/* Stocker: a personal investment ledger. Colour belongs to data; surfaces stay flat. */
:root {
  --paper: #F4EFE6;
  --panel: #FFFDF9;
  --ink: #211E19;
  --muted: #665F54;
  --line: #E2DACB;
  --hover: #EFE9DD;
  --accent: #9A5B2C;
  --gain: #2A7252;
  --loss: #B8433A;
  --sidebar-width: 232px;
  --subtabs-h: 45px;
}

html.dark {
  --paper: #171512;
  --panel: #1F1C18;
  --ink: #F2EDE3;
  --muted: #A89F90;
  --line: #37322B;
  --hover: #2B2722;
  --accent: #D09A6B;
  --gain: #5DB58F;
  --loss: #E08A80;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Nunito", "IBM Plex Sans Thai", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "cv11", "ss03";
  line-height: 1.55;
}

/* Thai glyphs stay legible only above about 12px */
[class*="text-[9px]"], [class*="text-[10px]"] { font-size: 11px !important; line-height: 1.5; }
[class*="text-[11px]"] { font-size: 12px !important; line-height: 1.5; }

/* Prices and amounts share one monospaced face, so columns of numbers line up digit for digit */
.figure { font-family: "Lato", "IBM Plex Sans Thai", system-ui, sans-serif; font-variant-numeric: tabular-nums lining-nums; font-weight: 700; letter-spacing: -0.01em; }

table td, table th { font-variant-numeric: tabular-nums; }
.text-right { font-variant-numeric: tabular-nums; }

/* ── Shell ─────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: var(--ink); }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand b { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; display: block; line-height: 1.2; }
.brand span { font-size: 12px; color: var(--muted); }

.side-portfolio { padding: 0 12px 10px; display: flex; gap: 4px; align-items: center; }
.side-portfolio select {
  flex: 1;
  min-width: 0;
  padding: 7px 8px;
  font-size: 13px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.side-nav { padding: 4px 10px 12px; flex: 1; }
.side-group { margin-top: 14px; }
.side-group > p { font-size: 12px; color: var(--muted); padding: 0 8px 4px; margin: 0; }

.group-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  margin-top: 2px;
  font-size: 15px;
  color: var(--muted);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}
.group-btn svg { width: 18px; height: 18px; flex: none; opacity: 0.75; }
.group-btn:hover { background: var(--hover); color: var(--ink); }
.group-btn.is-active { background: var(--hover); color: var(--ink); font-weight: 500; }
.group-btn.is-active svg { opacity: 1; color: var(--accent); }

/* Pages of the open section, as a row of tabs under the title */
.subtabs {
  height: var(--subtabs-h);
  display: flex;
  align-items: stretch;
  padding: 0 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtabs.is-single { display: none; }
.app-shell:has(.subtabs.is-single) { --subtabs-h: 0px; }
.subtab-row { display: flex; gap: 4px; }
.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  font-size: 14px;
  white-space: nowrap;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.tab-btn svg { width: 15px; height: 15px; flex: none; opacity: 0.7; }
.tab-btn:hover { color: var(--ink); }
.tab-btn.is-active { color: var(--ink); font-weight: 500; border-bottom-color: var(--accent); }
.tab-btn.is-active svg { opacity: 1; }
.page-head { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 14px; }
.page-head h1 { flex: none !important; }
.page-summary { margin: 0; min-width: 0; display: flex; flex-wrap: nowrap; gap: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; color: var(--muted); }
.page-summary i { font-style: normal; opacity: 0.5; }
.page-summary b { color: var(--ink); font-weight: 500; }
.page-summary b.text-emerald-500 { color: var(--gain); }
.page-summary b.text-rose-500 { color: var(--loss); }

.side-foot { border-top: 1px solid var(--line); padding: 10px 12px; font-size: 12px; color: var(--muted); }
.side-controls { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.side-controls button { padding: 5px 8px; border-radius: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.side-controls button:hover { background: var(--hover); color: var(--ink); }

.app-shell { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 16px; font-weight: 600; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { position: relative; padding: 7px; border-radius: 6px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }
#menu-toggle { display: none; }

.btn-primary {
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--paper);
  background: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary:hover { opacity: 0.86; }

.btn-text { padding: 6px 9px; border-radius: 6px; font-size: 13px; color: var(--muted); display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.btn-text:hover { background: var(--hover); color: var(--ink); }
.btn-text svg { width: 14px; height: 14px; }

.app-main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 24px 28px 40px; }
.app-note { padding: 12px 28px 20px; font-size: 12px; color: var(--muted); }

/* ── Overview ──────────────────────────────────────────── */
#overview-block { margin-bottom: 24px; }

.ledger-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 32px; align-items: end; }
.nav-label { font-size: 13px; color: var(--muted); margin: 0 0 2px; }
.nav-value { font-size: clamp(34px, 4.4vw, 50px); line-height: 1.1; }
.nav-sub { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 14px; color: var(--muted); }
#card-total-return, #card-total-return-pct { font-variant-numeric: tabular-nums; font-size: 14px !important; font-weight: 500; padding: 0 !important; background: none !important; }

.ledger-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 20px; margin: 0; }
.ledger-facts dt { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ledger-facts dd { margin: 0; font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 500; color: var(--ink); white-space: nowrap; }

.strip { margin-top: 20px; }
.strip-bar { display: flex; height: 10px; gap: 2px; }
.strip-bar span { min-width: 2px; }
.strip-legend { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-top: 7px; font-size: 12px; color: var(--muted); }
.strip-legend b { color: var(--ink); font-weight: 500; }
.strip-legend i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(240px, 1fr); gap: 16px; margin-top: 20px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.panel-pad { padding: 16px 18px; }
.panel h2 { font-size: 14px; font-weight: 600; margin: 0; color: var(--ink); }

.chart-key { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.chart-key i { display: inline-block; width: 14px; height: 2px; margin-right: 6px; vertical-align: middle; }

.attention { list-style: none; margin: 10px 0 0; padding: 0; }
.attention li { padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.attention li:first-child { border-top: 0; padding-top: 0; }
.attention b { display: block; font-weight: 500; color: var(--ink); }
.attention span { color: var(--muted); font-size: 12px; }
.attention-empty { font-size: 13px; color: var(--muted); margin-top: 10px; }

#live-status { font-size: 13px; }
html.dark .text-amber-500 { color: #D8B25C !important; }

/* ── Primitives on top of the existing utilities ──────── */
.bg-emerald-500.text-white, button.bg-emerald-500 { background: var(--ink) !important; color: var(--paper) !important; }
button.bg-emerald-500:hover { opacity: 0.86; }
.bg-indigo-600.text-white, button.bg-indigo-600 { background: var(--ink) !important; color: var(--paper) !important; }

.bg-white { background: var(--panel) !important; }
.bg-gray-50, .bg-slate-50 { background: color-mix(in srgb, var(--paper) 55%, var(--panel)) !important; }

html.dark .text-slate-400, html.dark .text-slate-500, html.dark [class~="dark:text-slate-400"] { color: #A89F90 !important; }
html.dark .text-emerald-500, html.dark .text-emerald-600, html.dark [class~="dark:text-emerald-400"] { color: var(--gain) !important; }
html.dark .text-rose-500, html.dark .text-rose-600, html.dark [class~="dark:text-rose-400"] { color: var(--loss) !important; }
html.dark .bg-slate-800, html.dark [class~="dark:bg-slate-800"], html.dark [class~="dark:bg-slate-900"] { background-color: var(--panel); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

thead th { font-weight: 400 !important; }
.tab-content.active { animation: none; }

/* ── Tablet and phone: the sidebar folds into a drawer, thumbs get a bottom bar ── */
.overflow-x-auto { position: relative; max-width: 100%; }
#bottom-nav { display: none; }
.add-short { display: none; }

@media (max-width: 1023px) {
  #sidebar { transform: translateX(-100%); transition: transform 0.18s ease-out; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  body.nav-open { overflow: hidden; }
  body.nav-open #sidebar { transform: none; box-shadow: 0 0 40px rgba(33, 30, 25, 0.25); z-index: 60; }
  #sidebar-scrim { display: none; position: fixed; inset: 0; background: rgba(23, 21, 18, 0.35); z-index: 55; }
  body.nav-open #sidebar-scrim { display: block; }

  .app-shell { margin-left: 0; min-width: 0; max-width: 100vw; }
  .topbar {
    height: calc(56px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  }
  .app-main { padding: 20px 20px 24px; }
  .subtabs { padding: 0 12px; }
  .page-summary { display: none; }
  .app-note { padding: 4px 20px calc(84px + env(safe-area-inset-bottom)); }

  #bottom-nav {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 45;
    display: flex;
    justify-content: center;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--paper);
    border-top: 1px solid var(--line);
  }
  .bottom-btn {
    flex: 1;
    max-width: 150px;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
  }
  .bottom-btn svg { width: 20px; height: 20px; }
  .bottom-btn.is-active { color: var(--ink); font-weight: 600; }

  #holdings-table th:nth-child(2), #holdings-table td:nth-child(2),
  #holdings-table th:nth-child(4), #holdings-table td:nth-child(4),
  #holdings-table th:nth-child(8), #holdings-table td:nth-child(8) { display: none; }
  #holdings-table td, #holdings-table th { padding-left: 10px; padding-right: 10px; }
}

/* Touch screens: every control meets the 44px target, and 16px text stops iOS zooming into forms */
@media (pointer: coarse) {
  .tab-btn { min-height: 44px; }
  .icon-btn { min-width: 44px; min-height: 44px; justify-content: center; }
  .btn-primary, .btn-text { min-height: 44px; }
  .side-controls button { min-height: 44px; min-width: 44px; }
  main button, [id$="-modal"] button { min-height: 44px; min-width: 44px; }
  main table a, main a.btn-text { display: inline-flex; align-items: center; min-height: 44px; }
  label.cursor-pointer > span { display: flex; align-items: center; justify-content: center; min-height: 40px; min-width: 40px; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea { font-size: 16px !important; min-height: 44px; }
  input[type="checkbox"] { width: 22px; height: 22px; }
  label:has(> input[type="checkbox"]) { min-height: 44px; }
  main article h4 a { min-height: 44px; }
  .side-portfolio select { min-height: 44px; }
}

/* Phone */
@media (max-width: 767px) {
  .app-main { padding: 16px 16px 20px; }
  .app-note { padding: 4px 16px calc(84px + env(safe-area-inset-bottom)); }
  .add-long { display: none; }
  .add-short { display: inline; }
  .ledger-head { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .ledger-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .hide-phone { display: none !important; }
  .chart-key { order: 3; }
  #tab-news .flex, #tab-intel .flex { flex-wrap: wrap; }
  .overflow-x-auto > span { flex: none; white-space: nowrap; }

  /* Holdings become rows of what matters: name and value, then profit and actions */
  #holdings-table, #holdings-table tbody { display: block; white-space: normal; }
  #holdings-table thead { display: none; }
  #holdings-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "asset value" "actions pnl"; gap: 2px 10px; padding: 10px 14px; }
  #holdings-table td { display: none; padding: 0 !important; }
  #holdings-table td:nth-child(1) { display: block; grid-area: asset; min-width: 0; }
  #holdings-table td:nth-child(6) { display: block; grid-area: value; align-self: center; text-align: right; }
  #holdings-table td:nth-child(7) { display: block; grid-area: pnl; align-self: center; text-align: right; }
  #holdings-table td:nth-child(9) { display: block; grid-area: actions; }
  #holdings-table td[colspan] { display: block; grid-column: 1 / -1; padding: 24px 0 !important; }

  /* Forms open as a sheet from the bottom, within thumb reach */
  [id$="-modal"].flex, #transaction-modal > .flex { align-items: flex-end; padding: 0 !important; }
  [id$="-modal"] [class*="max-w-"] {
    width: 100%;
    max-width: 100% !important;
    max-height: 92dvh;
    overflow-y: auto;
    border-radius: 12px 12px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (min-width: 1024px) {
  #sidebar-scrim { display: none; }
}

/* iPad landscape and small laptops: drop the role column so the table fits without sideways scrolling */
@media (min-width: 1024px) and (max-width: 1300px) {
  #holdings-table th:nth-child(2), #holdings-table td:nth-child(2) { display: none; }
  #holdings-table td, #holdings-table th { padding-left: 10px; padding-right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  #sidebar { transition: none; }
}

/* ── Chart workspace: quiet chrome, the price is the page ── */
body[data-tab="technical"] .app-main { max-width: none; padding: 0; }
body[data-tab="technical"] .app-note { padding-top: 12px; }

.cw {
  position: relative;
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 56px - var(--subtabs-h));
  min-height: 520px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.cw.is-full { position: fixed; inset: 0; z-index: 70; height: 100dvh; }
body.chart-full { overflow: hidden; }

.cw button { cursor: pointer; color: var(--muted); border-radius: 4px; font-size: 13px; white-space: nowrap; }
.cw button:hover { background: var(--hover); color: var(--ink); }
.cw svg { width: 16px; height: 16px; }

.cw-top {
  display: flex;
  align-items: center;
  gap: 4px 10px;
  min-height: 44px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--line);
}
.cw-symbol { position: relative; display: flex; align-items: center; width: 132px; flex: none; color: var(--muted); }
.cw-symbol svg { position: absolute; left: 8px; pointer-events: none; }
.cw-symbol input {
  width: 100%;
  padding: 6px 8px 6px 30px;
  font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid transparent;
  border-radius: 4px;
  text-transform: uppercase;
}
.cw-symbol input:hover { border-color: var(--line); }
.cw-symbol input::placeholder { text-transform: none; font-family: inherit; }

.cw-search {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  width: min(340px, 86vw);
  max-height: 320px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(33, 30, 25, 0.14);
}
.cw .cw-search-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 8px; width: 100%; padding: 8px 10px; text-align: left; align-items: baseline; }
.cw-search-row b { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink); }
.cw-search-row span { overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.cw-search-row em { font-style: normal; font-size: 12px; }

.cw-quote { display: flex; align-items: baseline; gap: 8px; flex: none; }
#tech-stock-price { font-size: 16px; color: var(--ink); white-space: nowrap; }
#tech-stock-change { font-size: 13px; white-space: nowrap; }
.cw-name { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }

.cw-seg { display: flex; align-items: center; gap: 1px; flex: none; }
.cw-seg button { min-width: 30px; padding: 4px 6px; font-variant-numeric: tabular-nums; font-size: 12px; }
.cw .cw-seg button.is-on, .cw .cw-toggles button.is-on { color: var(--ink); background: var(--hover); font-weight: 600; }

.cw-actions { display: flex; align-items: center; gap: 1px; flex: none; }
.cw-actions button { display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; }
.cw-actions-end { margin-left: auto; }
@media (max-width: 1700px) {
  .cw-name { display: none; }
  .cw-actions:not(.cw-actions-end) button:not(.cw-keep-label) span { display: none; }
}
@media (max-width: 1500px) {
  .cw-actions button { padding: 5px 6px; }
  .cw-top { gap: 4px 6px; }
  .cw-seg button { min-width: 26px; padding: 4px 5px; }
}
.cw-rail-toggle { display: none !important; }

.cw-error { margin: 0; padding: 6px 12px; font-size: 13px; color: var(--loss); border-bottom: 1px solid var(--line); }

.cw-body { flex: 1; min-height: 0; display: flex; }
.cw-rail { flex: none; width: 42px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0; border-right: 1px solid var(--line); overflow-y: auto; scrollbar-width: none; }
.cw-rail button { width: 32px; height: 32px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.cw-rail > span { flex: none; width: 22px; height: 1px; margin: 4px 0; background: var(--line); }
.cw .cw-rail button.is-on { background: var(--ink); color: var(--panel); }

.cw-stage { position: relative; flex: 1; min-width: 0; display: flex; }
.cw-grid { flex: 1; min-width: 0; display: grid; gap: 1px; background: var(--line); }
.cw-grid[data-layout="2v"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cw-grid[data-layout="2h"] { grid-template-rows: repeat(2, minmax(0, 1fr)); }
.cw-grid[data-layout="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.cw-cell { position: relative; min-width: 0; min-height: 0; background: var(--panel); }
.cw-chart { position: absolute; inset: 0; }
.cw-chart.is-drawing, .cw-chart.is-drawing canvas { cursor: crosshair !important; }
.cw-grid:not([data-layout="1"]) .cw-cell.is-active::after { content: ""; position: absolute; inset: 0; border: 1px solid var(--accent); pointer-events: none; z-index: 3; }

.cw-legend { position: absolute; top: 6px; left: 8px; right: 70px; z-index: 4; pointer-events: none; font-size: 12px; color: var(--muted); text-shadow: 0 0 3px var(--panel), 0 0 3px var(--panel); }
.cw-leg-pane { top: auto; }
.cw-leg-head { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; font-variant-numeric: tabular-nums; }
.cw-leg-head b { font-size: 13px; font-weight: 600; color: var(--ink); }
.cw-leg-head em { font-style: normal; color: var(--ink); }
.cw-leg-time { color: var(--muted); }
.cw-leg-row { display: flex; align-items: center; gap: 6px; min-height: 20px; }
.cw-leg-row.is-off { opacity: 0.5; }
.cw .cw-leg-name { pointer-events: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 0 3px; color: var(--muted); }
.cw-leg-name i { width: 8px; height: 2px; }
.cw-leg-values { font-variant-numeric: tabular-nums; display: inline-flex; gap: 6px; }
.cw-leg-actions { display: none; pointer-events: auto; gap: 1px; }
.cw-leg-actions.is-shown { display: inline-flex; }
.cw-leg-row:hover .cw-leg-actions { display: inline-flex; }
.cw-leg-actions button { padding: 2px; }
.cw-leg-actions svg { width: 13px; height: 13px; }

.cw-busy { position: absolute; top: 40%; left: 50%; transform: translateX(-50%); z-index: 4; font-size: 13px; color: var(--muted); }

.cw-selection, .cw-toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(33, 30, 25, 0.12);
  font-size: 13px;
}
.cw-selection { top: 44px; display: flex; align-items: center; gap: 8px; padding: 4px 8px; white-space: nowrap; }
.cw-toast { bottom: 44px; padding: 7px 12px; color: var(--ink); max-width: calc(100% - 24px); }
.cw-swatches { display: inline-flex; gap: 5px; }
.cw .cw-swatches button { width: 18px; height: 18px; min-width: 18px; min-height: 18px; border-radius: 50%; }
.cw .cw-swatches button.is-on { outline: 2px solid var(--ink); outline-offset: 1px; }

.cw-side { flex: none; width: 248px; border-left: 1px solid var(--line); overflow-y: auto; font-size: 13px; }
.cw.hide-side .cw-side { display: none; }
.cw-side h3 { margin: 0; padding: 10px 12px 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.cw .cw-watch-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 62px; gap: 6px; width: 100%; padding: 5px 12px; border-radius: 0; text-align: right; align-items: baseline; }
.cw-watch-row b { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink); text-align: left; overflow: hidden; text-overflow: ellipsis; }
.cw-watch-row .figure { color: var(--ink); font-size: 12px; }
.cw .cw-watch-row.is-on { background: var(--hover); }
.cw-info { padding: 0 12px 12px; }
.cw-info h4, .cw-ind-list h4 { margin: 12px 0 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.cw-facts { margin: 0; }
.cw-facts div { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.cw-facts dt { color: var(--muted); }
.cw-facts dd { margin: 0; font-variant-numeric: tabular-nums; font-size: 12px; text-align: right; }
.cw .cw-level { display: grid; grid-template-columns: minmax(0, 1fr) auto 50px; gap: 6px; width: 100%; padding: 3px 0; font-size: 12px; text-align: left; align-items: center; color: var(--ink); }
.cw-level .figure:last-child { text-align: right; }
.cw-empty { margin: 6px 0; padding: 0 2px; font-size: 12px; color: var(--muted); }

.cw-replay { display: flex; align-items: center; gap: 8px; padding: 4px 10px; font-size: 13px; border-top: 1px solid var(--line); background: var(--paper); }
.cw-replay b { font-weight: 500; }
.cw-replay button { display: inline-flex; padding: 5px 7px; }
.cw-replay select { padding: 3px 6px; font-size: 13px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }

.cw-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; padding: 2px 10px; border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.cw-toggles { display: flex; align-items: center; gap: 1px; flex: none; }
.cw-toggles button { padding: 3px 7px; font-size: 12px; display: inline-flex; align-items: center; }
.cw-toggles > i { width: 1px; height: 14px; margin: 0 4px; background: var(--line); }

.cw-pop { position: absolute; z-index: 50; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 12px 32px rgba(33, 30, 25, 0.14); }
.cw-menu { min-width: 190px; padding: 4px; }
.cw-menu-form { width: 250px; padding: 8px; }
.cw-menu-title { margin: 0; padding: 5px 8px; font-size: 12px; color: var(--muted); }
.cw .cw-menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; text-align: left; color: var(--ink); }
.cw .cw-menu-item.is-on { background: var(--hover); font-weight: 500; }
.cw-menu-row { display: flex; }
.cw .cw-menu-row button:first-child { flex: 1; padding: 7px 8px; text-align: left; color: var(--ink); }
.cw .cw-menu-row button:last-child { padding: 7px; }
.cw-quick { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.cw .cw-quick button { padding: 3px 7px; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; border: 1px solid var(--line); }

.cw-input { width: 100%; padding: 7px 9px; font-size: 14px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 4px; }
.cw-dialog { position: absolute; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px 16px; background: rgba(23, 21, 18, 0.28); }
.cw-dialog-box { width: 100%; max-width: 420px; max-height: 100%; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 16px 40px rgba(33, 30, 25, 0.18); }
.cw-dialog-box header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.cw-dialog-box h3 { margin: 0; font-size: 15px; font-weight: 600; }
.cw-dialog-box header button { display: inline-flex; padding: 4px; }
.cw-dialog-body { padding: 12px 14px; overflow-y: auto; }
.cw-dialog-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 14px; }
.cw .cw-dialog-actions .btn-primary { color: var(--paper); }
.cw .cw-dialog-actions .btn-primary:hover { background: var(--ink); color: var(--paper); }
.cw-about { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.cw-field { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; }
.cw-field > span:first-child { color: var(--muted); }
.cw-ind-list { margin-top: 6px; }
.cw .cw-ind-row { display: flex; align-items: center; gap: 2px; width: 100%; border-radius: 6px; }
.cw .cw-ind-pick { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto 18px; gap: 8px; flex: 1; min-width: 0; padding: 7px 8px 7px 2px; text-align: left; align-items: center; }
.cw .cw-ind-star { flex: none; width: 30px; height: 30px; display: grid; place-items: center; color: var(--muted); }
.cw .cw-ind-star svg { width: 15px; height: 15px; }
.cw .cw-ind-star:hover { color: var(--ink); }
.cw .cw-ind-star.is-on { color: #e0a100; }
.cw .cw-ind-star.is-on svg { fill: currentColor; }
.cw-ind-row b { font-weight: 500; color: var(--ink); }
.cw-ind-row span { font-size: 12px; white-space: normal; }
.cw-ind-row em { font-style: normal; font-size: 12px; color: var(--loss); }
.cw .cw-ind-row.is-on { background: var(--hover); }
.cw-ind-row.is-on .cw-ind-pick svg { color: var(--gain); }

.cw-plan { margin: 16px; }
.cw-plan p { margin: 2px 0 8px; font-size: 13px; color: var(--muted); }
.cw-plan thead th { color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.cw-plan tbody tr + tr td { border-top: 1px solid var(--line); }

@media (max-width: 1279px) {
  .cw-side { position: absolute; top: 0; right: 0; bottom: 0; z-index: 7; display: none; background: var(--panel); box-shadow: -8px 0 24px rgba(33, 30, 25, 0.1); }
  .cw.hide-side .cw-side { display: block; }
  .cw-name { display: none; }
}

@media (max-width: 1023px) {
  .cw { height: calc(100dvh - 56px - 57px - var(--subtabs-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom)); min-height: 460px; }
  .cw.is-full { height: 100dvh; }
  .cw-top { flex-wrap: wrap; }
  .cw-actions-end { margin-left: 0; }
}

/* Touch: the same tools, with 44px targets; the rail folds away so the chart keeps the width */
@media (pointer: coarse) {
  .cw button { min-height: 40px; min-width: 40px; }
  .cw .cw-swatches button { min-height: 26px; min-width: 26px; width: 26px; height: 26px; }
  .cw .cw-leg-name { min-height: 26px; min-width: 0; }
  .cw .cw-watch-row, .cw .cw-level, .cw .cw-menu-item { min-height: 44px; }
  .cw .cw-leg-actions { display: none; }
  .cw-seg button { min-width: 38px; }
  .cw-symbol input { min-height: 40px; }
  .cw-replay select { min-height: 40px; }
}

@media (max-width: 767px) {
  .cw-top { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; padding: 4px 8px; gap: 4px 8px; }
  .cw-symbol { width: auto; }
  .cw-quote { display: block; line-height: 1.2; }
  #tech-stock-price { display: block; font-size: 15px; }
  #tech-stock-change { font-size: 12px; }
  .cw-actions-end { grid-column: 3; grid-row: 1; }
  .cw-actions-end #cw-layout-btn, .cw-actions-end #cw-saved-btn, .cw-actions-end [data-click="cwScreenshot"] { display: none; }
  #cw-intervals { grid-column: 1 / -1; overflow-x: auto; scrollbar-width: none; }
  .cw-actions:not(.cw-actions-end) { grid-column: 1 / -1; overflow-x: auto; scrollbar-width: none; }
  .cw-rail-toggle { display: inline-flex !important; }
  .cw-rail { display: none; }
  .cw.show-rail .cw-rail {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 8;
    display: flex;
    background: var(--panel);
  }
  .cw-body { position: relative; }
  .cw-rail button { width: 44px; height: 44px; }
  .cw-rail { width: 48px; }
  .cw-legend { right: 58px; }
  .cw-ohlc, .cw-leg-time { display: none; }
  .cw-dialog { align-items: flex-end; padding: 0; }
  .cw-dialog-box { max-width: 100%; border-radius: 12px 12px 0 0; max-height: 80%; padding-bottom: env(safe-area-inset-bottom); }
  .cw-plan { margin: 12px; }
  .cw-input { font-size: 16px; }
}

/* ── Shared page parts: rows and rules instead of boxes inside boxes ── */
.page-tools { margin-bottom: 14px; }
.two-col { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.two-col-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.split-side { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 10px; }
.note { font-size: 13px; color: var(--muted); margin: 0; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; background: var(--hover); border-radius: 6px; max-width: 100%; }
.seg button { padding: 5px 11px; font-size: 13px; color: var(--muted); border-radius: 4px; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.is-on { background: var(--panel); color: var(--ink); font-weight: 500; }
.seg button span { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); }

.form-stack { display: grid; gap: 12px; align-content: start; }
.form-stack fieldset { display: grid; gap: 10px; margin: 0; padding: 12px 0 0; border: 0; border-top: 1px solid var(--line); min-width: 0; }
.form-stack legend { padding: 0 8px 0 0; font-size: 13px; font-weight: 500; color: var(--ink); }
.field { display: grid; gap: 4px; min-width: 0; font-size: 13px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field input, .field select, .filter-bar input, .filter-bar select, .inline-add input {
  width: 100%;
  min-width: 0;
  padding: 7px 9px;
  font-size: 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.field input[readonly] { background: var(--hover); color: var(--muted); }
.field input:focus, .field select:focus, .filter-bar input:focus, .filter-bar select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; margin: 0; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-size: 20px; line-height: 1.25; color: var(--ink); }
.fact-list { margin: 0; }
.fact-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.fact-list > div:first-child { border-top: 0; }
.fact-list dt { color: var(--muted); }
.fact-list dd { margin: 0; text-align: right; }
.action-row { display: flex; justify-content: flex-end; gap: 6px; margin-top: 14px; }

.rule-table { width: 100%; font-size: 14px; border-collapse: collapse; white-space: nowrap; }
.rule-table th { padding: 6px 10px; font-size: 12px; color: var(--muted); text-align: left; border-bottom: 1px solid var(--line); }
.rule-table th.text-right { text-align: right; }
.rule-table td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.rule-table tr:first-child td { border-top: 0; }
.rule-table th:first-child, .rule-table td:first-child { padding-left: 0; }
.rule-table th:last-child, .rule-table td:last-child { padding-right: 0; }
.rule-table td.wrap { white-space: normal; min-width: 170px; }
.rule-table small { display: block; font-size: 12px; color: var(--muted); }
.rule-table .muted { color: var(--muted); font-size: 13px; }
.empty-cell { padding: 28px 0 !important; text-align: center; color: var(--muted); font-size: 13px; white-space: normal; }

.link-ticker { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink); cursor: pointer; }
.link-ticker:hover { color: var(--accent); text-decoration: underline; }

.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.filter-bar select { width: auto; max-width: 170px; }
.filter-bar input { width: 130px; }

.list-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
.list-row:first-child { border-top: 0; padding-top: 0; }
.list-row small { display: block; font-size: 12px; color: var(--muted); white-space: normal; }

.verdict { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 40px; margin-bottom: 16px; }
.verdict-title { margin: 0; font-size: 24px; font-weight: 600; line-height: 1.3; }
.verdict-figures { display: flex; gap: 28px; margin: 0; }
.verdict-figures dt { font-size: 12px; color: var(--muted); }
.verdict-figures dd { margin: 0; font-size: 18px; }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font-size: 13px; }
.chips label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; color: var(--ink); }
.chips input[type="checkbox"] { accent-color: var(--ink); }
.inline-add { display: inline-flex; align-items: center; gap: 2px; }
.inline-add input { width: 92px; padding: 4px 8px; font-size: 13px; }

.news-list { margin-top: 4px; }
.news-row { padding: 10px 0; border-top: 1px solid var(--line); }
.news-row:first-child { border-top: 0; }
.news-row > a { display: block; font-size: 15px; font-weight: 500; line-height: 1.45; color: var(--ink); }
.news-row > a:hover { color: var(--accent); }
.news-row a:visited { color: var(--muted); }
.news-row p { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.news-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.news-source { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; color: var(--muted); background: transparent; cursor: pointer; }
.news-source:hover { background: var(--hover); }
.news-source.is-on { border-color: var(--accent); color: var(--accent); }
.news-source em { font-style: normal; opacity: .75; }
.news-paywall { padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; }

@media (max-width: 1023px) {
  .two-col, .split-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .two-col-even { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats dd { font-size: 18px; }
  .verdict-title { font-size: 20px; }
  .filter-bar input, .filter-bar select { flex: 1 1 130px; max-width: none; }
  .rule-table { font-size: 13px; }
}
@media (pointer: coarse) {
  .seg button { min-height: 40px; }
  .link-ticker { min-height: 32px; }
  .news-row p .link-ticker { min-height: 32px; min-width: 40px; }
}

.share-row { display: grid; grid-template-columns: minmax(84px, 1.1fr) minmax(0, 2fr) 56px 92px; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.share-row:first-child { border-top: 0; }
.share-row .figure { text-align: right; }
.share-row .muted { color: var(--muted); font-size: 12px; }
.share-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-bar { display: block; height: 8px; }
.share-bar i { display: block; height: 100%; min-width: 2px; background: var(--accent); }
.form-stack .seg { justify-self: start; }
@media (max-width: 767px) {
  .share-row { grid-template-columns: minmax(72px, 1fr) minmax(0, 1.2fr) 52px; }
  .share-row .muted { display: none; }
}

/* The utility `.hidden` is !important, so the theme icon has to be switched explicitly */
html.dark #btn-toggle-theme .lucide-moon { display: block !important; }
html.dark #btn-toggle-theme .lucide-sun { display: none !important; }

.nav-sub #card-day-change { font-size: 14px; }
.day-move { display: block; font-size: 12px; font-weight: 500; }
.settings h3 { margin: 18px 0 2px; font-size: 13px; font-weight: 600; }
.settings .action-row { justify-content: flex-start; margin-top: 6px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.delete-row { display: flex; gap: 8px; margin-top: 8px; }
.feedback-input { width: 100%; margin-top: 8px; padding: 8px 10px; font: inherit; font-size: 14px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; resize: vertical; }
.feedback-input:focus-visible { outline: 2px solid var(--accent, #2563eb); outline-offset: 1px; }
.first-steps { display: grid; gap: 10px; width: 100%; max-width: 460px; margin: 0; padding: 0; list-style: none; counter-reset: step; text-align: left; }
.first-steps li { position: relative; display: grid; gap: 4px; padding: 10px 12px 10px 44px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; color: var(--ink); counter-increment: step; }
.first-steps li::before { content: counter(step); position: absolute; left: 12px; top: 10px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 999px; background: var(--hover); color: var(--ink); font-size: 12px; font-weight: 600; }
.first-steps span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.first-steps-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.first-steps-actions button { padding: 6px 12px; font-size: 12px; border-radius: 8px; min-height: 36px; }
.delete-row input { flex: 1; min-width: 0; padding: 7px 9px; font-size: 14px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.btn-danger { padding: 7px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: #fff; background: var(--loss); cursor: pointer; white-space: nowrap; }
html.dark .btn-danger { color: #171512; }

/* ── Stock search and logos ── */
.ticker-suggest { position: fixed; z-index: 90; max-height: 340px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 32px rgba(33, 30, 25, 0.18); padding: 4px; }
.ticker-suggest button { display: grid; grid-template-columns: 24px 88px minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; padding: 7px 8px; border-radius: 4px; text-align: left; font-size: 13px; color: var(--muted); cursor: pointer; }
.ticker-suggest button:hover, .ticker-suggest button.is-on { background: var(--hover); }
.ticker-suggest b { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.ticker-suggest span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticker-suggest em { font-style: normal; font-size: 12px; }
.ticker-suggest p { margin: 0; padding: 10px; font-size: 13px; color: var(--muted); }
input.has-logo { padding-left: 32px !important; }

.stock-label { display: inline-flex; align-items: center; gap: 7px; vertical-align: middle; min-width: 0; }
.stock-label b { font-weight: 600; color: var(--ink); }
.stock-label > :first-child { flex: none; }
.link-ticker .stock-label b:hover { color: var(--accent); }
.attention li { display: flex; gap: 9px; align-items: flex-start; }
.attention li > div:last-child { min-width: 0; }
.strip-legend span { display: inline-flex; align-items: center; gap: 4px; }
.strip-legend i { margin-right: 1px; }
.news-row p { align-items: center; }
#dca-ticker { padding-left: 36px; }

.search-head { margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search-head input { width: min(420px, 100%); padding: 10px 12px; font-size: 15px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.search-head input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.search-empty { padding: 72px 16px; text-align: center; font-size: 15px; color: var(--muted); }

.cw-logo { display: inline-flex; align-self: center; }
.cw-leg-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.cw-leg-id { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink); }
.cw-leg-id b { font-weight: 600; }
.cw-no-symbol { display: none; position: absolute; inset: 0; margin: 0; z-index: 5; align-items: center; justify-content: center; font-size: 15px; color: var(--muted); background: var(--panel); text-align: center; padding: 16px; }
.cw-cell.no-symbol .cw-no-symbol { display: flex; }
.cw.is-empty .cw-side, .cw.is-empty .cw-bottom { display: none; }
.cw .cw-watch-row { grid-template-columns: minmax(0, 1fr) auto 62px; align-items: center; }

/* ── Allocation page ── */
#allocation-charts-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.allocation-stats { margin-bottom: 4px; }
.allocation-stats dd { font-size: 18px; display: flex; align-items: center; gap: 6px; }
.pie-layout { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 28px; align-items: center; }
.pie-box { position: relative; height: 280px; }
.pie-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.pie-center span { font-size: 12px; color: var(--muted); }
.pie-center b { font-size: 18px; font-weight: 600; }
.pie-list { max-height: 300px; overflow-y: auto; }
.pie-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) 62px 104px; gap: 10px; align-items: center; padding: 6px 4px; border-top: 1px solid var(--line); font-size: 14px; }
.pie-row:first-child { border-top: 0; }
.pie-row:hover { background: var(--hover); }
.pie-row > i { width: 10px; height: 10px; border-radius: 2px; }
.pie-row .figure { text-align: right; }
.pie-row .muted { color: var(--muted); font-size: 13px; }
.pie-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.pie-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portfolio-map { position: relative; height: 340px; overflow: hidden; border-radius: 6px; }
.map-tile { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; overflow: hidden; padding: 2px; border: 1px solid var(--panel); color: var(--ink); font-size: 13px; cursor: pointer; }
.map-tile:hover { filter: brightness(0.96); }
.map-tile b { font-weight: 600; }
.map-tile span { font-size: 12px; }
@media (max-width: 767px) {
  .pie-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .pie-box { height: 240px; }
  .pie-list { max-height: none; }
  .pie-row { grid-template-columns: 10px minmax(0, 1fr) 56px; }
  .pie-row .muted { display: none; }
}

/* ── Watchlist bar and stock actions ── */
.search-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.stock-actions { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.stock-action { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; background: var(--panel); cursor: pointer; white-space: nowrap; }
.stock-action:hover { color: var(--ink); background: var(--hover); }
.stock-action svg { width: 15px; height: 15px; }
.stock-action.is-on { color: var(--ink); border-color: var(--accent); }
.stock-action.is-on svg { color: var(--accent); fill: var(--accent); }
.watch-bar { flex: none; }
.watch-bar:not(.hidden) { display: flex; flex-wrap: wrap; gap: 6px; }
.watch-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; font-size: 13px; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; background: var(--panel); cursor: pointer; white-space: nowrap; }
.watch-toggle:hover { background: var(--hover); }
.watch-toggle.is-on { border-color: var(--accent); }
.watch-toggle svg { width: 15px; height: 15px; color: var(--muted); }
.watch-toggle em { font-style: normal; color: var(--muted); }
.watch-menu { position: fixed; z-index: 90; overflow-y: auto; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 32px rgba(33, 30, 25, 0.18); }
.watch-menu .note { padding: 10px; }
.watch-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) 16px auto; gap: 8px; align-items: center; width: 100%; min-height: 40px; padding: 6px 8px; border-radius: 4px; text-align: left; font-size: 13px; color: var(--muted); cursor: pointer; }
.watch-row:hover { background: var(--hover); }
.watch-row.is-on { background: var(--hover); }
.watch-row b { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.watch-row em { font-style: normal; }
.watch-row svg { width: 13px; height: 13px; color: var(--accent); }
.cw-watch-line { display: flex; align-items: center; gap: 8px; padding: 0 10px; border-bottom: 1px solid var(--line); min-height: 0; }
.cw-watch-line .watch-bar { padding: 4px 0; }
.cw .watch-toggle { padding: 3px 8px; font-size: 12px; }
.cw-watch-line .stock-actions { flex: none; padding: 4px 0; }
.cw-watch-line:not(:has(> :not(.hidden))) { display: none; }
.cw .stock-action { padding: 3px 8px; font-size: 12px; color: var(--muted); }
@media (pointer: coarse) {
  .stock-action, .watch-toggle { min-height: 40px; }
}

/* Economic calendar */
.calendar-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.calendar-day { margin-top: 16px; }
.calendar-day h3 { padding-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--ink); border-bottom: 1px solid var(--line); }
.calendar-day h3 em { font-style: normal; color: var(--accent); }
.calendar-row { display: grid; grid-template-columns: 48px 40px 52px minmax(0, 1fr) 190px; gap: 10px; align-items: center; padding: 9px 0; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); }
.calendar-row.is-past { opacity: .6; }
.calendar-time { color: var(--ink); }
.calendar-stars { letter-spacing: 1px; font-size: 14px; line-height: 1; }
.calendar-stars i { font-style: normal; color: var(--line); }
.calendar-stars i.is-on { color: #C48A1E; }
.calendar-holiday { font-size: 12px; }
.calendar-title { min-width: 0; }
.calendar-title b { display: block; font-weight: 500; color: var(--ink); }
.calendar-title small { font-size: 12px; }
.calendar-values { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(64px, 1fr); gap: 10px; margin: 0; }
.calendar-values .is-actual dd { font-weight: 600; }
.calendar-values div { text-align: right; }
.calendar-values dt { font-size: 11px; }
.calendar-values dd { margin: 0; color: var(--ink); }
@media (max-width: 640px) {
  .calendar-row { grid-template-columns: 48px 40px minmax(0, 1fr); gap: 4px 8px; }
  .calendar-title, .calendar-values { grid-column: 1 / -1; }
  .calendar-values div { text-align: left; }
}

/* Quarterly report */
.quarter-scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); column-gap: 24px; }
.quarter-score { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; font-size: 13px; color: var(--ink); border-bottom: 1px solid var(--line); }
.quarter-score b { display: block; font-weight: 500; }
.quarter-score small { font-size: 12px; color: var(--muted); }
.quarter-verdict { padding: 2px 0; font-size: 12px; font-weight: 600; text-align: center; border-radius: 4px; background: var(--hover); color: var(--muted); }
.quarter-score.is-good .quarter-verdict { color: var(--gain); }
.quarter-score.is-bad .quarter-verdict { color: var(--loss); }
.quarter-headline { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.quarter-summary { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink); }
.qt-kpi-note { margin: 0 0 4px; font-size: 11px; line-height: 1.4; color: var(--muted); }
.quarter-quote { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--line, #d0d5dd); }
.quarter-quote p { margin: 0; font-size: 14px; font-style: italic; color: var(--ink); }
.quarter-quote small, .quarter-quote cite { display: block; margin-top: 4px; font-size: 12px; font-style: normal; color: var(--muted, #667085); }
.quarter-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px 24px; }
.quarter-points h4 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--ink); }
.quarter-points.is-good h4 { color: var(--gain); }
.quarter-points.is-bad h4 { color: var(--loss); }
.quarter-points ul { margin: 0; padding-left: 18px; list-style: disc; font-size: 13px; line-height: 1.55; color: var(--ink); }

/* Privacy page */
.privacy-page { max-width: 720px; margin: 0 auto; padding: 32px 16px 64px; color: var(--ink); font-size: 15px; line-height: 1.7; }
.privacy-page h1 { font-size: 24px; font-weight: 600; }
.privacy-page h2 { margin-top: 24px; font-size: 16px; font-weight: 600; }
.privacy-page ul { padding-left: 20px; list-style: disc; }

.research-partial { margin: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--muted); font-size: 12px; }
.card-loading { display: grid; gap: 8px; }
.card-loading span { display: block; height: 12px; border-radius: 4px; background: var(--hover); animation: card-pulse 1.2s ease-in-out infinite; }
.card-loading span:nth-child(2) { width: 82%; }
.card-loading span:nth-child(3) { width: 64%; }
@keyframes card-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .card-loading span { animation: none; } }
.chart-zoom-reset { position: absolute; top: 6px; right: 6px; z-index: 2; padding: 4px 10px; font-size: 12px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.chart-zoom-reset:hover { background: var(--hover); }
.chart-zoom-reset[hidden] { display: none; }
.chart-zoom-hint { margin: 6px 0 0; font-size: 11px; color: var(--muted); text-align: right; }

/* Tax estimate */
.tax-intro { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.tax-intro h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; color: var(--ink); }
.tax-intro .note { margin: 0; max-width: 640px; }
.tax-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.tax-form { display: grid; gap: 14px; }
.tax-group { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 12px; margin: 0; padding: 0; border: 0; }
.tax-group legend { grid-column: 1 / -1; padding: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.tax-group > .note, .tax-group > .tax-check { grid-column: 1 / -1; margin: 0; }
.tax-field { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.tax-field input, .tax-field select { width: 100%; font-variant-numeric: tabular-nums; }
.tax-year { min-width: 160px; }
.tax-check { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); }
.tax-check input { margin-top: 2px; }
.tax-result { display: grid; gap: 12px; position: sticky; top: 72px; }
.tax-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.tax-card h3, .tax-h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.tax-h3 { margin-bottom: 10px; }
.tax-card.is-best { border-color: var(--gain); }
.tax-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; color: var(--gain); border: 1px solid var(--gain); }
.tax-total { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.tax-total small { display: block; font-size: 11px; color: var(--muted); }
.tax-total b { font-size: 18px; font-weight: 600; color: var(--ink); }
.tax-lines { margin: 0; display: grid; gap: 2px; font-size: 12px; }
.tax-lines div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.tax-lines dt { color: var(--muted); }
.tax-lines dd { margin: 0; color: var(--ink); }
.tax-lines .is-sum { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; font-weight: 600; }
.tax-rules ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
@media (max-width: 1024px) {
  .tax-layout { grid-template-columns: 1fr; }
  .tax-result { position: static; }
}
@media (max-width: 480px) {
  .tax-total { grid-template-columns: 1fr 1fr; }
  .tax-total b { font-size: 16px; }
}

/* Smart money */
.smart { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.smart-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; }
.smart-head h2 { margin: 0 0 2px; font-size: 16px; font-weight: 600; color: var(--ink); }
.smart-head .note { margin: 0; }
.smart-investors { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.smart-chip { flex: 0 0 auto; display: grid; gap: 1px; text-align: left; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); cursor: pointer; }
.smart-chip b { font-size: 13px; font-weight: 500; }
.smart-chip small { font-size: 11px; color: var(--muted); }
.smart-chip:hover { background: var(--hover); }
.smart-chip.is-on { border-color: var(--accent); background: var(--hover); }
.smart-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 6px 0 14px; }
.smart-meta small { display: block; font-size: 11px; color: var(--muted); }
.smart-meta b { font-size: 15px; font-weight: 600; color: var(--ink); }
.smart-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; }
.smart-h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--ink); }
.smart-bars, .smart-changes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.smart-bars li { display: grid; grid-template-columns: minmax(96px, 150px) minmax(0, 1fr) 52px; gap: 10px; align-items: center; font-size: 12px; }
.smart-bars .figure, .smart-changes .figure { text-align: right; color: var(--ink); }
.smart-bar { height: 8px; border-radius: 4px; background: var(--hover); overflow: hidden; }
.smart-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.smart-changes li { display: grid; grid-template-columns: 88px minmax(0, 1fr) 52px; gap: 10px; align-items: center; font-size: 12px; }
.smart-name { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smart-action { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; text-align: center; white-space: nowrap; border: 1px solid currentColor; }
.smart-action.is-buy { color: var(--gain); }
.smart-action.is-sell { color: var(--loss); }
.smart-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.congress-list { list-style: none; margin: 0; padding: 0; }
.congress-row { display: grid; grid-template-columns: 92px minmax(0, 1.4fr) minmax(0, 1fr) 140px 150px 28px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.congress-stock, .congress-who { display: grid; gap: 2px; min-width: 0; }
.congress-stock small, .congress-who small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.congress-who b { font-weight: 500; color: var(--ink); }
.congress-amount { color: var(--ink); }
.congress-dates { display: grid; grid-template-columns: auto 1fr; gap: 0 6px; }
.congress-dates small { color: var(--muted); }
.congress-source { color: var(--muted); display: inline-flex; }
.congress-source:hover { color: var(--accent); }
.congress-source svg { width: 16px; height: 16px; }
@media (max-width: 900px) {
  .smart-grid { grid-template-columns: 1fr; }
  .smart-meta { grid-template-columns: 1fr 1fr; }
  .congress-row { grid-template-columns: 80px minmax(0, 1fr) 28px; }
  .congress-who, .congress-amount, .congress-dates { grid-column: 2 / 3; }
  .congress-source { grid-row: 1; grid-column: 3; }
}
.smart-bars .link-ticker, .smart-changes .link-ticker, .smart-bars .smart-name, .smart-changes .smart-name { justify-self: start; text-align: left; min-width: 0; }

/* Colour: green and red speak only about gains and losses; actions and progress use the brand */
.btn-solid { color: var(--paper) !important; background: var(--ink); }
.btn-solid:hover { background: var(--accent); }
.bg-accent { background: var(--accent); }
.bg-accent-soft { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.border-accent-soft { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.text-accent { color: var(--accent); }
.bg-hover { background: var(--hover); }

/* Tables: numbers line up on the right, headers stay quiet */
.data-table th, .data-table td { vertical-align: middle; }
.data-table th.num, .data-table td.num { text-align: right; font-family: "Lato", "IBM Plex Sans Thai", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.data-table th.num { font-family: inherit; }
.data-table thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; border-bottom: 1px solid var(--line); }
.data-table tbody tr:hover { background: var(--hover); }
#holdings-table td.text-right, #holdings-table th.text-right { font-variant-numeric: tabular-nums; }

/* Empty states tell the reader what to do next */
.empty-state { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px; padding: 18px 12px; border: 1px dashed var(--line); border-radius: 8px; text-align: center; }
.empty-state p { margin: 0; font-size: 13px; color: var(--muted); }
.empty-state .btn-text { font-size: 13px; color: var(--accent); }

/* Phones: each row of a data table becomes a small labelled card */
@media (max-width: 640px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tbody { border: 0; }
  .data-table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .data-table td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 2px !important; white-space: normal !important; text-align: right; }
  .data-table td::before { content: attr(data-label); font-family: "Nunito", "IBM Plex Sans Thai", system-ui, sans-serif; color: var(--muted); font-size: 11px; text-align: left; flex: none; max-width: 45%; }
  .data-table td[data-label=""]::before { content: none; }
  .data-table td[data-label=""] { justify-content: flex-end; }
  .data-table .overflow-x-auto { overflow: visible; }
}

/* The headline value reads better in the text face; its digits are still fixed width */
.nav-value { font-family: "Lato", "IBM Plex Sans Thai", system-ui, sans-serif; font-weight: 700; letter-spacing: -0.02em; }

/* Insider trades: whether a sale was planned in advance */
.insider-why { min-width: 170px; }
.insider-plan-row { display: flex; align-items: center; gap: 6px; }
.insider-plan { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.insider-plan.is-tax { background: color-mix(in srgb, #c9a227 16%, transparent); color: #8a6d12; }
.insider-plan.is-none { background: var(--hover); color: var(--muted); font-weight: 500; }
.insider-why small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.insider-doc { display: inline-grid; place-items: center; color: var(--muted); }
.insider-doc svg { width: 14px; height: 14px; }
.insider-doc:hover { color: var(--ink); }
.attention-icon { flex: none; width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center; background: var(--hover); color: var(--accent); }
.attention-icon svg { width: 13px; height: 13px; }


.party { display: inline-block; min-width: 16px; padding: 0 4px; border-radius: 4px; font-size: 10px; font-weight: 600; text-align: center; color: #fff; }
.party-D { background: #2f63b8; }
.party-R { background: #c0392b; }
#smart-politician .congress-list { max-height: 560px; overflow-y: auto; }

.tax-upload { margin-top: 12px; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; }
.tax-upload-head b { display: block; font-size: 13px; font-weight: 600; }
.tax-upload-head small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.tax-upload-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.tax-upload-row select { width: auto; }
.tax-upload-row input[type=file] { flex: 1; min-width: 180px; }

.dcf-wacc { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 16px; margin: 0; font-size: 12px; }
.dcf-wacc div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.dcf-wacc dt { color: var(--muted); }
.dcf-wacc dd { margin: 0; }
.dcf-wacc .is-sum dt, .dcf-wacc .is-sum dd { color: var(--ink); font-weight: 600; }

/* Broker ratings */
.analyst-summary { display: grid; gap: 12px; }
.analyst-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--hover); }
.analyst-bar i { display: block; height: 100%; }
.analyst-bar .is-buy { background: var(--gain); }
.analyst-bar .is-hold { background: #c9a227; }
.analyst-bar .is-sell { background: var(--loss); }
.analyst-counts { display: flex; gap: 14px; margin: 6px 0 0; font-size: 12px; }
.analyst-counts .is-buy { color: var(--gain); }
.analyst-counts .is-hold { color: #a5841c; }
.analyst-counts .is-sell { color: var(--loss); }
.rating { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.rating.is-buy { background: color-mix(in srgb, var(--gain) 14%, transparent); color: var(--gain); }
.rating.is-hold { background: color-mix(in srgb, #c9a227 18%, transparent); color: #8a6d12; }
.rating.is-sell { background: color-mix(in srgb, var(--loss) 14%, transparent); color: var(--loss); }
#analyst-card td small { display: block; font-size: 11px; color: var(--muted); }

/* Ten-year statements: Qualtrim-style palette, kept inside this page */
.deep { display: grid; gap: 16px; }
.deep-skeleton { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.deep-card { background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: 0 1px 2px rgb(0 0 0 / 4%); min-width: 0; }
.deep-card header h3 { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0; }
.deep-card header p { font-size: 12px; color: var(--muted); margin: 2px 0 10px; }
.deep-hero { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.deep-title { display: flex; gap: 10px; align-items: center; }
.deep-title h2 { margin: 0; font-size: 20px; font-weight: 600; }
.deep-views button.is-on { background: #009bf5; color: #fff; }
.deep-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.deep-stat { background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.deep-stat small { display: block; font-size: 11px; color: var(--muted); }
.deep-stat b { display: block; font-size: 18px; font-weight: 600; margin-top: 2px; font-feature-settings: "tnum"; }
.deep-stat em { font-style: normal; font-size: 11px; color: #fa7a1e; }
.deep-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); }
.deep-grid > div:not(.hidden) { display: contents; }
.deep-chart { position: relative; height: 240px; }
.deep-chart.is-tall { height: 280px; }
.deep-kpi-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.deep-kpi-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-bottom: 12px; }
.deep-kpi-chip { text-align: left; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: transparent; }
.deep-kpi-chip.is-on { border-color: #009bf5; box-shadow: inset 0 0 0 1px #009bf5; }
.deep-kpi-chip small { display: block; font-size: 11px; color: var(--muted); }
.deep-kpi-chip b { display: block; font-size: 17px; font-weight: 600; font-feature-settings: "tnum"; }
.deep-kpi-chip em { font-style: normal; font-size: 11px; }
.deep-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.deep-chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--hover); }
.deep-table-head { overflow-x: auto; margin-bottom: 10px; }
.deep-table-head .seg { flex-wrap: nowrap; }
.deep-table-head button.is-on { background: #009bf5; color: #fff; }
.deep-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.deep-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.deep-table th, .deep-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.deep-table thead th { position: sticky; top: 0; background: var(--panel, #fff); color: var(--muted); font-weight: 500; }
.deep-table tbody th { text-align: left; font-weight: 500; position: sticky; left: 0; background: var(--panel, #fff); }
.deep-table .num { text-align: right; font-family: "Lato", "IBM Plex Sans Thai", system-ui, sans-serif; font-feature-settings: "tnum"; }
.deep-table td small { display: block; font-size: 10px; }
.deep-table .deep-cagr { background: color-mix(in srgb, #fa7a1e 7%, transparent); }
.deep-banner { display: flex; align-items: center; gap: 8px; width: 100%; margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, #009bf5 35%, transparent);
  background: color-mix(in srgb, #009bf5 8%, transparent); color: var(--ink); font-size: 13px; text-align: left; }
.deep-banner span { flex: 1; }
.deep-banner svg { width: 16px; height: 16px; color: #009bf5; }
/* A politician's own trades sit in a half-width column, so each trade takes two lines */
.congress-row.is-compact { grid-template-columns: 80px minmax(0, 1fr) 24px; gap: 4px 10px; }
.congress-row.is-compact .congress-amount, .congress-row.is-compact .congress-dates { grid-column: 2 / 3; }
.congress-row.is-compact .congress-dates { grid-template-columns: auto auto auto auto; justify-content: start; }
.congress-row.is-compact .congress-source { grid-row: 1; grid-column: 3; }
.congress-row.is-compact .congress-stock .link-ticker { justify-self: start; }

/* Options hub */
.opt-page { display: grid; gap: 16px; }
.opt-num { font-family: "Lato", "IBM Plex Sans Thai", system-ui, sans-serif; font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.opt-hero { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; }
.opt-title { display: flex; gap: 10px; align-items: center; }
.opt-title h2 { margin: 0; font-size: 20px; font-weight: 600; }
.opt-title h2 .opt-num { font-weight: 500; color: var(--muted); margin-left: 6px; }
.opt-expiry { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.opt-expiry select { min-width: 150px; }
.opt-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.opt-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.opt-stat small { display: flex; gap: 4px; align-items: center; font-size: 11px; color: var(--muted); }
.opt-stat b { display: block; font-size: 20px; font-weight: 600; margin-top: 2px; }
.opt-stat em { display: block; font-style: normal; font-size: 11px; color: var(--muted); margin-top: 2px; }
.opt-tip { cursor: help; color: var(--muted); font-size: 12px; }
.opt-tip:hover, .opt-tip:focus { color: #009bf5; outline: none; }
.opt-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; min-width: 0; }
.opt-card-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: flex-end; margin-bottom: 12px; }
.opt-card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.opt-card-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.opt-strategies { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); }
.opt-strategy { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.opt-strategy header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.opt-strategy h4 { margin: 0; font-size: 14px; font-weight: 600; }
.opt-strategy header span { font-size: 11px; color: var(--muted); }
.opt-legs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12px; }
.opt-legs small { color: var(--muted); }
.opt-chart { position: relative; height: 180px; }
.opt-chart.is-tall { height: 320px; }
.opt-card > .opt-chart { height: 260px; }
.opt-card > .opt-chart.is-tall { height: 340px; }
.opt-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 0; font-size: 12px; }
.opt-facts div { display: flex; justify-content: space-between; gap: 6px; border-bottom: 1px solid var(--line); padding: 3px 0; }
.opt-facts dt { color: var(--muted); }
.opt-facts dd { margin: 0; text-align: right; }
.opt-facts small { color: var(--muted); }
.is-gain { color: #0f9f6e; }
.is-loss { color: #dc3a3a; }
.opt-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--hover); color: var(--muted); white-space: nowrap; }
.opt-badge.is-gain { background: rgba(16, 185, 129, 0.14); color: #0f9f6e; }
.opt-badge.is-loss { background: rgba(239, 68, 68, 0.14); color: #dc3a3a; }
.opt-regime { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px 16px; border-radius: 14px; font-size: 13px; }
.opt-regime.is-gain { background: rgba(16, 185, 129, 0.1); }
.opt-regime.is-loss { background: rgba(239, 68, 68, 0.1); }
.opt-regime b { font-weight: 600; }
.opt-warn { margin: 0; padding: 10px 14px; border-radius: 12px; font-size: 12px; background: color-mix(in srgb, #fa7a1e 10%, transparent); color: var(--ink); }
.opt-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.opt-table-wrap.is-chain { max-height: 640px; overflow-y: auto; }
.opt-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.opt-table th, .opt-table td { padding: 7px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left; }
.opt-table thead th { position: sticky; top: 0; background: var(--panel); color: var(--muted); font-weight: 500; z-index: 1; }
.opt-table .num { text-align: right; font-family: "Lato", "IBM Plex Sans Thai", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.opt-chain .opt-strike { text-align: center; font-weight: 600; background: var(--hover); position: sticky; left: 0; }
.opt-chain td.is-itm { background: color-mix(in srgb, #009bf5 7%, transparent); }
.opt-chain tr.is-atm td, .opt-chain tr.is-atm th { border-top: 2px solid #009bf5; }
.opt-side { text-align: center !important; font-weight: 600 !important; }
.opt-side.is-call { color: #0f9f6e !important; }
.opt-side.is-put { color: #dc3a3a !important; }

/* Brokers */
.broker-chip { display: inline-flex; align-items: center; gap: 4px; margin-top: 3px; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; color: var(--muted); border: 1px dashed var(--line); background: transparent; }
.broker-chip svg { width: 11px; height: 11px; }
.broker-chip.is-set { border-style: solid; color: var(--ink); background: var(--hover); }
.tx-broker { display: block; font-size: 10.5px; color: var(--muted); }
.broker-dialog { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgb(15 23 42 / 55%); }
.broker-box { width: min(440px, 100%); background: var(--panel); border-radius: 16px; padding: 18px; display: grid; gap: 10px; box-shadow: 0 20px 50px rgb(0 0 0 / 25%); }
.broker-box h3 { margin: 0; font-size: 16px; font-weight: 600; }
.broker-rates { margin: 0; padding-left: 18px; font-size: 12px; color: var(--muted); display: grid; gap: 4px; }
.broker-rates b { color: var(--ink); font-weight: 600; }
.broker-actions { display: flex; justify-content: flex-end; gap: 8px; }

.attention-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.attention-chip { font-size: 11.5px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); }
.attention-chip em { font-style: normal; font-family: "Lato", "IBM Plex Sans Thai", system-ui, sans-serif; font-variant-numeric: tabular-nums; opacity: 0.8; }
.attention-chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--panel); }
.attention-pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.attention-pager button[disabled] { opacity: 0.35; pointer-events: none; }

/* Qualtrim-style valuation */
.val-card-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: flex-start; }
.val-card-head .seg button.is-on, .deep-views button.is-on { background: #009bf5; color: #fff; }
.val-tool { display: grid; gap: 14px; }
.val-num, .val-input { font-family: "Lato", "IBM Plex Sans Thai", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.val-top { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-end; }
.val-base { display: flex; flex-wrap: wrap; gap: 18px; }
.val-base small { display: block; font-size: 11px; color: var(--muted); }
.val-base b { font-size: 17px; font-weight: 600; }
.val-globals { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); }
.val-globals label { display: inline-flex; align-items: center; gap: 6px; }
.val-input { width: 76px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font-size: 13px; text-align: right; }
.val-input:focus { outline: 2px solid #009bf5; outline-offset: -1px; }
.val-table-wrap { overflow-x: auto; }
.val-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.val-table th, .val-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
.val-table thead th { font-size: 12px; font-weight: 600; text-align: right; }
.val-table thead th:first-child { text-align: left; color: var(--muted); font-weight: 500; }
.val-table tbody th { text-align: left; font-weight: 500; min-width: 190px; }
.val-table tbody th span { display: block; }
.val-table tbody th small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; }
.val-table td { text-align: right; }
.val-table .val-sep th { padding-top: 14px; font-size: 12px; color: var(--muted); font-weight: 600; }
.val-table tr.is-key td, .val-table tr.is-key th { background: color-mix(in srgb, #009bf5 6%, transparent); }
.val-na { color: var(--muted); }
.val-chart { position: relative; height: 220px; }

/* Qualtrim-style deep dive: one clean chart per figure */
.deep, .deep-kpi-chip, .deep-stat, .deep-metric { font-family: "Lato", "IBM Plex Sans Thai", system-ui, sans-serif; }
.deep-num { font-family: "Lato", "IBM Plex Sans Thai", system-ui, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.deep-stat b { font-family: "Lato", "IBM Plex Sans Thai", system-ui, sans-serif; font-size: 20px; letter-spacing: -0.02em; }
.deep-metrics { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.deep-metric { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 10px; box-shadow: 0 1px 2px rgb(0 0 0 / 4%); min-width: 0; }
.deep-metric header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.deep-metric h4 { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); }
.deep-metric header div { text-align: right; display: grid; gap: 3px; justify-items: end; }
.deep-metric header b { font-size: 16px; font-weight: 600; }
.deep-metric .deep-chart { height: 170px; }
.deep-badge { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, #009bf5 12%, transparent); color: #0b7fc4; font-variant-numeric: tabular-nums; }
.deep-kpi-chip small i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: baseline; }
.deep-seg-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.deep-seg-controls button.is-on { background: #009bf5; color: #fff; }
.deep-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #0b7fc4; }
.deep-live i { width: 8px; height: 8px; border-radius: 999px; background: #009bf5; animation: deep-pulse 1.2s ease-in-out infinite; }
@keyframes deep-pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .deep-live i { animation: none; } }

/* Company insights: white cards on a light grey canvas, Lato, one colour per figure */
.qt { --qt-canvas: #f3f5f8; --qt-card: #ffffff; --qt-ink: #1f2937; --qt-muted: #6b7280; --qt-line: #e5e7eb; --qt-soft: #f3f4f6; --qt-blue: #1e9be9;
  font-family: Lato, "IBM Plex Sans Thai", sans-serif; display: grid; gap: 14px; background: var(--qt-canvas); margin: -16px; padding: 16px; color: var(--qt-ink); }
html.dark .qt { --qt-canvas: #14161a; --qt-card: #1d2026; --qt-ink: #e5e7eb; --qt-muted: #9ca3af; --qt-line: #2d3139; --qt-soft: #262a31; }
.qt-card { background: var(--qt-card); border-radius: 10px; padding: 16px 18px; box-shadow: 0 1px 3px rgb(15 23 42 / 6%); min-width: 0; }
.qt-muted { color: var(--qt-muted); font-size: 13px; margin: 0; }
.qt-foot { color: var(--qt-muted); font-size: 11.5px; margin: 0; }
.qt-num { font-variant-numeric: tabular-nums; }
.qt-h3 { margin: 0 0 10px; font-size: 16px; font-weight: 700; color: var(--qt-ink); }
.qt-head { display: grid; justify-items: center; gap: 10px; text-align: center; }
.qt-search { display: flex; width: min(100%, 460px); border: 1px solid var(--qt-line); border-radius: 8px; overflow: hidden; background: var(--qt-card); }
.qt-search input { flex: 1; min-width: 0; border: 0; padding: 9px 12px; background: transparent; color: var(--qt-ink); font: inherit; outline: none; }
.qt-search-btn { padding: 0 16px; border-left: 1px solid var(--qt-line); background: var(--qt-soft); color: var(--qt-ink); font-size: 13px; }
.qt-identity { display: flex; align-items: center; gap: 12px; text-align: left; }
.qt-identity h2 { margin: 0; font-size: 22px; font-weight: 400; }
.qt-identity p { margin: 0; color: var(--qt-muted); font-size: 14px; }
.qt-identity.is-small h3 { margin: 0; font-size: 15px; font-weight: 700; }
.qt-price { display: flex; align-items: center; gap: 10px; }
.qt-price b { font-size: 24px; font-weight: 700; }
.qt-change { font-size: 13px; padding: 2px 9px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.qt-change.is-up, .qt-price-chip.is-up { background: #e6f4ea; color: #2e7d32; }
.qt-change.is-down, .qt-price-chip.is-down { background: #fdecea; color: #c62828; }
.qt-link { color: var(--qt-blue); font-weight: 400; }
.qt-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.qt-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px 28px; }
.qt-stats.is-compact { grid-template-columns: 1fr; gap: 0; margin: 10px 0; }
.qt-stat-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--qt-line); font-size: 13px; }
.qt-stat-row span { color: var(--qt-muted); }
.qt-stat-row span small { display: block; font-size: 11px; font-weight: 700; color: var(--qt-ink); }
.qt-stat-row b { font-weight: 700; text-align: right; }
.qt-period { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.qt-period button, .qt-tabs button, .qt-ratio-tabs button { padding: 6px 14px; border-radius: 7px; font-size: 13px; color: var(--qt-ink); background: transparent; border: 1px solid transparent; }
.qt-period button.is-on, .qt-tabs button.is-on { background: var(--qt-blue); color: #fff; }
.qt-ratio-tabs { display: flex; flex-wrap: wrap; margin-bottom: 6px; border: 1px solid #b9dcf5; border-radius: 6px; overflow: hidden; width: fit-content; }
.qt-ratio-tabs button { border-radius: 0; font-size: 11px; padding: 3px 9px; color: var(--qt-blue); }
.qt-ratio-tabs button.is-on { background: #dcefff; }
.qt-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.qt-grid:empty { display: none; }
/* Three charts a row on a computer, two on a tablet, one on a phone */
@media (min-width: 700px) { .qt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .qt-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
#qt-grid-overview { grid-template-columns: 1fr; }
.qt-chart-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.qt-chart-card h4 { margin: 0; font-size: 14px; font-weight: 400; display: flex; align-items: center; gap: 8px; }
.qt-chart { position: relative; height: 190px; }
.qt-kpi { display: inline-grid; place-items: center; padding: 3px 6px; border-radius: 4px; background: #f8a5a5; color: #fff; font-size: 10px; font-weight: 700; }
.qt-expand { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; background: var(--qt-soft); color: var(--qt-muted); flex: none; }
.qt-expand svg { width: 14px; height: 14px; }
.qt-price-chip { font-size: 11px; padding: 1px 7px; border-radius: 5px; margin-left: auto; }
.qt-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.qt-chips span { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--qt-soft); color: var(--qt-muted); }
.qt-two { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.qt-summary { margin: 12px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--qt-muted); max-height: 160px; overflow-y: auto; }
.qt-est-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.qt-est-head .qt-h3 { margin: 0; }
.qt-targets { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--qt-line); }
.qt-targets-asof { margin: 2px 0 0; font-size: 12px; }
.qt-target-pill { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; white-space: nowrap; }
.qt-target-pill.is-buy { background: var(--gain); }
.qt-target-pill.is-hold { background: #8b929c; }
.qt-target-pill.is-sell { background: var(--loss); }
.qt-targets .is-up { color: var(--gain); }
.qt-targets .is-down { color: var(--loss); }
/* Analysts card: monthly ratings, the firms with the best record on this stock, then each firm's latest call */
.qt-rating-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 4px; font-size: 12px; color: var(--qt-ink); }
.qt-rating-legend span { display: inline-flex; align-items: center; gap: 6px; }
.qt-rating-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.qt-rating-legend i.is-line { height: 2px; width: 14px; border-radius: 1px; background: var(--qt-blue); }
.qt-rating-chart { height: 170px; margin-bottom: 6px; }
.qt-rank { margin-top: 14px; }
.qt-rank h4, .qt-broker-head { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--qt-ink); }
.qt-rank ol { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.qt-rank li { counter-increment: rank; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; grid-template-areas: "n firm stars ret" "n rate rate ret"; align-items: center; gap: 0 10px; padding: 8px 0; border-bottom: 1px solid var(--qt-line); font-size: 13px; }
.qt-rank li:last-child { border-bottom: 0; }
.qt-rank li::before { content: counter(rank); grid-area: n; font-weight: 800; color: var(--qt-muted); }
.qt-rank li > b { grid-area: firm; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt-rank li > .qt-stars { grid-area: stars; }
.qt-rank li > span:nth-of-type(2) { grid-area: rate; color: var(--qt-muted); font-size: 12px; }
.qt-rank li > span:last-child { grid-area: ret; font-weight: 700; font-variant-numeric: tabular-nums; }
.qt-rank small { color: var(--qt-muted); }
.qt-stars { color: #e3a008; letter-spacing: 1px; font-size: 13px; white-space: nowrap; }
.qt-stars i { font-style: normal; color: var(--qt-line); }
.qt-broker-head { margin-top: 16px; }
.qt-broker-row { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 2px 8px; scrollbar-width: thin; }
.qt-broker-row:focus-visible { outline: 2px solid var(--qt-blue); outline-offset: 2px; border-radius: 10px; }
.qt-broker { flex: 0 0 220px; scroll-snap-align: start; display: grid; gap: 6px; align-content: start; padding: 12px; border: 1px solid var(--qt-line); border-radius: 12px; background: var(--qt-card); }
.qt-broker header, .qt-broker footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.qt-broker header b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt-broker-move { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.qt-broker p { margin: 0; font-size: 12px; color: var(--qt-muted); }
.qt-broker footer small { color: var(--qt-muted); font-size: 11.5px; white-space: nowrap; }
@media (max-width: 640px) { .qt-broker { flex-basis: 78%; } }
.qt-targets-note { font-size: 11.5px; margin: 10px 0 0; }
.qt-tabs { display: flex; flex-wrap: wrap; gap: 2px; }
.qt-tabs button { padding: 4px 10px; font-size: 12px; }
.qt-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.qt-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.qt-table th, .qt-table td { padding: 8px 10px; border-bottom: 1px solid var(--qt-line); white-space: nowrap; text-align: left; }
.qt-table thead th { color: var(--qt-muted); font-weight: 400; }
.qt-table .num { text-align: right; }
/* The row names stay put while the figures scroll sideways, as on Fiscal.ai */
.qt-table th:first-child, .qt-table td:first-child, .gd-table th:first-child { position: sticky; left: 0; z-index: 1; background: var(--qt-card); }
.qt-table.is-wide tbody th { position: sticky; left: 0; background: var(--qt-card); font-weight: 400; }
.qt-cagr-cell { background: color-mix(in srgb, #1e9be9 7%, transparent); }
.qt-news { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.qt-news li { display: grid; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--qt-line); }
.qt-news a { color: var(--qt-ink); font-weight: 700; font-size: 14px; }
.qt-news small { color: var(--qt-muted); font-size: 11.5px; }
.qt-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgb(15 23 42 / 45%); }
.qt-modal-box { width: min(1100px, 100%); background: var(--panel); color: var(--ink); border-radius: 10px; padding: 18px; display: grid; gap: 10px; font-family: Lato, "IBM Plex Sans Thai", sans-serif; }
.qt-modal-box header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.qt-modal-tools { display: flex; gap: 8px; align-items: center; }
.qt-modal-tools select { width: auto; }
.qt-modal-chart { position: relative; height: min(60vh, 460px); }
.qt-cagr { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.qt-cagr span { font-size: 12px; padding: 2px 8px; border-radius: 5px; font-variant-numeric: tabular-nums; }
.qt-cagr .is-up { background: #e6f4ea; color: #2e7d32; }
.qt-cagr .is-down { background: #fdecea; color: #c62828; }
.qt .is-up { color: #2e7d32; }
.qt .is-down { color: #c62828; }
.dcf-layout { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: start; }
.dcf-current, .dcf-results { border: 1px solid var(--qt-line); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; text-align: center; }
.dcf-current > p, .dcf-results > p { margin: 0 0 8px; font-size: 13px; }
.dcf-current > div, .dcf-results > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; text-align: left; }
.dcf-current small, .dcf-results small { display: block; font-size: 11px; color: var(--qt-muted); }
.dcf-current b { font-size: 14px; font-weight: 700; }
.dcf-results b { font-size: 18px; font-weight: 700; }
.dcf-field { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 12px; align-items: center; margin-bottom: 14px; font-size: 13px; }
.dcf-field small { grid-column: 2; font-size: 11px; color: var(--qt-muted); }
.dcf-input { display: flex; border: 1px solid var(--qt-line); border-radius: 7px; overflow: hidden; }
.dcf-input input { flex: 1; min-width: 0; border: 0; padding: 8px 10px; background: transparent; color: var(--qt-ink); font: inherit; font-variant-numeric: tabular-nums; outline: none; }
.dcf-input:focus-within { border-color: #43a047; box-shadow: 0 0 0 2px rgb(67 160 71 / 15%); }
.dcf-input em { font-style: normal; padding: 0 10px; display: grid; place-items: center; background: var(--qt-soft); color: var(--qt-muted); }
.dcf-toggle { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--qt-muted); margin: -6px 0 14px 162px; }
.dcf-chart { position: relative; height: 300px; }
.dcf-buttons { display: flex; gap: 8px; }
.earn-head { display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; align-items: center; }
.earn-search { grid-column: 1 / -1; width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--qt-line); background: var(--qt-card); color: var(--qt-ink); font-size: 14px; }
.earn-group p small { color: var(--qt-muted); font-weight: 600; }
.earn-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.earn-week { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.earn-day h4 { margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.earn-group p { display: flex; align-items: center; gap: 5px; margin: 8px 0 6px; font-size: 11.5px; color: var(--qt-muted); }
.earn-group p svg { width: 13px; height: 13px; }
.earn-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.earn-tile { display: grid; justify-items: center; gap: 3px; padding: 8px 4px; border-radius: 8px; border: 1px solid var(--qt-line); background: var(--qt-card); color: var(--qt-ink); font-size: 11px; }
.earn-tile:hover { border-color: var(--qt-blue); }
.earn-tile.is-followed { border-color: #f59e0b; box-shadow: inset 0 0 0 1px #f59e0b; }
.earn-detail { display: grid; gap: 12px; }
@media (max-width: 640px) {
  .qt { margin: -12px; padding: 12px; }
  .dcf-field { grid-template-columns: 1fr; }
  .dcf-field small { grid-column: 1; }
  .dcf-toggle { margin-left: 0; }
}
/* The chosen period and mode stand out with a solid frame */
.qt-period button { border: 1px solid var(--qt-line); background: var(--qt-card); }
.qt-period button.is-on { background: var(--qt-blue); border-color: #0b6fb0; color: #fff; box-shadow: 0 0 0 2px rgb(30 155 233 / 25%); font-weight: 700; }
.qt-ratio-tabs button.is-on { background: var(--qt-blue); color: #fff; font-weight: 700; }
.qt-tabs button.is-on { box-shadow: 0 0 0 2px rgb(30 155 233 / 25%); font-weight: 700; }

/* Yahoo-style price chart */
.pc-wrap { display: grid; gap: 8px; }
.pc-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px; }
.pc-quote { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.pc-price { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pc-move { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pc-move.is-up { color: #16a34a; }
.pc-move.is-down { color: #dc2626; }
.pc-note { color: var(--muted); font-size: 12px; }
.pc-ranges { display: flex; flex-wrap: wrap; gap: 2px; }
.pc-ranges button { padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--muted); background: transparent; }
.pc-ranges button:hover { color: var(--ink); background: var(--hover); }
.pc-ranges button.is-on { color: #fff; background: #1e9be9; }
@media (max-width: 640px) {
  .pc-ranges { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .pc-ranges::-webkit-scrollbar { display: none; }
  .pc-ranges button { flex: none; padding: 4px 8px; }
}
.pc-canvas { position: relative; height: 300px; }
.pc-loading { position: absolute; inset: 40% 30% auto; }
/* Market overview */
.mk-top { display: grid; gap: 14px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .mk-top { grid-template-columns: 1fr; } }
.mk-index-card { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; }
@media (max-width: 720px) { .mk-index-card { grid-template-columns: 1fr; } }
.mk-index-list { display: grid; align-content: start; gap: 2px; }
.mk-index { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; text-align: left; background: transparent; color: var(--qt-ink); }
.mk-index:hover { background: var(--qt-soft); }
.mk-index.is-on { background: var(--qt-soft); box-shadow: inset 3px 0 0 #1e9be9; font-weight: 700; }
.mk-index-name { font-size: 14px; }
.mk-index-quote { display: grid; justify-items: end; gap: 2px; font-size: 12px; }
.mk-chip { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--qt-soft, #f3f4f6); color: var(--muted); white-space: nowrap; }
.mk-chip.is-up { background: #dcfce7; color: #15803d; }
.mk-chip.is-down { background: #fee2e2; color: #b91c1c; }
.mk-mood-head { display: flex; justify-content: space-between; align-items: center; }
.mk-mood-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.mk-gauge-wrap { position: relative; }
.mk-mood-main > .mk-gauge-wrap { width: 100%; max-width: 240px; justify-self: center; }
.mk-gauge.is-lg { width: 100%; display: block; }
.mk-gauge.is-sm { width: 64px; display: block; }
.mk-gauge-text { position: absolute; inset: auto 0 0; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.mk-gauge-text small { display: block; font-size: 12px; color: var(--qt-muted); }
.mk-gauge-text b { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.mk-mood-past { display: grid; gap: 10px; }
.mk-mood-past > div { display: flex; align-items: center; gap: 8px; }
.mk-mood-past small { display: block; font-size: 11px; color: var(--qt-muted); }
.mk-mood-past b { font-size: 16px; }
.mk-mood-past em { display: block; font-style: normal; font-size: 11px; color: var(--qt-muted); }
.mk-vix { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--qt-line); }
.mk-vix small { display: block; font-size: 11px; color: var(--qt-muted); }
.mk-vix b { font-size: 20px; margin-right: 6px; }
.mk-vix > span { font-size: 13px; font-weight: 700; }
.mk-rows { display: grid; }
.mk-row { display: grid; grid-template-columns: 26px 36px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--qt-line); text-align: left; background: transparent; color: var(--qt-ink); }
.mk-row:hover { background: var(--qt-soft); }
.mk-rank { color: var(--qt-muted); font-size: 12px; text-align: center; }
.mk-row-name { min-width: 0; display: grid; }
.mk-row-name b { font-size: 14px; }
.mk-row-name small { font-size: 12px; color: var(--qt-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-weight { font-size: 12px; color: var(--qt-muted); }
.mk-movers { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.mk-movers h4 { margin: 0 0 4px; font-size: 13px; }
.mk-sectors { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.mk-sector { display: grid; gap: 12px; padding: 16px; border-radius: 12px; text-align: left; background: var(--tint); color: #1f2937; border: 0; min-height: 132px; align-content: space-between; }
html.dark .mk-sector { background: color-mix(in srgb, var(--tint) 14%, var(--qt-card)); color: var(--qt-ink); }
.mk-sector:hover { box-shadow: 0 4px 14px rgb(15 23 42 / 10%); }
.mk-logos { display: flex; }
.mk-logos > * { margin-right: -8px; box-shadow: 0 0 0 2px #fff; border-radius: 999px; }
.mk-sector-name { font-size: 15px; font-weight: 700; }
.mk-sector-name small { font-size: 11px; font-weight: 400; opacity: 0.7; }
.mk-sector-foot { display: flex; justify-content: space-between; align-items: center; }
.mk-sector-foot svg { width: 16px; height: 16px; color: #2563eb; }
/* Holdings donut */
.dn-card { display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr); gap: 20px; align-items: center; margin-bottom: 16px; padding: 18px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
@media (max-width: 760px) { .dn-card { grid-template-columns: 1fr; } }
.dn-chart { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1; margin: 0 auto; }
.dn-center { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 4px; pointer-events: none; }
.dn-center b { font-size: 26px; font-weight: 700; padding: 4px 12px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.dn-center b.is-up { background: #dcfce7; color: #15803d; }
.dn-center b.is-down { background: #fee2e2; color: #b91c1c; }
.dn-center select { pointer-events: auto; border: 0; background: transparent; color: var(--ink); font-weight: 700; font-size: 13px; }
.dn-labels { position: absolute; inset: 0; pointer-events: none; }
.dn-badge { position: absolute; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px 2px 2px; border-radius: 999px; background: var(--panel); box-shadow: 0 1px 4px rgb(0 0 0 / 15%); font-size: 10.5px; }
.dn-badge em { font-style: normal; font-weight: 700; color: var(--ink); }
.dn-list { display: grid; gap: 2px; min-width: 0; }
.dn-list-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.dn-list-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.dn-list-head small { color: var(--muted); }
.dn-row { display: grid; grid-template-columns: 8px 36px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 7px 6px; border-radius: 8px; text-align: left; background: transparent; color: var(--ink); }
.dn-row:hover { background: var(--hover); }
.dn-row > i { width: 8px; height: 24px; border-radius: 3px; }
.dn-name { min-width: 0; display: grid; }
.dn-name b { font-size: 14px; }
.dn-name small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dn-weight { font-size: 13px; font-weight: 600; }
.qt-search-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; }

.mk-tiles { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.mk-tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center; padding: 6px 8px; border-radius: 8px; text-align: left; border: 1px solid var(--qt-line); background: var(--qt-card); color: var(--qt-ink); }
.mk-tile > :first-child { grid-row: span 2; }
.mk-tile b { font-size: 12px; line-height: 1.1; }
.mk-tile em { font-style: normal; font-size: 11px; font-weight: 700; }
.mk-tile.is-up { background: color-mix(in srgb, #16a34a 7%, var(--qt-card)); }
.mk-tile.is-up em { color: #15803d; }
.mk-tile.is-down { background: color-mix(in srgb, #dc2626 7%, var(--qt-card)); }
.mk-tile.is-down em { color: #b91c1c; }
.mk-tile:hover { border-color: #1e9be9; }
.mk-more { margin-top: 10px; }

/* Blossom's Nunito for words and headings, Qualtrim's Lato for every figure */
h1, h2, h3, h4, .group-btn, .tab-btn, .btn-primary, .btn-text, .seg button { font-family: "Nunito", "IBM Plex Sans Thai", system-ui, sans-serif; }
h1, h2, h3 { letter-spacing: -0.01em; }
.qt, .qt-modal-box { font-family: "Nunito", "IBM Plex Sans Thai", system-ui, sans-serif; }
.qt-num, .qt-price b, .qt-stat-row b, .pc-price, .pc-move, .mk-chip, .dn-center b, .dn-weight, .deep-num, .opt-num, .val-num, .val-input, td.num, .num { font-family: "Lato", "IBM Plex Sans Thai", system-ui, sans-serif; font-variant-numeric: tabular-nums lining-nums; }
.app-version { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); font-family: "Nunito", "IBM Plex Sans Thai", system-ui, sans-serif; }
/* On phones the indexes become one swipeable row, so the chart sits near the top */
@media (max-width: 720px) {
  .mk-index-list { display: flex; overflow-x: auto; gap: 6px; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .mk-index { flex: 0 0 auto; min-width: 140px; scroll-snap-align: start; border: 1px solid var(--qt-line); }
  .mk-index.is-on { box-shadow: inset 0 -3px 0 #1e9be9; }
  .pc-price { font-size: 22px; }
}

.mk-tiles.is-folded { grid-auto-rows: 0; grid-template-rows: auto; row-gap: 0; overflow: hidden; }
.mk-fold { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--qt-line); background: var(--qt-card); color: var(--qt-ink); font-size: 12px; font-weight: 600; white-space: nowrap; }
.mk-fold:hover { border-color: #1e9be9; color: #1e9be9; }
.mk-fold svg { width: 14px; height: 14px; }

/* Learning: course catalogue, lesson reader and glossary */
.lr-hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 24px; background: linear-gradient(135deg, color-mix(in srgb, #1e9be9 10%, var(--qt-card)), var(--qt-card)); }
.lr-hero h2 { font-size: 26px; font-weight: 800; margin: 2px 0 6px; color: var(--qt-ink); }
.lr-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #1e9be9; }
.lr-start { margin-top: 14px; display: inline-flex; align-items: center; gap: 8px; max-width: 100%; }
.lr-start span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-start svg { width: 16px; height: 16px; flex: none; }
.lr-all-done { margin-top: 12px; font-weight: 700; color: #15803d; }
.lr-progress-ring { --p: 0; flex: none; width: 116px; height: 116px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--qt-card) 78%, transparent 79% 100%), conic-gradient(#1e9be9 calc(var(--p) * 1%), var(--qt-soft) 0); }
.lr-progress-ring b { font-size: 22px; color: var(--qt-ink); }
.lr-progress-ring small { font-size: 11px; color: var(--qt-muted); }
.lr-filters { margin: 4px 0 12px; }
.lr-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.lr-course { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: 18px; color: var(--qt-ink); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.lr-course:hover { transform: translateY(-2px); border-color: #1e9be9; box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08); }
.lr-course h3 { font-size: 17px; font-weight: 800; margin-top: 4px; }
.lr-course p { font-size: 13px; color: var(--qt-muted); line-height: 1.55; flex: 1; }
.lr-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, #1e9be9 12%, var(--qt-card)); color: #1e9be9; }
.lr-icon svg { width: 20px; height: 20px; }
.lr-course .lr-level { position: absolute; top: 18px; right: 18px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--qt-soft); color: var(--qt-muted); }
.lr-meta { font-size: 12px; color: var(--qt-muted); }
.lr-bar { width: 100%; height: 6px; border-radius: 999px; background: var(--qt-soft); overflow: hidden; }
.lr-bar i { display: block; height: 100%; background: #16a34a; border-radius: inherit; }
.lr-crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--qt-muted); margin-bottom: 10px; }
.lr-crumbs .btn-text { display: inline-flex; align-items: center; gap: 4px; }
.lr-crumbs svg { width: 14px; height: 14px; }
.lr-reader { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.lr-toc { position: sticky; top: 76px; padding: 14px; }
.lr-toc h4 { font-size: 13px; font-weight: 800; margin-bottom: 8px; color: var(--qt-ink); }
.lr-toc ol { display: grid; gap: 2px; }
.lr-toc button { width: 100%; display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: start; text-align: left; padding: 8px; border-radius: 8px; font-size: 13px; color: var(--qt-ink); line-height: 1.4; }
.lr-toc button:hover { background: var(--qt-soft); }
.lr-toc button.is-on { background: color-mix(in srgb, #1e9be9 12%, var(--qt-card)); font-weight: 700; }
.lr-toc svg { width: 16px; height: 16px; margin-top: 1px; color: var(--qt-muted); }
.lr-toc small { font-size: 11px; color: var(--qt-muted); }
.lr-lesson { padding: 28px clamp(18px, 4vw, 44px); max-width: 820px; }
.lr-lesson h2 { font-size: 28px; font-weight: 800; line-height: 1.25; margin: 4px 0 18px; color: var(--qt-ink); }
.lr-lesson > p, .lr-lesson > ul { font-size: 15.5px; line-height: 1.8; color: var(--qt-ink); margin-bottom: 14px; }
.lr-lesson > ul { padding-left: 20px; list-style: disc; }
.lr-lesson > ul li { margin-bottom: 6px; }
.lr-formula { margin: 16px 0; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--qt-line); background: var(--qt-soft); display: grid; gap: 4px; }
.lr-formula span, .lr-example span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--qt-muted); }
.lr-formula b { font-family: "Lato", "IBM Plex Sans Thai", system-ui, sans-serif; font-size: 16px; color: var(--qt-ink); }
.lr-formula small { font-size: 13px; color: var(--qt-muted); line-height: 1.5; }
.lr-example { margin: 16px 0; padding: 14px 16px; border-left: 4px solid #f59e0b; border-radius: 0 12px 12px 0; background: color-mix(in srgb, #f59e0b 8%, var(--qt-card)); }
.lr-example p { font-size: 14.5px; line-height: 1.7; margin-top: 4px; color: var(--qt-ink); }
.lr-tip { margin: 16px 0; display: grid; grid-template-columns: 20px 1fr; gap: 10px; padding: 14px 16px; border-radius: 12px; background: color-mix(in srgb, #1e9be9 8%, var(--qt-card)); }
.lr-tip svg { width: 18px; height: 18px; color: #1e9be9; margin-top: 2px; }
.lr-tip p { font-size: 14.5px; line-height: 1.7; color: var(--qt-ink); }
.lr-takeaways { margin: 22px 0 14px; padding: 16px; border-radius: 12px; border: 1px solid var(--qt-line); }
.lr-takeaways h4, .lr-quiz h4 { font-size: 14px; font-weight: 800; margin-bottom: 8px; color: var(--qt-ink); }
.lr-takeaways li { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.6; margin-bottom: 4px; color: var(--qt-ink); }
.lr-takeaways svg { width: 16px; height: 16px; color: #16a34a; flex: none; margin-top: 3px; }
.lr-try { margin-bottom: 6px; }
.lr-quiz { margin-top: 18px; padding: 16px; border-radius: 12px; background: var(--qt-soft); }
.lr-quiz > p { font-size: 14.5px; margin-bottom: 10px; color: var(--qt-ink); }
.lr-choices { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.lr-choices button { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--qt-line); background: var(--qt-card); color: var(--qt-ink); font-size: 14px; text-align: left; }
.lr-choices button:hover:not(:disabled) { border-color: #1e9be9; }
.lr-choices button.is-right { border-color: #16a34a; background: color-mix(in srgb, #16a34a 12%, var(--qt-card)); font-weight: 700; }
.lr-choices button.is-wrong { border-color: #dc2626; background: color-mix(in srgb, #dc2626 10%, var(--qt-card)); }
.lr-why { margin-top: 10px; font-size: 14px; line-height: 1.6; color: var(--qt-ink); }
.lr-why.is-right b { color: #15803d; }
.lr-why.is-wrong b { color: #b91c1c; }
.lr-pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--qt-line); }
.lr-pager button { display: inline-flex; align-items: center; gap: 6px; max-width: 48%; }
.lr-pager span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-pager svg { width: 16px; height: 16px; flex: none; }
.lr-search { min-width: 220px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--qt-line); background: var(--qt-card); color: var(--qt-ink); font-size: 14px; }
.lr-glossary { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.lr-glossary > div { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--qt-line); }
.lr-glossary dt { font-weight: 800; font-size: 14px; color: var(--qt-ink); }
.lr-glossary dd { font-size: 13px; color: var(--qt-muted); line-height: 1.55; margin-top: 2px; }
@media (max-width: 900px) {
  .lr-reader { grid-template-columns: 1fr; }
  .lr-toc { position: static; }
  .lr-hero { flex-direction: column-reverse; align-items: flex-start; }
  .lr-progress-ring { width: 92px; height: 92px; }
  .lr-lesson h2 { font-size: 23px; }
  .lr-search { min-width: 0; width: 100%; }
  .lr-pager button { max-width: 60%; }
}

.qt-kpi-more { display: grid; place-items: center; min-height: 120px; }

.scan-thumbs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.scan-thumbs figure { position: relative; margin: 0; }
.scan-thumbs img { height: 112px; width: auto; max-width: 90px; object-fit: cover; border-radius: 10px; border: 1px solid rgb(148 163 184 / 40%); }
.scan-thumbs button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; background: rgb(15 23 42 / 85%); color: #fff; font-size: 12px; }

/* Sector rotation: bars grow left for a loss and right for a gain from a shared zero line */
.mk-rot { display: grid; gap: 20px 32px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); min-width: 0; }
.mk-rot > div { min-width: 0; }
.mk-rot.is-loading { opacity: .55; }
.mk-rot-h { font-size: 13px; font-weight: 600; color: var(--qt-muted, #6b7280); margin: 0 0 6px; }
.mk-rot-sub { margin: -4px 0 12px; font-size: 13px; }
.mk-rot-row { display: grid; grid-template-columns: minmax(0, 46%) minmax(0, 1fr) 62px; grid-template-areas: "name track value"; align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 5px 0; background: none; border: 0; text-align: left; color: inherit; cursor: pointer; border-radius: 6px; }
.mk-rot-row:hover { background: color-mix(in srgb, currentColor 5%, transparent); }
.mk-rot-name { grid-area: name; display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.mk-rot-name b { min-width: 42px; font-variant-numeric: tabular-nums; }
.mk-rot-name span { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mk-rot-name small { font-size: 11px; color: var(--qt-muted, #6b7280); margin-left: auto; padding-right: 4px; white-space: nowrap; }
.mk-rot-track { grid-area: track; position: relative; height: 18px; min-width: 0; }
.mk-rot-track::before { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: color-mix(in srgb, currentColor 22%, transparent); }
.mk-rot-bar { position: absolute; top: 2px; height: 14px; border-radius: 4px; max-width: 50%; transition: width .4s ease; }
.mk-rot-bar.is-up { left: 50%; background: var(--gain, #16a34a); }
.mk-rot-bar.is-down { right: 50%; background: var(--loss, #dc2626); }
.mk-rot-value { grid-area: value; text-align: right; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mk-rot-value.is-up { color: var(--gain, #16a34a); }
.mk-rot-value.is-down { color: var(--loss, #dc2626); }
.mk-rot-stamp { font-weight: 600; color: inherit; display: inline-flex; align-items: center; gap: 6px; }
.mk-rot-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gain, #16a34a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gain, #16a34a) 25%, transparent); }
@media (max-width: 560px) {
  .mk-rot-row { grid-template-columns: minmax(0, 1fr) 62px; grid-template-areas: "name value" "track track"; row-gap: 4px; padding: 6px 0; }
  .mk-rot-name span { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { .mk-rot-bar { transition: none; } }

/* A KPI's Thai name sits under its reported English name */
.qt-chart-title { display: inline-flex; flex-direction: column; min-width: 0; }
.qt-chart-title small { font-size: 12px; font-weight: 400; color: var(--qt-muted, #6b7280); line-height: 1.35; margin-top: 2px; }

@media (max-width: 1023px) {
  html, body { overflow-x: clip; }
}

/* Research views on the company page */
.rs-band-text { font-size: 13px; margin: 4px 0 10px; }
.rs-band-chart { height: 260px; }
.rs-returns-chart { height: 180px; margin-top: 10px; }
.rs-compare-chart { height: 260px; }
.rs-compare-chart.is-loading { opacity: .5; }
.rs-score { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 8px; }
.rs-score b { font-size: 26px; font-weight: 800; }
.rs-score span { font-size: 13px; color: var(--qt-muted); }
.rs-tests { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 2px; }
.rs-tests li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 3px 0; }
.rs-tests li > span { width: 18px; flex: none; text-align: center; font-weight: 700; }
.rs-tests li.is-pass > span { color: var(--gain); }
.rs-tests li.is-fail > span { color: var(--loss); }
.rs-tests li.is-na { opacity: .6; }
.rs-tests small { display: block; color: var(--qt-muted); font-size: 11px; }
.rs-table-wrap { overflow-x: auto; max-width: 100%; }
.rs-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rs-table th, .rs-table td { padding: 6px 8px; border-bottom: 1px solid var(--qt-line); text-align: right; white-space: nowrap; }
.rs-table th:first-child { text-align: left; font-weight: 400; color: var(--qt-muted); }
.rs-table thead th { font-weight: 600; color: var(--qt-ink); }
.rs-table tr.is-on td, .rs-table tr.is-on th { background: color-mix(in srgb, #1e88e5 8%, transparent); }
.rs-table .is-up { color: var(--gain); }
.rs-table .is-down { color: var(--loss); }
#rs-health .is-up, #rs-returns .is-up { color: var(--gain); }
#rs-health .is-down, #rs-returns .is-down { color: var(--loss); }
.rs-compare-pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 10px; position: relative; }
.rs-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; border: 2px solid var(--c); font-size: 12.5px; font-weight: 700; }
.rs-chip button { border: 0; background: none; color: inherit; font-size: 15px; line-height: 1; padding: 0 2px; cursor: pointer; }
.rs-compare-input { border: 1px solid var(--qt-line); border-radius: 8px; padding: 5px 10px; font-size: 13px; width: 170px; background: transparent; color: inherit; }
.rs-metrics { margin-bottom: 8px; }
#qt-revisions:not(:empty) { margin-top: 14px; }

/* Quick lengths for moving averages and RSI */
.cw-presets { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 0 6px 36px; }
.cw-field .cw-presets { padding: 0; }
.cw-presets button { min-width: 40px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; font-variant-numeric: tabular-nums; background: transparent; color: var(--ink); cursor: pointer; }
.cw-presets button.is-on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); font-weight: 700; }
.cw .cw-ind-row { flex-wrap: wrap; }
.cw .cw-ind-row > .cw-presets { flex-basis: 100%; }

/* Correlation tab */
.corr-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.corr-table { border-collapse: separate; border-spacing: 2px; font-size: 12px; font-variant-numeric: tabular-nums; }
.corr-table th { font-weight: 600; padding: 4px 6px; white-space: nowrap; text-align: center; }
.corr-table tbody th { text-align: left; }
.corr-table td { min-width: 46px; padding: 6px 4px; text-align: center; border-radius: 4px; }
.is-loading { opacity: .5; }
.corr-lists { margin-top: 14px; }
.corr-vols { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; font-variant-numeric: tabular-nums; }

.rs-sub { margin-top: 18px; }
.rs-inputs { margin-top: 8px; font-size: 13px; }
.rs-inputs summary { cursor: pointer; color: var(--qt-muted); padding: 4px 0; }
.rs-spark { display: flex; align-items: flex-end; gap: 4px; height: 48px; margin-top: 10px; }
.rs-spark span { flex: 1; border-radius: 3px 3px 0 0; background: var(--gain); min-width: 6px; }
.rs-spark span.is-down { background: var(--loss); }
.rs-spark-note { font-size: 12px; margin-top: 4px; }
.rs-perf { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 6px 0; }
.rs-perf span { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border: 1px solid var(--qt-line); border-radius: 8px; }
.rs-perf small { font-size: 11px; color: var(--qt-muted); }
.rs-perf b { font-size: 14px; font-variant-numeric: tabular-nums; }
.rs-perf .is-up { color: var(--gain); }
.rs-perf .is-down { color: var(--loss); }
.rs-peers { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -2px 0 10px; font-size: 12.5px; }
.rs-peers button { border: 1px dashed var(--qt-line); border-radius: 999px; padding: 2px 10px; background: transparent; color: inherit; font-size: 12px; cursor: pointer; }

/* Screener */
/* Screener: presets, a folding filter panel in groups, active filters as chips, then the table */
.scr-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 8px 0 12px; }
.scr-preset { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 8px 10px; border: 1px solid var(--qt-line); border-radius: 10px; background: transparent; color: inherit; cursor: pointer; }
.scr-preset:hover, .scr-preset:focus-visible { border-color: var(--qt-blue); }
.scr-preset b { font-size: 13px; }
.scr-preset small { font-size: 11px; color: var(--qt-muted); line-height: 1.35; }
.scr-panel { border: 1px solid var(--qt-line); border-radius: 12px; margin-bottom: 10px; }
.scr-panel-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; background: none; border: 0; color: var(--qt-ink); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-align: left; }
.scr-panel-head span { flex: 1; }
.scr-panel-head svg { width: 16px; height: 16px; }
#scr-panel-body[hidden] { display: none; }
.scr-tabs { overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--qt-line); border-bottom: 1px solid var(--qt-line); padding: 0 6px; }
.scr-tabs::-webkit-scrollbar { display: none; }
.scr-tabs button { flex: none; padding: 9px 12px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--qt-muted); font-size: 13px; cursor: pointer; white-space: nowrap; }
.scr-tabs button.is-on { color: var(--qt-ink); font-weight: 600; border-bottom-color: var(--qt-blue); }
.scr-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 999px; background: var(--qt-blue); color: #fff; font-size: 11px; font-weight: 600; }
.scr-group { padding: 12px; display: grid; gap: 12px; }
.scr-fields { display: grid; gap: 10px 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.scr-field { display: grid; gap: 4px; padding: 6px 8px; border-radius: 8px; border: 1px solid transparent; }
.scr-field.is-on { border-color: color-mix(in srgb, var(--qt-blue) 45%, transparent); background: color-mix(in srgb, var(--qt-blue) 6%, transparent); }
.scr-field > span, .scr-field > label, .scr-size > span { font-size: 12.5px; color: var(--qt-ink); font-weight: 500; }
.scr-field label small { margin-left: 6px; color: var(--qt-muted); font-weight: 400; }
.scr-range { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; color: var(--qt-muted); }
.scr-field input, .scr-field select, .scr-actions input { width: 100%; min-width: 0; border: 1px solid var(--qt-line); border-radius: 7px; padding: 6px 8px; background: var(--qt-card); color: var(--qt-ink); font-size: 13px; }
.scr-field input:focus-visible, .scr-field select:focus-visible, .scr-actions input:focus-visible { outline: 2px solid var(--qt-blue); outline-offset: 1px; }
.scr-size { display: grid; gap: 6px; }
.scr-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.scr-seg button { padding: 6px 12px; border: 1px solid var(--qt-line); border-radius: 7px; background: var(--qt-card); color: var(--qt-ink); font-size: 13px; cursor: pointer; }
.scr-seg button.is-on { background: var(--qt-blue); border-color: var(--qt-blue); color: #fff; }
.scr-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; font-size: 12.5px; }
.scr-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--qt-blue) 45%, transparent); background: color-mix(in srgb, var(--qt-blue) 8%, transparent); color: var(--qt-ink); font-size: 12.5px; cursor: pointer; }
.scr-chip span { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 999px; color: var(--qt-muted); }
.scr-chip:hover span { background: var(--qt-line); color: var(--qt-ink); }
.scr-chip.is-saved { padding-right: 10px; }
.scr-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-size: 12.5px; }
.scr-saved { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.scr-saved-item { display: inline-flex; align-items: center; }
.scr-saved-del { background: none; border: 0; color: var(--qt-muted); cursor: pointer; padding: 0 4px; font-size: 14px; }
.scr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.scr-actions input { width: 170px; }
.scr-pop { position: relative; }
.scr-pop summary { list-style: none; cursor: pointer; }
.scr-pop summary::-webkit-details-marker { display: none; }
.scr-pop-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: min(560px, 90vw); max-height: 60vh; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; padding: 12px; border: 1px solid var(--qt-line); border-radius: 10px; background: var(--qt-card); box-shadow: 0 8px 24px rgb(0 0 0 / 12%); }
.scr-pop-body fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 4px; }
.scr-pop-body legend { font-size: 12px; font-weight: 600; color: var(--qt-muted); margin-bottom: 2px; }
.scr-pop-body label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--qt-ink); }
.scr-table th:first-child { min-width: 170px; }
.scr-table .num { text-align: right; }
.scr-table tr.is-thin td { color: var(--qt-muted); }
.scr-empty { padding: 18px 8px; color: var(--qt-muted); text-align: center !important; }
.scr-sort { background: none; border: 0; color: inherit; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; padding: 0; }
.scr-sort.is-on { color: var(--qt-blue); }
.scr-stock { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: inherit; cursor: pointer; text-align: left; padding: 0; }
.scr-stock small { color: var(--qt-muted); font-size: 11px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scr-table th:first-child, .scr-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--qt-card); }
@media (max-width: 640px) {
  .scr-field input, .scr-field select, .scr-actions input { min-height: 40px; font-size: 16px; }
  .scr-presets { display: flex; overflow-x: auto; scrollbar-width: none; }
  .scr-preset { flex: 0 0 160px; }
  .scr-actions { width: 100%; }
  .scr-actions input { flex: 1; width: auto; }
  .scr-pop-body { right: auto; left: 0; }
  .scr-stock small { display: none; }
}

/* Company page section bar, after Fiscal.ai's company tabs */
.co-sections { position: sticky; top: 56px; z-index: 20; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 8px 2px; margin: -4px 0 4px;
  background: var(--paper); border-bottom: 1px solid var(--qt-line); }
.co-sections::-webkit-scrollbar { display: none; }
.co-sections button { flex: none; padding: 5px 12px; border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--qt-muted); font-size: 13px; cursor: pointer; white-space: nowrap; }
.co-sections button:hover { border-color: var(--qt-line); color: var(--qt-ink); }
/* Tabs on the left, the one period switch on the right; on a phone the whole bar scrolls sideways */
.co-tabs, .co-periods { display: flex; gap: 4px; flex: none; }
.co-periods { margin-left: auto; padding-left: 12px; }
.co-tabs button { border-radius: 0; border-width: 0 0 2px; padding: 6px 12px; }
.co-tabs button:hover { border-color: transparent transparent var(--qt-line); }
.co-tabs button.is-on { color: var(--qt-ink); font-weight: 600; border-color: transparent transparent var(--qt-blue); }
.co-periods button.is-on { background: var(--qt-blue); color: #fff; }
.co-cur { display: flex; gap: 4px; }
.co-cur:not(:empty) { margin-right: 10px; padding-right: 10px; border-right: 1px solid var(--qt-line); }
.qt-est-price { margin-bottom: 8px; }
.co-panel { display: grid; gap: 14px; }
.co-panel[hidden], .tab-btn[hidden], .co-periods[hidden] { display: none; }
#company-root .qt-card, #company-root .qt-anchor, #qt-grid, #qt-estimates { scroll-margin-top: 120px; }
.gd-table th small, .gd-table td small { display: block; font-size: 11px; color: var(--qt-muted); font-weight: 400; }
.gd-table .is-up, .rs-owners .is-up { color: var(--gain); }
.gd-table .is-down, .rs-owners .is-down { color: var(--loss); }
.rs-owners b { display: flex; flex-direction: column; align-items: flex-end; }
.rs-owners b small { font-size: 11px; color: var(--qt-muted); font-weight: 400; }
.rs-risk-list { margin: 4px 0 8px; padding-left: 18px; display: grid; gap: 6px; font-size: 13px; line-height: 1.45; }
.rs-risk-list .is-new::marker { color: var(--gain); }
.rs-risk-list .is-gone { color: var(--qt-muted); }
#rs-risks .is-up { color: var(--gain); }
#rs-risks .is-down { color: var(--loss); }
.rs-ask-row { display: flex; gap: 8px; margin: 6px 0 8px; }
.rs-ask-input { flex: 1; width: auto; }
.rs-answer { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--qt-line); border-radius: 10px; font-size: 14px; line-height: 1.6; }
.rs-question { font-weight: 600; margin-bottom: 6px; }
.rs-cite { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: color-mix(in srgb, #1e88e5 12%, transparent); color: #1e88e5; white-space: nowrap; }
.rs-sources { font-size: 11.5px; margin-top: 8px; }
@media (max-width: 1023px) { .co-sections { top: calc(56px + env(safe-area-inset-top)); } }

/* Statement table tools: view, order, download, and rows ticked onto a chart */
.qt-table-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 10px; }
.qt-seg { display: inline-flex; border: 1px solid var(--qt-line); border-radius: 8px; overflow: hidden; }
.qt-seg button { padding: 5px 12px; font-size: 12.5px; color: var(--qt-ink); background: transparent; border: 0; border-right: 1px solid var(--qt-line); }
.qt-seg button:last-child { border-right: 0; }
.qt-seg button.is-on { background: var(--qt-blue); color: #fff; }
.qt-tool { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; font-size: 12.5px; color: var(--qt-ink); background: transparent; border: 1px solid var(--qt-line); border-radius: 8px; }
.qt-tool svg { width: 14px; height: 14px; }
.qt-tool.is-on { border-color: var(--qt-blue); color: var(--qt-blue); }
.qt-est-chart { position: relative; height: 200px; margin-top: 12px; }
.qt-est-note { font-size: 11.5px; margin-top: 6px; }
.qt-builder-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.qt-builder-picks { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 240px; min-width: 0; }
.qt-builder-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 10px; font-size: 12.5px; color: var(--qt-ink); background: transparent; border: 1px solid var(--qt-line); border-radius: 999px; }
.qt-builder-chip i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.qt-builder-chip span { color: var(--qt-muted, #8a8a8a); }
.qt-builder-chip:focus-visible, .qt-seg button:focus-visible { outline: 2px solid var(--qt-blue); outline-offset: 1px; }
.qt-pick-chart { position: relative; height: 240px; margin-bottom: 4px; }
.qt-pick-chart.is-empty { height: auto; padding: 14px 0; text-align: center; }
.qt-pick-note:empty { display: none; }
.qt-pick { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.qt-pick input { width: 14px; height: 14px; margin: 0; accent-color: var(--qt-blue); }
.qt-pick i { width: 8px; height: 8px; border-radius: 2px; background: transparent; flex: none; }
.qt-table.is-pickable tbody tr.is-picked th { font-weight: 600; }
.qt-table.is-pickable tbody tr:hover th, .qt-table.is-pickable tbody tr:hover td { background: color-mix(in srgb, var(--qt-blue) 6%, var(--qt-card)); }
@media (max-width: 640px) {
  .qt-pick-chart { height: 180px; }
  .qt-seg button { padding: 5px 9px; }
}

/* Two-step sign-in setup */
.two-step-qr { width: 168px; padding: 6px; margin: 6px 0 10px; background: #fff; border-radius: 8px; }
.two-step-qr svg { display: block; width: 100%; height: auto; }
.two-step-secret { font-size: 12px; letter-spacing: 0.04em; user-select: all; word-break: break-all; }
.two-step-codes { padding: 10px 12px; margin: 6px 0 10px; font-size: 13px; line-height: 1.7; border: 1px dashed var(--qt-line, #888); border-radius: 8px; user-select: all; }

/* Pre-market and after-hours price, under or beside the regular one */
.ext-hours { display: block; font-size: 11px; font-weight: 500; color: var(--qt-muted, #8a8f98); white-space: nowrap; }
.ext-hours em, .ext-hours .ext-label { font-style: normal; font-weight: 600; }
#qt-ext .ext-hours { display: inline-block; margin-left: 8px; font-size: 12px; }
.cw-ext:empty { display: none; }
.cw-ext { margin: 0 0 8px; }

.auth-legal { position: relative; z-index: 10; margin: 14px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--muted); text-align: center; }
.auth-legal a, .app-version a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
