/* Readability scale v33 — use the available canvas instead of miniaturising content. */
:root {
  --readable-caption: 14px;
  --readable-small: 14px;
  --readable-body: 16px;
  --readable-control: 16px;
  --readable-value: 18px;
}

body {
  font-size: var(--readable-body);
  line-height: 1.55;
}

body .command-header {
  grid-template-columns: minmax(320px, .82fr) minmax(760px, 2.18fr) !important;
  min-height: 126px !important;
  padding: 18px 22px !important;
}

body .command-header .eyebrow {
  font-size: var(--readable-caption) !important;
}

body .command-header h1 {
  font-size: clamp(26px, 1.8vw, 34px) !important;
  line-height: 1.12 !important;
}

body .command-header .subline {
  margin-top: 5px !important;
  font-size: 15px !important;
  line-height: 1.5 !important;
}

body .bottom-nav {
  grid-template-columns: repeat(6, minmax(92px, 1fr)) !important;
  gap: 5px !important;
  padding: 6px !important;
}

body .bottom-nav .nav-item,
body .header-buttons button {
  min-height: 48px !important;
  padding: 10px 14px !important;
  font-size: var(--readable-control) !important;
  line-height: 1.25 !important;
}

body .system-strip {
  top: 151px !important;
}

body .system-strip div,
body .system-strip label {
  min-height: 88px !important;
  padding: 15px 18px !important;
}

body .system-strip span,
body .system-strip label span {
  font-size: var(--readable-caption) !important;
  line-height: 1.35 !important;
}

body .system-strip strong,
body .system-strip input {
  margin-top: 5px !important;
  font-size: var(--readable-value) !important;
  line-height: 1.35 !important;
}

body .live-tape {
  min-height: 52px !important;
  font-size: var(--readable-body) !important;
}

body .live-tape strong,
body .live-tape span,
body .mail-unread-badge {
  font-size: var(--readable-small) !important;
}

body .institution-view-chrome {
  min-height: 112px;
  padding: 20px 24px;
}

body .institution-view-chrome span,
body .institution-view-provenance span,
body .kicker,
body .stock-command-formal .intel-card span,
body .stock-command-formal .buy-check-card span,
body .stock-command-formal .score-radar > span {
  font-size: var(--readable-caption) !important;
}

body .institution-view-chrome strong {
  font-size: clamp(27px, 1.7vw, 34px);
  line-height: 1.2;
}

body .institution-view-chrome p,
body .panel-explain,
body .stock-radar-note,
body .institution-empty p,
body .institution-module-grid p,
body .institution-watch-row small,
body .institution-source-audit span {
  font-size: var(--readable-body) !important;
  line-height: 1.6 !important;
}

body .institution-deck-head .kicker,
body .institution-deck-head > button,
body .institution-deck-head > span,
body .institution-watch-row em,
body .institution-risk-bars span,
body .institution-risk-bars strong,
body .institution-risk-rail dt,
body .institution-module-grid span,
body .institution-module-grid em {
  font-size: var(--readable-small) !important;
}

body .institution-watch-row b,
body .institution-watch-row strong,
body .institution-risk-rail dd,
body .institution-module-grid strong,
body th,
body td,
body input,
body select,
body textarea,
body button {
  font-size: var(--readable-body) !important;
}

body .institution-risk-score span,
body .institution-risk-score strong small,
body .institution-risk-score em,
body .signal-legend p,
body .chart-toolbar span,
body .chart-title-stack span,
body .formal-chart-source span,
body .formal-chart-source em {
  font-size: var(--readable-small) !important;
  line-height: 1.5 !important;
}

body .mail-item span,
body .mail-item p,
body .news-impact-card span,
body .news-impact-card em,
body .quote-chip,
body .quote-chip b,
body .history-stat span,
body .history-stat p,
body .backtest-template span,
body .backtest-template small,
body .scanner-performance-grid span,
body .scanner-performance-card small,
body .about-tags span,
body .about-contact-item span,
body .about-contact-item b {
  font-size: var(--readable-small) !important;
  line-height: 1.5 !important;
}

body .mail-item strong,
body .news-impact-card strong,
body .history-stat strong,
body .backtest-template strong,
body .scanner-performance-grid strong {
  font-size: var(--readable-value) !important;
  line-height: 1.35 !important;
}

body .mail-item {
  min-height: 112px;
  padding: 16px !important;
}

body .news-impact-card,
body .history-stat,
body .backtest-template,
body .scanner-performance-card {
  padding: 16px !important;
}

body .history-event :where(span, p, small, em),
body .news-item :where(span, p, small, em),
body .news-quote-chips > span,
body .backtest-page :where(span, small, em),
body .backtest-plan-state span {
  font-size: var(--readable-small) !important;
  line-height: 1.5 !important;
}

body .history-event strong,
body .news-item strong {
  font-size: var(--readable-body) !important;
  line-height: 1.45 !important;
}

body .compare-bars b {
  font-size: var(--readable-small) !important;
  line-height: 1.4 !important;
}

body .backtest-page label,
body .backtest-form-grid label {
  font-size: var(--readable-body) !important;
  line-height: 1.5 !important;
}

body th {
  min-height: 48px;
  padding: 13px 14px;
}

body td {
  padding: 14px;
  line-height: 1.55;
}

body input,
body select,
body textarea {
  min-height: 48px;
  padding: 10px 13px;
}

body :where(.pill, .tag, .source-pill, .status-pill, .cred-dot, .quality-score, .freshness-label) {
  font-size: var(--readable-caption) !important;
  line-height: 1.35 !important;
}

/* Every non-home workspace gets a real annotation floor; inherited large text stays large. */
body .view:not(#view-dashboard) :where(span, small, em) {
  font-size: max(14px, 1em) !important;
  line-height: 1.5;
}

body :where(.panel, .about-page, .backtest-page, .mail-layout, .stock-detail-shell) :where(p, li, label) {
  font-size: var(--readable-body);
  line-height: 1.65;
}

body :where(.panel, .about-page, .backtest-page, .mail-layout, .stock-detail-shell) :where(small, em) {
  font-size: var(--readable-small);
  line-height: 1.5;
}

/* The compact decision radar now uses its card instead of floating as an unexplained icon. */
body .stock-command-formal .stock-command-side .score-radar {
  grid-column: 1 / -1 !important;
  grid-template-columns: minmax(260px, .85fr) minmax(280px, 1.15fr) !important;
  gap: 24px 34px !important;
  min-height: 430px !important;
  padding: clamp(24px, 2vw, 34px) !important;
}

body .stock-command-formal .score-radar-head {
  grid-column: 1 / -1;
}

body .stock-command-formal .score-radar-head span {
  color: var(--stock-v3-gold);
  font-size: var(--readable-caption);
  font-weight: 950;
  letter-spacing: .12em;
}

body .stock-command-formal .score-radar-head strong {
  display: block;
  margin-top: 6px;
  color: #eef8ff;
  font-size: clamp(24px, 1.7vw, 32px);
  line-height: 1.2;
}

body .stock-command-formal .score-radar-head p {
  margin: 7px 0 0;
  color: var(--stock-v3-muted);
  font-size: var(--readable-body);
  line-height: 1.55;
}

body .stock-command-formal .score-radar .radar-chart {
  width: min(100%, 330px) !important;
  padding: 12px !important;
}

body .stock-command-formal .score-radar svg {
  width: 100% !important;
  max-width: 330px !important;
}

body .stock-command-formal .score-radar .radar-axis {
  stroke: rgba(86, 220, 255, .22);
  stroke-width: 1.3;
}

body .stock-command-formal .score-radar .side-radar-label {
  fill: #dff7ff;
  font-size: 13px;
  font-weight: 950;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(3, 11, 20, .96);
  stroke-width: 3px;
}

body .stock-command-formal .score-radar .side-radar-value {
  fill: #f0bd67;
  font-size: 12px;
}

body .stock-command-formal .score-radar .side-radar-point {
  fill: #f7ffff;
  stroke: var(--stock-v3-cyan);
  stroke-width: 1.5;
}

body .stock-command-formal .radar-bars {
  gap: 16px !important;
}

body .stock-command-formal .radar-bars i {
  grid-template-columns: 58px minmax(140px, 1fr) 72px !important;
  gap: 14px !important;
}

body .stock-command-formal .radar-bars i::before {
  height: 12px;
}

body .stock-command-formal .radar-bars b,
body .stock-command-formal .radar-bars span {
  font-size: var(--readable-body) !important;
}

body .stock-radar-card text.radar-label {
  font-size: 14px !important;
}

body .stock-radar-factors > div > span,
body .stock-radar-factors > div > strong,
body .stock-radar-factors > div > em {
  font-size: var(--readable-body) !important;
}

@media (max-width: 1500px) {
  body .command-header {
    position: relative !important;
    top: auto !important;
    grid-template-columns: 1fr !important;
    min-height: 0 !important;
  }

  body .system-strip {
    position: relative !important;
    top: auto !important;
  }
}

@media (max-width: 1180px) {
  body .command-header > div:first-child {
    display: none !important;
  }

  body .system-strip {
    top: auto !important;
  }
}

@media (max-width: 720px) {
  :root {
    --readable-caption: 13px;
    --readable-small: 14px;
    --readable-body: 16px;
    --readable-control: 15px;
    --readable-value: 17px;
  }

  body .command-header {
    padding: 14px !important;
  }

  body .command-header h1 {
    font-size: 22px !important;
  }

  body .bottom-nav .nav-item {
    min-width: 86px !important;
    min-height: 52px !important;
    font-size: var(--readable-control) !important;
  }

  body .header-buttons button {
    min-height: 48px !important;
  }

  body .system-strip {
    top: auto !important;
  }

  body .system-strip div,
  body .system-strip label {
    flex-basis: 176px !important;
    min-height: 90px !important;
  }

  body .institution-view-chrome {
    min-height: 0;
    padding: 18px;
  }

  body .institution-view-chrome strong {
    font-size: 25px;
  }

  body .stock-command-formal .stock-command-side .score-radar {
    grid-column: 1 !important;
    grid-template-columns: 1fr !important;
    gap: 22px !important;
    min-height: 0 !important;
    padding: 22px 16px !important;
  }

  body .stock-command-formal .score-radar .radar-chart {
    width: min(100%, 310px) !important;
  }

  body .stock-command-formal .radar-bars i {
    grid-template-columns: 52px minmax(90px, 1fr) 70px !important;
    gap: 10px !important;
  }

  body .stock-radar-card text.radar-label {
    font-size: 13px !important;
  }
}
