/* ============================================================
   GapFinder — "The Green Ledger"
   A quiet, premium money-green ledger on warm paper.
   Display: Fraunces · UI: Public Sans · Numerals: Fragment Mono
   ============================================================ */

:root {
  /* paper + ink */
  --paper:     #f4efe4;
  --paper-2:   #efe8d8;
  --card:      #fffdf8;
  --card-2:    #faf6ec;
  --ink:       #1f1c15;
  --ink-2:     #423d33;   /* strong secondary text — AA on card & paper */
  --ink-3:     #5f594a;   /* muted text — clears WCAG AA (~6.5:1) on card & paper */
  --ink-4:     #857d6b;   /* light muted — still clears AA (~5:1) so it is safe for small text */

  /* the money palette */
  --pine:       #3a4fe0;
  --pine-deep:  #2f3fb8;
  --pine-soft:  #e7e9ff;
  --emerald:    #5b46e3;
  --emerald-soft:#ece9ff;
  --brass:      #7c5cff;
  --brass-deep: #5a3fd6;
  --brass-light:#9b82ff;
  --brass-soft: #efe9ff;

  /* semantic */
  --pos:    #5b46e3;
  --warn:   #7c5cff;
  --danger: #b8402f;
  --danger-soft: #f8eae6;

  /* lines / shadows */
  --line:   #e2d9c6;
  --line-2: #d3c8b1;
  --shadow-sm: 0 1px 2px rgba(40,34,20,.05), 0 2px 6px rgba(40,34,20,.05);
  --shadow:    0 4px 14px rgba(40,34,20,.07), 0 1px 3px rgba(40,34,20,.06);
  --shadow-lg: 0 18px 50px rgba(40,34,20,.16), 0 4px 14px rgba(40,34,20,.08);
  --ring: 0 0 0 3px rgba(58,79,224,.28);

  --r-sm: 8px;
  --r:    13px;
  --r-lg: 20px;

  --sidebar-w: 250px;

  --serif: "Young Serif", Georgia, "Times New Roman", serif;
  --sans:  "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:  "Spline Sans Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  /* ledger paper: faint ruled lines + warm pine/brass vignettes */
  background-image:
    radial-gradient(110% 75% at 6% -6%, rgba(58,79,224,.06), transparent 58%),
    radial-gradient(120% 90% at 100% 0%, rgba(124,92,255,.07), transparent 55%),
    repeating-linear-gradient(180deg, transparent 0 31px, rgba(88,104,78,.045) 31px 32px);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--brass-soft); color: var(--ink); }

* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 20px; border: 3px solid var(--paper); }

:is(button, a, [tabindex]):focus-visible {
  outline: 2px solid var(--pine);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: flex-start;
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  height: 100vh;
  display: flex; flex-direction: column;
  padding: 24px 16px 16px;
  background: var(--card);
  border-right: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 4px; }
.brand .mark { flex: 0 0 34px; }
.brand-words { display: flex; flex-direction: column; }
.wordmark {
  font-family: var(--serif); font-size: 23px; font-weight: 500;
  letter-spacing: -.01em; line-height: 1.1; color: var(--ink);
}
.wordmark em { font-style: normal; color: var(--pine); }
/* the widened G-gap, echoing the mark */
.wordmark::first-letter { letter-spacing: .045em; }
.brand-sub {
  font-size: 10px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase;
  color: var(--brass-deep); margin-top: 3px;
}

.tabs { display: flex; flex-direction: column; gap: 3px; margin-top: 26px; flex: 1; }
.tab {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border: none; background: transparent;
  border-radius: 10px;
  font-size: 14.5px; font-weight: 500; color: var(--ink-2);
  text-align: left;
  transition: background .16s ease, color .16s ease;
}
.tab svg { width: 20px; height: 20px; flex: 0 0 20px; color: var(--ink-3); transition: color .16s; }
.tab:hover { background: var(--card-2); color: var(--ink); }
.tab.active { background: var(--pine-soft); color: var(--pine-deep); font-weight: 600; }
.tab.active svg { color: var(--pine); }
.tab.active::before {
  content: ""; position: absolute; left: -3px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 3px; background: linear-gradient(180deg, var(--brass-light), var(--brass));
}

/* vault status chip */
.vault {
  display: flex; align-items: center; gap: 11px; width: 100%;
  margin-top: 10px; padding: 11px 12px;
  background: var(--card-2); border: 1px solid var(--line);
  border-radius: var(--r); text-align: left;
  transition: border-color .15s, background .15s;
}
.vault:hover { border-color: var(--line-2); background: var(--card); }
.vdot {
  width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px;
  background: var(--ink-4); box-shadow: 0 0 0 3px rgba(138,151,140,.18);
}
.vdot.good { background: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-soft); animation: breathe 2.2s ease-in-out infinite; }
.vdot.bad  { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.vdot.warn { background: var(--brass); box-shadow: 0 0 0 3px var(--brass-soft); animation: breathe 1.4s ease-in-out infinite; }
.vtxt { display: flex; flex-direction: column; overflow: hidden; }
.vtxt b { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.vtxt span { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   MAIN + MASTHEAD
   ============================================================ */
.main {
  flex: 1; min-width: 0;
  padding: 26px clamp(20px, 4vw, 54px) 90px;
  max-width: 1280px;
}

.masthead {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding-bottom: 10px; margin-bottom: 26px;
  border-bottom: 3px double var(--line-2);
}
.runhead {
  font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase;
  color: var(--pine-deep);
}
.dateline { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.mast-dot { color: var(--brass); padding: 0 5px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
  padding-bottom: 20px; margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.kicker {
  display: inline-block;
  font-size: 11.5px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase;
  color: var(--brass-deep); margin-bottom: 9px;
}
.page-head h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(30px, 4vw, 42px); line-height: 1.02; letter-spacing: -.02em;
  color: var(--ink);
}
.sub { color: var(--ink-2); font-size: 14.5px; max-width: 62ch; margin: 10px 0 0; }
.head-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-brass {
  display: inline-flex; align-items: center; gap: 9px;
  border: none; border-radius: 11px;
  background: var(--pine); /* solid blue primary, myhome26-style */
  color: #fbf8f0;
  font-weight: 600; font-size: 14px; padding: 11px 20px;
  box-shadow: 0 1px 2px rgba(58,79,224,.3);
  text-decoration: none;
  transition: transform .12s ease, box-shadow .16s, background .16s;
}
.btn-brass svg { width: 15px; height: 15px; }
.btn-brass:hover { transform: translateY(-1px); background: var(--pine-deep); box-shadow: 0 6px 16px rgba(58,79,224,.28); }
.btn-brass:active { transform: translateY(0); }
.btn-brass:disabled { opacity: .55; cursor: default; transform: none; }
.btn-brass.busy { position: relative; overflow: hidden; }
.btn-brass.busy::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2.5px; width: 40%;
  background: rgba(255,255,255,.75); border-radius: 2px;
  animation: scanbar 1.1s ease-in-out infinite alternate;
}

.btn-ghost {
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2);
  border-radius: 10px; font-weight: 600; padding: 10px 16px; font-size: 14px;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-ghost.sm { padding: 7px 13px; font-size: 13px; }
.btn-ghost:hover { background: var(--card-2); border-color: var(--brass); color: var(--ink); }

/* ============================================================
   KPI TILES — ledger tiles with brass gilt edge
   ============================================================ */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 17px 18px 15px;
  box-shadow: var(--shadow-sm);
}
.kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--brass-light), var(--brass));
}
.kpi b {
  display: block; font-family: var(--serif); font-weight: 600;
  font-size: 32px; line-height: 1; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.kpi span { display: block; margin-top: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.kpi.k-brass b   { color: var(--brass-deep); }
.kpi.k-emerald b { color: var(--emerald); }
.kpi.k-pine b    { color: var(--pine); }
.kpi.k-ink b     { color: var(--ink); }
.kpi.k-emerald::before { background: linear-gradient(180deg, var(--emerald), var(--pine)); }
.kpi.k-pine::before    { background: linear-gradient(180deg, var(--pine), var(--pine-deep)); }
.kpi.k-ink::before     { background: var(--ink-2); }
.kpi.warn b { color: var(--danger); }
.kpi-gauge { margin-top: 12px; }
.kpi-gauge .gauge { height: 8px; width: 100%; }
.kpi-sub { margin-top: 12px; font-family: var(--mono); font-size: 11px; color: var(--ink-3); min-height: 8px; }

/* ============================================================
   THE GAP GAUGE — the signature
   Amazon shelf (pine, filled) · brass seam (the gap) · Walmart
   shelf (hollow hairline). Seam width encodes gap_score.
   ============================================================ */
.gauge { display: flex; align-items: stretch; height: 12px; width: 132px; }
.gauge .gA {
  background: linear-gradient(180deg, #4a5fe8, var(--pine));
  border-radius: 3.5px 0 0 3.5px;
  min-width: 6px;
}
.gauge .gSeam {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--brass-light), var(--brass));
  box-shadow: inset 0 1px 0 rgba(240,236,255,.5);
  transition: width .45s cubic-bezier(.2,.8,.25,1);
}
.gauge .gW {
  border: 1.5px solid #c2bba8; border-left: none;
  border-radius: 0 3.5px 3.5px 0;
  background: transparent;
  min-width: 6px;
}
/* the coin-glint shimmer on live GAP seams */
.gauge.shimmer .gSeam::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-110%);
  background: linear-gradient(105deg, transparent 20%, rgba(245,242,255,.85) 50%, transparent 80%);
  animation: glint 4s ease-in-out infinite;
}
/* variant: dashed, quieter seam */
.gauge.variant .gSeam {
  background: repeating-linear-gradient(90deg, var(--emerald) 0 5px, rgba(91,70,227,.25) 5px 9px);
  box-shadow: none;
}
/* matched: collapsed, fused, dim */
.gauge.matched .gA { background: #b3ab9b; border-radius: 3.5px 0 0 3.5px; }
.gauge.matched .gW { border-color: #cdc6b4; }
/* uncertain: dotted grey seam */
.gauge.uncertain .gSeam { background: repeating-linear-gradient(90deg, var(--ink-4) 0 2.5px, transparent 2.5px 6px); box-shadow: none; }
/* error: hairline red break */
.gauge.error .gA { background: #b3a698; }
.gauge.error .gSeam { background: var(--danger); box-shadow: none; }
/* null score: hollow dashed track */
.gauge.null {
  border: 1.5px dashed var(--line-2); border-radius: 4px;
  align-items: center; justify-content: center;
}
.gauge.null::after { content: "—"; font-family: var(--mono); font-size: 9px; color: var(--ink-4); line-height: 1; }

.gauge.lg { height: 22px; width: 100%; }
.gauge.lg .gA { border-radius: 6px 0 0 6px; }
.gauge.lg .gW { border-radius: 0 6px 6px 0; border-width: 2px; }

/* ============================================================
   SCORE TAPE — distribution strip
   ============================================================ */
.tape-wrap { margin: 2px 0 24px; }
.tape-head {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 7px;
}
.tape-head span:first-child {
  font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-2);
}
.tape-cap { font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); }
.tape {
  position: relative; height: 36px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm);
  border-bottom: 2px solid var(--line-2);
  overflow: hidden;
}
.tape .tick {
  position: absolute; bottom: 0; width: 2px;
  background: linear-gradient(180deg, var(--brass-light), var(--brass));
  border-radius: 1px 1px 0 0;
}
.tape-sweep {
  position: absolute; top: 0; bottom: 0; width: 46px; transform: translateX(-60px);
  background: linear-gradient(90deg, transparent, rgba(124,92,255,.16), transparent);
}
.tape.swept .tape-sweep { animation: sweep 1.5s cubic-bezier(.3,.6,.3,1) 1 both; }
.tape-axis {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10px; color: var(--ink-4); margin-top: 4px; padding: 0 2px;
}

/* ============================================================
   FEATURED FIND
   ============================================================ */
.featured {
  position: relative; cursor: pointer;
  background:
    radial-gradient(90% 130% at 100% 0%, rgba(124,92,255,.10), transparent 55%),
    var(--card);
  border: 1px solid var(--line); border-left: 4px solid var(--brass);
  border-radius: var(--r-lg);
  padding: 20px 22px 18px;
  margin-bottom: 26px;
  box-shadow: var(--shadow);
  transition: transform .18s cubic-bezier(.2,.8,.25,1), box-shadow .18s;
  animation: rise .5s cubic-bezier(.2,.8,.25,1) both;
}
.featured:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.feat-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase;
  color: var(--brass-deep); margin-bottom: 10px;
}
.feat-star { color: var(--brass); }
.feat-body { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.feat-info { flex: 1 1 300px; min-width: 0; }
.feat-kicker {
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 5px;
}
.feat-title {
  font-family: var(--serif); font-weight: 500; font-size: clamp(18px, 2.4vw, 24px);
  line-height: 1.22; letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.feat-meta { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.feat-gauge-wrap { flex: 1 1 260px; min-width: 220px; }
.feat-score { display: flex; align-items: baseline; gap: 7px; margin-top: 9px; }
.feat-score b { font-family: var(--serif); font-size: 26px; color: var(--brass-deep); line-height: 1; }
.feat-score span { font-size: 11.5px; font-weight: 600; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; }
.feat-link {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 14px;
  font-size: 13px; font-weight: 700; color: var(--pine-deep); text-decoration: none;
  padding: 8px 13px; border-radius: 9px; border: 1px solid var(--pine-soft); background: var(--card);
  transition: background .15s, border-color .15s;
}
.feat-link:hover { background: var(--pine-soft); border-color: var(--pine); }
.feat-link svg { width: 13px; height: 13px; }

.price { font-family: var(--serif); font-weight: 600; font-size: 20px; letter-spacing: -.01em; color: var(--ink); }
.price.lg { font-size: 30px; }

/* ============================================================
   STATUS PILLS + STAGE STAMPS
   ============================================================ */
.pill {
  display: inline-flex; align-items: center;
  font-size: 10.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 7px; white-space: nowrap;
}
.pill.gap      { background: linear-gradient(160deg, #8f74ff, var(--brass)); color: #fbf8f0; box-shadow: inset 0 1px 0 rgba(240,236,255,.5); }
.pill.variant  { background: var(--emerald-soft); color: #4836c0; border: 1px solid #d6cffb; }
.pill.matched  { background: #e9e7dc; color: var(--ink-3); }
.pill.uncertain{ background: transparent; color: var(--ink-3); border: 1px dashed var(--line-2); }
.pill.error    { background: var(--danger-soft); color: var(--danger); border: 1px solid #eccfc7; }

.stamp {
  display: inline-block;
  font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 7px; border: 1.5px solid currentColor; border-radius: 4px;
  transform: rotate(-2deg);
  white-space: nowrap;
}
.stamp.new      { color: var(--pine); }
.stamp.reviewed { color: var(--ink-2); }
.stamp.sourcing { color: var(--brass-deep); }
.stamp.ignored  { color: var(--ink-4); text-decoration: line-through; }

/* ============================================================
   FILTER RAIL
   ============================================================ */
.filter-rail { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.pill-group {
  display: inline-flex; flex-wrap: wrap; gap: 2px;
  background: var(--card-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 3px;
}
.fpill {
  border: none; background: transparent; color: var(--ink-3);
  font-weight: 600; font-size: 13px; padding: 7px 13px; border-radius: 8px;
  transition: background .15s, color .15s, box-shadow .15s;
}
.fpill:hover { color: var(--ink); }
.fpill.active { background: var(--card); color: var(--pine-deep); box-shadow: var(--shadow-sm); }

/* ============================================================
   GAP ROWS — the flagship ledger
   ============================================================ */
.rows { display: flex; flex-direction: column; gap: 9px; }
.grow {
  position: relative;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 84px auto auto 34px;
  align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 13px 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer; text-align: left; width: 100%;
  font-family: inherit; color: inherit;
  transition: transform .16s cubic-bezier(.2,.8,.25,1), box-shadow .16s, border-color .16s;
  animation: rise .45s cubic-bezier(.2,.8,.25,1) both;
}
.grow:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.grow:hover .gSeam { filter: brightness(1.08); }
/* score-scaled brass bleed into the right margin */
.grow::after {
  content: ""; position: absolute; top: 6px; bottom: 6px; right: -1px; width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--brass-light), var(--brass));
  opacity: var(--bleed, 0);
}
.grow.dim { opacity: .72; }

.g-gauge { display: flex; flex-direction: column; gap: 5px; }
.g-score { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.g-score b { color: var(--brass-deep); font-weight: 400; }

.g-main { min-width: 0; }
.g-kicker {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 3px;
}
.g-kicker .asin { font-family: var(--mono); font-weight: 400; letter-spacing: .02em; color: var(--ink-4); text-transform: none; }
.g-title {
  font-size: 14.5px; font-weight: 600; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* the whole row is clickable via a stretched, otherwise-invisible button */
.g-open {
  display: inline; background: none; border: none; padding: 0; margin: 0;
  font: inherit; color: inherit; cursor: pointer; text-align: left;
}
.g-open::after { content: ""; position: absolute; inset: 0; border-radius: var(--r); }
.g-open:focus-visible { outline: none; }
.grow:has(.g-open:focus-visible) { outline: 2px solid var(--pine); outline-offset: 2px; }
.g-notes { font-size: 12px; color: var(--ink-3); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }

.g-price { font-family: var(--mono); font-size: 14px; text-align: right; white-space: nowrap; }
.g-updated { display: block; font-family: var(--mono); font-size: 10px; color: var(--ink-4); margin-top: 3px; }

.g-out {
  position: relative; z-index: 1; /* stays clickable above the stretched row button */
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 9px;
  color: var(--ink-3); border: 1px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.grow:hover .g-out { color: var(--pine-deep); border-color: var(--pine-soft); background: var(--pine-soft); }
.g-out svg { width: 14px; height: 14px; }

/* ============================================================
   SCAN LEDGER
   ============================================================ */
.scan-list { display: flex; flex-direction: column; gap: 9px; }
.srow {
  display: grid;
  grid-template-columns: auto auto minmax(0,1fr) auto;
  align-items: center; gap: 18px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  animation: rise .45s cubic-bezier(.2,.8,.25,1) both;
}
.srow.failed { border-color: #eccfc7; background: linear-gradient(180deg, var(--card), #f8eae6); }
.s-id { font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.s-badge {
  font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 6px;
}
.s-badge.keepa   { background: var(--pine-soft); color: var(--pine-deep); }
.s-badge.scraper { background: var(--brass-soft); color: var(--brass-deep); }
.s-facts { display: flex; gap: 20px; flex-wrap: wrap; align-items: baseline; min-width: 0; }
.s-fact { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.s-fact b { font-family: var(--mono); font-weight: 400; color: var(--ink); }
.s-fact.money b { color: var(--brass-deep); }
.s-err { font-size: 12.5px; color: var(--danger); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-when { text-align: right; }
.s-date { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.s-dur { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); margin-top: 2px; }
.s-live { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--pine); }
.s-live i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--emerald);
  box-shadow: 0 0 0 3px var(--emerald-soft); animation: breathe 1.6s ease-in-out infinite;
}
.s-yield { display: flex; flex-direction: column; gap: 4px; min-width: 90px; }
.s-yield .gauge { height: 8px; width: 90px; }
.s-yield span { font-family: var(--mono); font-size: 10px; color: var(--ink-4); }

/* ============================================================
   HEALTH
   ============================================================ */
.st-banner {
  border-radius: var(--r); padding: 15px 18px; font-weight: 600; font-size: 14.5px;
  margin-bottom: 22px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
}
.st-banner.good { background: var(--pine-soft); border-color: #cfd2ff; color: var(--pine-deep); }
.st-banner.warn { background: var(--brass-soft); border-color: #ddd4ff; color: var(--brass-deep); }
.st-banner.bad  { background: var(--danger-soft); border-color: #eccfc7; color: var(--danger); }

.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.st-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px 22px; box-shadow: var(--shadow-sm);
}
.st-card h3 {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--serif); font-weight: 500; font-size: 19px; margin-bottom: 12px;
}
.sdot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; background: var(--ink-4); }
.sdot.good { background: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-soft); animation: breathe 2.2s ease-in-out infinite; }
.sdot.warn { background: var(--brass); box-shadow: 0 0 0 3px var(--brass-soft); }
.sdot.bad  { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.st-row {
  display: flex; justify-content: space-between; gap: 12px; padding: 7px 0;
  border-bottom: 1px dashed var(--line); font-size: 13.5px;
}
.st-row:last-of-type { border-bottom: none; }
.st-row span { color: var(--ink-3); }
.st-row b { font-family: var(--mono); font-weight: 400; }
.st-hint { font-size: 12.5px; color: var(--ink-3); margin: 10px 0 0; line-height: 1.5; }

.breaker-wrap { display: flex; align-items: center; gap: 16px; }
.breaker-wrap > div { flex: 1; }
.ring { transform: rotate(-90deg); flex: 0 0 54px; }
.ring-track { fill: none; stroke: var(--line); stroke-width: 5; }
.ring-fill {
  fill: none; stroke: var(--emerald); stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 144.5; stroke-dashoffset: 0;
  transition: stroke-dashoffset .5s linear, stroke .3s;
}
.ring-fill.open { stroke: var(--danger); }

/* ============================================================
   DETAIL DRAWER — "the clipping"
   ============================================================ */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(22,38,29,.45); backdrop-filter: blur(4px);
  animation: fade .2s ease both;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 71;
  width: min(440px, 100vw);
  background: var(--card);
  border-left: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg);
  padding: 26px 28px 30px;
  overflow-y: auto;
  animation: slidein .3s cubic-bezier(.2,.8,.25,1) both;
}
.drawer-close {
  position: absolute; top: 14px; right: 16px;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card-2); color: var(--ink-2); font-size: 20px; line-height: 1;
  display: grid; place-items: center;
}
.drawer-close:hover { background: var(--paper-2); color: var(--ink); }
.dw-clip {
  font-size: 10.5px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase;
  color: var(--brass-deep); margin-bottom: 18px;
}
.dw-clip span:last-child { font-family: var(--mono); font-weight: 400; letter-spacing: .03em; color: var(--ink-3); text-transform: none; }
.dw-gauge-wrap { margin-bottom: 20px; }
.dw-scoreline { display: flex; align-items: baseline; gap: 9px; margin-top: 9px; }
.dw-scoreline b { font-family: var(--serif); font-size: 30px; color: var(--brass-deep); line-height: 1; }
.dw-scoreline span { font-size: 12px; font-weight: 700; color: var(--ink-3); letter-spacing: .05em; text-transform: uppercase; }
.dw-kicker {
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 6px;
}
.drawer h2 {
  font-family: var(--serif); font-weight: 500; font-size: 21px; line-height: 1.3; letter-spacing: -.01em;
}
.dw-price-row { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; flex-wrap: wrap; }
.dw-meaning { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; margin: 0 0 18px; }
.factgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.factgrid .f { background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.factgrid .f span { display: block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.factgrid .f b { display: block; margin-top: 4px; font-family: var(--mono); font-weight: 400; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.dw-section h4 {
  font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 7px;
}
.dw-notes { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; margin: 0; }
.dw-notes.none { color: var(--ink-4); font-style: italic; }
.dw-actions { display: flex; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ============================================================
   STATES — skeleton / empty / notice / toast
   ============================================================ */
.skel-rows { display: flex; flex-direction: column; gap: 9px; }
.skel-row {
  position: relative; overflow: hidden; height: 64px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
}
.skel-row::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent);
  animation: shimmer 1.4s infinite;
}

.empty { text-align: center; padding: 64px 20px; color: var(--ink-3); }
.empty-art { margin-bottom: 12px; }
.empty h3 { font-family: var(--serif); font-weight: 500; font-size: 25px; color: var(--ink-2); }
.empty p { margin: 10px auto 20px; max-width: 46ch; font-size: 14.5px; }

.notice {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--brass);
  border-radius: var(--r); padding: 15px 18px; font-size: 14px; color: var(--ink-2);
}
.notice b { color: var(--ink); }
.notice button { margin-left: auto; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 20px);
  background: var(--ink); color: #faf6ec; font-size: 14px; font-weight: 500;
  padding: 13px 22px; border-radius: 12px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 90;
  max-width: min(90vw, 480px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript {
  position: fixed; inset: auto 0 0 0; padding: 16px; text-align: center;
  background: var(--danger); color: #fff; font-weight: 600; z-index: 99;
}

/* ============================================================
   MOBILE BOTTOM BAR
   ============================================================ */
.bottombar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: rgba(251,250,244,.94); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.btab {
  position: relative;
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px 5px; border: none; background: transparent; border-radius: 10px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: var(--ink-3);
}
.btab svg { width: 21px; height: 21px; }
.btab.active { color: var(--pine-deep); background: var(--pine-soft); }
.btab-dot {
  position: absolute; top: 5px; right: calc(50% - 16px);
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
  border: 2px solid var(--card);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes rise    { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes fade    { from { opacity: 0; } to { opacity: 1; } }
@keyframes slidein { from { transform: translateX(60px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shimmer { 100% { transform: translateX(100%); } }
@keyframes glint   { 0%, 55% { transform: translateX(-110%); } 85%, 100% { transform: translateX(110%); } }
@keyframes sweep   { from { transform: translateX(-60px); } to { transform: translateX(calc(100vw)); } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
@keyframes scanbar { from { left: 0; } to { left: 60%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grow { grid-template-columns: 130px minmax(0,1fr) auto 34px; }
  .grow .g-pill-cell, .grow .g-stamp-cell { display: none; }
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  .bottombar { display: flex; }
  .main { padding: 20px 16px 110px; max-width: none; }
  .masthead { margin-bottom: 20px; }
  .dateline { font-size: 10.5px; }
  /* id + badge share row 1; facts and timestamp each span the full width so a
     long unbroken scan error can't stretch an auto track and force page overflow */
  .srow { grid-template-columns: max-content 1fr; row-gap: 10px; }
  .srow .s-badge { justify-self: start; }
  .srow .s-facts, .srow .s-when { grid-column: 1 / -1; min-width: 0; }
  .s-when { text-align: left; }
  .s-err { min-width: 0; }
}

@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi b { font-size: 26px; }
  .grow { grid-template-columns: minmax(0,1fr) 34px; row-gap: 10px; padding: 13px 14px; }
  .g-gauge { grid-row: 2; grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 10px; }
  .g-price { display: none; }
  .feat-body { gap: 16px; }
  .filter-rail { gap: 8px; }
  .fpill { padding: 6px 10px; font-size: 12px; }
  .drawer { padding: 24px 20px 28px; }
  .factgrid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   TOOLBAR (search + sort) · PAGER · DRAWER EXTRAS
   ============================================================ */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.search-wrap { position: relative; flex: 1; min-width: 200px; display: flex; align-items: center; }
.search-ico { position: absolute; left: 13px; width: 17px; height: 17px; color: var(--ink-4); pointer-events: none; }
.search-wrap input {
  width: 100%; font-family: var(--sans); font-size: 14px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line-2); border-radius: 11px;
  padding: 10px 14px 10px 38px; transition: border-color .15s, box-shadow .15s;
}
.search-wrap input::placeholder { color: var(--ink-4); }
.search-wrap input:focus { outline: none; border-color: var(--pine); box-shadow: var(--ring); }
.sort-wrap { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); font-weight: 600; }
.sort-wrap select {
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--ink);
  background: var(--card); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 9px 30px 9px 12px; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='11' height='7' viewBox='0 0 11 7' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.2 5.5 5.5 10 1.2' stroke='%235f594a' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.sort-wrap select:focus { outline: none; border-color: var(--pine); box-shadow: var(--ring); }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 20px; }
.pager-info { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); min-width: 120px; text-align: center; }
.pager button:disabled { opacity: .45; cursor: default; }

/* drawer: image header */
.dw-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.dw-img {
  width: 68px; height: 68px; flex: 0 0 68px; object-fit: contain;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 5px;
}
.dw-head-main { min-width: 0; flex: 1; }

/* drawer: amazon -> walmart spread */
.dw-spread {
  display: grid; grid-template-columns: 1fr auto 1fr 1fr; align-items: center; gap: 10px;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin: 4px 0 16px;
}
.spread-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.spread-cell span { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.spread-cell b { font-family: var(--mono); font-size: 15px; color: var(--ink); }
.spread-arrow { color: var(--brass); font-size: 16px; }
.spread-cell.delta b.up { color: var(--pos); }
.spread-cell.delta b.down { color: var(--danger); }

/* drawer: walmart-check evidence */
.dw-evidence { display: flex; flex-direction: column; gap: 8px; }
.ev-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--ink-2); }
.ev-row b { font-family: var(--mono); font-weight: 400; }
.ev-match span, .ev-reason span { display: block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 3px; }
.ev-match p, .ev-reason p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.ev-link {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  font-size: 13px; font-weight: 700; color: var(--pine-deep); text-decoration: none;
  padding: 7px 12px; border-radius: 9px; border: 1px solid var(--pine-soft); background: var(--card);
}
.ev-link:hover { background: var(--pine-soft); }
.ev-none { font-size: 13px; color: var(--ink-3); font-style: italic; }

/* drawer: triage editor */
.dw-triage { display: flex; flex-direction: column; gap: 10px; }
.dw-field { display: flex; flex-direction: column; gap: 5px; }
.dw-field span { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.dw-triage select, .dw-triage textarea {
  font-family: var(--sans); font-size: 14px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px;
}
.dw-triage select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg width='11' height='7' viewBox='0 0 11 7' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.2 5.5 5.5 10 1.2' stroke='%235f594a' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; cursor: pointer; }
.dw-triage textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.dw-triage select:focus, .dw-triage textarea:focus { outline: none; border-color: var(--pine); box-shadow: var(--ring); }
.dw-triage-actions { display: flex; align-items: center; gap: 12px; }
.dw-saved { font-size: 13px; font-weight: 700; color: var(--pos); opacity: 0; transition: opacity .2s; }
.dw-saved.show { opacity: 1; }

@media (max-width: 560px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .sort-wrap { justify-content: space-between; }
  .dw-spread { grid-template-columns: 1fr 1fr; row-gap: 12px; }
  .spread-arrow { display: none; }
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-screen {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(80% 60% at 15% 10%, rgba(58,79,224,.10), transparent 60%),
    radial-gradient(70% 70% at 90% 95%, rgba(124,92,255,.12), transparent 60%),
    var(--paper);
}
.login-card {
  width: min(400px, 100%);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 38px 36px 26px; text-align: center;
  animation: rise .5s cubic-bezier(.2,.8,.25,1) both;
}
.login-brand { display: inline-flex; align-items: center; gap: 11px; margin-bottom: 6px; }
.login-brand .wordmark { font-family: var(--serif); font-size: 27px; font-weight: 500; color: var(--ink); }
.login-brand .wordmark em { font-style: normal; color: var(--pine); }
.login-tag { color: var(--ink-3); font-size: 13.5px; margin: 0 0 26px; }
.login-field { display: block; text-align: left; margin-bottom: 14px; }
.login-field span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.login-field input {
  width: 100%; font-family: var(--sans); font-size: 15px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line-2); border-radius: 11px; padding: 11px 13px;
  transition: border-color .15s, box-shadow .15s;
}
.login-field input:focus { outline: none; border-color: var(--pine); box-shadow: var(--ring); }
.login-submit { width: 100%; justify-content: center; margin-top: 6px; padding: 12px; font-size: 15px; }
.login-err { color: var(--danger); font-size: 13.5px; font-weight: 600; min-height: 18px; margin-bottom: 8px; text-align: left; }
.login-foot { color: var(--ink-4); font-size: 12px; margin: 22px 0 0; }

/* ============================================================
   SIDEBAR NAV GROUP + ACCOUNT BLOCK
   ============================================================ */
.nav-group {
  font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-4); padding: 16px 12px 6px; margin-top: 6px; border-top: 1px solid var(--line);
}
.account {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin-top: 10px; padding: 9px 10px;
  background: var(--card-2); border: 1px solid var(--line); border-radius: var(--r);
  text-align: left; transition: border-color .15s, background .15s;
}
.account:hover { border-color: var(--line-2); background: var(--card); }
.avatar {
  display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(140deg, var(--pine), var(--emerald)); color: #fff;
  font-weight: 800; font-size: 13px; text-transform: uppercase;
}
.avatar.lg { flex-basis: 40px; width: 40px; height: 40px; border-radius: 11px; font-size: 16px; }
.acct-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.acct-txt b { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-txt span { font-size: 11px; color: var(--ink-3); text-transform: capitalize; }
.acct-caret { width: 12px; height: 12px; color: var(--ink-4); flex: 0 0 12px; }

.menu-scrim { position: fixed; inset: 0; z-index: 79; }
.account-menu {
  position: fixed; z-index: 80;
  left: 16px; bottom: 74px; width: 230px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 8px; animation: rise .16s ease both;
}
.acct-head { display: flex; align-items: center; gap: 11px; padding: 8px 8px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.acct-head b { display: block; font-size: 14px; font-weight: 700; }
.acct-head span { font-size: 12px; color: var(--ink-3); text-transform: capitalize; }
.acct-links { border-bottom: 1px solid var(--line); margin-bottom: 6px; padding-bottom: 6px; }
.acct-link {
  display: block; width: 100%; text-align: left; border: none; background: transparent;
  font-size: 14px; color: var(--ink-2); padding: 9px 10px; border-radius: 9px;
}
.acct-link:hover { background: var(--card-2); color: var(--ink); }
.acct-link.danger { color: var(--danger); }
.acct-link.danger:hover { background: var(--danger-soft); }

/* ============================================================
   ROW IMAGE + SCORE BADGE  (thumb lives inside g-main to avoid touching the grid)
   ============================================================ */
.g-main { display: flex; align-items: center; gap: 12px; }
.g-main-txt { min-width: 0; flex: 1; }
.g-thumb {
  width: 44px; height: 44px; flex: 0 0 44px; object-fit: contain;
  background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 3px;
}
.g-thumb.ph {
  display: grid; place-items: center;
  background: repeating-linear-gradient(135deg, var(--card-2) 0 6px, #f0ece0 6px 12px);
}
.g-thumb.ph::after { content: ""; width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--line-2); }
.score-badge {
  display: inline-grid; place-items: center; min-width: 30px; height: 24px; padding: 0 7px;
  border-radius: 7px; font-family: var(--mono); font-weight: 700; font-size: 13px;
  color: #fbf8f0; background: linear-gradient(160deg, var(--brass-light), var(--brass));
  box-shadow: inset 0 1px 0 rgba(240,236,255,.5);
}
.score-badge.dim { background: #e6e3d8; color: var(--ink-4); box-shadow: none; }
.g-kicker .score-badge { margin-left: auto; }

/* ============================================================
   ADMIN TABLES
   ============================================================ */
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); box-shadow: var(--shadow-sm); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.admin-table th {
  text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-3); padding: 12px 16px; border-bottom: 1.5px solid var(--line-2); background: var(--card-2);
}
.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .u-name { font-weight: 600; }
.admin-table .u-sub { font-family: var(--mono); font-size: 11.5px; color: var(--ink-4); }
.role-pill { font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; }
.role-pill.admin { background: var(--brass-soft); color: var(--brass-deep); }
.role-pill.user { background: var(--pine-soft); color: var(--pine-deep); }
.row-inactive { opacity: .5; }
.admin-num { width: 78px; font-family: var(--mono); font-size: 13px; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--card); }
.admin-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn { border: 1px solid var(--line-2); background: var(--card); color: var(--ink-3); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; }
.icon-btn:hover { border-color: var(--pine); color: var(--pine-deep); }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
/* toggle switch */
.tswitch { position: relative; display: inline-block; width: 42px; height: 24px; }
.tswitch input { opacity: 0; width: 0; height: 0; }
.tswitch .track { position: absolute; inset: 0; background: var(--line-2); border-radius: 20px; transition: background .2s; cursor: pointer; }
.tswitch .track::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.tswitch input:checked + .track { background: var(--pine); }
.tswitch input:checked + .track::before { transform: translateX(18px); }

/* ============================================================
   ANALYTICS
   ============================================================ */
.an-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.an-grid .panel { margin-bottom: 0; max-width: none; }
.an-grid .panel h3 { font-family: var(--serif); font-weight: 500; font-size: 19px; margin-bottom: 14px; }
.an-bar-row { display: grid; grid-template-columns: 90px 1fr 40px; align-items: center; gap: 10px; margin-bottom: 9px; }
.an-bar-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.an-bar-track { height: 12px; background: var(--card-2); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.an-bar-fill { height: 100%; border-radius: 20px; transition: width .5s cubic-bezier(.2,.8,.25,1); }
.an-bar-val { font-family: var(--mono); font-size: 12.5px; font-weight: 600; text-align: right; }
.an-scans { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 8px; }
.an-scans .bar { flex: 1; min-width: 6px; background: linear-gradient(180deg, var(--brass-light), var(--brass)); border-radius: 3px 3px 0 0; min-height: 3px; position: relative; }
.an-scans .bar span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-family: var(--mono); font-size: 10px; color: var(--ink-3); }
.an-empty { color: var(--ink-3); font-size: 14px; padding: 20px 0; }

/* ============================================================
   GENERIC MODAL
   ============================================================ */
.modal-scrim { position: fixed; inset: 0; z-index: 110; background: rgba(22,38,29,.45); backdrop-filter: blur(4px); animation: fade .2s ease both; }
.modal { position: fixed; inset: 0; z-index: 111; display: grid; place-items: center; padding: 20px; }
.modal-card {
  position: relative; width: min(420px, 100%);
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  padding: 26px 26px 22px; animation: rise .24s cubic-bezier(.2,.8,.25,1) both;
}
.modal-close { position: absolute; top: 14px; right: 16px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--card-2); color: var(--ink-2); font-size: 19px; line-height: 1; }
.modal-card h3 { font-family: var(--serif); font-weight: 500; font-size: 22px; }
.modal-sub { color: var(--ink-3); font-size: 13.5px; margin: 6px 0 0; }
.modal-field { display: block; margin-top: 14px; }
.modal-field > span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 5px; }
.modal-field input, .modal-field select {
  width: 100%; font-family: var(--sans); font-size: 14px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px;
}
.modal-field input:focus, .modal-field select:focus { outline: none; border-color: var(--pine); box-shadow: var(--ring); }
.modal-field select { appearance: none; }
.modal-err { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 16px; margin-top: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@media (max-width: 860px) {
  .account-menu { left: 12px; right: 12px; width: auto; bottom: calc(64px + env(safe-area-inset-bottom)); }
}
@media (max-width: 560px) {
  .g-main { gap: 10px; }
  .g-thumb { width: 38px; height: 38px; flex-basis: 38px; }
}

/* ============================================================
   VIEW TOGGLE + PHOTO CARD GRID (myhome26-style deal cards)
   ============================================================ */
.view-toggle { display: inline-flex; background: var(--card-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.vt-btn { display: grid; place-items: center; width: 34px; height: 30px; border: none; background: transparent; color: var(--ink-3); border-radius: 8px; }
.vt-btn svg { width: 17px; height: 17px; }
.vt-btn:hover { color: var(--ink); }
.vt-btn.active { background: var(--card); color: var(--pine-deep); box-shadow: var(--shadow-sm); }

.gcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.gcard {
  position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .18s cubic-bezier(.2,.8,.25,1), box-shadow .18s, border-color .18s;
  animation: rise .45s cubic-bezier(.2,.8,.25,1) both;
}
.gcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.gcard:hover .gSeam { filter: brightness(1.08); }
.gcard.dim { opacity: .72; }
.gcard-photo { position: relative; aspect-ratio: 1 / 1; background: #fff; border-bottom: 1px solid var(--line); }
.gcard-photo img { width: 100%; height: 100%; object-fit: contain; padding: 14px; display: block; }
.gcard-photo.ph { background: repeating-linear-gradient(135deg, var(--card-2) 0 12px, #f0ece0 12px 24px); }
.gcard-photo.ph img { display: none; }
.gcard-score { position: absolute; top: 10px; right: 10px; box-shadow: 0 2px 8px rgba(31,28,21,.22); }
.gcard-pill { position: absolute; top: 10px; left: 10px; box-shadow: 0 2px 8px rgba(31,28,21,.18); }
.gcard-body { padding: 13px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.gcard-kicker { display: flex; gap: 7px; align-items: baseline; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.gcard-kicker .asin { font-family: var(--mono); font-weight: 400; letter-spacing: .02em; text-transform: none; color: var(--ink-4); margin-left: auto; }
.gcard-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gcard .gauge { height: 10px; width: 100%; }
.gcard-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.gcard-meta .price { font-size: 17px; }

@media (max-width: 560px) {
  .gcards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}

/* ============================================================
   OPPORTUNITY CARD (demand-forward: what to sell + how hot on Amazon)
   ============================================================ */
.gcards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.ocard {
  position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .18s cubic-bezier(.2,.8,.25,1), box-shadow .18s, border-color .18s;
  animation: rise .45s cubic-bezier(.2,.8,.25,1) both;
}
.ocard:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.ocard.dim { opacity: .68; }
.ocard-photo { position: relative; aspect-ratio: 1 / 1; background: #fff; border-bottom: 1px solid var(--line); }
.ocard-photo img { width: 100%; height: 100%; object-fit: contain; padding: 14px; display: block; }
.ocard-photo.ph { background: repeating-linear-gradient(135deg, var(--card-2) 0 12px, #f0ece0 12px 24px); }
.ocard-photo.ph img { display: none; }

.opp-tag {
  position: absolute; top: 10px; left: 10px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .02em;
  padding: 5px 9px; border-radius: 8px; box-shadow: 0 2px 8px rgba(31,28,21,.16);
}
.opp-tag.win     { background: #178a4e; color: #fff; }               /* the money: not on Walmart */
.opp-tag.partial { background: var(--brass-soft); color: var(--brass-deep); border: 1px solid #ddd4ff; }
.opp-tag.onwm    { background: #e9e7dc; color: var(--ink-3); }
.opp-tag.maybe   { background: var(--card); color: var(--ink-3); border: 1px dashed var(--line-2); }
.opp-tag.err     { background: var(--danger-soft); color: var(--danger); }
.opp-stamp {
  position: absolute; top: 10px; right: 10px;
  font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brass-deep); background: rgba(255,255,255,.9); border: 1.5px solid var(--brass); border-radius: 5px;
  padding: 3px 7px; transform: rotate(-3deg);
}

.ocard-body { padding: 13px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ocard-title {
  font-size: 14px; font-weight: 600; line-height: 1.32;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ocard-brand { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-top: -3px; }

.hot { margin-top: 2px; }
.hot-top { font-size: 13px; color: var(--ink-2); }
.hot-top b { font-family: var(--serif); font-size: 21px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.hot-flames { margin-left: 3px; font-size: 12px; }
.hot-bar { height: 6px; margin-top: 6px; background: var(--card-2); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.hot-bar i { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--pine), var(--brass)); transition: width .5s cubic-bezier(.2,.8,.25,1); }

.ocard-facts { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 4px; }
.ocard-facts .rank { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.ocard-facts .price { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink); }
