/*
 * Supply Closet — design system.
 *
 * One token layer shared by the marketing site, the auth pages and all three
 * role apps, so a colour or a radius is defined exactly once. Loaded before any
 * page-specific stylesheet; pages override components, never tokens.
 *
 * No web fonts and no external assets by design: the app is a PWA that has to
 * work offline in a cupboard with no signal, and a blocked font request is a
 * layout shift at best.
 */

:root {
  /* ── surfaces ─────────────────────────────────────────────────────────── */
  --bg: #faf9f6;
  --bg-alt: #f3f1ea;
  --surface: #ffffff;
  --surface-2: #f2f0ea;
  --surface-3: #e8e5db;

  /* ── ink ──────────────────────────────────────────────────────────────── */
  --text: #14171a;
  --text-2: #3f464e;
  --muted: #6b7280;
  --faint: #97a0ad;

  /* ── lines ────────────────────────────────────────────────────────────── */
  --line: #e3dfd5;
  --line-strong: #cdc7b9;

  /* ── brand ────────────────────────────────────────────────────────────── */
  --accent: #14705c;
  --accent-hover: #0f5a4a;
  --accent-soft: #e4f1ec;
  --accent-line: #b6d8cc;
  --accent-text: #ffffff;

  /* ── status ───────────────────────────────────────────────────────────── */
  --danger: #b3261e;
  --danger-soft: #fbeceb;
  --danger-line: #eec4c1;
  --warn-bg: #fdf3e0;
  --warn-line: #e8caa0;
  --warn-text: #85560f;
  --ok: #1a7f4f;
  --ok-soft: #e6f4ec;

  /* ── type ─────────────────────────────────────────────────────────────── */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-num: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --fs-display: clamp(2.35rem, 1.4rem + 3.6vw, 3.9rem);
  --fs-h1: clamp(1.85rem, 1.3rem + 2.1vw, 2.6rem);
  --fs-h2: clamp(1.4rem, 1.15rem + 1vw, 1.8rem);
  --fs-h3: 1.15rem;
  --fs-body: 1rem;
  --fs-sm: 0.9rem;
  --fs-xs: 0.8rem;

  /* ── space ────────────────────────────────────────────────────────────── */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  /* ── form ─────────────────────────────────────────────────────────────── */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;

  --shadow-sm: 0 1px 2px rgba(20, 23, 26, .06), 0 1px 3px rgba(20, 23, 26, .04);
  --shadow: 0 2px 4px rgba(20, 23, 26, .05), 0 6px 16px rgba(20, 23, 26, .07);
  --shadow-lg: 0 8px 20px rgba(20, 23, 26, .09), 0 24px 48px rgba(20, 23, 26, .11);

  --tabbar-h: 62px;
  --sidebar-w: 232px;
  --ease: cubic-bezier(.2, .7, .3, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1319;
    --bg-alt: #131922;
    --surface: #171d25;
    --surface-2: #1f2630;
    --surface-3: #29313d;

    --text: #eceef1;
    --text-2: #bcc3cd;
    --muted: #8b95a3;
    --faint: #6b7684;

    --line: #29313d;
    --line-strong: #3b4655;

    --accent: #45c9a4;
    --accent-hover: #5cd7b4;
    --accent-soft: #10261f;
    --accent-line: #1d4437;
    --accent-text: #05110c;

    --danger: #f28b86;
    --danger-soft: #2b1917;
    --danger-line: #573330;
    --warn-bg: #2e2415;
    --warn-line: #5f4a22;
    --warn-text: #efc781;
    --ok: #4cc98a;
    --ok-soft: #10251a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 2px 6px rgba(0, 0, 0, .45), 0 10px 24px rgba(0, 0, 0, .35);
    --shadow-lg: 0 10px 24px rgba(0, 0, 0, .5), 0 30px 60px rgba(0, 0, 0, .45);

    color-scheme: dark;
  }
}

/* ────────────────────────────────── reset ──────────────────────────────── */

* { box-sizing: border-box; }

/* Author `display` rules outrank the UA stylesheet's [hidden] rule, so hiding a
   .field or .row would otherwise do nothing. Make the attribute authoritative. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-body)/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.15; letter-spacing: -0.018em; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }

img, svg { max-width: 100%; }
svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ───────────────────────────────── buttons ─────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: 11px 18px;
  font: 600 var(--fs-body)/1 var(--font);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .16s var(--ease), border-color .16s var(--ease),
              transform .12s var(--ease), box-shadow .16s var(--ease);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; }

.btn-primary {
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/*
 * Secondary, not invisible. The apps use .btn-ghost wherever they want a
 * button that isn't the primary action — next to Camera, beside Cancel — and a
 * borderless one there reads as a link and gets missed. .btn-quiet is the
 * genuinely chromeless variant for toolbars.
 */
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-strong); }

.btn-quiet { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-quiet:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { color: var(--danger); border-color: var(--danger-line); background: var(--danger-soft); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn-lg { padding: 15px 26px; font-size: 1.05rem; border-radius: var(--radius-lg); }
.btn-sm { padding: 8px 13px; font-size: var(--fs-sm); border-radius: var(--radius-sm); }
.btn-block { width: 100%; }

.link-btn {
  padding: 0; font: 600 var(--fs-sm)/1.4 var(--font);
  color: var(--accent); background: none; border: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}

/* ───────────────────────────────── inputs ──────────────────────────────── */

.input, .select, textarea.input {
  width: 100%;
  padding: 12px 14px;
  font: var(--fs-body)/1.4 var(--font);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.label {
  display: block; margin-bottom: 6px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-2);
}
.hint { font-size: var(--fs-xs); color: var(--muted); }

/* ──────────────────────────── surfaces & chrome ────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.badge-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .01em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
}
.badge-pill.is-muted { color: var(--muted); background: var(--surface-2); border-color: var(--line); }

.eyebrow {
  font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent);
}

.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 var(--s5); }
@media (max-width: 640px) { .wrap { padding: 0 var(--s4); } }

/* Brand lockup — an inline SVG mark so it works offline and inherits colour. */
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em;
  color: var(--text); text-decoration: none;
}
.brand .mark {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  color: var(--accent-text); background: var(--accent);
  border-radius: 9px;
}
.brand .mark svg { width: 18px; height: 18px; stroke-width: 2; }
