/*
  Dashboard theme: DESIGN-STANDARDS.md (Product repo). Dark is the default and the one used on video.
  :root holds every colour, font and radius; components use only var(--cf-*). The MudBlazor theme (Phase 3 interactive pages,
  ADR-0008) must reuse these values.
*/
:root {
    --cf-bg: #0A0B0D;
    --cf-rail: #0D0F12;
    --cf-surface: #111317;
    --cf-surface-2: #171A1F;
    --cf-surface-3: #1B1F25;
    --cf-raised: #252A32;
    --cf-border: #1C2026;
    --cf-border-2: #22262D;
    --cf-grid: #1A1E24;
    --cf-text: #F2F4F7;
    --cf-text-2: #B3B9C2;
    --cf-muted: #8A919C;
    --cf-faint: #6F7680;
    --cf-ref: #5A616C;
    --cf-accent: #34D399;
    --cf-accent-soft: #15201B;
    --cf-on-accent: #0A0B0D;
    --cf-up: #34D399;
    --cf-up-soft: #0F2A20;
    --cf-down: #FF7A66;
    --cf-down-soft: #2E1512;
    --cf-warn: #F5B544;
    --cf-warn-soft: #2E2410;
    --cf-mythic: #C4B5FD;
    --cf-mythic-soft: #2A2140;
    --cf-radius: 14px;
    --cf-radius-sm: 8px;
    --cf-font: Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: var(--cf-font);
    font-feature-settings: "tnum" 1;
    color: var(--cf-text);
    background: var(--cf-bg);
    line-height: 1.45;
    font-size: 14px;
}

a { color: var(--cf-text); text-decoration: none; }
a:hover { color: #FFFFFF; }
h1:focus { outline: none; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 14px; font-weight: 600; margin: 0; }
.muted { color: var(--cf-muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.up { color: var(--cf-up); }
.down { color: var(--cf-down); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.strong { font-weight: 600; }
:focus-visible { outline: 2px solid var(--cf-accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- App shell: rail (grouped nav) + top bar + content grid ---------- */
.app { min-height: 100vh; display: flex; }
.rail {
    flex: 0 0 216px; min-height: 100vh; position: sticky; top: 0; align-self: flex-start; height: 100vh;
    background: var(--cf-rail); border-right: 1px solid var(--cf-border); display: flex; flex-direction: column; padding: 14px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px; font-weight: 700; font-size: 15px; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.rail nav { display: flex; flex-direction: column; gap: 18px; margin-top: 18px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { margin: 0 0 4px; padding: 0 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--cf-faint); }
.nav-item {
    position: relative; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--cf-radius-sm);
    color: var(--cf-text-2); font-size: 13px; font-weight: 500;
}
.nav-item svg { width: 16px; height: 16px; flex: none; }
.nav-item:hover { background: var(--cf-surface-2); color: var(--cf-text); }
.nav-item.active { background: var(--cf-accent-soft); color: var(--cf-accent); font-weight: 600; }
.nav-item.active::before {
    content: ""; position: absolute; left: -10px; top: 7px; width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--cf-accent);
}
.nav-item.soon { cursor: default; opacity: 0.6; }
.nav-item.soon:hover { background: transparent; color: var(--cf-text-2); }
.badge { margin-left: auto; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--cf-surface-3); color: var(--cf-muted); }
.rail-foot { margin-top: auto; padding: 10px 8px 2px; border-top: 1px solid var(--cf-border); font-size: 11px; color: var(--cf-faint); line-height: 1.5; }

.main-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 10; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 20px;
    background: color-mix(in srgb, var(--cf-bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--cf-border);
}
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--cf-muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a { color: var(--cf-muted); }
.crumbs a:hover { color: var(--cf-text); }
.crumbs .current { color: var(--cf-text); }
.topbar .search { flex: 1 1 280px; max-width: 520px; margin: 0 auto; }
.asof { font-size: 12px; color: var(--cf-muted); white-space: nowrap; }
.content { padding: 16px 20px 24px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-content: start; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.site-footer { padding: 0 20px 20px; font-size: 12px; color: var(--cf-faint); }

/* ---------- Search (plain GET form, works without JS) ---------- */
.search {
    display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px 0 12px; border-radius: 9px;
    background: var(--cf-surface); border: 1px solid var(--cf-border-2); color: var(--cf-muted);
}
.search:focus-within { border-color: var(--cf-accent); }
.search svg { width: 15px; height: 15px; flex: none; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font: inherit; font-size: 13px; color: var(--cf-text); }
.search input::placeholder { color: var(--cf-muted); }
.search button { height: 26px; padding: 0 10px; border: 0; border-radius: 6px; background: var(--cf-surface-3); color: var(--cf-text-2); font: 600 12px var(--cf-font); cursor: pointer; }
.search button:hover { background: var(--cf-raised); color: var(--cf-text); }
.search.large { height: 46px; font-size: 15px; }

/* ---------- Cards, headers, segmented controls ---------- */
.card { background: var(--cf-surface); border: 1px solid var(--cf-border); border-radius: var(--cf-radius); padding: 14px 16px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head .sub { font-size: 12px; color: var(--cf-muted); }
.card-head .end { margin-left: auto; }
.link-accent { font-size: 12px; font-weight: 600; color: var(--cf-accent); }
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: var(--cf-surface-2); border-radius: var(--cf-radius-sm); }
.segmented a { height: 26px; padding: 0 10px; border-radius: 6px; display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; color: var(--cf-muted); }
.segmented a:hover { color: var(--cf-text); }
.segmented a.active { background: var(--cf-raised); color: var(--cf-text); }
.page-head { grid-column: span 12; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .lead { margin: 2px 0 0; color: var(--cf-muted); font-size: 13px; }

/* ---------- KPI tiles ---------- */
.kpi { display: flex; align-items: center; gap: 12px; }
.kpi-body { flex: 1; min-width: 0; }
.kpi h2 { font-size: 12px; font-weight: 500; color: var(--cf-muted); }
.kpi-value { margin: 6px 0 2px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-note { margin: 0; font-size: 12px; color: var(--cf-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-note strong { font-weight: 600; }

/* ---------- Lists (movers) ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 8px; margin: 0 -8px; border-radius: var(--cf-radius-sm); }
.list-row:hover { background: var(--cf-surface-2); color: var(--cf-text); }
.list-rank { width: 18px; flex: none; font-size: 11px; font-weight: 600; color: var(--cf-faint); text-align: right; }
.list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.list-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { font-size: 11px; color: var(--cf-muted); }
.chip { min-width: 70px; padding: 4px 0; border-radius: 6px; text-align: center; font-size: 12px; font-weight: 700; }
.chip.up { background: var(--cf-up-soft); color: var(--cf-up); }
.chip.down { background: var(--cf-down-soft); color: var(--cf-down); }
.empty { color: var(--cf-muted); font-size: 13px; padding: 8px 0; margin: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
    padding: 8px; text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--cf-muted);
}
table.data th.sortable { padding: 0; }
table.data th.sortable a {
    display: inline-flex; align-items: center; gap: 4px; padding: 8px; min-height: 32px; color: inherit; text-decoration: none; border-radius: 6px;
}
table.data th.num.sortable { text-align: right; }
table.data th.sortable a:hover, table.data th.sortable a:focus-visible { color: var(--cf-text); background: var(--cf-surface-2); }
table.data th.sortable a.sorted { color: var(--cf-text); }
table.data th.sortable .arrow { font-size: 9px; opacity: 0.5; }
table.data th.sortable a.sorted .arrow { opacity: 1; color: var(--cf-accent); }
table.data td { padding: 9px 8px; border-top: 1px solid var(--cf-border); vertical-align: middle; }
table.data tbody tr:hover { background: var(--cf-surface-2); }
.product-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.product-cell .name { font-weight: 600; }
.product-cell .meta { display: block; font-size: 11px; color: var(--cf-muted); }
img.thumb { width: 34px; height: 34px; flex: none; object-fit: contain; border-radius: 6px; background: var(--cf-surface-2); }
.thumb-empty { width: 34px; height: 34px; flex: none; border-radius: 6px; background: var(--cf-surface-2); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; background: var(--cf-accent-soft); color: var(--cf-accent); }
.tag.warn { background: var(--cf-warn-soft); color: var(--cf-warn); }
.pager { display: flex; justify-content: flex-end; margin-top: 10px; }

/* ---------- Buttons ---------- */
.button {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--cf-radius-sm); border: 0;
    background: var(--cf-accent); color: var(--cf-on-accent); font: 700 13px var(--cf-font); cursor: pointer; white-space: nowrap;
}
.button:hover { color: var(--cf-on-accent); filter: brightness(1.08); }
.button.secondary { background: var(--cf-surface-3); color: var(--cf-text); }
.button.secondary:hover { color: var(--cf-text); background: var(--cf-raised); }
.button.small { height: 32px; padding: 0 12px; font-size: 12px; }

/* Top-bar account: avatar initial + name + Sign out, or a Sign in button. Name hides on phones to keep the bar one row. */
.account { display: flex; align-items: center; gap: 10px; margin: 0; flex: none; }
.account-avatar {
    width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 700 13px var(--cf-font);
    background: var(--cf-accent-soft); color: var(--cf-accent);
}
.account-name { font-size: 13px; color: var(--cf-text-2); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Product page ---------- */
.product-head { grid-column: span 12; display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
img.product-image { width: 112px; height: 112px; flex: none; object-fit: contain; border-radius: 12px; background: var(--cf-surface-2); }
.product-title { flex: 1 1 320px; min-width: 0; }
.product-title .tags { display: flex; gap: 6px; margin: 0 0 8px; }
.product-title h1 { font-size: 24px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 0; font-size: 13px; color: var(--cf-muted); }
.quote-box { flex: 0 1 auto; text-align: right; }
.quote { margin: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.quote-price { font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.quote-change { font-size: 14px; font-weight: 600; }
.quote-note { margin: 4px 0 0; font-size: 12px; color: var(--cf-muted); }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.stats { grid-column: span 12; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0; }
.stats > div { background: var(--cf-surface); border: 1px solid var(--cf-border); border-radius: var(--cf-radius); padding: 14px 16px; }
.stats dt { font-size: 12px; font-weight: 500; color: var(--cf-muted); }
.stats dd { margin: 6px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.stats dd small { font-size: 12px; font-weight: 600; margin-left: 4px; }

/* ---------- Chart: y ticks + x dates in HTML, line/area/baseline in a stretched SVG ---------- */
.chart { margin: 0; --cf-line: var(--cf-accent); }
.chart.up { --cf-line: var(--cf-up); }
.chart.down { --cf-line: var(--cf-down); }
.chart-body { display: flex; gap: 8px; margin-top: 8px; }
.chart-y { list-style: none; margin: 0; padding: 0; position: relative; width: 52px; flex: none; font-size: 11px; color: var(--cf-muted); text-align: right; }
.chart-y li { position: absolute; right: 0; transform: translateY(-50%); }
.chart-plot { flex: 1; min-width: 0; }
.chart-area { position: relative; }
.chart svg { width: 100%; height: 280px; display: block; overflow: visible; }
.chart .grid { stroke: var(--cf-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .fill { fill: url(#cf-area); }
.chart .stop { stop-color: var(--cf-line); }
.chart .series { fill: none; stroke: var(--cf-line); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart .baseline { stroke: var(--cf-ref); stroke-width: 1.5; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.chart .release { stroke: var(--cf-warn); stroke-width: 1.5; stroke-dasharray: 2 4; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--cf-line); fill-opacity: 0.08; }
/* Scripted hover (wwwroot/chart.js adds .live): crosshair, dot on the line and a tip card; the end dot fades while hovering.
   touch-action pan-y: a sideways drag scrubs the chart on phones, a vertical one still scrolls the page. */
.chart.live .chart-area { touch-action: pan-y; cursor: crosshair; }
.chart.live .hit:hover { fill: transparent; }
.chart.hovering .chart-dot { opacity: 0.25; }
.chart-cross { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--cf-muted); pointer-events: none; }
.chart-hover-dot {
    position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--cf-line);
    box-shadow: 0 0 0 4px var(--cf-bg), 0 0 0 7px color-mix(in srgb, var(--cf-line) 35%, transparent); pointer-events: none;
}
.chart-tip {
    position: absolute; top: 4px; display: flex; flex-direction: column; gap: 2px; padding: 8px 12px;
    min-width: 140px; border-radius: var(--cf-radius-sm); background: var(--cf-raised); border: 1px solid var(--cf-border);
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.45); white-space: nowrap; pointer-events: none; z-index: 2; color: var(--cf-text);
}
.chart-tip .tip-date { font-size: 11px; color: var(--cf-muted); }
.chart-tip .tip-value { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.chart-tip .tip-basis { font-size: 12px; color: var(--cf-muted); }
.chart-tip .tip-change { font-size: 12px; font-weight: 600; color: var(--cf-muted); }
.chart-tip .tip-change.up { color: var(--cf-up); }
.chart-tip .tip-change.down { color: var(--cf-down); }
/* Value tile note while hovering the chart (gain vs cost): .kpi-note is muted, so the trend needs the more specific rule. */
.kpi-note.up { color: var(--cf-up); }
.kpi-note.down { color: var(--cf-down); }
[hidden] { display: none !important; }
.chart-dot {
    position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--cf-bg);
    border: 3px solid var(--cf-line); pointer-events: none;
}
/* Release-date label: pinned to the top of its line, flipped to the line's left past the midpoint so it never leaves the card. */
.chart-event {
    position: absolute; top: 0; margin-left: 6px; padding: 2px 6px; border-radius: 999px; font-size: 11px; font-weight: 600;
    color: var(--cf-warn); background: var(--cf-warn-soft); white-space: nowrap; pointer-events: none;
}
.chart-event.end { transform: translateX(-100%); margin-left: -6px; }
/* Curated lists (FEAT-0004): days cards joined a list. Violet, so they never read as up, down or release (amber). Labels stack in 3 rows
   so neighbouring joins don't overlap. */
.chart .join { stroke: var(--cf-mythic); stroke-width: 1.5; stroke-dasharray: 2 4; stroke-linecap: round; vector-effect: non-scaling-stroke; opacity: 0.8; }
.chart-event.join { color: var(--cf-mythic); background: var(--cf-mythic-soft); max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.chart-event.join.row-1 { top: 24px; }
.chart-event.join.row-2 { top: 48px; }
.chart-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.table-scroll { overflow-x: auto; }
.chart .release-note { color: var(--cf-warn); }
.chart-x { list-style: none; margin: 6px 0 0; padding: 0; position: relative; height: 16px; font-size: 11px; color: var(--cf-muted); }
.chart-x li { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.chart-x li:first-child { transform: none; }
.chart-x li:last-child { transform: translateX(-100%); }
.chart figcaption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--cf-border); font-size: 12px; color: var(--cf-muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--cf-text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--cf-accent); }
.legend i.release { width: 0; height: 12px; border-radius: 0; border-left: 2px dotted var(--cf-warn); background: none; }
.legend i.dash { width: 12px; height: 0; border-radius: 0; border-top: 2px dashed var(--cf-ref); background: none; }

/* ---------- Notices ---------- */
.notice { grid-column: span 12; padding: 14px 16px; border-radius: var(--cf-radius); background: var(--cf-warn-soft); border: 1px solid #5C4A1A; color: var(--cf-text); }
.attribution { grid-column: span 12; margin: 0; color: var(--cf-faint); font-size: 12px; }
.attribution a { color: var(--cf-muted); text-decoration: underline; }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; width: 100%; padding: 0.6rem 1.25rem; background: var(--cf-warn-soft); color: var(--cf-text);
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ---------- Responsive: rail becomes a top strip; cards stack ---------- */
@media (max-width: 1100px) {
    .span-3 { grid-column: span 6; }
    .span-4, .span-8 { grid-column: span 12; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .app { flex-direction: column; }
    .rail { position: static; height: auto; min-height: 0; flex: none; flex-direction: row; align-items: center; gap: 8px; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--cf-border); overflow-x: auto; width: 100%; max-width: 100vw; box-sizing: border-box; }
    .rail nav { flex-direction: row; margin: 0; gap: 4px; }
    .nav-group { flex-direction: row; gap: 4px; }
    .nav-label, .rail-foot, .nav-item.soon { display: none; }
    .nav-item.active::before { display: none; }
    .brand span { display: none; }
    .topbar { position: static; flex-wrap: wrap; height: auto; padding: 10px 12px; }
    .topbar .search { order: 3; flex-basis: 100%; max-width: none; }
    .account-name { display: none; }
    .content { padding: 12px; gap: 12px; }
    .span-3, .span-6 { grid-column: span 12; }
    .quote-box { text-align: left; }
    .quote { align-items: flex-start; }
    .actions { justify-content: flex-start; }
    .quote-price { font-size: 32px; }
    .chart svg { height: 220px; }
}

/* Printing switch (Normal | Foil …) above the price: the page's price, tiles and chart follow it. */
.printing-switch { margin-bottom: 10px; }
.printing-switch a { height: 30px; gap: 6px; font-size: 13px; }
.printing-switch a .muted { font-weight: 500; font-size: 12px; }
.printing-switch a.active .muted { color: var(--cf-text-2); }

/* Whole-row / whole-tile click without JavaScript: one real <a class="stretched"> per row or tile; its ::after covers the row.
   Example: clicking anywhere on the Foil row of the Printings table charts Foil. */
tr.row-link, .card.clickable { position: relative; }
tr.row-link { cursor: pointer; }
a.stretched::after { content: ""; position: absolute; inset: 0; }
tr.row-link.selected { background: var(--cf-accent-soft); }
tr.row-link:hover td { color: var(--cf-text); }
.card.clickable:hover { border-color: var(--cf-border-2); background: var(--cf-surface-2); }
.card.clickable .kpi-note a { color: var(--cf-muted); }
.card.clickable:hover .kpi-note a { color: var(--cf-text); }
.tag-gap { margin-left: 6px; }

/* ---------- Portfolio (P3-T12) ---------- */
/* Small second line inside a table cell: "+45.5%" under a return, "Last price Nov 2" under a price. */
.cell-note { display: block; font-size: 11px; font-weight: 600; color: var(--cf-muted); }
.cell-note.up { color: var(--cf-up); }
.cell-note.down { color: var(--cf-down); }
.nowrap { white-space: nowrap; }
/* Delta badge in a KPI note: "+55.3% from $686.28". */
.delta { display: inline-block; padding: 1px 6px; border-radius: 6px; font-weight: 700; background: var(--cf-surface-3); color: var(--cf-text-2); }
.delta.up { background: var(--cf-up-soft); color: var(--cf-up); }
.delta.down { background: var(--cf-down-soft); color: var(--cf-down); }
.chart polyline.baseline { fill: none; }

/* Allocation donut: track + one stroked circle per slice; total in the centre. */
.donut-wrap { position: relative; width: 168px; height: 168px; margin: 6px auto 12px; }
.donut { width: 100%; height: 100%; }
.donut circle { fill: none; stroke-width: 14; }
.donut-track { stroke: var(--cf-surface-2); }
.donut-slice.single { stroke: var(--cf-accent); }
.donut-slice.sealed { stroke: var(--cf-warn); }
.donut-slice.other { stroke: var(--cf-muted); }
.donut-centre { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-total { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.donut-sub { font-size: 12px; color: var(--cf-muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.donut-legend li { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 10px; align-items: center; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend i.single { background: var(--cf-accent); }
.donut-legend i.sealed { background: var(--cf-warn); }
.donut-legend i.other { background: var(--cf-muted); }
.donut-foot { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--cf-border); font-size: 13px; display: flex; justify-content: space-between; gap: 10px; }

/* Recent transactions: side pill, name + date, amount. */
.txn-list { list-style: none; margin: 0; padding: 0; }
.txn-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--cf-border); font-size: 13px; }
.txn-list li:first-child { border-top: 0; }
.txn-main { min-width: 0; }
.txn-main a { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.txn-main .meta { display: block; font-size: 11px; color: var(--cf-muted); }
.side { display: inline-block; min-width: 40px; padding: 2px 6px; border-radius: 6px; font-size: 10px; font-weight: 700; text-align: center; letter-spacing: 0.04em; }
.side.buy { background: var(--cf-up-soft); color: var(--cf-up); }
.side.sell { background: var(--cf-down-soft); color: var(--cf-down); }

/* Forms (static SSR): labelled fields on --cf-surface-2, API errors under the field. */
.form-card h1, .form-card h2 { margin-bottom: 4px; }
.form-card > p { margin: 4px 0 0; }
.form { display: grid; gap: 14px; margin-top: 14px; }
.field { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field label, .field legend { font-size: 12px; font-weight: 600; color: var(--cf-text-2); padding: 0; }
.field input, .field select, .field textarea {
    width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--cf-border-2); background: var(--cf-surface-2);
    color: var(--cf-text); font: 500 14px var(--cf-font); font-variant-numeric: tabular-nums;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--cf-accent); }
.field-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.field-hint { margin: 0; font-size: 11px; color: var(--cf-muted); }
.field-error { margin: 0; font-size: 12px; font-weight: 600; color: var(--cf-down); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.form .form-actions { margin-top: 0; }
/* Edit transaction: destructive actions use the "down" colour; Delete… sits apart from Save/Cancel. */
.button.danger { background: var(--cf-down); color: var(--cf-on-accent); }
.button.danger:hover { color: var(--cf-on-accent); }
.button.danger-text { color: var(--cf-down); }
.button.danger-text:hover { color: var(--cf-down); }
.form-actions .push-right { margin-left: auto; }
.confirm { margin-top: 14px; padding: 16px; border: 1px solid var(--cf-down); border-radius: var(--cf-radius-sm); background: var(--cf-down-soft); }
.confirm h2 { font-size: 16px; margin: 0 0 6px; }
.confirm p { margin: 0; color: var(--cf-text-2); }
.choice { display: inline-flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--cf-surface-2); width: max-content; }
.choice label { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--cf-text-2); cursor: pointer; }
.choice label:has(input:checked) { background: var(--cf-raised); color: var(--cf-text); }
.choice input { accent-color: var(--cf-accent); margin: 0; }
.picked { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--cf-border); }
.picked .name { margin: 0; font-weight: 700; font-size: 15px; }
.picked .meta { margin: 2px 0 0; font-size: 12px; color: var(--cf-muted); }
.picked .end { margin-left: auto; }
img.thumb.large { width: 56px; height: 56px; }
.span-6.form-card, .span-8.form-card { align-self: start; }
@media (max-width: 760px) {
    .field-row { grid-template-columns: 1fr; }
}
.lead-edit { margin-left: 6px; font-size: 12px; font-weight: 600; }

/* ---------- Watchlist (P3-T09): tile notes, remove star, Watch / Watching toggle on product pages ---------- */
.page-head .push-right { margin-left: auto; }
.stat-note { margin: 4px 0 0; font-size: 12px; font-weight: 600; color: var(--cf-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-note.up { color: var(--cf-up); }
.stat-note.down { color: var(--cf-down); }
/* Above the row's stretched link, so the star removes instead of opening the product. */
.star-button {
    position: relative; z-index: 1; width: 36px; height: 36px; border: 0; border-radius: var(--cf-radius-sm); background: transparent;
    color: var(--cf-warn); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.star-button:hover { background: var(--cf-warn-soft); }
.watch-form { display: contents; }
.button.watch { background: var(--cf-surface-3); color: var(--cf-text); }
.button.watch:hover { background: var(--cf-raised); color: var(--cf-text); filter: none; }
.button.watch.on { background: var(--cf-warn-soft); color: var(--cf-warn); }
.button.watch.on:hover { color: var(--cf-warn); filter: brightness(1.15); }
.quote-box .field-error { margin-top: 8px; text-align: right; }

/* Signed-in row markers (MarkBadges): ★ watched in amber, "Held ×2" as a small accent pill, after the name or the price line. */
.mark { display: inline-flex; align-items: center; margin-left: 6px; vertical-align: 1px; }
.mark.watch { color: var(--cf-warn); }
.mark.held { padding: 1px 6px; border-radius: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.02em; background: var(--cf-accent-soft); color: var(--cf-accent); }

/* Admin activity log (FEAT-0001 § v1; canvas board "Admin · Activity log"). */
.activity { padding: 16px 0 8px; }
.activity-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 0 20px 14px; }
.activity-filters .segmented { margin-left: auto; }
.search-input { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: var(--cf-radius-sm); background: var(--cf-surface-2); border: 1px solid var(--cf-border-2); color: var(--cf-muted); }
.search-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--cf-text); font: 400 14px var(--cf-font); }
.search-input:focus-within { border-color: var(--cf-accent); }
.activity-scope { margin: 0; padding: 0 20px 12px; font-size: 13px; color: var(--cf-text-2); }
.activity-scope a { margin-left: 8px; }
.activity .empty { padding: 12px 20px; }
.activity-days, .activity-feed { list-style: none; margin: 0; padding: 0; }
.activity-day { margin: 0; padding: 8px 20px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--cf-muted); background: var(--cf-bg); border-top: 1px solid var(--cf-border); }
.activity-item { display: flex; align-items: flex-start; gap: 14px; padding: 12px 20px; border-top: 1px solid var(--cf-border); }
.activity-item:hover { background: var(--cf-surface-2); }
.activity-time { flex: none; width: 68px; padding-top: 6px; font-size: 13px; color: var(--cf-muted); }
.activity-avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--cf-accent-soft); color: var(--cf-accent); }
.activity-body { flex: 1; min-width: 0; }
.activity-text { display: block; font-size: 14px; line-height: 20px; }
.activity-who { font-weight: 600; color: var(--cf-text); }
.activity-who:hover, .activity-what:hover { text-decoration: underline; }
.activity-what { font-weight: 600; color: var(--cf-text); }
.activity-detail { display: block; margin-top: 2px; font-size: 12px; color: var(--cf-muted); overflow-wrap: anywhere; }
.activity-tag { flex: none; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--cf-surface-3); color: var(--cf-text-2); }
.activity-tag.portfolio { background: var(--cf-up-soft); color: var(--cf-up); }
.activity-tag.watchlist, .activity-tag.import { background: var(--cf-warn-soft); color: var(--cf-warn); }
.activity-tag.account { background: var(--cf-down-soft); color: var(--cf-down); }
.activity-pager { display: flex; justify-content: center; gap: 10px; padding: 14px 20px 8px; border-top: 1px solid var(--cf-border); }
.activity-pager:empty { display: none; }
.foot-note { margin: 0; font-size: 12px; color: var(--cf-muted); }
@media (max-width: 760px) {
  .activity-filters .segmented { margin-left: 0; overflow-x: auto; max-width: 100%; }
  .activity-item { flex-wrap: wrap; gap: 8px 12px; padding: 12px 16px; }
  .activity-time { width: auto; padding-top: 0; order: 3; }
  .activity-body { flex-basis: calc(100% - 44px); }
  .activity-tag { order: 4; }
}

/* ---------- Search: suggestions, filters, results (FEAT-0003) ---------- */
.search { position: relative; }
.suggest {
    position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; max-height: min(70vh, 520px); overflow-y: auto; padding: 6px;
    background: var(--cf-surface-2); border: 1px solid var(--cf-border-2); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}
.suggest[hidden] { display: none; }
.suggest-head { display: block; padding: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--cf-muted); }
.suggest-item, .suggest-all { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 10px; border-radius: 8px; color: var(--cf-text); }
.suggest-item:hover, .suggest-item[aria-selected="true"], .suggest-all:hover, .suggest-all[aria-selected="true"] { background: var(--cf-raised); color: var(--cf-text); }
.suggest-thumb { flex: none; width: 28px; height: 39px; border-radius: 3px; object-fit: cover; background: var(--cf-surface-3); }
.suggest-text { flex: 1; min-width: 0; display: grid; }
.suggest-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-meta { font-size: 12px; color: var(--cf-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-all { justify-content: space-between; min-height: 44px; margin-top: 4px; border-top: 1px solid var(--cf-border-2); border-radius: 0 0 8px 8px; font-size: 13px; font-weight: 600; color: var(--cf-accent); }
.suggest-all kbd { font: 600 11px var(--cf-font); padding: 2px 6px; border: 1px solid var(--cf-border-2); border-radius: 5px; color: var(--cf-muted); }

.tag.rarity { background: var(--cf-surface-3); color: var(--cf-text-2); }
.tag.rarity-M { background: var(--cf-mythic-soft); color: var(--cf-mythic); }
.tag.rarity-R { background: var(--cf-warn-soft); color: var(--cf-warn); }

.filters { display: grid; gap: 12px; }
.filters-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 0; padding: 0; border: 0; min-width: 0; }
.filters-row .search { flex: 1 1 320px; }
.filters-row .field { min-width: 180px; font-size: 12px; font-weight: 600; color: var(--cf-text-2); }
.filters-row .field select { max-width: 320px; }
.filters .button { height: 46px; }
fieldset.segmented { margin: 0; border: 0; align-self: flex-end; padding: 3px; }
fieldset.segmented label { position: relative; height: 34px; padding: 0 14px; border-radius: 6px; display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; color: var(--cf-muted); cursor: pointer; }
fieldset.segmented label:hover { color: var(--cf-text); }
fieldset.segmented label.active, fieldset.segmented label:has(input:checked) { background: var(--cf-raised); color: var(--cf-text); }
fieldset.segmented input, .picks input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
fieldset.segmented label:has(input:focus-visible), .pick:has(input:focus-visible) { outline: 2px solid var(--cf-accent); outline-offset: 2px; }
.picks { align-items: center; gap: 6px; }
.picks legend { float: left; margin-right: 6px; font-size: 12px; font-weight: 600; color: var(--cf-text-2); }
.pick { position: relative; height: 32px; padding: 0 12px; border-radius: 16px; display: inline-flex; align-items: center; background: var(--cf-surface-2); color: var(--cf-text-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.pick:hover { background: var(--cf-raised); color: var(--cf-text); }
.pick.on, .pick:has(input:checked) { background: var(--cf-mythic-soft); color: var(--cf-mythic); }
.filters .clear { margin-left: auto; font-size: 12px; color: var(--cf-muted); align-self: center; }
.filters .clear:hover { color: var(--cf-text); }

.results-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.results-head .count { margin: 0; font-size: 13px; color: var(--cf-muted); }
.view-toggle { margin-left: auto; display: inline-flex; gap: 2px; padding: 3px; background: var(--cf-surface-2); border-radius: var(--cf-radius-sm); }
.view-toggle a { width: 36px; height: 30px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--cf-muted); }
.view-toggle a:hover { color: var(--cf-text); }
.view-toggle a.active { background: var(--cf-raised); color: var(--cf-accent); }
.view-toggle svg { width: 16px; height: 16px; }
.results .pager { justify-content: center; align-items: center; gap: 12px; margin-top: 14px; }
.results .pager .where { font-size: 13px; color: var(--cf-text-2); }
.button.disabled { opacity: 0.45; pointer-events: none; }

.product-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.product-card { display: flex; flex-direction: column; height: 100%; background: var(--cf-surface-2); border: 1px solid var(--cf-border); border-radius: 12px; overflow: hidden; color: var(--cf-text); }
.product-card:hover { border-color: var(--cf-accent); color: var(--cf-text); }
.product-card .art { display: block; padding: 12px 12px 0; }
.product-card .art img, .product-card .art-empty { display: block; width: 100%; height: auto; aspect-ratio: 5 / 7; object-fit: contain; border-radius: 8px; background: var(--cf-surface-3); }
.product-card .body { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; flex: 1; }
.product-card .name { font-size: 14px; font-weight: 600; line-height: 19px; }
.product-card .meta { font-size: 12px; color: var(--cf-muted); }
.product-card .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.product-card .price { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--cf-border); }
.product-card .market { font-size: 19px; font-weight: 700; }
.product-card .changes { display: grid; text-align: right; font-size: 12px; }

@media (max-width: 760px) {
    .filters-row .field { min-width: 0; flex: 1 1 140px; }
    .filters-row .field select { max-width: none; width: 100%; }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .product-card .art { padding: 8px 8px 0; }
    .product-card .body { padding: 8px 10px 10px; }
    .suggest { position: fixed; top: 112px; left: 8px; right: 8px; }
    .view-toggle a { width: 44px; height: 40px; }
    .pick, fieldset.segmented label { min-height: 40px; }
}

/* ---------- Curated lists (FEAT-0004; canvas boards "Lists" and "List detail") ---------- */
.list-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.list-card {
    display: flex; flex-direction: column; gap: 10px; height: 100%; box-sizing: border-box; padding: 18px; border-radius: var(--cf-radius);
    background: var(--cf-surface); box-shadow: 0 0 0 1px var(--cf-border); color: var(--cf-text); text-decoration: none;
}
.list-card:hover { background: var(--cf-surface-2); color: var(--cf-text); }
.list-art { display: flex; gap: 6px; align-items: flex-start; min-height: 62px; }
.list-art img { width: 44px; height: 62px; object-fit: contain; border-radius: 6px; background: var(--cf-surface-2); }
.list-art .count { margin-left: auto; font-size: 12px; color: var(--cf-muted); }
.list-card .name { font-size: 16px; font-weight: 700; }
.list-card .summary { font-size: 12px; color: var(--cf-muted); flex: 1; }
.list-card .spark { width: 100%; height: 48px; }
.list-card .spark polyline { fill: none; stroke: var(--cf-muted); stroke-width: 2; vector-effect: non-scaling-stroke; }
.list-card.up .spark polyline { stroke: var(--cf-up); }
.list-card.down .spark polyline { stroke: var(--cf-down); }
.list-card .figures { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.list-card .value { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.list-card .change { font-size: 13px; font-weight: 600; }
.list-card .since { font-size: 11px; color: var(--cf-muted); }
.change.up, .stats dd.up { color: var(--cf-up); }
.change.down, .stats dd.down { color: var(--cf-down); }
.list-stats.span-8 { grid-column: span 8; }
.chart-note { margin: 10px 0 0; font-size: 12px; color: var(--cf-muted); }
.results-head h2 { margin: 0; }
.admin-lists { list-style: none; margin: 12px 0 0; padding: 0; }
.admin-lists li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 1px solid var(--cf-border); }
.admin-lists .meta { font-size: 12px; color: var(--cf-muted); }
.pick-list { list-style: none; margin: 12px 0 0; padding: 0; }
.pick-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--cf-border); }
.pick-list .pick-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick-list .name { font-weight: 600; font-size: 13px; }
.pick-list .meta { font-size: 11px; color: var(--cf-muted); }
.notice.ok { background: var(--cf-accent-soft); border-color: var(--cf-accent); }
.notice.error { background: var(--cf-down-soft); border-color: var(--cf-down); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
@media (max-width: 1100px) {
    .list-stats.span-8 { grid-column: span 12; }
}
.section-title { margin: 8px 0 -4px; font-size: 15px; font-weight: 700; }
.starter-result { margin: 10px 0 0; padding-left: 18px; font-size: 13px; }
