:root {
  color-scheme: dark;
  --bg: #071019;
  --bg-raised: #0e1a26;
  --surface: #0e1a26;
  --surface-raised: #132332;
  --surface-soft: #132332;
  --gold: #e2b95b;
  --gold-bright: #f1cf7d;
  --gold-muted: var(--muted);
  --gold-faint: rgba(226, 185, 91, 0.12);
  --gold-line: #293b4b;
  --line-soft: rgba(41, 59, 75, 0.72);
  --control-line: #4b7694;
  --steel: #6288a4;
  --steel-soft: rgba(98, 136, 164, 0.14);
  --text: #edf3f7;
  --muted: #95a5b3;
  --positive: #42d6b2;
  --positive-soft: rgba(66, 214, 178, 0.12);
  --negative: #f2737d;
  --negative-soft: rgba(242, 115, 125, 0.12);
  --warning: #efb865;
  --warning-soft: rgba(239, 184, 101, 0.13);
  --info: #61c6d7;
  --info-soft: rgba(97, 198, 215, 0.12);
  --locked: #b7c5d3;
  --locked-soft: #192634;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background:
    radial-gradient(circle at 12% 0%, rgba(58, 132, 173, 0.13), transparent 28rem),
    radial-gradient(circle at 88% 12%, rgba(226, 185, 91, 0.045), transparent 24rem),
    var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: 18px;
  color: var(--text);
  background: transparent;
  font-size: 14px;
  line-height: 1.45;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(1440px, 100%);
  min-width: 0;
  margin: 0 auto;
  overflow: hidden;
  background: rgba(7, 16, 25, 0.96);
  border: 1px solid var(--gold-line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 15px 22px;
  background:
    linear-gradient(100deg, rgba(98, 136, 164, 0.09), transparent 34%),
    var(--bg-raised);
  border-bottom: 1px solid var(--gold-line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  color: #071019;
  background: linear-gradient(145deg, var(--gold-bright), var(--gold));
  border-radius: 11px;
  box-shadow: 0 8px 24px rgba(226, 185, 91, 0.2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand small {
  margin-top: 1px;
  color: var(--gold-muted);
  font-size: 11px;
}

.system-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.system-note,
.scope-note {
  color: var(--muted);
  font-size: 12px;
}

.status-pill,
.data-badge,
.learning-state,
.lock-state {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.status-pill::before {
  width: 7px;
  height: 7px;
  margin-right: 7px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 13%, transparent);
  content: "";
}

.status-loading {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-good {
  color: var(--positive);
  background: var(--positive-soft);
}

.status-bad {
  color: var(--negative);
  background: var(--negative-soft);
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  color: var(--gold-bright);
  background: var(--gold-faint);
  border: 1px solid var(--control-line);
  border-radius: 9px;
  cursor: pointer;
}

.refresh-button:hover {
  background: rgba(226, 185, 91, 0.18);
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.refresh-button.is-loading span {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .refresh-button.is-loading span {
    animation: none;
  }
}

.main-tabs {
  display: flex;
  gap: 4px;
  padding: 0 22px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--gold-line);
}

.main-tab {
  position: relative;
  padding: 14px 13px 13px;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.main-tab::after {
  position: absolute;
  right: 13px;
  bottom: -1px;
  left: 13px;
  height: 2px;
  background: transparent;
  content: "";
}

.main-tab.is-active {
  color: var(--gold-bright);
}

.main-tab.is-active::after {
  background: var(--gold);
  box-shadow: 0 0 16px rgba(226, 185, 91, 0.42);
}

main {
  padding: 22px;
}

.page-panel {
  min-width: 0;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 17px;
}

.eyebrow,
.metric-caption {
  display: block;
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
  font-weight: 560;
  letter-spacing: -0.035em;
}

h2 {
  font-size: 16px;
  line-height: 1.3;
  font-weight: 580;
}

.page-heading p,
.surface-heading p,
.learning-hero p,
.locked-hero p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.mode-tabs,
.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--control-line);
  border-radius: 11px;
}

.mode-tab,
.segment {
  padding: 7px 11px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.mode-tab.is-active,
.segment.is-active {
  color: var(--gold-bright);
  background: var(--gold-faint);
  box-shadow: inset 0 0 0 1px rgba(226, 185, 91, 0.16);
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.segment {
  padding: 5px 10px;
  font-size: 12px;
}

.notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
}

.notice-warning {
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid rgba(239, 184, 101, 0.24);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.kpi-card,
.surface,
.learning-hero {
  min-width: 0;
  background:
    linear-gradient(145deg, rgba(98, 136, 164, 0.045), transparent 46%),
    var(--surface);
  border: 1px solid var(--gold-line);
  border-radius: 14px;
}

.kpi-card {
  position: relative;
  overflow: hidden;
  padding: 14px 15px;
}

.kpi-card::before {
  position: absolute;
  top: 0;
  left: 15px;
  width: 36px;
  height: 1px;
  background: var(--gold);
  content: "";
}

.kpi-card > span,
.kpi-card > small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.kpi-card > strong {
  display: block;
  min-height: 26px;
  margin: 5px 0 3px;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 590;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.value-positive {
  color: var(--positive) !important;
}

.value-negative {
  color: var(--negative) !important;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(270px, 0.72fr);
  gap: 10px;
  margin-bottom: 10px;
}

.surface {
  padding: 15px;
}

.surface-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.data-badge {
  color: var(--gold-bright);
  background: var(--gold-faint);
}

.learning-state {
  color: var(--info);
  background: var(--info-soft);
}

.data-badge-warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.lock-state {
  color: var(--locked);
  background: var(--locked-soft);
}

.chart-wrap {
  position: relative;
  min-height: 250px;
}

.fill-chart {
  display: block;
  width: 100%;
  height: 250px;
  overflow: visible;
}

.chart-grid-line {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.chart-axis-text {
  fill: var(--muted);
  font-size: 11px;
}

.chart-bar-buy {
  fill: var(--gold);
}

.chart-bar-sell {
  fill: var(--steel);
}

.chart-zero-line {
  stroke: rgba(98, 136, 164, 0.46);
  stroke-width: 1;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-mark {
  width: 13px;
  height: 5px;
  border-radius: 2px;
}

.legend-buy {
  background: var(--gold);
}

.legend-sell {
  background: var(--steel);
}

.fact-list {
  margin: 0;
}

.fact-list > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}

.fact-list dt {
  color: var(--muted);
}

.fact-list dd {
  margin: 0;
  text-align: right;
}

.skip-summary {
  margin-top: 13px;
  padding: 11px;
  background: var(--surface-soft);
  border-radius: 10px;
}

.skip-summary > span {
  color: var(--muted);
  font-size: 11px;
}

.skip-summary ul,
.readiness-surface ul,
.future-list {
  margin: 8px 0 0;
  padding-left: 17px;
}

.skip-summary li,
.readiness-surface li,
.future-list li {
  margin: 4px 0;
}

.table-surface {
  margin-top: 0;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  padding: 10px 9px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-soft);
}

th {
  color: var(--gold-muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-empty {
  height: 70px;
  color: var(--muted);
  text-align: center;
}

.action-pill,
.candidate-pill {
  display: inline-flex;
  padding: 3px 7px;
  color: var(--gold-bright);
  background: var(--gold-faint);
  border-radius: 999px;
  font-size: 10px;
}

.action-pill.is-sell {
  color: var(--muted);
  background: var(--steel-soft);
}

.locked-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 17px;
  margin-bottom: 10px;
  padding: 19px;
  background:
    linear-gradient(115deg, rgba(98, 136, 164, 0.16), transparent 60%),
    var(--surface);
  border: 1px solid rgba(98, 136, 164, 0.34);
  border-radius: 14px;
}

.locked-hero h2 {
  font-size: 20px;
}

.lock-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--locked);
  background: var(--locked-soft);
  border: 1px solid #607589;
  border-radius: 13px;
  font-size: 24px;
}

.live-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(270px, 0.65fr);
  gap: 10px;
}

.gate-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.gate-list li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}

.gate-list li:last-child {
  border-bottom: 0;
}

.gate-list > li > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--gold-muted);
  background: var(--surface-soft);
  border-radius: 8px;
  font-size: 10px;
}

.gate-list strong,
.gate-list small {
  display: block;
}

.gate-list strong {
  font-weight: 560;
}

.gate-list small,
.gate-list em {
  color: var(--muted);
  font-size: 11px;
}

.gate-list em {
  font-style: normal;
}

.future-list {
  padding-left: 20px;
  color: var(--muted);
}

.future-list li::marker,
.readiness-surface li::marker,
.skip-summary li::marker {
  color: var(--gold);
}

.no-data-box {
  margin-top: 15px;
  padding: 14px;
  color: var(--muted);
  text-align: center;
  background: var(--surface-soft);
  border-radius: 10px;
}

.learning-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  gap: 24px;
  margin-bottom: 10px;
  padding: 17px;
}

.learning-hero > div:first-child > strong {
  display: block;
  font-size: 18px;
  font-weight: 580;
}

progress {
  display: block;
  width: 100%;
  height: 8px;
  margin: 13px 0 7px;
  overflow: hidden;
  accent-color: var(--gold);
  background: var(--surface-soft);
  border: 0;
  border-radius: 999px;
}

progress::-webkit-progress-bar {
  background: var(--surface-soft);
  border-radius: 999px;
}

progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--steel), var(--gold-bright));
  border-radius: 999px;
}

progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--steel), var(--gold-bright));
  border-radius: 999px;
}

.learning-hero > div > small {
  color: var(--muted);
}

.learning-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: 10px;
}

.learning-metrics > span {
  min-width: 0;
  padding-left: 11px;
  border-left: 1px solid var(--gold-line);
}

.learning-metrics small,
.learning-metrics strong {
  display: block;
}

.learning-metrics small {
  color: var(--muted);
  font-size: 10px;
}

.learning-metrics strong {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 580;
  font-variant-numeric: tabular-nums;
}

.learning-flow-surface {
  margin-bottom: 10px;
}

.learning-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.learning-flow li {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 0 8px;
  color: var(--muted);
  text-align: center;
}

.learning-flow li:not(:last-child)::after {
  position: absolute;
  z-index: 0;
  top: 15px;
  right: -50%;
  width: 100%;
  height: 1px;
  background: var(--gold-line);
  content: "";
}

.learning-flow li > span {
  position: relative;
  z-index: 1;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--gold-line);
  border-radius: 50%;
  font-size: 11px;
}

.learning-flow li.is-complete,
.learning-flow li.is-active {
  color: var(--text);
}

.learning-flow li.is-complete > span,
.learning-flow li.is-active > span {
  color: #071019;
  background: var(--gold);
}

.learning-flow li.is-active > span {
  box-shadow: 0 0 0 5px var(--gold-faint);
}

.learning-flow li.is-complete:not(:last-child)::after {
  background: var(--gold);
}

.learning-flow strong {
  font-weight: 560;
}

.learning-flow small {
  color: var(--muted);
  font-size: 10px;
}

.learning-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: 10px;
  margin-bottom: 10px;
}

.readiness-surface ul {
  color: var(--muted);
}

.honesty-note {
  margin-top: 10px;
  padding: 12px 14px;
  color: var(--muted);
  background: var(--info-soft);
  border-left: 2px solid var(--info);
  border-radius: 2px 10px 10px 2px;
}

.honesty-note strong {
  color: var(--info);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 22px;
  color: var(--gold-muted);
  background: var(--bg-raised);
  border-top: 1px solid var(--gold-line);
  font-size: 11px;
}

.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;
}

noscript {
  display: block;
  max-width: 720px;
  margin: 20px auto;
  padding: 14px;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid rgba(239, 184, 101, 0.28);
  border-radius: 10px;
}

@media (max-width: 980px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .live-grid,
  .learning-grid,
  .learning-hero {
    grid-template-columns: 1fr;
  }

  .learning-metrics {
    padding-top: 14px;
    border-top: 1px solid var(--gold-line);
  }
}

@media (max-width: 700px) {
  body {
    padding: 0;
  }

  .app-shell {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .topbar,
  .page-heading,
  .filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .system-line {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .main-tabs,
  main,
  footer {
    padding-right: 14px;
    padding-left: 14px;
  }

  .mode-tabs,
  .segmented {
    align-self: flex-start;
  }

  .locked-hero {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .lock-state {
    grid-column: 2;
  }

  .learning-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .learning-flow {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .learning-flow li {
    grid-template-columns: 30px minmax(0, 1fr);
    justify-items: start;
    align-items: center;
    text-align: left;
  }

  .learning-flow li:not(:last-child)::after {
    top: 30px;
    right: auto;
    bottom: -9px;
    left: 14px;
    width: 1px;
    height: auto;
  }

  .learning-flow small {
    grid-column: 2;
  }
}

@media (max-width: 460px) {
  .topbar {
    padding: 14px;
  }

  h1 {
    font-size: 25px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .kpi-card > strong {
    font-size: 19px;
  }

  .surface-heading {
    flex-direction: column;
  }

  .chart-wrap,
  .fill-chart {
    min-height: 220px;
    height: 220px;
  }

  .locked-hero {
    grid-template-columns: 1fr;
  }

  .lock-state {
    grid-column: auto;
  }

  .gate-list li {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .gate-list em {
    grid-column: 2;
  }

  .learning-metrics {
    grid-template-columns: 1fr;
  }

  .learning-metrics > span {
    padding: 7px 0 0;
    border-top: 1px solid var(--gold-line);
    border-left: 0;
  }

  footer {
    flex-direction: column;
  }
}
