/* ===========================================================
   XHS Sentiment Index — Vercel Geist + Restrained Semantic Color
   =========================================================== */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-subtle: #f4f4f5;
  --surface-hover: #f9fafb;
  --border: #e5e5e5;
  --border-strong: #d4d4d8;

  --text: #171717;
  --text-secondary: #525252;
  --text-muted: #595962;

  --brand: #be123c;
  --brand-soft: rgba(190, 18, 60, 0.08);
  --accent: #005fcc;
  --accent-soft: rgba(0, 95, 204, 0.08);

  --risk-extreme: #b91c1c;
  --risk-extreme-bg: rgba(185, 28, 28, 0.08);
  --risk-high: #c2410c;
  --risk-high-bg: rgba(194, 65, 12, 0.08);
  --risk-watch: #92400e;
  --risk-watch-bg: rgba(146, 64, 14, 0.08);
  --risk-watch-border: rgba(146, 64, 14, 0.24);
  --risk-normal: #047857;
  --risk-normal-bg: rgba(4, 120, 87, 0.08);
  --risk-cold: #52525b;
  --risk-cold-bg: rgba(82, 82, 91, 0.08);

  --grid-line: #efefef;
  --shadow-tip: 0 4px 16px rgba(0, 0, 0, 0.08);

  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #000000;
  --surface: #0a0a0a;
  --surface-subtle: #141414;
  --surface-hover: #171717;
  --border: #262626;
  --border-strong: #3f3f46;

  --text: #ededed;
  --text-secondary: #a1a1aa;
  --text-muted: #a1a1aa;

  --brand: #fb7185;
  --brand-soft: rgba(251, 113, 133, 0.14);
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.14);

  --risk-extreme: #fca5a5;
  --risk-extreme-bg: rgba(248, 113, 113, 0.14);
  --risk-high: #fdba74;
  --risk-high-bg: rgba(251, 146, 60, 0.14);
  --risk-watch: #fcd34d;
  --risk-watch-bg: rgba(251, 191, 36, 0.14);
  --risk-watch-border: rgba(251, 191, 36, 0.28);
  --risk-normal: #6ee7b7;
  --risk-normal-bg: rgba(52, 211, 153, 0.14);
  --risk-cold: #a1a1aa;
  --risk-cold-bg: rgba(161, 161, 170, 0.12);

  --grid-line: #1b1b1e;
  --shadow-tip: 0 8px 24px rgba(0, 0, 0, 0.6);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  caret-color: var(--accent);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background-color: var(--accent-soft);
  color: var(--text);
}

a {
  text-underline-offset: 3px;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--border-strong);
  border-radius: 4px;
}

h1, h2, h3, h4, p, ul {
  margin: 0;
}

button, input {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header & Subnav ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  flex-shrink: 0;
  display: block;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-sep {
  color: var(--border-strong);
}

.brand-sub {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.data-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background-color: var(--surface-subtle);
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--risk-normal);
  flex-shrink: 0;
}

.data-status.warn .status-dot {
  background-color: var(--risk-watch);
}

.data-status.busy .status-dot {
  background-color: var(--accent);
}

.status-pill {
  font-size: 12px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 160ms ease-out, background-color 160ms ease-out, border-color 160ms ease-out;
}

.icon-btn:hover {
  color: var(--text);
  background-color: var(--surface-subtle);
  border-color: var(--border-strong);
}

.icon-btn.spin .icon-svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

.subnav {
  position: sticky;
  top: 56px;
  z-index: 25;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
}

.subnav-inner {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.subnav-inner::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  appearance: none;
  border: 0;
  background: none;
  padding: 11px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 160ms ease-out;
}

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

.tab.on {
  color: var(--text);
  font-weight: 600;
}

.tab.on::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  background-color: var(--text);
}

.tab-alert-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--brand);
}

/* ---------- Main Layout & Panels ---------- */
.main {
  padding: 20px 0 48px;
}

.pane {
  display: none;
}

.pane.on {
  display: block;
}

.panel {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.panel-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.section-gap {
  margin-top: 16px;
}

/* ---------- KPI Strip ---------- */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 16px;
}

.kpi-item {
  padding: 16px 20px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-item:last-child {
  border-right: 0;
}

.kpi-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.kpi-value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.18;
  color: var(--text);
}

.kpi-value small {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 2px;
}

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

/* ---------- Segmented Controls ---------- */
.seg {
  display: inline-flex;
  align-items: center;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 160ms ease-out, background-color 160ms ease-out;
}

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

.seg button.on {
  background-color: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.seg-compact {
  width: 100%;
  justify-content: space-between;
}

.seg-compact button {
  flex: 1;
  padding: 4px 6px;
  font-size: 12px;
}

/* ---------- Dashboard Grid ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.sidebar-panel {
  display: flex;
  flex-direction: column;
}

.sidebar-filter {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.asset-list {
  max-height: 670px;
  overflow-y: auto;
}

.arow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 150ms ease-out;
}

.arow:last-child {
  border-bottom: 0;
}

.arow:hover {
  background-color: var(--surface-hover);
}

.arow.on {
  background-color: var(--surface-subtle);
}

.arow.stale .n-text {
  color: var(--text-secondary);
}

.arow .n {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  min-width: 0;
}

.arow .n-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arow.on .n {
  font-weight: 600;
}

.arow .zd {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.arow .stag {
  font-style: normal;
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
  flex-shrink: 0;
}

.arow .s {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arow .v {
  font-size: 15px;
  font-weight: 600;
  text-align: right;
  grid-column: 2;
  grid-row: 1;
}

.arow .c {
  font-size: 12px;
  text-align: right;
  grid-column: 2;
  grid-row: 2;
}

.arow .bar {
  grid-column: 1 / -1;
  height: 3px;
  background-color: var(--surface-subtle);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.arow .bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
}

.up { color: var(--risk-extreme); }
.down { color: var(--risk-normal); }
.flat { color: var(--text-muted); }

/* ---------- Chart Panel ---------- */
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.chart-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.chart-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.zone-pill {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
}

.chart-host {
  position: relative;
  height: 290px;
  padding: 8px 0 0;
}

.chart-host svg {
  display: block;
}

.chart-tip {
  position: absolute;
  pointer-events: none;
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  white-space: nowrap;
  opacity: 0;
  z-index: 10;
  box-shadow: var(--shadow-tip);
  transition: opacity 120ms ease-out;
}

.chart-tip .t {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.chart-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--border);
}

.cstat {
  padding: 12px 18px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cstat:last-child {
  border-right: 0;
}

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

.cstat-val {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.signal-banner {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background-color: var(--surface-subtle);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.signal-banner strong {
  color: var(--text);
  font-weight: 600;
}

.signal-head {
  margin-bottom: 6px;
}

.signal-samples {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.signal-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.signal-src {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.signal-link {
  color: var(--accent);
  text-decoration: none;
}

.signal-link:hover {
  text-decoration: underline;
}

.detail-split {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  border-top: 1px solid var(--border);
}

.detail-col {
  padding: 18px 20px;
}

.detail-col-verdict {
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.subhead h3 {
  font-size: 14px;
  font-weight: 600;
}

.subhead-meta {
  font-size: 12.5px;
  color: var(--text-muted);
}

.comp-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.cp {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 10px;
  align-items: center;
}

.cp .k {
  font-size: 13px;
  color: var(--text-secondary);
}

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

.cp .v {
  font-size: 13px;
  font-weight: 600;
}

.cp .t {
  grid-column: 1 / -1;
  height: 4px;
  background-color: var(--surface-subtle);
  border-radius: 2px;
  overflow: hidden;
}

.cp .t i {
  display: block;
  height: 100%;
  border-radius: 2px;
  transition: width 240ms ease-out;
}

.verdict-box {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-secondary);
  flex: 1;
}

.verdict-box strong {
  display: block;
  font-size: 14.5px;
  margin-bottom: 6px;
}

.verdict-intent {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.jump-link {
  margin-top: 16px;
  appearance: none;
  border: 1px solid var(--border);
  background-color: var(--surface-subtle);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out;
}

.jump-link:hover {
  background-color: var(--surface-hover);
  border-color: var(--border-strong);
}

/* ---------- Reconciliation & Data Tables ---------- */
.recon-panel {
  margin-top: 16px;
}

.recon-head {
  flex-wrap: wrap;
}

.recon-title-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.recon-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.rstat strong {
  color: var(--text);
  font-weight: 600;
}

.rstat.ok strong { color: var(--risk-normal); }
.rstat.bad strong { color: var(--risk-extreme); }

.recon-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.tbl th {
  text-align: left;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background-color: var(--surface-subtle);
  white-space: nowrap;
}

.tbl td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

.tbl tbody tr:last-child td {
  border-bottom: 0;
}

.tbl tbody tr:hover td {
  background-color: var(--surface-hover);
}

.tbl-clickable tbody tr {
  cursor: pointer;
}

.tbl .num, .tbl th.num {
  text-align: right;
}

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

.tbl .secondary {
  color: var(--text-secondary);
}

.tag {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.tag.hit, .tag.z-n {
  color: var(--risk-normal);
  background-color: var(--risk-normal-bg);
}

.tag.miss, .tag.z-ex {
  color: var(--risk-extreme);
  background-color: var(--risk-extreme-bg);
}

.tag.pend, .tag.z-w {
  color: var(--risk-watch);
  background-color: var(--risk-watch-bg);
}

.tag.z-hi {
  color: var(--risk-high);
  background-color: var(--risk-high-bg);
}

.tag.z-c {
  color: var(--risk-cold);
  background-color: var(--risk-cold-bg);
}

.tdot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.heat-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hbar {
  flex: 1;
  height: 5px;
  background-color: var(--surface-subtle);
  border-radius: 3px;
  overflow: hidden;
  min-width: 72px;
}

.hbar i {
  display: block;
  height: 100%;
  border-radius: 3px;
}

/* ---------- Filter Bar & Inputs ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.input {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 160ms ease-out;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-input {
  width: 220px;
}

.toggle-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.toggle-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--text);
}

.clear-filter-btn {
  appearance: none;
  border: 1px solid var(--border);
  background-color: var(--surface-subtle);
  color: var(--text);
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.clear-filter-btn:hover {
  border-color: var(--border-strong);
}

/* ---------- Threshold & Calculator ---------- */
.thr-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 16px;
  align-items: start;
}

.thr-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.sat-host {
  height: 245px;
  padding: 8px 0;
}

.calc-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.calc-disclaimer {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
}

.slider-row label {
  color: var(--text-secondary);
}

.slider-row strong {
  font-weight: 600;
}

.slider-group input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.calc-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background-color: var(--surface-subtle);
}

.calc-kv {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.calc-kv:nth-child(2n) {
  border-right: 0;
}

.calc-kv:nth-last-child(-n+2) {
  border-bottom: 0;
}

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

.calc-kv strong {
  font-size: 15px;
  font-weight: 600;
}

.calc-kv-highlight strong {
  color: var(--brand);
}

.calc-note {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.chk-list {
  display: flex;
  flex-direction: column;
}

.ci {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.ci:last-child {
  border-bottom: 0;
}

.ci .box {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: transparent;
}

.ci.yes .box {
  border-color: var(--brand);
  background-color: var(--brand-soft);
  color: var(--brand);
}

.ci .tx {
  font-size: 13.5px;
  font-weight: 500;
}

.ci .tx small {
  display: block;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
}

.ci .sc {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.ci.yes .sc {
  color: var(--brand);
}

/* ---------- Forecast ---------- */
.fc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.fc {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 160ms ease-out;
}

.fc:hover {
  border-color: var(--border-strong);
}

.fc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.fc-name {
  min-width: 0;
}

.fc-name h3 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fc-name .m {
  margin-top: 6px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.fc-name .m > * {
  white-space: nowrap;
}

.fc-prob {
  text-align: right;
  flex-shrink: 0;
}

.fc-prob strong {
  display: block;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

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

.fc-meter {
  height: 3px;
  background-color: var(--surface-subtle);
  border-radius: 2px;
  overflow: hidden;
}

.fc-meter i {
  display: block;
  height: 100%;
  border-radius: 2px;
}

.fc-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.fc-line {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.fc-line i {
  font-style: normal;
  font-size: 12px;
  color: var(--text-muted);
}

.fc-line em {
  font-style: normal;
  color: var(--text-secondary);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.cd {
  padding: 14px 14px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cd:last-child {
  border-right: 0;
}

.cd .d {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
}

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

.cd .e {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

.cd .tg {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.action-item {
  padding: 16px 18px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.action-item:last-child {
  border-right: 0;
}

.action-step {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
}

.action-item h3 {
  font-size: 14.5px;
  font-weight: 600;
}

.action-item p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.callout {
  padding: 16px 18px;
  border: 1px solid var(--risk-watch-border);
  border-radius: 10px;
  background-color: var(--risk-watch-bg);
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--risk-watch);
  margin-bottom: 6px;
}

.callout p {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.65;
}

.sch-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.si {
  padding: 14px 16px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.si:last-child {
  border-right: 0;
}

.si .h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 600;
}

.si .st {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.si.now .st { color: var(--accent); }
.si.done .st { color: var(--risk-normal); }

.si .m {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ---------- Crisis Radar ---------- */
.crisis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.cc {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 160ms ease-out;
}

.cc:hover {
  border-color: var(--border-strong);
}

.cc-h {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cc-h h3 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.cc-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cc-p {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.cc-line {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.cpath {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  background-color: var(--surface-subtle);
  border-radius: 8px;
  font-size: 12.5px;
}

.cpath i {
  font-style: normal;
  color: var(--text-muted);
}

.cc-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

.cc-meta strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ---------- Ingest & Methodology ---------- */
.ing-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.15fr;
  gap: 16px;
  align-items: start;
}

.ingest-box {
  padding: 16px 18px;
}

.url-row {
  display: flex;
  gap: 8px;
}

.url-row .input {
  flex: 1;
  min-width: 0;
}

.btn-primary {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background-color: var(--text);
  color: var(--surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 160ms ease-out;
}

.btn-primary:hover {
  opacity: 0.88;
}

.btn-secondary {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background-color: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out;
}

.btn-secondary:hover {
  background-color: var(--surface-subtle);
  border-color: var(--border-strong);
}

.feed-list {
  margin-top: 14px;
  min-height: 180px;
}

.feed-empty {
  padding: 24px 16px;
  text-align: center;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background-color: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.65;
}

.demo-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fi {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.fi:last-child {
  border-bottom: 0;
}

.fi .tm {
  font-size: 12.5px;
  color: var(--text-muted);
}

.fi .h {
  font-size: 13.5px;
  font-weight: 500;
}

.fi .d {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.snap-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--border);
}

.snap-grid > div {
  padding: 12px 16px;
  border-right: 1px solid var(--border);
}

.snap-grid > div:last-child {
  border-right: 0;
}

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

.snap-grid .v {
  font-size: 16px;
  font-weight: 600;
  margin-top: 2px;
}

.snap-grid .v small {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}

.health-bar {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background-color: var(--surface-subtle);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.meth-body {
  padding: 18px 22px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 68ch;
}

.meth-body h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 8px;
}

.meth-body h3:first-child {
  margin-top: 0;
}

.meth-body code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text);
}

.formula-list {
  margin: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.formula-row {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
}

.formula-row:last-child {
  border-bottom: 0;
}

.formula-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.formula-name strong {
  color: var(--accent);
  margin-left: 4px;
}

.formula-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.meth-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meth-list strong {
  color: var(--text);
}

.footnote {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .dash-grid,
  .thr-grid,
  .ing-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .asset-list {
    max-height: 320px;
  }
  .cal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cd {
    border-bottom: 1px solid var(--border);
  }
  .actions-grid,
  .sch-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .action-item,
  .si {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .action-item:last-child,
  .si:last-child {
    border-bottom: 0;
  }
  .crisis-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 14px;
  }
  .brand-sep,
  .brand-sub {
    display: none;
  }
  .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi-item {
    border-bottom: 1px solid var(--border);
  }
  .kpi-item:nth-child(2n) {
    border-right: 0;
  }
  .kpi-item:last-child {
    grid-column: 1 / -1;
    border-right: 0;
    border-bottom: 0;
  }
  .chart-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cstat {
    border-bottom: 1px solid var(--border);
  }
  .cstat:nth-child(2n) {
    border-right: 0;
  }
  .cstat:last-child {
    grid-column: 1 / -1;
    border-right: 0;
    border-bottom: 0;
  }
  .detail-split {
    grid-template-columns: minmax(0, 1fr);
  }
  .detail-col-verdict {
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .snap-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .snap-grid > div {
    border-bottom: 1px solid var(--border);
  }
  .formula-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .search-input {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .data-status .status-text {
    display: none;
  }
  .chart-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .cal-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .cd {
    border-right: 0;
  }
}

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