:root {
  --bg: #070912;
  --bg2: #0d1020;
  --panel: rgba(18, 22, 42, .86);
  --panel-solid: #11162b;
  --card: rgba(255,255,255,.065);
  --card-strong: rgba(255,255,255,.105);
  --line: rgba(255,255,255,.12);
  --line-strong: rgba(255,255,255,.22);
  --text: #f4f7ff;
  --muted: #a9b3c8;
  --faint: #758096;
  --purple: #8b5cf6;
  --purple2: #7132f5;
  --cyan: #5ee7ff;
  --green: #49e28e;
  --green2: #0fcf7a;
  --amber: #ffd166;
  --red: #ff6b7a;
  --orange: #ff9f43;
  --blue: #6aa7ff;
  --shadow: 0 24px 90px rgba(0,0,0,.38);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% -10%, rgba(113,50,245,.38), transparent 26rem),
    radial-gradient(circle at 88% 2%, rgba(94,231,255,.18), transparent 28rem),
    radial-gradient(circle at 50% 115%, rgba(73,226,142,.10), transparent 30rem),
    linear-gradient(180deg, var(--bg), #090d19 42%, #060814 100%);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: #9eeaff; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
code { color: #d4c8ff; }
.shell { width: min(1440px, calc(100% - 40px)); margin: 0 auto; }
.hero { padding: 22px 0 28px; }
.topnav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 58px;
}
.topnav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  color: var(--muted);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.topnav a:hover { color: var(--text); background: rgba(255,255,255,.08); text-decoration: none; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr);
  gap: 28px;
  align-items: stretch;
}
.hero-copy, .verdict-card, .panel, .decision-card, .card, .chart-card, .controls, .step-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hero-copy {
  min-height: 540px;
  padding: clamp(32px, 6vw, 68px);
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.10), rgba(255,255,255,.035)),
    linear-gradient(160deg, rgba(113,50,245,.25), rgba(14,18,34,.70) 45%, rgba(14,18,34,.95));
  overflow: hidden;
  position: relative;
}
.hero-copy::after {
  content: "";
  position: absolute;
  inset: auto -12% -35% 35%;
  height: 330px;
  background: radial-gradient(circle, rgba(94,231,255,.26), transparent 58%);
  pointer-events: none;
}
.eyebrow {
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 12px;
  font-weight: 900;
  margin: 0 0 12px;
}
h1, h2, h3, p { text-wrap: pretty; }
h1 {
  margin: 0;
  max-width: 980px;
  font-size: clamp(44px, 7.1vw, 96px);
  line-height: .91;
  letter-spacing: -.07em;
}
.lede {
  max-width: 850px;
  color: #cbd5e8;
  font-size: clamp(17px, 1.8vw, 22px);
  margin: 28px 0 0;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; position: relative; z-index: 1; }
.primary, .secondary, .tab {
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  min-height: 46px;
  color: #071019;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 16px 42px rgba(94,231,255,.22);
}
.secondary, .tab {
  color: var(--text);
  background: rgba(255,255,255,.07);
  border: 1px solid var(--line);
  box-shadow: none;
}
.primary:hover, .secondary:hover, .tab:hover { transform: translateY(-1px); }
.verdict-card {
  border-radius: 34px;
  padding: 32px;
  background:
    linear-gradient(180deg, rgba(113,50,245,.16), rgba(255,255,255,.04)),
    rgba(12,16,31,.92);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.badge, .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(73,226,142,.30);
  background: rgba(73,226,142,.13);
  color: var(--green);
  font-size: 12px;
  line-height: 1.1;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge.warn { color: var(--amber); background: rgba(255,209,102,.13); border-color: rgba(255,209,102,.32); }
.badge.bad { color: var(--red); background: rgba(255,107,122,.13); border-color: rgba(255,107,122,.32); }
.badge.neutral { color: var(--muted); background: rgba(255,255,255,.07); border-color: var(--line); }
.verdict-card h2 { font-size: clamp(30px, 4vw, 54px); line-height: 1; margin: 22px 0 14px; letter-spacing: -.045em; }
.verdict-card p { color: #cad4e8; font-size: 16px; }
.mini-ledger { display: grid; gap: 10px; margin-top: 20px; }
.ledger-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.ledger-row b { color: var(--text); text-align: right; }
.decision-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 22px 0; }
.decision-card {
  border-radius: 22px;
  padding: 20px;
  background: rgba(255,255,255,.055);
  min-height: 142px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
}
.decision-card::after { content: ""; position: absolute; inset: auto -30% -70% 35%; height: 140px; background: radial-gradient(circle, rgba(255,255,255,.20), transparent 64%); }
.decision-card span { color: var(--muted); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.decision-card b { font-size: clamp(30px, 3.8vw, 50px); line-height: 1; letter-spacing: -.045em; }
.decision-card small { color: var(--muted); position: relative; z-index: 1; }
.decision-card.green { background: linear-gradient(135deg, rgba(73,226,142,.22), rgba(255,255,255,.055)); }
.decision-card.blue { background: linear-gradient(135deg, rgba(94,231,255,.20), rgba(255,255,255,.055)); }
.decision-card.purple { background: linear-gradient(135deg, rgba(139,92,246,.24), rgba(255,255,255,.055)); }
.decision-card.amber { background: linear-gradient(135deg, rgba(255,209,102,.20), rgba(255,255,255,.055)); }
.panel {
  margin: 22px 0;
  padding: clamp(20px, 3vw, 34px);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.035));
  backdrop-filter: blur(18px);
}
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
.section-head h2 { margin: 0; font-size: clamp(28px, 4vw, 52px); line-height: 1; letter-spacing: -.052em; }
.meta { color: var(--muted); margin: 8px 0 0; max-width: 560px; text-align: right; }
.calculator-layout, .two-col, .runbook-grid { display: grid; gap: 18px; }
.calculator-layout { grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); align-items: start; }
.two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 18px; }
.two-col.wide-left { grid-template-columns: minmax(0, 1.45fr) minmax(330px, .55fr); }
.controls, .card, .chart-card, .step-card {
  border-radius: var(--radius);
  background: rgba(8, 12, 25, .58);
  padding: 20px;
}
.controls { display: grid; gap: 18px; position: sticky; top: 18px; }
.controls label, .frontier-control label, .search { display: grid; gap: 8px; color: var(--muted); font-weight: 800; font-size: 13px; }
.controls output, .frontier-control output { color: var(--text); font-weight: 900; }
select, input[type="search"] {
  width: 100%;
  min-height: 44px;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.08);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}
select option { background: #10162b; color: var(--text); }
input[type="range"] { width: 100%; accent-color: var(--purple); }
.search { width: min(360px, 100%); }
.formula-box {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(113,50,245,.14);
  border: 1px solid rgba(139,92,246,.32);
}
.formula-box code { display: block; font-size: 12px; white-space: normal; }
.small { color: var(--muted); font-size: 13px; margin: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 20px;
  padding: 16px;
  background: rgba(255,255,255,.065);
  border: 1px solid var(--line);
}
.kpi .value { font-size: clamp(24px, 2.9vw, 38px); line-height: 1; font-weight: 900; letter-spacing: -.045em; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.kpi.good .value { color: var(--green); }
.kpi.warn .value { color: var(--amber); }
.kpi.bad .value { color: var(--red); }
.kpi.blue .value { color: var(--cyan); }
.card h3, .chart-card h3, .step-card h3 { margin: 0 0 10px; font-size: 20px; letter-spacing: -.02em; }
.card p, .chart-card p, .step-card p { color: #cbd5e8; }
.callout { background: linear-gradient(135deg, rgba(73,226,142,.13), rgba(255,255,255,.045)); border-color: rgba(73,226,142,.26); }
.warning { background: linear-gradient(135deg, rgba(255,209,102,.12), rgba(255,255,255,.04)); border-color: rgba(255,209,102,.28); }
.chart-card { overflow: hidden; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.chart-head p { color: var(--muted); margin: 0; }
svg { width: 100%; height: auto; display: block; overflow: visible; }
.axis, .chart-label { fill: var(--muted); font-size: 12px; font-weight: 700; }
.chart-title { fill: var(--text); font-size: 13px; font-weight: 800; }
.grid-line { stroke: rgba(255,255,255,.09); stroke-width: 1; }
.bar-gross { fill: rgba(94,231,255,.74); }
.bar-net { fill: rgba(73,226,142,.78); }
.bar-loss { fill: rgba(255,107,122,.74); }
.bar-muted { fill: rgba(255,255,255,.18); }
.line-green { stroke: var(--green); }
.line-blue { stroke: var(--cyan); }
.dot { stroke: rgba(255,255,255,.65); stroke-width: 1; }
.table-wrap { overflow: auto; border-radius: 16px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.08); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; z-index: 1; background: #11172d; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
td { color: #d8e1f2; font-size: 14px; }
tr:hover td { background: rgba(255,255,255,.035); }
.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.status-chip.good { color: var(--green); background: rgba(73,226,142,.12); }
.status-chip.warn { color: var(--amber); background: rgba(255,209,102,.13); }
.status-chip.bad { color: var(--red); background: rgba(255,107,122,.13); }
.status-chip.muted { color: var(--muted); background: rgba(255,255,255,.08); }
.tight-list { margin: 12px 0 0; padding-left: 18px; color: #cbd5e8; }
.tight-list li + li { margin-top: 8px; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-title-row h3 { margin: 0; }
.frontier-control { margin: 10px 0 14px; }
.tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.tab { min-height: 40px; padding: 9px 14px; }
.tab.active { color: #071019; background: linear-gradient(135deg, var(--cyan), var(--green)); border-color: transparent; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.plain-note {
  padding: 16px;
  border-radius: 18px;
  background: rgba(94,231,255,.09);
  border: 1px solid rgba(94,231,255,.22);
  color: #d8f6ff;
  margin-bottom: 14px;
}
.subhead { margin: 24px 0 12px; }
.runbook-grid { grid-template-columns: repeat(3, 1fr); }
.step-card b {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: #071019;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  margin-bottom: 16px;
}
.message-template {
  white-space: pre-wrap;
  margin: 0;
  color: #d8e1f2;
  background: rgba(0,0,0,.20);
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 16px;
  font-size: 13px;
}
.footer { color: var(--muted); padding: 30px 0 60px; }
.footer code { color: var(--text); }

@media (max-width: 1100px) {
  .hero-grid, .calculator-layout, .two-col, .two-col.wide-left { grid-template-columns: 1fr; }
  .decision-strip, .kpi-grid, .kpi-grid.compact { grid-template-columns: repeat(2, 1fr); }
  .controls { position: static; }
  .meta { text-align: left; }
  .runbook-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .shell { width: min(100% - 24px, 1440px); }
  .topnav { justify-content: flex-start; margin-bottom: 22px; }
  .hero-copy { min-height: auto; padding: 26px; border-radius: 24px; }
  .verdict-card, .panel { border-radius: 24px; }
  .decision-strip, .kpi-grid, .kpi-grid.compact, .runbook-grid { grid-template-columns: 1fr; }
  .section-head { display: block; }
  .search { width: 100%; margin-top: 12px; }
  table { min-width: 700px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .primary:hover, .secondary:hover, .tab:hover { transform: none; }
}
