:root {
  --navy: #0B1730; --gold: #E6CF9A; --ivory: #F5F3EE; --line: #E2DED4; --slate: #3A5688; --pale: #B9C7E3;
  --ink: #0E0F0C; --muted: #454745; --red: #A8200D; --yellow: #FFEB69;
  --display: Archivo, "Arial Narrow", sans-serif; --body: Inter, system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ivory); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
a { color: var(--navy); }
.d { font-family: var(--display); font-stretch: 68%; font-weight: 900; text-transform: uppercase; line-height: .9; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
:focus-visible { outline: 3px solid var(--slate); outline-offset: 2px; }

/* shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--navy); color: #fff; padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; color: #fff; text-decoration: none; padding: 6px 12px 22px; }
.logo svg { color: var(--gold); }
.side a.nav { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 24px; color: #fff; text-decoration: none; font-weight: 600; }
.side a.nav:hover { background: rgba(255, 255, 255, .1); }
.side a.nav[aria-current] { background: var(--gold); color: var(--navy); }
.side .foot { margin-top: auto; font-size: 12px; color: rgba(255, 255, 255, .72); padding: 12px; }
main { padding: clamp(20px, 4vw, 48px); max-width: 1180px; width: 100%; }
.tabs { display: none; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.title { font-size: clamp(44px, 6vw, 76px); }
.sub { color: var(--muted); max-width: 640px; margin-top: 10px; }

/* building blocks */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c12 { grid-column: 1 / -1; }
.card { background: #fff; border-radius: 28px; padding: clamp(20px, 2.4vw, 30px); display: flex; flex-direction: column; gap: 12px; }
.card.gold { background: var(--gold); color: var(--navy); }
.card.navy { background: var(--navy); color: #fff; }
.card.red { background: var(--red); color: #fff; }
.card.line { background: transparent; border: 2px solid var(--navy); }
.card.warn { background: var(--yellow); color: #3A341C; }
.label { font-size: 14px; font-weight: 700; }
.mega { font-size: clamp(64px, 8vw, 120px); }
.big { font-size: clamp(40px, 4.4vw, 64px); }
.mid { font-size: 30px; }
.split { display: flex; flex-wrap: wrap; gap: 12px 28px; padding-top: 14px; border-top: 1px solid currentColor; margin-top: auto; }
.split div { display: flex; flex-direction: column; font-size: 13px; font-weight: 500; }
.split b { font-size: 20px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span small { display: block; color: var(--muted); font-size: 13px; }
.kv b { white-space: nowrap; }
.navy .kv { border-color: rgba(255, 255, 255, .16); }
.track { position: relative; height: 14px; border-radius: 7px; background: var(--line); }
.track i { display: block; height: 100%; border-radius: 7px; background: var(--navy); max-width: 100%; transition: width .6s var(--ease); }
.track em { position: absolute; top: -4px; width: 2px; height: 22px; background: var(--gold); }
.navy .track { background: rgba(255, 255, 255, .16); }
.ticks { position: relative; height: 18px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ticks span { position: absolute; transform: translateX(-50%); }
.fall { display: flex; flex-direction: column; gap: 14px; }
.fall div.row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-weight: 600; }
.fall .track { grid-column: 1 / -1; background: var(--ivory); }
.chip { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border-radius: 15px; font-size: 13px; font-weight: 700; background: var(--ivory); white-space: nowrap; }
.chip.pass { background: var(--navy); color: var(--gold); } .chip.caution { background: var(--yellow); color: #3A341C; } .chip.fail { background: var(--red); color: #fff; }
.erc { display: flex; align-items: flex-end; gap: 8px; height: 110px; }
.erc div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; font-size: 12px; font-weight: 600; }
.erc i { width: 100%; border-radius: 8px 8px 0 0; background: rgba(255, 255, 255, .25); min-height: 3px; }
.erc div:first-child i { background: var(--gold); }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 24px; border: 0; background: var(--gold); color: var(--navy); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .2s var(--ease); }
.btn:hover { transform: translateY(-1px); }
.btn.dark { background: var(--navy); color: var(--gold); }
.btn.ghost { background: transparent; border: 2px solid var(--navy); }
.btn.quiet { background: #fff; }
.btn.danger { background: transparent; color: var(--red); text-decoration: underline; padding: 0 6px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 28px; background: #fff; }
.seg button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 22px; background: transparent; color: var(--navy); font: inherit; font-weight: 700; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--gold); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field small { font-size: 12px; color: var(--muted); }
.in { display: flex; align-items: center; height: 52px; border-radius: 12px; border: 1px solid #868685; background: #fff; overflow: hidden; }
.in:focus-within { border-color: var(--navy); box-shadow: 0 0 0 2px var(--navy); }
.in span { padding: 0 0 0 14px; font-weight: 600; color: var(--muted); }
.in input, .in select { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; padding: 0 14px; font: inherit; font-size: 17px; font-weight: 600; color: var(--ink); outline: none; }
.in span + input { padding-left: 6px; }
.in .suf { padding: 0 14px 0 0; }
.slider { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; }
.slider label, .slider output { font-weight: 700; }
.slider input { grid-column: 1 / -1; width: 100%; height: 44px; margin: 0; accent-color: var(--navy); }
.slider .ends { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* tables + chart */
.matrix { width: 100%; border-collapse: collapse; }
.matrix th, .matrix td { text-align: left; padding: 16px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.matrix th { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.matrix td b { font-family: var(--display); font-stretch: 68%; font-weight: 900; font-size: 28px; display: block; }
.matrix td.win b::after { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); border: 2px solid var(--navy); margin-left: 8px; vertical-align: middle; }
.matrix td small { color: var(--muted); }
.scroll { overflow-x: auto; }
svg.chart { width: 100%; height: auto; overflow: visible; }
svg.chart text { font-family: var(--body); font-size: 13px; font-weight: 600; fill: var(--muted); }
svg.chart .g { stroke: var(--line); stroke-width: 1; }
svg.chart path { fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.branch { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; text-decoration: none; color: inherit; }
.branch strong { display: block; font-size: 17px; }
.ring { position: relative; width: 132px; flex: none; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 46px; }

/* setup */
.setup { max-width: 760px; margin: 0 auto; padding: clamp(20px, 5vw, 56px) clamp(16px, 4vw, 32px) 80px; display: flex; flex-direction: column; gap: 22px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.steps i { height: 6px; border-radius: 3px; background: var(--line); }
.steps i.on { background: var(--navy); }
.income { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.note { font-size: 13px; color: var(--muted); }

/* plans */
.side a.nav.pro { margin-top: 14px; justify-content: center; border: 2px solid var(--gold); color: var(--gold); }
.side a.nav.pro[aria-current], .side a.nav.pro:hover { background: var(--gold); color: var(--navy); }
.ticks-list { display: flex; flex-direction: column; gap: 8px; font-size: 15px; font-weight: 500; }
.ticks-list li { display: flex; gap: 10px; align-items: flex-start; }
.ticks-list svg { flex: none; margin-top: 2px; }
.plan { min-height: 440px; }
.paywall { gap: 16px; }

/* motion: page entrance, plus small always-on responses */
@keyframes up { from { opacity: 0; transform: translateY(24px); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes growY { from { transform: scaleY(0); } }
@keyframes draw { from { stroke-dashoffset: 1; } }
@keyframes ring { from { stroke-dashoffset: var(--s); } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
.enter .head, .enter .card, .enter .grid > p, .enter .grid > .row-btns, .enter.setup > * { animation: up .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
.enter .track i { transform-origin: left center; animation: grow 1s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms + 250ms); }
.enter .track em { animation: pop .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms + 900ms); }
.enter .erc i { transform-origin: bottom; animation: growY .9s var(--ease) both .45s; }
.enter svg.chart path, svg.chart.draw path { stroke-dasharray: 1; animation: draw 1.5s var(--ease) both .25s; }
.enter .ring .arc { animation: ring 1.3s var(--ease) both .45s; }
.enter .chip { animation: pop .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms + 450ms); }
.enter .steps i.on { transform-origin: left center; animation: grow .6s var(--ease) both; }
a.card, .card.plan { transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
a.card:hover, .card.plan:hover { transform: translateY(-4px); box-shadow: 0 18px 44px rgba(11, 23, 48, .14); }
.side a.nav { transition: background .25s, color .25s, transform .25s var(--ease); }
.side a.nav:active, .btn:active, .seg button:active { transform: scale(.97); }
.seg button { transition: background .25s, color .25s; }
#stress-out { transition: background .45s var(--ease), color .45s var(--ease); }
.in { transition: box-shadow .2s, border-color .2s; }
.tabs a { transition: background .25s, color .25s; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  main { padding-bottom: 110px; }
  .tabs { display: flex; position: fixed; inset: auto 0 0 0; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
  .tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 48px; justify-content: center; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; border-radius: 16px; }
  .tabs a[aria-current] { color: var(--navy); background: var(--gold); }
  .c4, .c5, .c6, .c7, .c8 { grid-column: 1 / -1; }
  .income { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
