/* ── Design tokens (light default; dark via [data-theme="dark"] on html) ── */
:root {
  color-scheme: light;
  --bg-page: #eef0f5;
  --bg-card: #ffffff;
  --bg-subtle: #f4f6fb;
  --border: #e2e5f0;
  --border-strong: #cdd1e4;
  --text: #0f1222;
  --text-muted: #5c6178;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-foreground: #ffffff;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --accent-soft-border: rgba(99, 102, 241, 0.35);
  --shadow-card: 0 4px 24px rgba(15, 18, 34, 0.07), 0 1px 2px rgba(15, 18, 34, 0.04);
  --shadow-nav: 0 0 0 1px var(--border);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 16px;
  --nav-width: 240px;
  --input-bg: #fafbff;
  --input-border: #d5d9e8;
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --ok: #059669;
  --error: #dc2626;
  --timeline-rail: #d8dce8;
  --timeline-body-bg: #f8f9fd;
  --timeline-body-border: var(--border);
  --code-pill-bg: #eef0ff;
  --code-pill-border: #d4d8f5;
  --mix-track: #e8ebf4;
  --hero-gradient: linear-gradient(135deg, #f0f2ff 0%, #e8ecff 50%, rgba(99, 102, 241, 0.2) 100%);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #0b0e14;
  --bg-card: #131722;
  --bg-subtle: #0f121a;
  --border: #262c3d;
  --border-strong: #343c52;
  --text: #f1f3fa;
  --text-muted: #949db8;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-foreground: #0b0e14;
  --accent-soft: rgba(129, 140, 248, 0.14);
  --accent-soft-border: rgba(129, 140, 248, 0.35);
  --shadow-card: 0 12px 40px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --shadow-nav: 0 0 0 1px var(--border);
  --input-bg: #0d1018;
  --input-border: #343b52;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --ok: #4ade80;
  --error: #fb7185;
  --timeline-rail: #3d4d72;
  --timeline-body-bg: rgba(19, 23, 34, 0.65);
  --timeline-body-border: #2e3d60;
  --code-pill-bg: rgba(36, 50, 84, 0.95);
  --code-pill-border: #3b5487;
  --mix-track: #27334f;
  --hero-gradient: linear-gradient(135deg, rgba(31, 42, 68, 0.92) 0%, rgba(44, 68, 111, 0.9) 55%, rgba(99, 102, 241, 0.35) 100%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ── App chrome: sidebar + main ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 18, 0.45);
  z-index: 40;
  backdrop-filter: blur(2px);
}

.app-layout.nav-mobile-open .app-nav-backdrop {
  display: block;
}

.app-nav {
  width: var(--nav-width);
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  z-index: 50;
  box-shadow: var(--shadow-nav);
}

.app-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.app-nav-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--accent);
}

.app-nav-brand-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.app-nav-brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.app-nav-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-bottom: 12px;
}

.app-nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 14px 12px 6px;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.app-nav-link:hover {
  background: var(--bg-subtle);
}

.app-nav-link.active {
  background: var(--accent-soft);
  border-color: var(--accent-soft-border);
  color: var(--accent);
}

.app-nav-link .nav-icon {
  font-size: 16px;
  opacity: 0.9;
  width: 22px;
  text-align: center;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.app-topbar-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.app-topbar-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-content {
  padding: 20px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  cursor: pointer;
  font-size: 20px;
}

.theme-segment {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-subtle);
}

.theme-segment button {
  border: 0;
  border-radius: 0;
  padding: 11px 14px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.theme-segment button:hover {
  color: var(--text);
}

.theme-segment button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.theme-segment-vertical {
  flex-direction: column;
  width: 100%;
}

.theme-segment-vertical button {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.theme-segment-vertical button:last-child {
  border-bottom: 0;
}

.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.user-menu-trigger:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.user-menu-trigger-chevron {
  font-size: 10px;
  color: var(--text-muted);
}

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 248px;
  max-width: min(92vw, 300px);
  z-index: 60;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 8px 0;
}

.user-menu-heading {
  padding: 10px 14px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.user-menu-section {
  padding: 6px 10px 10px;
}

.user-menu-kicker {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 4px 4px 8px;
}

.user-menu-actions {
  padding-top: 0;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.user-menu-item {
  display: block;
  width: calc(100% - 8px);
  margin: 4px;
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.user-menu-item:hover {
  background: var(--bg-subtle);
}

.user-menu-item-danger {
  color: var(--danger);
}

.user-menu-item-danger:hover {
  background: var(--danger-soft);
}

.login-menu-corner {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
}

.login-wrap.app-bg-layer .card {
  background: color-mix(in srgb, var(--bg-card) 94%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* Full-viewport art background (shrinks via cover; position tuned mobile vs desktop) */
.app-bg-layer {
  background-color: var(--bg-page);
  background-image:
    linear-gradient(180deg, rgba(11, 14, 20, 0.9) 0%, rgba(11, 14, 20, 0.76) 42%, rgba(11, 14, 20, 0.9) 100%),
    url(/images/morning-bg.png);
  background-size: auto, cover;
  background-position: 0 0, center 36%;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
}

html[data-theme="light"] .app-bg-layer {
  background-image:
    linear-gradient(180deg, rgba(252, 253, 255, 0.94) 0%, rgba(238, 241, 248, 0.82) 48%, rgba(250, 251, 255, 0.93) 100%),
    url(/images/morning-bg.png);
  background-position: 0 0, center 32%;
}

@media (max-width: 640px) {
  .app-bg-layer {
    background-position: 0 0, center 26%;
    background-size: auto, 240%;
  }

  html[data-theme="light"] .app-bg-layer {
    background-position: 0 0, center 22%;
    background-size: auto, 220%;
  }
}

.app-layout.app-bg-layer > .app-nav {
  background: color-mix(in srgb, var(--bg-card) 86%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.app-layout.app-bg-layer .app-topbar {
  background: color-mix(in srgb, var(--bg-card) 86%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
  }

  .app-nav {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-card);
  }

  .app-layout.nav-mobile-open .app-nav {
    transform: translateX(0);
  }

  .app-main {
    width: 100%;
  }
}

/* Legacy container: use inside main for login */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.panel {
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.panel-float {
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 16px;
  align-items: stretch;
}

.hero-panel.panel-float {
  background: var(--hero-gradient);
  margin-bottom: 4px;
  border-color: var(--accent-soft-border);
}

.friends-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.schema-panel .schema-lede {
  margin: 6px 0 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.schema-pills {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schema-pill-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.code-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--code-pill-bg);
  border: 1px solid var(--code-pill-border);
  color: var(--text);
}

.schema-count {
  font-size: 12px;
}

.schema-count.ok { color: var(--ok); }

.muted-tag { color: var(--text-muted); font-size: 12px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }

.col { flex: 1 1 360px; }

input, button, select, textarea {
  font: inherit;
}

input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

button {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 13px 20px;
  background: var(--accent);
  color: var(--accent-foreground);
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s, opacity 0.15s;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.secondary {
  background: var(--bg-subtle);
  color: var(--text);
  border: 1px solid var(--border);
}

button.secondary:hover:not(:disabled) {
  background: var(--border);
}

button.ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

button.ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--bg-subtle);
}

h1, h2, h3 { margin-top: 0; }

.muted { color: var(--text-muted); }

.error { color: var(--error); }

.ok { color: var(--ok); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  vertical-align: top;
}

.scroll { overflow: auto; max-height: 460px; }

/* Alerts / summary: long text cells wrap instead of clipping */
.table-prose-wide th,
.table-prose-wide td {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.table-prose-wide .td-wrap {
  min-width: 10rem;
}

.pill {
  border-radius: 999px;
  padding: 3px 11px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 12px;
  display: inline-block;
  color: var(--text);
}

.profile-pill {
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-pill:hover {
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
}

.pref-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

input[type="checkbox"] {
  width: auto;
}

.link-chip {
  display: inline-block;
  text-decoration: none;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  border-radius: 999px;
  padding: 11px 18px;
  font-weight: 600;
  font-size: 13px;
}

.link-chip:hover {
  background: var(--accent-soft-border);
}

.hero {
  background: var(--hero-gradient);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.timeline-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.timeline-rail {
  position: relative;
  margin-top: 8px;
  padding-left: 4px;
}

.timeline-rail::before {
  content: "";
  position: absolute;
  left: calc(88px + 10px);
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--timeline-rail) 0%, var(--border) 100%);
  border-radius: 2px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 88px 22px minmax(0, 1fr);
  gap: 10px 6px;
  align-items: start;
  padding-bottom: 22px;
  position: relative;
}

.timeline-meta {
  text-align: right;
  padding-top: 2px;
}

.timeline-big {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
}

.timeline-small {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.timeline-node-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 6px;
  z-index: 1;
}

.timeline-node {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-page);
  box-shadow: 0 0 0 1px var(--border-strong);
  flex-shrink: 0;
}

.timeline-body {
  background: var(--timeline-body-bg);
  border: 1px solid var(--timeline-body-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.timeline-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.timeline-cat {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}

.timeline-desc {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.timeline-tickers {
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 560px) {
  .timeline-rail::before {
    left: 11px;
  }
  .timeline-row {
    grid-template-columns: 1fr;
    padding-left: 28px;
    padding-bottom: 18px;
  }
  .timeline-meta {
    text-align: left;
    grid-row: 1;
  }
  .timeline-node-wrap {
    position: absolute;
    left: 0;
    top: 4px;
    padding-top: 0;
  }
  .timeline-body {
    grid-row: 2;
    grid-column: 1 / -1;
  }
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 16px;
}

.pie-card {
  text-align: center;
}

.pie-chart {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  margin: 12px auto;
  border: 2px solid var(--border);
}

.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  max-width: 220px;
  margin: 0 auto;
  font-size: 12px;
  color: var(--text-muted);
}

.pie-legend-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.pie-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

.kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.chart-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  margin-top: 8px;
}

.bar-wrap {
  flex: 1;
  min-width: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.bar {
  flex: 1;
  width: 100%;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  border-radius: 6px 6px 0 0;
  opacity: 0.92;
}

.bar-label {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.donut {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  margin: 10px auto;
  background: conic-gradient(#66d9a8 0deg 120deg, #f2c66a 120deg 240deg, #ff8aa0 240deg 360deg);
}

.legend-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.bullish { background: #66d9a8; }
.dot.neutral { background: #f2c66a; }
.dot.bearish { background: #ff8aa0; }

.mix-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mix-row {
  display: grid;
  grid-template-columns: 130px 1fr 48px;
  gap: 8px;
  align-items: center;
}

.mix-label {
  font-size: 12px;
  color: var(--text);
}

.mix-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--mix-track);
  overflow: hidden;
}

.mix-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hover) 100%);
}

.mix-pct {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

.app-shell {
  min-height: 100vh;
  position: relative;
}

/* Login centered card */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
}

label.muted {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

/* Friends dashboard — signal board, macro timeline, tiers, triggers */
.signal-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) {
  .signal-board {
    grid-template-columns: 1fr;
  }
}

.signal-quadrant {
  background: rgba(24, 32, 55, 0.88);
  border: 1px solid rgba(79, 124, 255, 0.22);
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sq-header {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sq-header.bull {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.sq-header.bear {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.sq-header.tech {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.sq-header.thesis-h {
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
}

.sq-body {
  padding: 8px 12px;
  overflow-y: auto;
  max-height: 280px;
  flex: 1;
}

.sq-row {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.sq-row:last-child {
  border-bottom: none;
}

.sq-dir {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.sq-content {
  flex: 1;
  min-width: 0;
}

.sq-name {
  font-size: 13px;
  font-weight: 500;
  color: #e2e5ec;
  line-height: 1.3;
}

.sq-meta {
  font-size: 10px;
  color: #5a6075;
  margin-top: 2px;
  font-family: "DM Mono", ui-monospace, monospace;
}

.sq-note {
  font-size: 11px;
  color: #5a6075;
  margin-top: 3px;
  line-height: 1.4;
}

.strength-pill {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.sp-3p {
  background: #16301d;
  color: #22c55e;
}

.sp-2p {
  background: #1a2b1a;
  color: #4ade80;
}

.sp-1p {
  background: #1e2129;
  color: #6b7280;
}

.sp-1n {
  background: #1e2129;
  color: #6b7280;
}

.sp-2n {
  background: #2d1a1a;
  color: #f87171;
}

.sp-3n {
  background: #301616;
  color: #ef4444;
}

.macro-tl {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 2px;
}

.macro-tl::before {
  content: "";
  position: absolute;
  left: 52px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, #2a3555, #1a2235);
  border-radius: 2px;
}

.mtl-row {
  display: grid;
  grid-template-columns: 44px 24px 1fr;
  gap: 8px;
  align-items: flex-start;
  padding-bottom: 16px;
  position: relative;
}

.mtl-date {
  text-align: right;
  font-size: 11px;
  color: #5a6075;
  font-family: "DM Mono", ui-monospace, monospace;
  padding-top: 3px;
  line-height: 1.3;
}

.mtl-dot-wrap {
  display: flex;
  justify-content: center;
  padding-top: 4px;
  z-index: 1;
}

.mtl-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #0a0b0d;
  flex-shrink: 0;
}

.mtl-card {
  background: rgba(19, 29, 51, 0.7);
  border: 1px solid #2e3d60;
  border-radius: 10px;
  padding: 10px 12px;
}

.mtl-analyst {
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  color: #e2e5ec;
}

.mtl-call {
  font-size: 12px;
  color: #c5d0ef;
  line-height: 1.5;
  margin: 4px 0;
}

.mtl-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.badge {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 4px;
  font-family: "DM Mono", ui-monospace, monospace;
}

.badge-bull {
  background: #16301d;
  color: #4ade80;
}

.badge-bear {
  background: #301616;
  color: #f87171;
}

.badge-change {
  background: #2d2400;
  color: #fbbf24;
  border: 1px solid #4a3b00;
}

.badge-tier {
  background: #1e2535;
  color: #93c5fd;
}

.tier-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tier-row {
  border-left: 3px solid rgba(129, 140, 248, 0.35);
  padding-left: 12px;
}

.tier-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}

.tier-label {
  font-size: 13px;
  font-weight: 500;
  color: #e2e5ec;
}

.tier-pct {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 13px;
  color: #e2e5ec;
}

.tier-track {
  height: 6px;
  background: #1e2129;
  border-radius: 3px;
  overflow: hidden;
}

.tier-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}

.tf-green {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.tf-blue {
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

.tf-amber {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.tier-ticker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tier-tick {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(147, 197, 253, 0.12);
  border: 1px solid rgba(147, 197, 253, 0.35);
  color: #bfdbfe;
}

.tier-reason {
  font-size: 12px;
  color: #949db8;
  margin-top: 8px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.delta-pill {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-family: "DM Mono", ui-monospace, monospace;
}

.dp-up {
  background: #16301d;
  color: #4ade80;
}

.dp-down {
  background: #301616;
  color: #f87171;
}

.trigger-group {
  margin-bottom: 16px;
}

.tg-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tg-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  align-items: flex-start;
}

.tg-row:last-child {
  border-bottom: none;
}

.tg-ticker {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  color: #93c5fd;
}

.tg-desc {
  font-size: 12px;
  color: #c5d0ef;
  line-height: 1.4;
}

.tg-detail {
  font-size: 11px;
  color: #5a6075;
  margin-top: 2px;
}

.tg-val {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 12px;
  color: #e2e5ec;
  white-space: nowrap;
}

.collapse-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #5a6075;
  font-size: 11px;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 8px;
}

.collapse-btn:hover {
  color: #e2e5ec;
  border-color: rgba(255, 255, 255, 0.2);
}

/* One-time disclaimer gate (blocking until accepted + stored in D1) */
.disclaimer-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 88px 20px 40px;
}

.disclaimer-gate-card {
  max-width: 560px;
  width: 100%;
}

.disclaimer-gate-card h2 {
  margin-top: 0;
}

.disclaimer-body p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.55;
}

.disclaimer-ack {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 18px 0 10px;
  font-size: 14px;
  line-height: 1.45;
  cursor: pointer;
}

.disclaimer-ack input {
  width: auto;
  margin-top: 3px;
  flex-shrink: 0;
}

.disclaimer-actions {
  margin-top: 4px;
}

.disclaimer-version {
  margin-top: 16px;
  margin-bottom: 0;
  font-size: 12px;
}

/* X & Cron — tweet cards */
.x-cron-tweets.scroll {
  max-height: min(78vh, 900px);
}

.x-tweet-feed {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.x-tweet-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  padding: 14px 16px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.x-tweet-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 10px;
}

.x-tweet-rank {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  padding: 3px 8px;
  border-radius: 6px;
}

.x-sent {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
}

.x-sent-bull {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.x-sent-bear {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.x-sent-neutral {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.x-rel-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 160px;
  min-width: 140px;
}

.x-rel-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.x-rel-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--mix-track);
  overflow: hidden;
  max-width: 200px;
}

.x-rel-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hover) 100%);
  min-width: 2px;
  transition: width 0.2s ease;
}

.x-rel-val {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-width: 2.5rem;
}

.x-meta-chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.x-tweet-byline {
  font-size: 13px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.x-tweet-author {
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.x-tweet-author:hover {
  text-decoration: underline;
}

.x-tweet-text {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.x-topic-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.x-topic-pill {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--code-pill-bg);
  border: 1px solid var(--code-pill-border);
  color: var(--text);
  text-transform: capitalize;
}

.x-tweet-reason {
  font-size: 12px;
  margin: 0 0 10px;
  line-height: 1.45;
}

.x-tweet-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.x-engage {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.x-flags {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  text-transform: lowercase;
}
