/* Ticker Drill — Dark theme, blue accent */
:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --elevated: #1c1c1e;
  --text: #f5f5f7;
  --muted: #86868b;
  --border: #2a2a2a;
  --border-light: #3a3a3c;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-muted: rgba(0, 113, 227, 0.15);
  --good: #30d158;
  --bad: #ff453a;
  --warn: #ffd60a;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --max-w: 1120px;
  --header-h: 64px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

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

/* ── Header ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.app-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.back-link {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
}
.back-link:hover { color: var(--text); text-decoration: none; }

.brand-mark {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.header-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 420px;
  margin: 0 auto;
}

.search-field {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 1rem;
  transition: border-color var(--transition);
}
.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.ticker-prefix {
  color: var(--muted);
  font-weight: 500;
  margin-right: 0.25rem;
}

#ticker-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  padding: 0.6rem 0;
  min-width: 0;
}
#ticker-input::placeholder { color: var(--muted); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.25rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--elevated);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-muted); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text); }

.btn-deep {
  background: var(--accent-muted);
  color: var(--accent);
  border: 1px solid rgba(0, 113, 227, 0.35);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-deep:hover { background: rgba(0, 113, 227, 0.25); }

.grok-auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grok-auth-chip--on { color: var(--good); border-color: rgba(48, 209, 88, 0.35); }
.grok-auth-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--good);
  flex-shrink: 0;
}

.search-progress {
  height: 2px;
  background: var(--border);
  overflow: hidden;
}
.search-progress[hidden] { display: none; }
.search-progress-bar {
  height: 100%;
  width: 30%;
  background: var(--accent);
  animation: td-progress 1.2s ease-in-out infinite;
}
@keyframes td-progress {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  max-width: min(90vw, 420px);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  background: var(--elevated);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  animation: toast-in 0.25s ease;
}
.toast[hidden] { display: none; }
.toast--error { border-color: rgba(255, 69, 58, 0.4); color: #ff6961; }
.toast--info { border-color: rgba(0, 113, 227, 0.4); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Page layout ── */
.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem;
}

.main-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}

.main-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}
.main-tab:hover { color: var(--text); }
.main-tab--active {
  background: var(--elevated);
  color: var(--text);
  font-weight: 600;
}
.main-tab[hidden] { display: none; }

.sub-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  margin-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sub-tabs::-webkit-scrollbar { display: none; }

.sub-tab {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.sub-tab:hover { color: var(--text); border-color: var(--border-light); }
.sub-tab--active {
  background: var(--accent-muted);
  border-color: rgba(0, 113, 227, 0.5);
  color: var(--accent);
  font-weight: 600;
}

.lens-inner-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1rem;
  flex-wrap: wrap;
}

.lens-inner-tab {
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.lens-inner-tab--active {
  background: var(--accent-muted);
  border-color: rgba(0, 113, 227, 0.45);
  color: var(--accent);
  font-weight: 600;
}

.lens-approach-list {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.65rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.lens-body .lens-summary {
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 1rem;
}

.lens-munger-note {
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
}

.sub-view[hidden] { display: none; }
.sub-views { display: flex; flex-direction: column; gap: 0; }

.page--browse .results { display: none !important; }

/* ── Panels ── */
.results { display: flex; flex-direction: column; gap: 0; }
.results[hidden] { display: none !important; }

.analyze-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 280px;
  padding: 3rem 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.analyze-loading[hidden] { display: none; }

.analyze-loading-spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: td-spin 0.75s linear infinite;
}

.results-content[hidden] { display: none !important; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 0.75rem;
}

.panel-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.panel-head .panel-title { margin: 0; }

.panel-note {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.panel-note--cta { text-align: center; padding: 1rem 0; }

/* ── Hero ── */
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.ticker-pill {
  display: inline-block;
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

#company-name {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero-sector {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.hero-headline {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  color: var(--text);
  opacity: 0.9;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.hero-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.deep-learn-cta {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Badges ── */
.badge, .potential-badge, .cache-chip, .risk-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.badge--good { background: rgba(48, 209, 88, 0.15); color: var(--good); }
.badge--muted { background: var(--elevated); color: var(--muted); border: 1px solid var(--border); }
.badge--warn {
  background: rgba(255, 214, 10, 0.14);
  color: var(--warn);
  border: 1px solid rgba(255, 214, 10, 0.35);
}
.degraded-banner {
  margin: 0.5rem 0 0;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 214, 10, 0.35);
  background: rgba(255, 214, 10, 0.08);
  color: var(--warn);
  font-size: 0.875rem;
  line-height: 1.35;
  max-width: 42rem;
}
.cache-chip--hit { background: var(--accent-muted); color: var(--accent); }
.cache-chip--fresh { background: rgba(48, 209, 88, 0.12); color: var(--good); }

.potential-badge--high { background: rgba(48, 209, 88, 0.15); color: var(--good); }
.potential-badge--moderate { background: rgba(0, 113, 227, 0.15); color: var(--accent); }
.potential-badge--watchlist { background: rgba(255, 214, 10, 0.12); color: var(--warn); }
.potential-badge--low { background: var(--elevated); color: var(--muted); }

.risk-badge--critical { background: rgba(255, 69, 58, 0.15); color: var(--bad); }
.risk-badge--high { background: rgba(255, 159, 10, 0.12); color: #ff9f0a; }
.risk-badge--medium { background: var(--elevated); color: var(--muted); }
.risk-badge--compounding { background: rgba(48, 209, 88, 0.12); color: var(--good); }

/* ── Metrics ── */
.metric-card {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.metric-hint { font-size: 0.75rem; color: var(--muted); }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.65rem;
}

.summary-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.week-prediction-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

/* ── Consensus ── */
.consensus-block { margin-bottom: 1.25rem; }

.consensus-meter {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.consensus-label { font-size: 0.8rem; color: var(--muted); flex: 1; }
.consensus-direction { font-weight: 600; font-size: 0.95rem; }
.consensus-score { font-size: 0.8rem; color: var(--muted); }

.consensus--up .consensus-direction { color: var(--good); }
.consensus--down .consensus-direction { color: var(--bad); }
.consensus--neutral .consensus-direction { color: var(--muted); }

/* ── Research stance (Buy / Hold / Sell) ── */
.stance-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  margin-top: 0.35rem;
}
.stance-chip--lg {
  font-size: 0.95rem;
  padding: 0.4rem 0.9rem;
}
.stance-chip--buy {
  background: rgba(48, 209, 88, 0.18);
  color: var(--good);
  border-color: rgba(48, 209, 88, 0.35);
}
.stance-chip--hold {
  background: rgba(255, 214, 10, 0.14);
  color: var(--warn);
  border-color: rgba(255, 214, 10, 0.35);
}
.stance-chip--sell {
  background: rgba(255, 69, 58, 0.16);
  color: var(--bad);
  border-color: rgba(255, 69, 58, 0.35);
}
.stance-one-liner {
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  max-width: 36rem;
}
.stance-one-liner--panel {
  margin: 0.75rem 0 1rem;
  font-size: 1.05rem;
}
.stance-panel {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.stance-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.35rem;
}
.stance-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.stance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.85rem;
}
.stance-grid p {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text);
}
.stance-disclaimer {
  margin-top: 0.85rem !important;
}
@media (max-width: 720px) {
  .stance-grid { grid-template-columns: 1fr; }
}

/* ── Account ── */
.account-chip {
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.account-chip--in {
  border-color: rgba(0, 113, 227, 0.45);
  color: var(--accent);
}
.account-dialog { max-width: 420px; }
.account-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.account-form input {
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.account-lead { font-size: 0.9rem; color: var(--muted); margin: 0 0 1rem; }
.account-switch { font-size: 0.85rem; color: var(--muted); }
.account-switch a { color: var(--accent); }
.account-error {
  background: rgba(255, 69, 58, 0.12);
  color: var(--bad);
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}
.account-hello { margin: 0 0 1rem; }
.account-hello .muted { display: block; font-size: 0.8rem; color: var(--muted); font-weight: 400; }
.account-section { margin-bottom: 1.1rem; }
.account-section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.account-ticker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.account-ticker-list .linkish {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.account-new-list {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.account-new-list input {
  flex: 1;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.account-list-block { margin-bottom: 0.4rem; }
.account-list-block summary { cursor: pointer; font-size: 0.9rem; }
.account-social-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}
.oauth-btn {
  width: 100%;
  padding: 0.7rem 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  text-align: left;
}
.oauth-btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  width: 100%;
}
.oauth-btn-icon {
  flex-shrink: 0;
  display: block;
}
.oauth-btn-label {
  line-height: 1.2;
}
.oauth-btn:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
}
.oauth-btn--google {
  border-color: rgba(66, 133, 244, 0.45);
  background: rgba(66, 133, 244, 0.06);
}
.oauth-btn--google:hover { background: rgba(66, 133, 244, 0.12); }
.oauth-btn--apple {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.04);
  color: #f5f5f7;
}
.oauth-btn--apple:hover { background: rgba(255, 255, 255, 0.08); }
.oauth-btn--x {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
}
.oauth-btn--x:hover { background: rgba(0, 0, 0, 0.5); }
.account-or {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  margin: 0.5rem 0 0.85rem;
  position: relative;
}
.account-or span {
  background: var(--card, var(--elevated));
  padding: 0 0.5rem;
  position: relative;
  z-index: 1;
}
.llm-pref {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.llm-key-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}
.llm-key-row label {
  flex: 1 1 100%;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.llm-key-row input {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.grok-auth-chip--locked {
  opacity: 0.85;
  border-style: dashed;
}
.grok-auth-chip--premium {
  border-color: rgba(255, 214, 10, 0.45);
}
.account-premium {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: rgba(0, 113, 227, 0.08);
}
.account-premium--on {
  border-color: rgba(48, 209, 88, 0.35);
  background: rgba(48, 209, 88, 0.08);
}
.premium-activate-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.premium-activate-row input {
  flex: 1;
  min-width: 8rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

/* ── Account settings page ── */
.account-page .account-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}
.account-page-header .app-header-inner {
  max-width: 1100px;
}
.account-guest {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}
.account-guest-card {
  width: 100%;
  max-width: 420px;
  padding: 1.75rem 1.5rem;
  background: var(--card, var(--elevated));
  border: 1px solid var(--border);
  border-radius: 16px;
}
.account-guest-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
}
.account-app {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.25rem;
  align-items: start;
}
.account-nav {
  position: sticky;
  top: 4.5rem;
  padding: 1rem;
  background: var(--card, var(--elevated));
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 20rem;
}
.account-nav-user {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.account-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: rgba(0, 113, 227, 0.25);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.account-nav-user strong {
  display: block;
  font-size: 0.95rem;
}
.account-nav-user .muted {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  word-break: break-all;
}
.account-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.account-nav-link {
  text-align: left;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}
.account-nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}
.account-nav-link--active {
  background: rgba(0, 113, 227, 0.15);
  color: var(--accent);
}
.account-nav-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.account-main {
  min-width: 0;
}
.account-section-head {
  margin-bottom: 1.1rem;
}
.account-section-head h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
}
.account-panel-card {
  padding: 1.25rem;
  background: var(--card, var(--elevated));
  border: 1px solid var(--border);
  border-radius: 14px;
}
.account-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}
.account-stat-card {
  padding: 1.1rem 1.15rem;
  background: var(--card, var(--elevated));
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.account-stat-card h3 {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}
.account-stat-value {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}
.account-stat-card--wide {
  grid-column: 1 / -1;
}
.account-feature-list {
  margin: 0.75rem 0 1rem;
  padding-left: 1.2rem;
  line-height: 1.55;
}
.account-callout {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 214, 10, 0.08);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.account-callout--ok {
  background: rgba(48, 209, 88, 0.1);
  border-color: rgba(48, 209, 88, 0.3);
}
.account-form-grid {
  display: grid;
  gap: 1.25rem;
}
.llm-key-block label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.llm-key-block input {
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.status-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--elevated);
  color: var(--muted);
  margin-left: 0.35rem;
  vertical-align: middle;
}
.status-pill--on {
  background: rgba(48, 209, 88, 0.18);
  color: var(--good);
}
.account-ticker-list--grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.ticker-chip {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}
.ticker-chip:hover {
  border-color: var(--accent);
}
.account-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.account-history-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.account-history-list a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.account-provider-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.provider-badge {
  display: inline-block;
  text-transform: capitalize;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  margin-right: 0.5rem;
}
.account-subhead {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}
.account-error--ok {
  background: rgba(48, 209, 88, 0.12);
  color: var(--good);
}
.account-page code {
  font-size: 0.8rem;
  color: var(--muted);
}
@media (max-width: 820px) {
  .account-app {
    grid-template-columns: 1fr;
  }
  .account-nav {
    position: static;
    min-height: 0;
  }
  .account-nav-links {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .account-cards {
    grid-template-columns: 1fr;
  }
}

/* ── Flags ── */
.flags-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.flags-column h3 {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.flag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.flag-list li {
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  background: var(--elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.flags-column--green .flag-list li { border-left: 2px solid var(--good); }
.flags-column--red .flag-list li { border-left: 2px solid var(--bad); }
.flag-empty { color: var(--muted); font-style: italic; border-left: none !important; }

/* ── Summary text ── */
.summary-card {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  margin: 1rem 0;
}

.summary-resume {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: rgba(245, 245, 247, 0.88);
}

.week-prediction h3 {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Education ── */
.education-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.education-card {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}

.education-term {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.education-insight { margin: 0; font-size: 0.82rem; color: var(--muted); line-height: 1.5; }

.driver-list, .risk-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.driver-list li, .risk-list li { padding: 0.25rem 0; }

/* ── Chart ── */
.price-chart {
  width: 100%;
  min-height: 320px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.range-tabs {
  display: flex;
  gap: 0.2rem;
  padding: 0.2rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.range-tab {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.range-tab.is-active {
  background: var(--accent-muted);
  color: var(--accent);
  font-weight: 600;
}

.chart-fallback {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 2rem;
  text-align: center;
}

/* ── Max pain table ── */
.max-pain-table-wrap { margin-top: 1rem; }

.max-pain-table-title {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.max-pain-table, .peers-table, .database-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.max-pain-table th, .peers-table th, .database-table th {
  text-align: left;
  padding: 0.6rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.max-pain-table td, .peers-table td, .database-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.max-pain-table tbody tr:hover,
.peers-table tbody tr:hover,
.database-table tbody tr:hover {
  background: var(--elevated);
}

.max-pain-row--primary {
  border-left: 3px solid var(--accent);
}
.max-pain-row--primary td { font-weight: 500; }

.max-pain-primary-badge {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-muted);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.peers-table a, .ticker-link {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.peers-table tr.is-active { background: var(--accent-muted); }

/* ── Moonshot / Adversarial ── */
.moonshot-hero, .adversarial-hero { margin-bottom: 1rem; }

.moonshot-score, .adversarial-score {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.moonshot-pct, .adversarial-risk {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--accent);
}

.adversarial-risk { color: var(--bad); }
.adversarial-risk-label { margin: 0; font-size: 0.8rem; color: var(--muted); }
.adversarial-verdict { font-size: 0.9rem; color: var(--muted); line-height: 1.6; }

.signal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.signal-list li {
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  background: var(--elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.adversarial-signals-wrap h3 {
  margin: 1rem 0 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Meta / Company ── */
.meta-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1.5rem;
  margin: 0 0 1rem;
  font-size: 0.85rem;
}

.meta-row dt { color: var(--muted); font-weight: 500; }
.meta-row dd { margin: 0; }

.description {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.65;
}

.callout {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--accent-muted);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--accent);
}

.ext-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ── Deep report ── */
.panel--deep { min-height: 200px; }

.deep-status {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.deep-status[hidden] { display: none; }
.deep-status--loading {
  padding: 0.85rem 1rem;
  background: var(--accent-muted);
  border: 1px solid rgba(0, 113, 227, 0.25);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-weight: 500;
}

.deep-status-spinner {
  width: 1rem; height: 1rem;
  border: 2px solid rgba(0, 113, 227, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: td-spin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes td-spin { to { transform: rotate(360deg); } }

.deep-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  background: var(--elevated);
}
.deep-section > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.75rem 1rem;
  color: var(--text);
}
.deep-section-body { padding: 0 1rem 1rem; font-size: 0.85rem; color: var(--muted); line-height: 1.6; }

.deep-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.deep-table th { text-align: left; color: var(--muted); padding: 0.35rem 0.75rem 0.35rem 0; font-weight: 500; }
.deep-table td { padding: 0.35rem 0; color: var(--text); }

.deep-list, .deep-checklist { margin: 0; padding-left: 1.1rem; }
.deep-list li, .deep-checklist li { margin-bottom: 0.35rem; }
.deep-muted { color: var(--muted); font-size: 0.8rem; }
.deep-verdict { font-size: 0.95rem; color: var(--text); line-height: 1.65; }
.deep-metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.65rem; }
.deep-metric h4 { margin: 0 0 0.35rem; font-size: 0.85rem; color: var(--text); }
.deep-formula { font-size: 0.75rem; color: var(--muted); }
.deep-channel { font-size: 0.7rem; font-weight: 600; padding: 0.15rem 0.4rem; border-radius: 4px; }
.deep-channel--direct { background: rgba(255, 69, 58, 0.15); color: var(--bad); }
.deep-channel--indirect { background: var(--elevated); color: var(--muted); }

/* ── Explore: Top 10 ── */
.live-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.live-panel-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.live-panel-sub {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.live-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--good);
  white-space: nowrap;
  padding: 0.25rem 0.6rem;
  background: rgba(48, 209, 88, 0.12);
  border-radius: 999px;
}

.filter-drawer {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.filter-drawer-toggle {
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}
.filter-drawer-toggle::-webkit-details-marker { display: none; }
.filter-drawer[open] .filter-drawer-toggle { color: var(--text); border-bottom: 1px solid var(--border); }
.filter-drawer .top10-toolbar { padding: 1rem; }

.top10-toolbar-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.top10-sort-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.top10-sort-tab {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
}
.top10-sort-tab--active {
  background: var(--accent-muted);
  border-color: rgba(0, 113, 227, 0.4);
  color: var(--accent);
  font-weight: 600;
}

.top10-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-top: 0.85rem;
}

.top10-filter {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.top10-filter select {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  padding: 0.4rem 0.6rem;
}
.top10-filter--check {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.4rem;
}

.top10-filter-actions { display: flex; gap: 0.5rem; }

.top10-sort-desc {
  margin: 0 0 0.85rem;
  padding: 0.75rem 1rem;
  background: var(--accent-muted);
  border: 1px solid rgba(0, 113, 227, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text);
}
.top10-sort-desc:empty { display: none; }
.top10-sort-desc strong { color: var(--accent); }

.score-guide {
  margin-bottom: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.score-guide--inline { margin-top: 0.5rem; margin-bottom: 1rem; }

.score-guide-toggle {
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
}
.score-guide-toggle::-webkit-details-marker { display: none; }
.score-guide[open] .score-guide-toggle { border-bottom: 1px solid var(--border); }

.score-guide-body {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.score-def {
  padding: 0.65rem 0.75rem;
  background: var(--elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.score-def--active {
  border-color: rgba(0, 113, 227, 0.45);
  background: var(--accent-muted);
}
.score-def dt {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.score-def dd {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--muted);
}

.panel-subtitle {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.potential-breakdown { margin: 0 0 1rem; }

.metric-card--explain .metric-hint {
  display: block;
  margin-top: 0.35rem;
  line-height: 1.45;
}

.top10-result-count {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.live-status {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.top10-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.top10-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: border-color var(--transition), background var(--transition);
}
.top10-row:hover {
  border-color: var(--border-light);
  background: var(--elevated);
}

.top10-rank {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 1.5rem;
}

.top10-ticker {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.top10-name {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.top10-score {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-align: right;
}

/* ── Database ── */
.database-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.database-search { flex: 1; min-width: 200px; }
.database-search input {
  width: 100%;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font: inherit;
  color: var(--text);
  outline: none;
}
.database-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.database-count { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.database-row--stale { opacity: 0.55; }

/* ── Grok modal ── */
body.grok-modal-open { overflow: hidden; }

.grok-auth-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.grok-auth-modal[hidden] { display: none; }

.grok-auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.grok-auth-dialog {
  position: relative;
  width: min(100%, 400px);
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.grok-auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.grok-auth-header h2 { margin: 0; font-size: 1rem; font-weight: 600; }

.grok-auth-close {
  background: var(--elevated);
  border: none;
  border-radius: 50%;
  width: 28px; height: 28px;
  font-size: 1.1rem;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.grok-auth-close:hover { color: var(--text); }

.grok-auth-body { padding: 1.25rem; font-size: 0.9rem; }
.grok-auth-body button { margin-top: 0.5rem; }
.grok-auth-body input[type="text"],
.grok-auth-body input[type="password"] {
  width: 100%;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  color: var(--text);
  font: inherit;
  margin-top: 0.35rem;
}

/* ── Product: tagline, coach, market, trust, watchlist, compare ── */
.product-tagline {
  margin: 0.75rem 0 0;
  padding: 0 1.25rem;
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 72rem;
}
.proof-link {
  font-size: 0.8rem;
  color: var(--accent, #38bdf8);
  text-decoration: none;
  margin-left: 0.65rem;
  white-space: nowrap;
}
.proof-link:hover { text-decoration: underline; }
.pro-chip {
  margin-left: 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(167, 139, 250, 0.25);
  color: #c4b5fd;
}
.btn--pro-locked { opacity: 0.75; }
.sub-tab--pro::after {
  content: 'Pro';
  font-size: 0.6rem;
  margin-left: 0.25rem;
  color: #c4b5fd;
}

.contradictions-panel {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.05);
  margin-bottom: 1rem;
}
.contradictions-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--elevated);
}
.contradictions-badge--high { color: #f87171; border-color: rgba(248, 113, 113, 0.4); }
.contradictions-badge--medium { color: #fbbf24; border-color: rgba(251, 191, 36, 0.4); }
.contradictions-badge--low { color: #94a3b8; }
.contradictions-badge--none { color: #4ade80; border-color: rgba(74, 222, 128, 0.35); }
.contradictions-headline { font-size: 0.9rem; color: var(--muted); margin: 0.35rem 0 0.75rem; }
.contradictions-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.contradiction-item {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--elevated);
}
.contradiction-item--high { border-color: rgba(248, 113, 113, 0.4); }
.contradiction-item--medium { border-color: rgba(251, 191, 36, 0.35); }
.contradiction-item--ok { border-color: rgba(74, 222, 128, 0.3); color: var(--muted); }
.contradiction-title { font-weight: 600; font-size: 0.92rem; }
.contradiction-detail { margin: 0.3rem 0; font-size: 0.85rem; color: var(--muted); line-height: 1.4; }
.contradiction-sides {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  margin: 0.35rem 0;
}
.contradiction-vs { color: var(--muted); }
.contradiction-action { margin: 0; font-size: 0.8rem; color: var(--text); }

.desk-memo-panel { margin-bottom: 0.25rem; }
.desk-memo-sub { margin: 0 0 0.65rem; font-size: 0.85rem; color: var(--muted); }
.desk-memo-bullets { margin: 0 0 0.75rem; padding-left: 1.15rem; line-height: 1.45; font-size: 0.88rem; }
.desk-memo-bullets li { margin-bottom: 0.4rem; }
.desk-memo-movers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.desk-memo-col h4 { margin: 0 0 0.35rem; font-size: 0.82rem; }
.desk-memo-col ul { margin: 0; padding-left: 1rem; font-size: 0.82rem; }

/* Compounding panel */
.compounding-panel {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--elevated);
}
.compounding-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.compounding-panel-head h3 { margin: 0; font-size: 0.95rem; }
.compounding-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.compounding-status-badge--pass {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.1);
}
.compounding-status-badge--fail {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.08);
}
.compounding-summary { margin: 0.35rem 0 0.5rem; font-size: 0.88rem; line-height: 1.45; }
.compounding-rules { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.compounding-rule {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: 0.25rem 0.5rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
}
.compounding-rule-mark { font-weight: 700; }
.compounding-rule--pass .compounding-rule-mark { color: #4ade80; }
.compounding-rule--fail .compounding-rule-mark { color: #f87171; }
.compounding-rule--skip .compounding-rule-mark { color: var(--muted); }
.compounding-rule-label { font-weight: 500; }
.compounding-rule-detail {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

/* Hover help tooltips */
.td-help-target {
  cursor: help;
  border-bottom: 1px dotted rgba(148, 163, 184, 0.55);
}
.td-help-target:focus-visible {
  outline: 2px solid var(--accent, #38bdf8);
  outline-offset: 2px;
}
.td-tooltip {
  position: absolute;
  z-index: 80;
  max-width: min(22rem, calc(100vw - 1.5rem));
  padding: 0.55rem 0.7rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text);
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.live-panel-head-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.callout--pass {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.08);
}
.callout--fail {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}
.coach-banner {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.12), rgba(167, 139, 250, 0.1));
  border-bottom: 1px solid var(--border);
}
.coach-banner-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.coach-text { margin: 0; font-size: 0.9rem; line-height: 1.45; flex: 1; min-width: 12rem; }
.coach-actions { display: flex; gap: 0.5rem; }

.hero-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1rem;
}
.btn-watch--on {
  border-color: var(--accent, #38bdf8);
  color: var(--accent, #38bdf8);
}

.trust-panel {
  margin-bottom: 1rem;
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.04);
}
.trust-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--elevated);
  border: 1px solid var(--border);
}
.trust-badge--high { color: #4ade80; border-color: rgba(74, 222, 128, 0.4); }
.trust-badge--moderate { color: #fbbf24; border-color: rgba(251, 191, 36, 0.35); }
.trust-badge--limited { color: #f87171; border-color: rgba(248, 113, 113, 0.35); }
.trust-summary { margin: 0.35rem 0 0.75rem; font-size: 0.88rem; color: var(--muted); }
.trust-sources {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.trust-source {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0.65rem;
  background: var(--elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.78rem;
}
.trust-source strong { font-size: 0.82rem; }
.trust-claims {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.market-body { display: flex; flex-direction: column; gap: 1rem; }
.market-regime-card {
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--elevated);
}
.market-regime-card--positive { border-color: rgba(74, 222, 128, 0.35); }
.market-regime-card--negative { border-color: rgba(248, 113, 113, 0.35); }
.market-regime-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.market-regime-value { font-size: 1.35rem; font-weight: 700; margin: 0.2rem 0; }
.market-regime-summary { margin: 0.35rem 0; font-size: 0.9rem; line-height: 1.45; color: var(--muted); }
.market-universe { margin: 0.5rem 0 0; font-size: 0.85rem; }
.market-agg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.5rem;
}
.market-agg-cell {
  padding: 0.65rem 0.75rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.market-agg-label { font-size: 0.72rem; color: var(--muted); }
.market-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.market-columns--lists { grid-template-columns: repeat(3, 1fr); }
.market-section h3 { margin: 0 0 0.65rem; font-size: 0.95rem; }
.market-sector-row {
  display: grid;
  grid-template-columns: 7rem 1fr 4.5rem;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
}
.market-sector-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.market-sector-bar {
  height: 0.45rem;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.market-sector-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #a78bfa);
}
.market-sector-score { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.market-bars .market-bar-row {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.82rem;
  margin-bottom: 0.3rem;
}
.market-bars .muted { color: var(--muted); font-size: 0.75rem; }
.market-mini-list { margin: 0; padding-left: 1.1rem; }
.market-mini-list li { margin-bottom: 0.35rem; }
.market-ticker-btn {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0;
}
.market-ticker-btn:hover strong { color: var(--accent, #38bdf8); }
.market-ticker-btn span { font-size: 0.75rem; color: var(--muted); }

.watchlist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.watchlist-item {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.watchlist-open {
  flex: 1;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.watchlist-open:hover { background: rgba(255, 255, 255, 0.03); }
.watchlist-meta { font-size: 0.78rem; color: var(--muted); }
.watchlist-unpin { min-width: 2.5rem; font-size: 1.1rem; }

.compare-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.compare-pick {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.compare-pick input {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  color: var(--text);
  font: inherit;
  width: 6.5rem;
  text-transform: uppercase;
}
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.compare-table th, .compare-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  text-align: left;
}
.compare-table th[scope='row'] { color: var(--muted); font-weight: 500; width: 9rem; }
.pro-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(167, 139, 250, 0.2);
  color: #c4b5fd;
  vertical-align: middle;
}
.linkish {
  background: none;
  border: none;
  color: var(--accent, #38bdf8);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .app-header-inner {
    flex-wrap: wrap;
    padding: 0.65rem 1rem;
  }
  .header-search {
    order: 3;
    width: 100%;
    max-width: none;
  }
  .flags-grid { grid-template-columns: 1fr; }
  .hero-top { flex-direction: column; }
  .hero-badges { justify-content: flex-start; }
  #company-name { font-size: 1.4rem; }
  .market-columns,
  .market-columns--lists { grid-template-columns: 1fr; }
  .market-sector-row { grid-template-columns: 5rem 1fr 3.5rem; }
}

@media (max-width: 480px) {
  .main-tab { font-size: 0.8rem; padding: 0.5rem 0.5rem; }
  .sub-tab { font-size: 0.75rem; padding: 0.4rem 0.75rem; }
}
/* ═══════════════════════════════════════════════════════════
   Apple-like usability layer (calm hierarchy, progressive disclosure)
   ═══════════════════════════════════════════════════════════ */

:root {
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.75rem;
  --text-2xl: 2.25rem;
  --max-w: 980px;
  --header-h: 56px;
}

body {
  font-size: var(--text-base);
  letter-spacing: -0.01em;
}

.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-8);
}

.app-header-inner {
  max-width: var(--max-w);
  padding: 0.6rem 1.25rem;
  gap: var(--space-3);
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.brand-mark {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.proof-link {
  font-size: var(--text-xs);
  color: var(--muted);
  opacity: 0.9;
}

.header-search {
  flex: 1;
  max-width: 28rem;
  min-width: 0;
}

.search-field {
  flex: 1;
  background: var(--elevated);
  border-radius: 980px;
  border: 1px solid var(--border);
  padding: 0.35rem 0.85rem;
}

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

#ticker-input {
  font-size: 0.95rem;
}

.btn-primary {
  border-radius: 980px;
  padding: 0.5rem 1.15rem;
  font-weight: 600;
  font-size: var(--text-sm);
}

.btn-secondary, .btn-ghost {
  border-radius: 980px;
  font-size: var(--text-sm);
}

.btn-sm {
  padding: 0.25rem 0.55rem;
  font-size: var(--text-xs);
}

/* Segmented main nav */
.main-tabs {
  display: flex;
  gap: 0.2rem;
  padding: 0.25rem;
  margin: 0 0 var(--space-5);
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 980px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.main-tabs::-webkit-scrollbar { display: none; }

.main-tab {
  flex: 1 0 auto;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  border-radius: 980px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}

.main-tab:hover { color: var(--text); }

.main-tab--active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.product-tagline--quiet { display: none; }

.coach-banner--minimal {
  background: rgba(28, 28, 30, 0.92);
  border-bottom: 1px solid var(--border);
}

.coach-banner--minimal .coach-banner-inner {
  max-width: var(--max-w);
  padding: 0.45rem 1.25rem;
}

.coach-banner--minimal .coach-text {
  font-size: var(--text-sm);
  color: var(--muted);
}

/* Live panels */
.live-panel-head h2 {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 0.2rem;
}

.live-panel-sub {
  font-size: var(--text-sm);
  color: var(--muted);
  margin: 0;
  max-width: 36rem;
}

.top10-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0;
  margin: var(--space-4) 0 0;
  list-style: none;
}

/* Hero — primary focus */
.hero-card {
  padding: var(--space-5) var(--space-5);
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(28, 28, 30, 0.95), rgba(20, 20, 20, 0.98));
  margin-bottom: var(--space-4);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-5);
  align-items: flex-start;
  flex-wrap: wrap;
}

.ticker-pill {
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

#company-name {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin: 0 0 0.35rem;
}

.hero-sector {
  font-size: var(--text-sm);
  color: var(--muted);
  margin: 0;
}

.hero-headline {
  margin: 0.65rem 0 0;
  font-size: var(--text-base);
  color: var(--text);
  max-width: 28rem;
  line-height: 1.4;
}

.hero-score-block {
  text-align: right;
}

.potential-badge {
  display: inline-flex;
  align-items: center;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 980px;
  margin-bottom: 0.5rem;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.hero-stats--compact {
  margin-top: var(--space-4);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 8rem));
  gap: 0.5rem;
}

.hero-actions--inline {
  margin-top: var(--space-4);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hero-actions#hero-actions {
  margin: 0 0 var(--space-4);
  display: flex;
  gap: 0.5rem;
}

/* Progressive disclosure */
.disclosure {
  margin: 0 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}

.disclosure-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  user-select: none;
}

.disclosure-summary::-webkit-details-marker { display: none; }

.disclosure-summary::after {
  content: '›';
  color: var(--muted);
  font-size: 1.1rem;
  transform: rotate(90deg);
  transition: transform 0.15s ease;
}

.disclosure[open] > .disclosure-summary::after {
  transform: rotate(-90deg);
}

.disclosure--secondary {
  background: transparent;
  border-color: var(--border);
}

.disclosure .panel {
  border: none;
  border-radius: 0;
  margin: 0;
  border-top: 1px solid var(--border);
  box-shadow: none;
}

.disclosure .trust-panel,
.disclosure .contradictions-panel {
  background: var(--surface);
}

/* Sub-tabs as chips */
.sub-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.15rem 0 var(--space-4);
  margin-bottom: var(--space-2);
  scrollbar-width: none;
  border-bottom: none;
}

.sub-tabs::-webkit-scrollbar { display: none; }

.sub-tab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 980px;
  padding: 0.4rem 0.85rem;
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
}

.sub-tab--active {
  background: var(--accent-muted);
  border-color: transparent;
  color: var(--accent);
}

.sub-tabs-divider {
  width: 1px;
  align-self: stretch;
  background: var(--border);
  margin: 0.15rem 0.25rem;
  flex: 0 0 1px;
}

.sub-tab--lens {
  opacity: 0.92;
  font-size: 0.8rem;
}

.disclosure-meta {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin-left: auto;
  margin-right: 0.5rem;
}

.panel-note--quiet {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: var(--space-4);
}

.score-guide--quiet {
  margin-top: var(--space-3);
  opacity: 0.85;
}

/* sort-desc is shown when tdUpdateSortDescription sets content */

.panel-subtitle {
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0.75rem 0 0.4rem;
}

.panel {
  border-radius: 16px;
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
}

.panel-title {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-3);
}

.summary-card {
  background: var(--elevated);
  border-radius: 12px;
  padding: var(--space-4);
  margin: var(--space-4) 0;
}

.summary-resume {
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text);
  margin: 0;
}

.metric-grid {
  gap: 0.5rem;
}

.metric-card {
  border-radius: 12px;
  padding: 0.75rem;
}

.flags-grid {
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.flags-column {
  border-radius: 12px;
  padding: var(--space-3) var(--space-4);
}

.flags-column h3 {
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

/* Desk memo quieter */
.desk-memo-panel {
  border-radius: 16px;
}

.desk-memo-bullets {
  font-size: var(--text-sm);
  color: var(--muted);
}

.market-regime-value {
  font-size: var(--text-xl);
  letter-spacing: -0.03em;
}

/* Top10 rows cleaner */
.top10-item, .top10-row, .top10-list > li {
  border-radius: 14px;
}

/* Deep financials quality + flags */
.deep-quality {
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.85rem;
  border: 1px solid var(--border, #2a2a2a);
  background: rgba(255, 255, 255, 0.03);
}
.deep-quality--strong { border-color: rgba(48, 209, 88, 0.45); background: rgba(48, 209, 88, 0.08); }
.deep-quality--mixed { border-color: rgba(255, 214, 10, 0.4); background: rgba(255, 214, 10, 0.06); }
.deep-quality--weak { border-color: rgba(255, 69, 58, 0.45); background: rgba(255, 69, 58, 0.08); }
.deep-quality--opaque { border-color: rgba(134, 134, 139, 0.4); }
.deep-quality-grade {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}
.deep-quality-line { margin: 0 0 0.35rem; font-weight: 600; }
.deep-fin-flags-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0.75rem 0;
}
@media (max-width: 640px) {
  .deep-fin-flags-grid { grid-template-columns: 1fr; }
}
.deep-fin-flags-title { font-size: 0.85rem; margin: 0 0 0.35rem; color: var(--text-muted, #86868b); }
.deep-fin-flag--green strong { color: #30d158; }
.deep-fin-flag--red strong { color: #ff453a; }

.deep-period-block { margin: 0.75rem 0 1rem; }
.deep-period-title { font-size: 0.9rem; margin: 0 0 0.25rem; }
.deep-period-policy,
.deep-period-latest { margin: 0 0 0.5rem; font-size: 0.8rem; }
.deep-period-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.deep-period-table { min-width: 28rem; }
.deep-period-table thead th {
  text-align: left;
  color: var(--muted, #86868b);
  font-weight: 500;
  padding: 0.35rem 0.65rem 0.35rem 0;
  border-bottom: 1px solid rgba(134, 134, 139, 0.25);
  font-size: 0.78rem;
}
.deep-period-table td { padding: 0.4rem 0.65rem 0.4rem 0; white-space: nowrap; }
.deep-period-row--quarterly { background: rgba(10, 132, 255, 0.04); }
.deep-period-row--ytd { background: rgba(10, 132, 255, 0.08); font-weight: 500; }
.deep-period-chip {
  display: inline-block;
  min-width: 1.75rem;
  text-align: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  margin-right: 0.25rem;
  vertical-align: middle;
}
.deep-period-chip--fy { background: rgba(134, 134, 139, 0.18); color: var(--text-muted, #86868b); }
.deep-period-chip--quarterly { background: rgba(10, 132, 255, 0.18); color: #0a84ff; }
.deep-period-chip--ytd { background: rgba(10, 132, 255, 0.28); color: #0a84ff; }
.deep-metric--unavailable { opacity: 0.85; }
.deep-chip {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted, #86868b);
  vertical-align: middle;
}
.deep-eval {
  margin: 0.75rem 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border, #2a2a2a);
  background: rgba(255,255,255,0.03);
  font-size: 0.85rem;
}
.deep-eval summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted, #86868b);
}
.deep-eval-list { margin: 0.5rem 0 0; }

/* ——— Calm UI + export + viz (2026-07 product polish) ——— */

.top10-freshness {
  margin: 0 0 0.65rem;
  font-size: var(--text-sm);
  color: var(--text-muted, #86868b);
}

.main-tab--secondary {
  opacity: 0.85;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.75rem 0 1rem;
}

.lens-picker-wrap {
  display: inline-flex;
  align-items: center;
  margin-left: 0.25rem;
}

.lens-picker {
  appearance: none;
  background: var(--bg-elevated, #1c1c1e);
  color: var(--text, #f5f5f7);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 999px;
  padding: 0.4rem 1.75rem 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 10px) 55%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.sub-tab--lens-legacy {
  display: none !important;
}

.score-bars {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.score-bar-row {
  display: grid;
  grid-template-columns: minmax(5rem, 7.5rem) 1fr 2.25rem;
  gap: 0.5rem;
  align-items: center;
}

.score-bar-label {
  font-size: 0.8rem;
  color: var(--text-muted, #86868b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-bar-track {
  height: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  background: var(--accent, #0071e3);
  border-radius: 999px;
  min-width: 2px;
}

.score-bar-fill--main {
  background: #30d158;
}

.score-bar-val {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  text-align: right;
  color: var(--text-muted, #86868b);
}

.stance-conf-meter {
  height: 0.35rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.5rem 0 0.75rem;
}

.stance-conf-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent, #0071e3);
}

.stance-conf-fill--buy { background: #30d158; }
.stance-conf-fill--hold { background: #ffd60a; }
.stance-conf-fill--sell { background: #ff453a; }

.stance-details {
  margin-top: 0.5rem;
  border-top: 1px solid var(--border, #2a2a2a);
  padding-top: 0.5rem;
}

.stance-details-summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted, #86868b);
  list-style: none;
}

.stance-details-summary::-webkit-details-marker { display: none; }

.panel-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.price-chart {
  min-height: 200px;
  width: 100%;
}

/* Library: card-like rows on narrow screens */
@media (max-width: 768px) {
  .page { padding: var(--space-4) var(--space-3) var(--space-6); }
  #company-name { font-size: 1.65rem; }
  .hero-score-block { text-align: left; width: 100%; }
  .hero-badges { justify-content: flex-start; }
  .hero-stats--compact { grid-template-columns: 1fr 1fr; }
  .main-tab { padding: 0.45rem 0.7rem; font-size: 0.8rem; }
  .main-tab--secondary { display: none; }
  .app-header-right .proof-link { display: none; }
  .header-search { order: 3; width: 100%; max-width: none; }
  .app-header-inner { flex-wrap: wrap; }
  .desk-memo-movers { grid-template-columns: 1fr; }
  .score-bar-row { grid-template-columns: 5rem 1fr 2rem; }
  .hero-actions { width: 100%; }
  .hero-actions .btn-primary,
  .hero-actions .btn-secondary { flex: 1 1 auto; }

  .database-table thead { display: none; }
  .database-table,
  .database-table tbody,
  .database-table tr,
  .database-table td {
    display: block;
    width: 100%;
  }
  .database-table tr {
    background: var(--bg-elevated, #1c1c1e);
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.65rem;
  }
  .database-table td {
    border: none;
    padding: 0.15rem 0;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
  }
  .database-table td::before {
    content: attr(data-label);
    color: var(--text-muted, #86868b);
    font-size: 0.75rem;
    flex-shrink: 0;
  }
  .database-table td:nth-child(1)::before { content: '#'; }
  .database-table td:nth-child(2)::before { content: 'Ticker'; }
  .database-table td:nth-child(3)::before { content: 'Company'; }
  .database-table td:nth-child(4)::before { content: 'Score'; }
  .database-table td:nth-child(5)::before { content: 'Tier'; }
  .database-table td:nth-child(6)::before { content: 'Archetype'; }
  .database-table td:nth-child(7)::before { content: 'Consensus'; }
  .database-table td:nth-child(8)::before { content: 'Deep'; }
  .database-table td:nth-child(9)::before { content: 'Age'; }
  .database-table td:nth-child(6),
  .database-table td:nth-child(7),
  .database-table td:nth-child(8) {
    display: none;
  }
}
