/* OpenFile — dense, VJN-flavored. Tokens mirror js/fmt.js THEMES: the
   default is the high-contrast profile; [data-theme="paper"] (set on <html>
   by fmt.applyTheme) swaps in the light print-grade set. Both palettes are
   machine-validated for CVD separation and contrast. */

/* IBM Plex, self-hosted (latin subset, ~60KB total) — a superfamily built
   for technical documents, which is what filings are. Mono carries every
   figure: tickers, prices, table columns. */
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/static/fonts/plex-sans-var.woff2') format('woff2-variations'),
       url('/static/fonts/plex-sans-var.woff2') format('woff2');
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/static/fonts/plex-mono-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/static/fonts/plex-mono-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

:root {
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, "Segoe UI",
    sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, "SF Mono", Menlo, monospace;
  --bg: #000000;
  --surface: #0b0b0b;
  --surface2: #191919;
  --grid: #3a3a3a;
  --ink: #ffffff;
  --ink2: #e2e2e2;
  --muted: #9e9e9e;
  --blue: #458de6;
  --up: #3ad46b;
  --down: #ff5c5c;
  --mark: #a58a1955;
  --radius: 8px;
}
:root[data-theme="paper"] {
  --bg: #f2f0ea;
  --surface: #faf8f4;
  --surface2: #ece8df;
  --grid: #dbd6c9;
  --ink: #191813;
  --ink2: #413e35;
  --muted: #7c7768;
  --blue: #1e6ae0;
  --up: #12783c;
  --down: #c02f26;
  --mark: #97670033;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink2);
  font: 14px/1.45 var(--font-sans);
  -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--ink); margin: 0.2em 0 0.4em; }
h2 { font-size: 1.25rem; margin-top: 1.2em; }
code { background: var(--surface2); padding: 1px 5px; border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em; }

.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--grid);
  padding: 16px 14px; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; }
.main { padding: 14px 22px 60px; min-width: 0; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
}

/* controls */
button, .btn { background: var(--surface2); color: var(--ink2);
  border: 1px solid var(--grid); border-radius: 6px; padding: 5px 12px;
  font: inherit; font-size: 0.88rem; cursor: pointer; }
button:hover, .btn:hover { border-color: var(--muted); color: var(--ink); }
button.primary { background: var(--blue); border-color: var(--blue);
  color: #fff; }
button:disabled { opacity: 0.45; cursor: default; }
input[type="text"], input[type="password"], input[type="email"],
input[type="date"], input[type="number"], textarea, select {
  background: var(--surface2); color: var(--ink);
  border: 1px solid var(--grid); border-radius: 6px; padding: 6px 10px;
  font: inherit; width: 100%; }
input:focus, textarea:focus, select:focus { outline: none;
  border-color: var(--blue); }
label { font-size: 0.85rem; color: var(--muted); }
select { width: auto; }

/* segmented control + pills */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px;
  background: var(--surface); border: 1px solid var(--grid);
  border-radius: 8px; padding: 3px; }
.seg button { border: none; background: transparent; border-radius: 5px;
  padding: 4px 12px; color: var(--muted); }
.seg button.active { background: var(--surface2); color: var(--ink); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills button { border-radius: 999px; padding: 3px 12px; font-size: 0.82rem; }
.pills button.active { background: var(--blue); border-color: var(--blue);
  color: #fff; }

/* header */
.hdr { display: flex; justify-content: space-between; align-items: flex-start;
  gap: 18px; flex-wrap: wrap; }
.hdr h1 { font-size: 1.8rem; margin: 0; }
.hdr .coname { color: var(--muted); font-size: 1rem; font-weight: 400; }
.hdr .star { font-size: 1.2rem; background: none; border: none;
  cursor: pointer; padding: 2px 6px; }
.pricebig { text-align: right; font-size: 1.9rem; font-weight: 600;
  font-family: var(--font-mono); letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink); }
.pricebig .chg { font-size: 1rem; }
.sub { color: var(--muted); font-size: 0.85rem; }

/* metric chips */
.chips { display: grid; grid-template-columns: repeat(auto-fit,
  minmax(120px, 1fr)); gap: 10px; margin: 14px 0; }
.chip { background: var(--surface); border: 1px solid var(--grid);
  border-radius: var(--radius); padding: 8px 12px; }
.chip .k { color: var(--muted); font-size: 0.78rem; }
/* a chip or header with an explainer says so: dotted underline, help cursor */
.chip[title] { cursor: help; }
.chip[title] .k { text-decoration: underline dotted
  color-mix(in srgb, var(--muted) 65%, transparent);
  text-underline-offset: 3px; }
table.dt th[title] { cursor: help; text-decoration: underline dotted
  color-mix(in srgb, var(--muted) 65%, transparent);
  text-underline-offset: 3px; }
.chip .v { color: var(--ink); font-size: 1.2rem; font-weight: 600;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em; }
.chip .d { font-size: 0.8rem; }
.chip .d.up { color: var(--up); } .chip .d.down { color: var(--down); }

/* cards & charts */
.card { background: var(--surface); border: 1px solid var(--grid);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px;
  position: relative; }
.chart { width: 100%; }
.chart-export { position: absolute; top: 6px; right: 8px; z-index: 5;
  opacity: 0.55; font-size: 0.78rem; padding: 2px 9px;
  transition: opacity 0.15s; }
.card:hover .chart-export, .chart-export:focus-visible { opacity: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 1100px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.caption { color: var(--muted); font-size: 0.8rem; margin: 6px 2px 12px; }
.note-banner { background: var(--surface); border: 1px solid var(--grid);
  border-left: 3px solid var(--blue); border-radius: 6px;
  padding: 10px 14px; margin: 10px 0; }
.warn-banner { border-left-color: #c98500; }

/* tables */
table.dt { border-collapse: collapse; width: 100%; font-size: 0.86rem; }
table.dt th { text-align: left; color: var(--muted); font-weight: 500;
  border-bottom: 1px solid var(--grid); padding: 6px 10px;
  position: sticky; top: 0; background: var(--surface); }
table.dt td { padding: 5px 10px; border-bottom: 1px solid
  color-mix(in srgb, var(--grid) 50%, transparent); white-space: nowrap; }
table.dt tr:hover td { background: var(--surface2); }
.tablewrap { overflow: auto; max-height: 480px; border: 1px solid var(--grid);
  border-radius: 6px; }
td.num { text-align: right; font-variant-numeric: tabular-nums;
  font-family: var(--font-mono); font-size: 0.94em; }

/* search */
.searchrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 12px; }
.searchbox { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.searchbox .results { position: absolute; top: 100%; left: 0; right: 0;
  background: var(--surface2); border: 1px solid var(--grid);
  border-radius: 6px; z-index: 50; max-height: 320px; overflow: auto; }
.searchbox .results div { padding: 7px 12px; cursor: pointer;
  font-size: 0.88rem; }
.searchbox .results div:hover, .searchbox .results div.sel {
  background: var(--surface); color: var(--ink); }

/* sidebar bits */
.sidebar h2 { font-size: 1.15rem; margin: 0 0 10px; }
.wl-row { display: flex; justify-content: space-between; gap: 6px;
  font-variant-numeric: tabular-nums;
  padding: 3px 0; font-size: 0.86rem; align-items: center; }
.wl-row .sym { cursor: pointer; color: var(--ink2); font-weight: 600;
  font-family: var(--font-mono);
  background: none; border: none; padding: 2px 0; }
.wl-row .sym:hover { color: var(--ink); }
.cached-list { display: flex; flex-direction: column; gap: 2px;
  margin: 8px 0; max-height: 320px; overflow-y: auto; }
.cached-list button { text-align: left; border: none; background: none;
  font-family: var(--font-mono);
  padding: 4px 8px; border-radius: 5px; color: var(--ink2); }
.cached-list button.active { background: var(--surface2); color: var(--ink); }
.sidebar .divider { border-top: 1px solid var(--grid); margin: 12px 0; }
.toggle-row { display: flex; align-items: center; gap: 8px; padding: 4px 0;
  font-size: 0.87rem; }

/* nav */
.tabs { margin: 12px 0; }

/* landing — "morning paper": a serif welcome letter on warm paper. Fixed
   colors on purpose: the front door is light regardless of app theme. */
.landing { min-height: 100vh; background: #f7f3ec; color: #211d15;
  padding: 46px clamp(20px, 8vw, 110px) 40px;
  font-size: 15px; line-height: 1.55; }
.landing .land-top { display: flex; justify-content: space-between;
  align-items: baseline; gap: 12px; flex-wrap: wrap;
  border-bottom: 1px solid #e0d9c8; padding-bottom: 14px;
  margin-bottom: 40px; }
.landing .land-logo { font-family: Charter, "Iowan Old Style", Georgia, serif;
  font-size: 1.25rem; font-weight: 700; }
.landing .land-top a { color: #6e675a; font-size: 0.9rem; }
.landing .land-top a:hover { color: #211d15; }
.landing h1 { font-family: Charter, "Iowan Old Style", Georgia, serif;
  font-weight: 640; font-size: clamp(1.9rem, 4.6vw, 2.9rem);
  line-height: 1.12; letter-spacing: -0.014em; margin: 0; max-width: 21ch;
  text-wrap: balance; color: #211d15; }
.landing .land-sub { font-size: 1.05rem; color: #56503f; max-width: 56ch;
  margin: 18px 0 0; line-height: 1.6; }
.landing .land-sub strong { color: #211d15; }
.landing .land-ctas { margin: 30px 0 0; }
.landing .land-go { background: #1d5fb8; color: #fff; border: none;
  border-radius: 7px; padding: 11px 22px; font-size: 0.98rem;
  font-weight: 600; }
.landing .land-go:hover { background: #174d96; color: #fff;
  border-color: transparent; }
.landing .land-fine { color: #8a8271; font-size: 0.82rem; margin-top: 10px; }
.landing .land-defs { margin: 48px 0 0; padding: 0; border-top: 1px solid
  #e0d9c8; display: grid; grid-template-columns: repeat(3, 1fr); }
.landing .land-def { padding: 22px 22px 26px 0;
  border-right: 1px solid #e0d9c8; }
.landing .land-def:last-child { border-right: none; }
.landing .land-def + .land-def { padding-left: 22px; }
.landing dt { font-family: Charter, "Iowan Old Style", Georgia, serif;
  font-size: 1.08rem; font-weight: 700; margin-bottom: 7px; color: #211d15; }
.landing dd { margin: 0; color: #56503f; font-size: 0.9rem;
  line-height: 1.6; }
.landing dd b { color: #211d15; font-weight: 600; }
.landing .land-h2 { font-family: Charter, "Iowan Old Style", Georgia, serif;
  font-size: 1.45rem; font-weight: 700; color: #211d15; margin: 0 0 6px; }
.landing .land-demo { margin-top: 54px; padding-top: 26px;
  border-top: 1px solid #e0d9c8; }
.landing .land-note { color: #56503f; font-size: 0.95rem; margin: 0 0 16px;
  max-width: 64ch; }
/* the demo chart is the app's own ECharts canvas; the card matches the
   surface color the chart paints so they read as one panel */
.landing .land-chart { background: #faf8f4; border: 1px solid #dbd6c9;
  border-radius: 8px; padding: 8px; width: 100%; height: 400px; }
@media (max-width: 700px) { .landing .land-chart { height: 280px; } }
.landing .land-cap { color: #8a8271; font-size: 0.85rem; max-width: 74ch;
  margin: 10px 2px 0; line-height: 1.6; }
.landing .land-inside { margin-top: 54px; padding-top: 26px;
  border-top: 1px solid #e0d9c8; }
.landing .land-tabs { display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 20px 34px; margin: 18px 0 0; }
.landing .land-tab dt { font-family: Charter, "Iowan Old Style", Georgia,
  serif; font-size: 1rem; font-weight: 700; color: #211d15;
  margin-bottom: 4px; }
.landing .land-tab dd { margin: 0; color: #56503f; font-size: 0.86rem;
  line-height: 1.55; }
@media (max-width: 900px) {
  .landing .land-tabs { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
  .landing .land-tabs { grid-template-columns: 1fr; } }
.landing .land-cta2 { margin-top: 50px; padding: 22px 26px;
  background: #fffdf9; border: 1px solid #e0d9c8; border-radius: 8px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.landing .land-cta2 .land-fine { margin: 0; }
.landing .land-foot { margin-top: 34px; padding-top: 14px;
  border-top: 1px solid #e0d9c8; color: #8a8271; font-size: 0.82rem;
  display: flex; gap: 18px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .landing .land-defs { grid-template-columns: 1fr; }
  .landing .land-def { border-right: none; border-bottom: 1px solid #e0d9c8;
    padding-left: 0; }
  .landing .land-def + .land-def { padding-left: 0; }
}

/* portal */
.portal { max-width: 400px; margin: 9vh auto; }
.portal .card { padding: 20px; }
.portal .tabsel { display: flex; gap: 0; margin-bottom: 16px;
  border-bottom: 1px solid var(--grid); }
.portal .tabsel button { background: none; border: none; border-radius: 0;
  padding: 8px 14px; color: var(--muted);
  border-bottom: 2px solid transparent; }
.portal .tabsel button.active { color: var(--blue);
  border-bottom-color: var(--blue); }
.portal .field { margin-bottom: 12px; }
.portal .error { color: var(--down); font-size: 0.86rem; margin: 8px 0; }
.portal .success { color: var(--up); font-size: 0.86rem; margin: 8px 0; }

/* toast + spinner */
#toast { position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; }
#toast div { background: var(--surface2); border: 1px solid var(--grid);
  border-radius: 6px; padding: 10px 16px; color: var(--ink);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
#toast div.err { border-color: var(--down); }
.spin { display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--muted); border-top-color: transparent;
  animation: spin 0.8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { position: fixed; inset: 0; background: rgba(10,10,10,0.6);
  z-index: 100; display: flex; align-items: center; justify-content: center;
  color: var(--ink); font-size: 1.05rem; gap: 12px; }

/* transcripts */
.transcript { max-height: 520px; overflow-y: auto; padding: 4px 14px;
  background: var(--surface2); border-radius: 6px; font-size: 0.9rem; }
.transcript p { margin: 0.7em 0; }
.transcript mark { background: var(--mark); color: var(--ink); }

/* notes */
.note { margin-bottom: 12px; }
.note .head { display: flex; justify-content: space-between;
  color: var(--muted); font-size: 0.8rem; }
.note .body p { margin: 0.4em 0; color: var(--ink2); }

.newsitem { margin-bottom: 10px; }
.newsitem .t { font-weight: 600; }

details { margin: 10px 0; }
summary { cursor: pointer; color: var(--ink2); font-weight: 500;
  padding: 6px 0; }

.controls-row { display: flex; gap: 12px; align-items: flex-end;
  flex-wrap: wrap; margin-bottom: 10px; }
.controls-row .field { display: flex; flex-direction: column; gap: 3px; }

.popover-wrap { position: relative; display: inline-block; }
.popover { position: absolute; right: 0; top: 100%; margin-top: 4px;
  background: var(--surface2); border: 1px solid var(--grid);
  border-radius: 8px; padding: 12px 14px; z-index: 60; min-width: 210px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5); }
.popover label { display: flex; gap: 8px; align-items: center;
  padding: 3px 0; color: var(--ink2); white-space: nowrap; }
