:root {
  color-scheme: light;
  --page: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #f2f4f2;
  --text: #101a17;
  --text-2: #3f4b47;
  --muted: #66716d;
  --line: #e3e7e4;
  --line-strong: #cdd3cf;
  --brand: #0b5d4b;
  --brand-2: #0f7a62;
  --brand-hover: #084a3c;
  --brand-soft: #e6f2ee;
  --brand-ink: #ffffff;
  --link: #0b6b56;
  --hero-band: linear-gradient(180deg, #e9f3ef 0%, #f6f7f5 100%);
  --result-head: linear-gradient(135deg, #0b5d4b 0%, #0f7a62 100%);
  --footer: #0c1f1a;
  --footer-text: #c9d6d1;
  --hover-band: rgba(16, 26, 23, .04);
  --shadow-sm: 0 1px 2px rgba(16, 26, 23, .05);
  --shadow: 0 1px 2px rgba(16, 26, 23, .04), 0 8px 24px rgba(16, 26, 23, .06);
  /* chart series: validated categorical order (blue, orange, aqua, yellow, magenta) */
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --radius: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d1110;
    --surface: #161b19;
    --surface-2: #1c2220;
    --text: #eef2f0;
    --text-2: #c4ccc8;
    --muted: #93a09b;
    --line: #27302d;
    --line-strong: #36413d;
    --brand: #2fa383;
    --brand-2: #23866b;
    --brand-hover: #3db592;
    --brand-soft: #14302a;
    --link: #5cc6a6;
    --hero-band: linear-gradient(180deg, #11231e 0%, #0d1110 100%);
    --result-head: linear-gradient(135deg, #0e4d3f 0%, #116b56 100%);
    --footer: #080b0a;
    --footer-text: #a9b6b1;
    --hover-band: rgba(255, 255, 255, .05);
    --shadow-sm: none;
    --shadow: none;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 16px/1.65 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; color: var(--text); }
.muted { color: var(--muted); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 780px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 30; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; padding: 11px 18px;
  font: 600 15px/1 var(--font); text-decoration: none; border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--brand); color: var(--link); }

/* header */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 19px; letter-spacing: -.02em; color: var(--text); text-decoration: none; }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--text-2); text-decoration: none; white-space: nowrap; padding: 8px 12px; border-radius: 8px; font-size: 15px; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current] { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.nav .nav-all { border: 1px solid var(--line-strong); margin-left: 6px; color: var(--text); font-weight: 600; }
@media (max-width: 760px) {
  .top-inner { height: auto; flex-wrap: wrap; gap: 0; padding-top: 12px; }
  .nav { margin: 8px -12px 8px; width: calc(100% + 24px); }
}

/* page hero (calculator + info pages) */
.page-hero { background: var(--hero-band); border-bottom: 1px solid var(--line); padding: 20px 0 32px; }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--link); }
.title-row { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
.title-icon {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; flex: none;
  background: var(--surface); color: var(--brand); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.title-icon .icon { width: 26px; height: 26px; }
.page-hero h1 { font-size: clamp(28px, 4.4vw, 42px); font-weight: 750; margin: 0; }
.lede { color: var(--text-2); font-size: 18px; margin: 12px 0 0; max-width: 700px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 16px 0 0; padding: 0; list-style: none; font-size: 14px; color: var(--muted); }
.meta li { display: inline-flex; align-items: center; gap: 6px; }
.meta .icon { width: 16px; height: 16px; color: var(--brand-2); }

/* calculator layout */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.calc { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: -8px; }
.calc-section { padding-top: 28px; }
@media (max-width: 860px) { .calc { grid-template-columns: minmax(0, 1fr); } }
.calc-form { padding: 24px; }
.form-title { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 16px; }
.calc-results { overflow: hidden; position: sticky; top: 84px; }
@media (max-width: 860px) { .calc-results { position: static; } }

.field { margin-bottom: 16px; min-width: 0; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--text); }
.input {
  display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); overflow: hidden; transition: border-color .15s, box-shadow .15s;
}
.input:hover { border-color: var(--muted); }
.input:focus-within { border-color: var(--brand-2); box-shadow: 0 0 0 4px var(--brand-soft); }
.input input, .input select {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text);
  font: 500 17px/1.2 var(--font); padding: 12px 14px; font-variant-numeric: tabular-nums;
}
.input select {
  cursor: pointer; appearance: none; -webkit-appearance: none; padding-right: 38px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%2366716d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center;
}
.input select option { background: var(--surface); color: var(--text); }
.affix { color: var(--muted); padding: 0 14px; font-weight: 500; }
.affix:empty { display: none; }
.input .affix:first-child { padding-right: 0; }
.input input + .affix { padding-left: 0; }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 440px) { .pair { grid-template-columns: 1fr; gap: 0; } }
.more { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 16px; }
.more summary { cursor: pointer; font-weight: 650; margin-bottom: 14px; list-style: none; display: flex; align-items: center; gap: 8px; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
.more[open] summary::before { transform: rotate(45deg); }

/* results */
.result-head { background: var(--result-head); color: #fff; padding: 22px 24px 20px; }
.hero-label { margin: 0; font-weight: 550; font-size: 15px; opacity: .85; }
.hero-value { margin: 4px 0 0; font-size: clamp(38px, 5.6vw, 54px); font-weight: 750; letter-spacing: -.03em; line-height: 1.05; }
.hero-sub { margin: 6px 0 0; font-size: 14px; opacity: .8; }
.hero-sub:empty { display: none; }
.result-body { padding: 20px 24px 22px; }
.bar-chart { position: relative; margin-bottom: 12px; }
.bar-chart svg { display: block; }
.rows { margin: 0; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row dt { color: var(--text-2); display: flex; align-items: center; gap: 10px; min-width: 0; }
.row dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.row.strong dd { color: var(--link); }
.totals { margin-top: 14px; padding: 6px 16px; border-radius: 12px; background: var(--surface-2); }
.totals .row { border-color: var(--line); }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.savings { margin-top: 14px; padding: 12px 16px; border-radius: 12px; background: var(--brand-soft); }
.savings-title { margin: 0 0 2px; font-weight: 700; color: var(--link); }
.savings .row { border-color: transparent; padding: 4px 0; }
.savings.behind { background: #fdf1e7; }
.savings.behind .savings-title { color: #9a4a12; }
@media (prefers-color-scheme: dark) { .savings.behind { background: #33230f; } .savings.behind .savings-title { color: #f3b77e; } }
.note { margin: 14px 0 0; font-size: 14px; color: var(--text-2); display: flex; gap: 8px; }
.note:empty { display: none; }

/* charts */
.chart-card { margin-top: 20px; padding: 24px; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.chart-card h2 { font-size: 20px; margin: 0 0 4px; }
.chart-head p { margin: 0; font-size: 14px; }
.legend { display: flex; gap: 16px; font-size: 14px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item i { width: 10px; height: 10px; border-radius: 3px; }
.chart { position: relative; touch-action: pan-y; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 12px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .hover-band { fill: var(--hover-band); }
.chart-tip {
  position: absolute; z-index: 2; pointer-events: none; min-width: 180px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14); padding: 10px 12px; font-size: 13px;
}
.chart-tip strong { display: block; margin-bottom: 4px; }
.chart-tip div { display: flex; align-items: center; gap: 6px; line-height: 1.7; }
.chart-tip i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.chart-tip i.blank { background: transparent; }
.chart-tip span { color: var(--text-2); flex: 1; }
.chart-tip b { font-variant-numeric: tabular-nums; }
.schedule { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.schedule summary { cursor: pointer; font-weight: 600; color: var(--link); }
.table-wrap { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child { text-align: left; }
thead th { color: var(--muted); font-weight: 600; font-size: 13px; background: var(--surface-2); }
thead th:first-child { border-top-left-radius: 8px; }
thead th:last-child { border-top-right-radius: 8px; }
tbody th { font-weight: 600; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
.table-total tbody tr:last-child { font-weight: 700; }

/* ads */
.ad { margin: 28px 0; min-height: 120px; text-align: center; }
.ad-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }

/* article + contents */
.article-layout { display: grid; grid-template-columns: minmax(0, 760px) 240px; gap: 56px; justify-content: space-between; margin-top: 48px; }
.article-layout > * { min-width: 0; }
@media (max-width: 1000px) { .article-layout { grid-template-columns: minmax(0, 1fr); gap: 0; } .toc { display: none; } }
.toc { position: sticky; top: 92px; align-self: start; font-size: 14px; }
.toc p { margin: 0 0 10px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--text-2); text-decoration: none; line-height: 1.4; }
.toc a:hover { color: var(--link); border-left-color: var(--brand-2); }
.prose { max-width: 760px; }
.prose > h2:first-child { margin-top: 0; }
.prose h2 { font-size: 26px; font-weight: 700; margin: 40px 0 12px; }
.prose p, .prose li { color: var(--text-2); font-size: 17px; }
.prose li { margin-bottom: 8px; }
.prose strong { color: var(--text); }
.prose table { font-size: 15px; }
.prose .table-wrap { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.formula {
  font: 600 18px/1.5 ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace; color: var(--text) !important;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand-2);
  border-radius: 10px; padding: 14px 18px; overflow-x: auto;
}
.link-grid { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px 16px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.prose .link-grid li { margin: 0; font-size: 15px; }
.link-grid a { text-decoration: none; }
.link-grid a:hover { text-decoration: underline; }
.faq { margin-top: 48px; max-width: 760px; }
.faq h2 { font-size: 26px; margin: 0 0 16px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.faq summary { cursor: pointer; padding: 16px 52px 16px 18px; font-weight: 650; color: var(--text); list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 400; color: var(--muted); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0; padding: 0 18px 18px; color: var(--text-2); }
.info { padding: 32px 0 0; }
.info h2 { font-size: 22px; }

/* cards */
.related { margin-top: 56px; }
.related h2, .section-title { font-size: 24px; margin: 0 0 16px; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.link-card {
  display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 22px; color: var(--text); text-decoration: none;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.link-card:hover { border-color: var(--brand-2); transform: translateY(-2px); box-shadow: 0 12px 28px rgba(16, 26, 23, .1); }
.card-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); margin-bottom: 8px; }
.link-card strong { font-size: 17px; }
.link-card span { color: var(--text-2); font-size: 15px; }
.link-card .go { margin-top: auto; padding-top: 10px; color: var(--link); font-weight: 600; font-size: 15px; }
.disclaimer { font-size: 13px; margin: 40px 0 0; padding-top: 20px; border-top: 1px solid var(--line); }

/* home */
.home-hero { background: var(--hero-band); border-bottom: 1px solid var(--line); padding: 64px 0 56px; }
.home-hero-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 48px; align-items: center; }
@media (max-width: 900px) { .home-hero-grid { grid-template-columns: 1fr; } .preview { display: none; } }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--link); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; margin: 0 0 18px; }
.home-hero h1 { font-size: clamp(36px, 5.6vw, 58px); font-weight: 780; letter-spacing: -.035em; margin: 0 0 16px; }
.home-hero .lede { font-size: 19px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; padding: 0; margin: 24px 0 0; font-size: 14px; color: var(--text-2); }
.checks li { display: inline-flex; align-items: center; gap: 6px; }
.checks .icon { width: 16px; height: 16px; color: var(--brand-2); }
.preview { overflow: hidden; }
.preview .result-head { padding: 20px 22px; }
.preview .result-body { padding: 18px 22px 20px; }
.preview-bar { display: flex; gap: 2px; height: 14px; margin-bottom: 10px; }
.preview-bar i { display: block; height: 100%; }
.preview-bar i:first-child { border-radius: 4px 0 0 4px; }
.preview-bar i:last-child { border-radius: 0 4px 4px 0; }
.preview-tag { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .8; }
.home-section { padding: 56px 0 0; }
.home-cards { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1000px) { .home-cards { grid-template-columns: repeat(2, 1fr); } }
.group-title { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 28px 0 12px; }
.section-title + .group-title { margin-top: 8px; }
@media (max-width: 540px) { .home-cards { grid-template-columns: 1fr; } }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; list-style: none; margin: 0; padding: 0; }
@media (max-width: 1000px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .features { grid-template-columns: 1fr; } }
.features li { padding: 22px; }
.features h3 { font-size: 17px; margin: 0 0 6px; }
.features p { margin: 0; color: var(--text-2); font-size: 15px; }

/* footer */
.foot { background: var(--footer); color: var(--footer-text); margin-top: 80px; padding: 48px 0 24px; font-size: 15px; }
.foot .logo { color: #fff; }
.foot-grid { display: grid; gap: 32px; grid-template-columns: 1.5fr 1.3fr 1fr; }
.foot h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #fff; margin: 0 0 14px; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin-bottom: 8px; }
.foot nav[aria-label="All calculators"] ul { columns: 2; column-gap: 24px; }
@media (max-width: 420px) { .foot nav[aria-label="All calculators"] ul { columns: 1; } }
.foot a { color: var(--footer-text); text-decoration: none; }
.foot a:hover { color: #fff; }
.foot p { max-width: 380px; color: var(--footer-text); }
.copyright { font-size: 13px; margin-top: 36px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .1); color: var(--footer-text); opacity: .8; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr; } }
