:root {
  color-scheme: light;
  font: 16px/1.5 Helvetica, "Helvetica Neue", Arial, sans-serif;
  color: #152548;
  background: #fff;
  --line: #d9e2f2;
  --accent: #245bd5;
  --muted: #53617a;
  --navy: #101f52;
  --teal: #006381;
  --violet: #5639bd;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 1rem; }
body { margin: 0; }
a { color: var(--accent); text-underline-offset: 4px; }
header, footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem max(1.25rem, calc((100% - 92rem) / 2)); }
header { border-bottom: 1px solid var(--line); background: white; }
header a { color: var(--navy); font-weight: 750; font-size: 1.15rem; text-decoration: none; }
header span, footer { color: var(--muted); font-size: .8rem; }
header a:last-child { font-size: .85rem; font-weight: 600; }
main { position: relative; isolation: isolate; max-width: 94rem; margin: auto; padding: 1.5rem 1.25rem 2.5rem; }
.intro { position: relative; overflow: hidden; padding: clamp(1.5rem, 3.2vw, 3rem); border-radius: 1.1rem; background: linear-gradient(112deg, #101f52 0%, #2347a0 65%, #075879 100%); color: white; margin-bottom: 1.6rem; }
.intro > :not(.intro-art) { position: relative; z-index: 1; max-width: 48rem; }
.intro .eyebrow { color: #b9d7ff; font-size: .78rem; font-weight: 650; margin-bottom: .75rem; }
.intro h1 { color: white; font-size: clamp(2.4rem, 5vw, 4.4rem); letter-spacing: -.055em; line-height: 1.06; font-weight: 700; margin-bottom: .7rem; }
.intro .subtitle { color: #d2e6ff; font-size: clamp(1rem, 1.6vw, 1.3rem); font-weight: 550; }
.intro p { max-width: 62ch; color: #f0f5ff; font-size: .98rem; }
.intro .credit { font-size: .8rem; color: #c6daf7; margin-top: 1.15rem; margin-bottom: 0; }
.intro-art { position: absolute; right: -1rem; bottom: -1rem; width: 34%; max-width: 24rem; min-width: 15rem; opacity: .2; pointer-events: none; }
h1, h2, h3, p { margin: 0 0 .75rem; }
h2 { font-size: 1.08rem; letter-spacing: -.02em; }
h3 { font-size: 1rem; margin-top: .3rem; }
.credit, .sample { color: var(--muted); font-size: .82rem; }
.workspace { display: grid; grid-template-columns: minmax(19rem, 23rem) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.tool-tabs { display: flex; gap: .45rem; padding: .4rem; margin-bottom: 1.25rem; border: 1px solid var(--line); border-radius: .75rem; background: #f5f8ff; }
.tool-tabs button { flex: 1; background: transparent; color: var(--muted); min-height: 2.85rem; }
.tool-tabs button[aria-selected=true] { color: white; background: var(--accent); box-shadow: 0 3px 10px #101f5215; }
.tool-tabs button[aria-selected=false]:hover { color: var(--navy); background: #e7eefc; }
.calculation { margin: 1rem 0; padding: 1rem; background: white; border: 1px solid var(--line); border-radius: .6rem; }
.calculation code { display: block; white-space: normal; overflow-wrap: anywhere; font: inherit; font-size: .8rem; line-height: 1.7; margin: .65rem 0; }
.calculation p { margin: .65rem 0 0; color: var(--muted); font-size: .8rem; }
form, .result, .method { min-width: 0; border: 1px solid var(--line); background: white; padding: clamp(1rem, 1.8vw, 1.6rem); border-radius: .9rem; }
form { border-top: 3px solid var(--accent); box-shadow: 0 8px 28px #101f5207; }
.result { background: #f8faff; border-color: #e4eaf5; }
label { display: block; font-size: .77rem; margin-bottom: .8rem; font-weight: 600; min-width: 0; color: #354663; }
input, select, textarea { width: 100%; min-width: 0; min-height: 2.85rem; padding: .6rem .65rem; margin-top: .3rem; border: 1px solid #becce3; border-radius: .45rem; background: #fcfdff; color: #152548; font: inherit; font-size: 1rem; box-shadow: inset 0 1px 2px #101f5204; }
input:hover, select:hover, textarea:hover { border-color: #7695cc; }
input:focus, select:focus, textarea:focus { background: white; }
input[type=date] { appearance: none; -webkit-appearance: none; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .8rem; }
fieldset { border: 0; padding: 0; margin: .5rem 0 0; min-width: 0; }
legend { padding: 0; margin: .35rem 0 .7rem; font-weight: 700; font-size: .86rem; color: var(--navy); }
button { border: 1px solid transparent; border-radius: .5rem; min-height: 2.85rem; padding: .6rem 1rem; color: white; background: var(--accent); font: inherit; font-size: .85rem; font-weight: 650; cursor: pointer; }
button:hover:not(:disabled) { background: #1848b5; }
button.secondary { color: #234b91; background: white; border-color: #bdcce5; }
button.secondary:hover:not(:disabled) { background: #edf3ff; }
button:disabled { color: var(--muted); opacity: .6; cursor: default; }
:focus-visible { outline: 3px solid #13a3d2; outline-offset: 3px; }
.actions, .result-heading { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.result-heading { justify-content: space-between; margin-bottom: .75rem; }
.result-heading h2 { margin: 0; }
.actions { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: .4rem; }
.actions button:first-child { flex: 1; }
.method { margin-top: 1.5rem; }
summary { cursor: pointer; font-weight: 650; font-size: .85rem; padding: .45rem 0; color: #234b91; }
details p { color: var(--muted); font-size: .82rem; }
#error { color: #9b2131; background: #fff0f2; border-radius: .5rem; padding: .8rem; font-size: .9rem; }
#error:empty, [hidden] { display: none !important; }
#status { font-size: .8rem; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin: .8rem 0 1rem; }
.metric { min-width: 0; padding: .75rem; background: white; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: .6rem; }
.metric:nth-child(2) { border-top-color: var(--teal); }
.metric:nth-child(3) { border-top-color: #414ab8; }
.metric:nth-child(4) { border-top-color: var(--violet); }
.metric span, .metric small { display: block; color: var(--muted); }
.metric span { font-size: .75rem; font-weight: 600; margin-bottom: .4rem; }
.metric strong { display: block; color: var(--navy); font-size: clamp(1.1rem, 1.6vw, 1.55rem); letter-spacing: -.025em; overflow-wrap: anywhere; line-height: 1.2; }
.metric small { font-size: .72rem; margin-top: .4rem; }
figure { margin: .85rem 0; padding: .75rem; background: white; border: 1px solid var(--line); border-radius: .7rem; }
figure .plot { width: 100%; height: auto; display: block; margin-top: .35rem; }
figcaption { font-size: .76rem; color: var(--muted); }
figcaption strong { display: inline-block; color: var(--navy); font-size: .9rem; margin-bottom: .25rem; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.chart-legend > span { display: inline-flex; align-items: center; gap: .4rem; }
.legend-swatch { display: block; flex: 0 0 32px; width: 32px; height: 10px; }
.chart-credit { margin: .15rem 0 0; text-align: right; font-size: .65rem; color: var(--muted); }
.breakeven-note { font-size: .78rem; color: var(--muted); margin: .8rem .15rem; }
.breakeven-note strong { color: var(--navy); }
.live-hint { margin-top: .7rem; }
#output.updating { opacity: .55; }
.table { overflow: auto; margin-bottom: 1.3rem; border: 1px solid var(--line); border-radius: .6rem; background: white; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .78rem; }
th, td { padding: .7rem .75rem; border-bottom: 1px solid #e5ebf5; text-align: right; white-space: nowrap; }
thead th { background: #eaf0fc; color: #233e73; font-size: .72rem; }
th:first-child, td:first-child { text-align: left; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover { background: #f4f7ff; }
.bridge th { text-align: left; font-weight: 500; white-space: normal; }
.bridge td { text-align: right; }
.sensitivity th:first-child { position: sticky; left: 0; z-index: 1; background: #edf3ff; }
.sensitivity [data-sign=positive] { background: #e7f3f7; color: #07586e; }
.sensitivity [data-sign=negative] { background: #f2edfc; color: #553592; }
.sensitivity [data-base] { box-shadow: inset 0 0 0 2px var(--accent); font-weight: 750; }
footer { border-top: 1px solid var(--line); flex-wrap: wrap; }
.watermark { position: absolute; z-index: -1; inset: auto 1.25rem .4rem auto; color: #2347a010; font-size: clamp(2.5rem, 8vw, 7rem); font-weight: 750; letter-spacing: -.06em; user-select: none; pointer-events: none; }
@media (min-width: 1100px) { .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 851px) and (max-height: 900px) {
  .result { padding: 1rem; }
  .result-heading { margin-bottom: .45rem; }
  .calculation { padding: .6rem .8rem; margin: .7rem 0; }
}
@media (max-width: 850px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .intro-art { opacity: .12; }
  .intro { margin-bottom: 1rem; }
}
@media (max-width: 480px) {
  header { padding: .8rem 1rem; }
  header span { display: none; }
  main { padding: 1rem .85rem 2.5rem; }
  .intro { border-radius: .8rem; padding: 1.45rem 1.2rem; }
  .intro h1 { font-size: 2.5rem; }
  .intro p { font-size: .9rem; }
  .intro .credit { font-size: .74rem; }
  form, .result { padding: 1rem; }
  .result-heading { align-items: start; }
  .metric { padding: .75rem; }
  .metric strong { font-size: 1.15rem; }
  figure { padding: .75rem; }
}
@media (prefers-reduced-motion: no-preference) {
  button, input, select { transition: background-color .15s, border-color .15s; }
}
@media print {
  header, form, .tool-tabs, .result-heading button, .method, .watermark { display: none; }
  .workspace { display: block; }
  .intro { background: white; color: black; padding: 0; }
  .intro h1, .intro p { color: black; }
  .intro-art { display: none; }
  .result { background: white; border: 0; }
  figure { break-inside: avoid; }
}

