/* QuantEngine web UI. Colors are tokens; dark is the default theme. */
:root {
  color-scheme: light;
  --bg: #fcfcfb;
  --panel: #f4f3f0;
  --border: #dddcd7;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #8a8984;
  --accent: #2a78d6;
  --grid: #ecebe7;
  /* market colors (VN convention: up green, down red, ref yellow, ceiling violet, floor aqua) */
  --up: #089981;
  --down: #e34948;
  --loss: #e34948;   /* chart polarity pair, validated (dataviz) on the light surface */
  --gain: #089981;
  /* market map fills, validated (dataviz) on each surface; tiles also carry text labels */
  --map-ceiling: #7b3fd0; --map-up: #089981; --map-unchanged: #c98500; --map-down: #e34948; --map-floor: #1597c4; --map-other: #b9b8b2;
  --ref: #c98500;
  --ceil: #7b3fd0;
  --floor: #1597c4;
  /* categorical series slots, fixed order */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131313;
  --panel: #1a1a19;
  --border: #2e2e2b;
  --text: #f2f2f0;
  --text-2: #c3c2b7;
  --muted: #8a8984;
  --accent: #3987e5;
  --grid: #232321;
  --up: #22ab94;
  --down: #f0605f;
  --loss: #ee5b5a;   /* #f0605f is outside the dark lightness band */
  --gain: #22ab94;
  --map-ceiling: #9a60e8; --map-up: #22ab94; --map-unchanged: #b38a14; --map-down: #d94545; --map-floor: #2196c8; --map-other: #3a3a38;
  --ref: #e0a526;
  --ceil: #b388ff;
  --floor: #3dc4ef;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #2f9a2f; --s7: #9085e9; --s8: #e66767;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--panel);
}
.brand { font-weight: 700; letter-spacing: .5px; color: var(--accent); padding-right: 4px; }
.symbol-form input {
  width: 110px; padding: 5px 8px; text-transform: uppercase; font-weight: 600;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
}
.symbol-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.btn {
  padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.icon { padding: 5px 8px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 5px 8px; cursor: pointer; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--accent); color: #fff; }
.seg a { padding: 5px 10px; color: var(--text-2); text-decoration: none; }
.seg a + a { border-left: 1px solid var(--border); }
.seg a.active { background: var(--accent); color: #fff; }
.seg a:not(.active):hover { color: var(--text); }
.toggle { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); cursor: pointer; }
.spacer { flex: 1; }

/* ---- layout ---- */
.layout { flex: 1; display: flex; min-height: 0; }
.chart-area { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chart { flex: 1; min-height: 0; }
.legend {
  position: absolute; z-index: 3; top: 6px; left: 10px; right: 80px;
  pointer-events: none; font-size: 12px; color: var(--text-2);
}
.legend .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; min-height: 20px; }
.legend .sym { font-weight: 700; font-size: 14px; color: var(--text); }
.legend .k { color: var(--muted); }
.legend .v { color: var(--text); font-variant-numeric: tabular-nums; }
.legend .up { color: var(--up); }
.legend .down { color: var(--down); }
/* Only the settings / remove buttons take clicks: the rest of the legend lets them through to the chart (drawing tools). */
.legend .ind { pointer-events: none; }
.legend .ind button { pointer-events: auto; }
.legend .swatch { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 4px; }
.legend .ind button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 3px; font-size: 12px;
}
.legend .ind button:hover { color: var(--text); }
.message {
  position: absolute; z-index: 4; inset: 40% 10% auto; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; text-align: center; color: var(--text-2);
}
.message code { color: var(--text); }

/* ---- table view (accessible alternative to the chart) ---- */
.table-view { max-height: 40%; overflow: auto; border-top: 1px solid var(--border); }
.matched-view { height: 40%; min-height: 220px; display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.matched-view[hidden] { display: none; }
.table-view table, .wl-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { padding: 3px 8px; text-align: right; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.table-view th:first-child, .table-view td:first-child { text-align: left; }
.table-view thead th { position: sticky; top: 0; background: var(--panel); color: var(--text-2); font-weight: 600; }

/* ---- watchlist ---- */
.watchlist {
  width: 300px; border-left: 1px solid var(--border); background: var(--panel);
  display: flex; flex-direction: column; min-height: 0;
}
.wl-head { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--border); }
.wl-head select { flex: 1; padding: 4px 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.watchlist .wl-table { display: block; overflow-y: auto; flex: 1; }
.wl-table thead, .wl-table tbody { display: table; width: 100%; table-layout: fixed; }
.wl-table th { text-align: left; white-space: nowrap; font-weight: 600; color: var(--muted); padding: 4px 10px; font-size: 11px; }
.wl-table td { padding: 5px 10px; border-bottom: 1px solid var(--grid); cursor: pointer; }
.wl-table tr:hover td { background: var(--bg); }
.wl-table tr.active td { background: var(--bg); }
.wl-table tr.active td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.wl-table th:nth-child(1), .wl-table td:nth-child(1) { width: 30%; }
.wl-table td.chg { white-space: nowrap; }
.wl-table .num, .wl-table th.num { text-align: right; }
.wl-table .sym { font-weight: 600; }
.wl-table .nodata { color: var(--muted); }
.chg.up { color: var(--up); }
.chg.down { color: var(--down); }
.chg.ref { color: var(--ref); }
.chg.ceil { color: var(--ceil); }
.chg.floor { color: var(--floor); }
.wl-foot { padding: 6px 10px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--border); }

/* ---- shell: search, help, first-visit tip ---- */
.search-btn { display: inline-flex; align-items: center; gap: 8px; min-width: 260px; padding: 5px 10px; cursor: pointer;
  background: var(--bg); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; text-align: left; }
.search-btn:hover { border-color: var(--accent); color: var(--text-2); }
.search-btn .search-label { flex: 1; }
kbd { font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 2px 5px; border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 4px; color: var(--text-2); background: var(--panel); }
.palette { width: min(560px, calc(100vw - 24px)); margin-top: 12vh; padding: 0; }
.palette-box { display: flex; flex-direction: column; }
.palette input { margin: 10px; padding: 10px 12px; font-size: 15px; background: var(--bg); color: var(--text);
  border: 1px solid var(--accent); border-radius: 8px; outline: none; }
.pal-list { max-height: 50vh; overflow-y: auto; border-top: 1px solid var(--border); }
.pal-head { padding: 8px 14px 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.pal-row { display: flex; align-items: baseline; gap: 10px; padding: 8px 14px; cursor: pointer; }
.pal-row.active, .pal-row:hover { background: var(--bg); box-shadow: inset 2px 0 0 var(--accent); }
.pal-sym { font-weight: 700; width: 48px; }
.pal-ex { font-size: 10px; color: var(--muted); width: 44px; }
.pal-name { color: var(--text-2); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-empty { padding: 14px; color: var(--muted); }
.pal-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.help { width: min(620px, calc(100vw - 24px)); }
.help h2 { margin: 4px 0 0; font-size: 14px; }
.help p { margin: 0; color: var(--text-2); }
.help-keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.help-keys dt { color: var(--text); white-space: nowrap; }
.help-keys dd { margin: 0; color: var(--text-2); }
.first-tip { position: fixed; right: 16px; bottom: 16px; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: var(--panel); border: 1px solid var(--accent); border-radius: 8px;
  box-shadow: 0 6px 20px rgb(0 0 0 / .3); color: var(--text-2); }
.badge { display: inline-block; min-width: 16px; padding: 0 4px; margin-left: 4px; border-radius: 8px; font-size: 10px;
  line-height: 16px; text-align: center; background: var(--accent); color: #fff; }
a.btn { text-decoration: none; color: var(--text); display: inline-flex; align-items: center; }
a.btn.primary { color: #fff; }

/* ---- market strip ---- */
.market-strip { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; padding: 5px 12px;
  border-bottom: 1px solid var(--border); background: var(--bg); font-size: 12px; }
.market-strip[hidden] { display: none; }
.ms-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ms-name { color: var(--muted); }
.ms-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.ms-date { margin-left: auto; color: var(--muted); }
.spark polyline { stroke: var(--ref); }
.spark.up polyline { stroke: var(--up); }
.spark.down polyline { stroke: var(--down); }
.ms-bar { display: inline-flex; gap: 2px; width: 90px; height: 6px; }
.ms-bar i { display: block; border-radius: 2px; }
.ms-bar .up { background: var(--up); }
.ms-bar .ref { background: var(--ref); }
.ms-bar .down { background: var(--down); }

/* ---- stock header and chart toolbar ---- */
.sym-header { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); min-height: 52px; }
.sh-main { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.sh-star { background: none; border: 0; cursor: pointer; font-size: 18px; color: var(--muted); padding: 0 2px; line-height: 1; }
.sh-star.on { color: var(--ref); }
.sh-sym { font-size: 20px; font-weight: 700; }
.sh-ex { font-size: 10px; padding: 1px 5px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-2); }
.sh-name { color: var(--text-2); max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-price { display: flex; align-items: baseline; gap: 8px; }
.sh-last { font-size: 22px; font-weight: 700; }
.sh-date { color: var(--muted); font-size: 11px; }
.sh-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; font-size: 12px; }
.sh-stats > div { display: flex; flex-direction: column; }
.sh-stats dt { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; }
.sh-stats dd { margin: 0; font-variant-numeric: tabular-nums; }
.sh-range dd { display: flex; align-items: center; gap: 6px; }
.sh-range .np-bar { width: 70px; display: inline-block; }
.sh-range .np-bar b { position: absolute; top: -3px; width: 2px; height: 10px; background: var(--text); transform: translateX(-1px); }
.sh-actions { display: flex; gap: 6px; margin-left: auto; }
.chart-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 12px; border-bottom: 1px solid var(--border); }
.chart-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: row; }
.chart-main { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
/* ---- drawing tools (left of the chart) ---- */
.draw-bar { display: flex; flex-direction: column; gap: 2px; padding: 6px 3px; border-right: 1px solid var(--border);
  background: var(--panel); overflow-y: auto; flex-shrink: 0; }
.draw-bar button { width: 32px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-2); cursor: pointer; padding: 0; }
.draw-bar button:hover { background: var(--grid); color: var(--text); }
.draw-bar button.active { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.draw-bar svg path { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.draw-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.chart.drawing, .chart.drawing * { cursor: crosshair !important; }
@media (max-width: 700px) { .draw-bar button { width: 28px; height: 26px; } }

/* ---- side panel: tabs, news, hot ---- */
.side-tabs { display: flex; margin: 8px 8px 0; }
.side-tabs button { flex: 1; padding: 5px 4px; font-size: 12px; }
.side-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.side-pane[hidden] { display: none; }
.news-pane { overflow-y: auto; }
.profile { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.np-head { display: flex; align-items: baseline; gap: 6px; }
.np-sym { font-weight: 700; font-size: 15px; }
.np-ex { color: var(--muted); font-size: 11px; }
.np-price { margin-left: auto; font-variant-numeric: tabular-nums; }
.np-name { color: var(--text-2); margin: 2px 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-grid { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font-size: 12px; }
.np-grid dt { color: var(--muted); }
.np-grid dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.np-range { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 11px; color: var(--text-2); }
.np-bar { position: relative; flex: 1; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--down), var(--ref), var(--up)); opacity: .8; }
.np-bar i { position: absolute; top: -3px; width: 2px; height: 10px; background: var(--text); transform: translateX(-1px); }
.np-muted { color: var(--muted); padding: 10px 12px; }
.np-small { padding: 2px 0 0; font-size: 11px; }
.news-list { flex: 1; }
.news-item, .hot-row { padding: 8px 12px; border-bottom: 1px solid var(--grid); }
.news-title, .hot-title { color: var(--text); text-decoration: none; font-weight: 600; line-height: 1.35; display: block; }
.news-title:hover, .hot-title:hover { color: var(--accent); }
.news-meta { color: var(--muted); font-size: 11px; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.news-sum { margin: 4px 0 0; color: var(--text-2); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chip { font-size: 10px; font-weight: 600; padding: 0 5px; border: 1px solid var(--border); border-radius: 8px; color: var(--accent); text-decoration: none; }
.chip:hover { border-color: var(--accent); }
.hot-row { cursor: pointer; }
.hot-row:hover { background: var(--bg); }
.hot-top { display: flex; align-items: baseline; gap: 6px; }
.hot-rank { color: var(--muted); font-size: 11px; width: 16px; }
.hot-sym { font-weight: 700; }
.hot-count { margin-left: auto; color: var(--muted); font-size: 11px; }
.hot-bar { height: 3px; background: var(--grid); border-radius: 2px; margin: 4px 0 5px; }
.hot-bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.hot-title { font-weight: 500; font-size: 12px; }

/* ---- watchlist sorting, movers ---- */
.wl-table th[data-sort] { cursor: pointer; user-select: none; }
.wl-table th[data-sort]:hover { color: var(--text); }
.wl-table th.sorted { color: var(--text); }
.wl-table th.sorted[data-dir="asc"]::after { content: " ▲"; font-size: 9px; }
.wl-table th.sorted[data-dir="desc"]::after { content: " ▼"; font-size: 9px; }
.wl-empty td { color: var(--muted); cursor: default; white-space: normal; padding: 14px 10px; }
.mv-head { flex-wrap: wrap; }
.mv-head select { flex: 1 1 100%; }
.mv-head .seg { flex: 1; }
.mv-head .seg button { flex: 1; font-size: 12px; }
.mv-row { display: grid; grid-template-columns: 18px 1fr auto 64px; align-items: center; gap: 6px; padding: 6px 12px;
  border-bottom: 1px solid var(--grid); cursor: pointer; }
.mv-row:hover, .mv-row:focus, .mv-row.active { background: var(--bg); outline: none; }
.mv-row.active { box-shadow: inset 2px 0 0 var(--accent); }
.mv-sym { font-weight: 700; min-width: 0; display: flex; flex-direction: column; }
.mv-sym small, .mv-num small { font-weight: 400; font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-num { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.mv-chg { text-align: right; font-variant-numeric: tabular-nums; }
.tc-chart-link { color: var(--accent); text-decoration: none; font-size: 12px; margin-left: 4px; }

/* ---- dialog ---- */
.dialog {
  border: 1px solid var(--border); border-radius: 10px; padding: 0; width: min(360px, calc(100vw - 32px));
  background: var(--panel); color: var(--text);
}
.dialog::backdrop { background: rgb(0 0 0 / .45); }
.dialog form { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.dialog h2 { margin: 0; font-size: 15px; }
.field { display: flex; flex-direction: column; gap: 4px; color: var(--text-2); }
.field select, .field input { padding: 6px 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); }
.params { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---- backtest page ---- */
.bt-layout { flex: 1; display: flex; min-height: 0; }
.bt-form {
  width: 320px; flex-shrink: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px;
  border-right: 1px solid var(--border); background: var(--panel);
}
.bt-form .field input, .bt-form .field select { width: 100%; min-width: 0; }
.bt-form .params > * { min-width: 0; }
.bt-desc, .bt-note { margin: -4px 0 0; color: var(--muted); font-size: 12px; }
.bt-note code { color: var(--text-2); }
.bt-adv summary { cursor: pointer; color: var(--text-2); margin-bottom: 10px; }
.bt-check { align-self: end; padding-bottom: 6px; }
.bt-run { padding: 8px 10px; font-weight: 600; }
.bt-run:disabled { opacity: .6; cursor: progress; }
.bt-results { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-y: auto; }
.bt-message { margin: 40px auto; padding: 14px 16px; max-width: 520px; color: var(--text-2); text-align: center;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
.bt-results .down, .bt-table .down { color: var(--down); }
.bt-results .up, .bt-table .up { color: var(--up); }
#bt-output { display: flex; flex-direction: column; min-height: 100%; }
#bt-output[hidden] { display: none; }
.bt-title { padding: 10px 14px 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.bt-title .k, .kpi .k { color: var(--muted); }
.bt-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; padding: 10px 14px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.kpi .k { font-size: 11px; }
.kpi .kv { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bt-chart-wrap { position: relative; height: 380px; min-height: 260px; flex-shrink: 0; border-top: 1px solid var(--border); }
.bt-chart { position: absolute; inset: 0; }
.bt-chart-wrap .legend { right: 90px; }
.bt-chart-wrap .legend .up { color: var(--up); }
.bt-chart-wrap .legend .down { color: var(--down); }
.bt-tabs { margin: 10px 14px 0; align-self: flex-start; flex-wrap: wrap; }
.bt-table { max-height: none; flex: 1; border-top: 0; margin-top: 8px; }
.bt-table a { color: var(--accent); text-decoration: none; font-weight: 600; }
.bt-table td .k { color: var(--muted); font-size: 11px; }
.bt-table table th, .bt-table table td { text-align: right; }
.bt-table table th:first-child, .bt-table table td:first-child { text-align: left; }
.bt-table table th:nth-child(2), .bt-table table td:nth-child(2) { text-align: left; }
.bt-stats td { text-align: left !important; }
.bt-stats td:first-child { color: var(--text-2); width: 260px; }
.bt-empty { padding: 4px 14px; margin: 0; color: var(--text-2); }

/* ---- trade check page ---- */
.tc-sym { text-transform: uppercase; font-weight: 600; }
.tc-cost { flex-basis: 100%; }
.tc-guide { margin-top: 4px; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 12px; line-height: 1.45; }
.tc-guide summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.tc-guide h4 { margin: 12px 0 4px; font-size: 12.5px; }
.tc-guide dl { margin: 0; }
.tc-guide dt { font-weight: 600; margin-top: 6px; }
.tc-guide dd { margin: 0; color: var(--muted); }
.tc-guide p { margin: 4px 0; }
.tc-guide table { width: 100%; border-collapse: collapse; margin: 4px 0 8px; }
.tc-guide td { padding: 3px 4px; border-top: 1px solid var(--border); vertical-align: top; }
.tc-guide td:first-child { white-space: nowrap; color: var(--muted); padding-right: 8px; }
.tc-guide .btn { margin: 2px 0 4px; }
.tc-output { display: flex; flex-direction: column; gap: 10px; padding-bottom: 20px; transition: opacity .15s; }
.tc-output[hidden] { display: none; }
.tc-output.loading { opacity: .55; }
.tc-warnings { padding: 0 14px; display: flex; flex-direction: column; gap: 4px; }
.tc-warn { color: var(--ref); font-size: 12px; }
.tc-summary { margin: 0 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.tc-summary h3, .tc-card h3 { margin: 0 0 6px; font-size: 13px; }
.tc-summary ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.tc-summary li { display: flex; gap: 6px; line-height: 1.35; }
.tc-mark { font-weight: 700; width: 10px; flex-shrink: 0; }
.tc-summary .pro .tc-mark { color: var(--gain); }
.tc-summary .con .tc-mark { color: var(--loss); }
.tc-summary .note .tc-mark { color: var(--muted); }
.tc-basis { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 14px; }
.tc-basis button:disabled { opacity: .45; cursor: not-allowed; }
.k { color: var(--muted); }
.tc-chart-card { margin: 0 14px; position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.tc-chart-card figcaption { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tc-cap-title { font-weight: 600; }
.tc-table-btn { margin-left: auto; }
.tc-hist { margin-top: 6px; }
.tc-hist svg { display: block; max-width: 100%; height: auto; font-family: inherit; }
.tc-hit { cursor: default; outline: none; }
.tc-hit.hover, .tc-hit:focus { fill: var(--text); fill-opacity: .06; }
.tc-chart-card .table-view { max-height: 300px; border-top: 0; margin-top: 6px; }
.tc-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; font-size: 12px; box-shadow: 0 4px 14px rgb(0 0 0 / .25); min-width: 130px; }
.tc-tip b { font-variant-numeric: tabular-nums; }
.tc-tip div { color: var(--text-2); }
.tc-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.tc-wide { margin: 0 14px; }
.tc-card > p { margin: 0 0 8px; font-size: 12px; }
.tc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 14px; }
.tc-split { display: flex; gap: 2px; height: 12px; margin: 4px 0 6px; }
.tc-split i, .tc-split-legend i { display: block; border-radius: 2px; }
.tc-split .s, .tc-split-legend .s { background: var(--loss); }
.tc-split .t, .tc-split-legend .t { background: var(--gain); }
.tc-split .h, .tc-split-legend .h { background: var(--muted); }
.tc-split-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.tc-split-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tc-split-legend i { width: 10px; height: 10px; }
.tc-dl { max-width: 460px; }
.tc-news { margin-top: 8px; font-size: 12px; }
.tc-foot { margin: 6px 0 0; font-size: 11px; }
.tc-card .table-view { max-height: none; border-top: 0; }
.tc-disclaimer { margin: 0 14px; color: var(--muted); font-size: 12px; }
.np-actions { margin-top: 8px; }
.np-actions a { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 12px; }

/* ---- daily report page ---- */
.rp-page { overflow: auto; }
.rp-main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 14px 16px 30px; display: flex; flex-direction: column; gap: 12px; }
.rp-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.rp-head h1 { margin: 0; font-size: 20px; }
.rp-nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rp-nav input { padding: 5px 8px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; }
.rp-nav button:disabled { opacity: .45; cursor: not-allowed; }
#rp-body { display: flex; flex-direction: column; gap: 12px; transition: opacity .15s; }
#rp-body[hidden] { display: none; }
#rp-body.loading { opacity: .55; }
.rp-main .tc-card h2 { margin: 0 0 8px; font-size: 14px; }
.rp-main .tc-card h3 { margin: 6px 0 4px; font-size: 12px; color: var(--text-2); }
.rp-summary ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; line-height: 1.45; }
.rp-indexes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.rp-index .kv { font-size: 20px; }
.rp-trend { display: flex; gap: 6px; margin-top: 4px; }
.rp-badge { font-size: 10px; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
.rp-badge.up { color: var(--up); }
.rp-badge.down { color: var(--down); }
.rp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rp-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rp-big { font-size: 24px; font-weight: 700; }
.rp-bars { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.rp-bar-row { display: grid; grid-template-columns: 52px 1fr 130px; align-items: center; gap: 8px; font-size: 12px; }
.rp-bar-track { position: relative; height: 12px; background: var(--grid); border-radius: 2px; }
.rp-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 0 4px 4px 0; }
.rp-avg { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); }
.rp-bar-val { text-align: right; font-variant-numeric: tabular-nums; }
.rp-legend { margin: 8px 0 0; font-size: 11px; display: flex; align-items: center; gap: 6px; }
.rp-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.rp-key.fill { background: var(--accent); }
.rp-key.avg { width: 2px; background: var(--text); margin-left: 8px; }
.rp-breadth-row { margin-bottom: 12px; }
.rp-breadth-head { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; margin-bottom: 4px; font-size: 12px; }
.rp-breadth-bar { width: 100%; height: 10px; }
.rp-kpis { padding: 0; }
.rp-fig { margin: 8px 0 0; position: relative; }
.rp-fig figcaption { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rp-fig .table-view { max-height: 320px; border-top: 0; margin-top: 6px; }
.rp-div { display: flex; flex-direction: column; gap: 4px; }
.rp-div-row { display: grid; grid-template-columns: 150px 1fr 64px; align-items: center; gap: 8px; font-size: 12px; }
.rp-div-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-div-label a, .rp-main .bt-table a, .rp-main .news-meta a { color: var(--accent); text-decoration: none; font-weight: 600; }
.rp-div-track { position: relative; height: 12px; }
.rp-div-track::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--muted); }
.rp-div-track i { position: absolute; top: 0; bottom: 0; }
.rp-div-track i.pos { background: var(--gain); border-radius: 0 4px 4px 0; }
.rp-div-track i.neg { background: var(--loss); border-radius: 4px 0 0 4px; }
.rp-div-val { text-align: right; font-variant-numeric: tabular-nums; }
.rp-main .table-view { max-height: none; border-top: 0; }
.rp-main .bt-table table th:nth-child(2), .rp-main .bt-table table td:nth-child(2) { text-align: right; }
.rp-main .chg.up, .rp-main td.up { color: var(--up); }
.rp-main .chg.down, .rp-main td.down { color: var(--down); }
.rp-name { display: inline-block; max-width: 170px; vertical-align: bottom; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-notes { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; }

/* ---- market map (treemap) ---- */
.tm-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.tm-controls select { padding: 4px 6px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; }
.tm-controls .spacer { flex: 1; }
.tm-map { position: relative; width: 100%; background: var(--panel); border-radius: 4px; overflow: hidden; user-select: none; }
.tm-sector { position: absolute; box-sizing: border-box; border: 1px solid var(--border); background: var(--bg); }
.tm-head { height: 18px; line-height: 18px; padding: 0 6px; font-size: 12px; font-weight: 700; color: var(--text);
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-tile { position: absolute; box-sizing: border-box; border-radius: 2px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; overflow: hidden; cursor: pointer; line-height: 1.1; outline: none; }
.tm-tile b { font-weight: 700; letter-spacing: .3px; }
.tm-tile:hover, .tm-tile:focus { box-shadow: inset 0 0 0 2px var(--text); }
.tm-rest { cursor: default; color: var(--text-2); font-weight: 700; }
.tm-tip { min-width: 220px; }
.tm-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12px; }
.tm-key { display: inline-flex; align-items: center; gap: 5px; }
.tm-key i { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.tm-wrap .table-view { max-height: 420px; border-top: 0; }
.map-page { overflow: auto; }
.map-page .rp-main { max-width: none; }
.map-embed .topbar, .map-embed .tm-controls { display: none; }
.map-embed .rp-main { padding: 8px; }
.map-title { margin: 0 8px 0 0; font-size: 18px; }
.map-embed-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; color: var(--text); }

.field-note { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; font-weight: normal; }
.tc-size-note { margin-top: -6px; }

/* ---- price board (board.html), SSI iBoard style ---- */
.pb-page { overflow: hidden; }
.pb-indexes { display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.pb-index {
  flex: 1 0 200px; max-width: 280px; text-align: left; cursor: pointer; padding: 6px 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; color: var(--text);
}
.pb-index:hover { border-color: var(--accent); }
.pb-ix-top, .pb-ix-bottom { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pb-ix-bottom .chg { margin-right: 4px; }
.pb-ix-name { font-weight: 600; }
.pb-ix-spark svg { display: block; width: 100%; height: 34px; }
.pb-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.pb-select, .pb-filter, .pb-nav input {
  padding: 5px 8px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
}
.pb-select.active { border-color: var(--accent); color: var(--accent); }
.seg .pb-caret { padding: 5px 6px; border-left: 0; margin-left: -1px; }
.seg .pb-caret.active { background: var(--accent); color: #fff; border-left: 1px solid rgba(255, 255, 255, .35); }
.pb-cw-menu { position: fixed; z-index: 60; max-height: min(70vh, 520px); overflow: auto; padding: 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 28px rgba(0, 0, 0, .35); }
.pb-cw-menu h3 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.pb-cw-menu section + section { margin-top: 12px; }
.pb-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 4px; }
.pb-chip { display: flex; justify-content: space-between; gap: 4px; padding: 4px 7px; font: inherit; font-size: 12px; cursor: pointer;
  background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 5px; }
.pb-chip:hover { border-color: var(--accent); }
.pb-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pb-chip.on .k { color: inherit; }
.pb-cw-foot { margin-top: 12px; text-align: right; }
.pb-filter { width: 170px; }
.pb-nav { display: inline-flex; gap: 4px; align-items: center; }
.pb-nav .btn:disabled { opacity: .45; cursor: default; }
.pb-note { padding: 4px 12px; color: var(--ref); font-size: 12px; }
.pb-page > .bt-message { margin: 16px auto; }
.pb-wrap { flex: 1; min-height: 0; overflow: auto; }
.pb-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pb-table.loading tbody { opacity: .5; }
.pb-table th, .pb-table td { padding: 4px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--grid); }
.pb-table thead th {
  position: sticky; z-index: 2; background: var(--panel); color: var(--text-2); font-weight: 600; font-size: 11.5px;
  cursor: pointer; user-select: none; border-bottom: 1px solid var(--border);
}
.pb-table thead tr.pb-groups th { top: 0; }
.pb-table thead tr.pb-cols th { top: 26px; }
.pb-table thead th.pb-grp { text-align: center; cursor: default; border-left: 1px solid var(--border); }
.pb-table thead th.sorted { color: var(--accent); }
.pb-table thead th[aria-sort="ascending"]::after { content: " ▲"; font-size: 9px; }
.pb-table thead th[aria-sort="descending"]::after { content: " ▼"; font-size: 9px; }
/* Group borders by class (gs = first column of a group), so optional columns do not shift them. */
.pb-table .gs { border-left: 1px solid var(--border); }
/* Order book columns (Bid / Ask, as on SSI iBoard): live while streaming, the last book of the session after it. */
.pb-table .pb-book { background: color-mix(in srgb, var(--panel) 55%, transparent); }
.pb-table tbody tr.stale td, .pb-table tbody tr.stale .pb-sym { opacity: .55; }
@keyframes pb-flash-up { from { background: color-mix(in srgb, var(--up) 45%, transparent); } to { background: transparent; } }
@keyframes pb-flash-down { from { background: color-mix(in srgb, var(--down) 45%, transparent); } to { background: transparent; } }
.pb-table td.flash-up { animation: pb-flash-up 1.2s ease-out; }
.pb-table td.flash-down { animation: pb-flash-down 1.2s ease-out; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 12px; font-size: 12px;
  border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.live-badge[hidden] { display: none; }
.live-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.live-badge.on { border-color: color-mix(in srgb, var(--up) 60%, var(--border)); color: var(--text); }
.live-badge.on i { background: var(--up); box-shadow: 0 0 0 0 color-mix(in srgb, var(--up) 60%, transparent); animation: live-pulse 1.6s infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--up) 60%, transparent); } 100% { box-shadow: 0 0 0 7px transparent; } }
@media (prefers-reduced-motion: reduce) { .pb-table td.flash-up, .pb-table td.flash-down, .live-badge.on i, .tr-live.on i, .tr-table tr.flash td { animation: none; } }

/* ---- Matched orders (charts side panel) ---- */
.tr-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 4px; }
.tr-head .seg button { padding: 3px 10px; font-size: 12px; }
.tr-live { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.tr-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--up); animation: live-pulse 1.6s infinite; }
.tr-live.on { color: var(--text); font-weight: 600; }
.tr-sum { padding: 4px 10px 6px; }
.tr-split { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--grid); gap: 1px; }
.tr-split i, .tr-bar i { display: block; height: 100%; }
.tr-split .buy, .tr-bar .buy { background: var(--gain); }
.tr-split .sell, .tr-bar .sell { background: var(--loss); }
.tr-split .other, .tr-bar .other { background: var(--muted); opacity: .5; }
.tr-split-legend { display: flex; justify-content: space-between; font-size: 11px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tr-note { font-size: 11px; color: var(--muted); margin-top: 4px; }
.tr-body { flex: 1; overflow: auto; }
.tr-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.tr-table th { position: sticky; top: 0; background: var(--bg); color: var(--muted); font-weight: 500; font-size: 11px; text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--border); }
.tr-table td { padding: 3px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.tr-table .num { text-align: right; }
.tr-table .c { text-align: center; }
.tr-table .muted { color: var(--muted); }
.tr-side { display: inline-block; min-width: 16px; padding: 0 4px; border-radius: 3px; font-size: 10px; font-weight: 700; }
.tr-side.buy { color: var(--gain); border: 1px solid color-mix(in srgb, var(--gain) 55%, transparent); }
.tr-side.sell { color: var(--loss); border: 1px solid color-mix(in srgb, var(--loss) 55%, transparent); }
.tr-gap td { color: var(--muted); font-style: italic; background: color-mix(in srgb, var(--panel) 60%, transparent); }
@keyframes tr-flash { from { background: color-mix(in srgb, var(--accent) 30%, transparent); } to { background: transparent; } }
.tr-table tr.flash td { animation: tr-flash 1.2s ease-out; }
.tr-price .tr-barcell { width: 50%; }
.tr-bar { display: flex; height: 10px; min-width: 2px; border-radius: 2px; overflow: hidden; gap: 1px; }
.pb-table .pb-sym-h, .pb-table .pb-sym { position: sticky; left: 0; text-align: left; }
.pb-table .pb-sym-h { z-index: 3; }
.pb-table .pb-sym { z-index: 1; background: var(--bg); font-weight: 700; }
.pb-table tbody tr { cursor: pointer; }
.pb-table tbody tr:hover td, .pb-table tbody tr:hover .pb-sym { background: var(--panel); }
.pb-table tbody tr.hl td, .pb-table tbody tr.hl .pb-sym { background: color-mix(in srgb, var(--accent) 16%, var(--bg)); }
.pb-table .pb-strong { font-weight: 700; }
.pb-table .ceil { color: var(--ceil); }
.pb-table .floor { color: var(--floor); }
.pb-table .ref { color: var(--ref); }
.pb-table .up { color: var(--up); }
.pb-table .down { color: var(--down); }
.pb-table .none { color: var(--muted); }
.pb-table .k { color: var(--muted); }
.pb-table thead .ceil, .pb-table thead .floor, .pb-table thead .ref { color: var(--text-2); }
.pb-star { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 4px 0 0; font-size: 13px; }
.pb-star.on { color: var(--ref); }
.pb-star:hover { color: var(--text); }
.pb-empty { text-align: center !important; color: var(--muted); padding: 20px !important; }
.pb-foot {
  display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 6px 12px; font-size: 12px; color: var(--text-2);
  border-top: 1px solid var(--border); background: var(--panel); flex-shrink: 0;
}
.pb-foot .k { color: var(--muted); margin-left: auto; }

/* ---- small screens: watchlist below the chart ---- */
@media (max-width: 760px) {
  body { overflow: auto; }
  /* Let the page grow and scroll instead of squeezing the watchlist into what is left of the screen. */
  .layout { flex: none; flex-direction: column; }
  .chart-area { min-height: 70vh; }
  .chart-wrap { min-height: 60vh; }
  .watchlist { width: 100%; border-left: 0; border-top: 1px solid var(--border); height: 60vh; }
  .legend { position: static; padding: 6px 16px 0; font-size: 11px; }
  .topbar { padding: 6px 16px; }
  .bt-layout { flex-direction: column; }
  .bt-form { width: 100%; border-right: 0; border-bottom: 1px solid var(--border); padding: 12px 16px; }
  .bt-results { overflow: visible; }
  .bt-kpis, .bt-title { padding-left: 16px; padding-right: 16px; }
  .bt-chart-wrap { height: 320px; }
  .bt-chart-wrap .legend { position: absolute; padding: 0; right: 70px; }
  .tc-summary, .tc-grid { grid-template-columns: 1fr; }
  .rp-grid, .rp-grid3 { grid-template-columns: 1fr; }
  .rp-name { display: none; }
  .rp-main .table-view { overflow-x: auto; }
  .rp-main { padding: 10px 10px 24px; }
  .rp-div-row { grid-template-columns: 110px 1fr 60px; }
  .rp-bar-row { grid-template-columns: 48px 1fr 110px; }
  .search-btn { min-width: 0; flex: 1 1 100%; order: 10; }
  .topbar .seg a { padding: 5px 8px; }
  #btn-theme { font-size: 0; padding: 5px 9px; }
  #btn-theme::before { content: "◐"; font-size: 14px; }
  .first-tip { left: 12px; right: 12px; display: block; line-height: 1.8; }
  .first-tip button { float: right; }
  .search-btn kbd { display: none; }
  .sh-actions { margin-left: 0; width: 100%; }
  .sh-actions .btn { flex: 1; justify-content: center; }
  .ms-date { margin-left: 0; }
  .market-strip { gap: 4px 12px; }
  .spark { display: none; }
}
.lang-btn { font-weight: 700; min-width: 38px; }

/* ---- financials page ---- */
.fs-verdict { margin: 0 14px; display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; }
.fs-badge { font-size: 20px; font-weight: 700; padding: 6px 14px; border-radius: 8px; border: 2px solid currentColor; white-space: nowrap; }
.fs-badge.good { color: var(--gain); }
.fs-badge.mixed { color: var(--ref); }
.fs-badge.weak { color: var(--loss); }
.fs-badge.n\/a { color: var(--muted); }
.fs-vtext { display: flex; flex-direction: column; gap: 3px; font-size: 13px; min-width: 0; }
.fs-pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; margin: 0 14px; }
.fs-ph { display: flex; align-items: baseline; gap: 8px; }
.fs-ph h3 { margin: 0; }
.fs-rating { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 10px; border: 1px solid currentColor; }
.fs-rating.strong { color: var(--gain); }
.fs-rating.fair { color: var(--ref); }
.fs-rating.weak { color: var(--loss); }
.fs-rating.na { color: var(--muted); }
.fs-pillar .tc-warn { margin-top: 4px; }
.fs-measures { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
.fs-measures th { color: var(--muted); font-weight: 500; font-size: 11px; text-align: right; padding: 2px 4px; }
.fs-measures th:first-child { text-align: left; }
.fs-measures td { padding: 3px 4px; border-top: 1px solid var(--grid); vertical-align: middle; }
.fs-measures td.num { text-align: right; white-space: nowrap; }
.fs-bar { display: inline-block; width: 56px; height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; vertical-align: middle; }
.fs-bar i { display: block; height: 100%; background: var(--accent); }
.fs-flags { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.fs-flags li { display: flex; gap: 6px; line-height: 1.4; }
.fs-flags li.serious { color: var(--loss); }
.fs-tests { margin: 0 0 8px; padding: 0; list-style: none; columns: 2; font-size: 12px; }
.fs-tests li.pass { color: var(--gain); }
.fs-tests li.fail { color: var(--text-2); }
.fs-key { margin-top: 8px; max-width: 420px; }
.fs-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.fs-charts figure { margin: 0; }
.fs-charts figcaption { font-weight: 600; font-size: 12.5px; }
.fs-charts svg { display: block; width: 100%; height: auto; }
.fs-pos { fill: var(--accent); }
.fs-neg { fill: var(--loss); }
.fs-dot { fill: var(--ref); }
.fs-grid { stroke: var(--grid); }
.fs-axis { fill: var(--muted); font-size: 10px; }
.fs-st-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.fs-st-head h3 { margin: 0; }
.fs-st-head .seg button { padding: 3px 10px; font-size: 12px; }
.fs-table { max-height: 520px; }
.fs-table td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.fs-table table th:nth-child(2), .fs-table table td:nth-child(2) { text-align: right; }
.fs-table td:first-child { white-space: normal; min-width: 220px; }
.fs-table tr.lvl1 td:first-child { font-weight: 600; }
.fs-table tr.lvl2 td:first-child { padding-left: 18px; }
.fs-table tr.lvl3 td:first-child { padding-left: 32px; color: var(--text-2); }
@media (max-width: 760px) { .fs-verdict { flex-direction: column; align-items: flex-start; } .fs-tests { columns: 1; } }

/* ---- stock console (price board), like SSI iBoard's ---- */
.dialog.sc { width: min(1320px, calc(100vw - 24px)); height: min(860px, calc(100vh - 24px)); max-width: none; max-height: none;
  padding: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.dialog.sc:not([open]) { display: none; }
.sc-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px 6px; flex-wrap: wrap; }
.sc-id { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 1; }
.sc-sym { font-size: 20px; }
.sc-ex { color: var(--muted); font-size: 12px; }
.sc-name { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-actions { display: flex; gap: 8px; align-items: center; }
.sc-actions a.btn { text-decoration: none; }
.sc-quote { display: flex; gap: 22px; align-items: center; padding: 2px 14px 8px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.sc-last { display: flex; align-items: center; gap: 8px; }
.sc-price { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sc-chg { font-size: 12px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.sc-last.up, .sc-grid .up { color: var(--up); }
.sc-last.down, .sc-grid .down { color: var(--down); }
.sc-last.ref, .sc-grid .ref { color: var(--ref); }
.sc-last.ceil, .sc-grid .ceil { color: var(--ceil); }
.sc-last.floor, .sc-grid .floor { color: var(--floor); }
.sc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 4px 16px; flex: 1; min-width: 260px; font-size: 12px; }
.sc-grid div { display: flex; flex-direction: column; }
.sc-grid b { font-variant-numeric: tabular-nums; }
.sc-tabs { margin: 8px 14px 0; align-self: flex-start; }
.sc-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 8px 14px 12px; }
.sc-pane { flex: 1; min-height: 0; }
.sc-pane[hidden] { display: none; }
.sc-pad { padding: 8px 2px; margin: 0; }
.sc-trade { display: grid; grid-template-columns: minmax(0, 1fr) 260px 340px; gap: 10px; }
.sc-trade > section { min-height: 0; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.sc-trade h3 { margin: 0 0 6px; font-size: 13px; text-align: center; }
.sc-ranges { align-self: flex-start; margin-bottom: 6px; }
.sc-ranges button { padding: 2px 9px; font-size: 12px; }
.sc-chartwrap { position: relative; flex: 1; min-height: 260px; }
.sc-chart { position: absolute; inset: 0; }
.sc-legend { right: 70px; }
.sc-depth { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.sc-depth th { color: var(--muted); font-weight: 500; font-size: 11px; padding: 3px 4px; text-align: right; }
.sc-depth td { padding: 5px 4px; border-top: 1px solid var(--grid); position: relative; }
.sc-depth td.num { text-align: right; }
.sc-depth td span { position: relative; }
.sc-dbar { position: absolute; top: 3px; bottom: 3px; opacity: .22; }
.sc-dbar.bid { right: 0; background: var(--up); }
.sc-dbar.ask { left: 0; background: var(--down); }
.sc-depth .up { color: var(--up); } .sc-depth .down { color: var(--down); } .sc-depth .ref { color: var(--ref); }
.sc-depth .ceil { color: var(--ceil); } .sc-depth .floor { color: var(--floor); }
.sc-split { display: flex; height: 6px; margin-top: 10px; border-radius: 3px; overflow: hidden; gap: 1px; }
.sc-split .bid { background: var(--up); } .sc-split .ask { background: var(--down); }
.sc-split-legend { display: flex; justify-content: space-between; font-size: 11px; margin-top: 4px; color: var(--text-2); }
.sc-matched { padding: 0 !important; }
.sc-matched h3 { padding-top: 8px; }
.sc-trades { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sc-stats { max-height: 100%; height: 100%; border-top: 0; }
.sc-stats table th, .sc-stats table td { text-align: right; }
.sc-stats table th:first-child, .sc-stats table td:first-child { text-align: left; }
.sc-stats td.chg.up { color: var(--up); } .sc-stats td.chg.down { color: var(--down); } .sc-stats td.chg.ref { color: var(--ref); }
.sc-fin { height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.sc-fin-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.sc-fin-head > div:nth-child(2) { flex: 1; min-width: 220px; font-size: 13px; }
.sc-fin-head a.btn { text-decoration: none; }
.sc-fin-val { display: flex; gap: 14px; font-size: 13px; }
.sc-pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.sc-pillar { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; }
.sc-pillar .fs-ph { margin-bottom: 4px; }
.sc-m { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; border-top: 1px solid var(--grid); }
.sc-m span { color: var(--text-2); }
.sc-m b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sc-fin-sum { margin: 0; }
.pb-table tbody tr[data-sym] { cursor: pointer; }
@media (max-width: 1100px) {
  .sc-trade { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(300px, 1fr) minmax(260px, auto); overflow-y: auto; }
  .sc-chartbox { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .dialog.sc { width: 100vw; height: 100vh; border-radius: 0; }
  .sc-trade { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .sc-trade > section { min-height: 260px; }
  .sc-tabs { overflow-x: auto; max-width: calc(100% - 28px); }
  .sc-actions { width: 100%; }
}

/* ---- account: top-bar button, menu, sign-in dialog ---- */
.acct-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.acct-btn.on { padding: 2px 10px 2px 3px; border-radius: 16px; }
.acct-btn img, .acct-ini { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.acct-ini { display: inline-grid; place-items: center; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.acct-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.acct-menu { position: absolute; z-index: 60; min-width: 220px; padding: 6px; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / .25); }
.acct-menu[hidden] { display: none; }
.acct-menu a, .acct-menu button { padding: 7px 10px; border-radius: 6px; color: var(--text); text-decoration: none; text-align: left;
  background: none; border: 0; font: inherit; cursor: pointer; }
.acct-menu a:hover, .acct-menu button:hover { background: var(--bg); }
.acct-who { padding: 6px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: flex; flex-direction: column; }
.acct-who span { color: var(--muted); font-size: 12px; }
.acct-dialog { width: min(420px, calc(100vw - 32px)); }
.acct-box { position: relative; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.acct-box h2 { margin: 0; font-size: 18px; }
.acct-x { position: absolute; top: 10px; right: 10px; }
.acct-perks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }
.acct-google { min-height: 44px; display: flex; justify-content: center; }
.acct-dev { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px dashed var(--border); border-radius: 8px; }
.acct-dev input { padding: 6px 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); }
.acct-msg { margin: 0; color: var(--down); min-height: 1em; }
.acct-legal { margin: 0; font-size: 11px; }

/* ---- paper trading page ---- */
.pt-hero { flex: 1; display: grid; place-items: center; padding: 24px; }
.pt-hero[hidden], .pt-layout[hidden] { display: none; }
.pt-hero-box { max-width: 560px; padding: 28px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; gap: 12px; }
.pt-hero-box h1 { margin: 0; font-size: 24px; }
.pt-lead { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.5; }
.pt-points { margin: 0; padding-left: 18px; color: var(--text-2); line-height: 1.7; }
.pt-signin { align-self: flex-start; padding: 10px 16px; font-size: 15px; }
.pt-layout { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: 320px 1fr;
  grid-template-rows: auto 1fr; grid-template-areas: "kpis kpis" "ticket main"; }
.pt-kpis { grid-area: kpis; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--border);
  border-bottom: 1px solid var(--border); }
.pt-kpi { background: var(--panel); padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pt-kpi .k { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-kv { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.pt-kv small { font-size: 11px; font-weight: 500; color: var(--muted); }
.pt-kv.chg.up { color: var(--gain); } .pt-kv.chg.down { color: var(--loss); }
.pt-ticket { grid-area: ticket; width: auto; border-right: 1px solid var(--border); overflow: visible; }
.pt-main { grid-area: main; min-width: 0; padding: 12px 16px; display: flex; flex-direction: column; gap: 14px; }
.pt-h { margin: 0; font-size: 14px; }
.pt-quote { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); font-variant-numeric: tabular-nums; min-height: 20px; }
.pt-quote:empty { display: none; }
.pt-q-main { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pt-q-last { font-size: 20px; font-weight: 700; }
.pt-q-band { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.pt-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--up); vertical-align: middle; }
.pt-side, .pt-type { display: flex; }
.pt-side button, .pt-type button { flex: 1; padding: 7px; font-weight: 600; }
.pt-side button.buy.active { background: var(--gain); border-color: var(--gain); color: #fff; }
.pt-side button.sell.active { background: var(--loss); border-color: var(--loss); color: #fff; }
.pt-step { display: flex; gap: 4px; }
.pt-step input { flex: 1; text-align: right; font-variant-numeric: tabular-nums; font-size: 15px; }
.pt-quick { display: flex; gap: 6px; }
.pt-quick .btn { flex: 1; }
.pt-est { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13px; font-variant-numeric: tabular-nums; }
.pt-est dt { color: var(--text-2); }
.pt-est dd { margin: 0; text-align: right; }
.pt-go.buy { background: var(--gain); border-color: var(--gain); }
.pt-go.sell { background: var(--loss); border-color: var(--loss); }
.pt-msg { margin: 0; font-size: 13px; min-height: 1.2em; }
.pt-msg.ok { color: var(--up); } .pt-msg.err { color: var(--down); }
.pt-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.pt-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.pt-table-wrap { overflow-x: auto; }
.pt-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.pt-table th, .pt-table td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--grid); }
.pt-table thead th { color: var(--muted); font-weight: 500; font-size: 12px; }
.pt-table tbody th, .pt-table thead th:first-child, .pt-table tfoot th { text-align: left; }
.pt-orders td:first-child, .pt-orders thead th:first-child { text-align: left; }
.pt-table tbody th a { color: var(--text); font-weight: 700; text-decoration: none; }
.pt-table tbody th a:hover { color: var(--accent); }
.pt-table tfoot th, .pt-table tfoot td { font-weight: 700; border-bottom: 0; }
.pt-table .chg.up { color: var(--gain); } .pt-table .chg.down { color: var(--loss); }
.pt-acts { display: flex; gap: 4px; justify-content: flex-end; }
.btn.sm { padding: 2px 8px; font-size: 12px; }
.btn.linkish { background: none; border: 0; color: var(--accent); padding: 0 2px; text-decoration: underline; cursor: pointer; }
.pt-time { color: var(--text-2); }
.pt-side-tag { font-weight: 700; font-size: 12px; padding: 1px 6px; border-radius: 4px; }
.pt-side-tag.buy { color: var(--gain); border: 1px solid color-mix(in srgb, var(--gain) 55%, transparent); }
.pt-side-tag.sell { color: var(--loss); border: 1px solid color-mix(in srgb, var(--loss) 55%, transparent); }
.pt-status { font-size: 12px; font-weight: 600; }
.pt-status.filled { color: var(--up); } .pt-status.pending { color: var(--ref); }
.pt-status.cancelled, .pt-status.expired, .pt-status.rejected { color: var(--muted); }
.pt-rules { margin: 0; font-size: 12px; line-height: 1.5; }
@media (max-width: 1100px) { .pt-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .pt-layout { flex: none; overflow: visible; grid-template-columns: 1fr; grid-template-areas: "kpis" "ticket" "main"; }
  .pt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pt-ticket { border-right: 0; border-bottom: 1px solid var(--border); }
  .pt-main { padding: 10px; }
  .acct-name { display: none; }
}

/* Market-strip indexes open their chart. */
.ms-link { cursor: pointer; border-radius: 6px; }
.ms-link:hover, .ms-link:focus-visible { background: color-mix(in srgb, var(--accent) 12%, transparent); outline: none; }

/* ---- trade ticket (demo account), from the chart header and the stock console ---- */
.btn.sh-trade { background: var(--gain); border-color: var(--gain); color: #fff; font-weight: 600; }
.btn.sh-trade:hover { filter: brightness(1.08); }
.dialog.tk { width: min(400px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; overflow-y: auto; background: var(--bg); }
.tk-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 4px; }
.tk-head h2 { margin: 0; font-size: 16px; flex: 1; }
.tk-demo { font-size: 11px; font-weight: 600; color: var(--ref); border: 1px solid currentColor; border-radius: 10px; padding: 1px 8px; }
.tk-signin { padding: 8px 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.tk-signin p { margin: 0; color: var(--text-2); line-height: 1.5; }
.tk-signin[hidden], .tk-body[hidden] { display: none; }
.tk-body { padding: 6px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.tk-body .field input { width: 100%; min-width: 0; }
.tk-acct { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 12.5px; }
.tk-acct-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.tk-acct .chg.up { color: var(--gain); } .tk-acct .chg.down { color: var(--loss); }
.tk-more { color: var(--accent); text-decoration: none; font-size: 12px; }

/* ---- brand: logo + site name ---- */
.brand { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; padding-right: 4px; }
.brand img { width: 28px; height: 28px; display: block; }
.brand-name { font-weight: 700; letter-spacing: .3px; color: var(--text); font-size: 15px; white-space: nowrap; }
@media (max-width: 1200px) { .brand-name { display: none; } }  /* the logo alone when the menu needs the room */

/* ---- Learning with penguins (user guide page, learn.html) ---- */
.lg-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); flex: 1; min-height: 0; }
.lg-side { min-height: 0; display: flex; flex-direction: column;
  border-right: 1px solid var(--border); background: var(--panel); }
.lg-side-head { display: flex; gap: 10px; align-items: center; padding: 14px 14px 8px; }
.lg-side-head h1 { margin: 0; font-size: 17px; }
.lg-bar { height: 4px; margin: 0 14px 6px; background: var(--grid); border-radius: 2px; overflow: hidden; }
.lg-bar i { display: block; height: 100%; background: var(--gain); transition: width .3s; }
.lg-nav { overflow-y: auto; padding: 6px 8px 16px; flex: 1; }
.lg-level { margin-bottom: 12px; }
.lg-level-name { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 4px 8px; }
.lg-nav a { display: block; padding: 7px 8px 7px 24px; border-radius: 6px; color: var(--text-2); text-decoration: none; font-size: 13.5px; position: relative; }
.lg-nav a::before { content: '○'; position: absolute; left: 8px; color: var(--muted); font-size: 10px; top: 9px; }
.lg-nav a.read::before { content: '●'; color: var(--gain); }
.lg-nav a:hover { background: var(--grid); color: var(--text); }
.lg-nav a.active { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--text); font-weight: 600; }
.lg-body { overflow-y: auto; min-height: 0; padding: 26px 40px 60px; line-height: 1.65; font-size: 15px; outline: none; }
.lg-body > * { max-width: 1040px; }
.lg-body h2 { margin: 4px 0 14px; font-size: 26px; }
.lg-body ul, .lg-body ol { padding-left: 24px; }
.lg-body li { margin: 4px 0; }
.lg-crumb { font-size: 12.5px; }
.lg-fig { margin: 16px 0 20px; }
.lg-fig img { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 18px rgb(0 0 0 / .25); }
.lg-fig a { display: inline-block; cursor: zoom-in; }
.lg-fig figcaption { margin-top: 6px; color: var(--muted); font-size: 13px; }
.lg-table { border-collapse: collapse; margin: 10px 0 14px; width: 100%; max-width: 760px; }
.lg-table td { padding: 7px 12px; border-top: 1px solid var(--border); vertical-align: top; }
.lg-table td:first-child { white-space: nowrap; }
.lg-tip { background: var(--panel); border-left: 3px solid var(--ref); border-radius: 6px; padding: 10px 14px; }
.lg-pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.lg-pager .btn { text-decoration: none; }
.lg-body kbd { border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; font-size: 12px; background: var(--panel); }
@media (max-width: 800px) {
  .lg-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .lg-side { border-right: 0; border-bottom: 1px solid var(--border); }
  .lg-nav { max-height: 32vh; }
  .lg-body { padding: 16px; font-size: 14.5px; }
  .lg-table td:first-child { white-space: normal; }
}

.pt-table .k-pct { font-size: 11px; opacity: .85; }

/* ---- holdings search (My Trading) and Transaction History page ---- */
.pt-find { margin-left: auto; width: min(260px, 45%); padding: 5px 9px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); }
.pt-find[hidden] { display: none; }
.pt-card-head .pt-find + .k { margin-left: 8px; }
.pt-name { font-size: 11px; font-weight: 400; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-waiting { margin: 0; font-size: 13px; color: var(--text-2); }
.pt-waiting a, .th-layout a.btn { color: var(--accent); text-decoration: none; }
.th-layout { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 18px 24px; display: flex; flex-direction: column; gap: 12px; }
.th-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.th-head h1 { margin: 0; font-size: 20px; }
.th-head .spacer { flex: 1; }
.th-layout a.btn { color: var(--text); }
@media (max-width: 700px) { .pt-find { width: 100%; margin: 6px 0 0; } .pt-card-head { flex-wrap: wrap; } }
.lg-body h4 { margin: 20px 0 6px; font-size: 16.5px; }
.lg-body code { font-size: 12.5px; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.lg-body a { color: var(--accent); }
.lg-try { display: inline-block; margin: 2px 0 6px; text-decoration: none; color: #fff !important; }

/* ---- covered warrant tab (stock console) ---- */
.sc-cw-head { display: flex; gap: 40px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 13px; }
.sc-cw-head b { font-size: 16px; font-variant-numeric: tabular-nums; }
.sc-cw-under { color: var(--accent); text-decoration: none; margin-right: 6px; }
.sc-cw-kpis { padding: 0; }
.sc-cw-terms { max-width: none; font-size: 13px; }
.sc-cw-terms td:nth-child(odd) { color: var(--muted); }
.sc-cw-h { margin: 6px 0 0; font-size: 13px; }
.sc-cw-others { max-height: 260px; border-top: 0; }
.sc-cw-others tr[data-cw] { cursor: pointer; }
.sc-cw-others td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sc-cw-others .up { color: var(--up); } .sc-cw-others .down { color: var(--down); } .sc-cw-others .ref { color: var(--ref); }
.sc-cw-head .up { color: var(--up); } .sc-cw-head .down { color: var(--down); } .sc-cw-head .ref { color: var(--ref); }

/* ---- footer notice (every page, shell.js) and the terms / privacy page ---- */
.site-foot { flex-shrink: 0; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 3px 12px;
  border-top: 1px solid var(--border); font-size: 11px; color: var(--text-2); background: var(--bg); }
.site-foot span { flex: 1; min-width: 0; }
.site-foot a { color: var(--text-2); }
.site-foot a:hover { color: var(--text); }
.legal-wrap { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 16px 40px; }
.legal { max-width: 820px; margin: 0 auto; font-size: 14px; line-height: 1.6; }
.legal h1 { font-size: 22px; margin: 0 0 4px; }
.legal h2 { font-size: 17px; margin: 28px 0 8px; scroll-margin-top: 12px; }
.legal li { margin-bottom: 6px; }
.legal-box { margin: 16px 0; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, transparent); }
