/* Assistix Inventory — design tokens + components (docs/UI.md → Design system, ADR-025).
   Dark-first: near-black ground, layered panels, navy-blue accent. The light theme (white ground,
   navy accent — ADR-016) lives under [data-theme="light"] and is a token swap only.
   Loaded after tabulator.min.css; the Tabulator overrides near the bottom retheme the grid.
   Class names are stable — pages depend on them; add new ones rather than renaming. */

/* UI typeface: Manrope (variable, vendored — nothing loads from the internet). Data in the
   sheet and tables stays in the system font (--font-data); see docs/UI.md → Design system. */
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/static/vendor/fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/static/vendor/fonts/manrope-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* brand navy (both themes) */
  --navy-900: #0a1f45;
  --navy-800: #0f2a55;
  --navy-700: #14356b;
  --navy-600: #1c4788;
  --navy-500: #2b62b0;
  --navy-400: #4f86d6;
  --navy-300: #8fb4e8;
  --navy-100: #dbe6f7;
  --navy-50:  #f0f5fd;

  /* accent: the brand navy lifted so it reads on a dark ground */
  --accent: #5b8def;
  --accent-2: #7ea6f5;
  --accent-3: #4f86d6;
  --accent-soft: rgba(91, 141, 239, 0.14);
  --accent-line: rgba(91, 141, 239, 0.38);
  --on-accent: #ffffff;

  /* surfaces */
  --bg: #0b0e13;
  --panel: #11151b;
  --panel-2: #171c24;
  --panel-3: #1e242e;
  --border: #1f2631;
  --border-strong: #2c3542;
  --sidebar-bg: #0d1117;
  --sidebar-border: #1a2029;

  /* type */
  --text: #dfe4ec;
  --text-strong: #f5f7fa;
  --muted: #8b95a7;
  --muted-2: #5f6a7d;

  /* status */
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.14);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.14);
  --grey: #9aa4b5;
  --grey-soft: rgba(154, 164, 181, 0.14);

  /* chart series (accent-led) */
  --c1: #5b8def;
  --c2: #8fb4ff;
  --c3: #34d399;
  --c4: #fbbf24;
  --c5: #a78bfa;
  --c6: #f472b6;
  --c7: #22d3ee;
  --c8: #fb923c;
  --chart-grid: rgba(255, 255, 255, 0.06);
  --chart-axis: rgba(255, 255, 255, 0.14);
  --chart-line: #e9edf3;           /* single-series graphs and sparklines are monochrome (ADR-026) */

  /* buttons: primary is inverted (white on dark), like the reference app */
  --btn-primary-bg: #f5f7fa;
  --btn-primary-fg: #0b0e13;

  --s-1: 2px;
  --s-2: 4px;
  --s-3: 8px;
  --s-4: 12px;
  --s-5: 16px;
  --s-6: 24px;
  --s-7: 32px;

  --radius: 9px;
  --radius-lg: 12px;
  --font-ui: "Manrope", -apple-system, "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
  --font-data: -apple-system, "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
  --font: var(--font-ui);
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, "SF Mono", Menlo, monospace;
  --fs: 13px;
  --row-h: 30px;
  --sidebar-w: 232px;
  --topbar-h: 54px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  --shadow-sm: none;
  --selection: rgba(91, 141, 239, 0.35);
  --scrollbar: #2c3542;

  /* motion (docs/UI.md → Motion; docs/DECISIONS.md ADR-021). Curves from animations.dev —
     built-in CSS easings are too weak. Never `ease-in` on UI, never `transition: all`. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-press: 160ms;    /* button press feedback */
  --dur-color: 120ms;    /* hover / colour changes (plain `ease`) */
  --dur-ui: 200ms;       /* small panels */
  --dur-modal: 250ms;    /* modal enter; exit is faster */
  --dur-toast: 400ms;    /* toasts, `ease`, deliberately a touch slower (Sonner) */

  color-scheme: dark;
}

/* Light theme (ADR-016): white ground, navy accent. Token swap only. */
:root[data-theme="light"] {
  --accent: var(--navy-700);
  --accent-2: var(--navy-600);
  --accent-3: var(--navy-500);
  --accent-soft: var(--navy-50);
  --accent-line: var(--navy-100);
  --on-accent: #ffffff;

  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --panel-3: #eef2f8;
  --border: #e2e8f1;
  --border-strong: #cdd7e5;
  --sidebar-bg: #ffffff;
  --sidebar-border: #e2e8f1;

  --text: #16202f;
  --text-strong: #0a1626;
  --muted: #66748c;
  --muted-2: #8d99ad;

  --ok: #0f9d63;
  --ok-soft: #e6f6ee;
  --warn: #b7791f;
  --warn-soft: #fdf3e2;
  --bad: #d13438;
  --bad-soft: #fdeceb;
  --info: #2b62b0;
  --info-soft: #eaf1fb;
  --grey: #6b7280;
  --grey-soft: #f1f3f7;

  --c1: #14356b;
  --c2: #2b62b0;
  --c3: #0f9d63;
  --c4: #b7791f;
  --c5: #7c4dbd;
  --c6: #c05621;
  --c7: #0e7490;
  --c8: #4f86d6;
  --chart-grid: rgba(10, 31, 69, 0.08);
  --chart-axis: rgba(10, 31, 69, 0.2);
  --chart-line: var(--navy-700);
  --btn-primary-bg: var(--navy-700);
  --btn-primary-fg: #ffffff;

  --shadow: 0 10px 30px rgba(10, 31, 69, 0.12);
  --shadow-sm: 0 1px 2px rgba(10, 31, 69, 0.06);
  --selection: var(--navy-100);
  --scrollbar: #cdd7e5;
  color-scheme: light;
}

/* ---- reset / base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }   /* hover underline is gated: see the motion block at the end */
h1, h2, h3, h4 { margin: 0; font-weight: 700; color: var(--text-strong); letter-spacing: -0.02em; }
table { border-collapse: collapse; }
::selection { background: var(--selection); }
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
svg.ic { width: 16px; height: 16px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.info { color: var(--info); }

/* ---- shell ------------------------------------------------------------- */
.shell { display: flex; min-height: 100%; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 var(--s-5); height: var(--topbar-h);
  color: var(--text-strong); text-decoration: none; flex: 0 0 auto;
  border-bottom: 1px solid var(--sidebar-border);
}
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--navy-500), var(--navy-800));
  color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.brand-name { font-weight: 700; letter-spacing: -0.01em; font-size: 14px; }
.nav { display: flex; flex-direction: column; padding: var(--s-4) var(--s-3); gap: 1px; overflow: auto; }
.nav-group { display: flex; flex-direction: column; gap: 1px; margin-bottom: var(--s-4); }
.nav-group-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted-2); padding: 6px var(--s-4) 4px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px var(--s-4); border-radius: var(--radius);
  color: var(--muted); text-decoration: none; font-weight: 550;
  position: relative;
}
.nav-link { transition: background-color var(--dur-color) ease, color var(--dur-color) ease; }
.nav-link .ic { color: var(--muted-2); transition: color var(--dur-color) ease; }
.nav-link:active { background: var(--panel-3); }
.nav-link.active { background: var(--panel-3); color: var(--text-strong); font-weight: 700; }
.nav-link.active .ic { color: var(--accent); }
.nav-link.soon { color: var(--muted-2); cursor: default; }
.nav-link.soon .ic { color: var(--muted-2); }
.nav-link .soon-tag { margin-left: auto; font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-2); display: inline-flex; align-items: center; gap: 4px; }
.nav-link .soon-tag .ic { width: 11px; height: 11px; }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--sidebar-border); padding: var(--s-4); }
.user-card { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--navy-500), var(--navy-800)); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 750; letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.user-text { min-width: 0; flex: 1 1 auto; }
.user-name { font-size: 12px; font-weight: 650; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-mail { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-toggle {
  appearance: none; border: 1px solid var(--border); background: transparent; color: var(--muted);
  width: 28px; height: 28px; border-radius: var(--radius); display: grid; place-items: center; cursor: pointer; flex: 0 0 auto;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-color) ease, color var(--dur-color) ease;
}
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle .ic-sun { display: block; }
.theme-toggle .ic-moon { display: none; }
:root[data-theme="light"] .theme-toggle .ic-sun { display: none; }
:root[data-theme="light"] .theme-toggle .ic-moon { display: block; }
.sidebar-version { font-size: 10px; color: var(--muted-2); margin-top: var(--s-3); padding-left: 40px; }
/* the user card is a button that opens a small menu (ADR-030) */
.user-card { position: relative; }
.user-btn { appearance: none; border: none; background: transparent; padding: 4px; margin: -4px; border-radius: var(--radius); display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.user-btn .user-text { display: flex; flex-direction: column; min-width: 0; }
.user-btn .user-name, .user-btn .user-mail { display: block; }
.user-btn:hover { background: var(--panel-2); }
.user-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: var(--s-2); z-index: 40; }
.user-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: var(--s-2); }
.user-menu-item { appearance: none; border: none; background: transparent; width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); color: var(--text); font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; text-align: left; }
.user-menu-item .ic { width: 16px; height: 16px; color: var(--muted); }
.user-menu-item:hover { background: var(--panel-2); color: var(--text-strong); }

.main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: var(--s-4);
  padding: 0 var(--s-6);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.search-form { flex: 1 1 420px; max-width: 520px; position: relative; }
.search-form .search-input { width: 100%; padding-left: 32px; background-color: var(--panel); }   /* outranks .input padding */
.search-form::before {
  content: ""; position: absolute; left: 11px; top: 50%; width: 13px; height: 13px; transform: translateY(-50%);
  border: 1.8px solid var(--muted-2); border-radius: 50%; box-sizing: border-box; pointer-events: none;
}
.search-form::after {
  content: ""; position: absolute; left: 21px; top: calc(50% + 4px); width: 6px; height: 1.8px; background: var(--muted-2);
  transform: rotate(45deg); pointer-events: none;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--s-3); }
.content { padding: var(--s-6); flex: 1 1 auto; min-height: 0; }

/* ---- page furniture ---------------------------------------------------- */
.page-head { display: flex; align-items: center; gap: var(--s-4); margin-bottom: var(--s-5); flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.page-sub { color: var(--muted); }
.page-head .page-text { display: flex; flex-direction: column; gap: 2px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s-5);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card-title {
  font-size: 13px; font-weight: 650; color: var(--text-strong); letter-spacing: -0.005em;
  margin-bottom: var(--s-4);
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
}
.card-title .right { margin-left: auto; font-weight: 500; font-size: 12px; }
.card-title .right.muted { color: var(--muted); }
.card-sub { display: block; font-size: 12px; color: var(--muted); font-weight: 450; margin-top: -8px; margin-bottom: var(--s-4); }
.card-title + .card-sub { margin-top: calc(-1 * var(--s-4) + 2px); }
.card-head { display: flex; align-items: flex-start; gap: var(--s-3); margin-bottom: var(--s-4); }
.card-head .card-title { margin-bottom: 0; }
.card-head .card-sub { margin: 2px 0 0; }
.card-head .card-text { flex: 1 1 auto; min-width: 0; }
.card-head .card-actions { margin-left: auto; display: flex; align-items: center; gap: var(--s-3); }
.card-text { font-size: 12px; line-height: 1.5; margin: 0 0 var(--s-4); }
.cards { display: grid; gap: var(--s-5); }
.view-all { font-size: 12px; font-weight: 550; color: var(--accent-2); white-space: nowrap; }

.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi-inline { display: flex; align-items: baseline; gap: var(--s-3); }
.lbl { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ---- controls ---------------------------------------------------------- */
.btn {
  appearance: none; border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text-strong);
  padding: 8px 14px; border-radius: var(--radius); font: inherit; font-weight: 600; font-size: 13px;
  cursor: pointer; line-height: 1.2; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn .ic { width: 15px; height: 15px; }
.btn .ic.ok { color: var(--ok); }
.btn .ic.bad { color: var(--bad); }
.btn {
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-color) ease,
              border-color var(--dur-color) ease, color var(--dur-color) ease;
}
.btn:active { background: var(--panel-3); transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--btn-primary-bg); border-color: var(--btn-primary-bg); color: var(--btn-primary-fg); }
.btn-danger { background: var(--panel-2); border-color: rgba(248, 113, 113, 0.35); color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn.on { background: var(--btn-primary-bg); border-color: var(--btn-primary-bg); color: var(--btn-primary-fg); }

/* segmented control: a dark well with a filled active segment */
.btn-group, .seg, .chips {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px;
}
.btn-group .btn, .seg .seg-btn, .chips .chip {
  appearance: none; border: none; background: transparent; color: var(--muted);
  padding: 5px 12px; border-radius: 7px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  line-height: 1.3; white-space: nowrap; margin: 0;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-color) ease, color var(--dur-color) ease;
}
.btn-group .btn:active, .seg .seg-btn:active, .chips .chip:active { transform: scale(0.97); }
.btn-group .btn.on, .seg .seg-btn.on, .chips .chip.on { background: var(--btn-primary-bg); color: var(--btn-primary-fg); position: relative; z-index: 1; }
.btn-group .btn:first-child, .btn-group .btn:last-child { border-radius: 7px; }

.input, .select, .textarea {
  appearance: none; border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text);
  padding: 8px 12px; border-radius: var(--radius); font: inherit; line-height: 1.25;
  transition: border-color var(--dur-color) ease, background-color var(--dur-color) ease;
}
.input:focus, .select:focus, .textarea:focus, .btn:focus-visible, .nav-link:focus-visible, .theme-toggle:focus-visible {
  outline: 2px solid var(--accent-line); outline-offset: 1px; border-color: var(--accent);
}
.input::placeholder { color: var(--muted-2); }
.select { padding-right: 26px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 14px) 12px, calc(100% - 9px) 12px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.select option { background: var(--panel-2); color: var(--text); }
.textarea { min-height: 72px; resize: vertical; width: 100%; }
.toggle { display: inline-flex; align-items: center; gap: var(--s-3); cursor: pointer; user-select: none; }
input[type="checkbox"] { accent-color: var(--accent); }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0.6; filter: invert(0.7); }
:root[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator { filter: none; }

.chip { }   /* segmented styles above */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-bottom: var(--s-5); }
.toolbar-group { display: inline-flex; align-items: center; gap: var(--s-3); }
.toolbar-spacer { flex: 1 1 auto; }
.toolbar-search { min-width: 240px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 650; letter-spacing: 0.02em; line-height: 1.5;
  background: var(--grey-soft); color: var(--grey); border: 1px solid transparent; white-space: nowrap;
}
.badge-available, .badge-pending { background: var(--grey-soft); color: var(--grey); }
.badge-listed { background: var(--warn-soft); color: var(--warn); }
.badge-sold, .badge-active { background: var(--ok-soft); color: var(--ok); }
.badge-cancelled, .badge-failed, .badge-refunded { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-partsold { background: var(--info-soft); color: var(--info); }        /* an order with some of its tickets sold */
.badge-partlisted { background: var(--warn-soft); color: var(--warn); }
/* status badges carry a dot; label badges (provider, "past", "2d") do not */
.badge-available::before, .badge-listed::before, .badge-sold::before, .badge-cancelled::before, .badge-refunded::before,
.badge-pending::before, .badge-active::before, .badge-failed::before, .badge-partsold::before, .badge-partlisted::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; opacity: 0.9;
}

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 550;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--border);
}
.pill-muted { background: var(--panel-2); color: var(--muted); }
.pill-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); display: inline-block; }
.dot-on { background: var(--ok); }

/* ---- tables ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; font-size: 13px; }
.table th {
  text-align: left; font-size: 12px;
  color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; font-family: var(--font-data); }
.table tbody tr { transition: background-color var(--dur-color) ease; }
.table tbody tr:last-child td { border-bottom: none; }
.table .right, .table th.right { text-align: right; }
.cell-2 { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cell-2 .primary { color: var(--text-strong); font-weight: 600; }
.cell-2 .secondary { color: var(--muted); font-size: 12px; }

/* ---- dashboard (ADR-029): a landing page — one headline, one chart, three cards, a table --- */
.dash { display: flex; flex-direction: column; gap: var(--s-6); }
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s-5); }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }
@media (max-width: 1280px) {
  .span-3 { grid-column: span 6; }
  .span-4, .span-5, .span-7, .span-8 { grid-column: span 12; }
  .span-6 { grid-column: span 12; }
}

/* hero: no card, just type on the ground. Large text is tracked tight and set on one line;
   the facts underneath are the numbers the headline was made from. */
.hero { padding: var(--s-6) var(--s-2) var(--s-4); }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-7, 36px); }
.hero-eyebrow { font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.hero-kicker { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0.01em; }
.hero-value {
  font-size: clamp(48px, 6.4vw, 84px); font-weight: 750; line-height: 1; letter-spacing: -0.035em;
  color: var(--text-strong); font-variant-numeric: tabular-nums; margin-top: 6px;
  font-feature-settings: "ss01"; transition: color var(--dur-color) ease;
}
.hero-value.ok { color: var(--ok); }
.hero-value.bad { color: var(--bad); }
.hero-foot { display: flex; align-items: center; gap: var(--s-3); margin-top: var(--s-4); font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }
.hero-story { color: var(--text); }
.hero-facts { display: flex; gap: var(--s-8, 48px); margin-top: var(--s-6); padding-top: var(--s-5); border-top: 1px solid var(--border); flex-wrap: wrap; }
.fact { display: flex; flex-direction: column; gap: 3px; min-width: 150px; }
.fact-l { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.fact-v { font-size: 24px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.025em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.fact-v.ok { color: var(--ok); }
.fact-v.bad { color: var(--bad); }
.fact-s { font-size: 12px; color: var(--muted-2); }
.delta { font-weight: 650; display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; }
.delta-up { color: var(--ok); background: var(--ok-soft); }
.delta-down { color: var(--bad); background: var(--bad-soft); }
.delta-flat { color: var(--muted); background: var(--grey-soft); }

/* the period control is a translucent material floating on the ground (Apple: chrome as a
   layer, content underneath), solid again when the user asks for less transparency */
.seg-glass { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.09); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); }
:root[data-theme="light"] .seg-glass { background: rgba(10, 31, 69, 0.05); border-color: rgba(10, 31, 69, 0.1); }
@media (prefers-reduced-transparency: reduce) { .seg-glass { background: var(--panel-2); backdrop-filter: none; -webkit-backdrop-filter: none; } }

.chart-card { padding-bottom: var(--s-4); }
.dash-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-5); }
@media (max-width: 1180px) { .dash-row { grid-template-columns: 1fr; } }
.alerts-strip { flex-direction: row; flex-wrap: wrap; }
.alerts-strip .alert-row { flex: 1 1 260px; }
.facts-table td { padding: 7px 0; border-bottom: 1px solid var(--border); }
.facts-table tr:last-child td { border-bottom: none; }

/* one reveal on load: sections rise 8px into place, staggered — never replayed */
@keyframes dash-reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.reveal { animation: dash-reveal 420ms var(--ease-out) both; }
.dash > .reveal:nth-child(2) { animation-delay: 50ms; }
.dash > .reveal:nth-child(3) { animation-delay: 100ms; }
.dash > .reveal:nth-child(4) { animation-delay: 150ms; }
.dash > .reveal:nth-child(5) { animation-delay: 200ms; }

.next-event {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
  color: #fff; border: none;
}
.next-event { display: flex; flex-direction: column; }
.next-event .card-title { color: rgba(255, 255, 255, 0.72); }
.next-event > div:last-child { flex: 1 1 auto; display: flex; flex-direction: column; }
.ne-link { margin-top: auto; padding-top: var(--s-5); }
.next-event a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.ne-name { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.ne-meta { color: rgba(255, 255, 255, 0.82); margin-top: 2px; }
.ne-count { display: flex; align-items: baseline; gap: var(--s-3); margin-top: var(--s-4); }
.ne-days { font-size: 42px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.ne-stats { display: flex; gap: var(--s-6); margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid rgba(255, 255, 255, 0.2); }
.ne-stat-v { font-size: 17px; font-weight: 700; }
.ne-stat-l { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(255, 255, 255, 0.66); }

.chart { width: 100%; display: block; overflow: visible; }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--s-4); margin-top: var(--s-4); font-size: 12px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.chart-empty { display: grid; place-items: center; min-height: 140px; color: var(--muted-2); font-size: 12px; }
.chart-tip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--panel-3); color: var(--text-strong); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 6px 9px; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap;
}
.chart-tip .tip-h { font-weight: 650; margin-bottom: 2px; }
.chart-tip .tip-r { color: var(--muted); }

.alerts { display: flex; flex-direction: column; gap: var(--s-2); }
.alert-row {
  display: flex; align-items: center; gap: var(--s-3); padding: 7px 10px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); text-decoration: none;
}
.alert-row { transition: background-color var(--dur-color) ease, border-color var(--dur-color) ease; }
.alert-row .n { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.alert-none { color: var(--muted); padding: 7px 2px; }
.alert-warn { border-color: rgba(251, 191, 36, 0.3); background: var(--warn-soft); }
.alert-bad { border-color: rgba(248, 113, 113, 0.3); background: var(--bad-soft); }

/* recent sales list (dashboard) */
.sale-list { display: flex; flex-direction: column; }
.sale-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-4); align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.sale-row:last-child { border-bottom: none; }
.sale-plat { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 11px; font-weight: 750; letter-spacing: 0.02em; }
.sale-main { min-width: 0; }
.sale-title { color: var(--text-strong); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sale-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sale-money { text-align: right; }
.sale-amt { font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.sale-when { color: var(--muted-2); font-size: 11px; white-space: nowrap; }

/* ---- sign in / first run (auth.html; ADR-030) --------------------------- */
.auth-body { background: var(--bg); color: var(--text); font-family: var(--font-ui, system-ui, sans-serif); margin: 0; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--s-6) var(--s-4); gap: var(--s-4); }
.auth-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: var(--s-7, 36px) var(--s-6); }
.auth-brand { display: inline-flex; margin-bottom: var(--s-6); }
.auth-title { font-size: 26px; font-weight: 750; letter-spacing: -0.03em; margin: 0 0 4px; color: var(--text-strong); }
.auth-sub { color: var(--muted); margin: 0 0 var(--s-6); }
.auth-form { display: flex; flex-direction: column; gap: var(--s-4); }
.auth-form .fld { gap: 6px; font-size: 13px; }
.input-lg { padding: 11px 13px; font-size: 14px; }
.btn-lg { padding: 11px 16px; font-size: 14px; border-radius: 10px; }
.auth-submit { margin-top: var(--s-2); width: 100%; }
.auth-remember { font-size: 13px; color: var(--muted); }
.auth-help { margin: var(--s-6) 0 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
.auth-help code, .fld-help code { font-family: var(--font-data); font-size: 11px; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.auth-foot { font-size: 11px; color: var(--muted-2); margin: 0; }
.fld-help.ok { color: var(--ok); }
.form-error[hidden] { display: none; }

/* settings → profile & security */
.settings-stack { display: flex; flex-direction: column; gap: var(--s-8, 48px); min-width: 0; }
.settings-main[hidden] { display: none; }
[hidden] { display: none !important; }   /* the hidden attribute wins over any display rule (buttons, flex boxes) */
/* Operator page (ADR-037) */
.admin-unlock { max-width: 460px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); align-items: start; }
.admin-grid[hidden] { display: none; }
.admin-span { grid-column: 1 / -1; }
.admin-card { min-width: 0; }
.admin-person { display: flex; align-items: center; gap: var(--s-2); font-weight: 600; }
.admin-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--s-4); margin: 0; font-size: 13px; }
.admin-facts dt { color: var(--muted); }
.admin-facts dd { margin: 0; font-family: var(--font-data); }
.admin-sub-title { margin-top: var(--s-4); }
.admin-ua { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5); margin-bottom: var(--s-5); }
@media (max-width: 1100px) { .profile-grid { grid-template-columns: 1fr; } }
.profile-card { display: flex; flex-direction: column; gap: var(--s-4); }
.profile-card .card-title { margin-bottom: 0; }
.check { display: flex; align-items: flex-start; gap: var(--s-2); font-size: var(--fs-sm); line-height: 1.4; cursor: pointer; }
.check input { margin-top: 3px; flex: 0 0 auto; }
.backup-buttons { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.user-ws { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
label.btn { display: inline-flex; }
.btn.disabled { pointer-events: none; opacity: .55; }
.profile-actions { display: flex; justify-content: flex-end; }
.profile-meta { font-size: 12px; }
.profile-signout { margin-top: var(--s-5); }
.session-list, .member-list { display: flex; flex-direction: column; }
.session-row { display: flex; align-items: center; gap: var(--s-4); padding: 10px 0; border-bottom: 1px solid var(--border); }
.session-row:last-child { border-bottom: none; }
.session-row.current .session-title { color: var(--text-strong); }
.session-main { flex: 1 1 auto; min-width: 0; font-size: 13px; }
.session-title { display: flex; align-items: center; gap: var(--s-3); font-weight: 600; }
.toolbar-gap { margin: var(--s-5) 0 0; }

/* ---- misc -------------------------------------------------------------- */
.error-panel {
  border: 1px solid rgba(248, 113, 113, 0.35); background: var(--bad-soft); color: var(--bad);
  padding: var(--s-4) var(--s-5); border-radius: var(--radius); margin-bottom: var(--s-5);
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.form-grid label { display: flex; flex-direction: column; gap: var(--s-2); font-size: 12px; color: var(--muted); }
.form-grid .input, .form-grid .select, .form-grid .textarea { width: 100%; }
.form-error { color: var(--bad); margin-top: var(--s-3); }

.toast-container { position: fixed; right: var(--s-6); bottom: var(--s-6); display: flex; flex-direction: column; gap: var(--s-3); z-index: 100; }
.toast {
  background: var(--panel-3); color: var(--text-strong); padding: 9px 14px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); border-left: 3px solid var(--accent);
  box-shadow: var(--shadow); max-width: 380px; cursor: pointer;
  opacity: 1; transform: translateY(0);
  transition: opacity var(--dur-toast) ease, transform var(--dur-toast) ease;
}
.toast.leaving { opacity: 0; transform: translateY(100%); transition-duration: 200ms; }
.toast-ok { border-left-color: var(--ok); }
.toast-warn { border-left-color: var(--warn); }
.toast-error { border-left-color: var(--bad); }
.toast-info { border-left-color: var(--accent); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4, 7, 12, 0.62); display: grid; place-items: center;
  z-index: 90; padding: var(--s-6);
  opacity: 1; transition: opacity var(--dur-modal) var(--ease-out);
}
:root[data-theme="light"] .modal-backdrop { background: rgba(10, 31, 69, 0.42); }
.modal {
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  width: 640px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column;
  transform-origin: center;
  opacity: 1; transform: scale(1);
  transition: opacity var(--dur-modal) var(--ease-out), transform var(--dur-modal) var(--ease-out);
}
/* exit is faster than enter, and reverses the same path */
.modal-backdrop.closing { opacity: 0; transition-duration: 160ms; }
.modal-backdrop.closing .modal { opacity: 0; transform: scale(0.98); transition-duration: 160ms; }
.modal-sm { width: 420px; }
.modal-lg { width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); font-weight: 650; font-size: 15px; color: var(--text-strong); }
.modal-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.modal-body { padding: var(--s-5); overflow: auto; }
.modal-foot { padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); display: flex; gap: var(--s-3); justify-content: flex-end; background: var(--panel-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.modal-summary { color: var(--muted); margin-bottom: var(--s-4); }

/* ---- inventory: tree, cards, sheet -------------------------------------- */
.inv-head { flex-wrap: wrap; row-gap: var(--s-3); }
.crumbs { display: inline-flex; align-items: center; gap: var(--s-3); color: var(--text); font-size: 13px; }
.crumbs a { color: var(--accent-2); }
.crumb-sep { color: var(--muted-2); }
.inv-root { min-height: 0; }
.empty-state { color: var(--muted); padding: var(--s-7) 0; text-align: center; }
.section-title { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: var(--s-6) 0 var(--s-4); }

/* artwork tiles: the vendor's hero image, or initials on navy */
.art { position: relative; overflow: hidden; background: var(--navy-800); display: grid; place-items: center; color: #fff; font-weight: 800; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-fallback { background: linear-gradient(135deg, var(--navy-500), var(--navy-800)); }
.art-thumb { width: 108px; height: 62px; border-radius: 8px; font-size: 16px; }
.art-mini { width: 22px; height: 22px; border-radius: 5px; font-size: 9px; }

.pills { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }

/* node header above a sheet */
.node-header { display: flex; align-items: center; gap: var(--s-5); padding: var(--s-4) 0 var(--s-5); }
.node-text { min-width: 0; }
.node-name { font-size: 19px; font-weight: 700; color: var(--text-strong); display: flex; align-items: center; gap: var(--s-3); letter-spacing: -0.015em; }
.node-sub { color: var(--text); margin-top: 1px; }
/* KPI strip: fills the space to the right of the header for the selected node */
.node-header { flex-wrap: wrap; }
.node-kpis { flex: 1 0 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3); margin-top: var(--s-2); }
.nk { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px 8px; min-width: 0; }
.nk-l { font-size: 12px; font-weight: 500; color: var(--muted); }
.nk-v { font-size: 20px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.nk-v.ok { color: var(--ok); }
.nk-v.bad { color: var(--bad); }
.nk-s { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1100px) { .node-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* the sheet */
.sheet-host { display: flex; flex-direction: column; min-height: 0; }
.sheet-bar { display: flex; align-items: center; gap: var(--s-3); padding: 0 0 var(--s-3); }
.sheet { height: 320px; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--panel); }  /* height is set per load in inventory.js */

/* explorer layout */
.explorer { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--s-5); align-items: start; }
.explorer-tree { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--panel); padding: var(--s-3); position: sticky; top: calc(var(--topbar-h) + var(--s-5)); max-height: calc(100vh - var(--topbar-h) - 2 * var(--s-6)); overflow: auto; }
.tree-filter { width: 100%; margin-bottom: var(--s-3); }
.tree { display: flex; flex-direction: column; gap: 1px; }
.tree-node { display: flex; align-items: center; gap: var(--s-3); padding: 6px var(--s-3); border-radius: var(--radius); cursor: pointer; user-select: none; color: var(--text); }
.tree-node { transition: background-color var(--dur-color) ease; }
.tree-node:active { background: var(--panel-3); }
.tree-node.on { background: var(--accent-soft); color: var(--text-strong); }
.tree-node.on .tree-label { font-weight: 650; }
.tree-all { font-weight: 650; border-bottom: 1px solid var(--border); border-radius: 0; margin-bottom: var(--s-2); }
.tree-event { padding-left: 38px; font-size: 12px; }
.tree-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.tree-count.warn { color: var(--warn); font-weight: 650; }
.tree-date { color: var(--muted); font-size: 11px; min-width: 64px; white-space: nowrap; }
.tree-empty { color: var(--muted); padding: var(--s-4) var(--s-3); font-size: 12px; }
.tree-caret { appearance: none; border: none; background: transparent; color: var(--muted-2); width: 16px; padding: 0; cursor: pointer; font-size: 11px; transition: transform var(--dur-color) var(--ease-out); }
.tree-caret.open { transform: rotate(90deg); }
.explorer-main { min-width: 0; }

/* ---- sub-tabs (Inventory | Import inventory) ---------------------------- */
.subtabs { display: flex; gap: var(--s-2); border-bottom: 1px solid var(--border); margin: calc(-1 * var(--s-3)) 0 var(--s-5); }
.subtab { padding: 8px 12px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtab { transition: color var(--dur-color) ease, border-color var(--dur-color) ease; }
.subtab.active { color: var(--text-strong); border-bottom-color: var(--accent); }

/* ---- settings ---------------------------------------------------------- */
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + var(--s-5)); }
.settings-link { padding: 7px 10px; border-radius: var(--radius); color: var(--muted); font-weight: 550; text-decoration: none; }
.settings-link { transition: background-color var(--dur-color) ease, color var(--dur-color) ease; }
.settings-link.active { background: var(--accent-soft); color: var(--text-strong); }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-5); margin-bottom: var(--s-5); }
.section-h { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.source-list { display: flex; flex-direction: column; gap: var(--s-4); }
.source-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--panel); padding: var(--s-4) var(--s-5); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 4px; }
.source-card.src-off { opacity: 0.7; }
.src-head { display: flex; align-items: center; gap: var(--s-3); }
.src-label { font-weight: 700; font-size: 14px; color: var(--text-strong); }
.src-toggle { margin-left: auto; font-size: 12px; }
.src-identity { color: var(--text); font-size: 12px; }
.src-error { color: var(--bad); font-size: 12px; }
.src-test { min-height: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.src-test:empty { display: none; }
.src-actions { display: flex; gap: var(--s-3); margin-top: var(--s-3); flex-wrap: wrap; }
.src-remove { margin-left: auto; color: var(--bad); }

.fld { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.fld-label { color: var(--muted); font-weight: 600; }
.fld-help { color: var(--muted-2); font-size: 11px; }
.form-grid .span-2 { grid-column: span 2; }
.modal-lg .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }   /* Add order: 18 fields in 6 rows */
.modal-lg .form-grid > .toggle { grid-column: span 3; }
.form-grid > .toggle { grid-column: span 2; justify-self: start; margin-top: var(--s-2); flex-direction: row; align-items: center; }
.modal-foot .form-error { margin: 0; align-self: center; font-size: 12px; }
.modal-foot .btn.left { margin-right: auto; }                     /* Delete order… sits away from Save */
.form-grid > .form-note { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-bottom: -4px; }

/* ---- file drop zone (Import inventory) ------------------------------------ */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--panel-2);
  padding: var(--s-7) var(--s-5); text-align: center; cursor: pointer; outline: none;
  transition: background-color var(--dur-color) ease, border-color var(--dur-color) ease;
}
.dropzone:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.dropzone.dz-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.dz-busy { opacity: 0.7; cursor: progress; }
.dz-icon { font-size: 26px; color: var(--accent); line-height: 1; margin-bottom: var(--s-3); }
.dz-title { font-weight: 650; color: var(--text-strong); font-size: 14px; }
.dz-sub { margin-top: var(--s-2); font-size: 12px; max-width: 560px; margin-left: auto; margin-right: auto; }
.file-results { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-4); }
.file-results:empty { display: none; }
.file-result { display: flex; align-items: center; gap: var(--s-3); padding: 6px 8px; border-radius: var(--radius); background: var(--panel-2); font-size: 12px;
  opacity: 1; transition: opacity 150ms var(--ease-out); }
.fr-text { flex: 1 1 auto; min-width: 0; }
.fr-file { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- import page --------------------------------------------------------- */
.import-layout { display: flex; flex-direction: column; gap: var(--s-5); max-width: 1100px; }
.pick-row { display: flex; align-items: center; gap: var(--s-3); padding: 8px 6px; border-bottom: 1px solid var(--border); cursor: pointer; }
.pick-row:last-child { border-bottom: none; }
.pick-row.src-off { opacity: 0.6; }
.pick-label { font-weight: 650; color: var(--text-strong); }
.pick-detail { flex: 1 1 auto; }
.run-foot { display: flex; align-items: center; gap: var(--s-3); margin-top: var(--s-4); }
.run-summary { font-weight: 650; }
.recent-list { display: flex; flex-direction: column; }
.recent-row { display: grid; grid-template-columns: 150px auto 1fr auto auto; gap: var(--s-4); align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.recent-row:last-child { border-bottom: none; }

/* ---- inventory grid ---------------------------------------------------- */
.inventory-page { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - var(--s-7)); }
.grid-wrap { flex: 1 1 auto; min-height: 320px; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--panel); }
.grid { height: 100%; }
.summary { display: flex; flex-wrap: wrap; gap: var(--s-6); padding: var(--s-4) var(--s-2); color: var(--muted); }
.bulkbar {
  position: sticky; bottom: 0; z-index: 15;
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  background: var(--navy-800); color: #fff; padding: var(--s-3) var(--s-5);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-top: var(--s-4);
}
.bulk-count { font-weight: 650; margin-right: var(--s-3); }
.bulk-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.bulkbar .btn { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.28); color: #fff; }
.col-chooser { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3) var(--s-5); }

/* Tabulator overrides — the grid is themed by the same tokens as everything else */
.tabulator { background: var(--panel); border: none; font-size: 13px; color: var(--text); font-family: var(--font-data); }
.tabulator .tabulator-header { background: var(--panel-2); border-bottom: 1px solid var(--border); color: var(--text); font-weight: 650; }
.tabulator .tabulator-header .tabulator-col { background: transparent; border-right: 1px solid var(--border); }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content { padding: 6px 8px; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-title { font-size: 12px; font-family: var(--font-ui); font-weight: 600; color: var(--muted); }
.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="ascending"] .tabulator-col-title,
.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="descending"] .tabulator-col-title { color: var(--text-strong); }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter .tabulator-arrow { border-bottom-color: var(--muted-2); }
.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="ascending"] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow { border-bottom-color: var(--accent); }
.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="descending"] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow { border-top-color: var(--accent); }
.tabulator .tabulator-header input, .tabulator .tabulator-header select {
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 3px 6px; font: inherit;
  background: var(--panel); color: var(--text);
}
.tabulator .tabulator-header input::placeholder { color: var(--muted-2); }
.tabulator .tabulator-tableholder { background: var(--panel); }
.tabulator .tabulator-tableholder .tabulator-placeholder .tabulator-placeholder-contents { color: var(--muted); background: transparent; }
.tabulator .tabulator-row { background: var(--panel); color: var(--text); border-bottom: 1px solid var(--border); min-height: var(--row-h); }
.tabulator .tabulator-row.tabulator-row-even { background: var(--panel); }
.tabulator .tabulator-row.tabulator-selected { background: var(--accent-soft); }
.tabulator .tabulator-row .tabulator-cell { border-right: 1px solid var(--border); padding: 6px 8px; }
.tabulator .tabulator-row .tabulator-cell.tabulator-editing { border: 1px solid var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); padding: 5px 7px; background: var(--panel-2); color: var(--text); }
.tabulator .tabulator-row .tabulator-cell.tabulator-editing input, .tabulator .tabulator-row .tabulator-cell.tabulator-editing select { background: var(--panel-2); color: var(--text); border: none; }
.tabulator .tabulator-row.tabulator-group { background: var(--panel-2); font-weight: 650; color: var(--text-strong); border-bottom: 1px solid var(--border-strong); }
.tabulator .tabulator-row.tabulator-group span { color: var(--muted); font-weight: 500; }   /* Tabulator's default paints these red */
.tabulator .tabulator-row.tabulator-group .tabulator-arrow { border-left-color: var(--muted); }
.tabulator .tabulator-row.row-warn { background: var(--warn-soft); }
.tabulator .tabulator-row.row-sold { color: var(--muted); }
.tabulator .tabulator-row.row-dim { color: var(--muted-2); }
.tabulator .tabulator-footer { background: var(--panel-2); border-top: 1px solid var(--border); color: var(--muted); }
.tabulator .tabulator-col-resize-handle { opacity: 0; }
.tabulator-popup-container, .tabulator-edit-list { background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); }
.tabulator-edit-list .tabulator-edit-list-item { color: var(--text); }
.tabulator-edit-list .tabulator-edit-list-item.active { background: var(--accent); color: var(--on-accent); }
.tabulator .money { font-variant-numeric: tabular-nums; }
/* spreadsheet range selection (SelectRange module): accent outline, soft fill, row numbers */
.tabulator .tabulator-tableholder .tabulator-range-overlay .tabulator-range { border: 1px solid var(--accent); }
.tabulator .tabulator-tableholder .tabulator-range-overlay .tabulator-range.tabulator-range-active::after { background-color: var(--accent); }
.tabulator .tabulator-tableholder .tabulator-range-overlay .tabulator-range-cell-active { border: 2px solid var(--accent); }
.tabulator-row .tabulator-cell.tabulator-range-selected:not(.tabulator-range-only-cell-selected):not(.tabulator-range-row-header) { background-color: var(--accent-soft); }
.tabulator .tabulator-header .tabulator-col.tabulator-range-highlight { background-color: var(--panel-3); color: var(--text-strong); }
.tabulator .tabulator-header .tabulator-col.tabulator-range-selected { background-color: var(--accent); color: var(--on-accent); }
.tabulator .tabulator-header .tabulator-col.tabulator-range-selected .tabulator-col-title { color: var(--on-accent); }
.tabulator-row .tabulator-cell.tabulator-range-row-header, .tabulator .tabulator-header .tabulator-col.row-num { background-color: var(--panel-2); color: var(--muted-2); font-family: var(--mono); font-size: 11px; }
.tabulator-row.tabulator-range-highlight .tabulator-cell.tabulator-range-row-header { background-color: var(--panel-3); color: var(--text-strong); }
.tabulator-row.tabulator-range-highlight.tabulator-range-selected .tabulator-cell.tabulator-range-row-header,
.tabulator-row.tabulator-range-selected .tabulator-cell.tabulator-range-row-header { background-color: var(--accent); color: var(--on-accent); }
.tabulator.tabulator-ranges .tabulator-cell:not(.tabulator-editing) { cursor: cell; }
.tabulator .cross { color: var(--muted-2); }

@media print {
  .sidebar, .topbar, .bulkbar { display: none; }
  .content { padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
}

/* ---- motion: entrances, hover gating, reduced motion ---------------------- */
/* Entrances without JS: the browser transitions from these values on first paint. */
@starting-style {
  .modal-backdrop { opacity: 0; }
  .modal { opacity: 0; transform: scale(0.96); }
  .toast { opacity: 0; transform: translateY(100%); }
  .tree-event { opacity: 0; }
  .file-result { opacity: 0; }
}
.tree-event { transition: opacity 100ms var(--ease-out), background-color var(--dur-color) ease; }

/* Hover is a mouse thing. Touch fires :hover on tap and leaves it stuck, so every hover
   style that could stick lives here. */
@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration: underline; }
  .brand:hover, .nav-link:hover, .subtab:hover, .settings-link:hover, .alert-row:hover, .sale-row a:hover, .view-all:hover { text-decoration: none; }
  .btn:hover { background: var(--panel-3); border-color: var(--border-strong); }
  .btn.btn-primary:hover { background: var(--btn-primary-bg); border-color: var(--btn-primary-bg); color: var(--btn-primary-fg); filter: brightness(0.93); }   /* the generic hover must not wash out a primary button */
  .btn-primary:hover { filter: brightness(0.92); }
  .btn-danger:hover { background: var(--bad-soft); }
  .btn-ghost:hover { background: var(--panel-2); color: var(--text); }
  .btn-group .btn:hover:not(.on), .seg .seg-btn:hover:not(.on), .chips .chip:hover:not(.on) { background: var(--panel-3); color: var(--text); border-color: transparent; }
  .nav-link:hover:not(.soon) { background: var(--panel-2); color: var(--text-strong); }
  .nav-link:hover:not(.soon) .ic { color: var(--text); }
  .nav-link.active:hover { background: var(--accent-soft); }
  .nav-link.active:hover .ic { color: var(--accent); }
  .theme-toggle:hover { background: var(--panel-2); color: var(--text-strong); }
  .subtab:hover { color: var(--text); }
  .settings-link:hover { background: var(--panel-2); color: var(--text); }
  .settings-link.active:hover { background: var(--accent-soft); color: var(--text-strong); }
  .tree-node:hover { background: var(--panel-2); }
  .tree-node.on:hover { background: var(--accent-soft); }
  .table tbody tr:hover { background: var(--panel-2); }
  .alert-row:hover { background: var(--panel-3); border-color: var(--border-strong); }
  .bulkbar .btn:hover { background: rgba(255, 255, 255, 0.2); }
  .tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover { background: var(--panel-3); }
  .tabulator .tabulator-row.tabulator-selectable:hover { background: var(--panel-2); }
  .tabulator-edit-list .tabulator-edit-list-item:hover { background: var(--panel-3); }
}

/* Reduced motion: keep the opacity and colour transitions that aid comprehension, drop movement. */
@media (prefers-reduced-motion: reduce) {
  .btn:active, .chip:active, .seg-btn:active, .theme-toggle:active { transform: none; }
  @keyframes dash-reveal { from { opacity: 0; } to { opacity: 1; } }
  .reveal { animation-duration: 200ms; animation-delay: 0ms !important; }
  .modal, .modal-backdrop.closing .modal, .toast, .toast.leaving { transform: none; }
  .tree-caret { transition: none; }
  @starting-style {
    .modal { transform: none; }
    .toast { transform: none; }
  }
}
