/* Hallmark · v2.0.0 · redesign depth: restyle · genre: modern-minimal (app) · theme: custom "graphite" (technical, austere) · deal: manual · signature: the numbers, set in Plex Mono on a quiet graphite field · fonts kept as brand */
/* critique: the old default was green-on-green with tracked-caps labels everywhere; now one signal colour, sentence-case labels, flatter surfaces, so price and P&L carry the colour. */
/* waive 38iii: the h2 > .muted subtitle is set display:block as its own second line at a second size, which is the gate's own fix */
/* Loaded last. Restyles the default palette only: named palettes in appearance.css still win. Remove the <link> to roll back. */

/* ---------- 1. tokens: graphite (dark + light); applied only when no named palette is chosen ---------- */
:root {
  --hm-d-bg: #0f1113; --hm-d-panel: #15181b; --hm-d-panel2: #1c2024; --hm-d-line: #262b30; --hm-d-text: #e6e8ea; --hm-d-muted: #929aa3;
  --hm-d-up: #3ecf8e; --hm-d-dn: #f2636f; --hm-d-acc: #6aa8ff; --hm-d-warn: #e3b341; --hm-d-shadow: rgb(0 0 0 / .35);
  --hm-l-bg: #f5f6f7; --hm-l-panel: #ffffff; --hm-l-panel2: #eef0f2; --hm-l-line: #dde1e5; --hm-l-text: #16191c; --hm-l-muted: #5b636c;
  --hm-l-up: #0f7a45; --hm-l-dn: #c0283a; --hm-l-acc: #1f5fd1; --hm-l-warn: #8a5a00; --hm-l-shadow: rgb(20 30 40 / .12);
}
:root:not([data-palette]) {
  --bg: var(--hm-d-bg); --panel: var(--hm-d-panel); --panel2: var(--hm-d-panel2); --line: var(--hm-d-line); --text: var(--hm-d-text); --muted: var(--hm-d-muted);
  --up: var(--hm-d-up); --dn: var(--hm-d-dn); --acc: var(--hm-d-acc); --warn: var(--hm-d-warn); color-scheme: dark;
  --r: 3px; --r2: 5px; --r-sm: 3px; --r-md: 5px; --r-lg: 6px; --r-xl: 8px; --radius: 6px;
  --shadow: none; --shadow-sm: none; --shadow-md: 0 8px 24px var(--hm-d-shadow);
}
@media (prefers-color-scheme: light) {
  :root:not([data-palette]):not([data-theme="dark"]) {
    --bg: var(--hm-l-bg); --panel: var(--hm-l-panel); --panel2: var(--hm-l-panel2); --line: var(--hm-l-line); --text: var(--hm-l-text); --muted: var(--hm-l-muted);
    --up: var(--hm-l-up); --dn: var(--hm-l-dn); --acc: var(--hm-l-acc); --warn: var(--hm-l-warn); color-scheme: light; --shadow-md: 0 8px 24px var(--hm-l-shadow);
  }
}
:root:not([data-palette])[data-theme="light"] {
  --bg: var(--hm-l-bg); --panel: var(--hm-l-panel); --panel2: var(--hm-l-panel2); --line: var(--hm-l-line); --text: var(--hm-l-text); --muted: var(--hm-l-muted);
  --up: var(--hm-l-up); --dn: var(--hm-l-dn); --acc: var(--hm-l-acc); --warn: var(--hm-l-warn); color-scheme: light; --shadow-md: 0 8px 24px var(--hm-l-shadow);
}

/* ---------- 2. floor: page overflow ---------- */
html, body { overflow-x: clip; }

/* ---------- 3. surfaces: flat panels, hairlines carry structure ---------- */
:root:not([data-palette]) .card, :root:not([data-palette]) .kpi { box-shadow: none; }
.top { background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); }
.card > h2, .card > .row-between > h2 { font-weight: 600; letter-spacing: -.01em; }
.page > .row-between > h2, .page > section.row-between > h2 { font-size: 22px; letter-spacing: -.02em; }
h1, h2, h3 { text-wrap: balance; overflow-wrap: break-word; min-width: 0; }

/* ---------- 4. labels: sentence case, untracked, body face a step smaller ---------- */
th, .stat b, .scan .cat, .leg-head, .side .nav .grp, .ev-wd, .ev-agenda h3, .ev-date small, .ev-tag,
.ti-stats b, .bk-menu-h, .lv-h4, .lk-sec h4, .dk-pick h4, .brand-txt small,
.o3-wrap .o3-sum-h, .o3-wrap.o3-light .o3-sum-h {
  text-transform: none; letter-spacing: 0; font-variant: normal; font-family: var(--font-body);
}
th { font-size: 12px; font-weight: 500; }
.side .nav .grp { font-size: 12px; font-weight: 600; color: var(--muted); }

/* ---------- 5. controls: one primary style, the accent used only for action and focus ---------- */
.btn.primary, .btn.acc, button.primary { background: var(--acc); border-color: var(--acc); color: var(--bg); }
.btn.primary:hover, .btn.acc:hover, button.primary:hover { background: color-mix(in srgb, var(--acc) 86%, var(--text)); }
.btn[disabled], button[disabled] { opacity: .5; cursor: not-allowed; }
.chips button.on, .chips button[aria-pressed="true"] { background: color-mix(in srgb, var(--acc) 16%, transparent); border-color: var(--acc); color: var(--text); }
input:focus-visible, select:focus-visible, .inp:focus-visible, #search:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; border-color: var(--acc); }
.btn:active:not([disabled]), button:active:not([disabled]) { transform: scale(.97); }

/* decorative glow on the live dot is noise; the dot keeps its colour */
.dot.live { box-shadow: none; }

/* ---------- 6. motion: reduced-motion fallback for this layer ---------- */
@media (prefers-reduced-motion: reduce) { .top { backdrop-filter: none; } }

/* ---------- 7. dashboard panels (embed): the panel head already titles the page; drop the repeat and the explainer box ---------- */
html.embed .page > section.row-between > h2, html.embed .page > .row-between > h2, html.embed .insight { display: none; }
html.embed .page > section.row-between, html.embed .page > .row-between { justify-content: flex-start; }
.db-panel { border-radius: var(--r2); }

/* ---------- 8. page heads: the inline subtitle drops under the title so the title leads ---------- */
.page > .row-between > h2 > .muted, .page > section.row-between > h2 > .muted {
  display: block; margin-top: 4px; font: 400 13px/1.45 var(--font-body); letter-spacing: 0; color: var(--muted); max-width: 72ch;
}
.page > .row-between, .page > section.row-between { align-items: flex-end; row-gap: 12px; }

/* ---------- 9. no card inside a card: an inner card becomes a tinted region, not a second bordered box ---------- */
.card .card { border: 0; background: var(--panel2); box-shadow: none; }
.card .card .card { background: transparent; padding: 0; }

/* ---------- 10. stat rows: narrower minimum so a row of 7 fits one line instead of orphaning one tile ---------- */
.stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); }
.stat span { overflow-wrap: anywhere; }

/* ---------- 11. short pages: content starts at the top; free height is not shared out between rows (empty tall cards, gaps, scattered footer) ---------- */
main, .page.on, .site-foot { align-content: start; }
.page.on > * { align-self: start; }
.chips { align-items: center; }

/* ---------- 12. the page title leads; the "What this screen shows" box follows it (it is prepended in insights.js) ---------- */
.page.on > * { order: 2; }
.page.on > .insight + .row-between, .page.on > .row-between:first-child { order: 0; }
.page.on > .insight { order: 1; }

/* ---------- 13. narrow screens: grid tracks never grow past the viewport (wide tables and chip rows scroll inside their own box) ---------- */
main, .page.on { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.page.on > *, .grid2 > *, .grid3 > *, .grid-of > *, .grid-fp > *, .grid-st > *, .futures > *, .form > * { min-width: 0; }
.card { max-width: 100%; }
.tbl-wrap, .chain-wrap { max-width: 100%; overflow-x: auto; }
@media (max-width: 700px) {
  .chips { flex-wrap: wrap; }
  .row-between > * { min-width: 0; }
}

/* ---------- 14. phone fixes found at 390px ---------- */
@media (max-width: 700px) {
  /* dashboard panel head: title on its own line, controls wrap below instead of squeezing it into 3 lines */
  .db-head { flex-wrap: wrap; }
  .db-head b { flex: 1 0 100%; }
  /* desk replay bar: slider takes a full row, time and note keep one line each */
  .dk-replay { flex-wrap: wrap; }
  .dk-replay #dk-t { flex: 1 0 60% !important; }
  .dk-replay #dk-time, .dk-replay #dk-note { white-space: nowrap; }
  .dk-replay #dk-note { flex-basis: 100%; white-space: normal; }
}
/* strategy legs: the leg table scrolls inside its card on phones instead of running off the edge */
@media (max-width: 700px) { #st-legs { overflow-x: auto; max-width: 100%; } }

/* ---------- 15. per-card "updated" time: kept (each card's own freshness), shown on hover/focus instead of repeated on every head; touch screens keep it visible ---------- */
.asof::before { content: none; }
@media (hover: hover) {
  .asof { opacity: 0; transition: opacity var(--t-fast, 150ms) ease-out; }
  .card:hover .asof, .card:focus-within .asof { opacity: .75; }
}
@media (prefers-reduced-motion: reduce) { .asof { transition: none; } }
