/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg:           #F4F5F7;
  --surface:      #FFFFFF;
  --surface2:     #F0F2F5;
  --surface3:     #E8EBF0;
  --border:       #E2E5EA;
  --border-strong:#C8CDD6;
  --text:         #0F1722;
  --text-muted:   #5A6473;
  --text-faint:   #9AA3AE;
  --accent:       #00C805;
  --accent-blue:  #1652F0;
  --accent-hover: #00A804;
  --accent-light: #E6FAE6;
  --green:        #00C805;
  --green-light:  #E6FAE6;
  --red:          #FF5000;
  --red-light:    #FFF0EB;
  --amber:        #F5A623;
  --amber-light:  #FFF8EC;
  --blue:         #1652F0;
  --blue-light:   #EBF0FF;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:       0 4px 16px rgba(0,0,0,0.08);
  --radius:       12px;
  --radius-sm:    8px;
  --radius-xs:    5px;
  --sidebar-w:    220px;
  --header-h:     56px;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg:           #070a10;
  --surface:      #0d1120;
  --surface2:     #121829;
  --surface3:     #172033;
  --border:       #1d2840;
  --border-strong:#243050;
  --text:         #dde4f0;
  --text-muted:   #6878a0;
  --text-faint:   #3a4560;
  --accent:       #00C805;
  --accent-hover: #00A804;
  --accent-light: #0a2010;
  --green:        #22c55e;
  --green-light:  #0a2010;
  --red:          #e05252;
  --red-light:    #2a1010;
  --amber:        #e8a61a;
  --amber-light:  #2a1e08;
  --blue:         #4f8ef7;
  --blue-light:   #0d1a3a;
  --shadow-sm:    0 1px 4px rgba(0,0,0,0.6);
  --shadow:       0 4px 20px rgba(0,0,0,0.7);
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--blue); text-decoration: none; }
button { font-family: var(--font); }

/* Keyboard users get a visible focus ring; mouse clicks don't trigger :focus-visible. */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.body { display: flex; flex: 1; overflow: hidden; }

/* ── Header ─────────────────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  z-index: 100;
}

.logo {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  white-space: nowrap;
}
/* The gold-thread Z (brand 2026-08-11): the mark sits on its own navy tile —
   the same canvas as the favicon — so it never fights the surrounding surface
   color, and it reads identically in both themes (primary gold #C59B2A stays
   usable because the tile, not the page, is its background). The wordmark is
   two-tone: "Zari" in text, "Labs" in gold (#9C7A1C on light — 17px/800 is
   large text, 3:1 bar, measured 3.69:1). */
.logo .zari-mark {
  width: 28px; height: 28px; padding: 5px;
  background: #070a10;   /* near-black (founder call 2026-08-11: gold pops most on deepest dark) */
  border: 1px solid var(--border-strong);
  border-radius: 7px; color: #C59B2A; flex-shrink: 0;
}
.logo .logo-labs { color: #9C7A1C; }
[data-theme="dark"] .logo .logo-labs { color: #C59B2A; }
/* The logo is a button: click → home (welcome screen). Resets keep the .logo look. */
button.logo { background: none; border: none; padding: 0; font-family: inherit; cursor: pointer; }
button.logo:hover { opacity: 0.82; }

/* ── Primary content nav (header) ──────────────────────────────────────────── */
.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 10px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.header-nav::-webkit-scrollbar { display: none; }

.nav-btn {
  padding: 7px 11px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.nav-btn:hover { background: var(--surface2); color: var(--text); }

.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.chips-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  flex-shrink: 1;
  min-width: 0;
  scrollbar-width: none;
}
.chips-row::-webkit-scrollbar { display: none; }

.chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--blue-light);
  color: var(--blue);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.chip-remove {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  opacity: 0.6;
}
.chip-remove:hover { opacity: 1; }

.header-add-row {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.header-ticker-input {
  width: 110px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font);
  outline: none;
  text-transform: uppercase;
  transition: border-color 0.15s, background 0.15s;
}
.header-ticker-input::placeholder { text-transform: none; color: var(--text-faint); }
.header-ticker-input:focus { border-color: var(--blue); background: var(--surface); }

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;   /* account cluster pins to the top-right corner */
}

.budget-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 8px;
}
.budget-label { font-size: 12px; color: var(--text-faint); font-weight: 600; }
.budget-input {
  width: 80px;
  padding: 6px 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 600;
  outline: none;
  font-variant-numeric: tabular-nums;
}

.btn-primary {
  padding: 7px 16px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  padding: 6px 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.header-sep { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }

.header-date {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
}

.theme-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  transition: all 0.15s;
  line-height: 1;
}
.theme-btn:hover { background: var(--surface2); color: var(--text); }

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Wide monitors: give the lists more room */
@media (min-width: 1500px) {
  .sidebar { width: 260px; }
}

/* Drawer copy of the content nav — header nav takes over ≥900px */
.sidebar-nav {
  display: none;
  flex-wrap: wrap;
  gap: 2px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Sidebar quick filter ────────────────────────────────────────────────────── */
.sidebar-filter-row { padding: 8px 10px 6px; flex-shrink: 0; }
.sidebar-filter-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font);
  outline: none;
  text-transform: uppercase;
  transition: border-color 0.15s, background 0.15s;
}
.sidebar-filter-input::placeholder { text-transform: none; color: var(--text-faint); }
.sidebar-filter-input:focus { border-color: var(--blue); background: var(--surface); }

/* ── Sidebar sections (Portfolio pinned · Watchlist grows) ──────────────────── */
.sidebar-section { display: flex; flex-direction: column; flex-shrink: 0; min-height: 0; }
.sidebar-section-grow { flex: 1; min-height: 0; }

.sidebar-section-header {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 9px 14px 8px;
  cursor: pointer;
  user-select: none;
  border: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-family: var(--font);
  text-align: left;
  transition: background 0.1s;
}
.sidebar-section-header:hover { background: var(--surface2); }

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.sidebar-section-title-static { flex-shrink: 0; }

.sidebar-section-count {
  font-size: 10.5px;
  color: var(--text-faint);
  background: var(--surface3);
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  margin-right: auto;
}

/* ── Sidebar list switcher header ────────────────────────────────────────────── */
.sidebar-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  padding: 11px 14px;
  cursor: pointer;
  user-select: none;
  border: none;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  transition: background 0.1s;
  background: var(--surface);
  font-family: var(--font);
  text-align: left;
}
.sidebar-list-header:hover { background: var(--surface2); }

.sidebar-list-current-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.sidebar-list-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}

/* Kind badge: the one thing that tells holdings and watchlists apart, since
   §8 made them the same model. Reads as a label, never as a control. */
.sidebar-list-kind {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  background: var(--surface3);
  border-radius: 3px;
  padding: 2px 5px;
  flex-shrink: 0;
}
.sidebar-list-kind.holdings { color: var(--green); background: var(--green-light); }

.sidebar-list-count {
  font-size: 10.5px;
  color: var(--text-faint);
  background: var(--surface3);
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Broker-synced lists are read-only in the UI (doc 14): the add row is replaced
   by the reason, rather than left there to fail with a 409. */
.sidebar-readonly-note {
  padding: 9px 14px;
  font-size: 11.5px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── List dropdown ───────────────────────────────────────────────────────── */
.sidebar-list-dropdown {
  background: var(--surface2);
  border-bottom: 2px solid var(--accent-blue);
  flex-shrink: 0;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.sidebar-list-options { padding: 4px 0; }

.sidebar-list-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.1s;
  user-select: none;
  background: none;
  border: none;
  font-family: var(--font);
  text-align: left;
}
.sidebar-list-option:hover { background: var(--surface3); }
.sidebar-list-option.active { color: var(--blue); font-weight: 700; background: var(--blue-light); }

.sidebar-list-option-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-list-option-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.sidebar-list-option-count {
  font-size: 11px;
  color: var(--text-faint);
  background: var(--surface3);
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}
.sidebar-list-check { color: var(--green); font-size: 12px; font-weight: 700; }

/* Holdings and watchlists are grouped under headings inside the one switcher —
   a heading is not a tree, and the founder's objection was to the tree. */
.sidebar-list-group-title {
  padding: 8px 14px 4px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.sidebar-list-actions {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;                 /* narrow sidebars wrap rather than scroll */
  border-top: 1px solid var(--border);
}
.sidebar-list-actions .sidebar-new-list-btn { flex: 1; border-top: none; }
/* While the create row is open it owns the whole row: naming a new list and
   renaming the old one are different intents, and on a 375px phone they do not
   fit side by side anyway. */
.sidebar-list-actions .sidebar-new-list-row { flex: 1 1 100%; border-top: none; }
.sidebar-list-actions:has(.sidebar-new-list-row) .sidebar-list-manage { display: none; }

.sidebar-list-manage {
  padding: 9px 12px;
  font-size: 11.5px;
  font-family: var(--font);
  color: var(--text-muted);
  background: none;
  border: none;
  border-left: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
}
.sidebar-list-manage:hover { background: var(--surface3); color: var(--text); }
.sidebar-list-manage.danger:hover { color: var(--red); }
.sidebar-list-manage[disabled] { opacity: 0.4; cursor: default; }
.sidebar-list-manage[disabled]:hover { background: none; color: var(--text-muted); }

/* While the filter is active the list shows matches from every list, so each
   row has to say which list it came from — otherwise the filter silently lies
   about where a ticker lives. */
.watch-item-listname {
  font-size: 10px;
  color: var(--text-faint);
  flex-shrink: 0;
  max-width: 84px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.watch-item-shares {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.sidebar-new-list-btn {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.1s;
}
.sidebar-new-list-btn:hover { background: var(--surface2); }

.sidebar-new-list-row {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  align-items: center;
}
.sidebar-new-list-input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--blue);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font);
  outline: none;
  min-width: 0;
}
.sidebar-new-list-kind {
  flex-shrink: 0;
  padding: 5px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font);
  outline: none;
}

.sidebar-new-list-confirm {
  padding: 5px 10px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
}
.sidebar-new-list-confirm:hover { background: #1040CC; }

/* ── Ticker list ─────────────────────────────────────────────────────────────── */
.sidebar-ticker-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.sidebar-empty {
  padding: 16px 14px;
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.5;
}

/* ── Add ticker row ──────────────────────────────────────────────────────────── */
.sidebar-add-row {
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.sidebar-add-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  text-transform: uppercase;
  transition: border-color 0.15s, background 0.15s;
}
.sidebar-add-input::placeholder { text-transform: none; color: var(--text-faint); font-size: 12px; }
.sidebar-add-input:focus { border-color: var(--blue); background: var(--surface); }


/* ── Ticker row in watchlist ─────────────────────────────────────────────────── */
.watch-item {
  display: flex;
  align-items: center;
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: background 0.1s;
}
.watch-item:hover { background: var(--surface2); }
.watch-item.tab-open .watch-item-ticker { color: var(--blue); }
.watch-item.tab-active { background: var(--blue-light); }
.watch-item.tab-active .watch-item-ticker { color: var(--blue); }

.watch-active-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--blue);
  border-radius: 0 2px 2px 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.watch-item.tab-active .watch-active-bar { opacity: 1; }

.watch-item-ticker {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  flex: 1;
  padding: 8px 10px 8px 16px;
  letter-spacing: 0.01em;
}

.watch-item-remove {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 14px;
  padding: 8px 10px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.1s;
  flex-shrink: 0;
}
.watch-item:hover .watch-item-remove { opacity: 1; }
.watch-item-remove:hover { color: var(--red); }

/* ── Watchlist right-click context menu ──────────────────────────────────────── */
.wl-ctx-menu {
  position: fixed;
  z-index: 9999;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  min-width: 180px;
  padding: 4px 0;
  user-select: none;
}
.wl-ctx-item {
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.1s;
}
.wl-ctx-item:hover:not(.wl-ctx-header):not(.disabled) { background: var(--hover); }
.wl-ctx-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  cursor: default;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 2px;
}
.wl-ctx-item.disabled { color: var(--text-faint); cursor: default; }

/* ── Mobile bottom action sheet ──────────────────────────────────────────────
   Phone-width companion to the context menu above; opened by the ⋯ button on
   ticker rows (visible ≤900px only — see the media query). Mockup:
   docs/mockups/mobile_bottom_sheet.html. Sits above the drawer (z 300). */
.watch-item-more {
  display: none;   /* phone-width affordance; desktop keeps right-click */
  align-items: center; justify-content: center;
  width: 44px; height: 44px; flex-shrink: 0;
  background: none; border: none; border-radius: 50%;
  color: var(--text-faint); font-size: 17px; letter-spacing: 1px;
  cursor: pointer; font-family: var(--font);
}
.watch-item-more:hover, .watch-item-more:focus-visible { color: var(--text); background: var(--surface3); }

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 340;
  background: rgba(7, 10, 16, 0.45);
  opacity: 0; pointer-events: none; transition: opacity 0.18s ease;
}
.action-sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 350;
  width: min(480px, 100vw);
  background: var(--surface); border: 1px solid var(--border-strong); border-bottom: none;
  border-radius: 16px 16px 0 0; box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
  transform: translate(-50%, 105%);
  transition: transform 0.22s cubic-bezier(0.3, 0.9, 0.4, 1);
  padding: 6px 10px calc(12px + env(safe-area-inset-bottom, 0px));
}
body.sheet-open .action-sheet { transform: translate(-50%, 0); }
body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .action-sheet, .sheet-backdrop { transition: none; } }

.sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 4px auto 8px; }
.sheet-head { display: flex; align-items: baseline; gap: 8px; padding: 2px 10px 10px; border-bottom: 1px solid var(--border); }
.sheet-head-ticker { font-weight: 800; font-size: 15px; }
.sheet-head-sub { font-size: 12px; color: var(--text-muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-list { padding: 6px 0 2px; }
.sheet-action {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px;
  padding: 0 10px; background: none; border: none; border-radius: var(--radius-sm);
  font: inherit; font-size: 13.5px; color: var(--text); cursor: pointer; text-align: left;
}
.sheet-action:hover, .sheet-action:focus-visible { background: var(--surface2); }
.sheet-action .ic { width: 22px; text-align: center; font-size: 15px; flex-shrink: 0; }
.sheet-action .hint { margin-left: auto; font-size: 11px; color: var(--text-faint); }
.sheet-action .check { margin-left: auto; color: var(--accent); font-weight: 700; }
.sheet-action.destructive { color: var(--red); }
.sheet-action:disabled { color: var(--text-faint); cursor: default; }
.sheet-action:disabled:hover { background: none; }
.sheet-pick-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-faint); padding: 10px 10px 4px;
}
.sheet-cancel {
  display: block; width: 100%; min-height: 44px; margin-top: 6px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-muted); cursor: pointer;
}
.sheet-cancel:hover { color: var(--text); }
.sheet-new-list-row { display: flex; gap: 8px; padding: 10px; }
.sheet-new-list-input {
  flex: 1; min-width: 0; min-height: 44px; padding: 0 12px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 13.5px; color: var(--text);
}
.sheet-new-list-input:focus { border-color: var(--blue); background: var(--surface); outline: none; }
.sheet-new-list-kind {
  min-height: 44px; padding: 0 8px; flex-shrink: 0;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 12.5px; color: var(--text);
}

.sheet-new-list-confirm {
  min-height: 44px; padding: 0 16px; flex-shrink: 0;
  background: var(--blue); border: none; border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; font-weight: 600; color: #fff; cursor: pointer;
}

/* ── Sidebar scheduler entry (full controls live in the Scheduler tab) ───────── */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.status-dot.active { background: var(--green); box-shadow: 0 0 0 2px var(--green-light); }

.sidebar-sched-entry { border-top: 1px solid var(--border); }
.sched-entry-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  color: var(--text);
  transition: background 0.1s;
  text-align: left;
}
.sched-entry-btn:hover { background: var(--surface2); }
.sched-entry-label { font-weight: 600; flex: 1; }
.sched-entry-meta { font-size: 11px; color: var(--text-muted); }

/* ── Scheduler page (workspace tab) ──────────────────────────────────────────── */
.sched-view {
  max-width: 760px;
  padding: 20px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.sched-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.sched-title { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.sched-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; max-width: 460px; }
.sched-status-pill {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.sched-status-pill.on  { background: var(--green-light); color: var(--green); }
.sched-status-pill.off { background: var(--surface3); color: var(--text-muted); }

.sched-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.sched-card-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sched-settings { border-color: var(--border-strong); }
.sched-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sched-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.sched-field input[type="time"] {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.sched-field input[type="time"]:focus-visible { border-color: var(--blue); }
.sched-tz { font-size: 11px; color: var(--text-faint); }
.sched-note { font-size: 12px; color: var(--text-muted); line-height: 1.55; margin-top: 10px; }

.sched-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.sched-steps { padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.sched-steps li { font-size: 12.5px; line-height: 1.55; color: var(--text); }
.sched-benefits { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.sched-benefits li { font-size: 12.5px; line-height: 1.55; color: var(--text); }

.delivery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.delivery-card {
  background: var(--surface2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.delivery-name { font-size: 12px; font-weight: 700; margin-bottom: 3px; }
.delivery-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }

@media (max-width: 700px) {
  .sched-grid { grid-template-columns: 1fr; }
}

/* ── Sidebar history (collapsible) ───────────────────────────────────────────── */
.sidebar-history {
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.history-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: background 0.1s;
}
.history-toggle:hover { background: var(--surface2); }

.history-toggle-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.history-arrow { font-size: 10px; color: var(--text-faint); }

.history-list { list-style: none; padding: 0 0 4px; max-height: 180px; overflow-y: auto; }

.history-item {
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  gap: 4px;
  transition: background 0.1s;
}
.history-item:hover { background: var(--surface2); color: var(--text); }
.history-tickers { font-weight: 600; font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-time { color: var(--text-faint); font-size: 11px; flex-shrink: 0; }

/* ── Analysis bar ────────────────────────────────────────────────────────────── */
.analysis-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-shrink: 0;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.analysis-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-wrap: nowrap;
}
.analysis-bar-row::-webkit-scrollbar { display: none; }

.chips-scroll {
  flex: 1;
  min-width: 80px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips-scroll::-webkit-scrollbar { display: none; }

.chips-placeholder {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 28px;
  display: block;
  white-space: nowrap;
}

.analysis-ticker-input {
  width: 160px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font);
  outline: none;
  text-transform: uppercase;
  transition: border-color 0.15s, background 0.15s;
}
.analysis-ticker-input::placeholder { text-transform: none; color: var(--text-faint); }
.analysis-ticker-input:focus { border-color: var(--blue); background: var(--surface); }

.btn-add-analysis {
  padding: 6px 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-add-analysis:hover { background: var(--blue-light); color: var(--blue); border-color: var(--blue); }

/* ── Workspace ───────────────────────────────────────────────────────────────── */
.workspace {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 12px 14px 14px;
  gap: 0;
  background: var(--bg);
}

/* ── Tab bar ─────────────────────────────────────────────────────────────────── */
.wtab-bar {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 0 0 0 2px;
  background: transparent;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
.wtab-bar::-webkit-scrollbar { display: none; }

.wtab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px 9px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
  position: relative;
}
.wtab:hover { background: var(--surface); color: var(--text); }
.wtab.active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  border-bottom-color: var(--surface);
  z-index: 1;
}

.wtab-label { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
.wtab-sub { font-size: 10px; color: var(--text-faint); font-weight: 400; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wtab-close {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  opacity: 0;
  transition: opacity 0.1s, color 0.1s;
}
.wtab:hover .wtab-close,
.wtab.active .wtab-close { opacity: 1; }
.wtab-close:hover { color: var(--red); }

/* ── Results area / tab content ─────────────────────────────────────────────── */
#results-area {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* When tab bar is shown, results-area connects seamlessly */
.wtab-bar + #results-area {
  border-top: none;
  border-radius: 0 var(--radius) var(--radius) var(--radius);
}

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 20px 72px;
  color: var(--text-faint);
}
.empty-icon { margin-bottom: 14px; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.empty-desc { font-size: 13px; line-height: 1.7; color: var(--text-faint); }

.empty-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}
.empty-action-chip {
  padding: 7px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}
.empty-action-chip:hover {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue);
}

/* ── Loading ─────────────────────────────────────────────────────────────────── */
.loading-card {
  padding: 60px 40px;
  text-align: center;
}
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text-muted); font-size: 14px; line-height: 1.6; }

/* ── Analysis tabs (metrics / chart / thesis) ────────────────────────────────── */
.tabs-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
}
.tab-btn {
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-btn.download-report-btn {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 6px;
  align-self: center;
  margin-bottom: 0;
  border-bottom: none;
  background: var(--surface-2, var(--surface));
  border: 1px solid var(--border);
  transition: background 0.15s, color 0.15s;
}
.tab-btn.download-report-btn:hover { color: var(--text); background: var(--hover); border-color: var(--blue); }
.tab-panel { display: none; padding: 24px; }
.tab-panel.active { display: block; }

/* ── Metrics table ───────────────────────────────────────────────────────────── */
.metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.metrics-table th {
  text-align: left;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
}
.metrics-table th.ticker-col {
  text-align: right;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}
.metrics-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.metrics-table td:first-child { color: var(--text-muted); font-size: 12px; }
.metrics-table td.val-cell { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.metrics-table tr:last-child td { border-bottom: none; }
.metrics-table .section-row td {
  background: var(--surface2);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 5px 14px;
}
.best { color: var(--green) !important; font-weight: 700 !important; }
.bad  { color: var(--red)   !important; }

/* ── Verdict badges ───────────────────────────────────────────────────────────── */
.verdict {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.verdict.STRONG_BUY { background: var(--green-light); color: var(--green); }
.verdict.BUY        { background: var(--green-light); color: var(--green); }
.verdict.HOLD       { background: var(--amber-light); color: var(--amber); }
.verdict.SELL       { background: var(--red-light);   color: var(--red);   }
.verdict.STRONG_SELL{ background: var(--red-light);   color: var(--red);   }

/* ── Grade badges ────────────────────────────────────────────────────────────── */
.grade {
  display: inline-block;
  width: 26px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-xs);
  padding: 1px 4px;
}
.grade-A { background: var(--green-light); color: var(--green); }
.grade-B { background: var(--blue-light);  color: var(--blue);  }
.grade-C { background: var(--amber-light); color: var(--amber); }
.grade-D, .grade-F { background: var(--red-light); color: var(--red); }

/* ── Thesis grid ─────────────────────────────────────────────────────────────── */
.thesis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.thesis-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.thesis-header {
  padding: 14px 16px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.thesis-ticker { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; }
.thesis-meta { display: flex; align-items: center; gap: 8px; }
.conviction-bar { display: flex; gap: 2px; }
.conviction-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.conviction-dot.filled { background: var(--green); }
.thesis-body { padding: 16px; }
.thesis-section { margin-bottom: 14px; }
.thesis-section:last-child { margin-bottom: 0; }
.thesis-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 5px;
}
.thesis-text { font-size: 13px; line-height: 1.65; color: var(--text); }
.targets-row { display: flex; gap: 8px; }
.target-box { flex: 1; background: var(--surface2); border-radius: var(--radius-sm); padding: 10px; text-align: center; border: 1px solid var(--border); }
.target-label { font-size: 10px; color: var(--text-faint); margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.04em; }
.target-price { font-size: 16px; font-weight: 700; color: var(--green); }
.target-upside { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.grades-row { display: flex; gap: 8px; flex-wrap: wrap; }
.grade-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.grade-item-label { font-size: 9px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.flag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.flag { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: var(--radius-xs); font-size: 11px; font-weight: 600; }
.flag.danger  { background: var(--red-light);   color: var(--red);   }
.flag.warning { background: var(--amber-light); color: var(--amber); }
.flag.ok      { background: var(--green-light); color: var(--green); }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag { padding: 2px 8px; background: var(--surface2); border-radius: var(--radius-xs); font-size: 11px; color: var(--text-muted); border: 1px solid var(--border); }

/* ── Comparison card ─────────────────────────────────────────────────────────── */
.comparison-card {
  border: 2px solid var(--blue);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
  background: var(--blue-light);
}
.comparison-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.comparison-winner-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.comparison-winner { font-size: 26px; font-weight: 800; color: var(--blue); letter-spacing: -1px; }
.comparison-summary { font-size: 13px; line-height: 1.65; color: var(--text); margin-bottom: 14px; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.category-item { background: var(--surface); border-radius: var(--radius-sm); padding: 10px; border: 1px solid var(--border); }
.category-name { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.category-winner-ticker { font-size: 14px; font-weight: 700; color: var(--blue); }
.category-reason { font-size: 11px; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }

/* ── Chart ───────────────────────────────────────────────────────────────────── */
.chart-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.range-btns, .chart-type-btns { display: flex; gap: 4px; }
.range-btn {
  padding: 5px 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.range-btn:hover { background: var(--surface3); color: var(--text); }
.range-btn.active { background: var(--blue); border-color: var(--blue); color: white; font-weight: 700; }
#chart-container { height: 340px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
#rsi-container { height: 90px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-top: 8px; }

/* ── Ticker view ─────────────────────────────────────────────────────────────── */
.ticker-view { background: var(--surface); height: 100%; display: flex; flex-direction: column; border-radius: inherit; }

/* Compact identity band: symbol · name · price · meta · actions in ~2 dense rows.
   Every pixel here is stolen from the content pane below — keep it tight. */
.ticker-view-header {
  padding: 10px 20px 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.ticker-hero-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.ticker-hero-symbol { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }
.ticker-hero-name {
  font-size: 12px; color: var(--text-muted);
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.ticker-price { font-size: 18px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.ticker-change { font-size: 13px; font-weight: 600; }
.ticker-change.pos { color: var(--green); }
.ticker-change.neg { color: var(--red); }

.ticker-meta-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: baseline; margin-top: 3px; }
.ticker-meta-item { display: flex; align-items: baseline; gap: 5px; }
.ticker-meta-label { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.ticker-meta-value { font-size: 12px; font-weight: 600; color: var(--text-muted); }

.ticker-header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; margin-left: auto; }

.btn-run-analysis {
  padding: 9px 18px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-run-analysis:hover { background: var(--accent-hover); }
.btn-run-analysis:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-add-to-compare {
  padding: 9px 14px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-add-to-compare:hover { background: var(--blue-light); color: var(--blue); border-color: var(--blue); }

/* Inner ticker tabs */
.ticker-inner-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  flex-shrink: 0;
}
.ticker-tab-btn {
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.ticker-tab-btn:hover { color: var(--text); }
.ticker-tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

.ticker-view-body { flex: 1; min-height: 0; overflow-y: auto; }
.ticker-inner-panel { display: none; padding: 16px 20px 20px; }
.ticker-inner-panel.active { display: block; }

/* Fill panels (chart): consume the full pane height instead of scrolling */
.ticker-inner-panel.panel-fill { padding: 0; }
.ticker-inner-panel.panel-fill.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Stats grid in ticker view */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat-card { background: var(--surface2); border-radius: var(--radius-sm); padding: 12px 14px; border: 1px solid var(--border); }
.stat-card-label { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.stat-card-value { font-size: 16px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-card-value.pos { color: var(--green); }
.stat-card-value.neg { color: var(--red); }

.ticker-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin: 20px 0 10px;
}
.ticker-section-title:first-child { margin-top: 0; }

.tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.tech-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  font-size: 12px;
  border: 1px solid var(--border);
}
.tech-item-label { color: var(--text-muted); }
.tech-item-value { font-weight: 700; color: var(--text); }
.tech-item-value.bullish { color: var(--green); }
.tech-item-value.bearish { color: var(--red); }

.ticker-mini-chart { height: 240px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 8px; }
.ticker-mini-rsi { height: 80px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }

/* Mini table (earnings / insiders) */
.mini-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.mini-table th {
  text-align: left;
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
}
.mini-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.mini-table tr:last-child td { border-bottom: none; }

/* Ticker analysis area */
.ticker-analysis-area { margin-top: 4px; }
.ticker-analysis-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 13px;
}

/* ── Toast / Error ───────────────────────────────────────────────────────────── */
.error-msg {
  background: var(--red-light);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid rgba(255,80,0,0.2);
}

/* ── Metric tooltip hint ─────────────────────────────────────────────────────── */
.tooltip-hint {
  display: inline-block;
  font-size: 9px;
  color: var(--text-faint);
  cursor: help;
  opacity: 0.6;
  vertical-align: middle;
  margin-left: 2px;
  transition: opacity 0.15s;
}
.tooltip-hint:hover { opacity: 1; color: var(--accent); }

/* ── Scrollbar ───────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── Macro bar ───────────────────────────────────────────────────────────────── */
.macro-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
  min-height: 34px;
}
.macro-bar::-webkit-scrollbar { display: none; }

.macro-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  font-size: 12px;
}

.macro-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}

.macro-price {
  font-weight: 600;
  color: var(--text);
  font-size: 12px;
}

.macro-chg {
  font-size: 11px;
  font-weight: 500;
}
.macro-chg.pos { color: var(--green); }
.macro-chg.neg { color: var(--red); }

/* ── Indicator toolbar (single-stock chart) ─────────────────────────────────── */
.indicator-toolbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.indicator-toolbar-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 12px;
}

.ind-section {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 0 2px;
}

.ind-btn {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.ind-btn:hover { border-color: var(--accent); color: var(--accent); }

.ind-btn.active {
  background: rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.5);
  color: #818cf8;
}

/* ── Chart root containers ──────────────────────────────────────────────────── */
.chart-root {
  overflow-x: hidden;
  overflow-y: auto;   /* only scrolls when the 220px main-chart floor exceeds a short pane */
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.comp-chart-root {
  overflow: hidden;
  min-height: 360px;
}

/* ── Chart controls row ──────────────────────────────────────────────────────── */
.chart-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

/* ── Analysis bar divider + tool buttons ────────────────────────────────────── */
.analysis-bar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 4px;
}

.btn-tool {
  font-size: 12px;
  padding: 5px 11px;
  white-space: nowrap;
}

/* ── Sector heatmap ──────────────────────────────────────────────────────────── */
.sector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.sector-card {
  border-radius: 10px;
  padding: 14px 14px 12px;
  border: 1px solid var(--border);
  transition: transform 0.1s;
  cursor: default;
}

.sector-card:hover { transform: translateY(-1px); }

.sector-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.sector-ticker {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.sector-1d {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.sector-1m { font-weight: 500; }

/* ── Earnings calendar ───────────────────────────────────────────────────────── */
.cal-date-group { margin-bottom: 20px; }

.cal-date-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.cal-items { display: flex; flex-direction: column; gap: 6px; }

.cal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  flex-wrap: wrap;
}

.cal-ticker {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  min-width: 52px;
}

.cal-timing {
  font-size: 11px;
  color: var(--text-faint);
  background: var(--surface2);
  padding: 2px 7px;
  border-radius: 4px;
}

.cal-est {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Ticker chart tab: flex layout ──────────────────────────────────────────
   NOTE: must only apply when .active — a bare [id^="tp-chart-"] rule here used
   to force the hidden chart panel visible, pushing every other sub-tab's
   content (Earnings et al.) below the fold. Covered by .panel-fill.active now. */

/* ── Discovery tab ───────────────────────────────────────────────────────────── */
.discovery-wrap {
  padding: 20px 24px;
  max-width: 1080px;
}

.discovery-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.discovery-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.discovery-subtitle {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 3px;
  font-style: italic;
}

.discovery-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.discovery-ts {
  font-size: 11px;
  color: var(--text-faint);
}

.discovery-msg {
  padding: 14px 18px;
  background: rgba(108,143,255,0.07);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.disc-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 24px 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

/* ── Profile card ───────────────────────────────────────────────────────────── */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}

.profile-style {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.profile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.profile-stat {}
.profile-stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.profile-stat-value { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 2px; }

/* ── Screener table ─────────────────────────────────────────────────────────── */
.screener-table-wrap { overflow-x: auto; }

.score-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
}
/* Discovery composite score is a button: tap → glossary card explains the number */
button.score-pill-btn { border: none; font-family: inherit; cursor: pointer; line-height: inherit; }
.score-pill-denom { font-size: 8.5px; font-weight: 600; opacity: 0.75; margin-left: 1px; }
.info-row-flash { background: var(--blue-light); border-radius: var(--radius-xs); transition: background 0.4s; }

.screen-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  display: inline-block;
  margin: 1px;
  background: rgba(108,143,255,0.1);
  color: var(--accent);
}
.screen-badge.screen-value    { background: rgba(251,191,36,0.12); color: var(--yellow); }
.screen-badge.screen-growth   { background: rgba(52,211,153,0.12); color: var(--green); }
.screen-badge.screen-quality  { background: rgba(34,211,238,0.12); color: var(--cyan); }
.screen-badge.screen-momentum { background: rgba(167,139,250,0.12); color: var(--accent2); }
.screen-badge.screen-earnings { background: rgba(251,146,60,0.12); color: var(--orange); }
.screen-badge.screen-near     { background: rgba(52,211,153,0.12); color: var(--green); }
.screen-badge.screen-fmp      { background: rgba(136,146,170,0.1); color: var(--muted); }

/* ── Ranking rationale ──────────────────────────────────────────────────────── */
.ranking-rationale {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent2);
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 4px;
}

/* ── Recommendation cards ───────────────────────────────────────────────────── */
.recs-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.disc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.disc-card:hover { border-color: rgba(108,143,255,0.4); }

.disc-card-error {
  background: var(--surface);
  border: 1px solid rgba(248,113,113,0.2);
  border-radius: 10px;
  padding: 14px 18px;
}

.disc-card-header {
  padding: 14px 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.disc-card-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.disc-card-ticker {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.disc-card-name {
  font-size: 12px;
  color: var(--muted);
}

.disc-why {
  padding: 8px 18px;
  font-size: 11px;
  color: var(--text-faint);
  background: rgba(108,143,255,0.04);
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}

.disc-card-body {
  padding: 12px 18px;
}

.disc-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.disc-meta-item {}
.disc-meta-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); display: block; }
.disc-meta-value { font-size: 12px; font-weight: 500; color: var(--text); }

.disc-summary {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 6px;
}

.disc-case {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.55;
}

.disc-card-footer {
  padding: 8px 18px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.btn-discover {
  background: rgba(108,143,255,0.1);
  border-color: rgba(108,143,255,0.35);
  color: var(--accent);
  font-weight: 600;
}
.btn-discover:hover {
  background: rgba(108,143,255,0.2);
}

/* ── News feed ───────────────────────────────────────────────────────────────── */
.news-feed {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.news-feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.news-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.news-item:last-child { border-bottom: none; }

.news-item-important {
  border-left: 2px solid var(--accent);
  padding-left: 12px;
  margin-left: -14px;
}

.news-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.news-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.news-pos { background: var(--green); }
.news-neg { background: var(--red); }
.news-neu { background: var(--muted); }

.news-ticker {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(108,143,255,0.1);
  padding: 1px 7px;
  border-radius: 4px;
}

.news-type {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.news-flag {
  font-size: 10px;
  font-weight: 700;
  color: var(--yellow);
  background: rgba(251,191,36,0.12);
  padding: 1px 7px;
  border-radius: 4px;
}

.news-date {
  font-size: 11px;
  color: var(--text-faint);
  margin-left: auto;
  white-space: nowrap;
}

.news-headline {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 3px;
}

.news-headline a {
  color: var(--text);
  text-decoration: none;
}
.news-headline a:hover { color: var(--accent); text-decoration: underline; }

.news-source {
  font-size: 11px;
  color: var(--text-faint);
}

/* ── API key modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 420px;
  width: 100%;
  margin: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
}

.modal-desc code {
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--accent);
}

.modal-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
.modal-input:focus { border-color: var(--accent); }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Sign-in wall (W3 auth) ─────────────────────────────────────────────────── */
.auth-wall {
  z-index: 9500;                      /* above every app modal — it's a wall */
  background: var(--bg);              /* opaque: nothing behind it has loaded */
}
.auth-box { max-width: 360px; }
.auth-wide { width: 100%; display: block; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-faint);
  font-size: 0.75rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}
.auth-status {
  min-height: 1.1em;
  font-size: 0.8rem;
  color: var(--muted);
}
.auth-status.auth-error { color: var(--red, #e5484d); }
.auth-actions { justify-content: space-between; }
.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.auth-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}
.auth-link:hover { color: var(--text); }
.auth-foot {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.5;
}
.auth-foot a { color: inherit; text-decoration: underline; }
.auth-foot a:hover { color: var(--text); }

/* ── Ticker news panel ──────────────────────────────────────────────────────── */
.tnews-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.tnews-item:last-child { border-bottom: none; }

.tnews-item-important {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
}

.tnews-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.tnews-date {
  font-size: 11px;
  color: var(--text-faint);
}

.tnews-source {
  font-size: 11px;
  color: var(--text-faint);
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 4px;
}

.tnews-sentiment {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tnews-sentiment.pos { color: var(--green); }
.tnews-sentiment.neg { color: var(--red); }

.tnews-headline {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 5px;
}
.tnews-headline a {
  color: var(--text);
  text-decoration: none;
}
.tnews-headline a:hover { color: var(--accent); text-decoration: underline; }

.tnews-summary {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  max-height: 80px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* News context block in thesis */
.thesis-news-context {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 10px 14px !important;
}

/* ── Company panel ──────────────────────────────────────────────────────────── */
.company-summary {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: 8px;
  padding: 14px 16px;
  border: 1px solid var(--border);
}

.company-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}

.company-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.company-detail-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}

.company-detail-value {
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
}

/* ── Similar stocks panel ───────────────────────────────────────────────────── */
.similar-panel {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.similar-panel-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.similar-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.similar-rationale {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.5;
}

.btn-find-similar {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px !important;
  color: var(--accent) !important;
  font-size: 11px !important;
  cursor: pointer;
}
.btn-find-similar:hover {
  background: rgba(108,143,255,0.08);
}

/* ── Discovery scope row ────────────────────────────────────────────────────── */
.discovery-scope-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.discovery-scope-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.discovery-scope-select {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
  outline: none;
  cursor: pointer;
  min-width: 180px;
}
.discovery-scope-select:focus { border-color: var(--accent); }

/* ── Portfolio Analysis ─────────────────────────────────────────────────────── */
.pa-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 20px;
}

.pa-grade-block {
  text-align: center;
  min-width: 64px;
}

.pa-summary {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-muted);
  flex: 1;
}

.pa-section {
  margin-bottom: 20px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.pa-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.pa-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-top: 8px;
}

.pa-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.pa-label {
  font-weight: 600;
  color: var(--text-muted);
  min-width: 110px;
  font-size: 12px;
}

.pa-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pa-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.8;
}

.pa-gap-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.pa-gap-item:last-child { border-bottom: none; }

.pa-gap-label {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.pa-stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

/* ══ Progressive Experience (progression.js) ═══════════════════════════════ */

/* Header additions */
.stage-chip {
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--blue); background: var(--blue-light);
  border: 1px solid var(--blue); border-radius: 20px; padding: 3px 10px;
  white-space: nowrap;
}
.stage-chip:empty { display: none; }

/* Compliance bar */
.compliance-bar {
  flex-shrink: 0;
  padding: 7px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 10.5px; line-height: 1.5;
  color: var(--text-faint);
  text-align: center;
}
.compliance-bar strong { color: var(--text-muted); font-weight: 600; }

/* Sidebar roadmap */
.sidebar-roadmap { padding: 10px 12px; border-top: 1px solid var(--border); }
.sidebar-roadmap-label {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-faint); margin-bottom: 6px;
}
.roadmap-item {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: none; border: none; cursor: pointer;
  padding: 5px 4px; font-size: 12px; color: var(--text-faint);
  border-radius: var(--radius-xs); transition: all .15s; text-align: left;
  font-family: inherit;
}
.roadmap-item:hover { color: var(--text-muted); background: var(--surface2); }
.soon-pill {
  margin-left: auto; font-size: 8.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--blue); background: var(--blue-light);
  border-radius: 8px; padding: 1px 6px;
}

/* Welcome / Day 0 state */
.welcome-state { max-width: 860px; margin: 0 auto; padding: 44px 20px 24px; text-align: center; }
.welcome-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; }
.welcome-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }

.continue-card {
  display: flex; align-items: center; gap: 14px; text-align: left;
  max-width: 620px; margin: 0 auto 26px;
  background: var(--blue-light); border: 1px solid var(--blue);
  border-radius: var(--radius); padding: 14px 18px; cursor: pointer;
  transition: transform .15s;
}
.continue-card:hover { transform: translateY(-1px); }
.continue-icon { font-size: 20px; flex-shrink: 0; }
.continue-text { flex: 1; font-size: 12.5px; color: var(--text-muted); line-height: 1.55; }
.continue-text b { color: var(--text); }
.continue-cta { font-size: 12px; font-weight: 700; color: var(--blue); white-space: nowrap; }

.intent-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 12px; text-align: left;
}
.intent-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 15px; cursor: pointer;
  transition: all .15s;
}
.intent-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.intent-emoji { font-size: 20px; margin-bottom: 8px; }
.intent-title { font-size: 13.5px; font-weight: 700; margin-bottom: 4px; }
.intent-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.55; margin-bottom: 9px; }
.intent-example {
  font-size: 11px; font-style: italic; color: var(--blue);
  background: var(--blue-light); border-radius: var(--radius-xs); padding: 5px 8px;
}

/* Roadmap coming-soon panel */
.roadmap-panel { max-width: 620px; margin: 0 auto; padding: 48px 20px; text-align: center; }
.roadmap-icon { font-size: 34px; margin-bottom: 10px; }
.roadmap-title { font-size: 19px; font-weight: 800; margin-bottom: 20px; }
.roadmap-soon {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  vertical-align: middle; color: var(--blue); background: var(--blue-light);
  border-radius: 10px; padding: 3px 9px; margin-left: 8px;
}
.roadmap-block {
  text-align: left; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 10px;
}
.roadmap-block b { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.roadmap-block p { font-size: 12.5px; color: var(--text-muted); line-height: 1.65; margin-top: 4px; }
.roadmap-panel .empty-action-chip { margin-top: 14px; }

/* ── "Since you last checked" brief + streak ─────────────────────────────── */
.streak-chip {
  display: inline-flex; align-items: center; gap: 4px; vertical-align: middle;
  font-size: 11px; font-weight: 700; color: #f59e0b;
  background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3);
  border-radius: 20px; padding: 3px 10px; margin-left: 10px;
}

.daily-brief {
  max-width: 620px; margin: 0 auto 22px; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px 8px;
}
.brief-header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.brief-title { font-size: 13px; font-weight: 700; }
.brief-date { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.brief-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 2px; border-top: 1px solid var(--border);
  font-size: 12.5px; cursor: pointer; border-radius: var(--radius-xs);
  transition: background .12s;
}
.brief-item:hover { background: var(--surface2); }
.brief-ticker { font-weight: 700; width: 74px; flex-shrink: 0; }
.brief-pf { font-size: 10px; }
.brief-chg { width: 64px; flex-shrink: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.brief-chg.pos { color: var(--green); }
.brief-chg.neg { color: var(--red); }
.brief-price { width: 78px; flex-shrink: 0; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.brief-note { flex: 1; font-size: 11px; color: var(--text-faint); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Plain-English CSS tooltips (fast, readable; native title is slow) ────── */
.tt { position: relative; cursor: help; }
.tt::after {
  content: attr(data-tip);
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 300;
  width: max-content; max-width: 240px;
  background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--radius-sm);
  padding: 8px 11px; font-size: 11.5px; font-weight: 400; line-height: 1.55;
  letter-spacing: 0; text-transform: none; white-space: normal; text-align: left;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  opacity: 0; visibility: hidden; transition: opacity .12s;
  pointer-events: none;
}
.tt:hover::after,
.tt:focus-visible::after,
.tt.tt-open::after { opacity: 1; visibility: visible; }   /* hover, keyboard focus, or tap-toggle */
/* In Guided mode, invite the hover — dotted underline on explainable labels */
body.guided-mode .tt { border-bottom: 1px dotted var(--text-faint); }

/* ── AI Coach card (spec: docs/ai_coach.html) ─────────────────────────────── */
.coach-card {
  max-width: 620px; margin: 0 auto 22px; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius); padding: 14px 18px;
  display: flex; gap: 12px; align-items: flex-start;
  transition: opacity .4s;
}
.coach-card.coach-done { opacity: .55; }
.coach-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.coach-body { flex: 1; min-width: 0; }
.coach-label {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--blue); margin-bottom: 4px;
}
.coach-title { font-size: 13.5px; font-weight: 700; margin-bottom: 5px; line-height: 1.4; }
.coach-text { font-size: 12.5px; color: var(--text-muted); line-height: 1.65; }
.coach-evidence {
  margin-top: 9px; padding: 10px 13px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px; color: var(--text-muted); line-height: 1.6;
}
.coach-citation { margin-top: 6px; font-size: 10.5px; color: var(--text-faint); font-style: italic; }
.coach-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.coach-btn {
  font-size: 11.5px; font-weight: 600; padding: 5px 12px; cursor: pointer;
  background: var(--blue-light); color: var(--blue);
  border: 1px solid var(--blue); border-radius: var(--radius-sm);
  font-family: inherit; transition: all .15s;
}
.coach-btn:hover { filter: brightness(1.1); }
.coach-btn-quiet { background: none; border-color: var(--border); color: var(--text-faint); }
.coach-fineprint { margin-top: 8px; font-size: 10px; color: var(--text-faint); }

/* ── Thesis Chat (spec: docs/ux_progressive_experience.html Power screen) ──── */
.tchat {
  margin-top: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.tchat-header {
  padding: 11px 16px; font-size: 12.5px; font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.tchat-thread {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 16px; max-height: 340px; overflow-y: auto;
}
.tchat-thread:empty { display: none; }
.tchat-msg {
  max-width: 82%; padding: 9px 13px; border-radius: 12px;
  font-size: 12.5px; line-height: 1.6; white-space: pre-wrap;
}
.tchat-user {
  align-self: flex-end; background: var(--blue-light);
  border: 1px solid var(--blue); color: var(--text);
  border-bottom-right-radius: 4px;
}
.tchat-ai {
  align-self: flex-start; background: var(--surface2);
  border: 1px solid var(--border); color: var(--text-muted);
  border-bottom-left-radius: 4px;
}
.tchat-starters { display: flex; gap: 7px; flex-wrap: wrap; padding: 12px 16px 2px; }
.tchat-starter {
  font-size: 11.5px; padding: 5px 11px; cursor: pointer;
  background: none; color: var(--blue);
  border: 1px solid var(--blue); border-radius: 16px;
  font-family: inherit; transition: all .15s;
}
.tchat-starter:hover { background: var(--blue-light); }
.tchat-input-row { display: flex; gap: 8px; padding: 12px 16px 8px; }
.tchat-input {
  flex: 1; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  font-size: 12.5px; color: var(--text); font-family: inherit;
}
.tchat-input:focus { outline: none; border-color: var(--blue); }
.tchat-send {
  background: var(--blue); color: #fff; border: none;
  border-radius: var(--radius-sm); padding: 8px 16px;
  font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.tchat-send:disabled { opacity: .5; cursor: default; }
.tchat-fineprint { padding: 0 16px 11px; font-size: 10px; color: var(--text-faint); }

/* ── Thesis notes (private) ────────────────────────────────────────────────── */
.tnotes { border-top: 1px solid var(--border); padding: 10px 16px 12px; }
.tnotes-header { font-size: 11.5px; font-weight: 700; margin-bottom: 8px; }
.tnotes-private {
  font-size: 9.5px; font-weight: 600; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .05em; margin-left: 6px;
}
.tnotes-list:not(:empty) { margin-bottom: 8px; }
.tnotes-item {
  padding: 8px 11px; margin-bottom: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  border-left: 3px solid var(--yellow, #f59e0b);
  border-radius: var(--radius-sm);
}
.tnotes-text { font-size: 12px; color: var(--text); line-height: 1.55; white-space: pre-wrap; }
.tnotes-meta { margin-top: 4px; font-size: 10px; color: var(--text-faint); }
.tnotes-del {
  background: none; border: none; padding: 0; cursor: pointer;
  font-size: 10px; color: var(--text-faint); text-decoration: underline; font-family: inherit;
}
.tnotes-del:hover { color: var(--red); }
.tnotes-input-row { display: flex; gap: 8px; }

/* ── Community hub phase 1 ─────────────────────────────────────────────────── */
.soon-pill-new { background: rgba(34,197,94,0.12); color: var(--green); }
.community-panel { max-width: 860px; margin: 0 auto; padding: 36px 20px; text-align: center; }
.sec-title-lg { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; }
.sec-sub-lg { font-size: 13px; color: var(--text-muted); margin-bottom: 22px; }
.community-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px; text-align: left; margin-bottom: 18px;
}
.community-card {
  display: flex; flex-direction: column; gap: 7px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  text-decoration: none; transition: all .15s;
}
.community-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.community-src {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: #ff4d4d;
}
.community-name { font-size: 14px; font-weight: 700; color: var(--text); }
.community-why { flex: 1; font-size: 11.5px; color: var(--text-muted); line-height: 1.6; }
.community-visit { font-size: 11.5px; font-weight: 600; color: var(--blue); }
.community-disclaimer {
  font-size: 10.5px; color: var(--text-faint); line-height: 1.6;
  max-width: 640px; margin: 0 auto 10px;
}
.community-phase2 {
  font-size: 11px; color: var(--text-muted); background: var(--surface);
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  padding: 9px 14px; max-width: 640px; margin: 0 auto 16px;
}

/* ── Community admin controls ──────────────────────────────────────────────── */
.community-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); text-align: left; margin: 18px 0 10px;
}
.community-card { position: relative; }
.community-remove {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; cursor: pointer;
  font-size: 14px; line-height: 1; color: var(--text-faint);
  padding: 2px 5px; border-radius: 4px; opacity: 0; transition: opacity .15s;
  font-family: inherit;
}
.community-card:hover .community-remove { opacity: 1; }
.community-remove:hover { color: var(--red); background: var(--surface2); }
.community-admin {
  text-align: left; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin: 6px 0 16px;
}
.community-admin-title { font-size: 12px; font-weight: 700; margin-bottom: 10px; }
.community-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.community-form-input {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 10px;
  font-size: 12px; color: var(--text); font-family: inherit;
  flex: 1 1 140px; min-width: 120px;
}
.community-form-input:focus { outline: none; border-color: var(--blue); }
.community-form-wide { flex: 2 1 280px; }
.community-admin .community-phase2 { margin: 0; max-width: none; }

/* ── Notes resurfacing (brief: your note comes back when the ticker reports) ── */
.brief-notes-block { margin: 4px 0 8px; }
.brief-notes-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.brief-note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  margin-bottom: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.brief-note-card:hover { background: var(--surface2); }
.brief-note-head { font-size: 12.5px; color: var(--text); margin-bottom: 6px; }
.brief-note-quote {
  font-size: 12.5px;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.55;
  padding: 6px 10px;
  background: var(--surface2);
  border-radius: var(--radius-xs);
  margin-bottom: 4px;
}
.brief-note-when {
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-faint);
  margin-left: 8px;
  white-space: nowrap;
}
.brief-note-cta { font-size: 11.5px; color: var(--blue); font-weight: 600; margin-top: 4px; }

/* ── Symbol autocomplete dropdown (shared, fixed-position, body-level) ──────── */
.ac-dropdown {
  position: fixed;
  z-index: 400;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 4px 0;
}
.ac-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 12.5px;
}
.ac-row:hover, .ac-row.active { background: var(--blue-light); }
.ac-symbol {
  font-weight: 700;
  color: var(--text);
  min-width: 52px;
  font-variant-numeric: tabular-nums;
}
.ac-name {
  flex: 1;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ac-exch { font-size: 10.5px; color: var(--text-faint); flex-shrink: 0; }

/* ── Provenance line — the timestamp IS the trust signal (principles §1) ────── */
.provenance-line {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

/* ── Responsive: tablet & phone ──────────────────────────────────────────────
   Breakpoint policy lives in docs/design_principles.md Part II.
   <900px: sidebar becomes an off-canvas drawer behind the ☰ header button. */
.sidebar-toggle { display: none; }
.sidebar-backdrop {
  position: fixed; inset: var(--header-h) 0 0 0;
  background: rgba(0, 0, 0, 0.45); z-index: 250;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}

@media (max-width: 900px) {
  .sidebar-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; padding: 5px 0;
  }
  .sidebar {
    position: fixed; top: var(--header-h); bottom: 0; left: 0;
    z-index: 300; width: min(280px, 84vw);
    transform: translateX(-100%); transition: transform 0.2s ease;
    box-shadow: var(--shadow);
    border-right: 1px solid var(--border-strong);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }

  .header { gap: 8px; padding: 0 10px; }
  .header-date { display: none; }
  .workspace { padding: 8px 8px 10px; }

  /* Content nav lives in the drawer on small screens */
  .header-nav { display: none; }
  .sidebar-nav { display: flex; }

  /* ── Bottom-sheet affordance: ⋯ on ticker rows replaces the hover-only × ──── */
  .watch-item-more { display: inline-flex; }
  .watch-item-remove, .recent-item-remove { display: none; }  /* Remove lives in the ⋯ sheet */
  .watch-item, .recent-item { min-height: 44px; }
}

@media (max-width: 600px) {
  .stage-chip { display: none; }
  .analysis-bar-row { padding: 8px; }  /* bar already scrolls horizontally; keep labels for clarity */
  .budget-input { width: 64px; }
  .compliance-bar { font-size: 9.5px; padding: 5px 10px; }
  .empty-state { padding: 40px 16px; }
}

/* ── Discovery Engine v2 (docs/discovery_engine.md) ────────────────────────── */
.scr-building {
  margin: 0 0 14px; padding: 9px 14px;
  background: var(--surface2); border: 1px solid var(--border);
  border-left: 3px solid var(--blue); border-radius: var(--radius-sm);
  font-size: 12px; color: var(--text-muted);
}
.scr-collections {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px; margin-bottom: 18px;
}
.scr-collection {
  text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 13px;
  font: inherit; color: inherit;
  transition: border-color .12s;
}
.scr-collection:hover { border-color: var(--accent-blue); }
.scr-collection.active { border-color: var(--accent-blue); background: var(--surface2); }
.scr-coll-title { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; }
.scr-coll-criteria { font-size: 10.5px; color: var(--text-faint); line-height: 1.5; }
.scr-controls { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 12px; align-items: flex-end; }
.scr-control { display: flex; flex-direction: column; gap: 5px; }
.scr-control-label { font-size: 10.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.seg-control { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.seg-btn {
  background: var(--surface); border: none; cursor: pointer;
  padding: 6px 12px; font-size: 12px; color: var(--text-muted); font-family: inherit;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn.active { background: var(--accent-blue); color: #fff; font-weight: 600; }
.seg-btn:not(.active):hover { color: var(--text); }
.scr-sectors { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.scr-sector-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 12px; font-size: 11.5px; color: var(--text-muted); cursor: pointer; font-family: inherit;
}
.scr-sector-chip:hover { border-color: var(--accent-blue); }
.scr-sector-chip.active { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }
/* "Hide what I already hold" — one control over both halves of Discover
   (product_discussions.md 2026-08-18). Reads as a preference, not a filter
   chip: it governs the whole page, so it sits above everything it governs. */
.scr-hide-owned {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.scr-hide-owned input { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; }
.scr-hide-owned:hover { color: var(--text); }
.scr-hide-owned-hint { font-size: 11.5px; color: var(--text-faint); }

.scr-provenance { font-size: 11px; color: var(--text-faint); margin: 4px 0 14px; }

/* "What these mean" glossary card — dynamic per page (see mountInfoCard in app.js) */
.info-toggle-btn { font-size: 11.5px; padding: 5px 12px; align-self: flex-start; }
.info-toggle-btn.active { color: var(--accent-blue); border-color: var(--accent-blue); }
.info-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin: 4px 0 18px;
}
.info-card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.info-card-title { font-size: 12px; font-weight: 700; }
.info-card-sub { font-size: 10.5px; color: var(--text-faint); }
.info-card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 10px 24px; margin: 0;
}
.info-card-row dt { font-size: 11.5px; font-weight: 600; color: var(--text); }
.info-card-row dd { font-size: 11.5px; color: var(--text-muted); margin: 2px 0 0; line-height: 1.45; }
.scr-fbars { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 18px; margin-bottom: 10px; }
.fbar { display: flex; align-items: center; gap: 8px; }
.fbar-label { width: 46px; flex-shrink: 0; font-size: 10.5px; color: var(--text-faint); }
.fbar-track { flex: 1; height: 5px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.fbar-fill { height: 100%; background: var(--accent-blue); border-radius: 3px; }
.fbar-risk .fbar-fill { background: var(--text-faint); }
.fbar-val { width: 24px; flex-shrink: 0; text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.scr-checked { font-size: 10.5px; color: var(--text-faint); margin-top: 8px; line-height: 1.5; }
.disc-analyst { font-size: 11px; color: var(--text-muted); margin-top: 7px; line-height: 1.5; }
.scr-personal-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
@media (max-width: 600px) {
  .scr-controls { gap: 12px; }
  .scr-fbars { grid-template-columns: 1fr; }
  /* Discovery mobile pass: segmented controls and card footers wrap instead of overflowing */
  .seg-control { flex-wrap: wrap; }
  .seg-btn { flex: 1 1 auto; }
  .scr-collections { grid-template-columns: 1fr; }
  .disc-card-footer { flex-wrap: wrap; }
  .scr-personal-bar .btn-primary { width: 100%; }
}

/* ── Header account cluster: inbox icon + profile menu ─────────────────────── */
.header-icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  background: none; border: 1px solid var(--border); border-radius: 50%;
  color: var(--text-muted); cursor: pointer;
}
.header-icon-btn:hover { color: var(--text); border-color: var(--border-strong, var(--border)); background: var(--surface2); }
.header-badge-dot { position: absolute; top: 1px; right: 1px; }
.profile-wrap { position: relative; }
.profile-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 400;
  min-width: 268px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  padding: 6px; text-align: left;
}
.profile-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.profile-menu-name { font-size: 13px; font-weight: 700; }
.profile-menu-sub { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }
/* Doc 11 §7: the quiet meter — plain text, no color states, no urgency. */
.profile-menu-credits { font-size: 10.5px; color: var(--text-faint); margin-top: 6px; }
/* Standing compliance rule (product_discussions.md): point-of-output
   disclaimer under AI verdict surfaces (comparison + portfolio). */
.output-disclaimer {
  margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border);
  font-size: 10.5px; line-height: 1.5; color: var(--text-faint);
}

/* 👍/👎 thesis feedback (doc 17 §5.3) — calm: one small row, no toasts. */
.fb-block {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: 8px; font-size: 11px; color: var(--text-faint);
}
.fb-label { margin-right: 2px; }
.fb-btn {
  background: none; border: 1px solid var(--border); border-radius: 999px;
  padding: 1px 8px; font-size: 12px; cursor: pointer; line-height: 1.5;
  filter: grayscale(1); opacity: .7;
}
.fb-btn:hover { opacity: 1; }
.fb-btn.on { filter: none; opacity: 1; border-color: var(--accent); background: var(--surface2); }
.fb-detail { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; width: 100%; margin-top: 4px; }
.fb-chip {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 999px;
  padding: 2px 9px; font-size: 10.5px; color: var(--text-muted); cursor: pointer;
}
.fb-chip.on { border-color: var(--accent); color: var(--text); }
.fb-comment {
  flex: 1; min-width: 160px; padding: 3px 8px; font: inherit; font-size: 11px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text);
}
.fb-send { font-weight: 600; }

/* Backtest page tables (doc 17 §5.2) */
.bt-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.bt-table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-faint); padding: 5px 10px 5px 0; border-bottom: 1px solid var(--border);
}
.bt-table td { padding: 5px 10px 5px 0; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.bt-table th.num, .bt-table td.num { text-align: right; padding-right: 16px; }
.profile-menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 8px 10px;
  background: none; border: none; border-radius: var(--radius-sm);
  font: inherit; font-size: 12.5px; color: var(--text); text-align: left; cursor: pointer;
}
.profile-menu-item:hover { background: var(--surface2); }
.profile-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }
.profile-menu-disabled { color: var(--text-faint); cursor: default; white-space: nowrap; }
.profile-menu-disabled:hover { background: none; }
.profile-soon-chip {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 7px; border-radius: 999px;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-faint);
  white-space: nowrap;
}
.settings-row { margin: 14px 0; }
.settings-label {
  display: block; margin-bottom: 6px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted);
}
.settings-hint { margin-top: 6px; font-size: 11px; color: var(--text-faint); line-height: 1.5; }

/* ── Inbox (contract: docs/features.md "In-app Inbox") ─────────────────────── */
.inbox-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-blue);
}
.inbox-empty {
  padding: 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px; color: var(--text-muted); line-height: 1.7;
}
.inbox-empty a { color: var(--accent-blue); }
.inbox-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 12px;
}
.inbox-item.unread { border-left: 3px solid var(--accent-blue); }
.inbox-item-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.inbox-item-type {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--accent-blue);
}
.inbox-item-date { font-size: 11px; color: var(--text-faint); }
.inbox-item-body { font-size: 13px; color: var(--text-muted); line-height: 1.65; }
.inbox-verdicts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.inbox-verdict-chip {
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 5px 11px; font-size: 12px; color: var(--text); cursor: pointer; font-family: inherit;
}
.inbox-verdict-chip:hover { border-color: var(--accent-blue); }
.inbox-note {
  margin: 8px 0 0; padding: 9px 13px;
  background: var(--surface2); border-left: 3px solid var(--border-strong, var(--border));
  border-radius: var(--radius-sm); font-style: italic;
}
.inbox-note-when { display: block; margin-top: 4px; font-size: 10.5px; font-style: normal; color: var(--text-faint); }

/* ── Notes dock (always-available scratchpad, context follows the active tab) ── */
.notes-dock {
  position: fixed;
  right: 18px;
  bottom: 44px;   /* clears the compliance bar */
  z-index: 250;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.notes-dock-pill {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
}
.notes-dock-pill:hover { border-color: var(--blue); color: var(--blue); }
.notes-dock.collapsed .notes-dock-pill { display: inline-flex; }
.notes-dock.collapsed .notes-dock-panel { display: none; }

.notes-dock-panel {
  display: flex;
  flex-direction: column;
  width: 330px;
  max-height: min(430px, 60vh);
  background: var(--surface);
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.notes-dock-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.notes-dock-title { font-size: 12.5px; font-weight: 700; color: var(--text); }
.notes-dock-context {
  font-size: 11px; font-weight: 700;
  color: var(--blue); background: var(--blue-light);
  border-radius: 10px; padding: 2px 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px;
}
.notes-dock-min {
  margin-left: auto;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px; font-weight: 700; font-family: var(--font);
  padding: 0 4px; line-height: 1;
}
.notes-dock-min:hover { color: var(--text); }

.notes-dock-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 12px;
}
.notes-dock-empty { font-size: 11.5px; color: var(--text-faint); padding: 8px 0; }

.notes-dock-item { padding: 7px 0; border-bottom: 1px solid var(--border); }
.notes-dock-item:last-child { border-bottom: none; }
.notes-dock-item-text { font-size: 12px; color: var(--text); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.notes-dock-item-meta { font-size: 10.5px; color: var(--text-faint); margin-top: 3px; }
.notes-dock-item-del { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 10.5px; padding: 0; font-family: var(--font); }
.notes-dock-item-del:hover { color: var(--red); }

.notes-dock-compose { border-top: 1px solid var(--border); padding: 9px 12px 10px; flex-shrink: 0; }
.notes-dock-input {
  width: 100%;
  resize: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font);
  line-height: 1.5;
  padding: 7px 9px;
  outline: none;
}
.notes-dock-input:focus { border-color: var(--blue); background: var(--surface); }
.notes-dock-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.notes-dock-hint { font-size: 10px; color: var(--text-faint); flex: 1; min-width: 0; }
.notes-dock-save {
  padding: 6px 14px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
}
.notes-dock-save:hover { opacity: 0.9; }
.notes-dock-save:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 900px) {
  .notes-dock { right: 10px; bottom: 40px; }
  .notes-dock-panel { width: min(330px, calc(100vw - 20px)); }
}

/* ── Selection → note chip ──────────────────────────────────────────────────── */
.sel-note-chip {
  position: fixed;
  z-index: 400;
  padding: 5px 11px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: var(--shadow);
}
.sel-note-chip:hover { opacity: 0.92; }

/* ── Recently viewed (sidebar) ──────────────────────────────────────────────── */
.sidebar-section-header-static { cursor: default; }
.sidebar-section-header-static:hover { background: var(--surface); }
.sidebar-recent-list { overflow-y: auto; max-height: 22vh; padding: 2px 0 4px; }
.recent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.recent-item:hover { background: var(--surface2); }
.recent-item-ticker { font-size: 12.5px; font-weight: 700; color: var(--text); }
.recent-item-when { font-size: 10.5px; color: var(--text-faint); margin-left: auto; }
.recent-item-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-faint); font-size: 13px; line-height: 1; padding: 0;
  opacity: 0; transition: opacity 0.1s;
}
.recent-item:hover .recent-item-remove { opacity: 1; }
.recent-item-remove:hover { color: var(--red); }

/* ── Notes page (workspace tab) ─────────────────────────────────────────────── */
.notes-page-wrap { padding: 20px 24px; }
.notes-page-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 1100px) { .notes-page-grid { grid-template-columns: 1fr; } }

.notes-page-title { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 2px; }
.notes-page-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.notes-col-head {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); margin-bottom: 10px;
}

.note-group {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.note-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.note-group-key { font-size: 13px; font-weight: 800; color: var(--text); }
.note-group-actions { display: flex; gap: 6px; margin-left: auto; }
.note-group-act {
  padding: 3px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 10.5px; font-weight: 600; font-family: var(--font);
  color: var(--text-muted); cursor: pointer;
  white-space: nowrap;
}
.note-group-act:hover { border-color: var(--blue); color: var(--blue); }

.note-row { padding: 7px 0; border-bottom: 1px solid var(--border); }
.note-row:last-child { border-bottom: none; }
.note-row-text { font-size: 12.5px; color: var(--text); line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.note-row-meta { font-size: 10.5px; color: var(--text-faint); margin-top: 3px; }
.note-row-del { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 10.5px; padding: 0; font-family: var(--font); }
.note-row-del:hover { color: var(--red); }

.thesis-lib-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 7px;
  flex-wrap: wrap;
}
.thesis-lib-ticker { font-size: 13px; font-weight: 800; color: var(--text); }
.thesis-lib-type { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.thesis-lib-verdict {
  font-size: 10.5px; font-weight: 700;
  border-radius: 10px; padding: 2px 8px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
}
.thesis-lib-when { font-size: 10.5px; color: var(--text-faint); margin-left: auto; }
.thesis-lib-actions { display: flex; gap: 6px; }

/* ── Metrics highlighting: worst-in-class + legend ──────────────────────────── */
.worst { color: #d97706 !important; }               /* muted amber — trails the group */
[data-theme="dark"] .worst { color: #f59e0b !important; }

.metrics-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 10px 16px 0;
  font-size: 10.5px;
  color: var(--text-faint);
}
.legend-chip { display: inline-flex; align-items: center; gap: 5px; }
.legend-chip::before { content: '●'; font-size: 9px; }
.legend-best::before  { color: var(--green); }
.legend-worst::before { color: #d97706; }
[data-theme="dark"] .legend-worst::before { color: #f59e0b; }
.legend-bad::before   { color: var(--red); }

/* ── Partial analysis banner (data in, theses still generating) ─────────────── */
.partial-banner {
  margin: 14px 16px 4px;
  padding: 9px 14px;
  background: var(--blue-light);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text);
}
.thesis-pending-dot { font-size: 10px; }

/* ── Coach ordering hint (Guided mode only) ─────────────────────────────────── */
.coach-order-hint {
  display: none;
  margin: 4px 0 10px;
  padding: 8px 12px;
  background: var(--surface2);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-muted);
}
body.guided-mode .coach-order-hint { display: block; }

/* ── Thesis refresh (tier-2 cache: served while data has moved) ─────────────── */
.thesis-refresh-btn {
  margin-left: 6px;
  padding: 3px 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s;
}
.thesis-refresh-btn:hover { border-color: var(--blue); color: var(--blue); }

/* ── Touch-target pass (2026-08-02 audit: 44px minimum at phone width) ────────
   Deliberately the last section of the file so it wins the cascade over every
   component rule above. Controls in tight flex rows (header, tabs, chips) keep
   their visual size and get an invisible centred 44×44 hit area via ::after —
   no layout pressure, so the zero-horizontal-overflow guarantee holds.
   Free-standing controls get real size bumps. */
@media (max-width: 900px) {
  .seg-btn { min-height: 44px; }
  .scr-hide-owned { min-height: 44px; flex-wrap: wrap; }
  .scr-hide-owned input { width: 20px; height: 20px; }
  .scr-sector-chip { padding: 9px 14px; }
  .info-toggle-btn { min-height: 44px; }
  .sidebar-new-list-confirm, .notes-dock-save { min-height: 44px; }
  /* The list switcher is the sidebar's primary control on a phone, and every
     row in it is a destination — all free-standing, so they take real size
     rather than a ::after hit area (§15's 44px rule, doc 12 §1 sweep). */
  .sidebar-list-header, .sidebar-list-option, .sidebar-new-list-btn,
  .sidebar-list-manage, .sidebar-new-list-input, .sidebar-new-list-kind { min-height: 44px; }

  .sidebar-toggle, .header-icon-btn, .wtab-close, .chip-remove,
  .notes-dock-min, .notes-dock-item-del {
    position: relative;
  }
  .sidebar-toggle::after, .header-icon-btn::after, .wtab-close::after,
  .chip-remove::after, .notes-dock-min::after, .notes-dock-item-del::after {
    content: '';
    position: absolute; left: 50%; top: 50%;
    width: 44px; height: 44px;
    transform: translate(-50%, -50%);
  }
  /* Hover-revealed × buttons make no sense without a cursor — always visible */
  .wtab-close, .chip-remove, .notes-dock-item-del { opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   App shell v2 — docs/product_discussions.md 2026-08-17
   Mockups: docs/mockups/app_chat_workspace.html (desktop) · app_mobile.html
   ══════════════════════════════════════════════════════════════════════════ */

.header-spacer { flex: 1; min-width: 0; }

/* Macro strip moved into the header: ambient context earns a corner, not a row. */
.header .macro-bar {
  background: none; border: none; padding: 0; margin: 0;
  max-width: 46vw; flex-shrink: 1;
}

/* Profile: an identity, not a glyph (§13). Upgrades to an <img> avatar later. */
.avatar-btn {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font); font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
  background: var(--surface2); color: var(--text-muted);
  border: 1px solid var(--border-strong); cursor: pointer;
}
.avatar-btn:hover { color: var(--text); border-color: var(--accent-blue); }
.profile-menu-stage { margin-top: 7px; }
.profile-menu-stage:empty { display: none; }

/* ── Omnibox (§2) ─────────────────────────────────────────────────────────── */
.omni-wrap { position: relative; flex-shrink: 0; margin-bottom: 10px; }
.omni {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 10px 12px;
  box-shadow: var(--shadow-sm);
}
.omni:focus-within { border-color: var(--accent-blue); }
.omni-ico { color: var(--text-faint); flex-shrink: 0; display: grid; place-items: center; }
.omni-ico svg { width: 17px; height: 17px; display: block; }
.omni-input {
  flex: 1; min-width: 0; background: none; border: none; outline: none;
  font-family: var(--font); font-size: 14px; color: var(--text);
}
.omni-input::placeholder { color: var(--text-faint); }
.omni-go {
  width: 30px; height: 30px; flex-shrink: 0; border: none; border-radius: 8px;
  background: var(--accent-blue); color: #fff; cursor: pointer;
  display: grid; place-items: center;
}
.omni-go svg { width: 15px; height: 15px; }
.omni-spinner {
  width: 14px; height: 14px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent-blue);
  animation: omni-spin .8s linear infinite;
}
@keyframes omni-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .omni-spinner { animation: none; } }

/* The dropdown previews the routing decision AND its price before Enter. */
.omni-drop {
  position: absolute; left: 0; right: 0; top: calc(100% + 5px); z-index: 60;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  overflow: hidden; max-height: 62vh; overflow-y: auto;
}
.od-group {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint); padding: 9px 13px 3px;
}
.od-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px;
  font-size: 12.5px; cursor: pointer; min-height: 44px;
}
.od-row:hover, .od-row.sel { background: var(--surface2); }
.od-sym { font-weight: 700; width: 54px; flex-shrink: 0; display: flex; align-items: center; }
.od-ico { width: 15px; height: 15px; color: var(--text-muted); }
.od-desc { color: var(--text-muted); min-width: 0; }
.od-why { font-size: 11px; color: var(--text-faint); }
.od-tag { margin-left: auto; font-size: 10px; color: var(--text-faint); flex-shrink: 0; }
.od-ask { border-top: 1px solid var(--border); background: var(--blue-light); }
.od-ask .od-desc { color: var(--text); }

/* ── Launcher (§3) — one catalogue, rendered on Home and behind ＋ ─────────── */
.home-launch-title { font-size: 14px; font-weight: 700; margin: 22px 0 3px; }
.home-launch-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.lgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 9px; margin-bottom: 8px;
}
.lcard {
  text-align: left; font-family: var(--font); cursor: pointer; color: var(--text);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 13px; min-height: 56px;
}
.lcard:hover { border-color: var(--accent-blue); }
.lcard-h { font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.lcard-ico { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.lcard-d { font-size: 11px; color: var(--text-muted); line-height: 1.5; margin-top: 4px; display: block; }
.lcard-t { font-size: 10px; color: var(--text-faint); margin-top: 6px; display: block; }
/* Gated tools render dimmed with the reason — hiding a feature means a user
   cannot want it (§3). This replaces the old display:none gating on Home. */
.lcard.locked { opacity: .55; }
.lcard.locked .lcard-t { color: var(--amber); }

.launcher {
  position: absolute; inset: 46px 10px 10px 10px; z-index: 70; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px 17px;
}
.launcher-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.launcher-input {
  flex: 1; min-width: 0; font-family: var(--font); font-size: 13px; padding: 10px 12px;
  color: var(--text); background: var(--surface2);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); outline: none;
}
.launcher-input:focus { border-color: var(--accent-blue); }
.launcher-esc {
  font-family: var(--font); font-size: 11px; background: none; cursor: pointer;
  border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 999px; padding: 6px 12px; min-height: 34px;
}

/* ── Tab bar: Home pinned, ＋ opens the launcher (§4) ──────────────────────── */
.wtab-home { gap: 6px; }
.wtab-ico { flex-shrink: 0; }
.wtab-add {
  background: none; border: none; color: var(--text-faint);
  font-size: 15px; cursor: pointer; padding: 6px 10px; flex-shrink: 0;
  align-self: center;
}
.wtab-add:hover { color: var(--accent-blue); }

/* ── Selection bar (§9): exists only while something is ticked ────────────── */
.watch-select {
  width: 15px; height: 15px; flex-shrink: 0; accent-color: var(--accent-blue);
  margin: 0 2px 0 0; cursor: pointer;
}
.selbar {
  flex-shrink: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 10px; border-top: 1px solid var(--border); background: var(--surface2);
  font-size: 11.5px; color: var(--text-muted);
}
.selbar[hidden] { display: none; }
.selbar-cost { font-size: 10.5px; color: var(--text-faint); flex: 1; min-width: 0; }
.selbar-clear {
  font-family: var(--font); font-size: 11.5px; background: none; border: none;
  color: var(--text-muted); cursor: pointer; padding: 6px 4px;
}
.selbar-clear:hover { color: var(--text); }
.selbar-cta {
  font-family: var(--font); font-size: 11.5px; font-weight: 600; cursor: pointer;
  background: var(--accent-blue); color: #fff; border: none;
  border-radius: var(--radius-xs); padding: 8px 13px; min-height: 36px;
}
.selbar-cta:hover { filter: brightness(1.08); }

/* ── Compliance bar: also the quiet home for About / Terms / Help (§14) ───── */
.compliance-bar { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.compliance-text { flex: 1; min-width: 0; }
.compliance-links { display: flex; gap: 10px; flex-shrink: 0; }
.compliance-link {
  font-family: var(--font); font-size: inherit; background: none; border: none;
  color: var(--text-faint); cursor: pointer; padding: 0;
  text-decoration: underline; text-underline-offset: 2px;
}
.compliance-link:hover { color: var(--text-muted); }

/* ── Mobile mode bar + tab switcher sheet (§15) ───────────────────────────── */
.mobile-bar { display: none; }
.tabsheet { display: none; }

@media (max-width: 700px) {
  /* Ambient index quotes duplicate the daily brief on a phone. */
  .header .macro-bar { display: none; }

  .mobile-bar {
    display: flex; flex-shrink: 0; background: var(--surface);
    border-top: 1px solid var(--border); padding: 3px 0 4px;
  }
  .mbar-btn {
    flex: 1; min-height: 50px; font-family: var(--font); font-size: 10px;
    cursor: pointer; background: none; border: none; color: var(--text-faint);
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 5px 0; position: relative;
  }
  .mbar-btn svg { width: 20px; height: 20px; }
  .mbar-btn.on { color: var(--accent-blue); font-weight: 700; }
  .mbar-count {
    position: absolute; top: 2px; right: 50%; margin-right: -20px;
    font-size: 9px; font-weight: 700; background: var(--accent-blue); color: #fff;
    border-radius: 999px; padding: 0 4px; min-width: 14px; line-height: 14px;
  }

  /* The tab strip is replaced by the sheet — a vertical list scales to 20 tabs
     where a horizontal strip dies at four. */
  .wtab-bar { display: none !important; }

  .tabsheet {
    display: flex; position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,.45); align-items: flex-end;
  }
  .tabsheet[hidden] { display: none; }
  .tabsheet-in {
    width: 100%; max-height: 76vh; overflow-y: auto; background: var(--surface);
    border-radius: 18px 18px 0 0; padding: 8px 0 16px;
  }
  .tabsheet-grab {
    width: 38px; height: 4px; border-radius: 3px;
    background: var(--border-strong); margin: 4px auto 10px;
  }
  .tabsheet-head {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
    color: var(--text-faint); padding: 4px 16px 8px; display: flex; align-items: center;
  }
  .tabsheet-done {
    margin-left: auto; font-family: var(--font); font-size: 12px; font-weight: 600;
    background: none; border: none; color: var(--accent-blue); cursor: pointer;
    text-transform: none; letter-spacing: 0; padding: 6px 2px;
  }
  .tsrow {
    display: flex; align-items: center; gap: 11px; padding: 11px 16px;
    min-height: 56px; cursor: pointer; border-top: 1px solid var(--border);
  }
  .tsrow.on { background: var(--surface2); box-shadow: inset 3px 0 0 var(--accent-blue); }
  .tsrow-t { min-width: 0; }
  .tsrow-t b { font-size: 13px; display: block; }
  .tsrow-t span { font-size: 10.5px; color: var(--text-faint); }
  .tsrow-pin {
    margin-left: auto; flex-shrink: 0; font-size: 9.5px; color: var(--text-faint);
    border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px;
  }
  .tsrow-x {
    margin-left: auto; width: 40px; height: 40px; flex-shrink: 0; border: none;
    background: none; color: var(--text-faint); cursor: pointer; font-size: 17px;
    border-radius: 9px;
  }
  .tsrow-x:hover { color: var(--red); background: var(--surface3); }

  /* Launcher fills the screen rather than floating in a small workspace. */
  .launcher { inset: 8px; }
  .lgrid { grid-template-columns: 1fr; }

  .omni { padding: 9px 11px; }
  .omni-input { font-size: 15px; }
}

/* ── Phone: ticker sub-tabs become stacked sections (§15) ─────────────────── */
@media (max-width: 700px) {
  .ticker-inner-tabs { display: none; }
  .ticker-view.acc-applied .ticker-view-body { display: block; }

  .tacc-head {
    display: flex; align-items: center; gap: 9px; width: 100%;
    max-width: 100%; text-align: left; font-family: var(--font);
    background: none; border: none; border-top: 1px solid var(--border);
    color: var(--text); cursor: pointer;
    padding: 13px 0; min-height: 48px; font-size: 13px; font-weight: 600;
  }
  .tacc-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tacc-chev {
    margin-left: auto; flex-shrink: 0; width: 14px; height: 14px;
    color: var(--text-faint); display: grid; place-items: center;
    transition: transform .15s;
  }
  .tacc-chev svg { width: 14px; height: 14px; display: block; }
  .tacc-head[aria-expanded="true"] .tacc-chev { transform: rotate(90deg); }

  .ticker-inner-panel.tacc-panel { display: none; padding: 0 0 14px; }
  .ticker-inner-panel.tacc-panel.tacc-open { display: block; }
  .ticker-inner-panel.tacc-panel.panel-fill { height: auto; }
}

/* ── Phone: the comparison table transposes instead of scrolling (§15) ────── */
.metrics-wrap { max-width: 100%; }

@media (max-width: 700px) {
  .metrics-wrap .metrics-table,
  .metrics-wrap .metrics-table thead,
  .metrics-wrap .metrics-table tbody,
  .metrics-wrap .metrics-table tr,
  .metrics-wrap .metrics-table td { display: block; width: auto; }
  .metrics-wrap .metrics-table thead { display: none; }

  /* Each metric row becomes a card; each value cell becomes a labelled line. */
  .metrics-wrap .metrics-table tr {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px;
  }
  .metrics-wrap .metrics-table tr.section-row {
    background: none; border: none; padding: 14px 0 2px; margin: 0;
  }
  .metrics-wrap .metrics-table tr.section-row td {
    font-size: 10px; font-weight: 700; letter-spacing: .07em;
    text-transform: uppercase; color: var(--text-faint); padding: 0; border: none;
  }
  .metrics-wrap .metrics-table td.metric-name {
    font-size: 12.5px; font-weight: 700; color: var(--text);
    padding: 0 0 7px; border: none;
  }
  .metrics-wrap .metrics-table td.val-cell {
    display: flex; align-items: baseline; gap: 10px;
    padding: 4px 0; border: none; text-align: right;
    font-variant-numeric: tabular-nums;
  }
  /* The ticker label the removed thead used to carry. */
  .metrics-wrap .metrics-table td.val-cell::before {
    content: attr(data-t);
    flex: 1; text-align: left; font-size: 11.5px; font-weight: 700;
    color: var(--text-muted); letter-spacing: .02em;
  }
  .metrics-legend { flex-wrap: wrap; }
}

/* Header icon buttons: grid-centre the SVG so the glyph can never overflow the
   box (the overflow check found 37px content in a 30px button), and give them a
   real touch target on phones — part of the ≥44px pass (§15). */
.header .theme-btn.sidebar-toggle,
.header .header-icon-btn {
  display: inline-grid; place-items: center; padding: 0; overflow: hidden;
}
@media (max-width: 700px) {
  .header .theme-btn.sidebar-toggle,
  .header .header-icon-btn,
  .header .avatar-btn { width: 44px; height: 44px; }
  .header .header-icon-btn, .header .avatar-btn { border-radius: 50%; }
  .header { gap: 4px; padding: 0 6px; }
}
