/* Sully's Vault — black theme. The page background is pure black (#000);
   cards use subtle dark greys so sections stay distinguishable. */
:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #111111;
  --surface-2: #1b1b1b;
  --surface-3: #242424;
  --text: #ffffff;
  --muted: #a9a9b3;
  --border: #2c2c2c;
  --accent: #a78bfa;
  --accent-strong: #7c5cff;
  --accent-2: #ff4f8b;
  --accent-soft: #221a3d;
  --good: #34d399;
  --good-soft: #0c2a1f;
  --bad: #ff6b6b;
  --bad-soft: #2e1212;
  --warn: #fbbf24;
  --warn-soft: #2b2108;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.container { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: .85rem;
}
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { white-space: nowrap; padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: #fff; }
.user { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .user { margin-left: auto; }
}

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent-strong); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
  transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--border); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.good { background: var(--good); }
.btn.small { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
input, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; width: 100%;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 6px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
h1 { font-size: 1.8rem; margin: 0 0 6px; }
h2 { font-size: 1.25rem; margin: 0 0 14px; }
h3 { margin: 0 0 10px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 80vh; display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 400px; }
.auth-hero { text-align: center; margin-bottom: 20px; }
.auth-hero .brand-mark { width: 56px; height: 56px; font-size: 1.3rem; margin: 0 auto 12px; border-radius: 16px; }
.tagline { letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--muted); }
.tabs { display: flex; background: var(--surface-2); border-radius: 10px; padding: 4px; margin-bottom: 8px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.form-error { color: var(--bad); font-size: .9rem; min-height: 1.3em; margin: 10px 0 0; }

/* ---------- search ---------- */
.hero-search { text-align: center; padding: 28px 0 8px; }
.hero-search p { margin: 0 0 20px; }
.searchbar { display: flex; gap: 8px; max-width: 720px; margin: 0 auto; }
.searchbar input { font-size: 1.05rem; padding: 14px 18px; border-radius: 12px; }
.searchbar .btn { padding: 0 22px; border-radius: 12px; }
.hint { margin-top: 10px; font-size: .85rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 24px; }
.pcard {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; color: var(--text); box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
a.pcard:hover { transform: translateY(-2px); text-decoration: none; }
.pcard .thumb { aspect-ratio: 1; background: #fff; display: grid; place-items: center; padding: 12px; border-bottom: 1px solid var(--border); }
.pcard .thumb img { max-height: 100%; object-fit: contain; }
.pcard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pcard .name { font-weight: 600; font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .meta { font-size: .8rem; color: var(--muted); }
.pcard .actions { display: flex; gap: 6px; margin-top: auto; padding-top: 10px; flex-wrap: wrap; align-items: center; }
.noimg { color: var(--muted); font-size: 2.5rem; }

/* ---------- product page ---------- */
.product { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
@media (max-width: 820px) { .product { grid-template-columns: 1fr; } }
.product-image { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); aspect-ratio: 1; display: grid; place-items: center; padding: 20px; }
.product-image img { max-height: 100%; object-fit: contain; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: .92rem; margin: 14px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.desc { font-size: .92rem; color: var(--muted); max-height: 7.5em; overflow: hidden; position: relative; }
.desc.open { max-height: none; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 600px) { .stats { grid-template-columns: 1fr; } }
.stat { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; }
.stat .label { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat .usd { font-size: 1.6rem; font-weight: 700; margin-top: 2px; }
.stat .sar { color: var(--muted); font-size: .9rem; }
.stat.low { background: var(--good-soft); }
.stat.low .usd { color: var(--good); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td .t { font-size: .8rem; color: var(--muted); max-width: 320px; }
tr.best td { background: var(--good-soft); }

.sources { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chart { width: 100%; height: 160px; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 2.6rem; margin-bottom: 6px; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 12px; color: var(--muted); padding: 20px 0; }

.summary-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
@media (max-width: 760px) { .summary-bar { grid-template-columns: repeat(2, 1fr); } }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.qty button { border: 0; background: var(--surface-2); color: var(--text); width: 28px; height: 28px; cursor: pointer; font-size: 1rem; }
.qty span { min-width: 28px; text-align: center; font-weight: 600; font-size: .9rem; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 10px;
  font-weight: 600; box-shadow: var(--shadow); z-index: 100; max-width: 90vw;
}
.toast.error { background: var(--bad); color: #fff; }

.notice { padding: 12px 16px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: .9rem; margin: 16px 0; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: .85em; }

dialog { border: 0; border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
.scanner-body { padding: 20px; width: min(480px, 90vw); text-align: center; }
.scanner-body video { width: 100%; border-radius: 10px; background: #000; }

/* ---------- v1.1 additions ---------- */
.stat .where { margin-top: 6px; font-size: .85rem; font-weight: 600; }
.stat.high { background: var(--bad-soft); }
.stat.high .usd { color: var(--bad); }
tr.dim td { opacity: .55; }
.market { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.market .stat { min-width: 170px; }
.card.unavail { opacity: .75; box-shadow: none; }
#username { color: var(--muted); font-weight: 600; }
details.stale { margin-top: 18px; }
details.stale summary { cursor: pointer; font-weight: 600; }
.card .notice { margin: 8px 0; }

/* ---------- v1.3: black theme details + global price UI ---------- */
html, body { background: #000000; color: var(--text); }
.topbar { background: #000000; border-bottom-color: #1f1f1f; }
.nav a { color: #d4d4d8; }
.card, .pcard { background: var(--surface); }
.pcard .thumb, .product-image { background: #ffffff; }   /* product photos stay on white so they look right */
input, select { background: #0b0b0b; color: #fff; border-color: #333; }
input::placeholder { color: #77777f; }
a { color: var(--accent); }
th { color: #c4c4cc; }
td { border-bottom-color: #1f1f1f; }
tr.best td { background: #0b2219; }
.toast { background: #ffffff; color: #000000; }
.stat { background: var(--surface-2); border: 1px solid var(--border); }
.stat .label { color: #c4c4cc; }
.stat.low { background: #0b2219; border-color: #14532d; }
.stat.high { background: #2a1010; border-color: #5b1d1d; }
.stat.total { background: #0f1b2e; border-color: #1e3a5f; }
.stat.total .usd { color: #93c5fd; }
.stat.avg { background: var(--surface-3); }
.stats.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .stats.four { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .stats.four { grid-template-columns: 1fr; } }
.counts { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.count-pill { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; font-size: .85rem; }
.count-pill strong { color: #fff; }
.badge.no_results, .badge.skipped { background: #1f1f1f; color: #d4d4d8; }
.badge.connected { background: var(--good-soft); color: var(--good); }
.badge.error { background: var(--bad-soft); color: var(--bad); }
.badge.not_configured { background: var(--warn-soft); color: var(--warn); }
.badge.disabled, .badge.no_api_access, .badge.unavailable { background: #1a1a1a; color: #8a8a93; }
.badge.untested { background: var(--accent-soft); color: var(--accent); }
.flag { display: inline-block; min-width: 26px; font-size: .75rem; font-weight: 700; color: #d4d4d8;
        background: #1f1f1f; border: 1px solid #333; border-radius: 6px; padding: 1px 6px; text-align: center; }
.price-cell .orig { color: var(--muted); font-size: .8rem; }
.ship-unknown { color: var(--muted); font-style: italic; font-size: .85rem; }
.source-table td, .source-table th { vertical-align: top; }
.source-table .src-name { font-weight: 700; color: #fff; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 6px 0 12px; }
.filters select { width: auto; padding: 6px 10px; }

/* ---------- v2: collectibles platform ---------- */
:root {
  /* Chart series colours (one per category, fixed order; validated for colour-blind separation on dark). */
  --series-1: #3987e5;   /* Funko Pops */
  --series-2: #d95926;   /* Pokémon cards */
  --series-3: #199e70;   /* F1 cards */
  --series-4: #c98500;   /* playing-card decks */
  --gain: #34d399;
  --loss: #ff6b6b;
}
.gain { color: var(--gain); }
.loss { color: var(--loss); }
textarea { font: inherit; color: #fff; background: #0b0b0b; border: 1px solid #333; border-radius: 10px; padding: 10px 14px; width: 100%; min-height: 70px; resize: vertical; }
select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }

/* nav: horizontal scroll on small screens */
.nav { overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
@media (max-width: 1100px) { .nav a { padding: 8px 10px; } }

/* section headings & panels */
.section { margin-top: 28px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.kpi .label { font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #c4c4cc; }
.kpi .big { font-size: 1.5rem; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: .85rem; }
.kpi.hero { grid-column: span 2; background: linear-gradient(135deg, #0d0d0d, #070707); border-color: color-mix(in srgb, var(--accent-base, #7c5cff) 40%, #1a1a1a); }
.kpi.hero .big { font-size: 2.1rem; }
@media (max-width: 600px) { .kpi.hero { grid-column: span 2; } }

/* category pills / tabs */
.cat-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 18px; }
.cat-tabs a, .cat-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: #e4e4e7; font: inherit; font-weight: 600; cursor: pointer; }
.cat-tabs a:hover { text-decoration: none; background: var(--surface-2); }
.cat-tabs .active { background: var(--accent-soft); border-color: #3b2f6b; color: #fff; }
.cat-tabs .n { color: var(--muted); font-weight: 600; font-size: .85rem; }
.cat-tag { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; color: #d4d4d8; }
.cat-tag::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }

/* item cards */
.igrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.icard { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; color: var(--text); transition: transform .15s, border-color .15s; }
a.icard:hover { transform: translateY(-2px); text-decoration: none; border-color: #3a3a3a; }
.icard .thumb { aspect-ratio: 1; background: #fff; display: grid; place-items: center; padding: 10px; }
.icard .thumb img { max-height: 100%; object-fit: contain; }
.icard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.icard .name { font-weight: 600; font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 4px; }
.icard .t, .t { font-size: .78rem; color: var(--muted); }
.kv2 { display: flex; justify-content: space-between; gap: 8px; font-size: .86rem; }
.kv2 span { color: var(--muted); }
.kv2 strong { font-variant-numeric: tabular-nums; text-align: right; }
.kv2 small { font-weight: 600; }
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 8px; gap: 6px; }

/* trend badges */
.trend { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: #1a1a1a; color: #c4c4cc; white-space: nowrap; }
.trend.up { background: var(--good-soft); color: var(--gain); }
.trend.down { background: var(--bad-soft); color: var(--loss); }
.trend.stable { background: #1a1a1a; color: #e4e4e7; }
.trend.none { color: #8a8a93; font-weight: 600; }

/* trust badges */
.trust { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.trust.high { color: var(--gain); }
.trust.medium { color: var(--warn); }
.trust.low { color: var(--loss); }
tr.suspicious td { background: #1a0b0b; }

/* modal */
body.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .75); z-index: 50; display: grid; place-items: start center; overflow-y: auto; padding: 4vh 12px; }
.modal { position: relative; width: min(640px, 100%); background: #0e0e0e; border: 1px solid #2c2c2c; border-radius: 16px; box-shadow: var(--shadow); }
.modal.wide { width: min(900px, 100%); }
.modal-body { padding: 22px; }
.modal-close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; color: #c4c4cc; font-size: 1.6rem; cursor: pointer; line-height: 1; }
.steps { display: flex; gap: 6px; margin-bottom: 14px; font-size: .78rem; color: var(--muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.steps span.on { color: #fff; }
.cat-pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cat-pick button { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: #fff; font: inherit; font-weight: 700; cursor: pointer; text-align: left; }
.cat-pick button:hover { border-color: var(--accent); }
.cat-pick .ico { font-size: 1.6rem; }
.pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; margin-top: 12px; }
.pick { display: flex; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; color: #fff; text-align: left; font: inherit; }
.pick:hover { border-color: var(--accent); }
.pick .pthumb { width: 54px; height: 54px; flex: none; background: #fff; border-radius: 8px; display: grid; place-items: center; overflow: hidden; }
.pick .pthumb img { max-height: 100%; object-fit: contain; }
.pick .pthumb .noimg { font-size: 1.4rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0; font-weight: 500; }
.checks input, label.inline input { width: auto; }
label.inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.paid-box { background: #0d1a12; border: 1px solid #1d4a31; border-radius: 12px; padding: 14px 16px; margin: 10px 0 4px; }
.paid-box label { margin-top: 0; font-size: 1rem; }
.paid-row { display: flex; gap: 8px; }
.paid-row input { font-size: 1.4rem; font-weight: 700; padding: 10px 14px; }
.paid-row select { width: 110px; flex: none; font-weight: 700; }
.help { font-size: .8rem; color: var(--muted); margin-top: 4px; }

/* item page */
.item-head { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
@media (max-width: 820px) { .item-head { grid-template-columns: 1fr; } }
.item-photo { background: #fff; border-radius: var(--radius); aspect-ratio: 1; display: grid; place-items: center; padding: 16px; border: 1px solid var(--border); }
.item-photo img { max-height: 100%; object-fit: contain; }
.attr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.attr-chips .badge { background: #1a1a1a; color: #e4e4e7; }
.value-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
@media (max-width: 1000px) { .value-grid { grid-template-columns: repeat(2, 1fr); } }
.value-grid .kpi .big { font-size: 1.25rem; }
.basis { font-size: .8rem; color: var(--muted); margin-top: 6px; }

/* charts */
.chart-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg .grid { stroke: #222; stroke-width: 1; }
.chart-svg .axis { fill: #a1a1aa; font-size: 12px; font-family: inherit; }
.chart-svg .xhair { stroke: #555; stroke-width: 1; }
.chart-wrap .tip { position: absolute; top: 8px; background: #161616; border: 1px solid #333; border-radius: 8px; padding: 8px 10px; font-size: .8rem; pointer-events: none; min-width: 170px; z-index: 2; }
.chart-wrap .tip i, .legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.tip-date { color: var(--muted); margin-bottom: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: #d4d4d8; margin-top: 6px; }
.chart-empty { color: var(--muted); padding: 28px 12px; text-align: center; border: 1px dashed #2c2c2c; border-radius: 12px; font-size: .9rem; }
.range-btns { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.range-btns button { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 700; font-size: .82rem; padding: 6px 10px; border-radius: 7px; cursor: pointer; }
.range-btns button.active { background: var(--surface-3); color: #fff; }
.chart-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chart-tabs button { border: 1px solid var(--border); background: transparent; color: #d4d4d8; font: inherit; font-size: .85rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.chart-tabs button.active { background: var(--surface-3); color: #fff; border-color: #444; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 1.2fr) 3fr minmax(90px, auto); gap: 10px; align-items: center; font-size: .86rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: #161616; border-radius: 4px; height: 14px; overflow: hidden; }
.bar { height: 100%; border-radius: 0 4px 4px 0; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* lists (top 10, movers) */
.mini-list { display: flex; flex-direction: column; }
.mini { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid #1f1f1f; color: #fff; }
.mini:last-child { border-bottom: 0; }
a.mini:hover { text-decoration: none; background: #0b0b0b; }
.mini .mthumb { width: 44px; height: 44px; background: #fff; border-radius: 8px; display: grid; place-items: center; overflow: hidden; }
.mini .mthumb img { max-height: 100%; object-fit: contain; }
.mini .mthumb .noimg { font-size: 1.2rem; }
.mini .nm { font-size: .9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini .rt { text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; font-weight: 700; }

/* highlight cards (most valuable / gainer / loser) */
.highlights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 760px) { .highlights { grid-template-columns: 1fr; } }

/* find / best price */
.best-deal { border: 1px solid #14532d; background: #08160f; border-radius: 14px; padding: 16px 18px; margin: 14px 0; }
.best-deal .price { font-size: 1.8rem; font-weight: 800; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
@media (max-width: 700px) { .compare { grid-template-columns: 1fr; } }
.scan-box { max-width: 560px; margin: 0 auto; text-align: center; }
.scan-box video { width: 100%; border-radius: 12px; background: #050505; min-height: 220px; }
.upload-zone { border: 1px dashed #3a3a3a; border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; display: block; font-weight: 500; }
.upload-zone:hover { border-color: var(--accent); color: #fff; }
.upload-zone input { display: none; }
.photo-preview { max-height: 140px; border-radius: 10px; margin-top: 8px; background: #fff; }
.fab { position: fixed; right: 20px; bottom: 22px; z-index: 20; border-radius: 999px; padding: 14px 20px; box-shadow: 0 8px 24px rgba(124, 92, 255, .35); }
@media (min-width: 900px) { .fab { display: none; } }
@media (max-width: 600px) {
  .kpi .big { font-size: 1.2rem; }
  .kpi.hero .big { font-size: 1.7rem; }
  .chart-wrap { overflow-x: auto; }
  .chart-svg { min-width: 560px; }
  .page-head h1 { font-size: 1.5rem; }
}

/* ---------- v2.1: exact identification + price range ---------- */
:root { --series-5: #d55181; --series-6: #8b6be0; }   /* Deadpool cards; 6 = McDonald's (slots 1-6 validated together, dark surface) */
.price-range { border: 1px solid color-mix(in srgb, var(--accent-base, #7c5cff) 40%, #1a1a1a); background: linear-gradient(135deg, #0d0d0d, #070707); border-radius: 14px; padding: 14px 16px; margin: 6px 0 14px; }
.price-range.empty-range { border-color: var(--border); background: var(--surface); }
.pr-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.pr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 640px) { .pr-grid { grid-template-columns: 1fr; } }
.pr { background: #101010; border: 1px solid #262626; border-radius: 12px; padding: 12px 14px; }
.pr .label { font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #c4c4cc; }
.pr .big { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pr .sub { color: var(--muted); font-size: .88rem; }
.pr .src { font-size: .82rem; margin-top: 6px; color: #d4d4d8; }
.pr.low .big { color: var(--gain); }
.pr.high .big { color: #ff8f8f; }
.match-group { margin-top: 14px; }
.match-group h3 { margin: 0 0 2px; font-size: 1rem; }
.match-group.exact h3 { color: var(--gain); }
.match-group.similar { opacity: .9; }
.pick-exact { border-color: #1d4a31; background: #0b1a12; }
.pick .why { color: #a1a1aa; }
.filters-panel { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 14px; }
.filters-panel select, .filters-panel input { width: auto; padding: 7px 10px; font-size: .88rem; }
.filters-panel input[type=search] { min-width: 200px; flex: 1; }
.filters-panel input[type=number] { width: 110px; }
.change-line { font-size: .92rem; margin-top: 8px; }

/* ---------- v2.2: price sources, deals, analysis ---------- */
.src-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.src-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.src-top { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.src-name { font-weight: 800; }
.src-status { font-size: .8rem; font-weight: 700; white-space: nowrap; padding: 3px 9px; border-radius: 999px; background: #1a1a1a; }
.src-status.working { background: var(--good-soft); color: var(--gain); }
.src-status.limited { background: var(--warn-soft); color: var(--warn); }
.src-status.auth_failed, .src-status.rate_limited, .src-status.unavailable { background: #2b1a08; color: #fdba74; }
.src-status.not_configured { background: var(--bad-soft); color: var(--loss); }
.src-kv { grid-template-columns: 110px 1fr; font-size: .85rem; margin: 10px 0; }
.cred-grid { display: grid; gap: 4px 12px; }
.cred label { margin: 8px 0 4px; font-size: .85rem; }
.cred input, .cred textarea { font-size: .88rem; padding: 8px 10px; }
.deal-box { border-radius: 14px; padding: 14px 16px; margin: 10px 0; border: 1px solid var(--border); background: var(--surface); }
.deal-box.great, .deal-box.good, .deal-box.BUY { border-color: #1d4a31; background: #0b1a12; }
.deal-box.fair, .deal-box.CONSIDER { border-color: #5c4710; background: #1a1508; }
.deal-box.expensive, .deal-box.very_expensive, .deal-box.WAIT, .deal-box.OVERPRICED { border-color: #5b1d1d; background: #1a0b0b; }
.deal-head { font-size: 1.35rem; font-weight: 800; }
.score-ring { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-weight: 800; font-size: 1.2rem;
  background: conic-gradient(var(--gain) calc(var(--s) * 1%), #262626 0); position: relative; }
.score-ring::after { content: ""; position: absolute; inset: 6px; background: #0e0e0e; border-radius: 50%; }
.score-ring span { position: relative; z-index: 1; }
.factor-list { margin: 8px 0 0; padding-left: 18px; font-size: .86rem; }
.analysis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700;
  background: #1e1b33; color: #c4b5fd; border: 1px solid #2d2257; }
.tag button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 0 0 2px; }
.bell { position: relative; background: transparent; border: 1px solid var(--border); color: #fff; border-radius: 999px; padding: 6px 10px; cursor: pointer; }
.bell .dot { position: absolute; top: -4px; right: -4px; background: var(--accent-2); color: #fff; font-size: .7rem; border-radius: 999px; padding: 1px 6px; }
.progress-list { list-style: none; padding: 0; margin: 10px 0; font-size: .9rem; }
.progress-list li { padding: 3px 0; }
.progress-list .grp { color: var(--muted); font-weight: 700; margin-top: 6px; }
.set-head { margin: 12px 0 4px; font-size: .82rem; font-weight: 800; color: #c4c4cc; letter-spacing: .03em; }
.version-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; margin-top: 10px; }
.version-list button { text-align: left; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: #fff; font: inherit; cursor: pointer; }
.version-list button:hover { border-color: var(--accent); }
.ship-yes { color: var(--gain); } .ship-no { color: var(--loss); } .ship-unk { color: var(--muted); }

/* ---------- v2.3: deals feed ---------- */
.deal-summary { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 14px; }
@media (max-width: 1100px) { .deal-summary { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .deal-summary { grid-template-columns: repeat(2, 1fr); } }
.sum-card { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
  color: #fff; font: inherit; cursor: pointer; min-width: 0; }
.sum-card.active, .sum-card:hover { border-color: var(--accent); }
.sum-card .label { font-size: .74rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #c4c4cc; }
.sum-card .nm { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
.deal-card .deal-price { font-size: 1.3rem; font-weight: 800; margin: 2px 0; }
.deal-card .deal-price s { font-weight: 500; margin-left: 4px; }

/* v3.8.3 — safe "Check saved key" result under a source card */
.key-diag { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); }
.key-diag .kv { margin: 0; }

/* 4.3 — sign-up requests and the admin page */
.form-ok { color: var(--good); font-size: .9rem; margin: 10px 0 0; }
.adm-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.adm-user .adm-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.adm-user .t { font-size: .85rem; color: var(--muted, inherit); margin-top: 4px; overflow-wrap: anywhere; }
.adm-actions { gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.adm-actions .btn { min-height: 40px; }
