:root {
  --bg: #f4efe6;
  --panel: rgba(255, 250, 242, 0.88);
  --panel-strong: #fff9f0;
  --text: #16211c;
  --muted: #5c6b64;
  --line: rgba(22, 33, 28, 0.12);
  --accent: #1e6b52;
  --accent-soft: #4cae7d;
  --signal-hot: #d4553b;
  --signal-warm: #df8d2b;
  --signal-neutral: #d2b542;
  --signal-cool: #3c8c69;
  --positive: #1d7a54;
  --negative: #bb4d37;
  --shadow: 0 18px 60px rgba(35, 40, 32, 0.12);
  --shadow-sm: 0 4px 16px rgba(35, 40, 32, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --font-display: "Georgia", "Times New Roman", serif;
  --font-body: "Segoe UI", "Helvetica Neue", sans-serif;
  --font-mono: "Cascadia Code", "Fira Code", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(233, 192, 129, 0.34), transparent 28%),
    radial-gradient(circle at top right, rgba(30, 107, 82, 0.22), transparent 24%),
    linear-gradient(180deg, #efe4d2 0%, #f8f4ed 38%, #f4efe6 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.position-link {
  border-bottom: 1px solid rgba(30, 107, 82, 0.22);
  transition: color 180ms ease, border-color 180ms ease;
}

.position-link:hover {
  color: var(--accent);
  border-color: rgba(30, 107, 82, 0.65);
}

.ticker-link {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.name-link {
  color: inherit;
}

.shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 48px;
}

.page-shell {
  display: grid;
  gap: 18px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(255, 248, 236, 0.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav a {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  transition: 180ms ease;
}

.nav a.active,
.nav a:hover {
  background: rgba(30, 107, 82, 0.12);
  color: var(--text);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
  gap: 18px;
  margin-bottom: 18px;
}

.hero-panel,
.panel {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent 55%);
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.eyebrow {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

.hero h1 {
  margin: 16px 0 10px;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 0.95;
}

.lede {
  max-width: 58ch;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-meta .pill {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(30, 107, 82, 0.09);
  color: var(--muted);
}

.hero-side {
  display: grid;
  gap: 14px;
}

.value-strip {
  display: grid;
  gap: 10px;
}

.value-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
}

.value-amount {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3vw, 3.1rem);
  line-height: 1;
}

.value-delta {
  font-size: 0.96rem;
}

.positive {
  color: var(--positive);
  font-weight: 600;
}

.negative {
  color: var(--negative);
  font-weight: 600;
}

.delta-up::before { content: "▲ "; font-size: 0.7em; }
.delta-down::before { content: "▼ "; font-size: 0.7em; }

.cluster-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  background: rgba(30, 107, 82, 0.1);
  color: var(--accent);
  font-weight: 500;
}

.score-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.score-bar-track {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: rgba(22, 33, 28, 0.1);
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #6bcf9d);
  transition: width 600ms ease;
}

.score-bar-fill.hot { background: linear-gradient(90deg, #b83424, #e06648); }
.score-bar-fill.warm { background: linear-gradient(90deg, #b86c10, #e09b3a); }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.72);
}

.metric-card span {
  display: block;
}

.metric-label {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-value {
  margin: 12px 0 6px;
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-value.positive { color: var(--positive); }
.metric-value.negative { color: var(--negative); }
.metric-value.warning { color: #92540d; }

.metric-foot {
  color: var(--muted);
  font-size: 0.88rem;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.overview {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.page-intro h1 {
  margin: 14px 0 10px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3vw, 3.1rem);
  line-height: 1;
}

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

.chart-wrap {
  display: grid;
  gap: 12px;
}

.chart {
  width: 100%;
  min-height: 240px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(30, 107, 82, 0.08), rgba(30, 107, 82, 0)),
    rgba(255, 255, 255, 0.52);
}

.chart-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.donut-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.donut {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  position: relative;
  margin: 0 auto;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: rgba(255, 249, 240, 0.98);
  box-shadow: inset 0 0 0 1px rgba(22, 33, 28, 0.05);
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  z-index: 1;
}

.donut-center strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1;
}

.legend {
  display: grid;
  gap: 10px;
}

.legend-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 0.92rem;
}

.swatch {
  width: 11px;
  height: 11px;
  border-radius: 999px;
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.overlay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.overlay-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(30, 107, 82, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(246, 252, 248, 0.92));
}

.position-overlay-callout {
  display: grid;
}

.position-overlay-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid rgba(30, 107, 82, 0.16);
  background:
    radial-gradient(circle at top right, rgba(30, 107, 82, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(245, 251, 247, 0.96));
  box-shadow: var(--shadow-sm);
}

.position-overlay-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.position-overlay-rule,
.position-overlay-recommendation,
.position-overlay-arrow {
  font-size: 0.95rem;
}

.position-overlay-arrow {
  color: var(--muted);
}

.position-overlay-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.position-overlay-block {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(22, 33, 28, 0.08);
}

.position-overlay-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.position-overlay-rationale {
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: rgba(30, 107, 82, 0.06);
  line-height: 1.6;
}

.overlay-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.overlay-card h3 {
  margin: 0;
  font-size: 1rem;
}

.overlay-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.overlay-confidence {
  background: rgba(22, 33, 28, 0.08);
  color: var(--muted);
  box-shadow: 0 0 0 1px rgba(22, 33, 28, 0.08);
}

.verdict-confirm {
  background: rgba(60, 140, 105, 0.14);
  color: #235d44;
  box-shadow: 0 0 0 1px rgba(60, 140, 105, 0.2);
}

.verdict-escalate {
  background: rgba(212, 85, 59, 0.15);
  color: #8f3423;
  box-shadow: 0 0 0 1px rgba(212, 85, 59, 0.25);
}

.verdict-deescalate {
  background: rgba(223, 141, 43, 0.15);
  color: #924c0a;
  box-shadow: 0 0 0 1px rgba(223, 141, 43, 0.25);
}

.signal-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  transition: box-shadow 200ms ease, transform 200ms ease;
}

.signal-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.signal-card.card-hot {
  border-color: rgba(212, 85, 59, 0.3);
  background: rgba(255, 248, 246, 0.7);
}

.signal-card.card-warm {
  border-color: rgba(223, 141, 43, 0.25);
  background: rgba(255, 251, 246, 0.7);
}

.signal-card.card-actionable {
  border-left: 3px solid var(--signal-hot);
}

.signal-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.signal-card h3 {
  margin: 0;
  font-size: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.heat-hot {
  background: rgba(212, 85, 59, 0.15);
  color: #8f3423;
  box-shadow: 0 0 0 1px rgba(212, 85, 59, 0.25);
  animation: pulse-hot 2.4s ease-in-out infinite;
}
.heat-warm { background: rgba(223, 141, 43, 0.15); color: #924c0a; box-shadow: 0 0 0 1px rgba(223, 141, 43, 0.25); }
.heat-neutral { background: rgba(210, 181, 66, 0.16); color: #7c6713; }
.heat-cool { background: rgba(60, 140, 105, 0.14); color: #235d44; }

@keyframes pulse-hot {
  0%, 100% { box-shadow: 0 0 0 1px rgba(212, 85, 59, 0.25); }
  50% { box-shadow: 0 0 0 3px rgba(212, 85, 59, 0.18); }
}

.stack {
  display: grid;
  gap: 10px;
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(22, 33, 28, 0.08);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f6e58, #8bcf9d);
  transition: width 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-fill.negative-bar { background: linear-gradient(90deg, #993428, #dd7260); }

.table-wrap {
  overflow: auto;
  border-radius: 14px;
}

.empty-cell {
  padding: 18px 10px;
  color: var(--muted);
  text-align: center;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(22, 33, 28, 0.08);
  text-align: left;
  white-space: nowrap;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255, 249, 240, 0.96);
  backdrop-filter: blur(8px);
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

th[data-sort] {
  cursor: pointer;
  user-select: none;
  padding-right: 20px;
  position: relative;
}

th[data-sort]::after {
  content: "⇅";
  position: absolute;
  right: 4px;
  opacity: 0.35;
  font-size: 0.9em;
}

th[data-sort].sort-asc::after { content: "↑"; opacity: 0.8; color: var(--accent); }
th[data-sort].sort-desc::after { content: "↓"; opacity: 0.8; color: var(--accent); }

tbody tr:hover {
  background: rgba(30, 107, 82, 0.05);
}

tbody tr.below-gak-row {
  background: rgba(187, 77, 55, 0.04);
}

tbody tr.below-gak-row:hover {
  background: rgba(187, 77, 55, 0.09);
}

.ticker {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
  font-size: 0.87rem;
}

.small {
  font-size: 0.84rem;
}

.sparkline {
  width: 110px;
  height: 34px;
}

.empty {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.45);
  color: var(--muted);
}

.footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
  letter-spacing: 0.04em;
}

/* Filter / pill row */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.5);
  color: var(--muted);
  transition: 180ms ease;
  font-family: var(--font-body);
}

.filter-btn:hover {
  background: rgba(30, 107, 82, 0.08);
  color: var(--text);
  border-color: rgba(30, 107, 82, 0.25);
}

.filter-btn.active {
  background: rgba(30, 107, 82, 0.12);
  color: var(--accent);
  border-color: rgba(30, 107, 82, 0.35);
  font-weight: 600;
}

/* Page intro lede */
.lede.data-lede {
  font-size: 0.96rem;
  line-height: 1.7;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: rgba(30, 107, 82, 0.05);
  max-width: 72ch;
}

/* Chart enhancements */
.chart-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 6px 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.chart-stat strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Value strip improvements */
.value-amount {
  font-variant-numeric: tabular-nums;
}

/* Summary KPI row on overview */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px 0 4px;
  border-top: 1px solid var(--line);
}

.kpi-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.kpi-value {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.section-subtitle {
  margin: 4px 0 0;
  font-size: 0.86rem;
}

[data-animate] {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 600ms ease forwards;
}

[data-animate="2"] { animation-delay: 80ms; }
[data-animate="3"] { animation-delay: 160ms; }
[data-animate="4"] { animation-delay: 240ms; }

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .hero,
  .grid.overview,
  .grid.two,
  .metrics {
    grid-template-columns: 1fr;
  }

  .donut-layout {
    grid-template-columns: 1fr;
  }

  .signal-grid {
    grid-template-columns: 1fr;
  }

  .position-overlay-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 16px, 1380px);
    padding-top: 10px;
  }

  .topbar {
    position: static;
    border-radius: 24px;
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-panel,
  .panel {
    padding: 16px;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .filter-row {
    gap: 6px;
  }
}
