/* =========================================================================
   Pop Collect — Margin & market monitor
   Light, borderless, frosted. Surfaces are separated by tone and soft
   shadow rather than lines. One accent (cobalt) for interaction; green and
   red are reserved for market movement only.
   Type: Geist (UI + figures, tabular) · Geist Mono (SKU tickers only)
   ========================================================================= */

:root {
  --canvas: #F4F5F9;
  --surface: #FFFFFF;
  --surface-2: #F6F7FA;   /* sunken fields, hover */
  --surface-3: #EEF0F5;   /* pressed, tracks */

  --ink: #0E1220;
  --ink-2: #3B4159;
  --ink-3: #6F7590;
  --ink-4: #A2A8BC;
  --hair: rgba(14, 18, 32, 0.06);
  --hair-2: rgba(14, 18, 32, 0.10);

  --brand: #2E5BFF;
  --brand-ink: #2249D6;
  --brand-soft: rgba(46, 91, 255, 0.10);
  --brand-ring: rgba(46, 91, 255, 0.28);

  --up: #12A150;
  --up-ink: #0E7F3F;
  --up-soft: #E4F5EA;
  --down: #E5484D;
  --down-ink: #C43C41;
  --down-soft: #FDEAEB;
  --flat: #6F7590;
  --flat-soft: #EEF0F5;

  --frost: rgba(255, 255, 255, 0.66);
  --frost-strong: rgba(255, 255, 255, 0.86);

  /* category tints for slab art: muted so they never compete with status */
  --cat-pokemon-1: #F2C94C; --cat-pokemon-2: #3B7DD8;
  --cat-basketball-1: #F08A4B; --cat-basketball-2: #B4472B;
  --cat-baseball-1: #2F4A8A; --cat-baseball-2: #C24A4A;
  --cat-mtg-1: #6B4FBB; --cat-mtg-2: #2C2A4A;
  --cat-onepiece-1: #D6453B; --cat-onepiece-2: #F0B24C;

  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 24px;

  --shadow-1: 0 1px 2px rgba(14, 18, 32, 0.04), 0 10px 30px -18px rgba(14, 18, 32, 0.16);
  --shadow-2: 0 2px 4px rgba(14, 18, 32, 0.04), 0 18px 44px -20px rgba(14, 18, 32, 0.22);
  --shadow-3: 0 6px 12px -6px rgba(14, 18, 32, 0.10), 0 32px 64px -24px rgba(14, 18, 32, 0.30);

  --ease: cubic-bezier(.2, .7, .2, 1);
  --rail-w: 240px;
  --topbar-h: 64px;
}

/* ------------------------------ BASE ---------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01', 'cv11';
}
/* Ambient tint behind the frosted chrome. Deliberately faint. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1000px 560px at 6% -10%, rgba(122, 108, 255, 0.16), transparent 62%),
    radial-gradient(760px 520px at 102% -4%, rgba(56, 196, 168, 0.11), transparent 60%),
    radial-gradient(640px 420px at 55% -12%, rgba(255, 178, 122, 0.09), transparent 60%),
    radial-gradient(900px 640px at 70% 112%, rgba(46, 91, 255, 0.06), transparent 60%);
}
::selection { background: rgba(46, 91, 255, 0.18); }
* { scrollbar-width: thin; scrollbar-color: rgba(14, 18, 32, 0.18) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(14, 18, 32, 0.16); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
dl, dd { margin: 0; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; }
.r { text-align: right; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------------------------- APP SHELL ------------------------------- */

.app { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; transition: grid-template-columns .28s var(--ease); }
.app.rail-collapsed { --rail-w: 76px; }

/* Collapsed rail: icons only, everything else folds away. */
.rail-collapsed .rail { padding-left: 12px; padding-right: 12px; }
.rail-collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
.rail-collapsed .brand-logo-mark { display: block; }
.rail-collapsed .brand-logo,
.rail-collapsed .store-text,
.rail-collapsed .store .chev,
.rail-collapsed .nav-item > span,
.rail-collapsed .plan-widget-text,
.rail-collapsed .plan-widget .chev { display: none; }
.rail-collapsed .store { justify-content: center; padding: 8px 0; }
.rail-collapsed .nav-item { position: relative; justify-content: center; padding: 11px 0; }
.rail-collapsed .nav-item .nav-badge { display: grid; position: absolute; top: 4px; right: 6px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
.rail-collapsed .plan-widget { justify-content: center; padding: 8px 0; }
.rail-toggle { margin-right: 2px; }

/* ------------------------------- RAIL --------------------------------- */

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  background: var(--frost);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  box-shadow: inset -1px 0 0 var(--hair);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px 22px;
}
.brand-logo { display: block; width: auto; height: 30px; max-width: 100%; }
.brand-logo-mark { display: none; width: auto; height: 20px; }

.store {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 8px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  text-align: left;
  cursor: pointer;
  margin-bottom: 14px;
  transition: background .15s var(--ease);
}
.store:hover { background: rgba(14, 18, 32, 0.045); }
.store-avatar { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; box-shadow: 0 1px 2px rgba(14, 18, 32, 0.2); }
.store-avatar svg { display: block; }
.store-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.store-avatar.has-logo { background: var(--surface); }
.store-wrap { position: relative; }
.menu.store-menu { left: 0; right: auto; top: calc(100% + 6px); width: 100%; background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
.rail:has(.store-menu:not([hidden])) { z-index: 60; }
.store-menu .menu-item { white-space: nowrap; }
.rail-collapsed .menu.store-menu { width: 232px; }
.menu-title { font-size: 13px; font-weight: 600; }
.menu-sub { font-size: 12px; color: var(--ink-3); }
.page-actions { display: flex; align-items: center; gap: 8px; }
.add-wrap { position: relative; }
/* Panels animate in, which makes each child its own layer; lift the header so its menu opens above the toolbar. */
#tab-inventory .page-head { z-index: 20; }
.menu.add-menu { width: 270px; }
.menu-item-text { display: flex; flex-direction: column; gap: 1px; text-align: left; }
.menu-item-text b { font-weight: 600; color: var(--ink); }
.menu-item-text small { font-size: 11.5px; font-weight: 400; color: var(--ink-3); }
.add-menu .menu-item { align-items: flex-start; }
.add-menu .menu-item svg { margin-top: 2px; }
.dup-note { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); font-size: 12.5px; }
.modal.is-wide { max-width: 760px; }
.import-preview { max-height: 46vh; overflow: auto; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--hair); }
.import-preview table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.import-preview th { position: sticky; top: 0; padding: 8px 10px; background: var(--surface-2); text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.import-preview td { padding: 8px 10px; box-shadow: inset 0 1px 0 var(--hair); vertical-align: top; white-space: nowrap; }
.import-preview td small { display: block; font-size: 11.5px; color: var(--ink-3); }
.import-preview .r { text-align: right; }
.sheet-bar-actions { display: flex; align-items: center; gap: 8px; }
.sheet-selection { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.sheet-table input.sheet-check { width: 15px; height: 15px; min-width: 0; margin: 0; padding: 0; flex: none; border-radius: 3px; background: none; box-shadow: none; -webkit-appearance: auto; appearance: auto; accent-color: var(--ink); cursor: pointer; vertical-align: middle; }
.sheet-check-wrap { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.sheet-table tr.is-selected td { background: var(--brand-soft); }
.menu-tag { margin-left: auto; padding: 2px 7px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-size: 10.5px; font-weight: 600; }
.store-logo-row { display: flex; align-items: center; gap: 16px; }
.store-logo-preview { width: 64px; height: 64px; flex-shrink: 0; border-radius: 16px; overflow: hidden; box-shadow: 0 1px 3px rgba(14, 18, 32, 0.2); }
.store-logo-preview svg, .store-logo-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.store-logo-preview.has-logo { background: var(--surface); }
.store-logo-actions { display: flex; flex-direction: column; gap: 6px; }
.store-logo-buttons { display: flex; gap: 8px; }
.store-logo-buttons label.btn { cursor: pointer; }
.store-note { font-size: 12.5px; color: var(--ink-3); }
.store-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.store-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-domain { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store .chev { color: var(--ink-4); flex-shrink: 0; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-item svg { flex-shrink: 0; color: var(--ink-3); transition: color .15s var(--ease); }
.nav-item > span:first-of-type { flex: 1; }
.nav-item:hover { background: rgba(14, 18, 32, 0.045); color: var(--ink); }
.nav-item:hover svg { color: var(--ink-2); }
.nav-item.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); font-weight: 600; }
.nav-item.is-active svg { color: var(--brand); }
.nav-count { font-size: 11.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.nav-badge {
  min-width: 18px; height: 18px; padding: 0 6px;
  display: grid; place-items: center;
  border-radius: 20px;
  background: var(--ink); color: #fff;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}

.rail-foot { padding-top: 14px; }
.plan-widget {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 10px 10px 12px;
  border: 0; border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--shadow-1);
  text-align: left; cursor: pointer;
  transition: box-shadow .18s var(--ease), transform .18s var(--ease);
}
.plan-widget:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.plan-widget .chev { color: var(--ink-4); margin-left: auto; flex-shrink: 0; }
.plan-widget-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.plan-widget-count { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.plan-widget-label { font-size: 11.5px; color: var(--ink-3); }
.ring { width: 36px; height: 36px; flex-shrink: 0; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--surface-3); stroke-width: 3.5; }
.ring-fill { fill: none; stroke: var(--brand); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .9s var(--ease) .2s; }
.meter { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 4px; background: var(--ink); width: 0; transition: width .6s var(--ease); }

/* ------------------------------ TOPBAR -------------------------------- */

.main { min-width: 0; display: flex; flex-direction: column; overflow-x: clip; } /* clip: the decorative ribbon bleeds past the edge on narrow screens */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px;
  background: rgba(244, 245, 249, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
}
.topbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hair) 12%, var(--hair) 88%, transparent);
}
/* Sync progress: a hairline sweep along the top bar instead of a spinner. */
.topbar-progress {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; z-index: 1;
  background: linear-gradient(90deg, var(--brand), #7C9BFF);
  transform-origin: left; transform: scaleX(0); opacity: 0;
  transition: opacity .35s var(--ease);
}
body.is-syncing .topbar-progress { opacity: 1; animation: sweep 1.4s cubic-bezier(.3, .6, .2, 1) forwards; }
@keyframes sweep { 0% { transform: scaleX(0); } 60% { transform: scaleX(.72); } 100% { transform: scaleX(1); } }

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 320px;
  padding: 8px 10px 8px 12px;
  border-radius: 12px;
  background: rgba(14, 18, 32, 0.05);
  color: var(--ink-3);
  transition: background .15s var(--ease), box-shadow .15s var(--ease);
}
.search:hover { background: rgba(14, 18, 32, 0.07); }
.search:focus-within { background: var(--surface); box-shadow: 0 0 0 3px var(--brand-ring), var(--shadow-1); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 13.5px; color: var(--ink); }
.search input::placeholder { color: var(--ink-4); }
.search kbd {
  font-family: var(--font);
  font-size: 11px;
  color: var(--ink-4);
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--hair-2);
}
.search:focus-within kbd { display: none; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.sync-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); padding-right: 4px; font-variant-numeric: tabular-nums; }
.sync-pill svg { color: var(--up); transition: color .3s var(--ease); }
body.is-syncing .sync-pill svg { color: var(--brand); animation: spin 1.2s linear infinite; }

.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 0; border-radius: 12px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s var(--ease);
}
.icon-btn:hover { background: rgba(14, 18, 32, 0.06); }
.icon-btn-count {
  position: absolute; top: 3px; right: 2px;
  min-width: 17px; height: 17px; padding: 0 5px;
  display: grid; place-items: center;
  border-radius: 9px; background: var(--ink); color: #fff;
  font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--canvas);
}

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: block; overflow: hidden;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px rgba(14, 18, 32, 0.08);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-initials { display: grid; place-items: center; width: 100%; height: 100%; background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 600; letter-spacing: .02em; }
.field input[readonly] { color: var(--ink-3); cursor: default; }
.field input[readonly]:focus { background: var(--surface-2); box-shadow: none; }
.account-menu { position: relative; }
.avatar-trigger { padding: 2px; border: 0; background: none; border-radius: 50%; cursor: pointer; transition: box-shadow .15s var(--ease); }
.avatar-trigger:hover, .avatar-trigger[aria-expanded="true"] { box-shadow: 0 0 0 3px rgba(14, 18, 32, 0.10); }
.avatar-trigger.is-active { box-shadow: 0 0 0 3px var(--brand-ring); }

.menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 250px;
  padding: 6px;
  border-radius: var(--r-md);
  background: var(--frost-strong);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  backdrop-filter: blur(24px) saturate(1.6);
  box-shadow: var(--shadow-3), 0 0 0 1px var(--hair);
  z-index: 50;
  animation: rise .18s var(--ease);
  transform-origin: top right;
}
.menu-head { padding: 10px 10px 11px; display: flex; flex-direction: column; gap: 2px; }
.account-name { font-size: 13px; font-weight: 600; }
.account-email { font-size: 12px; color: var(--ink-3); }
.menu-divider { height: 1px; background: var(--hair); margin: 5px 6px; }
.menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px;
  border: 0; border-radius: 9px; background: none;
  color: var(--ink-2); font-size: 13px; font-weight: 500; text-align: left;
  cursor: pointer;
}
.menu-item svg { color: var(--ink-3); }
.menu-item:hover { background: rgba(14, 18, 32, 0.06); color: var(--ink); }

/* ------------------------------ BUTTONS ------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 0;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .12s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease), opacity .15s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-ink { background: var(--ink); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 18px -10px rgba(14, 18, 32, 0.6); }
.btn-ink:hover { background: #1D2238; }
.btn-ink.is-loading svg { animation: spin .8s linear infinite; }
.btn-ghost { background: rgba(14, 18, 32, 0.055); color: var(--ink); }
.btn-ghost:hover { background: rgba(14, 18, 32, 0.09); }
.btn-danger { background: var(--down); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--down-ink); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.link-btn { padding: 0; border: 0; background: none; font-size: 12.5px; font-weight: 600; color: var(--brand-ink); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ------------------------------ CONTENT ------------------------------- */

.content { flex: 1; min-width: 0; width: 100%; max-width: 1360px; margin: 0 auto; padding: 26px 32px 72px; }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }
.tab-panel.is-active > * { animation: rise .5s var(--ease) both; }
.tab-panel.is-active > *:nth-child(2) { animation-delay: .05s; }
.tab-panel.is-active > *:nth-child(3) { animation-delay: .10s; }
.tab-panel.is-active > *:nth-child(4) { animation-delay: .15s; }
.tab-panel.is-active > *:nth-child(5) { animation-delay: .20s; }

.page-head { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 6px 0 22px; }

/* Decorative ribbon in the top-right, bleeding under the frosted hero. */
.ribbon {
  position: absolute; right: -40px; top: -120px;
  width: 760px; height: 300px;
  pointer-events: none; z-index: 0; opacity: .7;
  -webkit-mask-image: linear-gradient(90deg, transparent 6%, #000 34%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent 6%, #000 34%, #000 92%, transparent);
  animation: ribbon-drift 40s ease-in-out infinite alternate;
}
.ribbon svg { width: 100%; height: 100%; display: block; }
@keyframes ribbon-drift { from { transform: translate(0, 0); } to { transform: translate(-16px, 8px); } }
.hero { position: relative; z-index: 1; }
.page-head h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; }
.page-head p { margin-top: 3px; font-size: 13.5px; color: var(--ink-3); }

.surface {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 20px 22px 22px;
  margin-bottom: 18px;
}
.surface-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.surface-head h2 { font-size: 15px; }
.surface-note { font-size: 12.5px; color: var(--ink-3); }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--ink-3); }

/* ------------------------------ HERO ---------------------------------- */

.hero {
  padding: 22px 24px 18px;
  background: rgba(255, 255, 255, 0.74);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  backdrop-filter: blur(28px) saturate(1.5);
  box-shadow: var(--shadow-1), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.hero-label { font-size: 13px; color: var(--ink-3); }
.hero-value-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.hero-value { font-size: 50px; font-weight: 400; letter-spacing: -0.04em; line-height: 1; }
.hero-sub { display: block; margin-top: 8px; font-size: 13px; color: var(--ink-3); }
.hero-sub b { color: var(--ink); font-weight: 600; }

.delta-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border-radius: 20px;
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.delta-chip.up { background: var(--up-soft); color: var(--up-ink); }
.delta-chip.down { background: var(--down-soft); color: var(--down-ink); }
.delta-chip.flat { background: var(--flat-soft); color: var(--flat); }

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: rgba(14, 18, 32, 0.055);
  flex-shrink: 0;
}
.segmented button {
  padding: 5px 11px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.segmented button svg { color: currentColor; }

.chart { position: relative; height: 230px; margin: 6px 76px 0 -4px; }
.chart-svg .band { fill: rgba(14, 18, 32, 0.035); }
.chart-svg .ref.cost { stroke: var(--ink-4); }
.chart-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-svg .area { fill: url(#hero-fill); opacity: 0; animation: fade .9s var(--ease) .35s forwards; }
.chart-svg .line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.4s var(--ease) .1s forwards; }
.chart-svg .ref { fill: none; stroke: var(--ink-4); stroke-width: 1.2; stroke-dasharray: 3 5; vector-effect: non-scaling-stroke; opacity: .9; }
.chart-end { position: absolute; left: 100%; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2.5px #fff, 0 0 0 4px rgba(46, 91, 255, 0.25); transform: translate(-50%, -50%); pointer-events: none; animation: fade .4s var(--ease) 1.2s both; }
/* Current value pinned to the line's end, like a price tag on the right axis. */
.chart-tag {
  position: absolute; left: 100%; margin-left: 12px;
  padding: 3px 8px; border-radius: 7px;
  background: var(--brand); color: #fff;
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
  transform: translateY(-50%); pointer-events: none;
  box-shadow: 0 4px 10px -4px rgba(46, 91, 255, 0.6);
  animation: fade .4s var(--ease) 1.3s both;
}
.chart-tag::before { content: ''; position: absolute; left: -4px; top: 50%; width: 8px; height: 8px; background: inherit; border-radius: 2px; transform: translateY(-50%) rotate(45deg); }
.slab text { font-family: var(--font); }
.chart-labels { position: absolute; left: 0; right: 0; bottom: -20px; height: 16px; pointer-events: none; }
.chart-labels span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--ink-4); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-labels span:first-child { transform: none; }
.chart-labels span:last-child { transform: translateX(-100%); }
.chart-ylabel { position: absolute; left: 100%; margin-left: 12px; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); font-size: 11px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; transform: translateY(-50%); pointer-events: none; }
.chart-legend { display: none; }
.chart-cursor { position: absolute; top: 0; bottom: 0; left: 0; pointer-events: none; }
.chart-cursor-line { position: absolute; top: 0; bottom: 0; left: 0; width: 1px; background: var(--ink-4); opacity: .6; }
.chart-cursor-dot { position: absolute; left: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--brand-ring); transform: translate(-50%, -50%); }
.chart-tip {
  position: absolute; top: 4px; left: 12px;
  display: flex; flex-direction: column; gap: 1px;
  padding: 8px 10px; border-radius: 10px;
  background: var(--ink); color: #fff;
  white-space: nowrap;
  box-shadow: var(--shadow-2);
}
.chart-tip.flip { left: auto; right: 12px; }
.chart-tip-date { font-size: 11px; opacity: .7; }
.chart-tip-value { font-size: 14px; font-weight: 600; }
.chart-tip-sub { font-size: 11px; opacity: .8; }
.chart-tip-sub.up { color: #7BE3A6; }
.chart-tip-sub.down { color: #FF9DA0; }
.chart-legend { position: absolute; top: -4px; right: 8px; display: flex; gap: 14px; font-size: 11.5px; color: var(--ink-3); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 14px; height: 0; border-top: 2px solid var(--brand); border-radius: 2px; }
.chart-legend .lg-retail { border-top: 2px dashed var(--ink-4); }

/* Display case: the collection as real slabs standing on a glass shelf. */
.vault { padding-bottom: 10px; }
.vault .surface-head { margin-bottom: 4px; }
.vault-nav { display: flex; gap: 4px; margin-left: auto; }
.vault-nav .icon-btn { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2); }
.vault-nav .icon-btn:hover { background: var(--surface-3); }
.vault-shelf { position: relative; display: flex; gap: 6px; overflow-x: auto; padding: 18px 2px 8px; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; }
.vault-shelf::-webkit-scrollbar { display: none; }
.vault-slot {
  position: relative;
  flex: 0 0 auto; width: 118px;
  display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 0 4px 10px; border: 0; border-radius: 12px; background: none; cursor: pointer;
  scroll-snap-align: start;
  transition: background .2s var(--ease);
}
.vault-slot:hover { background: var(--surface-2); }
/* The shelf: a soft base each slab rests on. */
.vault-slot::before { content: ''; position: absolute; left: 10px; right: 10px; top: 118px; height: 10px; border-radius: 50%; background: radial-gradient(closest-side, rgba(14, 18, 32, 0.16), transparent); }
.vault-slot .slab { width: 80px; height: 123px; position: relative; z-index: 1; transition: transform .45s var(--ease), filter .45s var(--ease); }
.vault-slot:hover .slab { transform: translateY(-8px) perspective(400px) rotateY(-10deg); filter: drop-shadow(0 16px 14px rgba(14, 18, 32, 0.16)); }
.vault-slot:hover::before { transform: scaleX(.82); opacity: .6; }
.vault-slot::before { transition: transform .45s var(--ease), opacity .45s var(--ease); }
.vault-slot:focus-visible { outline: none; background: var(--surface-2); }
.vault-name { margin-top: 12px; width: 100%; min-height: 30px; font-size: 11.5px; font-weight: 600; line-height: 1.3; color: var(--ink-2); text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vault-price { display: flex; align-items: baseline; gap: 5px; margin-top: 4px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.vault-price i { font-style: normal; font-size: 11px; }
.vault-price i.up { color: var(--up-ink); }
.vault-price i.down { color: var(--down-ink); }
.vault-price i.flat { color: var(--ink-4); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid var(--hair);
}
.stat { display: flex; flex-direction: column; gap: 3px; padding: 4px 16px 0 0; }
.stat + .stat { padding-left: 16px; box-shadow: inset 1px 0 0 var(--hair); }
.stat-label { font-size: 12px; color: var(--ink-3); }
.stat-value { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--ink-4); margin-left: 2px; }
.stat-sub { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.stat-sub.up { color: var(--up-ink); }
.stat-sub.down { color: var(--down-ink); }
.stat .meter { margin-top: 6px; width: 120px; }

/* ------------------------------ TICKER -------------------------------- */

/* By category: one share bar, then a row per category. */
.cat-bar { display: flex; gap: 3px; height: 10px; margin: 6px 0 14px; border-radius: 6px; overflow: hidden; }
.cat-bar span { display: block; height: 100%; border-radius: 3px; min-width: 6px; transition: width .6s var(--ease); }
.cat-list { display: flex; flex-direction: column; }
.cat-row { display: grid; grid-template-columns: 10px 1fr auto 64px; align-items: center; gap: 12px; padding: 10px 0; }
.cat-row + .cat-row { box-shadow: inset 0 1px 0 var(--hair); }
.cat-swatch { width: 10px; height: 10px; border-radius: 3px; }
.cat-name { display: flex; flex-direction: column; font-size: 13px; font-weight: 600; min-width: 0; }
.cat-name small { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-top: 1px; }
.cat-value { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.cat-delta { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.cat-delta.up { color: var(--up-ink); }
.cat-delta.down { color: var(--down-ink); }
.cat-delta.flat { color: var(--flat); }

/* --------------------------- OVERVIEW SPLIT --------------------------- */

.overview-split { display: grid; grid-template-columns: 1.45fr 1fr; gap: 18px; align-items: start; margin-top: 18px; }
.overview-split .surface { margin-bottom: 0; }
.overview-side { display: flex; flex-direction: column; gap: 18px; }
.overview-side .surface:last-child { flex: 1; }

.attention-list { display: flex; flex-direction: column; }
.attention {
  display: grid;
  grid-template-columns: auto 1.2fr 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 8px;
  margin: 0 -8px;
  width: calc(100% + 16px);
  border: 0; border-radius: 12px;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background .15s var(--ease);
}
.attention-math { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.attention-math b { font-size: 13px; font-weight: 600; white-space: nowrap; }
.attention-math b.up { color: var(--up-ink); }
.attention-math b.down { color: var(--down-ink); }
.attention-math small { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attention:hover { background: var(--surface-2); }
.attention + .attention { box-shadow: inset 0 1px 0 var(--hair); }
.attention-title { display: block; font-size: 13.5px; font-weight: 600; }
.attention-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.attention-sub > span { white-space: nowrap; }
.attention-value { text-align: right; white-space: nowrap; }
.attention-price { display: block; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.attention-pct { display: block; margin-top: 1px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.attention-pct.up { color: var(--up-ink); }
.attention-pct.down { color: var(--down-ink); }

.signal { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.signal svg { flex-shrink: 0; }
.signal.up { color: var(--up-ink); }
.signal.down { color: var(--down-ink); }
.signal.flat { color: var(--flat); }

.activity-list { display: flex; flex-direction: column; }
.activity { display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding: 10px 0; align-items: start; }
.activity + .activity { box-shadow: inset 0 1px 0 var(--hair); }
.activity-icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); margin-top: 1px; }
.activity.is-alert .activity-icon { background: var(--brand-soft); color: var(--brand-ink); }
.activity-text { font-size: 13px; color: var(--ink-2); }
.activity-time { margin-top: 2px; font-size: 12px; color: var(--ink-4); font-variant-numeric: tabular-nums; }

/* ------------------------------ TOOLBAR ------------------------------- */

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.search-inline { width: 280px; background: var(--surface); box-shadow: var(--shadow-1); }
.search-clear {
  display: grid; place-items: center; flex-shrink: 0;
  width: 20px; height: 20px; margin-right: -4px; padding: 0;
  border: 0; border-radius: 50%;
  background: rgba(14, 18, 32, 0.08); color: var(--ink-3);
  cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease);
}
.search-clear:hover { background: var(--ink); color: #fff; }
.search-inline:hover { background: var(--surface); }
.toolbar-filters { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.select-wrap { position: relative; display: inline-flex; }
.select-wrap::after {
  content: '';
  position: absolute; right: 12px; top: 50%;
  width: 7px; height: 7px;
  border-right: 1.6px solid var(--ink-3); border-bottom: 1.6px solid var(--ink-3);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.select, .field select {
  appearance: none; -webkit-appearance: none;
  padding: 8px 32px 8px 12px;
  border: 0; border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  cursor: pointer;
  transition: box-shadow .15s var(--ease);
}
.select:hover { color: var(--ink); }
.select:focus-visible, .field select:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring), var(--shadow-1); }

/* ------------------------------ CARD GRID ----------------------------- */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(460px, 100%), 1fr)); gap: 16px; }
.card-grid > * { min-width: 0; }

/* Poster tile: the slab fills the left edge at full height, numbers at right. */
.card {
  position: relative;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 18px 18px 14px 18px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
  animation: rise .45s var(--ease) both;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.card:not(.is-editing):not(.is-expanded) { cursor: pointer; }

/* Expanded tile: spans the row, art at left, chart + numbers + action at right. */
.card.is-expanded {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px 28px;
  padding: 24px 26px 22px;
  box-shadow: var(--shadow-2), 0 0 0 1px rgba(46, 91, 255, 0.10);
  cursor: default;
}
.card.is-expanded:hover { transform: none; }
.card.is-expanded .slab { width: 150px; height: 231px; }
.card.is-expanded { align-items: start; }
.card.is-expanded:hover .slab { transform: none; filter: drop-shadow(0 12px 18px rgba(14, 18, 32, 0.16)); }
.x-art { display: flex; align-items: flex-start; justify-content: center; }
.x-main { min-width: 0; }
.x-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.x-title .card-name { font-size: 19px; letter-spacing: -0.02em; }
.x-title .card-meta { overflow: visible; white-space: normal; }
.x-close { width: 34px; height: 34px; margin: -4px -6px 0 0; flex-shrink: 0; }
.x-price-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 16px; }
.x-price-row .card-price { font-size: 30px; }
.x-range { font-size: 12.5px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.card-chart { position: relative; height: 170px; margin: 10px 76px 0 -4px; }
.card-chart .chart-labels { bottom: -18px; }
.x-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 32px; }
.x-stats .stat-value { font-size: 17px; }
.x-stats .stat-value.up { color: var(--up-ink); }
.x-stats .stat-value.down { color: var(--down-ink); }
.card.is-expanded .alert-suggest { margin-top: 18px; }
.x-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.card.is-editing { grid-column: 1 / -1; align-items: start; box-shadow: 0 0 0 2px var(--brand-ring), var(--shadow-2); transform: none; cursor: default; }
.card.is-editing .card-edit .form-row { grid-template-columns: 1fr 1fr; }
.card.is-editing .card-edit .form-row.three { grid-template-columns: 1fr 1fr 1fr; }

.card-art { display: flex; align-items: center; justify-content: center; }
.card-body { min-width: 0; display: flex; flex-direction: column; }
.card-top { display: flex; gap: 14px; align-items: flex-start; }
.card-title { flex: 1; min-width: 0; }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-name { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; min-width: 0; }
/* Status as plain colored text: no chip, no background. */
.card-status { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; margin-top: 2px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.card-status.up { color: var(--up-ink); }
.card-status.down { color: var(--down-ink); }
.card-status.flat { color: var(--ink-3); }
.card-set { margin-top: 2px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; }
.card-meta > span { flex-shrink: 0; }
.card-meta .t-sym { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.card-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-4); }

.card-price-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 16px; }
.card-price { font-size: 26px; font-weight: 500; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.card-price-label { display: block; margin-top: 5px; font-size: 12px; color: var(--ink-3); }
.card-price-label b { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.card-spark { width: 96px; height: 34px; margin-bottom: 4px; flex-shrink: 0; }
.card-spark svg { width: 100%; height: 100%; overflow: visible; }
.card-price-label + .card-price-label { margin-top: 2px; color: var(--ink-4); }

.card-pnl { display: inline-flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--ink-3); white-space: nowrap; min-width: 0; }
.card-pnl b { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card-pnl.up b { color: var(--up-ink); }
.card-pnl.down b { color: var(--down-ink); }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--hair); }
.card-foot-meta { font-size: 12px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.card-actions { display: flex; gap: 2px; margin-right: -8px; }
.mini-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 9px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.mini-btn:hover { background: rgba(14, 18, 32, 0.06); color: var(--ink); }
.mini-btn.is-syncing svg { animation: spin .8s linear infinite; }
.mini-btn.is-primary { color: var(--brand-ink); }
.mini-btn.is-primary:hover { background: var(--brand-soft); }

/* Slab thumbnail: a graded card in its holder. Category tint is the card
   art, the label strip carries the grade. Sheen sweeps on hover. */
.slab { width: 52px; height: 80px; flex-shrink: 0; overflow: visible; transition: transform .5s var(--ease), filter .5s var(--ease); transform-origin: 50% 60%; }
.card .slab { width: 132px; height: 203px; }
.alert-card .slab { width: 50px; height: 77px; }
.attention .slab { width: 36px; height: 55px; }
.slab .slab-sheen { transform: translateX(-110%); transition: transform .7s var(--ease); transform-box: fill-box; }
.card:hover .slab .slab-sheen, .attention:hover .slab .slab-sheen, .row:hover .slab .slab-sheen { transform: translateX(110%); }
/* Picked-up feel: a small 3D tilt and a longer shadow on hover. */
.card:hover .slab { transform: perspective(520px) rotateY(-12deg) rotateX(5deg) translateY(-2px); filter: drop-shadow(8px 14px 14px rgba(14, 18, 32, 0.18)); }
.slab image { transition: opacity .3s; }

/* Price rail: cost → retail band with market marker. The one chart every
   card carries; it is the app's threshold logic drawn literally. */
.rail-price { margin-top: 16px; }
.rail-track { position: relative; height: 22px; }
.rail-track::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; border-radius: 2px; background: var(--surface-3); }
.rail-band { position: absolute; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; background: var(--ink-4); opacity: .55; }
.rail-zone { position: absolute; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; }
.rail-zone.up { background: var(--up); opacity: .35; }
.rail-zone.down { background: var(--down); opacity: .35; }
.rail-tick { position: absolute; top: 50%; width: 2px; height: 12px; margin: -6px 0 0 -1px; border-radius: 2px; background: var(--ink-2); }
.rail-mark { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--flat); box-shadow: 0 0 0 3px var(--surface); transition: left .6s var(--ease); }
.rail-mark.up { background: var(--up); }
.rail-mark.down { background: var(--down); }
.rail-labels { display: flex; justify-content: space-between; margin-top: 2px; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rail-labels b { font-weight: 600; color: var(--ink-2); }
.rail-labels .lab-market.up b { color: var(--up-ink); }
.rail-labels .lab-market.down b { color: var(--down-ink); }

/* Inline edit (grid tile / list row) */
.card-edit { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.card-edit .form-row { gap: 10px; }
.card-edit-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.edit-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.btn-done { transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease); }
.btn-done svg { transition: transform .22s var(--ease); }
.btn-done:hover { background: var(--up-ink); transform: translateY(-1px); box-shadow: 0 10px 22px -10px rgba(14, 127, 63, 0.7); }
.btn-done:hover svg { transform: scale(1.2) rotate(-8deg); }
.icon-action {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 9px; background: transparent; color: var(--ink-3);
  cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-action.is-danger:hover { background: var(--down-soft); color: var(--down-ink); }
.grade-input { display: flex; gap: 8px; min-width: 0; }
.grade-input .select-wrap { flex: 1 1 auto; min-width: 0; }
.grade-input input { flex: 0 0 76px; width: 76px; }
.grade-input [data-grade-format-wrap] { flex: 1 1 auto; min-width: 0; }
.age-chip.is-slow { color: #9A5B00; font-weight: 600; }
.age-chip.is-stale { color: var(--down-ink); font-weight: 600; }
.field input.is-invalid, .sheet-table input.is-invalid { box-shadow: 0 0 0 2px var(--down); }
.sheet-grade .grade-input { gap: 0; min-width: 150px; }
.sheet-grade .grade-input input { flex-basis: 56px; width: 56px; }
.sheet-grade .grade-input { min-width: 210px; }

/* ------------------------------ LIST VIEW ----------------------------- */

.list { padding: 0; overflow: hidden; }
.list-scroll { overflow-x: auto; }
.list-head, .row {
  display: grid;
  grid-template-columns: minmax(200px, 1.6fr) 104px 76px 96px 76px 80px 56px 72px 84px 92px 60px;
  align-items: center;
  gap: 8px;
  min-width: 1100px;
  padding: 0 14px;
}
.list-head { height: 40px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); background: var(--surface-2); position: sticky; top: 0; }
.row { height: 64px; box-shadow: inset 0 1px 0 var(--hair); transition: background .15s var(--ease); }
.row:hover { background: var(--surface-2); }
.row-card { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row-card .slab { width: 30px; height: 46px; }
.row-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-set { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-ticker { display: flex; align-items: center; gap: 8px; }
.row-ticker .t-sym { font-family: var(--mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.row-ticker .t-spark { width: 36px; height: 16px; }
.row-ticker .t-spark svg { width: 100%; height: 100%; overflow: visible; }
.cell { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell b { font-weight: 600; }
.cell small { display: block; margin-top: 1px; font-size: 11px; font-weight: 400; color: var(--ink-4); }
.cell.up { color: var(--up-ink); font-weight: 600; }
.cell.down { color: var(--down-ink); font-weight: 600; }
.cell.flat { color: var(--ink-3); }
.cell.dim { color: var(--ink-4); font-size: 12px; }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
.row.is-editing { height: auto; display: block; padding: 18px 18px 16px; background: var(--surface); box-shadow: inset 0 0 0 2px var(--brand-ring); }
.row.is-editing .form-row { gap: 12px; }
.row.is-editing .card-edit-head { margin-bottom: 14px; }

/* ------------------------------- STATUS ------------------------------- */

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px 3px 7px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.pill svg { flex-shrink: 0; }
.pill.up { background: var(--up-soft); color: var(--up-ink); }
.pill.down { background: var(--down-soft); color: var(--down-ink); }
.pill.flat { background: var(--flat-soft); color: var(--flat); }
.pill.brand { background: var(--brand-soft); color: var(--brand-ink); }

.status-ok { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--up-ink); }

/* ------------------------------- EMPTY -------------------------------- */

.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 56px 20px; color: var(--ink-3); text-align: center; }
.empty svg { color: var(--ink-4); margin-bottom: 8px; }
.empty h3 { font-size: 15px; color: var(--ink); }
.empty .btn { margin-top: 12px; }

/* ------------------------------- SHEET -------------------------------- */

.sheet-bar {
  position: sticky; top: var(--topbar-h); z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; margin-bottom: 12px;
  border-radius: 12px;
  background: var(--frost-strong);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: var(--shadow-1);
}
.sheet-hint { font-size: 12.5px; color: var(--ink-3); }
.sheet-scroll { padding: 0; overflow: auto; max-height: calc(100vh - 220px); }
.sheet-table { border-collapse: collapse; width: 100%; min-width: 1360px; font-size: 13px; }
.sheet-table th { position: sticky; top: 0; z-index: 2; padding: 10px 12px; text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ink-3); background: var(--surface-2); white-space: nowrap; }
.sheet-table th.r { text-align: right; }
.sheet-table td { padding: 0; box-shadow: inset 0 1px 0 var(--hair); vertical-align: middle; }
.sheet-table td.readonly { padding: 0 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sheet-table td.readonly.r { text-align: right; }
.sheet-rownum { width: 64px; padding-left: 12px !important; }
.sheet-rownum-cell { padding: 0 12px !important; text-align: right; font-size: 11.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.sheet-table input, .sheet-table select {
  width: 100%; height: 44px; padding: 0 12px;
  border: 0; background: transparent; outline: none;
  font-size: 13px; color: var(--ink);
  transition: background .12s var(--ease), box-shadow .12s var(--ease);
}
.sheet-table input[type="number"] { text-align: right; font-variant-numeric: tabular-nums; }
.sheet-table input:hover, .sheet-table select:hover { background: var(--surface-2); }
.sheet-table input:focus, .sheet-table select:focus { background: var(--surface); box-shadow: inset 0 0 0 2px var(--brand); position: relative; z-index: 1; }
.sheet-table select { appearance: none; -webkit-appearance: none; cursor: pointer; }

/* ------------------------------- CHIPS -------------------------------- */

.chips { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.chip {
  padding: 7px 13px;
  border: 0; border-radius: 20px;
  background: transparent;
  color: var(--ink-3);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.chip:hover { background: rgba(14, 18, 32, 0.055); color: var(--ink); }
.chip.is-active { background: var(--ink); color: #fff; }

/* ------------------------------- ALERTS ------------------------------- */

.alert-feed { display: flex; flex-direction: column; gap: 14px; }
.alert {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px 28px;
  padding: 20px 22px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: opacity .2s var(--ease);
  animation: rise .45s var(--ease) both;
}
.alert.is-reviewed { opacity: .58; }
.alert.is-reviewed:hover { opacity: 1; }
.alert-main { min-width: 0; }
.alert-kind { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.alert-kind .signal { font-size: 12.5px; }
.alert-time { font-size: 12px; color: var(--ink-4); }
.alert-card { display: flex; align-items: center; gap: 14px; }
.alert-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.alert-name span { font-weight: 500; color: var(--ink-3); }
.alert-set { margin-top: 2px; font-size: 12.5px; color: var(--ink-3); }
.alert-figures { display: flex; gap: 0; margin-top: 18px; flex-wrap: wrap; }
.alert-figure { display: flex; flex-direction: column; gap: 3px; padding-right: 22px; margin-right: 22px; box-shadow: inset -1px 0 0 var(--hair); }
.alert-figure:last-child { box-shadow: none; margin-right: 0; padding-right: 0; }
.alert-figure span:first-child { font-size: 12px; color: var(--ink-3); }
.alert-figure b { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.alert-figure b.up { color: var(--up-ink); }
.alert-figure b.down { color: var(--down-ink); }
.alert-explain { margin-top: 16px; font-size: 13px; line-height: 1.55; color: var(--ink-2); max-width: 64ch; }
.alert-explain b { font-weight: 600; color: var(--ink); }
.alert-suggest { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.alert-suggest b { color: var(--ink); }
.alert-suggest.up { background: var(--up-soft); color: var(--up-ink); }
.alert-suggest.up b { color: var(--up-ink); }
.alert-suggest.down { background: var(--down-soft); color: var(--down-ink); }
.alert-suggest.down b { color: var(--down-ink); }
.alert-actions { display: flex; flex-direction: column; gap: 8px; align-self: start; }

/* ------------------------------- SYNC --------------------------------- */

.connections { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.connection { margin-bottom: 0; display: flex; flex-direction: column; }
.connection-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.connection-mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.connection-mark.shopify { background: #F1F8EC; }
.connection-mark.ebay { background: #F5F6FA; }
.destination-icon.brand-slack { background: #FBF7FA; }
.destination-icon.brand-discord { background: #EEF0FD; }
.connection-title { flex: 1; min-width: 0; }
.connection-title h3 { font-size: 15px; }
.connection-title p { margin-top: 1px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv { display: flex; flex-direction: column; margin-bottom: 16px; flex: 1; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 13px; }
.kv > div + div { box-shadow: inset 0 1px 0 var(--hair); }
.kv dt { color: var(--ink-3); }
.kv dd { font-weight: 500; text-align: right; }
.connection .btn { align-self: flex-start; }

.destinations { display: flex; flex-direction: column; }
.destination { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 12px 0; }
.destination + .destination { box-shadow: inset 0 1px 0 var(--hair); }
.destination-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.destination-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.destination-label { font-size: 13.5px; font-weight: 600; }
.destination-detail { font-size: 12.5px; color: var(--ink-3); }

.switch {
  position: relative; width: 42px; height: 26px;
  border: 0; border-radius: 26px;
  background: var(--surface-3);
  cursor: pointer;
  transition: background .2s var(--ease);
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(14, 18, 32, 0.25);
  transition: transform .2s var(--ease);
}
.switch.is-on { background: var(--up); }
.switch.is-on::after { transform: translateX(16px); }

.sync-log { display: flex; flex-direction: column; }
.sync-row { display: grid; grid-template-columns: 130px 140px 1fr; gap: 16px; padding: 10px 0; font-size: 13px; }
.sync-row + .sync-row { box-shadow: inset 0 1px 0 var(--hair); }
.sync-time { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sync-kind { font-weight: 600; }
.sync-result { color: var(--ink-2); }

/* ------------------------------ BILLING ------------------------------- */

.current-plan { display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 28px; align-items: center; }
.current-plan-info h2 { margin-top: 4px; font-size: 22px; letter-spacing: -0.02em; }
.current-plan-info p { margin-top: 4px; font-size: 13px; color: var(--ink-3); }
.usage-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-3); margin-bottom: 8px; }
.usage-label .num { font-weight: 600; color: var(--ink); }
.usage-note { margin-top: 8px; font-size: 12px; color: var(--ink-3); }

.plan-readout { display: flex; align-items: baseline; gap: 14px; margin: 8px 0 22px; }
.plan-price { font-size: 44px; font-weight: 500; letter-spacing: -0.035em; line-height: 1; }
.plan-price span { font-size: 16px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; margin-left: 2px; }
.plan-limit { font-size: 14px; color: var(--ink-3); }
.plan-limit b { color: var(--ink); font-weight: 600; }

.slider-wrap { padding: 0 6px; margin-bottom: 26px; }
.slider {
  --fill: 0%;
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 26px; margin: 0;
  background: transparent; cursor: pointer;
}
.slider::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--ink) var(--fill), var(--surface-3) var(--fill)); }
.slider::-moz-range-track { height: 4px; border-radius: 4px; background: var(--surface-3); }
.slider::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--ink); }
.slider::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 24px; height: 24px; margin-top: -10px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(14, 18, 32, 0.2), 0 4px 12px rgba(14, 18, 32, 0.18), 0 0 0 1px rgba(14, 18, 32, 0.06);
  transition: transform .15s var(--ease);
}
.slider::-moz-range-thumb { width: 24px; height: 24px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(14, 18, 32, 0.2), 0 4px 12px rgba(14, 18, 32, 0.18), 0 0 0 1px rgba(14, 18, 32, 0.06); }
.slider:active::-webkit-slider-thumb { transform: scale(1.12); }
.slider:focus-visible { outline: none; }
.slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--brand-ring), 0 4px 12px rgba(14, 18, 32, 0.18); }
.slider-ticks { display: flex; justify-content: space-between; margin-top: 14px; }
.slider-tick { position: relative; width: 24px; text-align: center; font-size: 11px; color: var(--ink-4); font-variant-numeric: tabular-nums; transition: color .15s var(--ease); }
.slider-tick.is-active { color: var(--ink); font-weight: 600; }
.slider-tick .tick-current { position: absolute; left: 50%; top: -15px; transform: translateX(-50%); font-size: 9.5px; font-weight: 600; letter-spacing: .02em; color: var(--brand-ink); white-space: nowrap; }

.features { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 22px; }
.features li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.features li::before { content: ''; width: 16px; height: 16px; border-radius: 50%; background: var(--up-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 12.5l4 4 8-9' stroke='%230E7F3F' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 10px no-repeat; }
.plan-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; border-top: 1px solid var(--hair); }
.plan-hint { font-size: 12.5px; color: var(--ink-3); max-width: 48ch; }

/* ------------------------------- FORMS -------------------------------- */

.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-3); min-width: 0; }
.field-narrow { max-width: 320px; }
.field input, .field select {
  width: 100%;
  padding: 9px 12px;
  border: 0; border-radius: 10px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px transparent;
  font-size: 13.5px; font-weight: 400; color: var(--ink);
  outline: none;
  transition: background .15s var(--ease), box-shadow .15s var(--ease);
}
.field select { padding-right: 32px; }
.field .select-wrap { display: flex; }
.field input:hover, .field select:hover { background: var(--surface-3); }
.field input:focus, .field select:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--brand); }
.field input:disabled { color: var(--ink-3); background: var(--surface-2); opacity: .8; }
.field input::placeholder { color: var(--ink-4); }
.field input[type="number"] { font-variant-numeric: tabular-nums; }
.form-actions { display: flex; justify-content: flex-end; padding-top: 2px; }
.form-actions-start { justify-content: flex-start; }
/* Confirm / form dialog */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center; padding: 16px;
  background: rgba(14, 18, 32, 0.38);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: fade .15s var(--ease);
}
.modal {
  width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 22px 22px 18px;
  border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-3);
  animation: rise .2s var(--ease);
}
.modal h2 { margin: 0 0 8px; font-size: 17px; font-weight: 650; color: var(--ink); }
.modal-body { font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.modal-body p { margin: 0 0 12px; }
.modal-form { gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-actions .btn { min-width: 84px; justify-content: center; }

/* Aging stock (overview) */
.aging-buckets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 22px; }
.age-bucket { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.age-bar { display: block; height: 6px; margin-top: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.age-bar i { display: block; height: 100%; border-radius: 4px; }
/* One hue, light → dark: older stock reads heavier. */
.age-step-0 { background: #B9C2D8; }
.age-step-1 { background: #8793B3; }
.age-step-2 { background: #515C7D; }
.age-step-3 { background: #1F2740; }
.aging-list { margin-top: 18px; }
.aging-row { display: grid; grid-template-columns: minmax(0, 1.3fr) auto minmax(0, 1.4fr); align-items: center; gap: 18px; padding: 10px 0; box-shadow: inset 0 1px 0 var(--hair); }
.aging-card { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.aging-card .slab { width: 30px; height: 46px; flex-shrink: 0; }
.aging-card > span { display: flex; flex-direction: column; min-width: 0; }
.aging-card:hover .row-name { text-decoration: underline; }
.aging-capital { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.aging-capital b { font-size: 13.5px; font-weight: 600; }
.aging-capital small { font-size: 11.5px; color: var(--ink-3); }
.aging-action { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; }
.aging-why { font-size: 12px; color: var(--ink-3); text-align: right; }
.aging-more { display: block; margin: 12px 0 0; }
.channel-picker { display: grid; grid-template-columns: repeat(3, 1fr); }
.channel-picker button { padding: 9px 10px; font-size: 13px; }
.sold-auto { margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-size: 10.5px; font-weight: 600; }
.alert-actions .btn svg { flex-shrink: 0; }

/* Sold tab */
.sold-stats { margin-top: 0; padding-top: 0; border-top: 0; }
.stat-value.up { color: var(--up-ink); }
.stat-value.down { color: var(--down-ink); }
#tab-sold .page-head { align-items: center; }
.sold-chart-surface .surface-head { align-items: flex-start; }
.sold-chart-surface .surface-head h2 { margin-bottom: 2px; }
.sold-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 2px 0 14px; font-size: 12.5px; color: var(--ink-3); }
.sold-legend-item { display: inline-flex; align-items: center; gap: 7px; }
.sold-legend-item i, .sold-end i, .sold-tip-row i { width: 12px; height: 2px; border-radius: 2px; flex-shrink: 0; }
.sold-legend-item b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.sold-chart { position: relative; height: 240px; margin: 8px 148px 28px 46px; }
.sold-chart-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sold-grid { stroke: var(--hair-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.sold-grid.is-zero { stroke: var(--ink-4); }
.sold-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.sold-chart-overlay { position: absolute; inset: 0; pointer-events: none; }
.sold-ylabel { position: absolute; right: 100%; margin-right: 10px; transform: translateY(-50%); font-size: 11px; color: var(--ink-4); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sold-xlabel { position: absolute; top: 100%; margin-top: 8px; transform: translateX(-50%); font-size: 11px; color: var(--ink-4); white-space: nowrap; }
.sold-xlabel:last-of-type { transform: translateX(-100%); }
.sold-end { position: absolute; left: 100%; margin-left: 10px; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.sold-end b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.sold-marker { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--down); box-shadow: 0 0 0 2px var(--surface); transform: translate(-50%, -50%); }
.sold-cursor-dot { position: absolute; left: 0; width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); transform: translate(-50%, -50%); }
.sold-tip { gap: 3px; z-index: 2; }
.sold-tip-row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: rgba(255, 255, 255, 0.72); }
.sold-tip-row b { min-width: 58px; font-size: 13px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.sold-tip .chart-tip-sub { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.sold-chart-surface .sold-empty { padding: 40px 22px; }
.sold-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.sold-toolbar .chips { margin-bottom: 0; }
.sold-surface { padding: 6px 0 4px; }
.sold-table-wrap { overflow-x: auto; }
.sold-table { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.sold-table th { padding: 12px 14px; text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.sold-table td { padding: 10px 14px; box-shadow: inset 0 1px 0 var(--hair); white-space: nowrap; }
.sold-table .r { text-align: right; }
.sold-table td.up { color: var(--up-ink); }
.sold-table td.down { color: var(--down-ink); }
.sold-table td.muted { color: var(--ink-3); }
.sold-card { display: flex; align-items: center; gap: 12px; min-width: 0; max-width: 340px; }
.sold-card .slab { width: 30px; height: 46px; flex-shrink: 0; }
.sold-card > div { min-width: 0; }
.sold-empty { margin: 0; padding: 28px 22px; text-align: center; font-size: 13px; color: var(--ink-3); }

/* Discord webhook setup, shown under the Discord switch when it's on */
.discord-setup { margin: 0 0 12px 50px; padding: 16px 18px; border-radius: var(--r-md); background: var(--surface-2); animation: rise .2s var(--ease); }
.discord-setup-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--ink); }
.setup-steps { margin: 0 0 14px; padding-left: 18px; font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }
.setup-steps li + li { margin-top: 6px; }
.setup-steps b { font-weight: 600; color: var(--ink); }
.discord-form { display: flex; flex-direction: column; gap: 10px; }
.discord-form .field input { background: var(--surface); }
.discord-actions { display: flex; gap: 8px; }
.discord-status { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.discord-status:empty { display: none; }
.discord-status.up { color: var(--up-ink); }
.discord-status.down { color: var(--down-ink); }

.danger-zone { box-shadow: inset 0 0 0 1px var(--down-soft), var(--shadow-1); }
.danger-zone h2 { color: var(--down-ink); }
.danger-copy { margin: 0; max-width: 60ch; font-size: 13px; line-height: 1.55; color: var(--ink-2); }

/* -------------------------------- TOAST ------------------------------- */

.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translate(-50%, 16px);
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--ink); color: #fff;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-3);
  opacity: 0; pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
  z-index: 100;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.has-action.is-visible { pointer-events: auto; }
.toast-action { margin-left: 12px; padding: 3px 9px; border: 0; border-radius: 7px; background: rgba(255, 255, 255, 0.16); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.toast-action:hover { background: rgba(255, 255, 255, 0.28); }

/* ------------------------------- TABBAR ------------------------------- */

.tabbar { display: none; }

/* ----------------------------- RESPONSIVE ----------------------------- */

@media (max-width: 1180px) {
  .stat-row { grid-template-columns: repeat(3, 1fr); row-gap: 16px; }
  .stat:nth-child(4) { padding-left: 0; box-shadow: none; }
  .x-stats { grid-template-columns: repeat(3, 1fr); }
  .x-stats .stat:nth-child(4) { padding-left: 0; box-shadow: none; }
  .overview-split { grid-template-columns: 1fr; }
  .attention { grid-template-columns: auto 1.3fr 1fr auto; }
  .current-plan { grid-template-columns: 1fr; gap: 18px; }
}

@media (max-width: 920px) {
  :root { --topbar-h: 58px; }
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .topbar { padding: 0 16px; gap: 10px; }
  .rail-toggle { display: none; }
  .search { width: auto; flex: 1; }
  .search kbd { display: none; }
  .sync-pill { display: none; }
  .content { padding: 18px 16px 96px; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 22px; }
  .hero { padding: 18px 16px 14px; }
  .ribbon { width: 460px; height: 180px; right: -70px; top: -80px; }
  .hero-value { font-size: 36px; }
  .chart { height: 190px; margin-right: 64px; }
  .chart-tag { font-size: 11px; padding: 2px 6px; margin-left: 10px; }
  .connections { grid-template-columns: minmax(0, 1fr); }
  .form-row, .form-row.three { grid-template-columns: 1fr; }
  .search-inline { width: 100%; }
  .toolbar .segmented { margin-left: auto; }
  .alert { grid-template-columns: 1fr; }
  .alert-actions { flex-direction: row; }
  .alert-actions .btn { flex: 1; }
  .sync-row { grid-template-columns: 1fr; gap: 2px; }
  .plan-foot { flex-direction: column; align-items: stretch; }
  .features { flex-direction: column; gap: 10px; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: flex;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--frost-strong);
    -webkit-backdrop-filter: blur(24px) saturate(1.5); backdrop-filter: blur(24px) saturate(1.5);
    box-shadow: 0 -1px 0 var(--hair);
  }
  .tabbar-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 4px;
    border: 0; border-radius: 12px; background: none;
    color: var(--ink-3); font-size: 10.5px; font-weight: 600;
    cursor: pointer;
  }
  .tabbar-item.is-active { color: var(--ink); }
  .tabbar-item.is-active svg { color: var(--brand); }
}

@media (max-width: 600px) {
  .stat-row { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { padding-left: 0; box-shadow: none; }
  .stat:nth-child(4) { padding-left: 16px; box-shadow: inset 1px 0 0 var(--hair); }
  .stat:nth-child(5) { padding-left: 0; box-shadow: none; }
  .hero-top { flex-direction: column; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  /* Phone tile: slab beside the title, everything else full width beneath. */
  .card { grid-template-columns: 84px minmax(0, 1fr); gap: 12px 14px; align-items: start; }
  .card:not(.is-expanded) .card-body { display: contents; }
  .card-art { grid-row: 1; grid-column: 1; justify-content: flex-start; }
  .card-top, .card.is-editing .card-edit-head { grid-row: 1; grid-column: 2; }
  .card-edit-head { flex-direction: column; }
  .card-price-row, .rail-price, .card-foot, .card-edit { grid-column: 1 / -1; }
  .card-price-row { margin-top: 0; }
  .rail-price { margin-top: 4px; }
  .card .slab { width: 84px; height: 129px; }
  .card-foot { flex-wrap: wrap; }
  .card.is-editing .card-edit .form-row, .card.is-editing .card-edit .form-row.three { grid-template-columns: 1fr; }
  #syncNowBtn span { display: none; }
  #syncNowBtn { padding: 9px 11px; }
  .attention-sub > span:nth-child(n+2) { display: none; }
  .attention-pct { font-size: 11.5px; }
  .attention { grid-template-columns: auto 1fr auto; }
  .attention-math { display: none; }
  .card { padding: 14px 14px 12px; }
  .card-spark { width: 72px; height: 30px; }
  .card.is-expanded { grid-template-columns: 1fr; padding: 18px 16px; }
  .card.is-expanded .slab { width: 96px; height: 148px; }
  .x-art { justify-content: flex-start; }
  .card-chart { margin-right: 64px; }
  .x-stats { grid-template-columns: 1fr 1fr; row-gap: 14px; }
  .x-stats .stat:nth-child(odd) { padding-left: 0; box-shadow: none; }
  .x-stats .stat:nth-child(even) { padding-left: 16px; box-shadow: inset 1px 0 0 var(--hair); }
}

/* Phones: the Retail / Cost axis tags don't fit beside the chart (and the
   stat row right below repeats both figures). */
@media (max-width: 600px) {
  .chart-ylabel { display: none; }
  .discord-setup { margin-left: 0; }
  .sold-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 16px; }
  .aging-buckets { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
  .aging-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .aging-action { grid-column: 1 / -1; flex-direction: column; align-items: flex-start; gap: 6px; }
  .aging-why { text-align: left; }
  .sold-chart { height: 200px; margin: 8px 6px 28px 40px; }
  .sold-end { display: none; }
  #tab-sold .page-head { align-items: flex-start; flex-direction: column; }
  .sold-stats .stat:nth-child(odd) { padding-left: 0; box-shadow: none; }
  /* Each sale becomes a card: the card name, then label/value pairs. */
  .sold-table { min-width: 0; }
  .sold-table thead { display: none; }
  .sold-table tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 10px; padding: 14px 16px; box-shadow: inset 0 1px 0 var(--hair); }
  .sold-table tbody tr:first-child { box-shadow: none; }
  .sold-table td { padding: 0; box-shadow: none; text-align: left !important; white-space: normal; font-size: 12.5px; }
  .sold-table td:first-child { grid-column: 1 / -1; }
  .sold-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 1px; font-size: 11px; font-weight: 500; color: var(--ink-4); }
}

/* -------------------------------- LOGIN -------------------------------- */
/* Real Supabase sign-in gate (backend.js). Shown instead of .app until a
   session exists; kept visually consistent with the rest of the app
   (frosted surface, same tokens) rather than a bare unstyled form. */

.login-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--canvas);
}
.login-card {
  width: 100%; max-width: 420px;
  max-height: 100%; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding: 32px 28px 28px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px -24px rgba(14, 18, 32, 0.28);
}
.login-logo { display: block; width: auto; height: 34px; align-self: flex-start; margin-bottom: 20px; }
.signup-fields { display: flex; flex-direction: column; gap: 14px; }
.login-segmented { display: grid; grid-template-columns: 1fr 1fr; }
.login-segmented button { padding: 8px 11px; font-size: 13px; }
.field-hint { font-size: 11.5px; font-weight: 400; color: var(--ink-4); }
.field input.is-invalid { box-shadow: 0 0 0 2px var(--down); }
.login-card h1 { margin: 0 0 6px; font-size: 20px; font-weight: 650; color: var(--ink); }
.login-sub { margin: 0 0 18px; font-size: 13px; color: var(--ink-3); line-height: 1.5; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card .btn { width: 100%; margin-top: 4px; }
.login-google { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 4px; }
.login-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0; font-size: 11.5px; font-weight: 600; color: var(--ink-4); text-transform: uppercase; letter-spacing: .04em; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--hair-2); }
.login-error { margin: 0; font-size: 12.5px; font-weight: 500; color: var(--down-ink); }
.login-toggle {
  margin: 16px auto 0; padding: 0; border: 0; background: none;
  font-size: 12.5px; font-weight: 600; color: var(--brand-ink); cursor: pointer;
}
.login-toggle:hover { text-decoration: underline; }
.login-demo {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 18px; padding: 12px 14px;
  border-radius: var(--r-md); background: var(--surface-2);
  font-size: 12px; color: var(--ink-3); line-height: 1.5;
}
.login-demo strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.login-demo .mono { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }
.login-card .login-demo .btn { width: auto; margin-top: 0; flex-shrink: 0; }

/* ----------------------------- CONNECTIONS ------------------------------ */

.connection-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* -------------------------------- MOTION ------------------------------ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .chart-svg .line { stroke-dashoffset: 0; }
  .chart-svg .area { opacity: 1; }
}
