/* =============================================================================
   Dashmesh Gift Center — Owner Dashboard
   Production CSS extracted from mockup v4 (approved by Deep, 2026-05-28).
   DO NOT override --primary/--accent/--bg/--text here; they come from head.ejs.
   ============================================================================= */

/* =========================================================================
   SECTION 0 — Tokens local to the dashboard
   ========================================================================= */
:root {
  --primary-dark:   #5C141F;
  --primary-soft:   rgba(122, 31, 43, 0.06);
  --primary-line:   rgba(122, 31, 43, 0.12);
  --accent-soft:    rgba(201, 162, 39, 0.14);
  --accent-glow:    rgba(201, 162, 39, 0.45);
  --bg-deep:        #F2E8D2;
  --surface:        #FFFFFF;
  --text-muted:     #6E6862;
  --text-faint:     #9E9893;
  --hairline:       rgba(42, 37, 34, 0.08);
  --ok:             #2F7D58;
  --warn:           #C77A12;
  --danger:         #B3261E;
  --danger-soft:    #B85060;
  --chip-web:       #2D6F9F;
  --chip-call:      #7A1F2B;
  --chip-whatsapp:  #1F7A4A;
  --chip-store:     #6B4A26;
  --radius-card:    14px;
  --radius-tile:    12px;
  --radius-chip:    999px;
  --radius-input:   12px;
  --shadow-1:       0 1px 2px rgba(42, 37, 34, 0.05), 0 1px 1px rgba(42, 37, 34, 0.04);
  --shadow-2:       0 4px 16px rgba(42, 37, 34, 0.08), 0 1px 3px rgba(42, 37, 34, 0.05);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --topbar-h: 60px;
}

/* =========================================================================
   SECTION 1 — Base / stage
   ========================================================================= */

/* Prevent horizontal scroll at mobile widths (spec §9: no horizontal scroll at 360-375px).
   html must also be constrained because browsers propagate body overflow-x:hidden to the
   viewport, leaving <html> as the scroll container — document.documentElement.scrollWidth
   would still report the full content width without this rule. */
html { overflow-x: hidden; }

.dashboard-body {
  background:
    radial-gradient(ellipse at top, rgba(201, 162, 39, 0.05), transparent 55%),
    var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

.stage {
  max-width: 420px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* =========================================================================
   SECTION 2 — Sticky top bar
   ========================================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  backdrop-filter: saturate(140%) blur(6px);
  -webkit-backdrop-filter: saturate(140%) blur(6px);
  min-height: var(--topbar-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  /* Long-press target: ring fills on pointerdown hold */
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

/* Gold ring that fills around the brand mark during long press */
.brand--ring-fill .brand__mark {
  outline: 2px solid transparent;
  animation: none;
}

.brand__ring {
  position: absolute;
  inset: -3px;
  border-radius: 10px;
  pointer-events: none;
  /* Clip path animates from 0% to 100% on long-press, controlled via JS/custom property */
  background: conic-gradient(var(--accent) calc(var(--ring-pct, 0) * 1%), transparent 0);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.1s;
}
.brand--pressing .brand__ring {
  opacity: 0.7;
}

.brand__mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: radial-gradient(circle at 30% 30%, #8B2535, var(--primary) 70%);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 1px 2px rgba(42, 37, 34, 0.15);
}

.brand__mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.brand__mark-initials {
  color: var(--accent);
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
}

.brand__name {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.15;
  color: var(--text);
  letter-spacing: -0.005em;
}

.brand__name small {
  display: block;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 1px;
}

/* B4/B7: Mobile topbar — constrain brand name and live pill to fit on one row at 375px */
@media (max-width: 479px) {
  .brand__name {
    font-size: 13px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .brand__name small {
    /* Hide subtitle on smallest screens to prevent wrap */
    display: none;
  }
  .live {
    font-size: 11px;
    padding: 4px 8px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  /* Ensure live__dot isn't oversized at mobile */
  .live__dot {
    width: 6px;
    height: 6px;
  }
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  padding: 6px 10px;
  border-radius: var(--radius-chip);
  border: 1px solid var(--hairline);
  min-height: 28px;
}

.live__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(199, 122, 18, 0.18);
  transition: background 0.3s, box-shadow 0.3s;
  flex: 0 0 auto;
}

.live__dot.ws-status--connected {
  background: #1F7A4A;
  box-shadow: 0 0 0 3px rgba(31, 122, 74, 0.18);
  animation: pulse-dot 2.4s ease-in-out infinite;
}
.live__dot.ws-status--connecting {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(199, 122, 18, 0.18);
}
.live__dot.ws-status--disconnected {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.18);
  animation: none;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 3px rgba(31, 122, 74, 0.18); }
  50%       { box-shadow: 0 0 0 5px rgba(31, 122, 74, 0.10); }
}

/* =========================================================================
   SECTION 3 — Section frame
   ========================================================================= */
.section {
  padding: var(--space-5) 0 var(--space-2);
}

.section__rail {
  padding: 0 var(--space-4);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.section__title {
  font-size: 19px;
  line-height: 1.2;
  position: relative;
  padding-bottom: 6px;
}

/* Gold underline on the currently visible section */
.section__title.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 32px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.section__sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* V4-5 — stacked rail for Needs Attention */
.section__rail--stack {
  align-items: flex-start;
}
.section__rail-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.section__subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--danger-soft);
  margin-top: 2px;
}
.section__rail--stack .section__sub {
  align-self: flex-start;
  padding-top: 4px;
}

/* =========================================================================
   SECTION 4 — KPI strip
   ========================================================================= */
/* Mobile (< 768px): 2-column grid — 4 numeric tiles + 1 full-width donut */
.kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-2);
}
/* Donut tile spans both columns on mobile */
.kpi--donut {
  grid-column: 1 / -1;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-tile);
  padding: 12px var(--space-3);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: background 0.15s;
}
.kpi:hover { background: var(--primary-soft); }
.kpi:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Brief gold flash on tap */
.kpi.is-tapped { animation: kpi-tap 250ms ease-out; }
@keyframes kpi-tap {
  0%   { background: var(--accent-soft); }
  100% { background: transparent; }
}

.kpi__eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Desktop hover: 1px gold underline on eyebrow */
.kpi:hover .kpi__eyebrow {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.kpi__value {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1.05;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.kpi__value .rupee {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  margin-right: 2px;
}

.kpi__delta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi__delta .up   { color: #2F7D58; font-weight: 600; }
.kpi__delta .flat { color: var(--text-muted); }

.kpi--low .kpi__value { color: var(--danger); }
.kpi--low::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--danger);
  opacity: 0.85;
}

/* Channel donut tile */
.kpi--donut {
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
}

.donut {
  --size: 88px;
  width: var(--size);
  height: var(--size);
  flex: 0 0 auto;
  position: relative;
}
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut__center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
}
.donut__total {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.donut__label {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.legend {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  font-size: 12px;
  min-width: 0;
}
.legend__row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}
.legend__swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex: 0 0 auto;
}
.legend__name  { color: var(--text-muted); }
.legend__count { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

/* =========================================================================
   SECTION 5 — Activity feed
   ========================================================================= */
.feed {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  margin: 0 var(--space-4);
  border-radius: var(--radius-card);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.feed__row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--hairline);
  min-height: 64px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}
.feed__row:last-child { border-bottom: none; }
.feed__row:hover { background: var(--primary-soft); }

.feed__row.is-new {
  animation: gold-flash 1500ms ease-out;
}
@keyframes gold-flash {
  0%   { background-color: var(--accent-soft); }
  60%  { background-color: rgba(201, 162, 39, 0.06); }
  100% { background-color: transparent; }
}

/* Expanded row */
.feed__row.is-expanded { align-items: start; }
.feed__expand {
  display: none;
  grid-column: 1 / -1;
  padding: var(--space-2) 0 var(--space-2);
  border-top: 1px solid var(--hairline);
  margin-top: var(--space-2);
  font-size: 13px;
  color: var(--text-muted);
  gap: var(--space-2);
}
.feed__row.is-expanded .feed__expand { display: flex; flex-direction: column; gap: 6px; }

.feed__deliver-btn {
  background: var(--primary);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-chip);
  padding: 8px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}
.feed__deliver-btn:hover { background: var(--primary-dark); }
.feed__deliver-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* SVG checkmark draw animation */
.feed__row.is-delivered .feed__deliver-btn { display: none; }
.delivered-check {
  display: none;
  width: 24px;
  height: 24px;
  color: var(--ok);
}
.feed__row.is-delivered .delivered-check { display: inline-block; }
.delivered-check path {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw-check 500ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
@keyframes draw-check {
  to { stroke-dashoffset: 0; }
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-chip);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
  white-space: nowrap;
  /* B5: fixed width aligns order IDs across all feed rows */
  min-width: 80px;
  flex-shrink: 0;
  text-align: center;
}

@media (min-width: 768px) {
  .feed__row .chip {
    min-width: 88px;
  }
}
.chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.chip--web      { background: rgba(45, 111, 159, 0.10); color: var(--chip-web); }
.chip--web .chip__dot { background: var(--chip-web); }
.chip--call     { background: rgba(122, 31, 43, 0.10); color: var(--chip-call); }
.chip--call .chip__dot { background: var(--chip-call); }
.chip--whatsapp { background: rgba(31, 122, 74, 0.10); color: var(--chip-whatsapp); }
.chip--whatsapp .chip__dot { background: var(--chip-whatsapp); }
.chip--store    { background: rgba(107, 74, 38, 0.10); color: var(--chip-store); }
.chip--store .chip__dot { background: var(--chip-store); }
.chip--warn     { background: var(--accent-soft); color: #8A6A0A; font-weight: 700; }
.chip--warn .chip__dot { background: var(--accent); }

/* Dim chip when delivered */
.feed__row.is-delivered .chip { opacity: 0.45; }

.feed__body { min-width: 0; }
.feed__line1 {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feed__num   { font-variant-numeric: tabular-nums; color: var(--text); }
.feed__total { color: var(--text-muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.feed__line2 {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feed__time {
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  align-self: flex-start;
  padding-top: 2px;
}

.feed__empty {
  padding: var(--space-5) var(--space-4);
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* =========================================================================
   SECTION 6 — Low-stock panel (V4-1 flex rail)
   ========================================================================= */
.low-stock-wrap {
  position: relative;
}

.low-stock {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-3);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--space-4);
  scrollbar-width: none;
}
.low-stock::-webkit-scrollbar { display: none; }

.ls-card {
  flex: 0 0 60vw;
  max-width: 280px;
  scroll-snap-align: start;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--danger);
  border-radius: var(--radius-card);
  padding: 0;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-height: 308px;
}

.ls-card__img {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-deep);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.ls-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ls-card__body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.ls-card__count {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 38px;
  line-height: 1;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  margin-top: 4px;
}
.ls-card__count .of   { font-size: 14px; color: var(--text-muted); font-weight: 500; margin-left: 2px; font-variant-numeric: tabular-nums; }
.ls-card__count .word { font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); display: block; margin-top: 4px; }

.ls-card__name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 32px;
  margin-top: 6px;
}

.ls-card__cta {
  background: var(--primary);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 0 12px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  letter-spacing: 0.01em;
  margin-top: 10px;
  box-shadow: 0 2px 6px rgba(122, 31, 43, 0.20);
  transition: background 0.15s;
}
.ls-card__cta:hover { background: var(--primary-dark); }

/* C2 gold flash on ls-card when tapped via toast deep-link */
.ls-card.is-tapped { animation: card-flash 700ms ease-out; }

/* D2 — chevron scroll button; visible only on desktop >=1280 px */
.low-stock-chevron {
  display: none;
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-2);
  color: var(--primary);
  cursor: pointer;
  place-items: center;
  z-index: 2;
  transition: background 0.15s, color 0.15s;
}
.low-stock-chevron:hover { background: var(--primary); color: var(--bg); }
.low-stock-chevron svg   { width: 18px; height: 18px; }

/* =========================================================================
   SECTION 7 — Inventory: search + scan + lang + sort + recent scans
   ========================================================================= */
.search {
  margin: 0 var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.search__row {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
}

.search__input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-input);
  padding: 0 var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  box-shadow: var(--shadow-1);
}

.search__input input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  padding: 0;
  min-width: 0;
}
.search__input input::placeholder { color: var(--text-faint); }

.search__icon {
  width: 22px;
  height: 22px;
  color: var(--text-muted);
  flex: 0 0 auto;
}

.search__mic {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  flex: 0 0 auto;
  transition: color 0.2s;
}
.search__mic svg { width: 18px; height: 18px; }
.search__mic.is-listening {
  color: var(--danger);
  box-shadow: 0 0 0 6px rgba(179, 38, 30, 0.15);
  border-radius: 50%;
  animation: mic-pulse 1.5s ease-in-out infinite;
}
.search__mic[hidden] { display: none; }

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(179, 38, 30, 0.12); }
  50%       { box-shadow: 0 0 0 8px rgba(179, 38, 30, 0.22); }
}

.search__spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--primary-line);
  border-top-color: var(--primary);
  animation: spin 700ms linear infinite;
  flex: 0 0 auto;
  margin-right: 2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.search__scan {
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-input);
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: var(--shadow-1);
  transition: opacity 0.15s;
}
.search__scan svg { width: 18px; height: 18px; }
.search__scan:active { opacity: 0.8; }

/* V4-3 — search__meta: lang-pills LEFT + sort RIGHT, INLINE no wrap */
.search__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: nowrap;
  min-width: 0;
}
.search__meta > .lang-pills { flex: 0 0 auto; }
.search__meta > .sort       { flex: 0 0 auto; }

.lang-pills {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-chip);
  padding: 3px;
  gap: 0;
}
.lang-pill {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: var(--radius-chip);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  cursor: pointer;
  min-height: 28px;
  min-width: 36px;
  transition: background 0.15s, color 0.15s;
}
.lang-pill.is-active { background: var(--primary); color: var(--bg); }

/* V4-4 — Recent Scans: single-line horizontal scroll */
.recent-scans {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  padding: 0 var(--space-4) 0;
  margin-bottom: var(--space-2);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.recent-scans::-webkit-scrollbar { display: none; }
.recent-scans > * { flex: 0 0 auto; }

.recent-scans__fade {
  position: sticky;
  right: 0;
  flex: 0 0 28px;
  width: 28px;
  height: 100%;
  margin-left: -28px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(251, 247, 240, 0) 0%, rgba(251, 247, 240, 0.92) 70%, rgba(251, 247, 240, 1) 100%);
}

.recent-scans__label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  align-self: center;
  margin-right: 2px;
}

.scan-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-chip);
  padding: 4px 10px 4px 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow-1);
  min-height: 28px;
  cursor: pointer;
  transition: background 0.15s;
}
.scan-chip:hover { background: var(--bg-deep); }
.scan-chip__img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-deep);
  overflow: hidden;
  flex: 0 0 auto;
}
.scan-chip__img img { width: 100%; height: 100%; object-fit: cover; }

/* Sort dropdown */
.sort {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-chip);
  padding: 0 8px 0 12px;
  min-height: 32px;
}
.sort__label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.sort select {
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 16px 4px 4px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%237A1F2B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='1 1 5 5 9 1'/></svg>");
  background-repeat: no-repeat;
  background-position: right 2px center;
}

/* =========================================================================
   SECTION 8 — Category chips row
   ========================================================================= */
.chips-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-2);
}

.cat-chips {
  flex: 1;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.cat-chips::-webkit-scrollbar { display: none; }

.cat-chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  background: var(--bg);
  border: 1px solid var(--primary-line);
  color: var(--primary);
  border-radius: var(--radius-chip);
  padding: 7px 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  min-height: 32px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.cat-chip.is-active {
  background: var(--primary);
  color: var(--bg);
  border-color: var(--primary);
}
.cat-chip:hover:not(.is-active) { background: var(--primary-soft); }

/* =========================================================================
   SECTION 9 — Inventory grid (D1 compact cards, V4 cascade fix)
   ========================================================================= */
/* V4 final cascade fix: :where() gives zero specificity so @media rules win */
:where(.grid) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-3);
}

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-1);
  position: relative;
  cursor: pointer;
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-2); }

.card.is-oos {
  opacity: 0.55;
  border-top: 2px solid var(--danger);
}
.card.is-oos .card__name { color: var(--text-muted); }

.card__img {
  aspect-ratio: 1;
  background: var(--bg-deep);
  overflow: hidden;
  position: relative;
}
.card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* -------------------------------------------------------------------------
   dash-product-img — product images in dashboard (grid, low-stock, scan result)
   width + height attrs set in JS to prevent CLS; CSS takes over sizing.
   --object-fit defaults to cover (fills square); SVG placeholders use contain.
   ------------------------------------------------------------------------- */
.dash-product-img {
  display: block;
}
/* When an image fails to load: show placeholder styling */
.dash-product-img--missing {
  object-fit: contain !important;
  padding: 12px;
  opacity: 0.6;
  filter: grayscale(0.4);
}

/* V4 R1 — badge top-right */
.card__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-chip);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
  box-shadow: var(--shadow-1);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-variant-numeric: tabular-nums;
}
.card__badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}
.card__badge--amber { color: var(--warn); }
.card__badge--amber::before { background: var(--warn); }
.card__badge--red   { color: var(--danger); }
.card__badge--red::before   { background: var(--danger); }

.card__body {
  padding: 10px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.card__name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}
.card__price {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.card__price .rupee { font-family: 'Inter', sans-serif; font-weight: 600; margin-right: 1px; }

.card__spark {
  display: block;
  width: 100%;
  height: 24px;
  color: var(--accent);
  margin-top: 6px;
  padding: 0 8px;
}

/* Skeleton card state */
.card.is-skeleton .card__img {
  background: linear-gradient(90deg, rgba(122,31,43,0.04) 25%, rgba(122,31,43,0.08) 50%, rgba(122,31,43,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.card.is-skeleton .card__name,
.card.is-skeleton .card__price,
.card.is-skeleton .card__badge {
  background: linear-gradient(90deg, rgba(122,31,43,0.04) 25%, rgba(122,31,43,0.08) 50%, rgba(122,31,43,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  color: transparent;
  min-height: 14px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* KPI skeleton */
.kpi.is-skeleton .kpi__value,
.kpi.is-skeleton .kpi__delta {
  background: linear-gradient(90deg, rgba(122,31,43,0.04) 25%, rgba(122,31,43,0.08) 50%, rgba(122,31,43,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  color: transparent;
  min-height: 30px;
}

/* Gold flash on WS update */
.card.is-flash { animation: card-flash 1500ms ease-out; }
@keyframes card-flash {
  0%   { box-shadow: 0 0 0 2px var(--accent-glow), var(--shadow-1); }
  100% { box-shadow: 0 0 0 0 rgba(201, 162, 39, 0), var(--shadow-1); }
}

/* Load more */
.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: var(--space-2) var(--space-4) var(--space-4);
}
.load-more {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  border-radius: var(--radius-chip);
  padding: 10px 22px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  min-height: 44px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.load-more:hover { background: var(--primary); color: var(--bg); }
.load-more__count { color: var(--text-muted); font-weight: 500; margin-left: 4px; }
.load-more:hover .load-more__count { color: rgba(251, 247, 240, 0.7); }
.load-more[hidden] { display: none; }

/* Empty state */
.empty-state {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
  padding: var(--space-4);
  margin: 0 var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.empty-state__title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  line-height: 1.3;
}
.empty-state__title em { font-style: italic; color: var(--primary); }
.empty-state__lede { font-size: 13px; color: var(--text-muted); }
.empty-state__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.empty-chip {
  background: var(--bg-deep);
  border: 1px solid var(--hairline);
  color: var(--primary);
  font-weight: 600;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-chip);
  cursor: pointer;
  min-height: 32px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s;
}
.empty-chip:hover { background: var(--primary); color: var(--bg); }

/* =========================================================================
   SECTION 10 — Charts
   ========================================================================= */
.charts {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 0 var(--space-4);
}

.chart {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
}

.chart__title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
}
.chart__sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-bottom: var(--space-3);
}

/* Top sellers bar chart */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar  { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: baseline; }
.bar__name { font-size: 13px; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar__val  { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bar__track {
  grid-column: 1 / -1;
  height: 6px;
  background: var(--bg-deep);
  border-radius: 3px;
  overflow: hidden;
}
.bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #9A2D3D);
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.bar:first-child .bar__fill { background: linear-gradient(90deg, var(--primary), var(--accent)); }

/* Sales by category donut */
.donut-large {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--space-4);
  align-items: center;
}
.donut-large .donut { --size: 120px; }
.donut-large__legend { display: grid; gap: 5px; font-size: 12px; }
.donut-large__legend .legend__row { padding: 1px 0; }

/* Hourly heatmap */
.heatmap {
  display: grid;
  grid-template-columns: 28px repeat(24, 1fr);
  gap: 2px;
  font-variant-numeric: tabular-nums;
}
.heatmap__day {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  align-self: center;
  font-weight: 600;
}
.heatmap__cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: rgba(122, 31, 43, 0.06);
  min-width: 0;
}
.heatmap__hours {
  display: grid;
  grid-template-columns: 28px repeat(24, 1fr);
  gap: 2px;
  margin-top: 6px;
  font-size: 9px;
  color: var(--text-faint);
}
.heatmap__hours span:nth-child(odd)   { visibility: hidden; }
.heatmap__hours span:first-child      { visibility: hidden; }

/* =========================================================================
   SECTION 11 — Footer
   ========================================================================= */
.foot {
  padding: var(--space-6) var(--space-4) var(--space-7);
  text-align: center;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

/* =========================================================================
   SECTION 12 — Toast stack
   ========================================================================= */
.toast-stack {
  position: fixed;
  top: calc(var(--topbar-h) + 6px);
  right: 12px;
  left: 12px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 360px;
  margin-left: auto;
}

.toast {
  pointer-events: auto;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-card);
  padding: 14px 38px 12px 14px;
  box-shadow: 0 10px 30px rgba(42, 37, 34, 0.15), 0 2px 6px rgba(42, 37, 34, 0.06);
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: toast-in 600ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes toast-in {
  0%   { transform: translateY(-10px); opacity: 0; }
  100% { transform: translateY(0);     opacity: 1; }
}
.toast.is-leaving {
  animation: toast-out 300ms ease-in forwards;
}
@keyframes toast-out {
  to { transform: translateY(-8px); opacity: 0; }
}

.toast__handle {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 2px;
  border-radius: 2px;
  background: rgba(42, 37, 34, 0.18);
}
.toast__close {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
}
.toast__close svg { width: 14px; height: 14px; }

.toast__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
}
.toast__head .order-num { color: var(--text); font-variant-numeric: tabular-nums; }
.toast__head .total {
  margin-left: auto;
  color: var(--primary);
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.toast__line {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* M1 — Low-stock toast variant */
.toast--lowstock { border-left-color: var(--accent); }
.toast__title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--danger);
  margin-top: 4px;
  line-height: 1.2;
}
.toast__subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--danger-soft);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: 2px;
}
.toast__product-line {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast__product-line .stock { color: var(--danger); font-weight: 700; font-variant-numeric: tabular-nums; }

/* =========================================================================
   SECTION 13 — Scanner sheet + scan result
   ========================================================================= */
.scanner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 11, 9, 0.85);
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--space-4);
}
.scanner-overlay[hidden] { display: none; }

.scanner-sheet {
  position: relative;
  background: #0F0B09;
  color: #FBF7F0;
  border-radius: 14px;
  overflow: hidden;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 9 / 14;
  max-height: 640px;
  box-shadow: var(--shadow-2);
}

.scanner-sheet__camera-wrap {
  position: absolute;
  inset: 0;
}
#scanner-qr-region {
  width: 100% !important;
  height: 100% !important;
}
/* Override html5-qrcode default styles */
#scanner-qr-region video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}
#scanner-qr-region img { display: none !important; }

.scanner-sheet__hint {
  position: absolute;
  bottom: 70px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: rgba(251, 247, 240, 0.45);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  pointer-events: none;
}

.scanner-sheet__finder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 220px;
  height: 220px;
  border-radius: 16px;
  background: transparent;
  pointer-events: none;
}
.scanner-sheet__finder::before,
.scanner-sheet__finder::after,
.scanner-sheet__finder > .corner-tl,
.scanner-sheet__finder > .corner-br {
  content: '';
  position: absolute;
  width: 36px;
  height: 36px;
  border-color: var(--accent);
  border-style: solid;
}
.scanner-sheet__finder::before  { top: 0;  left: 0;  border-width: 2px 0 0 2px; border-top-left-radius: 14px; }
.scanner-sheet__finder::after   { top: 0;  right: 0; border-width: 2px 2px 0 0; border-top-right-radius: 14px; }
.corner-tl, .corner-br { width: 36px; height: 36px; }
.scanner-sheet__finder .corner-tl { bottom: 0; left: 0;  border-width: 0 0 2px 2px; border-bottom-left-radius: 14px; }
.scanner-sheet__finder .corner-br { bottom: 0; right: 0; border-width: 0 2px 2px 0; border-bottom-right-radius: 14px; }

.scanner-sheet__sweep {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 12px var(--accent-glow);
  animation: scan-sweep 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes scan-sweep {
  0%, 100% { top: 16px;           opacity: 0.4; }
  50%       { top: calc(100% - 18px); opacity: 1; }
}

.scanner-sheet__close {
  position: absolute;
  bottom: var(--space-4);
  left: var(--space-4);
  background: var(--primary);
  color: var(--bg);
  border: none;
  border-radius: 999px;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  z-index: 2;
}
.scanner-sheet__close svg { width: 22px; height: 22px; }

.scanner-sheet__upload {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: transparent;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  z-index: 2;
}

.scanner-sheet__caption {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  background: rgba(15, 11, 9, 0.5);
  color: rgba(251, 247, 240, 0.85);
  border: 1px solid rgba(251, 247, 240, 0.12);
  border-radius: var(--radius-chip);
  padding: 6px 12px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 2;
}

/* Hidden file input for upload fallback */
#scanner-file-input { display: none; }

/* Post-decode product card */
.scan-result {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-2);
  margin: var(--space-3) var(--space-4) 0;
  padding: var(--space-4);
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: var(--space-3);
  align-items: start;
}
.scan-result[hidden] { display: none; }
.scan-result__img {
  width: 88px;
  height: 88px;
  border-radius: 10px;
  background: var(--bg-deep);
  overflow: hidden;
}
.scan-result__img img { width: 100%; height: 100%; object-fit: cover; }
.scan-result__body { min-width: 0; }
.scan-result__name {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.25;
  color: var(--text);
}
.scan-result__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.scan-result__meta strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.scan-result__price { font-family: 'Playfair Display', serif; font-weight: 700; color: var(--primary); font-size: 14px; }
.scan-result__last {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  border-top: 1px solid var(--hairline);
  padding-top: var(--space-2);
}
.scan-result__last strong { color: var(--text); }
.scan-result__actions {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.btn-primary {
  flex: 1;
  background: var(--primary);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-chip);
  padding: 0 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover  { background: var(--primary-dark); }
.btn-secondary {
  flex: 1;
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-chip);
  padding: 0 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-secondary:hover { background: var(--primary); color: var(--bg); }

/* =========================================================================
   SECTION 14 — Demo reset confirm sheet
   ========================================================================= */
.reset-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 37, 34, 0.55);
  z-index: 85;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.reset-overlay[hidden] { display: none; }

.reset-sheet {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: var(--space-5) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  animation: sheet-up 350ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.reset-sheet__handle {
  width: 36px;
  height: 3px;
  border-radius: 3px;
  background: var(--hairline);
  margin: 0 auto;
}
.reset-sheet__title {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}
.reset-sheet__body {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}
.reset-sheet__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.reset-sheet__cancel {
  background: var(--bg-deep);
  color: var(--text);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-chip);
  padding: 0 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  min-height: 48px;
  cursor: pointer;
}
.reset-sheet__confirm {
  background: var(--primary);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-chip);
  padding: 0 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  min-height: 48px;
  cursor: pointer;
  transition: background 0.15s;
}
.reset-sheet__confirm:hover { background: var(--primary-dark); }

/* Reorder confirm sheet */
.reorder-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 37, 34, 0.55);
  z-index: 85;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.reorder-overlay[hidden] { display: none; }

.reorder-sheet {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: var(--space-5) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  animation: sheet-up 350ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* =========================================================================
   SECTION 15 — Choreography animations
   ========================================================================= */
.gold-flash-on  { animation: gold-flash 1500ms ease-out !important; }
.card-flash-on  { animation: card-flash 1500ms ease-out !important; }

/* Low-stock panel pulse on KPI click */
.section__title--pulse {
  animation: title-pulse 700ms ease-out;
}
@keyframes title-pulse {
  0%, 100% { color: var(--text); }
  40%       { color: var(--accent); }
}

/* =========================================================================
   SECTION 16 — Tablet breakpoint (>=768 px)
   ========================================================================= */
@media (min-width: 768px) {
  .stage {
    max-width: 760px;
    margin-top: var(--space-5);
    margin-bottom: var(--space-5);
    border-radius: 24px;
    box-shadow:
      0 30px 80px rgba(42, 37, 34, 0.16),
      0 8px 20px rgba(42, 37, 34, 0.08);
    overflow: hidden;
  }
  .kpis {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: var(--space-3);
    overflow-x: visible;
    scroll-snap-type: none;
  }
  /* On tablet+, donut tile reverts to single column */
  .kpi--donut {
    grid-column: auto;
  }
  .kpi { min-height: 124px; padding: var(--space-4); }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  .charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    align-items: start;
  }
  .charts > .chart--heatmap { grid-column: 1 / -1; }

  /* D3 — hide scan button and recent-scans chips */
  .search__scan,
  .recent-scans {
    display: none !important;
  }

  /* V4-1 Tablet ls-card: 220px */
  .low-stock-wrap { position: relative; }
  .ls-card { flex: 0 0 220px; max-width: 220px; }
  .low-stock { padding-right: var(--space-7); }
  .low-stock-wrap::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 56px;
    background: linear-gradient(90deg, rgba(251,247,240,0) 0%, rgba(251,247,240,0.85) 60%, rgba(251,247,240,1) 100%);
    pointer-events: none;
  }
  .cat-chips { overflow-x: visible; flex-wrap: wrap; }
  .toast-stack { position: fixed; }
}

/* =========================================================================
   SECTION 17 — Desktop breakpoint (>=1280 px)
   ========================================================================= */
@media (min-width: 1280px) {
  .stage { max-width: 1400px; border-radius: 28px; }
  .topbar { padding: var(--space-3) var(--space-6); }
  .section__rail,
  .kpis, .feed, .low-stock, .search, .chips-row,
  .grid, .charts, .foot { padding-left: var(--space-6); padding-right: var(--space-6); }
  .feed { margin: 0 var(--space-6); padding: 0; }
  .kpi { padding: 14px var(--space-4); min-height: 96px; }
  .kpi__value { font-size: 28px; }
  .kpi__delta { margin-top: 6px; }
  body.dashboard-body { font-size: 14px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .charts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-4); }
  .charts > .chart--heatmap { grid-column: auto; }
  .scanner-sheet { max-width: 720px; left: 50%; right: auto; transform: translateX(-50%); border-radius: 18px; }
  .feed__row { padding: 10px var(--space-4); min-height: 52px; }
  .feed__line2 { margin-top: 1px; }
  .low-stock-chevron { display: grid; }
  .ls-card { flex: 0 0 240px; max-width: 240px; }
}

@media (min-width: 1440px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .ls-card { flex: 0 0 240px; max-width: 240px; }
}

@media (min-width: 1600px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(218px, 1fr)); }
  .ls-card { flex: 0 0 210px; max-width: 210px; }
}

/* =========================================================================
   SECTION 18 — Reduced motion overrides
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  .live__dot                     { animation: none; }
  .search__spinner               { animation: none; border-top-color: var(--primary); }
  .scanner-sheet__sweep          { animation: none; }
  .search__mic.is-listening      { animation: none; box-shadow: 0 0 0 4px rgba(179, 38, 30, 0.20); }
  .kpi.is-tapped                 { animation: none; }
  .feed__row.is-new              { animation: none; }
  .card.is-flash, .card.is-skeleton .card__img { animation: none; }
  .toast                         { animation: none; }
  .toast.is-leaving              { animation: none; opacity: 0; }
  .reset-sheet, .reorder-sheet   { animation: none; }
  .bar__fill                     { transition: none; }
  .section__title.is-active::after { transition: none; }
  .delivered-check path          { animation: none; stroke-dashoffset: 0; }
}
