*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --orange: #F5A623;
  --orange-dim: rgba(245,166,35,0.12);
  --orange-border: rgba(245,166,35,0.3);
  --sb-bg: #F8F8F8;
  --sb-border: #E4E4E4;
  --sb-section: #9B9B9B;
  --sb-icon: #6B6B6B;
  --sb-text: #4A4A4A;
  --sb-hover-bg: #EFEFEF;
  --sb-active-bg: rgba(245,166,35,0.14);
  --sb-active-text: #F5A623;
  --sb-logo-bg: #2E3033;
  --sb-logo-border: #3A3D40;
  --main-bg: #fff;
  --border: #EAECEF;
  --text: #111827;
  --muted: #6B7280;
  --subtle: #F9FAFB;
  --green: #15803d; --green-bg: #f0fdf4; --green-border: #bbf7d0;
  --red: #b91c1c;   --red-bg: #fef2f2;   --red-border: #fecaca;
  --amber-bg: #fffbeb; --amber-text: #92400e;
  --font: 'DM Sans', system-ui, sans-serif;
  --mono: 'DM Mono', monospace;
  --body-bg: #E4E4E4;
  --card-bg: #fff;
  --hover-track: #F3F4F6;
  --bar-track-bg: #F3F4F6;
  --segment-bar-empty: #E5E7EB;
  --crux-bg: #FFFBEB;
  --crux-border: #FDE68A;
  --crux-strong: #92400E;
  --ai-pill-bg: #eef2ff;
  --ai-pill-border: #c7d2fe;
  --ai-pill-text: #4f46e5;
  --status-info-bg: #eff6ff;
  --status-info-border: #bfdbfe;
  --status-info-text: #1e40af;
}
body.dark {
  --sb-bg: #16181d;
  --sb-border: #2a2e35;
  --sb-section: #6b7280;
  --sb-icon: #9ca3af;
  --sb-text: #cbd5e0;
  --sb-hover-bg: #1f2229;
  --sb-active-bg: rgba(245,166,35,0.16);
  --sb-active-text: var(--orange);
  --sb-logo-bg: #0f1115;
  --sb-logo-border: #2a2e35;
  --main-bg: #16181d;
  --border: #2a2e35;
  --text: #E5E7EB;
  --muted: #9ca3af;
  --subtle: #1c1f25;
  --green-bg: #082d1c; --green-border: #14532d; --green: #4ade80;
  --red-bg:   #2d0e10; --red-border:   #7f1d1d; --red:   #f87171;
  --amber-bg: #2a1e07; --amber-text: #facc15;
  --orange-dim: rgba(245,166,35,0.18);
  --orange-border: rgba(245,166,35,0.45);
  --body-bg: #0f1115;
  --card-bg: #1c1f25;
  --hover-track: #2a2e35;
  --bar-track-bg: #242830;
  --segment-bar-empty: #2a2e35;
  --crux-bg: #2a1e07;
  --crux-border: #78350f;
  --crux-strong: #fcd34d;
  --ai-pill-bg: #1e1b3a; --ai-pill-border: #4338ca; --ai-pill-text: #a5b4fc;
  --status-info-bg: #0c1c34; --status-info-border: #1e3a8a; --status-info-text: #93c5fd;
}
html, body { height: 100%; overflow: hidden; }
body { font-family: var(--font); display: flex; background: var(--body-bg); color: var(--text); }
.shell { display: flex; width: 100vw; height: 100vh; }

/* ══════════════════ SIDEBAR ══════════════════ */
.sidebar {
  width: 236px; flex-shrink: 0;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  display: flex; flex-direction: column; overflow: hidden;
  transition: width 0.15s ease, border-right-color 0.15s ease;
}
.sidebar.hidden {
  width: 0;
  border-right-color: transparent;
}
.sb-logo {
  display: flex; align-items: center; gap: 9px;
  padding: 15px 14px 13px;
  background: var(--sb-logo-bg);
  border-bottom: 1px solid var(--sb-logo-border);
  flex-shrink: 0;
  cursor: pointer;
}
.sb-logo-img { width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0; }
.sb-logo-text-wrap { display: flex; align-items: baseline; gap: 0; }
.sb-logo-tikr { font-size: 17px; font-weight: 700; color: #F0F0F0; letter-spacing: -0.01em; }
.sb-logo-play { font-size: 11px; font-weight: 500; color: #888; letter-spacing: 0.01em; }
.sb-logo-play-arrow { color: var(--orange); font-size: 10px; margin-right: 1px; }
.sb-scroll { flex: 1; overflow-y: auto; padding-bottom: 10px; }
.sb-scroll::-webkit-scrollbar { width: 3px; }
.sb-scroll::-webkit-scrollbar-thumb { background: #D4D4D4; border-radius: 3px; }
.sb-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 5px;
  cursor: pointer;
  user-select: none;
}
.sb-section-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--sb-section);
}
.sb-section-chevron {
  color: #AEAEAE; transition: transform 0.2s;
  display: flex; align-items: center;
}
.sb-section-chevron.open { transform: rotate(180deg); }
.sb-group { overflow: hidden; transition: max-height 0.2s ease; }
.sb-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px;
  margin: 1px 8px;
  font-size: 12.5px; color: var(--sb-text);
  cursor: pointer; border-radius: 5px;
  transition: background 0.1s, color 0.1s;
  user-select: none;
}
.sb-item:hover { background: var(--sb-hover-bg); }
.sb-item.active {
  background: var(--sb-active-bg);
  color: var(--sb-active-text);
}
.sb-item svg { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.7; }
.sb-item.active svg { opacity: 1; }
.sb-item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-item-ticker {
  font-family: var(--mono); font-size: 9.5px; font-weight: 500;
  color: #555; flex-shrink: 0;
}
.sb-item.active .sb-item-ticker { color: var(--orange); }
.sb-divider { height: 1px; background: #E4E4E4; margin: 8px 0; }

/* ══════════════════ MAIN ══════════════════ */
.main { flex: 1; background: var(--main-bg); display: flex; flex-direction: column; overflow: hidden; }

/* ── Home / Search state ── */
.home-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 20px;
}
.home-logo-area { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; }
.home-logo-img { width: 44px; height: 44px; border-radius: 11px; }
.home-logo-tikr { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.home-logo-play { font-size: 13px; font-weight: 500; color: #9CA3AF; letter-spacing: 0.01em; }
.home-logo-arrow { color: var(--orange); margin-right: 1px; }
.home-search-wrap { width: 100%; max-width: 540px; position: relative; }
.home-search-box {
  display: flex; align-items: center; gap: 10px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 13px 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06), 0 0 0 0px rgba(245,166,35,0);
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: text;
}
.home-search-box:focus-within {
  border-color: var(--orange);
  box-shadow: 0 2px 16px rgba(0,0,0,0.08), 0 0 0 3px rgba(245,166,35,0.12);
}
.home-search-box svg { flex-shrink: 0; color: #9CA3AF; }
.home-search-box input {
  flex: 1; border: none; outline: none;
  font-family: var(--font); font-size: 15px;
  color: var(--text); background: transparent;
}
.home-search-box input::placeholder { color: #9CA3AF; }
.home-sub { margin-top: 14px; font-size: 13px; color: var(--muted); text-align: center; }

.home-suggestions { width: 100%; max-width: 600px; margin-top: 36px; }
.home-suggestions-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 12px; text-align: left;
}
.home-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.suggest-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
  /* Let grid 1fr columns shrink below intrinsic content width — without this,
     a single card with a long un-wrappable name (e.g. Roundhill ETF Trust)
     forces the whole grid wider than its parent's max-width, decentering it. */
  min-width: 0;
}
.suggest-card:hover {
  border-color: var(--orange);
  box-shadow: 0 2px 8px rgba(245,166,35,0.12);
}
.suggest-card-soon { cursor: default; }
.suggest-card-soon:hover { border-color: var(--border); box-shadow: none; }
.suggest-ticker-soon { color: var(--muted); }
.suggest-name-soon { color: var(--muted); }
.suggest-ticker {
  font-family: var(--mono);
  font-size: 13px; font-weight: 600;
  color: var(--orange);
  margin-bottom: 4px;
}
.suggest-name {
  font-size: 12.5px; font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.suggest-sector {
  font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.home-dropdown {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  overflow: hidden; z-index: 100;
}
.home-dropdown.open { display: block; }
.hd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s;
}
.hd-item:last-child { border-bottom: none; }
.hd-item:hover { background: #fafafa; }
.hd-ticker {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  color: var(--orange); background: var(--orange-dim);
  border: 1px solid var(--orange-border);
  padding: 2px 6px; border-radius: 4px; flex-shrink: 0; min-width: 44px; text-align: center;
}
.hd-name { font-size: 13.5px; color: var(--text); font-weight: 500; }
.hd-sector { font-size: 12px; color: var(--muted); margin-left: auto; flex-shrink: 0; }
.hd-item-soon { cursor: default; opacity: 0.6; }
.hd-item-soon:hover { background: #fff; }
.hd-ticker-soon { font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--muted); background: #f3f4f6; border: 1px solid var(--border); padding: 2px 6px; border-radius: 4px; flex-shrink: 0; min-width: 44px; text-align: center; }
.hd-name-soon { font-size: 13.5px; color: var(--muted); font-weight: 500; }
.hd-coming-soon { margin-left: auto; flex-shrink: 0; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 4px; padding: 2px 7px; }

/* ── Company view ── */
.company-view { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.company-view.show { display: flex; }
.co-header {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; flex-shrink: 0;
}
.co-header-left { display: flex; align-items: center; gap: 14px; }
.co-logo-box {
  width: 48px; height: 48px; border-radius: 10px;
  border: 1px solid #E5E7EB;
  background: #F9FAFB;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.co-logo-box svg { width: 28px; height: 28px; }
.co-name-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.co-ticker-big {
  font-size: 22px; font-weight: 700;
  color: var(--orange); letter-spacing: -0.02em;
}
.co-name-text {
  font-size: 15px; font-weight: 400; color: #333;
}
.co-exch-pill {
  font-size: 11px; color: #555;
  border: 1px solid #D1D5DB;
  border-radius: 4px; padding: 2px 7px;
  background: #fff;
}
.co-sector-row { font-size: 12.5px; color: var(--muted); }
.co-search-bar {
  padding: 8px 22px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
  position: relative;
}
.co-search-inner {
  display: flex; align-items: center; gap: 8px;
  background: var(--subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 12px;
  transition: border-color 0.15s;
}
.co-search-inner:focus-within { border-color: var(--orange); background: #fff; }
.co-search-inner input {
  flex: 1; border: none; outline: none;
  font-family: var(--font); font-size: 13px;
  color: var(--text); background: transparent;
}
.co-search-inner input::placeholder { color: #9CA3AF; }
.co-search-dropdown {
  display: none; position: absolute;
  top: calc(100% - 1px); left: 22px; right: 22px;
  background: #fff; border: 1px solid var(--border);
  border-top: none; border-radius: 0 0 6px 6px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  overflow: hidden; z-index: 100;
}
.co-search-dropdown.open { display: block; }
.co-header-right { text-align: right; flex-shrink: 0; }
.co-price-usd { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.co-price-currency { font-size: 13px; font-weight: 500; color: #6B7280; margin-right: 4px; }
.co-chg-row { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 2px; }
.co-chg-val { font-size: 13px; font-weight: 500; }
.co-date-row { font-size: 11px; color: #9CA3AF; margin-top: 3px; }
.co-logo-box img { width: 100%; height: 100%; object-fit: contain; }
.pos { color: var(--green); } .neg { color: var(--red); }

/* Tab bar */
.tab-bar {
  display: flex; background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 22px; overflow-x: auto; flex-shrink: 0; scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 5px;
  padding: 10px 13px; font-size: 12.5px; font-weight: 500;
  color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap; margin-bottom: -1px;
  transition: color 0.1s; user-select: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--orange); }
.tab svg { width: 13px; height: 13px; flex-shrink: 0; }

/* Content area */
.content-area {
  flex: 1; overflow-y: auto; padding: 20px 22px;
  background: var(--subtle);
}
.content-area::-webkit-scrollbar { width: 4px; }
.content-area::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }
.panel { display: none; }
.panel.show { display: block; }

/* ══════════════════ AI-COMPOSED COMPONENTS (the palette Opus uses) ═══════ */

/* Cards */
.card { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 16px 18px; margin-bottom: 12px; }
.card-title {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--border);
}

/* AI pill */
.ai-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 500; color: #4f46e5;
  background: #eef2ff; border: 1px solid #c7d2fe;
  border-radius: 3px; padding: 2px 8px; margin-bottom: 14px;
}

/* KPI strip */
.kpi-strip {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin-bottom: 12px;
}
.kpi-cell { background: #fff; padding: 13px 15px; }
.kpi-lbl { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.kpi-val { font-family: var(--mono); font-size: 16px; font-weight: 500; color: var(--text); }

/* Risks */
.risk-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: 6px; padding: 16px 18px; margin-bottom: 12px;
}
.risk-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.risk-badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 3px; flex-shrink: 0;
}
.risk-badge.high { background: var(--red-bg); color: var(--red); }
.risk-badge.med  { background: var(--amber-bg); color: var(--amber-text); }
.risk-badge.low  { background: var(--green-bg); color: var(--green); }
.risk-name { font-size: 13.5px; font-weight: 600; color: var(--red); }
.risk-intro { font-size: 13px; line-height: 1.7; color: var(--text); margin-bottom: 10px; }
.risk-bullets { margin: 0 0 10px 4px; padding: 0; list-style: none; }
.risk-bullets li {
  font-size: 13px; line-height: 1.65; color: var(--muted);
  padding: 3px 0 3px 16px; position: relative;
}
.risk-bullets li::before {
  content: "•"; position: absolute; left: 0;
  color: var(--muted); font-size: 14px; line-height: 1.5;
}
.risk-bottom {
  font-size: 13px; line-height: 1.65; color: var(--text);
  padding-top: 10px; border-top: 1px solid var(--border);
}
.risk-bottom strong { color: var(--text); font-weight: 600; }

/* Bar chart */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.bar-yr { font-family: var(--mono); font-size: 11px; color: var(--muted); width: 30px; text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; height: 22px; background: #F3F4F6; border-radius: 3px; overflow: hidden; }
.bar-fill {
  height: 100%; background: var(--orange); opacity: 0.8; border-radius: 3px; min-width: 4px;
  display: flex; align-items: center; padding-left: 8px;
  font-family: var(--mono); font-size: 11px; font-weight: 500; color: #7c3d00;
}

/* Debate */
.debate-topic {
  background: #fff; border: 1px solid var(--border);
  border-radius: 6px; padding: 18px 20px; margin-bottom: 12px;
}
.debate-topic-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 6px;
}
.debate-topic-intro {
  font-size: 13px; line-height: 1.7; color: var(--muted);
  margin-bottom: 14px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.debate-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.debate-side { border-radius: 5px; padding: 12px 14px; }
.debate-bull-side { background: var(--green-bg); border: 1px solid var(--green-border); }
.debate-bear-side { background: var(--red-bg);   border: 1px solid var(--red-border); }
.debate-side-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; margin-bottom: 6px;
}
.debate-bull-side .debate-side-label { color: var(--green); }
.debate-bear-side .debate-side-label { color: var(--red); }
.debate-side-intro {
  font-size: 12.5px; line-height: 1.65; margin-bottom: 8px;
}
.debate-bull-side .debate-side-intro { color: #166534; }
.debate-bear-side .debate-side-intro { color: #991b1b; }
.debate-side-bullets { list-style: none; padding: 0; margin: 0; }
.debate-side-bullets li {
  font-size: 12px; line-height: 1.65; color: var(--muted);
  padding: 3px 0 3px 14px; position: relative;
}
.debate-side-bullets li::before {
  content: "•"; position: absolute; left: 0; font-size: 13px; line-height: 1.5;
}
.debate-bull-side .debate-side-bullets li::before { color: var(--green); }
.debate-bear-side .debate-side-bullets li::before { color: var(--red); }
.debate-crux {
  font-size: 13px; line-height: 1.7;
  padding: 10px 14px; border-radius: 5px;
  background: #FFFBEB; border: 1px solid #FDE68A;
  color: var(--text);
}
.debate-crux strong { color: #92400E; font-weight: 600; }

/* Case (Bull/Bear) */
.case-hero { border-radius: 6px; padding: 14px 16px; margin-bottom: 14px; display: flex; align-items: center; gap: 12px; border: 1px solid; }
.case-bull { background: var(--green-bg); border-color: var(--green-border); }
.case-bear { background: var(--red-bg); border-color: var(--red-border); }
.case-emo { font-size: 26px; }
.case-ttl { font-size: 13.5px; font-weight: 600; }
.case-bull .case-ttl { color: var(--green); }
.case-bear .case-ttl { color: var(--red); }
.case-sub { font-size: 12px; margin-top: 2px; }
.case-bull .case-sub { color: #16a34a; }
.case-bear .case-sub { color: #b91c1c; }
.case-arg-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: 6px; padding: 16px 18px; margin-bottom: 12px;
}
.case-arg-title { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.case-arg-body { font-size: 13px; line-height: 1.7; color: var(--text); margin-bottom: 10px; }
.case-arg-bullets { list-style: none; padding: 0; margin: 0 0 10px 0; }
.case-arg-bullets li {
  font-size: 12.5px; line-height: 1.65; color: var(--muted);
  padding: 3px 0 3px 14px; position: relative;
}
.case-arg-bullets li::before { content: "•"; position: absolute; left: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.case-arg-risk {
  font-size: 12.5px; line-height: 1.65;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.case-arg-risk .risk-label { font-weight: 600; }
.bull .case-arg-risk .risk-label { color: var(--orange); }
.bear .case-arg-risk .risk-label { color: var(--red); }

/* Prose */
.prose { font-size: 13.5px; line-height: 1.75; color: var(--text); }
.prose + .prose { margin-top: 10px; }

/* Segments */
.segment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segment-card {
  border: 1px solid var(--border); border-radius: 5px; padding: 12px 14px;
  background: var(--subtle);
}
.segment-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.segment-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.segment-rev { font-size: 12px; font-weight: 600; color: var(--orange); font-family: var(--mono); }
.segment-share { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.segment-bar-track { height: 4px; background: #E5E7EB; border-radius: 2px; margin-bottom: 6px; }
.segment-bar-fill { height: 100%; background: var(--orange); border-radius: 2px; opacity: 0.7; }
.segment-body { font-size: 12px; line-height: 1.6; color: var(--muted); }

/* Growth + Watch list items */
.growth-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.growth-item:last-child { border-bottom: none; padding-bottom: 0; }
.growth-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.growth-body { font-size: 13px; line-height: 1.7; color: var(--muted); }
.watch-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.watch-item:last-child { border-bottom: none; padding-bottom: 0; }
.watch-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); flex-shrink: 0; margin-top: 5px; }
.watch-body { font-size: 13px; line-height: 1.7; color: var(--muted); }
.watch-body strong { color: var(--text); font-weight: 600; }

/* Footer */
.app-footer {
  flex-shrink: 0; padding: 8px 22px;
  border-top: 1px solid var(--border); background: #fff;
  display: flex; align-items: center; gap: 6px;
}
.app-footer span { font-size: 11.5px; color: #9CA3AF; }

/* ── Login overlay ──────────────────────────────────────────────────── */
.login-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: linear-gradient(135deg, #2E3033 0%, #1a1c1e 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: #fff; border-radius: 16px;
  padding: 36px 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  text-align: center;
  font-family: var(--font);
}
.login-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}
.login-logo { width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0; display: block; }
.login-title {
  font-size: 24px; font-weight: 700; color: var(--text);
  letter-spacing: -0.02em;
  display: inline-flex; align-items: baseline; line-height: 1;
}
.login-play { font-size: 13px; font-weight: 500; color: #9CA3AF; letter-spacing: 0.01em; }
.login-play-arrow { color: var(--orange); margin-right: 1px; font-size: 11px; }
.login-sub { font-size: 13px; color: var(--muted); margin-bottom: 22px; }
.login-card form { display: flex; flex-direction: column; gap: 10px; }
.login-card input {
  font-family: var(--font); font-size: 14px;
  padding: 11px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; outline: none; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-card input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(245,166,35,0.12);
}
.login-card button {
  margin-top: 6px;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  padding: 11px; border: none; border-radius: 8px;
  background: linear-gradient(145deg, #F5A623 0%, #E8880A 100%);
  color: #fff; cursor: pointer;
  transition: filter 0.12s, transform 0.06s;
}
.login-card button:hover { filter: brightness(1.04); }
.login-card button:active { transform: translateY(1px); }
.login-card button:disabled { opacity: 0.6; cursor: not-allowed; }
.login-error {
  margin-top: 8px; min-height: 18px;
  font-size: 12px; color: var(--red); text-align: left;
}

/* Tier gate splash (shares the login-overlay styling) */
.tier-body {
  font-size: 13.5px; line-height: 1.65; color: var(--muted);
  margin: 10px 0 20px;
}
.tier-body strong { color: var(--text); font-weight: 600; }
.tier-actions {
  display: flex; flex-direction: column; gap: 8px;
}
.tier-cta {
  display: inline-block; text-align: center; text-decoration: none;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  padding: 11px 14px; border-radius: 8px;
  background: linear-gradient(145deg, #F5A623 0%, #E8880A 100%);
  color: #fff;
  transition: filter 0.12s, transform 0.06s;
}
.tier-cta:hover  { filter: brightness(1.04); }
.tier-cta:active { transform: translateY(1px); }
.tier-secondary {
  font-family: var(--font); font-size: 13px; font-weight: 500;
  padding: 9px 14px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.tier-secondary:hover { border-color: var(--text); color: var(--text); }

/* User chip — appears next to each search bar (home + company view) */
.user-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  font-size: 11.5px; font-weight: 500; color: var(--sb-text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer; user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.user-chip:hover {
  background: var(--orange-dim); border-color: var(--orange-border);
  color: var(--orange);
}
.user-chip-email { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }

/* Co-search-bar layout: input grows, chip stays compact on the right */
.co-search-row { display: flex; align-items: center; gap: 8px; }
.co-search-row .co-search-inner { flex: 1; }

/* Home (Discover) user chip — top-right of the main area, doesn't crowd the centered hero */
.home-state { position: relative; }
.home-user-chip {
  position: absolute;
  top: 18px;
  right: 22px;
}

/* "Recently viewed" reuses the same grid styling as suggestions */
.home-recents { width: 100%; max-width: 600px; margin-top: 36px; }

/* Loading / Error states */
.panel-loading {
  padding: 40px 20px; text-align: center;
  font-size: 13px; color: var(--muted);
}
.panel-loading::before {
  content: ''; display: inline-block; width: 12px; height: 12px;
  margin-right: 8px; vertical-align: middle;
  border: 2px solid var(--orange-dim); border-top-color: var(--orange);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.panel-error {
  padding: 16px 18px; border-radius: 6px;
  background: var(--red-bg); border: 1px solid var(--red-border);
  color: var(--red); font-size: 13px; line-height: 1.6;
}

/* Streaming status pill */
.view-status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; margin-bottom: 12px;
  background: #eef2ff; border: 1px solid #c7d2fe;
  border-radius: 999px;
  font-size: 11.5px; color: #4f46e5; font-weight: 500;
  transition: opacity 0.3s, background 0.2s, border-color 0.2s, color 0.2s;
}
.view-status.done {
  background: #f0fdf4; border-color: #bbf7d0; color: #166534;
}
.view-status.error {
  background: var(--red-bg); border-color: var(--red-border); color: var(--red);
}
.view-status.info {
  background: #eff6ff; border-color: #bfdbfe; color: #1e40af;
}
.view-status.soon {
  background: #fffbeb; border-color: #fde68a; color: #92400e;
}
.view-status-spinner {
  width: 10px; height: 10px;
  border: 1.5px solid rgba(79,70,229,0.2);
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
.view-status.done .view-status-spinner  { border-color: #bbf7d0;          border-top-color: #166534; }
.view-status.error .view-status-spinner { border-color: var(--red-border); border-top-color: var(--red); }
.view-status.info .view-status-spinner  { border-color: #bfdbfe;          border-top-color: #1e40af; }
.view-status.soon .view-status-spinner  { border-color: #fde68a;          border-top-color: #92400e; }
.view-status.done .view-status-spinner,
.view-status.error .view-status-spinner,
.view-status.info .view-status-spinner,
.view-status.soon .view-status-spinner { animation: none; }
.view-stream { /* host for streamed HTML */ }

/* Friendly info / error panels (shown instead of streamed HTML) */
.panel-info {
  padding: 28px 32px; border-radius: 8px;
  border: 1px solid; max-width: 640px; margin: 24px auto 0;
}
.panel-info-title {
  font-size: 15px; font-weight: 600; margin-bottom: 8px;
}
.panel-info-body {
  font-size: 13.5px; line-height: 1.65;
}
.panel-info-cta {
  display: inline-block;
  margin-top: 14px;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 6px;
  background: var(--orange);
  color: #fff;
  border: none; cursor: pointer;
  transition: filter 0.12s, transform 0.06s;
}
.panel-info-cta:hover  { filter: brightness(1.04); }
.panel-info-cta:active { transform: translateY(1px); }

.panel-info-soon  { background: #fffbeb; border-color: #fde68a; }
.panel-info-soon .panel-info-title { color: #92400e; }
.panel-info-soon .panel-info-body  { color: #78350f; }
.panel-info-info  { background: #eff6ff; border-color: #bfdbfe; }
.panel-info-info .panel-info-title { color: #1e40af; }
.panel-info-info .panel-info-body  { color: #1e3a8a; }
.panel-info-error { background: var(--red-bg); border-color: var(--red-border); }
.panel-info-error .panel-info-title { color: var(--red); }
.panel-info-error .panel-info-body  { color: #7f1d1d; }

/* ══════════════════ Theme toggle button ══════════════════ */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  padding: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--orange-border);
  color: var(--orange);
  background: var(--orange-dim);
}
.theme-toggle svg { width: 14px; height: 14px; }
.theme-toggle .icon-moon { display: none; }
body.dark .theme-toggle .icon-sun  { display: none; }
body.dark .theme-toggle .icon-moon { display: inline; }

/* Group toggle + user-chip when they live in the same corner */
.user-actions { display: flex; align-items: center; gap: 8px; }
.home-user-actions { position: absolute; top: 18px; right: 22px; }

/* ══════════════════ DARK MODE — surface overrides ══════════════════ */
body.dark {
  background: var(--body-bg);
  color: var(--text);
}
/* Cards & elevated surfaces */
body.dark .card,
body.dark .risk-card,
body.dark .debate-topic,
body.dark .case-arg-card,
body.dark .kpi-cell,
body.dark .co-header,
body.dark .co-search-bar,
body.dark .tab-bar,
body.dark .app-footer,
body.dark .home-search-box,
body.dark .suggest-card,
body.dark .user-chip,
body.dark .login-card,
body.dark .home-dropdown,
body.dark .co-search-dropdown,
body.dark .theme-toggle {
  background: var(--card-bg);
}
/* Inner-bg surfaces (sub-tone) */
body.dark .segment-card,
body.dark .co-logo-box,
body.dark .co-search-inner {
  background: var(--subtle);
}
/* Bar tracks */
body.dark .bar-track       { background: var(--bar-track-bg); }
body.dark .segment-bar-track { background: var(--segment-bar-empty); }
/* Debate "crux" callout */
body.dark .debate-crux {
  background: var(--crux-bg); border-color: var(--crux-border); color: var(--text);
}
body.dark .debate-crux strong { color: var(--crux-strong); }
/* AI pill */
body.dark .ai-pill {
  background: var(--ai-pill-bg); border-color: var(--ai-pill-border); color: var(--ai-pill-text);
}
/* Streaming status pill */
body.dark .view-status {
  background: var(--ai-pill-bg); border-color: var(--ai-pill-border); color: var(--ai-pill-text);
}
body.dark .view-status.info {
  background: var(--status-info-bg); border-color: var(--status-info-border); color: var(--status-info-text);
}
body.dark .view-status.soon {
  background: #1f1a0a; border-color: #4a3818; color: #d4a44a;
}
body.dark .view-status.done {
  background: var(--green-bg); border-color: var(--green-border); color: var(--green);
}
body.dark .view-status.error {
  background: var(--red-bg); border-color: var(--red-border); color: var(--red);
}
/* panel-info friendly panels */
body.dark .panel-info-soon  { background: #1f1a0a; border-color: #4a3818; }
body.dark .panel-info-soon .panel-info-title { color: #d4a44a; }
body.dark .panel-info-soon .panel-info-body  { color: #b89968; }
body.dark .panel-info-info  { background: var(--status-info-bg); border-color: var(--status-info-border); }
body.dark .panel-info-info .panel-info-title { color: var(--status-info-text); }
body.dark .panel-info-info .panel-info-body  { color: var(--status-info-text); }
body.dark .panel-info-error { background: var(--red-bg); border-color: var(--red-border); }
body.dark .panel-info-error .panel-info-title { color: var(--red); }
body.dark .panel-info-error .panel-info-body  { color: #fca5a5; }
/* Co-header sub elements */
body.dark .co-ticker-big { color: var(--orange); }
body.dark .co-name-text  { color: #cbd5e0; }
body.dark .co-exch-pill  { background: var(--subtle); border-color: var(--border); color: #cbd5e0; }
body.dark .co-price-currency { color: var(--muted); }
/* Login splash already on dark background — but the card itself becomes card-bg */
body.dark .login-card { color: var(--text); }
body.dark .login-title { color: var(--text); }
body.dark .login-card input {
  background: var(--subtle); color: var(--text); border-color: var(--border);
}
body.dark .login-card input::placeholder { color: var(--muted); }
body.dark .tier-body strong { color: var(--text); }
body.dark .tier-secondary { color: var(--muted); border-color: var(--border); }
body.dark .tier-secondary:hover { color: var(--text); border-color: var(--muted); }
/* Sidebar group hover already uses var --sb-hover-bg */
body.dark .sb-item:hover { color: var(--text); }
body.dark .sb-item-ticker { color: var(--muted); }
/* Suggest card hover */
body.dark .suggest-card-soon:hover { background: var(--card-bg); }
/* Tab borders */
body.dark .tab.active { color: var(--text); }
/* Hover sb-item color */
body.dark .hd-item:hover { background: var(--sb-hover-bg); }
body.dark .hd-name { color: var(--text); }
/* Make the page background obvious in dark, hide light flash */
body.dark .home-state, body.dark .company-view { background: var(--main-bg); }
