/* Dashboard (/stores/): Robinhood-style market view. Loaded after stores.css. */
:root {
  --bg: #ffffff;
  --bg-2: #f6f5f9;
  --card: #ffffff;
  --line: #ebe8f1;
  --line-2: #d9d4e4;
  --ink: #141021;
  --ink-2: #3f3952;
  --muted: #7a7489;
  --paper: #ffffff;
  --paper-2: #f6f5f9;
  --up: #12a33c;
  --up-soft: #e6f6ea;
  --down: #e5471d;
  --down-soft: #fdeae4;
  --flat-soft: #ecebf1;
  --brand-soft: #efe7fc;
  --shadow: 0 1px 2px rgba(20, 16, 33, 0.05), 0 8px 24px rgba(20, 16, 33, 0.06);
  --dash-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
html[data-theme="dark"] {
  --bg: #0d0b14;
  --bg-2: #15121f;
  --card: #15121f;
  --line: #24202f;
  --line-2: #342f42;
  --ink: #f4f2f8;
  --ink-2: #c9c4d6;
  --muted: #8b85a0;
  --paper: #0d0b14;
  --paper-2: #15121f;
  --up: #00c805;
  --up-soft: rgba(0, 200, 5, 0.14);
  --down: #ff5a2c;
  --down-soft: rgba(255, 90, 44, 0.16);
  --flat-soft: #24202f;
  --brand: #a77cf0;
  --brand-deep: #c4a3f6;
  --brand-soft: rgba(167, 124, 240, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
html[data-theme="dark"] .btn { background: #8a4df0; border-color: #8a4df0; color: #fff; }
html[data-theme="dark"] .btn:hover { background: #9c67f5; }

body.dash { background: var(--bg); color: var(--ink-2); font-family: var(--dash-sans); font-size: 1rem; }
body.dash main { padding: 1.5rem 0 4rem; }
body.dash .wrap { max-width: 1120px; }
body.dash h1, body.dash h2, body.dash h3 { font-family: var(--dash-sans); font-weight: 650; letter-spacing: -0.02em; color: var(--ink); font-variation-settings: normal; }
body.dash .site-header { background: var(--bg); border-color: var(--line); }
body.dash .site-footer { border-color: var(--line); }
body.dash .crumbs { margin: 0; }

.dash-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.theme { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; }
.theme:hover { color: var(--ink); border-color: var(--muted); }
.theme .moon { display: none; }
html[data-theme="dark"] .theme .sun { display: none; }
html[data-theme="dark"] .theme .moon { display: block; }

.dash-title { font-size: clamp(1.6rem, 3.2vw, 2rem); line-height: 1.1; margin: 0; }
.dash-asof { margin: 0.3rem 0 1.5rem; color: var(--muted); font-size: 0.9rem; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 2rem; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--card); text-decoration: none; color: var(--muted); font-size: 0.82rem; font-weight: 500; transition: border-color 0.15s, box-shadow 0.15s; }
.stat b { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.03em; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat:hover { border-color: var(--line-2); box-shadow: var(--shadow); color: var(--ink-2); }
.stat.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.stat[data-filter="up"] b, .stat[data-filter="high"] b { color: var(--up); }
.stat[data-filter="down"] b { color: var(--down); }

/* movers */
.strip { margin: 0 0 2rem; }
.strip-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.75rem; margin-bottom: 0.75rem; }
.strip-head h2 { font-size: 1.2rem; margin: 0; white-space: nowrap; }
.strip-head span { color: var(--muted); font-size: 0.88rem; }
.scroller { display: flex; gap: 0.6rem; overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 2px 0.6rem; margin: -2px -2px 0; scrollbar-width: none; }
/* Auto-scrolling strips move by fractions of a pixel, which scroll snapping would fight. */
.scroller.auto { scroll-snap-type: none; }
.scroller::-webkit-scrollbar { display: none; }
.mover { flex: 0 0 150px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 0.15rem; padding: 0.9rem 0.9rem 0.85rem; border: 1px solid var(--line); border-radius: 14px; background: var(--card); text-decoration: none; color: var(--ink); transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.mover:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); color: var(--ink); }
.mover .logo { margin-bottom: 0.5rem; }
.m-name { font-weight: 650; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-cat { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-rate { font-size: 1.35rem; font-weight: 650; letter-spacing: -0.03em; margin-top: 0.35rem; font-variant-numeric: tabular-nums; }
.mover .pill, .mover .ends { align-self: flex-start; margin-top: 0.3rem; }

.logo { width: 40px; height: 40px; border-radius: 10px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; }
.logo img { width: 100%; height: 100%; object-fit: contain; }

.pill { display: inline-block; font-size: 0.8rem; font-weight: 700; line-height: 1; padding: 0.35rem 0.55rem; border-radius: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill.up { background: var(--up); color: #fff; }
.pill.hot { background: var(--up); box-shadow: 0 0 0 2px var(--up-soft); }
.pill.down { background: var(--down); color: #fff; }
.pill.flat { background: var(--flat-soft); color: var(--muted); }
.pill.new { background: var(--brand-soft); color: var(--brand); }
.ends { display: inline-block; font-size: 0.76rem; font-weight: 600; color: #b26a00; white-space: nowrap; }
html[data-theme="dark"] .ends { color: #f2b544; }

/* list */
.list-section { margin-top: 0.5rem; }
.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.list-head h2 { font-size: 1.2rem; margin: 0; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.search { display: flex; align-items: center; gap: 0.4rem; background: var(--bg-2); border: 1px solid transparent; border-radius: 999px; padding: 0 0.85rem; height: 38px; color: var(--muted); flex: 1 1 180px; min-width: 160px; }
.search:focus-within { border-color: var(--brand); background: var(--card); }
.search input { border: 0; background: transparent; font: inherit; font-size: 0.95rem; color: var(--ink); width: 100%; min-width: 0; outline: none; }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
#sort { font: inherit; font-size: 0.88rem; font-weight: 600; height: 38px; padding: 0 2rem 0 0.85rem; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a7489' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.7rem center / 14px; color: var(--ink); appearance: none; -webkit-appearance: none; cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; background: var(--card); height: 38px; }
.seg button { font: inherit; font-size: 0.88rem; font-weight: 600; padding: 0 0.85rem; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--ink); color: var(--bg); }
.switch { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; font-weight: 600; color: var(--ink-2); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative; transition: background 0.15s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.switch input:checked + .track { background: var(--up); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }

.chips { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.75rem; margin-bottom: 0.25rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; font: inherit; font-size: 0.85rem; font-weight: 600; padding: 0.4rem 0.85rem; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); cursor: pointer; }
.chip:hover { border-color: var(--muted); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.list { border-top: 1px solid var(--line); }
.cols, .trow { display: grid; grid-template-columns: 40px minmax(0, 1fr) 72px auto; gap: 0 0.75rem; align-items: center; }
.cols { display: none; }
.trow { padding: 0.7rem 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: background 0.1s; }
.trow:hover { background: var(--bg-2); color: var(--ink); }
.trow .who { display: flex; flex-direction: column; min-width: 0; }
.trow .name { font-weight: 650; font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .sub { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .spark svg { display: block; width: 72px; height: 24px; }
.trow .logo { grid-row: 1; grid-column: 1; }
.trow .who { grid-row: 1; grid-column: 2; }
.trow .spark { grid-row: 1; grid-column: 3; }
.trow .val { grid-row: 1; grid-column: 4; }
.trow .sites { grid-row: 2; grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }
.trow .sites:empty { display: none; }
.trow .site { display: inline-flex; align-items: baseline; gap: 0.3rem; font-size: 0.72rem; line-height: 1.2; padding: 0.2rem 0.5rem; border-radius: 6px; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.trow .site i { font-style: normal; font-weight: 600; color: var(--muted); }
.trow .site b { font-weight: 700; font-variant-numeric: tabular-nums; }
.trow .site.is-best { background: var(--up-soft); color: var(--up); }
.trow .site.is-best i { color: var(--up); }
.trow .site.none { display: none; }
.trow .val { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; text-align: right; }
.trow .rate { font-size: 1.1rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.trow .note { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.trow .note:empty { display: none; }
.empty { padding: 2rem 1rem; margin: 0; color: var(--muted); text-align: center; }

@media (min-width: 900px) {
  .cols, .trow { grid-template-columns: 40px minmax(0, 1fr) 96px repeat(4, 88px) 160px; gap: 0 0.6rem; }
  .cols { display: grid; padding: 0.5rem 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
  .cols .c-store { grid-column: 1 / 3; }
  .cols .c-val { text-align: right; }
  .cols .sortable { cursor: pointer; user-select: none; }
  .cols .sortable:hover { color: var(--ink); }
  .cols .sortable.active::after { content: " ▲"; font-size: 0.6rem; }
  .cols .sortable.active.desc::after { content: " ▼"; }
  .trow { padding: 0.75rem 0.25rem; border-radius: 10px; }
  .trow .spark svg { width: 100px; height: 28px; }
  .trow .logo, .trow .who, .trow .spark, .trow .val { grid-row: auto; grid-column: auto; }
  .trow .sites { display: contents; }
  .trow .site { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.05rem; padding: 0.35rem 0.55rem; border-radius: 8px; background: transparent; font-size: 0.95rem; white-space: nowrap; }
  .trow .site i { font-size: 0.6rem; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 700; }
  .trow .site b { font-weight: 600; color: var(--ink); }
  .trow .site.none { display: flex; }
  .trow .site.none b { color: var(--line-2); font-weight: 400; }
  .trow .site.is-best { background: var(--up-soft); }
  .trow .site.is-best b { color: var(--up); font-weight: 700; }
  .cols .c-site { text-align: center; }
  .trow .val { flex-direction: row; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; }
  .trow .val .note { flex-basis: 100%; }
  .trow .rate { font-size: 1.15rem; }
}

.dash-note { font-size: 0.85rem; color: var(--muted); margin-top: 1.25rem; max-width: 64rem; line-height: 1.55; }
body.dash .cta { margin-top: 2.5rem; }
body.dash .cta h2 { color: #fff; }
@media (min-width: 1040px) {
  .cols, .trow { grid-template-columns: 40px minmax(0, 1fr) 120px repeat(4, 96px) 170px; gap: 0 0.85rem; }
  .trow .spark svg { width: 120px; }
}

/* store page */
.sp-head { display: flex; align-items: center; gap: 1rem; margin: 0 0 0.75rem; }
.sp-head .logo { width: 56px; height: 56px; border-radius: 14px; }
.sp-head h1 { font-size: clamp(1.6rem, 3.2vw, 2rem); line-height: 1.1; margin: 0; }
.sp-meta { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.9rem; }
.sp-lede { margin: 0 0 1.25rem; color: var(--ink-2); max-width: 44rem; }
.sp-lede strong { color: var(--ink); font-weight: 650; }
body.store .chips { margin-bottom: 1rem; }
body.store .panel { display: grid; grid-template-areas: none; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; margin-bottom: 1.5rem; }
body.store .panel[hidden] { display: none; }
.sp-main, .sp-side { min-width: 0; }
.sp-side h2 { font-size: 1.1rem; margin: 0 0 0.6rem; }

.sp-hero { padding: 0.25rem 0 0; }
.sp-label { margin: 0; font-size: 0.95rem; font-weight: 500; color: var(--ink); display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.sp-best { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--up); background: var(--up-soft); border-radius: 999px; padding: 0.15rem 0.5rem; }
.sp-value { margin: 0.2rem 0 0; font-size: clamp(2.6rem, 6vw, 3.6rem); font-weight: 650; letter-spacing: -0.04em; line-height: 1.05; color: var(--ink); font-variant-numeric: tabular-nums; }
.sp-change { margin: 0.35rem 0 0; font-size: 0.98rem; font-weight: 600; display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.sp-change .arrow { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; }
.sp-hero.up .sp-change { color: var(--up); }
.sp-hero.up .arrow { border-bottom: 9px solid var(--up); }
.sp-hero.down .sp-change { color: var(--down); }
.sp-hero.down .arrow { border-top: 9px solid var(--down); }
.sp-hero.flat .sp-change { color: var(--muted); }
.sp-hero.flat .arrow { display: none; }
.sp-chart { margin-top: 1rem; height: 220px; touch-action: pan-y; cursor: crosshair; }
.sp-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.sp-line { stroke: var(--up); transition: stroke 0.2s; }
.sp-hero.down .sp-line { stroke: var(--down); }
.sp-base { stroke: var(--line-2); stroke-dasharray: 2 6; stroke-width: 1.5; }
.sp-cursor { stroke: var(--muted); stroke-width: 1; display: none; }
.sp-dot { fill: var(--up); stroke: var(--bg); stroke-width: 3; display: none; }
.sp-hero.down .sp-dot { fill: var(--down); }
.sp-cursor.show, .sp-dot.show { display: block; }
.sp-axis { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; margin-top: 0.35rem; font-size: 0.74rem; color: var(--muted); }
.sp-legend { text-align: center; flex: 1; }
/* range pills (shared) */
.ranges { display: flex; gap: 0.25rem; margin-top: 0.5rem; border-bottom: 1px solid var(--line); padding-bottom: 0.5rem; }
.ranges button { font: inherit; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.02em; padding: 0.3rem 0.75rem; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.ranges button:hover { color: var(--ink); }
.ranges button.active { color: var(--up); background: var(--up-soft); }
.sp-hero.down .ranges button.active { color: var(--down); background: var(--down-soft); }

.prows { display: flex; flex-direction: column; gap: 0.5rem; }
.prow { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; align-items: center; gap: 0 0.7rem; padding: 0.8rem 0.9rem; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); transition: border-color 0.15s, box-shadow 0.15s; }
.prow[role=button] { cursor: pointer; }
.prow[role=button]:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.prow.charted { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.prow.best { background: var(--up-soft); border-color: transparent; }
.prow.best.charted { border-color: var(--up); box-shadow: none; }
.prow.none { opacity: 0.6; }
.pdot { width: 10px; height: 10px; border-radius: 50%; }
.pwho { display: flex; flex-direction: column; min-width: 0; }
.sp-pname { font-weight: 650; font-size: 0.95rem; display: flex; align-items: center; gap: 0.4rem; }
.sp-pbest { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--up); background: var(--bg); border-radius: 999px; padding: 0.1rem 0.4rem; }
.pterm { font-size: 0.76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pval { display: flex; flex-direction: column; align-items: flex-end; gap: 0.1rem; }
.punit { font-size: 0.72rem; color: var(--muted); }
.sp-rate { font-size: 1.2rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prow.best .sp-rate { color: var(--up); }
.prow.none .sp-rate { font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.sp-link { font-size: 0.85rem; font-weight: 700; text-decoration: none; color: var(--brand); padding: 0.35rem 0.6rem; border-radius: 8px; background: var(--brand-soft); white-space: nowrap; }
.sp-link:hover { color: var(--brand-deep); }

.sp-card { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 1rem 1.1rem; margin-top: 0.75rem; font-size: 0.95rem; }
.sp-card .ihead { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand); margin-bottom: 0.35rem; }
.sp-card.insight p { margin: 0; color: var(--ink); font-weight: 500; }
.sp-card.insight .isub { margin-top: 0.35rem; color: var(--muted); font-weight: 400; font-size: 0.9rem; }
.sp-card.terms h3 { font-size: 0.95rem; margin: 0 0 0.35rem; }
.sp-card.terms ul { margin: 0; padding-left: 1.1rem; color: var(--ink-2); }
.sp-card.terms li { margin: 0.2rem 0; }
body.store .join { font-size: 0.88rem; color: var(--muted); margin: 0 0 2rem; }
.rel-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.rel-grid .mover { flex: none; }
@media (min-width: 720px) { .rel-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 960px) {
  body.store .panel { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 2.5rem; align-items: start; }
  .sp-head { margin-bottom: 0.5rem; }
}

/* store page prose: explainer + FAQ */
.sp-explain, .sp-faq { max-width: 44rem; margin: 2.25rem 0 0; }
.sp-explain h2, .sp-faq h2 { font-size: 1.2rem; margin: 0 0 0.6rem; }
.sp-explain p { margin: 0 0 0.9rem; color: var(--ink-2); }
.sp-faq .qa { border-top: 1px solid var(--line); padding: 0.85rem 0; }
.sp-faq .qa:last-child { border-bottom: 1px solid var(--line); }
.sp-faq h3 { font-size: 1rem; margin: 0 0 0.3rem; color: var(--ink); }
.sp-faq p { margin: 0; color: var(--ink-2); font-size: 0.95rem; }
.sp-faq + .strip { margin-top: 2rem; }
