/* =========================================================================
   base.css — design tokens, reset, typography
   Pantry WMS · mobile-first · CSS Grid · no Tailwind
   Tokens derived from the approved graphic design references.
   ========================================================================= */

:root {
  /* --- Spacing scale (spec 4.2) --- */
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;

  /* --- Radius --- */
  --radius-sm: .5rem;
  --radius-md: .75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.375rem;
  --radius-pill: 99px;

  /* --- Type scale --- */
  --font: "Inter", "Segoe UI", Roboto, system-ui, -apple-system, Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Segoe UI Mono", Menlo, monospace;
  --font-size-xs: .75rem;
  --font-size-sm: .8125rem;
  --font-size-md: .9375rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.375rem;
  --font-size-2xl: 1.75rem;
  --font-size-3xl: 2rem;

  /* --- Surfaces & ink --- */
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #f6f8fc;
  --surface-sunken: #eef2f8;
  --ink: #162033;
  --ink-soft: #3a465c;
  --muted: #66758d;
  --muted-2: #7a879c;

  /* --- Lines --- */
  --border-color: #e3e8f1;
  --border-strong: #d2dae8;

  /* --- Brand --- */
  --brand: #16a46a;
  --brand-deep: #0c8a57;
  --brand-2: #196ad8;
  --brand-gradient: linear-gradient(135deg, #196ad8, #20b27b);

  /* --- Semantic status colors (text + soft bg pairs). Spec 4.2/4.4:
         always pair color with text, never color alone. --- */
  --status-ok: #16a46a;
  --status-ok-soft: #e8f7f0;
  --status-ok-ink: #08754b;

  --status-warning: #f39a22;
  --status-warning-soft: #fff3df;
  --status-warning-ink: #a45e07;

  --status-danger: #e04f5f;
  --status-danger-soft: #fff0f2;
  --status-danger-ink: #bc2538;

  --status-info: #2f75e0;
  --status-info-soft: #eaf2ff;
  --status-info-ink: #164c9e;

  --status-muted: #66758d;
  --status-muted-soft: #eef2f8;

  /* --- Elevation --- */
  --shadow-sm: 0 5px 16px rgba(26, 37, 62, .05);
  --shadow-soft: 0 8px 22px rgba(26, 37, 62, .06);
  --shadow-md: 0 14px 40px rgba(26, 37, 62, .08);
  --shadow-lg: 0 28px 90px rgba(22, 32, 51, .13);

  /* --- Layout metrics --- */
  --sidebar-w: 16rem;
  --header-h: 4.5rem;
  --bottomnav-h: 4rem;

  /* --- Density (spec 4.2): default comfortable.
         [data-density="compact"|"scanner"] override these. --- */
  --control-h: 2.75rem;
  --control-font: var(--font-size-md);
  --row-pad-y: var(--space-3);
}

[data-density="compact"] {
  --control-h: 2.25rem;
  --control-font: var(--font-size-sm);
  --row-pad-y: var(--space-2);
}

[data-density="scanner"] {
  --control-h: 3.5rem;
  --control-font: var(--font-size-lg);
  --row-pad-y: var(--space-4);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--font-size-md);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure { margin: 0; }

h1 { font-size: var(--font-size-2xl); font-weight: 850; letter-spacing: -.6px; line-height: 1.15; }
h2 { font-size: var(--font-size-xl); font-weight: 800; letter-spacing: -.3px; }
h3 { font-size: var(--font-size-lg); font-weight: 800; letter-spacing: -.2px; }

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

img, svg { max-width: 100%; display: block; }

/* Inline icon default size. Components that place icons in sized containers
   (.iconbox, .kpi__icon, .btn, .nav-item__icon …) override this via their own
   more specific selectors. Prevents an unsized icon from blowing out layout. */
svg { width: 1.15rem; height: 1.15rem; flex: none; }

ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: .1px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cdd6e4; border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #b8c3d6; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
