/* ==========================================================================
   AJ App ERP — Polish
   Three visual directions share one structural backbone.
   Each direction overrides tokens via [data-dir="a|b|c"][data-theme="light|dark"]
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

:root {
  color-scheme: light;
  --app-h: 100vh;
}

/* ---------- DIRECTION A · Refined Enterprise (default) ---------- */
[data-dir="a"] {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r-sm: 6px;  --r-md: 8px;  --r-lg: 12px;  --r-xl: 16px;
  --gap: 16px;
  --row-h: 40px;
  --fs-xs: 11px; --fs-sm: 12.5px; --fs-md: 13.5px; --fs-lg: 15px; --fs-xl: 20px; --fs-2xl: 28px; --fs-3xl: 36px;
  --tracking-caps: 0.06em;
}
[data-dir="a"][data-theme="light"] {
  --bg: oklch(99% 0.003 280);
  --bg-1: oklch(98% 0.004 280);
  --bg-2: oklch(96% 0.006 280);
  --surface: #ffffff;
  --surface-2: oklch(98.5% 0.003 280);
  --border: oklch(92% 0.005 280);
  --border-strong: oklch(85% 0.008 280);
  --fg: oklch(20% 0.02 280);
  --fg-muted: oklch(45% 0.02 280);
  --fg-dim: oklch(60% 0.015 280);
  --accent: oklch(55% 0.21 285);
  --accent-fg: #ffffff;
  --accent-soft: oklch(95% 0.04 285);
  --accent-soft-fg: oklch(40% 0.15 285);
  --pos: oklch(60% 0.15 150);
  --pos-soft: oklch(95% 0.05 150);
  --neg: oklch(60% 0.2 25);
  --neg-soft: oklch(95% 0.04 25);
  --warn: oklch(72% 0.15 75);
  --warn-soft: oklch(96% 0.05 85);
  --shadow-sm: 0 1px 2px oklch(20% 0.02 280 / .06);
  --shadow-md: 0 2px 8px oklch(20% 0.02 280 / .06), 0 1px 2px oklch(20% 0.02 280 / .04);
}
[data-dir="a"][data-theme="dark"] {
  /* Greyscale — lighter mid-grey, easy on the eyes */
  --bg: oklch(38% 0 0);
  --bg-1: oklch(42% 0 0);
  --bg-2: oklch(46% 0 0);
  --surface: oklch(44% 0 0);
  --surface-2: oklch(48% 0 0);
  --border: oklch(54% 0 0);
  --border-strong: oklch(62% 0 0);
  --fg: oklch(97% 0 0);
  --fg-muted: oklch(82% 0 0);
  --fg-dim: oklch(70% 0 0);
  --accent: oklch(72% 0.04 280);             /* barely-there purple tint */
  --accent-fg: oklch(18% 0 0);
  --accent-soft: oklch(32% 0.02 280);
  --accent-soft-fg: oklch(82% 0.04 280);
  --pos: oklch(72% 0.07 150);                /* muted green */
  --pos-soft: oklch(30% 0.03 150);
  --neg: oklch(70% 0.09 25);                 /* muted coral */
  --neg-soft: oklch(30% 0.04 25);
  --warn: oklch(78% 0.08 85);
  --warn-soft: oklch(30% 0.03 85);
  --shadow-sm: 0 1px 2px #0006;
  --shadow-md: 0 4px 14px #0006, 0 1px 2px #0008;
}

/* ---------- DIRECTION B · Warm Editorial ---------- */
[data-dir="b"] {
  --font-sans: "Inter Tight", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Instrument Serif", "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --r-sm: 4px; --r-md: 8px; --r-lg: 14px; --r-xl: 20px;
  --gap: 20px;
  --row-h: 52px;
  --fs-xs: 11px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 22px; --fs-2xl: 34px; --fs-3xl: 52px;
  --tracking-caps: 0.12em;
}
[data-dir="b"][data-theme="light"] {
  --bg: oklch(97.5% 0.008 70);           /* warm bone */
  --bg-1: oklch(96% 0.012 70);
  --bg-2: oklch(93% 0.015 70);
  --surface: oklch(99% 0.005 70);
  --surface-2: oklch(97% 0.01 70);
  --border: oklch(90% 0.012 70);
  --border-strong: oklch(80% 0.02 70);
  --fg: oklch(22% 0.02 40);
  --fg-muted: oklch(45% 0.025 50);
  --fg-dim: oklch(60% 0.02 60);
  --accent: oklch(55% 0.13 35);           /* terracotta/clay */
  --accent-fg: oklch(98% 0.01 70);
  --accent-soft: oklch(93% 0.04 40);
  --accent-soft-fg: oklch(40% 0.11 35);
  --pos: oklch(55% 0.11 150);
  --pos-soft: oklch(93% 0.04 150);
  --neg: oklch(55% 0.17 25);
  --neg-soft: oklch(93% 0.04 25);
  --warn: oklch(65% 0.13 75);
  --warn-soft: oklch(94% 0.05 80);
  --shadow-sm: 0 1px 0 oklch(30% 0.02 40 / .05);
  --shadow-md: 0 10px 30px oklch(30% 0.02 40 / .06), 0 1px 0 oklch(30% 0.02 40 / .04);
}
[data-dir="b"][data-theme="dark"] {
  /* Greyscale — lighter mid-grey, warm feel via accent only */
  --bg: oklch(40% 0 0);
  --bg-1: oklch(44% 0 0);
  --bg-2: oklch(48% 0 0);
  --surface: oklch(46% 0 0);
  --surface-2: oklch(50% 0 0);
  --border: oklch(56% 0 0);
  --border-strong: oklch(64% 0 0);
  --fg: oklch(97% 0 0);
  --fg-muted: oklch(82% 0 0);
  --fg-dim: oklch(70% 0 0);
  --accent: oklch(72% 0.05 35);              /* whisper-terracotta */
  --accent-fg: oklch(20% 0 0);
  --accent-soft: oklch(32% 0.03 35);
  --accent-soft-fg: oklch(82% 0.05 35);
  --pos: oklch(70% 0.06 150);
  --pos-soft: oklch(30% 0.03 150);
  --neg: oklch(70% 0.07 25);
  --neg-soft: oklch(30% 0.03 25);
  --warn: oklch(75% 0.07 85);
  --warn-soft: oklch(30% 0.03 85);
  --shadow-sm: 0 1px 2px #0006;
  --shadow-md: 0 10px 30px #0007;
}

/* ---------- DIRECTION C · Dense Pro Tool ---------- */
[data-dir="c"] {
  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --r-sm: 3px; --r-md: 4px; --r-lg: 6px; --r-xl: 8px;
  --gap: 10px;
  --row-h: 30px;
  --fs-xs: 10.5px; --fs-sm: 11.5px; --fs-md: 12.5px; --fs-lg: 13.5px; --fs-xl: 16px; --fs-2xl: 22px; --fs-3xl: 28px;
  --tracking-caps: 0.08em;
}
[data-dir="c"][data-theme="light"] {
  --bg: oklch(98% 0.003 240);
  --bg-1: oklch(96% 0.004 240);
  --bg-2: oklch(94% 0.006 240);
  --surface: #ffffff;
  --surface-2: oklch(97% 0.004 240);
  --border: oklch(90% 0.006 240);
  --border-strong: oklch(80% 0.01 240);
  --fg: oklch(18% 0.015 240);
  --fg-muted: oklch(42% 0.018 240);
  --fg-dim: oklch(58% 0.015 240);
  --accent: oklch(55% 0.16 240);            /* slate-blue */
  --accent-fg: #ffffff;
  --accent-soft: oklch(94% 0.04 240);
  --accent-soft-fg: oklch(38% 0.14 240);
  --pos: oklch(55% 0.15 150);
  --pos-soft: oklch(94% 0.05 150);
  --neg: oklch(58% 0.2 25);
  --neg-soft: oklch(94% 0.05 25);
  --warn: oklch(70% 0.15 75);
  --warn-soft: oklch(96% 0.05 80);
  --shadow-sm: 0 0 0 1px oklch(90% 0.006 240);
  --shadow-md: 0 0 0 1px oklch(90% 0.006 240);
}
[data-dir="c"][data-theme="dark"] {
  /* Greyscale — lighter neutral, Bloomberg-grey trading terminal feel */
  --bg: oklch(39% 0 0);
  --bg-1: oklch(43% 0 0);
  --bg-2: oklch(47% 0 0);
  --surface: oklch(45% 0 0);
  --surface-2: oklch(49% 0 0);
  --border: oklch(55% 0 0);
  --border-strong: oklch(64% 0 0);
  --fg: oklch(97% 0 0);
  --fg-muted: oklch(82% 0 0);
  --fg-dim: oklch(68% 0 0);
  --accent: oklch(72% 0.05 240);             /* barely-blue, desaturated */
  --accent-fg: oklch(18% 0 0);
  --accent-soft: oklch(32% 0.03 240);
  --accent-soft-fg: oklch(82% 0.06 240);
  --pos: oklch(72% 0.07 150);
  --pos-soft: oklch(30% 0.03 150);
  --neg: oklch(70% 0.08 25);
  --neg-soft: oklch(30% 0.03 25);
  --warn: oklch(78% 0.08 85);
  --warn-soft: oklch(30% 0.03 85);
  --shadow-sm: 0 0 0 1px oklch(55% 0 0);
  --shadow-md: 0 0 0 1px oklch(55% 0 0);
}

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- FOREST theme (all directions) — autumn forest: mossy greens, rusts, tans ---------- */
[data-theme="forest"] {
  /* Deep loamy soil backgrounds — warmer (hue ~70, yellow-olive) not pine green */
  --bg: oklch(18% 0.022 65);
  --bg-1: oklch(22% 0.028 65);
  --bg-2: oklch(27% 0.034 70);
  --surface: oklch(24% 0.03 68);
  --surface-2: oklch(29% 0.038 70);
  /* Visible borders — a warm moss green that reads clearly against the backgrounds */
  --border: oklch(42% 0.055 115);
  --border-strong: oklch(55% 0.075 115);
  /* Foreground — parchment/bone */
  --fg: oklch(94% 0.03 85);
  --fg-muted: oklch(75% 0.05 80);
  --fg-dim: oklch(60% 0.055 75);
  /* Primary accent — autumn rust/amber (like maple leaves) */
  --accent: oklch(68% 0.16 55);
  --accent-fg: oklch(18% 0.03 55);
  --accent-soft: oklch(32% 0.08 55);
  --accent-soft-fg: oklch(85% 0.12 60);
  /* Status colors — ripe fall palette */
  --pos: oklch(72% 0.14 125);           /* mossy green */
  --pos-soft: oklch(28% 0.07 125);
  --neg: oklch(62% 0.18 30);            /* deep burnt-orange red (oxblood) */
  --neg-soft: oklch(28% 0.08 30);
  --warn: oklch(78% 0.15 75);           /* goldenrod */
  --warn-soft: oklch(30% 0.08 75);
  --shadow-sm: 0 0 0 1px oklch(42% 0.055 115);
  --shadow-md: 0 4px 14px #0008, 0 1px 2px #0008;
}
[data-dir="c"][data-theme="forest"] {
  --shadow-sm: 0 0 0 1px oklch(55% 0.075 115);
  --shadow-md: 0 0 0 1px oklch(55% 0.075 115);
}

.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  transition: grid-template-columns .22s cubic-bezier(.4,0,.2,1);
}
.app[data-collapsed="true"] {
  grid-template-columns: 56px 1fr;
}

/* Selection */
::selection { background: var(--accent-soft); color: var(--accent-soft-fg); }

/* Scrollbar */
.scroll { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* Utility */
.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1, "zero" 1; }
.tnum { font-variant-numeric: tabular-nums; }
.caps { text-transform: uppercase; letter-spacing: var(--tracking-caps); font-size: var(--fs-xs); color: var(--fg-dim); font-weight: 600; }
.hr { height: 1px; background: var(--border); border: 0; margin: 0; }
.divider-v { width: 1px; background: var(--border); align-self: stretch; }

/* ==========================================================================
   Shared UI primitives: cards, badges, tables, inputs, buttons, sparklines.
   Cross-direction — tokens handle the look differences.
   ========================================================================== */

.btn {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--bg-2); }
.btn--primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
}
.btn--primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--fg-muted); }
.btn--ghost:hover { background: var(--bg-2); color: var(--fg); }
.btn--sm { height: 26px; padding: 0 10px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn--xs { height: 22px; padding: 0 6px; font-size: 11px; border-radius: var(--r-sm); gap: 4px; }
[data-dir="c"] .btn { border-radius: var(--r-sm); font-weight: 500; }
[data-dir="b"] .btn { border-radius: 999px; padding: 0 18px; height: 36px; }
[data-dir="b"] .btn--sm { height: 28px; padding: 0 12px; }

.input {
  height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0 10px;
  color: var(--fg);
  font-size: var(--fs-sm);
  outline: none;
  min-width: 0;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
[data-dir="c"] .input { border-radius: var(--r-sm); height: 28px; }
[data-dir="b"] .input { border-radius: 999px; height: 36px; padding: 0 14px; }

/* Multi-line variant for textareas — overrides the fixed height + padding so
   `rows` actually controls visible lines, and adds inner padding native to
   block text input. */
textarea.input,
.input--multiline {
  height: auto;
  min-height: 80px;
  width: 100%;
  display: block;
  padding: 10px 12px;
  line-height: 1.5;
  font-family: inherit;
  resize: vertical;
}
[data-dir="b"] textarea.input,
[data-dir="b"] .input--multiline {
  border-radius: var(--r-md);
  padding: 10px 14px;
  height: auto;
}
[data-dir="c"] textarea.input,
[data-dir="c"] .input--multiline {
  height: auto;
  min-height: 72px;
  padding: 8px 10px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card__header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.card__header h3 {
  margin: 0; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.005em;
}
.card__body { padding: 14px 16px; }
.card__footer { padding: 10px 16px; border-top: 1px solid var(--border); color: var(--fg-muted); font-size: var(--fs-sm); }
[data-dir="c"] .card { border-radius: var(--r-sm); box-shadow: none; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--bg-2);
  color: var(--fg-muted);
  white-space: nowrap;
}
.badge--accent { background: var(--accent-soft); color: var(--accent-soft-fg); }
.badge--pos { background: var(--pos-soft); color: var(--pos); }
.badge--neg { background: var(--neg-soft); color: var(--neg); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--outline { background: transparent; border: 1px solid var(--border-strong); color: var(--fg-muted); }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
[data-dir="c"] .badge { border-radius: var(--r-sm); font-weight: 500; letter-spacing: 0.02em; text-transform: none; font-family: var(--font-mono); font-size: 10px; }

/* Stat Cards */
.stats { display: grid; gap: var(--gap); }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow-sm);
}
.stat__label {
  font-size: 10.5px;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-dim);
  font-weight: 600;
}
.stat__value {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--fg);
}
.stat__meta { font-size: var(--fs-xs); color: var(--fg-muted); display: flex; align-items: center; gap: 6px; }
.stat__delta { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-mono); font-size: 11px; }
.stat__delta--pos { color: var(--pos); }
.stat__delta--neg { color: var(--neg); }
.stat__spark { height: 34px; margin-top: 4px; }
[data-dir="b"] .stat { border-radius: var(--r-xl); padding: 22px 24px; }
[data-dir="b"] .stat__value { font-size: var(--fs-3xl); font-weight: 400; letter-spacing: -0.03em; }
[data-dir="c"] .stat { border-radius: var(--r-sm); padding: 10px 12px; box-shadow: none; }
[data-dir="c"] .stat__value { font-family: var(--font-mono); font-size: 20px; font-weight: 500; }

/* Tables */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
}
.tbl th, .tbl td {
  text-align: left;
  padding: 10px 12px;
  min-height: var(--row-h);
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}
.tbl th { padding: 0 12px; height: var(--row-h); }
.tbl th {
  font-size: 10px;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-dim);
  font-weight: 600;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--bg-1); }

/* Paid invoice rows — soft blue shading like the legacy app; fades other rows to draw eye to unpaid ones */
.inv-row--paid { background: color-mix(in oklch, #2563eb 10%, var(--surface)); }
.inv-row--paid:hover { background: color-mix(in oklch, #2563eb 16%, var(--surface)); }
[data-theme="grey"] .inv-row--paid,
[data-theme="forest"] .inv-row--paid { background: color-mix(in oklch, #2563eb 14%, var(--surface)); }
[data-theme="grey"] .inv-row--paid:hover,
[data-theme="forest"] .inv-row--paid:hover { background: color-mix(in oklch, #2563eb 22%, var(--surface)); }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--font-mono); }
.tbl td.muted { color: var(--fg-muted); }
[data-dir="c"] .tbl { font-size: var(--fs-sm); }
[data-dir="c"] .tbl th { font-size: 9.5px; background: var(--bg-2); }
[data-dir="b"] .tbl th { font-size: 10px; background: transparent; border-bottom: 1px solid var(--border-strong); }
[data-dir="b"] .tbl tbody tr:hover { background: var(--bg-1); }

/* Section title + divider header */
.section-title {
  display: flex; align-items: baseline; gap: 10px; margin: 20px 0 12px;
}
.section-title h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.015em;
}
[data-dir="b"] .section-title h2 { font-weight: 400; letter-spacing: -0.02em; font-size: calc(var(--fs-xl) + 4px); }
.section-title .muted { color: var(--fg-muted); font-size: var(--fs-sm); }

/* Page title */
.page-title {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.page-title h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
[data-dir="b"] .page-title h1 { font-weight: 400; letter-spacing: -0.04em; font-style: italic; }
[data-dir="c"] .page-title h1 { font-size: var(--fs-xl); font-weight: 600; }
.page-title__sub { color: var(--fg-muted); margin-top: 6px; font-size: var(--fs-sm); }

/* Filter chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--fg-muted);
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
}
.chip:hover { background: var(--bg-2); color: var(--fg); }
.chip--active { background: var(--fg); color: var(--bg); border-color: transparent; }
[data-dir="b"] .chip--active { background: var(--accent); color: var(--accent-fg); }
[data-dir="c"] .chip { border-radius: var(--r-sm); height: 24px; font-family: var(--font-mono); }

/* Avatar group */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  color: var(--fg);
  background: var(--bg-2);
  border: 1px solid var(--border);
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  flex: none;
}
.avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.avatar--lg { width: 44px; height: 44px; font-size: 15px; }
[data-dir="c"] .avatar { border-radius: var(--r-sm); }

/* Progress bar */
.bar { height: 4px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.bar__fill { height: 100%; background: var(--accent); border-radius: 999px; }
.bar__fill--pos { background: var(--pos); }
.bar__fill--warn { background: var(--warn); }

/* Kbd */
.kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--fg-muted);
}

/* Swatches (color dots for color/fabric columns) */
.swatch {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: inline-block;
  vertical-align: middle;
  flex: none;
}

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 12px;
  font-size: var(--fs-sm);
  color: var(--fg-muted);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.tab:hover { color: var(--fg); }
.tab--active {
  color: var(--fg);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ==========================================================================
   Sales Order specific
   ========================================================================== */

/* Fulfillment dot — list view status */
.ff-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; flex: none; vertical-align: middle;
  position: relative;
}
.ff-dot--full    { background: var(--pos); }
.ff-dot--partial { background: conic-gradient(var(--warn) 0 50%, var(--bg-2) 50% 100%); border:1px solid var(--warn); }
.ff-dot--pending { background: var(--bg-2); border: 1px solid var(--border-strong); }
.ff-dot--draft   { background: transparent; border: 1.5px dashed var(--border-strong); }
.ff-dot--voided  { background: var(--neg-soft); border: 1px solid var(--neg); }

/* Line rows in the SO detail */
.so-line {
  display: grid;
  grid-template-columns: 22px 38px 90px 1fr 110px 70px 64px 74px 54px 76px 82px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  transition: background .1s;
}
.so-line:hover { background: var(--bg-1); }
/* Fulfilled (has invoice#) — tinted in the accent-soft to signal "locked + invoiced" */
.so-line--fulfilled { background: var(--accent-soft); }
.so-line--fulfilled:hover { background: var(--accent-soft); filter: brightness(0.98); }
/* Out of stock on an invoiced order — white + left border flag so it stands out */
.so-line--oos {
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--warn);
}
.so-line--oos:hover { background: var(--bg-1); }

/* Pack + Qty pills inside line rows and search results */
.so-pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.so-pill--pack { background: oklch(92% 0.08 25); color: oklch(32% 0.12 25); }
[data-theme="dark"] .so-pill--pack  { background: oklch(32% 0.04 25); color: oklch(82% 0.08 25); }
[data-theme="forest"] .so-pill--pack { background: oklch(32% 0.04 25); color: oklch(82% 0.08 25); }
.so-pill--qty  { background: oklch(92% 0.06 190); color: oklch(30% 0.1 200); }
[data-theme="dark"] .so-pill--qty { background: oklch(32% 0.03 190); color: oklch(82% 0.06 190); }
[data-theme="forest"] .so-pill--qty { background: oklch(32% 0.03 190); color: oklch(82% 0.06 190); }
.so-pill--qty input { all: unset; width: 32px; text-align: right; font-variant-numeric: tabular-nums; font: inherit; color: inherit; }

/* Inline QTY input used in line rows (smaller than pill) */
.so-qty-input {
  width: 52px; height: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  text-align: right; padding: 0 6px;
  font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 600;
  color: var(--fg); outline: none;
}
.so-qty-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* Invoice link chip */
.so-inv-link {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  color: var(--accent);
  padding: 3px 6px;
  border-radius: var(--r-sm);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
}
.so-inv-link:hover { background: var(--accent-soft); color: var(--accent-soft-fg); }
.so-inv-blank {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--warn);
  font-weight: 600;
  padding: 3px 6px;
  border-radius: var(--r-sm);
  background: var(--warn-soft);
  white-space: nowrap;
}

/* Totals rail — docked right card on the detail page */
.so-totals {
  position: sticky; top: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 0;
  overflow: hidden;
}
.so-totals__row { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.so-totals__row:last-of-type { border-bottom: 0; }
.so-totals__row span:first-child { color: var(--fg-muted); flex: 1; }
.so-totals__row .amt { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.so-totals__hero { padding: 14px; background: var(--bg-1); border-bottom: 1px solid var(--border); }
.so-totals__hero .amt { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.02em; }
[data-dir="b"] .so-totals__hero .amt { font-weight: 400; font-style: italic; }
[data-dir="c"] .so-totals__hero .amt { font-family: var(--font-mono); font-weight: 500; }
.so-totals__card {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--fg-muted);
}

/* Search dropdown overlay on the SO detail */
.so-search-panel {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: 0 10px 40px #0003, 0 2px 8px #0002;
  margin-top: 6px;
  overflow: hidden;
}
.so-search-panel__header {
  display: grid; grid-template-columns: 160px 1fr; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-dim);
  font-weight: 600;
}
.so-search-result {
  display: grid; grid-template-columns: 48px 160px 1fr;
  gap: 14px; padding: 10px 12px; align-items: center;
  border-bottom: 1px solid var(--border);
}
.so-search-result:last-child { border-bottom: 0; }
.so-search-result__color {
  display: grid; grid-template-columns: 1fr 74px 64px;
  gap: 10px; align-items: center;
  padding: 6px 12px 6px 0;
}

/* Bottom bar sticky in detail page */
.so-mini-bar {
  position: fixed; left: 260px; bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 10px 14px;
  box-shadow: 0 6px 24px #00000033;
  display: flex; gap: 16px; align-items: center;
  font-size: var(--fs-xs);
  z-index: 50;
}
.so-mini-bar .amt { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 700; color: var(--fg); }


/* ===== omni-search.css inlined here — separate file flakes on dev CDN ===== */
/* ==========================================================================
   Omni Search — global ⌘K palette in topbar
   ========================================================================== */

.om {
  position: relative;
  width: 360px;
  max-width: 100%;
}

/* ── Bar ─────────────────────────────────────────────────────────────────── */
.om__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-2);
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.om--open .om__bar,
.om__bar:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 18%, transparent);
}
.om__icon { color: var(--fg-dim); flex: 0 0 auto; }
.om__input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: var(--fg);
  font-size: var(--fs-sm);
  min-width: 0;
}
.om__input::placeholder { color: var(--fg-dim); }
.om__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
}
.om__clear:hover { background: var(--bg-1); color: var(--fg); }
.om__kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--fg-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  flex: 0 0 auto;
}

/* ── Panel ───────────────────────────────────────────────────────────────── */
.om__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  width: min(880px, 96vw);
  max-height: min(72vh, 720px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md), 0 14px 40px oklch(20% 0.02 280 / .12);
  z-index: 50;
  padding: 10px;
  animation: omfade .14s ease-out;
}
@keyframes omfade {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Sections (shared) ──────────────────────────────────────────────────── */
.om__section { padding: 6px 4px 10px; }
.om__section + .om__section { border-top: 1px solid var(--border); margin-top: 6px; }
.om__section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px 6px;
}
.om__section-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
  color: var(--fg-dim);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.om__empty { padding: 4px 2px; }

.om__recent-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
  padding: 0 2px;
}
.om__recent {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: background .1s, border-color .1s;
}
.om__recent:hover,
.om__recent--active {
  background: var(--bg-2);
  border-color: var(--border-strong);
}
.om__recent-id {
  font-size: 10.5px;
  color: var(--fg-dim);
  font-weight: 500;
}
.om__recent-title {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--fg);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.om__recent-sub {
  font-size: 11px;
  color: var(--fg-muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hint chips ("try searching for") */
.om__hint-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 2px;
}
.om__hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: background .1s, border-color .1s;
}
.om__hint:hover { background: var(--bg-2); border-style: solid; }
.om__hint-label {
  font-size: 11px;
  color: var(--fg-muted);
}
.om__hint-example {
  font-size: 11px;
  color: var(--fg);
  font-weight: 500;
}

/* ── Exact-match banner ─────────────────────────────────────────────────── */
.om__exact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin: 0 2px 8px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1px solid color-mix(in oklch, var(--accent) 30%, var(--border));
  cursor: pointer;
  text-align: left;
  transition: background .1s, transform .1s;
}
.om__exact:hover,
.om__exact--active {
  background: color-mix(in oklch, var(--accent) 14%, var(--surface));
}
.om__exact-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.om__exact-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
  color: var(--accent-soft-fg);
}
.om__exact-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--fg);
}
.om__exact-sub {
  font-size: var(--fs-sm);
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.om__exact-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.om__exact-amount {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.om__enter {
  font-size: 10.5px;
  color: var(--fg-dim);
  font-weight: 500;
  white-space: nowrap;
}

/* ── Quick actions row ──────────────────────────────────────────────────── */
.om__actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
  padding: 0 2px;
}
.om__action {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: background .1s, border-color .1s;
}
.om__action:hover,
.om__action--active {
  background: var(--bg-2);
  border-color: var(--border-strong);
}
.om__action-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-soft-fg);
}
.om__action-title {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--fg);
}
.om__action-sub {
  grid-column: 2;
  font-size: 11px;
  color: var(--fg-muted);
}
.om__action-chev {
  grid-column: 3;
  grid-row: 1 / span 2;
  color: var(--fg-dim);
}

/* ── No results ─────────────────────────────────────────────────────────── */
.om__noresults {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 32px 16px;
  color: var(--fg-muted);
  text-align: center;
}
.om__noresults-sub {
  font-size: 11px;
  color: var(--fg-dim);
  max-width: 360px;
}

/* ── Result columns ─────────────────────────────────────────────────────── */
.om__cols {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  padding: 4px 2px 2px;
}
.om__col {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
  min-height: 0;
}
.om__col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.om__col-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
  color: var(--fg-muted);
}
.om__col-count {
  font-size: 10.5px;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}
.om__col-body {
  display: flex;
  flex-direction: column;
}

.om__row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background .08s;
}
.om__row:first-child { border-top: 0; }
.om__row:hover,
.om__row--active {
  background: var(--bg-2);
}
.om__row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.om__row-id {
  font-size: 10.5px;
  color: var(--fg-dim);
  font-weight: 500;
}
.om__row-title {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--fg);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.om__row-sub {
  font-size: 11px;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.om__row-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.om__row-metatext {
  font-size: 10.5px;
  color: var(--fg-dim);
}
.om__row-amount {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

/* ── Footer / tip line ──────────────────────────────────────────────────── */
.om__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--fg-dim);
}
.om__foot-keys {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.om__foot-key {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--fg-muted);
}

/* Reduced width when topbar is tight */
@media (max-width: 1100px) {
  .om { width: 280px; }
}

/* ==========================================================================
   AJ App — Pre-auth screens (Forgot / Reset password)
   Standalone, outside the app shell. Reuses base.css + ui.css tokens.
   ========================================================================== */

.auth-stage {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
  background:
    radial-gradient(1200px 520px at 50% -10%, var(--accent-soft) 0%, transparent 60%),
    var(--bg);
}

.auth-wrap {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 56px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
}

/* ── Brand lockup ─────────────────────────────────────────────────────── */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  justify-content: center;
}
.auth-logo {
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--accent-fg);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  flex: none;
  box-shadow: var(--shadow-sm);
}
[data-dir="b"] .auth-logo { border-radius: 50%; font-style: italic; }
.auth-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.auth-brand-name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; color: var(--fg); }
.auth-brand-sub  { font-size: 11.5px; color: var(--fg-dim); }

/* ── Card ─────────────────────────────────────────────────────────────── */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  padding: 30px 30px 26px;
}
[data-dir="c"] .auth-card { border-radius: var(--r-md); }

.auth-head { margin-bottom: 20px; }
.auth-head h1 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
[data-dir="b"] .auth-head h1 { font-weight: 400; font-style: italic; }
.auth-head p {
  margin: 0;
  color: var(--fg-muted);
  font-size: var(--fs-md);
  line-height: 1.5;
  text-wrap: pretty;
}

/* Icon badge above headings on status screens */
.auth-badge {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: grid; place-items: center;
  margin-bottom: 16px;
}
.auth-badge--accent { background: var(--accent-soft); color: var(--accent-soft-fg); }
.auth-badge--pos    { background: var(--pos-soft);    color: var(--pos); }
.auth-badge--warn   { background: var(--warn-soft);   color: var(--warn); }

/* ── Form pieces ──────────────────────────────────────────────────────── */
.auth-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.auth-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--fg);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.auth-label .opt { font-weight: 500; color: var(--fg-dim); font-size: var(--fs-xs); }

.auth-input-wrap { position: relative; display: flex; align-items: center; }
.auth-input-wrap .lead-ico {
  position: absolute; left: 11px;
  color: var(--fg-dim);
  pointer-events: none;
  display: flex;
}
.auth-input {
  width: 100%;
  height: 42px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 0 12px 0 38px;
  color: var(--fg);
  font-size: var(--fs-md);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
[data-dir="b"] .auth-input { border-radius: var(--r-md); }
[data-dir="c"] .auth-input { border-radius: var(--r-sm); height: 38px; }
.auth-input::placeholder { color: var(--fg-dim); }
.auth-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-input--err { border-color: var(--neg); }
.auth-input--err:focus { box-shadow: 0 0 0 3px var(--neg-soft); }
.auth-input.has-trail { padding-right: 64px; }

.auth-trail-btn {
  position: absolute; right: 8px;
  height: 28px; padding: 0 9px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--fg-muted);
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.auth-trail-btn:hover { color: var(--fg); background: var(--bg-1); }

.auth-help { font-size: var(--fs-xs); color: var(--fg-dim); line-height: 1.45; }
.auth-help--err { color: var(--neg); display: flex; align-items: center; gap: 5px; }

/* Primary / block button */
.auth-btn {
  width: 100%;
  height: 44px;
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-fg);
  border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: filter .12s, background .12s, opacity .12s;
}
.auth-btn:hover { filter: brightness(1.06); }
.auth-btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
[data-dir="b"] .auth-btn { border-radius: 999px; }
[data-dir="c"] .auth-btn { border-radius: var(--r-sm); height: 40px; }

.auth-btn--ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-strong);
}
.auth-btn--ghost:hover { background: var(--bg-2); filter: none; }

/* Checkbox + forgot row (sign-in) */
.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.auth-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--fg-muted);
  cursor: pointer;
  user-select: none;
}
.auth-check input {
  appearance: none;
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  display: grid; place-items: center;
  cursor: pointer;
  flex: none;
  transition: background .12s, border-color .12s;
}
.auth-check input::after {
  content: "";
  width: 9px; height: 9px;
  transform: scale(0);
  transition: transform .12s;
  background: var(--accent-fg);
  clip-path: polygon(14% 47%, 0 61%, 40% 100%, 100% 22%, 85% 9%, 38% 71%);
}
.auth-check input:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.auth-check input:checked::after { transform: scale(1); }
.auth-check input:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); }

/* Inline links / secondary row */
.auth-alt {
  margin-top: 18px;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--fg-muted);
}
.auth-link {
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.auth-link:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Account context chip (reset screen) */
.auth-acct {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 18px;
  font-size: var(--fs-sm);
}
.auth-acct .avatar { width: 26px; height: 26px; font-size: 10px; }
.auth-acct b { color: var(--fg); font-weight: 600; }
.auth-acct span { color: var(--fg-muted); }

/* Email echo line on the "sent" screen */
.auth-echo {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--fg);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 9px 12px;
  margin-bottom: 18px;
  word-break: break-all;
}

/* Password policy checklist */
.auth-rules {
  list-style: none;
  margin: 4px 0 18px;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 14px;
}
.auth-rule {
  display: flex; align-items: center; gap: 7px;
  font-size: var(--fs-xs);
  color: var(--fg-dim);
  transition: color .12s;
}
.auth-rule .tick {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center;
  flex: none;
  color: transparent;
  transition: background .12s, border-color .12s, color .12s;
}
.auth-rule--ok { color: var(--fg); }
.auth-rule--ok .tick { background: var(--pos); border-color: var(--pos); color: #fff; }

/* Expiry / security note row */
.auth-note {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: var(--fs-xs);
  color: var(--fg-dim);
  line-height: 1.5;
  margin-top: 2px;
}
.auth-note .ico { flex: none; margin-top: 1px; color: var(--fg-dim); }

/* Inline alert banner (e.g. throttled) */
.auth-alert {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  line-height: 1.45;
  margin-bottom: 18px;
}
.auth-alert--warn { background: var(--warn-soft); color: var(--warn); }
.auth-alert--warn .ico { flex: none; margin-top: 1px; }
.auth-alert--neg { background: var(--neg-soft); color: var(--neg); }
.auth-alert--neg .ico { flex: none; margin-top: 1px; }
.auth-alert b { font-weight: 600; }

/* ── Footer ───────────────────────────────────────────────────────────── */
.auth-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
  padding: 18px 24px 26px;
  font-size: var(--fs-xs);
  color: var(--fg-dim);
}
.auth-foot .secure { display: inline-flex; align-items: center; gap: 6px; }

/* ── Prototype state switcher (NOT part of product) ───────────────────── */
.proto-switch {
  position: fixed;
  left: 50%; bottom: 16px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px;
  padding: 5px 6px 5px 10px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  z-index: 100;
  font-size: var(--fs-xs);
  max-width: calc(100vw - 24px);
  flex-wrap: wrap;
  justify-content: center;
}
.proto-switch__label {
  color: var(--fg-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-size: 9.5px;
  padding-right: 4px;
}
.proto-switch button {
  height: 24px; padding: 0 10px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--fg-muted);
  background: transparent;
}
.proto-switch button:hover { background: var(--bg-2); color: var(--fg); }
.proto-switch button.on { background: var(--fg); color: var(--bg); font-weight: 600; }

/* fade between screens */
.auth-fade { animation: authfade .22s ease-out; }
@keyframes authfade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* LISA-AUTH-HANDOFF-20260601 server-side additions */
.auth-icon{display:inline-grid;place-items:center;line-height:1}.auth-icon svg{display:block}.auth-card form{margin:0}.auth-inline-form{margin-top:0}.auth-btn[disabled]{opacity:.58;cursor:not-allowed}.auth-row .auth-link{text-align:right}.auth-error-list{margin:8px 0 0;padding-left:18px;color:var(--neg,#b42318);font-size:12px}.auth-meta-link{border:0;background:transparent;padding:0;font:inherit;cursor:pointer}.auth-done-redirect{margin-top:10px}.proto-switch{display:none!important}
