/* Prevent mobile browsers, especially iOS Safari, from zooming into text
   controls on focus. This file is intentionally loaded on every template. */
html,
body {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (pointer: coarse), (max-width: 1024px) {
  html,
  body {
    touch-action: manipulation;
  }
}

input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
textarea,
select,
[contenteditable="true"],
.search-input,
.adv-input,
.combo-input {
  font-size: 16px !important;
}

/* ── Customer names are bold everywhere in the app. ──────────────────────
   Loaded on every template, so this is the single global hook. The generic
   `.customer-name` wrapper is applied at inline render sites; the remaining
   selectors are dedicated customer-name classes that already exist per
   page, bolded here so those markup sites need no change. Don't add
   font-size here (would fight the no-zoom rule above). */
.customer-name,
.sale-customer,
.ret-customer,
.memo-customer,
.sale-event-cust,
.card-customer,
.cust-name,
.sig-name,
.customer-link .primary-text {
  font-weight: 700 !important;
}

/* Inventory status colors are semantic everywhere in the app:
   green = on hand, red = sold/invoiced and out,
   dark blue = RETURNED movements (2026-07-16 user ruling). */
:root {
  --status-on-hand: #1a8a3a;
  --status-on-hand-soft: rgba(26, 138, 58, .12);
  --status-invoiced: #c0392b;
  --status-invoiced-soft: rgba(192, 57, 43, .12);
  --status-returned: #172554;
  --status-returned-soft: rgba(23, 37, 84, .12);
  /* In-app TEMP MEMO is violet and its RETURN teal, so neither can be
     confused with the amber JewelMate memo (2026-07-30 user ruling). */
  --status-temp-memo: #5b21b6;
  --status-temp-memo-soft: rgba(139, 92, 246, .18);
  --status-temp-return: #0f5f6b;
  --status-temp-return-soft: rgba(20, 184, 166, .18);
}

html body .hero-pill.on_hand {
  background: var(--status-on-hand);
  color: #fff;
}
html body .hero-pill.returned {
  background: var(--status-returned);
  color: #fff;
}
html body .hero-pill.sold {
  background: var(--status-invoiced);
  color: #fff;
}

html body .badge.on_hand,
html body .di-head-pill.on_hand,
html body .row-status.onhand,
html body .sit-state.on_hand,
html body .card-avatar.on_hand,
html body .card-status.on_hand {
  background: var(--status-on-hand-soft);
  color: var(--status-on-hand);
}
html body .badge.returned,
html body .di-head-pill.returned,
html body .flow-chip.returned,
html body .badge-returned,
html body .detail-movement-flow.returned {
  background: var(--status-returned-soft);
  color: var(--status-returned);
}
html body .flow-chip.tempmemo,
html body .detail-movement-flow.tempmemo {
  background: var(--status-temp-memo-soft);
  color: var(--status-temp-memo);
}
html body .flow-chip.tempreturn,
html body .detail-movement-flow.tempreturn {
  background: var(--status-temp-return-soft);
  color: var(--status-temp-return);
}
html body .badge.sold,
html body .badge.invoice,
html body .di-head-pill.sold,
html body .flow-chip.invoice,
html body .row-status.invoiced,
html body .sit-state.invoiced,
html body .card-avatar.out_invoice,
html body .card-status.out_invoice,
html body .detail-movement-flow.invoice {
  background: var(--status-invoiced-soft);
  color: var(--status-invoiced);
}
html body #soldGrid .badge.memo,
html body #soldGrid .badge.invoice,
html body #soldGrid .badge.combo,
html body #soldTableBody .badge.memo,
html body #soldTableBody .badge.invoice,
html body #soldTableBody .badge.combo {
  background: var(--status-invoiced-soft);
  color: var(--status-invoiced);
}

html body .timeline-dot.returned {
  background: var(--status-returned);
}
html body .timeline-dot.on_hand,
html body .dot.on_hand,
html body .sit .dot.on_hand,
html body .st-dot.on_hand,
html body .status-dot.dot-on {
  background: var(--status-on-hand);
}
html body .timeline-dot.invoice,
html body .timeline-dot.sold,
html body .dot.invoiced,
html body .sit .dot.invoiced,
html body .st-dot.invoiced {
  background: var(--status-invoiced);
}

html body .item-card.state-on_hand {
  border-left-color: var(--status-on-hand);
}
html body .item-card.state-returned {
  border-left-color: var(--status-returned);
}
html body .item-card.state-sold,
html body .item-card.src-memo,
html body .item-card.src-invoice,
html body .item-card.src-combo {
  border-left-color: var(--status-invoiced);
}
html body .it-days.sold,
html body .it-days .d.sold,
html body .item-days.sold {
  color: var(--status-invoiced);
}

/* ── Customer dropdown option — ONE look everywhere (the Card Ledger one). ─
   Every customer picker renders this exact markup:
     <div class="combo-opt">
       <div class="combo-opt-name">
         <span class="combo-opt-id">#123</span>
         <span class="customer-name">Store Name</span>
       </div>
       <div class="combo-opt-meta">Contact · City, ST</div>
     </div>
   Fallback colours match the app palette so this holds on any page even
   before its own :root vars load. */
.combo-opt-name {
  display: flex; align-items: baseline; flex-wrap: wrap;
}
.combo-opt-id {
  color: var(--text-muted, #86868b); font-weight: 500; margin-right: 6px;
  font-variant-numeric: tabular-nums;
}
.combo-opt-meta {
  margin-top: 2px; font-size: 11px; line-height: 1.35;
  color: var(--text-muted, #86868b);
  font-variant-numeric: tabular-nums;
}

/* ── Global scanner-safe software keyboard fallback. ─────────────────────
   Shown only by no-zoom.js when a mobile field is tapped and the native
   keyboard does not appear, which happens when some scanners are connected
   as hardware keyboards. */
.global-soft-keyboard {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2147483000;
  display: block;
  padding: 10px 4px max(32px, calc(env(safe-area-inset-bottom) + 15px));
  background: rgba(28, 28, 30, .96);
  border: 0;
  border-radius: 0;
  box-shadow: 0 -1px 0 rgba(255,255,255,.08);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, calc(100% + 34px), 0) scale(.996);
  transition:
    transform .42s cubic-bezier(.18, .92, .22, 1),
    opacity .16s linear;
  will-change: transform, opacity;
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-user-select: none;
  user-select: none;
  contain: layout style;
  -webkit-tap-highlight-color: transparent;
}
.global-soft-keyboard.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, -18px, 0) scale(1);
}
.global-soft-keyboard-inner {
  max-width: 462px;
  margin: 0 auto;
  padding: 0 3px;
}
.global-soft-keyboard-keys {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
}
.global-soft-keyboard-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  width: 100%;
}
.global-soft-keyboard-row.home {
  padding: 0 19px;
}
.global-soft-keyboard-row.shift {
  gap: 7px;
}
.global-soft-keyboard-row.bottom {
  gap: 6px;
}
.global-soft-key {
  flex: 1 1 0;
  min-width: 0;
  height: clamp(45px, 11.7vw, 50px);
  border: 0;
  border-radius: 8px;
  background: #6f7076;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-size: 23px !important;
  font-weight: 400;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 1.5px 0 rgba(0,0,0,.72);
  cursor: pointer;
  touch-action: manipulation;
  transform: translate3d(0,0,0);
  transition:
    background-color .07s linear,
    box-shadow .07s linear,
    filter .07s linear,
    transform .055s cubic-bezier(.2, .8, .2, 1);
  will-change: transform;
}
.global-soft-key:active,
.global-soft-key.is-pressed {
  transform: translate3d(0,1px,0) scale(.975);
  background: #5d5e65;
  filter: brightness(1.04);
}
.global-soft-key.mod {
  flex: 1.28 1 0;
  background: #3f4047;
  font-size: 18px !important;
  font-weight: 500;
}
.global-soft-key.shift-on {
  background: #f4f4f5;
  color: #111;
}
.global-soft-key.space {
  flex: 4.7 1 0;
  font-size: 17px !important;
}
.global-soft-key.return {
  flex: 2.05 1 0;
  background: #3f4047;
  font-size: 17px !important;
  font-weight: 500;
}
.global-soft-key.mode {
  flex: 1.55 1 0;
  font-size: 17px !important;
  font-weight: 500;
}
.global-soft-key.backspace {
  font-size: 20px !important;
}
.global-soft-key-pop {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 46px;
  height: 58px;
  padding: 0 13px;
  border-radius: 13px;
  background: #f2f2f7;
  color: #111;
  box-shadow: 0 10px 22px rgba(0,0,0,.28);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-size: 30px !important;
  font-weight: 400;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(-50%, -31px, 0) scale(.9);
  transition:
    opacity .055s linear,
    transform .105s cubic-bezier(.18, .9, .2, 1);
  will-change: transform, opacity;
}
.global-soft-key-pop.is-visible {
  opacity: 1;
  transform: translate3d(-50%, -47px, 0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .global-soft-keyboard {
    transition: opacity .12s linear;
  }
  .global-soft-key,
  .global-soft-key-pop {
    transition: none;
  }
}

/* ── Skeleton shimmer (loading placeholders — UI only) ─────────────── */
.sk { display: grid; gap: 8px; padding: 4px 0; }
.sk-bar { height: 14px; border-radius: 7px;
  background: linear-gradient(90deg, rgba(0,0,0,.06) 25%, rgba(0,0,0,.13) 50%, rgba(0,0,0,.06) 75%);
  background-size: 200% 100%; animation: skShimmer 1.1s linear infinite; }
.sk-bar.w80 { width: 80%; } .sk-bar.w60 { width: 60%; } .sk-bar.w40 { width: 40%; }
@keyframes skShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk-bar { animation: none; } }

/* ════════════════════════════════════════════════════════════════════
   DARK MODE — "NEBULA". (🌙 toggle · exact-spec build 2026-07-21)
   Deep space base, drifting aurora parallax, star field + dot grid
   (showcase), animated gradient headline, breathing CTA with shine
   sweep, heartbeat beam divider, spotlight cards with keylines, one
   orbiting conic border. Modes: [data-intensity="showcase"] = login
   hero, everything on; default = CALM (app interior, ambient only).
   FLAGGED DEVIATIONS: ① auroras at z-index:-1 (48 pages, fixed
   overlays — same guarantee as content z-index:1); ② star field
   exists only on the showcase page (calm pages have no hero region);
   ③ conic card lives on a calm page so it orbits only if that page is
   ever flagged showcase (spec: calm = static conic); ④ per-card random
   beams from the previous iteration REMOVED (spec: calm beams fire
   one-shot on real data events only); ⑤ status semantics beyond
   cyan-positives retained from the approved app system.
   ════════════════════════════════════════════════════════════════════ */
html[data-theme="dark"] {
  color-scheme: dark;
  /* spec tokens */
  --bg-page: #07070d;
  --bg-card: #101019;
  --border-subtle: rgba(255,255,255,.06);
  --text-primary: #f2f1f8;
  --accent-link: #a79eff;
  --star-blue: #a8d4ff;
  --cyan-badge: #8fe8e0;
  /* legacy names → Nebula ladder (all pages theme untouched) */
  --bg: #07070d;
  --surface: #101019;
  --surface-2: #1a1a26;
  --surface-3: #242433;
  --surface-hover: #2e2e40;
  --border: rgba(255,255,255,.06);
  --border-strong: rgba(255,255,255,.12);
  --border-hover: rgba(255,255,255,.10);
  --text: #f2f1f8;
  --text-secondary: #9a97b0;
  /* #807e96 was 4.38:1 on --surface-2 and 3.38:1 on --surface-hover — below
     the 4.5:1 floor, which is why 32 elements (h5, strong, p.note, user-email,
     table headers) measured as too dim across admin, upload, flags and
     ordering. #9c9ab2 clears every dark surface: 7.35 on --bg down to 4.86 on
     --surface-hover. It lands close to --text-secondary because the old value
     was simply below the legibility floor; hierarchy still reads through size
     and weight. */
  --text-muted: #9c9ab2;
  --accent: #a79eff;
  --accent-hover: #b8b1ff;
  /* Ink for anything PAINTED WITH --accent. The dark accent is a pale
     lavender, so white on it is only 2.34:1 — unreadable, and the reason the
     "New Memo" button looked completely blank. Dark ink on it is 7.36:1.
     Light mode keeps #fff (5.94:1 on the darker #5b48e8 accent). */
  --on-accent: #14121f;
  /* Sticky top bars were hardcoded rgba(251,251,253,.8-.96) in 10 places, so
     in dark mode they stayed near-WHITE while the text on them turned
     near-white — a.brand measured 1.48:1. */
  --surface-translucent: rgba(16,16,25,.92);
  --accent-strong: #cdc8ff;
  --accent-soft: rgba(167,158,255,.14);
  --cta: #6e5bff;
  --cta-hover: #7e6dff;
  --cyan: #5ee0c8;
  /* status — cyan positives per spec; rest from the approved system */
  --status-on-hand: #5ee0c8;   --status-on-hand-fill: #0f6f5c;
  --status-on-hand-soft: rgba(94,224,200,.13);
  --status-invoiced: #df7c71;  --status-invoiced-fill: #8b2c23;
  --status-invoiced-soft: rgba(223,124,113,.13);
  --status-returned: #82aef0;  --status-returned-fill: #274b8f;
  --status-returned-soft: rgba(130,174,240,.14);
  --status-temp-memo: #c4a7ff;
  --status-temp-memo-soft: rgba(167,158,255,.16);
  --status-temp-return: #5ee0c8;
  --status-temp-return-soft: rgba(94,224,200,.14);
  --green: #5ee0c8;   --green-soft: rgba(94,224,200,.13);
  --red: #df7c71;     --red-soft: rgba(223,124,113,.13);
  --amber: #e7ad6a;   --amber-soft: rgba(231,173,106,.14);
  --purple: #ef7fb8;  --navy: #82aef0;
  --emerald: #5ee0c8; --emerald-soft: rgba(94,224,200,.13);
  --rose: #df7c71;    --rose-soft: rgba(223,124,113,.13);
  --violet: #ef7fb8;  --violet-soft: rgba(239,127,184,.14);
  --warn: #e7ad6a;    --warn-bg: rgba(231,173,106,.14);
  --on-memo: #e7ad6a; --temp-memo: #ef7fb8;
  --memo-color: #ef7fb8; --memo-soft: rgba(239,127,184,.14);
  --invoice-color: #df7c71; --invoice-soft: rgba(223,124,113,.13);
  --on-hand: #5ee0c8; --not-avail: #df7c71;
  --error: #df7c71;   --error-bg: rgba(223,124,113,.13);
  --success: #5ee0c8; --success-bg: rgba(94,224,200,.13);
  --gold: #e8c05c;    --gold-soft: rgba(232,192,92,.14);
  --yellow: #e7ad6a;  --orange: #e7986a; --muted: #9c9ab2;
  --secondary: #9a97b0;
  --ink-1: #f2f1f8; --ink-2: #c6c3d6; --ink-3: #9a97b0;
  /* #6f6d84 was 3.78-3.83:1 on the analytics panels (#101019 / #0e0e14).
     #8a879e is 5.44:1 there. Drives #updatedAt, #statusTotal, #resultCount. */
  --ink-4: #8a879e;
  --primary: #a79eff; --primary-soft: rgba(167,158,255,.14);
  --grad: linear-gradient(135deg, #6e5bff 0%, #5ee0c8 100%);
  --shadow: none; --shadow-sm: none; --shadow-md: none; --shadow-lg: none;
  --shadow-hover: none; --shadow-accent: 0 0 26px rgba(110,91,255,.40);
  --ring: 0 0 0 2px var(--accent);
}
/* ── LAYER 1: aurora blobs with drift + mouse parallax. Two pseudo
   layers, desynced 9s vs 11s, opposite parallax directions (depth).
   drawer.js feeds --par-x/--par-y (-0.5..0.5) via rAF. Calm = halved
   opacity; showcase = full. ── */
html[data-theme="dark"] body {
  background: var(--bg);
  color: var(--text);
}
html[data-theme="dark"] body::before,
html[data-theme="dark"] body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
  opacity: .5;                 /* calm default; showcase overrides */
}
html[data-theme="dark"] body::before {
  width: 420px; height: 340px; top: -140px; left: -60px;
  background: radial-gradient(ellipse, rgba(110,91,255,.32), transparent 65%);
  animation: nebula-drift-a 9s ease-in-out infinite alternate;
  translate: calc(var(--par-x, 0) * 24px) calc(var(--par-y, 0) * 14px);
}
html[data-theme="dark"] body::after {
  width: 380px; height: 300px; top: -120px; right: -70px;
  background: radial-gradient(ellipse, rgba(56,220,220,.20), transparent 65%);
  animation: nebula-drift-b 11s ease-in-out infinite alternate;
  translate: calc(var(--par-x, 0) * -18px) calc(var(--par-y, 0) * -10px);
}
html[data-theme="dark"][data-intensity="showcase"] body::before,
html[data-theme="dark"][data-intensity="showcase"] body::after { opacity: 1; }
@keyframes nebula-drift-a {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(40px,20px) scale(1.15); }
}
@keyframes nebula-drift-b {
  from { transform: translate(0,0) scale(1.1); }
  to   { transform: translate(-35px,15px) scale(1); }
}
/* ── LAYER 2: star field + dot grid (showcase hero region only). ── */
html[data-theme="dark"] .hero-sky {
  position: absolute; inset: 0 0 auto 0; height: 140px;
  pointer-events: none; overflow: hidden;
}
html[data-theme="dark"] .hero-sky::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.10) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, black, transparent);
  mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, black, transparent);
}
html[data-theme="dark"] .star {
  position: absolute; width: 2px; height: 2px; border-radius: 50%;
  background: #fff; opacity: .3;
}
html[data-theme="dark"] .star.s1 { left: 12%; top: 28px; background: #fff; }
html[data-theme="dark"] .star.s2 { left: 27%; top: 84px; width: 1.5px; height: 1.5px; background: var(--star-blue); }
html[data-theme="dark"] .star.s3 { left: 46%; top: 40px; background: #cdc8ff; }
html[data-theme="dark"] .star.s4 { left: 63%; top: 96px; width: 1.5px; height: 1.5px; background: var(--cyan-badge); }
html[data-theme="dark"] .star.s5 { left: 78%; top: 30px; background: var(--star-blue); }
html[data-theme="dark"] .star.s6 { left: 90%; top: 70px; width: 1.5px; height: 1.5px; background: #fff; }
html[data-theme="dark"][data-intensity="showcase"] .star.s1 { animation: twinkle 3.2s ease-in-out .0s infinite; }
html[data-theme="dark"][data-intensity="showcase"] .star.s2 { animation: twinkle 4.1s ease-in-out .7s infinite; }
html[data-theme="dark"][data-intensity="showcase"] .star.s3 { animation: twinkle 3.6s ease-in-out 1.3s infinite; }
html[data-theme="dark"][data-intensity="showcase"] .star.s4 { animation: twinkle 4.7s ease-in-out .4s infinite; }
html[data-theme="dark"][data-intensity="showcase"] .star.s5 { animation: twinkle 3.9s ease-in-out 1.8s infinite; }
html[data-theme="dark"][data-intensity="showcase"] .star.s6 { animation: twinkle 4.4s ease-in-out 1.0s infinite; }
@keyframes twinkle { 0%,100% { opacity: .15; } 50% { opacity: .8; } }
/* ── LAYER 3: glass nav. ── */
html[data-theme="dark"] .topbar {
  background: rgba(255,255,255,0.03);
  border-bottom-color: var(--border);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
/* ── LAYER 4: hero — badge pill, gradient headline, breathing CTA. ── */
html[data-theme="dark"] .hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  color: var(--cyan-badge);
  background: rgba(56,220,220,.08);
  border: 1px solid rgba(56,220,220,.25);
  border-radius: 20px; padding: 5px 12px;
  text-transform: uppercase;
}
html[data-theme="dark"] .grad-headline {
  background: linear-gradient(90deg, #f2f1f8, #a79eff, #5ee0c8, #f2f1f8);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  letter-spacing: -.5px;
}
html[data-theme="dark"][data-intensity="showcase"] .grad-headline {
  animation: headline-flow 6s linear infinite;
}
@keyframes headline-flow {
  from { background-position: 0% center; }
  to   { background-position: 200% center; }
}
html[data-theme="dark"] .cta-nebula {
  position: relative; overflow: hidden;
  background: var(--cta) !important;
  border-color: transparent !important;
  color: #fff !important;
  border-radius: 9px;
  box-shadow: 0 0 26px rgba(110,91,255,.35);
}
html[data-theme="dark"][data-intensity="showcase"] .cta-nebula {
  animation: cta-breathe 4s ease-in-out infinite;
}
html[data-theme="dark"][data-intensity="showcase"] .cta-nebula::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%;
  left: -60%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-20deg);
  animation: cta-shine 3.5s ease-in-out infinite;
}
@keyframes cta-breathe {
  0%, 100% { box-shadow: 0 0 26px rgba(110,91,255,.35); }
  50%      { box-shadow: 0 0 42px rgba(110,91,255,.60); }
}
/* sweep only in the LAST 30% of the timeline — 70% rest is the design */
@keyframes cta-shine {
  0%, 70% { left: -60%; opacity: 0; }
  71%     { opacity: 1; }
  100%    { left: 130%; opacity: 1; }
}
/* ── LAYER 5: beam divider — heartbeat, not conveyor. Ambient only in
   showcase; CALM fires one-shot (.beam-fire) on real data events. ── */
.beam-line {
  position: relative; height: 1px;
  background: rgba(255,255,255,.06);
  overflow: hidden; margin: 8px 0;
}
html:not([data-theme="dark"]) .beam-line { background: rgba(0,0,0,.08); }
html[data-theme="dark"] .beam-line::after {
  content: ""; position: absolute; top: -1px;
  height: 3px; width: 90px; border-radius: 3px; left: -90px; opacity: 0;
  background: linear-gradient(90deg, transparent, #a8d4ff, transparent);
  filter: blur(1px);
}
html[data-theme="dark"][data-intensity="showcase"] .beam-line::after {
  animation: beam-heartbeat 4.5s infinite;
}
html[data-theme="dark"] .beam-line.beam-fire::after {
  animation: beam-heartbeat 1.8s 1;
}
@keyframes beam-heartbeat {
  0%       { left: -90px; opacity: 0; }
  8%       { opacity: 1; }
  55%      { left: 100%; opacity: 1; }
  56%,100% { left: 100%; opacity: 0; }
}
/* one-shot vertical beam for the item-history timeline (data event) */
html[data-theme="dark"] .tl.beam-v-once::after {
  content: ""; position: absolute; left: 8px; top: -90px;
  width: 3px; height: 90px; border-radius: 3px;
  background: linear-gradient(180deg, transparent, #a8d4ff, transparent);
  filter: blur(1px);
  animation: beam-travel-v 1.4s ease-out 1 forwards;
}
@keyframes beam-travel-v {
  0%   { top: -90px; opacity: 0; }
  12%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
/* ── LAYER 6: card grid — spotlights, keylines, one conic orbit. ── */
html[data-theme="dark"] .card { background: var(--surface);
  border-color: var(--border); box-shadow: none; }
html[data-theme="dark"] .spot-card { position: relative; overflow: hidden; }
html[data-theme="dark"] .spot-card > * { position: relative; }
html[data-theme="dark"] .spot-card::before {
  content: ""; position: absolute; top: 0; left: 18%; right: 18%;
  height: 1px;
}
html[data-theme="dark"] .spot-card.keyline-v::before {
  background: linear-gradient(90deg, transparent, rgba(167,158,255,.8), transparent);
}
html[data-theme="dark"] .spot-card.keyline-c::before {
  background: linear-gradient(90deg, transparent, rgba(94,224,200,.7), transparent);
}
html[data-theme="dark"] .spot-card .spotlight {
  position: absolute; width: 150px; height: 150px;
  border-radius: 50%; pointer-events: none;
  opacity: 0; transition: opacity .25s;
}
html[data-theme="dark"] .spot-card.keyline-v .spotlight {
  background: radial-gradient(circle, rgba(167,158,255,.22), transparent 70%);
}
html[data-theme="dark"] .spot-card.keyline-c .spotlight {
  background: radial-gradient(circle, rgba(94,224,200,.20), transparent 70%);
}
html[data-theme="dark"] .spot-card:hover .spotlight { opacity: 1; }
@property --orbit { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
html[data-theme="dark"] .conic-card {
  border: 1px solid transparent !important;
  background: linear-gradient(#101019,#101019) padding-box,
    conic-gradient(from var(--orbit, 40deg), rgba(167,158,255,.9),
      rgba(94,224,200,.4), rgba(255,255,255,.05),
      rgba(167,158,255,.9)) border-box !important;
}
html[data-theme="dark"][data-intensity="showcase"] .conic-card {
  animation: conic-orbit 20s linear infinite;   /* slow = premium */
}
@keyframes conic-orbit { to { --orbit: 360deg; } }
/* positive deltas: cyan, never generic green (token map handles it) */
/* ── Quiet interior components (carried forward, spec-compatible). ── */
html[data-theme="dark"] .kmenu,
html[data-theme="dark"] .scope-also-dropdown,
html[data-theme="dark"] .photo-scope-dialog {
  background: var(--surface-3); border-color: var(--border-strong);
  box-shadow: none; color: var(--text); }
html[data-theme="dark"] .kmenu-assign { background: var(--surface-2); }
html[data-theme="dark"] .scope-option:hover,
html[data-theme="dark"] .scope-option.selected {
  background: var(--surface-hover); color: var(--text);
  border-color: var(--border-strong); }
html[data-theme="dark"] .scope-also-search {
  background: var(--surface-2); color: var(--text);
  border-color: var(--border); }
html[data-theme="dark"] .scope-also-tick { background: var(--surface-2); }
html[data-theme="dark"] .btn.primary {
  background: var(--cta); border-color: transparent; color: #fff;
  box-shadow: 0 0 26px rgba(110,91,255,.35); }
html[data-theme="dark"] .btn.primary:hover { background: var(--cta-hover); }
html[data-theme="dark"] .drawer-link.active {
  box-shadow: inset 2px 0 0 var(--accent-link); color: var(--accent-link); }
html[data-theme="dark"] .btn:hover { background: var(--surface-2); }
html[data-theme="dark"] .btn:active { background: var(--surface-3); }
html[data-theme="dark"] button.chip:hover,
html[data-theme="dark"] a.chip:hover,
html[data-theme="dark"] .cat-chip:hover,
html[data-theme="dark"] .kmenu-row:hover,
html[data-theme="dark"] .drawer-link:hover,
html[data-theme="dark"] .past-row .btn:hover,
html[data-theme="dark"] #results .row:hover { background: var(--surface-hover); }
html[data-theme="dark"] .cat-chip.active {
  background: var(--cta); border-color: transparent; color: #fff;
  box-shadow: none; }
html[data-theme="dark"] :focus-visible {
  outline: 2px solid var(--accent-link); outline-offset: 2px; }
html[data-theme="dark"] ::selection { background: rgba(110,91,255,.35); }
html[data-theme="dark"] .hero-pill.on_hand { background: var(--status-on-hand-fill); }
html[data-theme="dark"] .hero-pill.returned { background: var(--status-returned-fill); }
html[data-theme="dark"] .hero-pill.sold { background: var(--status-invoiced-fill); }
html[data-theme="dark"] .card-avatar.on_hand { background: var(--status-on-hand-soft); }
html[data-theme="dark"] .brand-mark {
  background: linear-gradient(135deg, #f0d080 0%, #d3a63f 60%, #b3862c 100%);
  color: #241a05; box-shadow: 0 0 0 1px rgba(240,208,128,.30); }
html[data-theme="dark"] img { opacity: .97; }
html[data-theme="dark"] .scan-card-photo,
html[data-theme="dark"] .card-image,
html[data-theme="dark"] .detail-image,
html[data-theme="dark"] .item-head img {
  box-shadow: 0 0 0 1px rgba(255,255,255,.10); }
html[data-theme="dark"] .sk-bar {
  background: linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.12) 50%, rgba(255,255,255,.05) 75%);
  background-size: 200% 100%; }
html[data-theme="dark"] ::placeholder { color: var(--text-muted); }
/* The dark theme lightens --memo-color/--invoice-color to pastels, so the
   white labels on the upload page's file-type buttons dropped to 2.50:1 and
   2.89:1. Dark ink on those pastels is 7.28:1 and 6.29:1. */
html[data-theme="dark"] .btn-memo,
html[data-theme="dark"] .btn-invoice,
html[data-theme="dark"] .btn-inventory { color: var(--on-accent); }

/* ── Dark-mode ink on pale fills ──────────────────────────────────────────
   The dark theme lightens several "status" fills to pastels, but the ink on
   them stayed white or stayed dark, so it disappeared. Each pairing below is
   computed, not eyeballed. */
/* Drawer count badge: white on the amber fill was 1.98:1 — it appears on
   every page, so this was the single most widespread failure. 9.32:1 now. */
html[data-theme="dark"] .drawer-badge { color: var(--on-accent); }
html[data-theme="dark"] .drawer-badge:not(.is-review) { color: #fff; }
/* DataTables pager: the current page sits on --gold (#e8c05c in dark) and was
   inheriting light text at 1.54:1. Arrows were #666 on near-black at 3.29:1. */
html[data-theme="dark"] .dataTables_paginate .paginate_button.current,
html[data-theme="dark"] .dataTables_paginate .paginate_button.current:hover {
  color: var(--on-accent) !important; }
html[data-theme="dark"] .dataTables_paginate .paginate_button {
  color: var(--text-muted) !important; }
/* Role badges: #7c3aed ink on its own 12%-alpha violet wash was 1.36-2.83:1. */
html[data-theme="dark"] .badge-ADMIN,
html[data-theme="dark"] .badge.badge-ADMIN { color: #c4a2ff; }
/* .view-switch is hardcoded `background:#fff` with #86868b links (analytics,
   order history, temp-memo mobile). In dark mode the pill stayed white. */
html[data-theme="dark"] .view-switch {
  background: var(--surface-2); border-color: var(--border); box-shadow: none; }
html[data-theme="dark"] .view-switch a { color: var(--text-secondary); }
html[data-theme="dark"] .view-switch a:hover { color: var(--text); }
/* :not([class*="btn"]) — NOT :not(.btn). The button classes in this app are
   .btn-primary / .btn-secondary / .btn.primary, none of which match .btn on
   its own, so every <a> styled as a button was being repainted with
   --accent-link. On a primary button that is accent text on an accent
   background: the label vanished completely. */
html[data-theme="dark"] a:not(.brand):not(.chip):not([class*="btn"]):not(.drawer-link) {
  color: var(--accent-link); }
/* Inventory grid filter rail (carried) */
html[data-theme="dark"] .filter-rail .chip,
html[data-theme="dark"] .cust-sel-btn,
html[data-theme="dark"] .select-chip {
  background: var(--surface-2); border: 1px solid transparent;
  color: var(--text-secondary); backdrop-filter: none;
  -webkit-backdrop-filter: none; box-shadow: none; }
html[data-theme="dark"] .filter-rail .chip::before { display: none; }
html[data-theme="dark"] .filter-rail .chip:hover,
html[data-theme="dark"] .cust-sel-btn:hover,
html[data-theme="dark"] .select-chip:hover {
  background: var(--surface-hover); color: var(--text);
  border-color: transparent; box-shadow: none; transform: none; }
html[data-theme="dark"] .filter-rail .chip.active {
  background: var(--cta); color: #fff; border-color: transparent;
  font-weight: 700; box-shadow: none; }
html[data-theme="dark"] .filter-rail .chip.active:hover {
  background: var(--cta-hover); box-shadow: none; }
html[data-theme="dark"] .filter-rail .chip.active.chip-on {
  background: var(--green-soft); color: var(--green); }
html[data-theme="dark"] .filter-rail .chip.active.chip-memo {
  background: var(--amber-soft); color: var(--amber); }
html[data-theme="dark"] .filter-rail .chip.active.chip-temp {
  background: var(--violet-soft); color: var(--violet); }
html[data-theme="dark"] .filter-rail .chip.active.chip-melt {
  background: rgba(94,234,212,.13); color: #5eead4; }
html[data-theme="dark"] .filter-rail .chip.active.chip-off {
  background: var(--red-soft); color: var(--red); }
html[data-theme="dark"] .cust-sel-menu {
  background: var(--surface-3); border-color: var(--border-strong);
  box-shadow: none; }
html[data-theme="dark"] .cust-sel-opt { color: var(--text-secondary); }
html[data-theme="dark"] .cust-sel-opt:hover {
  background: var(--surface-hover); color: var(--text); }
html[data-theme="dark"] .cust-sel-opt.sel-active {
  background: var(--accent-soft); color: var(--accent-strong); }
html[data-theme="dark"] .cust-sel.active .cust-sel-btn,
html[data-theme="dark"] .cust-sel.open .cust-sel-btn {
  background: var(--accent-soft); color: var(--accent-strong);
  border-color: transparent; box-shadow: none; }
/* Dotted Customer chip: the dashed outline must survive the dark rail's
   transparent-border restyle — it IS the affordance. */
html[data-theme="dark"] .cust-dotted .cust-sel-btn {
  border: 1px dashed rgba(255,255,255,.28); }
html[data-theme="dark"] .cust-dotted.active .cust-sel-btn,
html[data-theme="dark"] .cust-dotted.open .cust-sel-btn {
  border: 1px solid transparent; }
html[data-theme="dark"] .cust-search-head { border-color: var(--border); }
html[data-theme="dark"] .cust-search-head input {
  background: var(--surface-2); border-color: var(--border); color: var(--text); }
html[data-theme="dark"] .cust-search-head input:focus { border-color: var(--accent); }
html[data-theme="dark"] .cust-clear-x {
  background: var(--surface-2); border-color: transparent;
  color: var(--text-secondary); }
html[data-theme="dark"] .cust-clear-x:hover { color: var(--red); }
html[data-theme="dark"] .cust-opt-n { color: var(--text-muted); }
html[data-theme="dark"] .cust-search-empty { color: var(--text-muted); }
/* ── Reduced motion: EVERYTHING off in both modes. ── */
@media (prefers-reduced-motion: reduce) {
  html[data-theme="dark"] body::before,
  html[data-theme="dark"] body::after,
  html[data-theme="dark"] .star,
  html[data-theme="dark"] .grad-headline,
  html[data-theme="dark"] .cta-nebula,
  html[data-theme="dark"] .cta-nebula::after,
  html[data-theme="dark"] .beam-line::after,
  html[data-theme="dark"] .tl.beam-v-once::after,
  html[data-theme="dark"] .conic-card { animation: none !important; }
  html[data-theme="dark"] .beam-line::after {
    left: 20%; opacity: .5; }          /* static accent segment */
  html[data-theme="dark"] body::before,
  html[data-theme="dark"] body::after {
    translate: 0 0; }                  /* parallax off */
}
/* ════════════════════════════════════════════════════════════════════
   LIGHT MODE — "PORCELAIN". Daylight sibling of Nebula (exact-spec
   build 2026-07-21). CORE PHYSICS: glows become COLORED SHADOWS, light
   beams become INK, keylines become hover-lifts. Same component logic,
   switched purely by data-theme.
   FLAGGED DEVIATIONS: ① teal #0FA88A fails AA as text (3.00) → text
   uses --teal-text #0B8168 (4.82), #0FA88A kept for fills/borders (the
   spec's own fix-under-AA rule); ② light brand accent migrates from
   the legacy #0071e3 blue to spec #5B48E8 violet APP-WIDE; ③ auroras
   at z-index:-1 (same guarantee as content z-index:1); ④ stars hidden
   in light per spec ("they don't exist"); ⑤ conic card lives on a calm
   page → static per mode rules.
   ════════════════════════════════════════════════════════════════════ */
html:not([data-theme="dark"]) {
  --bg-page: #fafbfd;
  --bg-card: #ffffff;
  --frame-border: #e4e6ee;
  --border-subtle: rgba(15,15,35,.07);
  --teal: #0fa88a;
  --teal-text: #0b8168;
  --shadow-rest: 0 1px 3px rgba(22,22,31,.06);
  --shadow-lift: 0 6px 20px rgba(22,22,31,.08), 0 2px 8px rgba(91,72,232,.14);
  --shadow-accent-rest: 0 4px 14px rgba(91,72,232,.18);
  --shadow-accent-peak: 0 8px 28px rgba(91,72,232,.30);
  /* legacy token map → Porcelain (overrides each page's inline :root) */
  --bg: #fafbfd;
  --surface: #ffffff;
  --border: #e4e6ee;
  --border-strong: #c9cbdc;
  --border-hover: #b6b9cd;
  --text: #16161f;
  --text-secondary: #5c5b70;
  --text-muted: #8e8da0;
  --accent: #5b48e8;
  --accent-hover: #6a58f0;
  --on-accent: #ffffff;
  --surface-translucent: var(--surface-translucent);
  --accent-strong: #4f3dd6;
  --accent-soft: rgba(91,72,232,.10);
  --primary: #5b48e8; --primary-soft: rgba(91,72,232,.10);
  --green: #0b8168;   --green-soft: rgba(15,168,138,.12);
  --emerald: #0b8168; --emerald-soft: rgba(15,168,138,.12);
  --success: #0b8168; --success-bg: rgba(15,168,138,.10);
  --on-hand: #0b8168;
  --status-on-hand: #0b8168;
  --status-on-hand-soft: rgba(15,168,138,.12);
  --shadow-sm: 0 1px 3px rgba(22,22,31,.06);
  --shadow-md: 0 6px 20px rgba(22,22,31,.08), 0 2px 8px rgba(91,72,232,.14);
  --shadow-hover: 0 6px 20px rgba(22,22,31,.08), 0 2px 8px rgba(91,72,232,.14);
  --grad: linear-gradient(135deg, #5b48e8 0%, #0fa88a 100%);
}
html:not([data-theme="dark"]) body { background: var(--bg-page); }
/* LAYER 1: pastel auroras + shared parallax vars (drawer.js rAF). */
html:not([data-theme="dark"]) body::before,
html:not([data-theme="dark"]) body::after {
  content: ""; position: fixed; pointer-events: none; z-index: -1;
  opacity: .5;                       /* calm; showcase overrides */
}
html:not([data-theme="dark"]) body::before {
  width: 420px; height: 340px; top: -140px; left: -60px;
  background: radial-gradient(ellipse, rgba(124,111,255,.13), transparent 65%);
  animation: nebula-drift-a 9s ease-in-out infinite alternate;
  translate: calc(var(--par-x, 0) * 24px) calc(var(--par-y, 0) * 14px);
}
html:not([data-theme="dark"]) body::after {
  width: 380px; height: 300px; top: -120px; right: -70px;
  background: radial-gradient(ellipse, rgba(15,200,170,.09), transparent 65%);
  animation: nebula-drift-b 11s ease-in-out infinite alternate;
  translate: calc(var(--par-x, 0) * -18px) calc(var(--par-y, 0) * -10px);
}
html:not([data-theme="dark"])[data-intensity="showcase"] body::before,
html:not([data-theme="dark"])[data-intensity="showcase"] body::after { opacity: 1; }
/* LAYER 2: dot grid, NO stars in light. */
html:not([data-theme="dark"]) .hero-sky {
  position: absolute; inset: 0 0 auto 0; height: 140px;
  pointer-events: none; overflow: hidden;
}
html:not([data-theme="dark"]) .hero-sky::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(22,22,31,0.13) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, black, transparent);
  mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, black, transparent);
}
html:not([data-theme="dark"]) .star { display: none; }
/* LAYER 3: floating nav — shadow, not glass edge. */
html:not([data-theme="dark"]) .topbar {
  background: rgba(255,255,255,.7);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 1px 12px rgba(22,22,31,.04);
}
/* LAYER 4: hero. */
html:not([data-theme="dark"]) .hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  color: var(--teal-text);
  background: rgba(15,168,138,.08);
  border: 1px solid rgba(15,168,138,.22);
  border-radius: 20px; padding: 4px 14px;
  text-transform: uppercase;
}
html:not([data-theme="dark"]) .grad-headline {
  background: linear-gradient(90deg, #16161f, #5b48e8, #0b8168, #16161f);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  letter-spacing: -.5px;
}
html:not([data-theme="dark"])[data-intensity="showcase"] .grad-headline {
  animation: headline-flow 6s linear infinite;
}
html:not([data-theme="dark"]) .cta-nebula {
  position: relative; overflow: hidden;
  background: var(--accent) !important;
  border-color: transparent !important;
  color: var(--on-accent) !important;
  border-radius: 9px;
  box-shadow: var(--shadow-accent-rest);
}
html:not([data-theme="dark"])[data-intensity="showcase"] .cta-nebula {
  animation: cta-breathe-light 4s ease-in-out infinite;
}
html:not([data-theme="dark"])[data-intensity="showcase"] .cta-nebula::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%;
  left: -60%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-20deg);
  animation: cta-shine 3.5s ease-in-out infinite;
}
@keyframes cta-breathe-light {
  0%, 100% { box-shadow: 0 4px 14px rgba(91,72,232,.18); }
  50%      { box-shadow: 0 8px 28px rgba(91,72,232,.30); }
}
/* LAYER 5: ink beam — same heartbeat, ink instead of light. */
html:not([data-theme="dark"]) .beam-line { background: rgba(15,15,35,.07); }
html:not([data-theme="dark"]) .beam-line::after {
  content: ""; position: absolute; top: -1px;
  height: 3px; width: 90px; border-radius: 3px; left: -90px; opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(91,72,232,.55), transparent);
  filter: blur(1px);
}
html:not([data-theme="dark"])[data-intensity="showcase"] .beam-line::after {
  animation: beam-heartbeat 4.5s infinite;
}
html:not([data-theme="dark"]) .beam-line.beam-fire::after {
  animation: beam-heartbeat 1.8s 1;
}
html:not([data-theme="dark"]) .tl.beam-v-once::after {
  content: ""; position: absolute; left: 8px; top: -90px;
  width: 3px; height: 90px; border-radius: 3px;
  background: linear-gradient(180deg, transparent, rgba(91,72,232,.5), transparent);
  filter: blur(1px);
  animation: beam-travel-v 1.4s ease-out 1 forwards;
}
/* LAYER 6: spotlight-lift cards + conic. */
html:not([data-theme="dark"]) .spot-card {
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-rest);
  transition: box-shadow .2s, transform .2s;
}
html:not([data-theme="dark"]) .spot-card > * { position: relative; }
html:not([data-theme="dark"]) .spot-card:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}
html:not([data-theme="dark"]) .spot-card .spotlight {
  position: absolute; width: 150px; height: 150px;
  border-radius: 50%; pointer-events: none;
  opacity: 0; transition: opacity .25s;
}
html:not([data-theme="dark"]) .spot-card.keyline-v .spotlight {
  background: radial-gradient(circle, rgba(124,111,255,.10), transparent 70%);
}
html:not([data-theme="dark"]) .spot-card.keyline-c .spotlight {
  background: radial-gradient(circle, rgba(15,168,138,.08), transparent 70%);
}
html:not([data-theme="dark"]) .spot-card:hover .spotlight { opacity: 1; }
html:not([data-theme="dark"]) .conic-card {
  border: 1px solid transparent !important;
  background: linear-gradient(#fff,#fff) padding-box,
    conic-gradient(from var(--orbit, 40deg), rgba(91,72,232,.7),
      rgba(15,168,138,.4), rgba(22,22,31,.05),
      rgba(91,72,232,.7)) border-box !important;
  box-shadow: var(--shadow-rest);
}
html:not([data-theme="dark"])[data-intensity="showcase"] .conic-card {
  animation: conic-orbit 20s linear infinite;
}
html:not([data-theme="dark"]) .conic-card .grp-head b { color: var(--accent); }
/* Reduced motion: all off; lifts become border-color changes. */
@media (prefers-reduced-motion: reduce) {
  html:not([data-theme="dark"]) body::before,
  html:not([data-theme="dark"]) body::after,
  html:not([data-theme="dark"]) .grad-headline,
  html:not([data-theme="dark"]) .cta-nebula,
  html:not([data-theme="dark"]) .cta-nebula::after,
  html:not([data-theme="dark"]) .beam-line::after,
  html:not([data-theme="dark"]) .tl.beam-v-once::after,
  html:not([data-theme="dark"]) .conic-card { animation: none !important; }
  html:not([data-theme="dark"]) body::before,
  html:not([data-theme="dark"]) body::after { translate: 0 0; }
  html:not([data-theme="dark"]) .beam-line::after { left: 20%; opacity: .5; }
  html:not([data-theme="dark"]) .spot-card:hover {
    transform: none; box-shadow: var(--shadow-rest);
    border-color: var(--border-strong);
  }
}
/* iOS renders input[type=search] with a native WHITE field regardless
   of page CSS (reported: inventory search bar white on phone in dark).
   Strip the native appearance so page/theme styling wins. */
input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
}
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
/* Theme switch: colors only, 180ms. Never layout. */
html.theme-melt, html.theme-melt body,
html.theme-melt .card, html.theme-melt .topbar,
html.theme-melt .chip, html.theme-melt .btn,
html.theme-melt input, html.theme-melt select, html.theme-melt textarea {
  transition: background-color .18s ease, color .18s ease,
              border-color .18s ease !important;
}
