/*
 * Marketdesk — design system
 *
 * Concept: a calm, instrument-grade workspace for the office's Etsy work, built around the
 * split-flap display: the one dark "board" surface stays dark in both themes, and when live data
 * changes (today: a shop's status) it flips like a departures board — the single signature motion.
 * New modules reuse the same tokens, cards, tables and pill; they don't invent new chrome.
 *
 * Roles, not palette: 2 surfaces + ink + muted ink + ONE accent (indigo = interactive/focus).
 * Status hues (open / holiday / not found / waiting) are data, always paired with a label.
 */

/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Consolas, monospace;

  --bg:          oklch(97.6% 0.006 85);
  --surface:     oklch(99.6% 0.003 85);
  --surface-2:   oklch(95.6% 0.007 85);
  --ink:         oklch(21% 0.014 265);
  --ink-2:       oklch(46% 0.013 265);
  --ink-3:       oklch(60% 0.011 265);
  --line:        oklch(91% 0.007 85);
  --line-strong: oklch(84% 0.009 85);

  --accent:      oklch(51% 0.2 268);
  --accent-ink:  oklch(99% 0.005 268);
  --accent-soft: oklch(94.5% 0.035 268);
  --chart:       oklch(51% 0.2 268);
  --focus:       oklch(60% 0.2 268);
  --danger:      oklch(52% 0.19 27);
  --danger-soft: oklch(95.5% 0.03 27);

  --open:        oklch(48% 0.12 155);   --open-soft:    oklch(95% 0.04 155);
  --holiday:     oklch(50% 0.12 65);    --holiday-soft: oklch(95.5% 0.05 82);
  --gone:        oklch(48% 0.012 265);  --gone-soft:    oklch(94% 0.006 265);
  --wait:        oklch(50% 0.12 245);   --wait-soft:    oklch(95% 0.03 245);

  /* the board: dark in every theme */
  --board:        oklch(18.5% 0.013 265);
  --board-cell:   oklch(23.5% 0.015 265);
  --board-seam:   oklch(14% 0.01 265);
  --board-ink:    oklch(95% 0.012 85);
  --board-muted:  oklch(68% 0.012 265);
  --board-line:   oklch(29% 0.014 265);
  --board-open:   oklch(82% 0.15 155);
  --board-holiday:oklch(85% 0.14 82);
  --board-gone:   oklch(72% 0.012 265);
  --board-wait:   oklch(80% 0.1 245);

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --r-s: 6px; --r-m: 10px; --r-l: 16px; --r-pill: 999px;
  --shadow: 0 1px 2px oklch(20% 0.02 265 / 0.06), 0 12px 32px -12px oklch(20% 0.02 265 / 0.22);

  --t-12: 0.75rem; --t-13: 0.8125rem; --t-14: 0.875rem; --t-15: 0.9375rem; --t-17: 1.0625rem;
  --t-20: 1.25rem; --t-28: 1.75rem; --t-36: clamp(1.75rem, 1.2rem + 1.6vw, 2.25rem);

  --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in:   cubic-bezier(0.55, 0, 0.75, 0.2);
  --ease-snap: cubic-bezier(0.16, 1, 0.3, 1);

  --sidebar: 248px;
}

/* dark: re-tuned, not inverted (system preference, then the same values for an explicit choice) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: oklch(16.5% 0.009 265); --surface: oklch(19.8% 0.01 265); --surface-2: oklch(23% 0.011 265);
    --ink: oklch(95% 0.009 85); --ink-2: oklch(73% 0.012 265); --ink-3: oklch(60% 0.012 265);
    --line: oklch(27% 0.012 265); --line-strong: oklch(34% 0.013 265);
    --accent: oklch(72% 0.14 268); --accent-ink: oklch(18% 0.03 268); --accent-soft: oklch(28% 0.06 268); --chart: oklch(66% 0.15 268);
    --focus: oklch(74% 0.15 268); --danger: oklch(72% 0.16 27); --danger-soft: oklch(27% 0.06 27);
    --open: oklch(78% 0.13 155); --open-soft: oklch(27% 0.05 155);
    --holiday: oklch(82% 0.12 82); --holiday-soft: oklch(29% 0.05 75);
    --gone: oklch(72% 0.012 265); --gone-soft: oklch(26% 0.01 265);
    --wait: oklch(78% 0.1 245); --wait-soft: oklch(27% 0.05 245);
    --board: oklch(13% 0.01 265); --board-cell: oklch(19% 0.013 265); --board-seam: oklch(10% 0.008 265); --board-line: oklch(24% 0.013 265);
    --shadow: 0 1px 2px oklch(0% 0 0 / 0.3), 0 16px 40px -12px oklch(0% 0 0 / 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(16.5% 0.009 265); --surface: oklch(19.8% 0.01 265); --surface-2: oklch(23% 0.011 265);
  --ink: oklch(95% 0.009 85); --ink-2: oklch(73% 0.012 265); --ink-3: oklch(60% 0.012 265);
  --line: oklch(27% 0.012 265); --line-strong: oklch(34% 0.013 265);
  --accent: oklch(72% 0.14 268); --accent-ink: oklch(18% 0.03 268); --accent-soft: oklch(28% 0.06 268); --chart: oklch(66% 0.15 268);
  --focus: oklch(74% 0.15 268); --danger: oklch(72% 0.16 27); --danger-soft: oklch(27% 0.06 27);
  --open: oklch(78% 0.13 155); --open-soft: oklch(27% 0.05 155);
  --holiday: oklch(82% 0.12 82); --holiday-soft: oklch(29% 0.05 75);
  --gone: oklch(72% 0.012 265); --gone-soft: oklch(26% 0.01 265);
  --wait: oklch(78% 0.1 245); --wait-soft: oklch(27% 0.05 245);
  --board: oklch(13% 0.01 265); --board-cell: oklch(19% 0.013 265); --board-seam: oklch(10% 0.008 265); --board-line: oklch(24% 0.013 265);
  --shadow: 0 1px 2px oklch(0% 0 0 / 0.3), 0 16px 40px -12px oklch(0% 0 0 / 0.6);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 var(--t-15)/1.5 var(--font-sans); font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-s); }
::selection { background: var(--accent-soft); }
.mono { font-family: var(--font-mono); font-feature-settings: "zero", "tnum"; }
.muted { color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: var(--s-4); top: -100px; z-index: 100; background: var(--ink); color: var(--bg); padding: var(--s-2) var(--s-4); border-radius: var(--r-s); text-decoration: none; }
.skip:focus { top: var(--s-4); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: var(--s-5);
  padding: var(--s-5) var(--s-4); border-right: 1px solid var(--line); background: var(--surface);
}
.brand { display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-2); text-decoration: none; }
.brand__mark { width: 30px; height: 30px; flex: none; }
.brand__name { font-weight: 650; letter-spacing: -0.01em; font-size: var(--t-17); }
.brand__sub { display: block; font-size: var(--t-12); color: var(--ink-3); font-weight: 450; letter-spacing: 0; }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: var(--s-3); padding: 9px var(--s-3); border-radius: var(--r-m);
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: var(--t-14);
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }
.nav__groups { display: grid; gap: var(--s-5); }
.nav__group { display: grid; gap: 6px; }
.nav__label { padding: 0 var(--s-3); font-size: var(--t-12); color: var(--ink-3); font-weight: 550; letter-spacing: 0.02em; }
.sidebar__foot { margin-top: auto; display: grid; gap: var(--s-3); }
.source {
  display: grid; grid-template-columns: auto 1fr; gap: 2px var(--s-2); align-items: center;
  padding: var(--s-3); border-radius: var(--r-m); background: var(--surface-2); font-size: var(--t-13); text-decoration: none;
}
.source__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--open); box-shadow: 0 0 0 3px color-mix(in oklch, var(--open) 22%, transparent); }
.source[data-source="rss"] .source__dot { background: var(--holiday); box-shadow: 0 0 0 3px color-mix(in oklch, var(--holiday) 22%, transparent); }
.source__title { font-weight: 550; }
.source__note { grid-column: 2; color: var(--ink-3); font-size: var(--t-12); }
.me { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2); }
.me__text { min-width: 0; flex: 1; line-height: 1.25; }
.me__name, .me__role { display: block; }
.me__name { font-weight: 550; font-size: var(--t-14); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me__role { font-size: var(--t-12); color: var(--ink-3); text-transform: capitalize; }

.main { min-width: 0; outline: none; }
.page { max-width: 1200px; margin: 0 auto; padding: var(--s-7) clamp(var(--s-4), 3vw, var(--s-7)) var(--s-8); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-4) var(--s-5); margin-bottom: var(--s-6); }
.page-head h1 { font-size: var(--t-36); line-height: 1.1; letter-spacing: -0.025em; font-weight: 650; outline: none; }
.page-head .lede { margin-top: var(--s-2); color: var(--ink-2); font-size: var(--t-15); max-width: 60ch; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }

.topbar { display: none; }
.tabbar { display: none; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); height: 38px; padding: 0 var(--s-4);
  border-radius: var(--r-m); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 550; font-size: var(--t-14); white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color 140ms var(--ease-out), border-color 140ms var(--ease-out), transform 140ms var(--ease-out);
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--ink-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover:not(:disabled) { background: color-mix(in oklch, var(--accent) 88%, black); border-color: transparent; }
.btn--danger { background: var(--danger); border-color: var(--danger); color: oklch(99% 0 0); }
.btn--danger:hover:not(:disabled) { background: color-mix(in oklch, var(--danger) 88%, black); border-color: transparent; }
.btn--ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); border-color: transparent; }
.btn--icon { width: 36px; height: 36px; padding: 0; }
.btn--sm { height: 32px; padding: 0 var(--s-3); font-size: var(--t-13); }
.btn.is-busy svg { animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: grid; gap: 6px; }
.field > label, .label { font-size: var(--t-13); font-weight: 550; }
.field__hint { font-size: var(--t-12); color: var(--ink-3); }
.input, .textarea, .select {
  width: 100%; min-height: 40px; padding: 9px var(--s-3); border-radius: var(--r-m); border: 1px solid var(--line-strong);
  background: var(--surface); transition: border-color 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--ink-3); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 22%, transparent); }
.textarea { min-height: 132px; resize: vertical; font: var(--t-13)/1.55 var(--font-mono); }
.select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.search { position: relative; flex: 1 1 240px; max-width: 360px; }
.search svg { position: absolute; left: 11px; top: 50%; width: 17px; height: 17px; translate: 0 -50%; color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 36px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-m); background: var(--surface-2); border: 1px solid var(--line); }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 var(--s-3); border: 0; border-radius: 7px;
  background: transparent; color: var(--ink-2); font-size: var(--t-13); font-weight: 550; cursor: pointer;
}
.seg button svg { width: 15px; height: 15px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px oklch(20% 0.02 265 / 0.12); }
.seg .count { font-family: var(--font-mono); font-size: var(--t-12); color: var(--ink-3); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.toolbar .spacer { flex: 1; }

/* ---------- cards & tables ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line); }
.card__head h2 { font-size: var(--t-15); font-weight: 600; }
.card__body { padding: var(--s-5); }
.link { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 550; font-size: var(--t-13); text-decoration: none; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link svg { width: 15px; height: 15px; }

.table { width: 100%; border-collapse: collapse; font-size: var(--t-14); }
.table th {
  text-align: left; font-weight: 500; font-size: var(--t-12); color: var(--ink-3); padding: 10px var(--s-4);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 14px var(--s-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color 160ms var(--ease-out); }
.table tbody tr:hover { background: color-mix(in oklch, var(--surface-2) 55%, transparent); }
.table .num { font-family: var(--font-mono); font-size: var(--t-13); color: var(--ink-2); white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table .actions .btn { color: var(--ink-3); }
.table .actions .btn:hover { color: var(--ink); }

.shop { display: flex; gap: var(--s-3); align-items: center; min-width: 0; }
.shop__text { min-width: 0; }
.shop__name { font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.shop__name svg { width: 14px; height: 14px; color: var(--ink-3); opacity: 0; transition: opacity 140ms; }
.shop__name:hover { text-decoration: underline; text-underline-offset: 3px; }
.shop__name:hover svg, .shop__name:focus-visible svg { opacity: 1; }
.shop__sub { font-size: var(--t-13); color: var(--ink-2); margin-top: 2px; max-width: 48ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.shop__sub q { font-style: italic; }
.shop__err { display: flex; align-items: center; gap: 5px; margin-top: 4px; font-size: var(--t-12); color: var(--danger); }
.shop__err svg { width: 13px; height: 13px; flex: none; }

.avatar {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: var(--r-m);
  background: var(--surface-2); border: 1px solid var(--line); font: 600 var(--t-13) var(--font-mono); color: var(--ink-2); text-transform: uppercase;
}
.avatar--round { border-radius: 50%; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); font: 500 var(--t-12) var(--font-mono); color: var(--ink-2); white-space: nowrap; }
.tag svg { width: 12px; height: 12px; }
.tag--accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

/* ---------- status pill + the split-flap (signature) ---------- */
.pill {
  --c: var(--gone); --bgc: var(--gone-soft);
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px 0 9px; border-radius: var(--r-pill);
  background: var(--bgc); color: var(--c); font-weight: 600; font-size: var(--t-13); white-space: nowrap; perspective: 300px;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill[data-status="open"]         { --c: var(--open);    --bgc: var(--open-soft); }
.pill[data-status="holiday"]      { --c: var(--holiday); --bgc: var(--holiday-soft); }
.pill[data-status="unsearchable"] { --c: var(--wait);    --bgc: var(--wait-soft); }
.flap { display: inline-grid; }
.flap > span { grid-area: 1 / 1; backface-visibility: hidden; transform-origin: 50% 50%; }
.flap__old { visibility: hidden; }
.is-flipping .flap__old { visibility: visible; animation: flap-out 220ms var(--ease-in) forwards; }
.is-flipping .flap__new { animation: flap-in 300ms var(--ease-snap) 200ms backwards; }
@keyframes flap-out { to { transform: rotateX(-90deg); opacity: 0.4; } }
@keyframes flap-in  { from { transform: rotateX(90deg); opacity: 0.4; } }
tr.is-changed, .board__row.is-changed { animation: row-flash 2400ms var(--ease-out); }
@keyframes row-flash { from { background-color: var(--accent-soft); } }

/* ---------- the board (overview) ---------- */
.board {
  position: relative; overflow: hidden; border-radius: var(--r-l); background: var(--board); color: var(--board-ink);
  padding: var(--s-5) var(--s-5) var(--s-4); isolation: isolate;
}
.board::after { /* 3% grain removes the flat-CSS look */
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.05; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.board__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-2) var(--s-4); margin-bottom: var(--s-5); font: 500 var(--t-12)/1 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--board-muted); }
.board__live { display: inline-flex; align-items: center; gap: var(--s-2); letter-spacing: 0.04em; text-transform: none; font-size: var(--t-12); }
.board__live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--board-open); animation: pulse 2.4s var(--ease-out) infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--board-open) 55%, transparent); } 60% { box-shadow: 0 0 0 6px transparent; } }
.counters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3); }
.counter { display: grid; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-m); background: color-mix(in oklch, var(--board-cell) 60%, transparent); border: 1px solid var(--board-line); text-decoration: none; color: inherit; transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out); }
a.counter:hover { border-color: color-mix(in oklch, var(--board-ink) 30%, transparent); background: var(--board-cell); }
.counter__label { display: flex; align-items: center; gap: var(--s-2); font: 500 var(--t-12) var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--board-muted); }
.counter__label::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--k, var(--board-gone)); }
.counter[data-k="open"] { --k: var(--board-open); }
.counter[data-k="holiday"] { --k: var(--board-holiday); }
.counter[data-k="wait"] { --k: var(--board-wait); }
.digits { display: flex; gap: 4px; perspective: 500px; }
.digit {
  position: relative; display: grid; place-items: center; width: clamp(34px, 4.4vw, 52px); height: clamp(46px, 6vw, 70px);
  border-radius: 6px; background: var(--board-cell); font: 500 clamp(1.75rem, 1rem + 2.6vw, 2.9rem)/1 var(--font-mono); color: var(--board-ink);
  box-shadow: inset 0 -1px 0 oklch(100% 0 0 / 0.04), 0 1px 0 oklch(0% 0 0 / 0.4);
}
.digit::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; translate: 0 -1px; background: var(--board-seam); }
.digits.is-arriving .digit { animation: digit-in 520ms var(--ease-snap) backwards; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes digit-in { from { transform: rotateX(-88deg); opacity: 0; } }

.board__rows { margin-top: var(--s-5); border-top: 1px solid var(--board-line); }
.board__row {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.7fr); gap: var(--s-4); align-items: center;
  padding: 12px var(--s-2); border-bottom: 1px solid var(--board-line); font: 500 var(--t-14) var(--font-mono); letter-spacing: 0.02em;
}
.board__row:last-child { border-bottom: 0; }
.board__row--head { font-size: var(--t-12); letter-spacing: 0.12em; text-transform: uppercase; color: var(--board-muted); padding-top: 14px; padding-bottom: 10px; }
.board__shop { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: uppercase; }
.board__status { display: inline-flex; align-items: center; gap: var(--s-2); perspective: 300px; text-transform: uppercase; color: var(--k, var(--board-gone)); }
.board__status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.board__status[data-status="open"] { --k: var(--board-open); }
.board__status[data-status="holiday"] { --k: var(--board-holiday); }
.board__status[data-status="unsearchable"] { --k: var(--board-wait); }
.board__since { color: var(--board-muted); text-align: right; white-space: nowrap; }
.board__empty { padding: var(--s-6) var(--s-2); color: var(--board-muted); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4); font-size: var(--t-15); }
.board__foot { display: flex; justify-content: flex-end; padding-top: var(--s-3); }
.board__foot .link { color: var(--board-ink); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: var(--s-4); margin-top: var(--s-4); align-items: start; }
.stack { display: grid; gap: var(--s-4); }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: var(--s-3); align-items: start; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: var(--t-14); }
.timeline li:last-child { border-bottom: 0; }
.timeline__icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); }
.timeline__icon svg { width: 14px; height: 14px; }
.timeline__icon[data-status]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--gone)); }
.timeline__icon[data-status="open"] { --c: var(--open); background: var(--open-soft); }
.timeline__icon[data-status="holiday"] { --c: var(--holiday); background: var(--holiday-soft); }
.timeline__icon[data-status="unsearchable"] { --c: var(--wait); background: var(--wait-soft); }
.timeline__text { padding-top: 4px; line-height: 1.45; }
.timeline__text b { font-weight: 600; }
.timeline__time { padding-top: 5px; font: var(--t-12) var(--font-mono); color: var(--ink-3); white-space: nowrap; }
.day { font-size: var(--t-12); font-weight: 600; color: var(--ink-3); letter-spacing: 0.04em; text-transform: uppercase; padding: var(--s-5) 0 var(--s-1); }
.day:first-child { padding-top: 0; }

/* ---------- notices & empty states ---------- */
.notice { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-4); border-radius: var(--r-m); background: var(--surface-2); font-size: var(--t-14); line-height: 1.5; }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--ink-2); }
.notice--warn { background: var(--holiday-soft); }
.notice--warn svg { color: var(--holiday); }
.notice b { font-weight: 600; }
.empty { display: grid; justify-items: center; text-align: center; gap: var(--s-3); padding: var(--s-8) var(--s-5); }
.empty__mark { width: 56px; height: 56px; color: var(--ink-3); }
.empty h2 { font-size: var(--t-17); font-weight: 600; }
.empty p { color: var(--ink-2); max-width: 42ch; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-3) var(--s-5); font-size: var(--t-14); margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* ---------- settings ---------- */
.settings { display: grid; gap: var(--s-4); }
.setting { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: var(--s-5); padding: var(--s-5); }
.setting__intro h2 { font-size: var(--t-15); font-weight: 600; }
.setting__intro p { margin-top: var(--s-1); color: var(--ink-2); font-size: var(--t-14); }
.form { display: grid; gap: var(--s-4); max-width: 420px; }
.form__actions { display: flex; gap: var(--s-2); align-items: center; }
.form-error { color: var(--danger); font-size: var(--t-13); font-weight: 500; }
.form-error:empty { display: none; }

/* ---------- dialog ---------- */
.dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--line); border-radius: var(--r-l);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.dialog[open] { animation: dialog-in 260ms var(--ease-out); }
.dialog::backdrop { background: oklch(15% 0.02 265 / 0.45); backdrop-filter: blur(2px); }
.dialog[open]::backdrop { animation: fade-in 200ms var(--ease-out); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
@keyframes sheet-up { from { opacity: 0; transform: translateY(32px); } }
@keyframes fade-in { from { opacity: 0; } }
.dialog__inner { --pad: var(--s-5); display: grid; gap: var(--s-4); padding: var(--pad); margin: 0; }
.dialog__head { display: flex; justify-content: space-between; gap: var(--s-3); align-items: flex-start; }
.dialog__head h2 { font-size: var(--t-20); font-weight: 650; letter-spacing: -0.015em; }
.dialog__head p { margin-top: var(--s-1); color: var(--ink-2); font-size: var(--t-14); }
.dialog__foot { display: flex; justify-content: flex-end; gap: var(--s-2); padding-top: var(--s-2); }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 220px; overflow: auto; font-size: var(--t-13); }
.results li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: var(--s-2); align-items: start; overflow-wrap: anywhere; }
.results svg { width: 16px; height: 16px; margin-top: 2px; }
.results .ok svg { color: var(--open); } .results .same svg { color: var(--ink-3); } .results .bad svg { color: var(--danger); }
.secret { display: flex; gap: var(--s-2); }
.secret .input { font-family: var(--font-mono); letter-spacing: 0.02em; }

/* ---------- details sheet (the eye) ---------- */
.dialog--sheet {
  margin: 0 0 0 auto; width: min(520px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  border-radius: var(--r-l) 0 0 var(--r-l); border-right: 0;
}
.dialog--sheet[open] { animation: sheet-in 300ms var(--ease-out); }
@keyframes sheet-in { from { opacity: 0; transform: translateX(28px); } }
.dialog--sheet .dialog__inner { min-height: 100%; grid-template-rows: auto 1fr auto auto; align-content: start; }
.dialog--sheet .dialog__head { position: sticky; top: calc(var(--pad) * -1); z-index: 1; margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 0; padding: var(--pad); background: var(--surface); border-bottom: 1px solid var(--line); }
.dialog--sheet .dialog__head h2 { overflow-wrap: anywhere; }
.dialog--sheet .dialog__foot { position: sticky; bottom: calc(var(--pad) * -1); margin: 0 calc(var(--pad) * -1) calc(var(--pad) * -1); padding: var(--s-4) var(--pad); background: var(--surface); border-top: 1px solid var(--line); }
.details { display: grid; gap: var(--s-5); }
.details__status { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; font-size: var(--t-14); }
.details__block { display: grid; gap: var(--s-3); }
.details__block h3 { margin: 0; font-size: var(--t-12); font-weight: 600; color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase; }
.details__block .notice p + p { margin-top: var(--s-1); }
.details__quote { margin: 0; padding: var(--s-3) var(--s-4); border-left: 3px solid var(--holiday); background: var(--surface-2); border-radius: 0 var(--r-m) var(--r-m) 0; font-style: italic; overflow-wrap: anywhere; }
.kv--stack { grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 10px var(--s-4); }
.kv--stack dd { overflow-wrap: anywhere; min-width: 0; }
.kv code, .kv .link.mono { font-size: var(--t-13); overflow-wrap: anywhere; }
.notice--bad { background: var(--danger-soft); }
.notice--bad svg { color: var(--danger); }

.board__shop {
  display: inline-flex; align-items: center; gap: var(--s-2); max-width: 100%; padding: 2px 0; border: 0; background: none; color: inherit;
  font: inherit; letter-spacing: inherit; text-transform: uppercase; cursor: pointer; text-align: left;
}
.board__shop span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board__shop svg { width: 15px; height: 15px; flex: none; color: var(--board-muted); transition: color 140ms var(--ease-out); }
.board__shop:hover span { text-decoration: underline; text-underline-offset: 4px; }
.board__shop:hover svg { color: var(--board-ink); }

/* ---------- password eye ---------- */
.reveal-wrap { position: relative; }
.reveal-wrap .input { padding-right: 46px; }
.reveal-wrap .input::-ms-reveal { display: none; } /* Edge's own eye: we draw one consistent button instead */
.reveal {
  position: absolute; right: 3px; top: 50%; translate: 0 -50%; width: 36px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink-3); cursor: pointer;
}
.reveal svg { width: 18px; height: 18px; }
.reveal:hover { color: var(--ink); background: var(--surface-2); }
.reveal[aria-pressed="true"] { color: var(--accent); }

/* ---------- charts (single series; colour validated for both themes) ---------- */
.chart { margin: 0; display: grid; gap: var(--s-3); }
.chart__title { font-size: var(--t-15); font-weight: 600; }
.chart__empty { display: grid; place-items: center; min-height: 160px; padding: var(--s-4); text-align: center; color: var(--ink-2); font-size: var(--t-14); border: 1px dashed var(--line-strong); border-radius: var(--r-m); }
.chart__frame { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-2); height: 168px; }
.chart__y { display: flex; flex-direction: column; justify-content: space-between; font: var(--t-12) var(--font-mono); color: var(--ink-3); text-align: right; line-height: 1; translate: 0 -0.5em; padding-bottom: 0; }
.chart__y span:last-child { translate: 0 0.5em; }
.chart__plot { position: relative; }
.chart__grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart__grid span { border-top: 1px solid var(--line); }
.chart__grid span:last-child { border-top-color: var(--line-strong); } /* baseline */
.chart__bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.chart__bar { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; border-radius: 4px 4px 0 0; outline-offset: 1px; }
.chart__fill { width: 100%; background: var(--chart); border-radius: 4px 4px 0 0; transition: filter 120ms var(--ease-out); }
.chart__bar:hover .chart__fill, .chart__bar:focus-visible .chart__fill { filter: brightness(1.12) saturate(1.1); }
.chart__bar.is-empty { background: repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in oklch, var(--line) 70%, transparent) 4px 5px); border-radius: 4px 4px 0 0; height: 18%; align-self: flex-end; opacity: 0.7; }
.chart__tip { position: absolute; top: -6px; translate: -50% -100%; padding: 6px 10px; border-radius: var(--r-s); background: var(--ink); color: var(--bg); font-size: var(--t-12); font-weight: 550; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow); z-index: 2; }
.chart__x { display: flex; justify-content: space-between; margin-left: 34px; font: var(--t-12) var(--font-mono); color: var(--ink-3); }
.chart__table summary { cursor: pointer; font-size: var(--t-13); color: var(--ink-2); width: fit-content; }
.chart__table[open] summary { margin-bottom: var(--s-2); }
.chart__table .table { font-size: var(--t-13); }
.chart__table .table td, .chart__table .table th { padding: 6px var(--s-3); }

/* ---------- competitors ---------- */
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: var(--s-4); }
.comp-card { display: grid; gap: var(--s-4); padding: var(--s-5); text-decoration: none; color: inherit; transition: border-color 160ms var(--ease-out), transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out); }
.comp-card:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: 0 8px 24px -16px oklch(20% 0.02 265 / 0.35); }
.comp-card__head { display: flex; gap: var(--s-3); align-items: center; min-width: 0; }
.comp-card__name { display: grid; min-width: 0; }
.comp-card__name .shop__name { font-size: var(--t-17); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.comp-card__name .shop__sub { margin: 0; }
.comp-card__foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2); font-size: var(--t-12); color: var(--ink-3); padding-top: var(--s-3); border-top: 1px solid var(--line); }
.comp-mark { flex: none; object-fit: cover; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--surface-2); }
.comp-mark--md { width: 40px; height: 40px; }
.comp-mark--lg { width: 56px; height: 56px; border-radius: var(--r-l); font-size: var(--t-17); }
.comp-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4) var(--s-3); }
.comp-metric { display: grid; gap: 2px; min-width: 0; }
.comp-metric__label { font-size: var(--t-12); color: var(--ink-3); }
.comp-metric__value { font: 600 var(--t-20)/1.2 var(--font-mono); letter-spacing: -0.01em; font-feature-settings: "tnum"; overflow-wrap: anywhere; }
.comp-metric__value.is-pending, .tile__value.is-pending { font: 500 var(--t-14)/1.4 var(--font-sans); color: var(--ink-3); }
.comp-metric__note { font-size: var(--t-12); color: var(--ink-2); }
.comp-sync { display: inline-flex; align-items: center; gap: 5px; }
.comp-sync svg { width: 13px; height: 13px; }
.comp-sync.is-busy svg { animation: spin 900ms linear infinite; }
.comp-sync.is-bad { color: var(--danger); }
.comp-activity, .comp-section, .comp-charts, .comp-method, .comp-gap { margin-top: var(--s-4); }
.comp-events { list-style: none; margin: 0; padding: 0; }
.comp-event { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: var(--t-14); }
.comp-event:last-child { border-bottom: 0; }
.comp-event__body { text-decoration: none; color: inherit; line-height: 1.45; min-width: 0; }
a.comp-event__body:hover .comp-event__title { text-decoration: underline; text-underline-offset: 3px; }
.comp-event__title { font-weight: 550; }
.comp-thumb { width: 40px; height: 40px; border-radius: var(--r-s); object-fit: cover; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); }
.comp-thumb svg { width: 16px; height: 16px; }
.comp-delta { font-family: var(--font-mono); font-size: var(--t-13); white-space: nowrap; }
.comp-delta.is-up { color: var(--open); }
.comp-delta.is-down { color: var(--danger); }
.comp-back { margin-bottom: var(--s-4); }
.comp-head { align-items: flex-start; }
.comp-head__id { display: flex; gap: var(--s-4); align-items: flex-start; min-width: 0; }
.comp-head__id h1 { overflow-wrap: anywhere; }
.comp-head__meta { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); align-items: center; margin-top: var(--s-2); font-size: var(--t-13); color: var(--ink-3); }
.comp-method summary { cursor: pointer; font-weight: 600; font-size: var(--t-14); }
.comp-method p { margin-top: var(--s-2); color: var(--ink-2); font-size: var(--t-14); max-width: 75ch; }

.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s-3); } /* 6 → 3 → 2, never an orphan */
@media (max-width: 1360px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); } .tile { padding: var(--s-3); } .tile__value { font-size: var(--t-20); } }
.tile { display: grid; gap: 4px; align-content: start; padding: var(--s-4); border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); }
.tile__label { font-size: var(--t-12); color: var(--ink-3); }
.tile__value { font: 600 var(--t-28)/1.15 var(--font-mono); letter-spacing: -0.02em; font-feature-settings: "tnum"; overflow-wrap: anywhere; }
.tile__hint { font-size: var(--t-12); color: var(--ink-2); line-height: 1.4; }

.listing-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: var(--s-4); }
.listing { display: grid; gap: 6px; text-decoration: none; color: inherit; }
.listing__img { display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--r-m); background: var(--surface-2); color: var(--ink-3); }
.listing__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease-out); }
.listing__img svg { width: 28px; height: 28px; }
.listing:hover .listing__img img { transform: scale(1.03); }
.listing__title { font-size: var(--t-13); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.listing:hover .listing__title { text-decoration: underline; text-underline-offset: 3px; }
.listing__price { font: 600 var(--t-15) var(--font-mono); }
.listing__meta { font-size: var(--t-12); color: var(--ink-3); }

/* ---------- Board (home) ---------- */
.home-head { margin-bottom: var(--s-5); }
.home-alert {
  display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); padding: 12px var(--s-4); border-radius: var(--r-m);
  background: var(--holiday-soft); color: var(--ink); text-decoration: none; font-size: var(--t-14);
}
.home-alert svg { width: 18px; height: 18px; flex: none; color: var(--holiday); }
.home-alert svg:last-child { margin-left: auto; color: var(--ink-2); }
.home-alert:hover { background: color-mix(in oklch, var(--holiday-soft) 80%, var(--holiday)); }
.home-alert b { font-weight: 600; }
.home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); margin-top: var(--s-4); align-items: stretch; }
.home-card { display: flex; flex-direction: column; }
.home-card .card__body { flex: 1; }
.home-card .timeline li { padding: 9px 0; }
.home-card__empty { color: var(--ink-2); font-size: var(--t-14); }
.home-card__cta { display: grid; gap: var(--s-4); align-content: start; justify-items: start; }
.home-card__lede { color: var(--ink-2); font-size: var(--t-13); margin-bottom: var(--s-2); }
.home-card__skeleton { height: 120px; }
.home-card__warn { display: flex; gap: var(--s-2); align-items: flex-start; font-size: var(--t-13); color: var(--holiday); }
.home-card__warn[data-level="bad"] { color: var(--danger); }
.home-card__warn svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.home-list { list-style: none; margin: 0; padding: 0; display: grid; }
.home-list__item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; font-size: var(--t-14); }
.home-list li:last-child .home-list__item { border-bottom: 0; }
.home-list__item:hover .home-list__name { text-decoration: underline; text-underline-offset: 3px; }
.home-list__name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-list__value { font: var(--t-13) var(--font-mono); color: var(--ink-2); white-space: nowrap; }
.comp-mark--sm { width: 28px; height: 28px; border-radius: var(--r-s); font-size: 11px; }
@media (max-width: 1080px) { .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .home-grid > :first-child { grid-column: 1 / -1; } }
@media (max-width: 720px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Etsy API usage ---------- */
.usage { display: grid; gap: var(--s-2); }
.usage__numbers { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px var(--s-2); }
.usage__used { font: 600 var(--t-28)/1 var(--font-mono); letter-spacing: -0.02em; font-feature-settings: "tnum"; }
.usage__left { margin-left: auto; font: 500 var(--t-13) var(--font-mono); color: var(--ink-2); }
.usage__note { font-size: var(--t-13); color: var(--ink-2); }
.usage__h { font-size: var(--t-13); font-weight: 600; margin: 0 0 var(--s-2); }
.meter { height: 8px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.meter__fill { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: var(--open); transition: width 400ms var(--ease-out); }
.meter[data-level="warn"] .meter__fill { background: var(--holiday); }
.meter[data-level="bad"] .meter__fill { background: var(--danger); }
.source__meter { grid-column: 1 / -1; margin-top: 6px; }
.source__meter .meter { height: 5px; }

/* ---------- product research ---------- */
.research__form { display: grid; gap: var(--s-3); padding: var(--s-4); margin-bottom: var(--s-4); }
.research__row { display: flex; gap: var(--s-2); }
.research__search { max-width: none; flex: 1; }
.research__q { min-height: 46px; font-size: var(--t-17); }
.research__row .btn { height: 46px; padding: 0 var(--s-5); }
.research__filters { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-4); align-items: center; }
.research__filter { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--t-13); color: var(--ink-2); font-weight: 550; }
.research__filter .select { min-height: 34px; padding-block: 5px; width: auto; }
.research__range { display: inline-flex; align-items: center; gap: 6px; }
.research__range .input { width: 84px; min-height: 34px; padding-block: 5px; }
.research__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: var(--t-13); color: var(--ink-3); margin-bottom: var(--s-3); }
.research__loading { display: flex; gap: var(--s-2); align-items: center; margin-bottom: var(--s-3); }
.research__loading svg { width: 16px; height: 16px; animation: spin 900ms linear infinite; }
.research__insights, .research__shops, .research__results { margin-top: var(--s-4); }
.research__tools { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.research__sort { display: inline-flex; gap: var(--s-2); align-items: center; font-size: var(--t-13); }
.research__sort .select { min-height: 34px; padding-block: 5px; width: auto; }
.research__table .shop { align-items: flex-start; }
.research__thumb { width: 56px; height: 56px; flex: none; object-fit: cover; border-radius: var(--r-m); background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); }
.research__thumb svg { width: 20px; height: 20px; }
.research__title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 550; max-width: 46ch; }
.table th.is-num, .table td.num { text-align: right; }
.table td.is-strong { color: var(--ink); font-weight: 600; }
.price { display: inline-grid; justify-items: end; gap: 2px; }
.price__sale { font-size: var(--t-12); font-weight: 600; color: var(--open); }
.price__native { font-size: var(--t-12); font-weight: 400; color: var(--ink-3); }
@media (max-width: 720px) { .price { justify-items: start; } }
.th-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.th-sort:hover { color: var(--ink); }
.th-sort__mark { font-family: var(--font-mono); opacity: 0.6; }
[aria-sort="ascending"] .th-sort, [aria-sort="descending"] .th-sort { color: var(--ink); }
[aria-sort="ascending"] .th-sort__mark, [aria-sort="descending"] .th-sort__mark { opacity: 1; color: var(--accent); }
.research__shoplist { list-style: none; margin: 0; padding: var(--s-2) var(--s-5) var(--s-4); display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 0 var(--s-5); }
.research__shoplist li { display: flex; align-items: center; gap: var(--s-3); padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.research__shoplist .shop__text { flex: 1; min-width: 0; }
.research__shoplist .shop__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.research__recent { margin-bottom: var(--s-4); }

.tag-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tag-bars__link { display: grid; grid-template-columns: minmax(90px, 0.9fr) minmax(0, 1.4fr) 44px; gap: var(--s-3); align-items: center; padding: 3px 0; color: inherit; text-decoration: none; font-size: var(--t-13); }
a.tag-bars__link:hover .tag-bars__label { text-decoration: underline; text-underline-offset: 3px; color: var(--accent); }
.tag-bars__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-bars__track { height: 8px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.tag-bars__fill { display: block; height: 100%; background: var(--chart); border-radius: inherit; }
.tag-bars__value { font: var(--t-12) var(--font-mono); color: var(--ink-2); text-align: right; }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip { display: inline-flex; align-items: center; height: 32px; padding: 0 var(--s-3); border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); text-decoration: none; font-size: var(--t-13); font-weight: 500; }
.chip:hover { border-color: var(--ink-3); background: var(--surface-2); }

@media (max-width: 720px) {
  .research__row { flex-direction: column; }
  .research__row .btn { width: 100%; }
  .research__filters { display: grid; grid-template-columns: 1fr 1fr; }
  .research__filter { display: grid; gap: 4px; }
  .research__filter .select, .research__range .input { width: 100%; }
  .research__filter:first-child { grid-column: 1 / -1; }
  .research__range { display: grid; grid-template-columns: 1fr auto 1fr; }
  /* result card: listing on top, six metrics in a 3 × 2 grid, actions below
     (.table.research__table beats the generic phone-table rules that come later) */
  .table.research__table tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3) var(--s-3); }
  .table.research__table tbody tr > td:nth-child(2), .table.research__table td.actions { grid-column: 1 / -1; }
  .table.research__table td.cell-meta { grid-column: auto; display: grid; gap: 1px; text-align: left; font-size: var(--t-13); }
  .table.research__table td.cell-meta::before { margin-right: 0; font-size: var(--t-12); }
  .research__shoplist { padding: var(--s-2) var(--s-4) var(--s-3); }
}

/* ---------- keywords ---------- */
.kw-grid, .kw-card, .kw-checker { margin-top: var(--s-4); }
.kw-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.kw-bars__row { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(60px, 1.1fr) 112px auto; gap: var(--s-3); align-items: center; min-height: 30px; font-size: var(--t-13); } /* fixed number column keeps every bar aligned */
.kw-bars__term { color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kw-bars__term:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.kw-bars__nums { font: var(--t-12) var(--font-mono); white-space: nowrap; text-align: right; min-width: 104px; }
.kw-bars__nums b { font-weight: 600; color: var(--ink); }
.kw-related { list-style: none; margin: 0; padding: 0; }
.kw-related li { display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1fr) auto; gap: var(--s-4); align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: var(--t-14); }
.kw-related li:last-child { border-bottom: 0; }
.kw-related__kw { font-weight: 550; color: inherit; text-decoration: none; }
.kw-related__kw:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.kw-related__share { font: var(--t-13) var(--font-mono); white-space: nowrap; }
.kw-related__comp { font: var(--t-13) var(--font-mono); }
.kw-related__actions { display: flex; gap: 2px; }
.kw-checker__body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.kw-checker__inputs { display: grid; gap: var(--s-4); }
.kw-labelrow { display: flex; justify-content: space-between; align-items: baseline; }
.kw-labelrow label { font-size: var(--t-13); font-weight: 550; }
.kw-count { font: var(--t-12) var(--font-mono); color: var(--ink-3); }
.kw-count[data-level="warn"] { color: var(--holiday); }
.kw-count[data-level="bad"] { color: var(--danger); font-weight: 600; }
.kw-title, .kw-tags { min-height: 84px; font: var(--t-14)/1.5 var(--font-sans); }
.kw-chips { list-style: none; margin: var(--s-2) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.kw-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 10px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); font-size: var(--t-12); }
.kw-chip__len { font: 10px var(--font-mono); color: var(--ink-3); background: var(--surface); border-radius: var(--r-pill); padding: 1px 6px; }
.kw-chip.is-bad { background: var(--danger-soft); border-color: color-mix(in oklch, var(--danger) 40%, transparent); color: var(--danger); }
.kw-result { display: grid; gap: var(--s-4); align-content: start; }
.kw-score { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--s-3); align-items: center; }
.kw-score__value { grid-row: span 2; font: 600 2.75rem/1 var(--font-mono); letter-spacing: -0.03em; }
.kw-score[data-level="ok"] .kw-score__value { color: var(--open); }
.kw-score[data-level="warn"] .kw-score__value { color: var(--holiday); }
.kw-score[data-level="bad"] .kw-score__value { color: var(--danger); }
.kw-score__label { font-size: var(--t-14); }
.kw-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: var(--t-14); line-height: 1.45; }
.kw-checks li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: var(--s-2); align-items: start; }
.kw-checks__icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.kw-checks__icon svg { width: 13px; height: 13px; stroke-width: 2.4; }
.kw-checks li[data-level="pass"] .kw-checks__icon { background: var(--open-soft); color: var(--open); }
.kw-checks li[data-level="warn"] .kw-checks__icon { background: var(--holiday-soft); color: var(--holiday); }
.kw-checks li[data-level="fail"] .kw-checks__icon { background: var(--danger-soft); color: var(--danger); }
.kw-sug h3 { margin: 0 0 var(--s-2); font-size: var(--t-13); font-weight: 600; }
.chip { gap: 6px; }
.chip svg { width: 14px; height: 14px; }
button.chip { cursor: pointer; font-family: inherit; }
.chip--add:hover { border-color: var(--accent); color: var(--accent); }
.chip__meta { font: 10px var(--font-mono); color: var(--ink-3); }
@media (max-width: 1080px) { .kw-checker__body { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) {
  .kw-bars__row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .kw-bars__row .tag-bars__track { grid-column: 1 / -1; grid-row: 2; }
  .kw-related li { grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s-3); }
  .kw-related__share, .kw-related__comp { grid-column: 1; font-size: var(--t-12); }
  .kw-related__actions { grid-column: 2; grid-row: 1 / span 3; }
}

/* ---------- trend finder ---------- */
.trend-status { display: flex; flex-wrap: wrap; gap: 6px var(--s-4); align-items: center; margin: calc(var(--s-3) * -1) 0 var(--s-4); font-size: var(--t-13); color: var(--ink-2); }
.trend-status__live { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 550; }
.trend-status__live svg { width: 15px; height: 15px; animation: spin 900ms linear infinite; }
.trend-status__rising { color: var(--open); font-weight: 550; }
.trend-tabs { margin-bottom: var(--s-4); }
.trend-tabs .seg { flex-wrap: wrap; }
.trend-note { margin-bottom: var(--s-4); }
.trend-foot { margin-top: var(--s-4); }
.trend-add__row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
@media (max-width: 720px) { .trend-add__row { grid-template-columns: 1fr; } }

.idea-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--s-4); }
.idea { display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.idea__thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; background: var(--line); }
.idea__thumbs a, .idea__thumbs span { aspect-ratio: 1; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); overflow: hidden; }
.idea__thumbs img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease-out); }
.idea__thumbs a:hover img { transform: scale(1.05); }
.idea__body { display: grid; gap: var(--s-3); align-content: start; padding: var(--s-4) var(--s-5) var(--s-5); }
.idea__title { margin: 0; font-size: var(--t-20); font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; }
.idea__why { font-size: var(--t-13); color: var(--ink-2); line-height: 1.5; }
.idea__why b { color: var(--open); font-weight: 600; }
.idea__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); margin: 0; }
.idea__stats dt { font-size: var(--t-12); color: var(--ink-3); }
.idea__stats dd { margin: 2px 0 0; font: 600 var(--t-15) var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idea__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }

.trend-controls { display: grid; gap: var(--s-3); margin-bottom: var(--s-4); }
.trend-controls__row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.trend-controls__row .spacer { flex: 1; }
.trend-kw { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.trend-kw .chip { white-space: nowrap; flex: none; }
.chip[aria-pressed="true"], .chip--active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip--active svg { width: 13px; height: 13px; }

.listing-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: var(--s-4); }
.listing-card { position: relative; display: grid; grid-template-rows: auto 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out); }
.listing-card:hover { border-color: var(--line-strong); box-shadow: 0 8px 24px -16px oklch(20% 0.02 265 / 0.35); }
.listing-card__img { position: relative; display: grid; place-items: center; aspect-ratio: 1; background: var(--surface-2); color: var(--ink-3); overflow: hidden; }
.listing-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease-out); }
.listing-card:hover .listing-card__img img { transform: scale(1.03); }
.listing-card__badges { position: absolute; left: 10px; top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.score { display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 8px; border-radius: var(--r-pill); background: oklch(18% 0.013 265 / 0.86); color: oklch(97% 0.01 85); font: 600 var(--t-13) var(--font-mono); backdrop-filter: blur(4px); }
.badge-flag { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: var(--r-pill); font-size: var(--t-12); font-weight: 650; background: oklch(99% 0.005 85 / 0.92); }
.badge-flag.is-rising { color: oklch(42% 0.12 155); }
.badge-flag.is-new { color: oklch(45% 0.13 60); }
.listing-card__save { position: absolute; right: 10px; top: 10px; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%; background: oklch(99% 0.005 85 / 0.92); color: oklch(40% 0.01 265); cursor: pointer; box-shadow: 0 1px 3px oklch(0% 0 0 / 0.15); }
.listing-card__save svg { width: 17px; height: 17px; }
.listing-card__save[aria-pressed="true"] { color: oklch(62% 0.16 70); }
.listing-card__save[aria-pressed="true"] svg { fill: currentColor; }
.listing-card__body { display: grid; gap: 4px; align-content: start; padding: var(--s-3) var(--s-4) var(--s-4); }
.listing-card__title { font-size: var(--t-14); line-height: 1.4; color: inherit; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.listing-card__title:hover { text-decoration: underline; text-underline-offset: 3px; }
.listing-card__price { font: 600 var(--t-15) var(--font-mono); }
.listing-card__shop, .listing-card__kw { font-size: var(--t-12); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listing-card__stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: var(--s-2) 0 2px; padding: var(--s-2); border-radius: var(--r-m); background: var(--surface-2); }
.listing-card__stats dt { font-size: 10px; color: var(--ink-3); white-space: nowrap; }
.listing-card__stats dd { margin: 2px 0 0; font: 600 var(--t-12) var(--font-mono); white-space: nowrap; }
.listing-card__stats small { display: block; font: 400 9px var(--font-sans); color: var(--ink-3); }
.trend-more { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--s-4); margin-top: var(--s-5); font-size: var(--t-13); }
.trend-thumbs { display: flex; flex: none; }
.trend-thumbs img, .trend-thumbs span { width: 36px; height: 36px; border-radius: var(--r-s); object-fit: cover; border: 2px solid var(--surface); background: var(--surface-2); margin-left: -10px; }
.trend-thumbs :first-child { margin-left: 0; }
.trend-kwlink { padding: 0; border: 0; background: none; cursor: pointer; font: inherit; font-weight: 600; text-align: left; color: inherit; }
@media (max-width: 720px) { .listing-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); } .listing-card__body { padding: var(--s-2) var(--s-3) var(--s-3); } .listing-card__stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: var(--s-5); bottom: var(--s-5); z-index: 60; display: grid; gap: var(--s-2); justify-items: end; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: var(--s-2); max-width: min(420px, calc(100vw - 32px)); padding: 11px var(--s-4); border-radius: var(--r-m);
  background: var(--ink); color: var(--bg); font-size: var(--t-14); font-weight: 500; box-shadow: var(--shadow); pointer-events: auto;
  animation: toast-in 280ms var(--ease-out);
}
.toast svg { width: 16px; height: 16px; flex: none; }
.toast--bad svg { color: oklch(78% 0.15 27); }
.toast.is-leaving { animation: toast-out 200ms var(--ease-in) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(4px); } }

/* ---------- alert pop-ups (shop back open): a piece of the board that drops in ---------- */
.alerts { position: fixed; top: var(--s-5); right: var(--s-5); z-index: 70; display: grid; gap: var(--s-3); width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.alert {
  position: relative; overflow: hidden; display: grid; gap: var(--s-2); padding: var(--s-4) var(--s-4) var(--s-4) calc(var(--s-4) + 3px);
  border-radius: var(--r-l); background: var(--board); color: var(--board-ink); pointer-events: auto;
  box-shadow: 0 1px 0 var(--board-line) inset, 0 24px 48px -16px oklch(0% 0 0 / 0.55), 0 2px 6px oklch(0% 0 0 / 0.2);
  animation: alert-in 520ms var(--ease-snap) both;
}
.alert::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--board-open); box-shadow: 0 0 18px var(--board-open); }
.alert__top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.alert__eyebrow { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--t-12)/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--board-muted); }
.alert__eyebrow svg { width: 14px; height: 14px; color: var(--board-open); transform-origin: 50% 10%; animation: bell-ring 900ms var(--ease-out) 500ms both; }
.alert__close { display: grid; place-items: center; width: 28px; height: 28px; margin: -6px -6px -6px 0; border: 0; border-radius: var(--r-s); background: none; color: var(--board-muted); cursor: pointer; }
.alert__close:hover { background: var(--board-cell); color: var(--board-ink); }
.alert__close svg { width: 16px; height: 16px; }
.alert__title { margin: 0; font: 600 var(--t-17)/1.25 var(--font-mono); letter-spacing: 0.02em; overflow-wrap: anywhere; }
.alert__status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.alert__body { font-size: var(--t-13); color: var(--board-muted); }
.alert .pill[data-status="open"]    { --c: var(--board-open);    --bgc: color-mix(in oklch, var(--board-open) 15%, transparent); }
.alert .pill[data-status="holiday"] { --c: var(--board-holiday); --bgc: color-mix(in oklch, var(--board-holiday) 15%, transparent); }
.alert .is-flipping .flap__old { animation-delay: 700ms; }
.alert .is-flipping .flap__new { animation-delay: 900ms; }
.alert__action {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px; margin-top: var(--s-1); padding: 7px 12px; border-radius: var(--r-m);
  background: var(--board-open); color: var(--board); font-size: var(--t-13); font-weight: 600; text-decoration: none;
}
.alert__action svg { width: 15px; height: 15px; }
.alert__action:hover { filter: brightness(1.08); }
.alert__timer { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--board-open); opacity: 0.5; transform-origin: left; animation: alert-timer 14s linear forwards; }
.alert.is-paused .alert__timer { animation-play-state: paused; }
.alert.is-leaving { animation: alert-out 240ms var(--ease-in) forwards; }
@keyframes alert-in { from { opacity: 0; transform: translateY(-14px) scale(0.96); } }
@keyframes alert-out { to { opacity: 0; transform: translateX(24px); } }
@keyframes alert-timer { to { transform: scaleX(0); } }
@keyframes bell-ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(16deg); } 40% { transform: rotate(-12deg); } 60% { transform: rotate(7deg); } 80% { transform: rotate(-3deg); } }
@media (max-width: 720px) {
  .alerts { top: calc(var(--s-3) + env(safe-area-inset-top)); left: var(--s-3); right: var(--s-3); width: auto; }
  @keyframes alert-out { to { opacity: 0; transform: translateY(-16px); } }
}

/* ---------- alerts in Settings + the Board nudge ---------- */
.devices { display: grid; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.devices li { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); border-radius: var(--r-m); background: var(--surface-2); font-size: var(--t-14); }
.devices li > svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.devices .is-this { color: var(--accent); }
.devices__text { display: grid; gap: 2px; min-width: 0; }
.devices__text small { color: var(--ink-3); font-size: var(--t-12); }
.devices__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.devices__actions:empty { display: none; }
.nudge { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-l); background: var(--accent-soft); color: var(--ink); }
.nudge > svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.nudge__text { flex: 1; min-width: 0; font-size: var(--t-14); }
.nudge__text b { display: block; }
.nudge .btn { flex: none; }
@media (max-width: 720px) { .nudge { flex-wrap: wrap; } .nudge__text { flex-basis: calc(100% - 40px); } }

/* ---------- module access checkboxes (Users) ---------- */
.access { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--s-2); margin: 0; padding: 0; border: 0; min-width: 0; }
.access legend { margin-bottom: var(--s-2); font-size: var(--t-14); font-weight: 600; }
.access label { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-m); cursor: pointer; font-size: var(--t-14); }
.access label:has(input:checked) { border-color: color-mix(in oklch, var(--accent) 45%, var(--line)); background: var(--accent-soft); }
.access input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.access small { display: block; color: var(--ink-3); font-size: var(--t-12); }
.access-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- loading ---------- */
.skeleton { border-radius: var(--r-l); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton--page { height: 320px; }

/* ---------- responsive: laptop (source lives in the details sheet) ---------- */
@media (max-width: 1240px) and (min-width: 721px) {
  .table .col-source { display: none; }
}

/* ---------- responsive: tablet ---------- */
@media (max-width: 1080px) {
  :root { --sidebar: 76px; }
  .sidebar { padding: var(--s-5) var(--s-3); align-items: center; }
  .brand { padding: 0; }
  .brand__text, .nav a span, .nav__label, .source__title, .source__note, .me__text { display: none; }
  .nav a { justify-content: center; padding: 11px; }
  .source { grid-template-columns: auto; padding: var(--s-3); }
  .me { flex-direction: column; padding: 0; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .setting { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
}

/* ---------- responsive: phone (designed, not shrunk) ---------- */
@media (max-width: 720px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); position: sticky; top: 0; z-index: 20;
    padding: var(--s-3) var(--s-4); background: color-mix(in oklch, var(--bg) 86%, transparent); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .brand__text { display: block; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in oklch, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  }
  .tabbar a { display: grid; justify-items: center; gap: 3px; padding: 7px 2px; border-radius: var(--r-m); color: var(--ink-3); text-decoration: none; font-size: 11px; font-weight: 550; min-width: 0; }
  .tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  @media (max-width: 400px) { .tabbar { padding-inline: 2px; } .tabbar a { font-size: 10px; padding-inline: 0; } .tabbar a svg { width: 19px; height: 19px; } }
  .tabbar a svg, .tabbar__more svg { width: 21px; height: 21px; }
  .tabbar__more { display: grid; justify-items: center; gap: 3px; padding: 7px 2px; border: 0; border-radius: var(--r-m); background: none; color: var(--ink-3); font: 550 11px var(--font-sans); cursor: pointer; }
  .tabbar__more.is-current { color: var(--accent); }
  .more-nav { display: grid; gap: var(--s-5); }
  .more-nav .nav__label { display: block; }
  .more-nav .nav a span { display: inline; }
  .more-nav .nav a { justify-content: flex-start; padding: 12px var(--s-3); font-size: var(--t-15); }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .page { padding: var(--s-5) var(--s-4) calc(96px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: var(--s-5); align-items: stretch; flex-direction: column; }
  .page-head__actions .btn { flex: 1; }
  .board { padding: var(--s-4); margin-inline: calc(var(--s-4) * -1); border-radius: 0; } /* the one deliberate full-bleed */
  .counters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
  .counter { padding: var(--s-3); }
  .digit { width: 38px; height: 52px; font-size: 2rem; }
  .board__row { grid-template-columns: minmax(0, 1fr) auto; }
  .board__since { display: none; }
  .search { max-width: none; flex-basis: 100%; }
  .toolbar .seg { overflow-x: auto; max-width: 100%; }

  /* table → cards */
  .table thead { display: none; }
  .table, .table tbody { display: block; }
  .table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-2) var(--s-3); padding: var(--s-4); border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { display: block; padding: 0; border: 0; }
  .table td.cell-status { grid-column: 2; grid-row: 1; justify-self: end; }
  .table td.cell-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px var(--s-4); font-size: var(--t-12); }
  .table td.cell-meta::before { content: attr(data-label); color: var(--ink-3); margin-right: -10px; }
  .table td.actions { grid-column: 1 / -1; text-align: left; display: flex; gap: var(--s-1); margin-left: -8px; }
  .table td.hide-sm { display: none; }
  .toasts { left: var(--s-4); right: var(--s-4); bottom: calc(80px + env(safe-area-inset-bottom)); justify-items: stretch; }

  /* details sheet becomes a bottom sheet */
  .dialog.dialog--sheet { margin: auto 0 0; width: 100vw; height: auto; max-height: 92dvh; border-radius: var(--r-l) var(--r-l) 0 0; border-right: 1px solid var(--line); border-bottom: 0; }
  .dialog--sheet[open] { animation: sheet-up 300ms var(--ease-out); }
  .dialog--sheet .dialog__foot { padding-bottom: calc(var(--s-4) + env(safe-area-inset-bottom)); }
  .dialog--sheet .dialog__foot .btn { flex: 1; }
  .kv--stack { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv--stack dd { margin-bottom: var(--s-2); }
  .dialog { width: calc(100vw - 24px); }
  .dialog__inner { --pad: var(--s-4); }
  .page-head h1 { font-size: var(--t-28); }
  .toast { max-width: none; }
}

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
  /* flip becomes an instant swap; the row keeps a calm highlight so the change is still visible */
  .is-flipping .flap__old { display: none; }
  tr.is-changed, .board__row.is-changed { animation: none; background-color: var(--accent-soft); transition: background-color 1ms; }
  .board__live::before { animation: none; }
}

/* ---------- listing badges + badge filter chips ---------- */
.badge-filter { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.chip__count { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: var(--t-12); }
.chip[aria-pressed="true"] .chip__count { color: inherit; opacity: 0.75; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--r-pill); font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.badge[data-badge="bestseller"] { background: var(--holiday-soft); color: var(--holiday); border-color: transparent; }
.badge[data-badge="topViews"], .badge[data-badge="topFavs"], .badge[data-badge="trending"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge[data-badge="new"], .badge[data-badge="onSale"] { background: var(--open-soft); color: var(--open); border-color: transparent; }
.badge-flag-row .badges { margin-top: 0; }
.research__chips { padding: 0 var(--s-5) var(--s-4); }
@media (max-width: 720px) { .research__chips { padding: 0 var(--s-4) var(--s-3); } }
.research__more { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--line); }
.research__estnote { padding: 0 var(--s-5) var(--s-4); margin: 0; }
.research__advice .advice { list-style: none; margin: 0; padding: var(--s-2) var(--s-5) var(--s-4); display: grid; gap: var(--s-3); }
.advice li { display: flex; gap: var(--s-3); align-items: flex-start; font-size: var(--t-14); line-height: 1.5; }
.advice li > svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--accent); }
.advice li[data-tone="good"] > svg { color: var(--open); }
.advice li[data-tone="warn"] > svg { color: var(--holiday); }
.advice li[data-tone="bad"] > svg { color: var(--danger); }
.research__shoptable td .shop__text { min-width: 0; }
@media (max-width: 720px) { .research__more, .research__estnote { padding-left: var(--s-4); padding-right: var(--s-4); } .research__advice .advice { padding: var(--s-2) var(--s-4) var(--s-4); } }
.listing-card__est { margin: 2px 0 0; font-size: var(--t-12); color: var(--ink-2); }
.listing-card__est b { color: var(--open); font-weight: 650; }
.research__table td:nth-child(2) { min-width: 300px; }
@media (max-width: 720px) { .research__table td:nth-child(2) { min-width: 0; } }
