:root {
  color-scheme: light;
  --paper: #fff;
  --ink: #263235;
  --muted: #4f5e61;
  --line: #d3dcdd;
  --tray: #f2f5f5;
  --accent: #176772;
  --accent-dark: #10535e;
  --accent-soft: #dceff1;
  --good: #245e40;
  --caution: #795715;
  --bad: #92392e;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  font: 16px/1.5 system-ui, sans-serif;
  background: #f2f3f3;
  color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden], .budgethub:not([href]) { display: none !important; }
body { margin: 0; overflow-wrap: anywhere; }
h1, h2, h3, p, dl, figure { margin: 0; }
h2 { font-size: 1.12rem; line-height: 1.3; font-weight: 700; }
a { color: var(--accent-dark); text-underline-offset: .18em; }
button, select, input { font: inherit; }
button, select, summary { cursor: pointer; }
:focus-visible { outline: 2px solid #168899; outline-offset: 3px; }
code { font-family: var(--mono); }
.shell { width: min(1440px, 100%); margin-inline: auto; }
.skip-link { position: fixed; z-index: 2; top: .5rem; left: .5rem; padding: .55rem .85rem; background: #fff; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: .4rem 1rem; padding-inline: 1.35rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; min-height: 57px; color: var(--ink); text-decoration: none; font-weight: 750; font-size: 1.09rem; }
.brand img { display: block; border-radius: 3px; background: #297e8d; }
.header-inner nav { display: flex; align-items: stretch; flex-wrap: wrap; gap: 0 1.3rem; }
.header-inner nav a { display: inline-flex; align-items: center; min-height: 54px; color: var(--muted); font-size: .85rem; font-weight: 600; text-decoration: none; border-bottom: 2px solid transparent; }
.header-inner nav a:hover { color: var(--accent-dark); border-color: #64adb6; }

.workbench {
  display: grid; grid-template-columns: 326px minmax(0, 1fr); grid-template-rows: auto 1fr;
  background-color: #ecefef;
  background-image: conic-gradient(#e5e9e9 25%, transparent 0 50%, #e5e9e9 0 75%, transparent 0);
  background-size: 12px 12px;
}
.hero { grid-column: 2; grid-row: 1; padding: 24px clamp(16px, 3vw, 36px) 18px; }
h1 { font-size: clamp(1.9rem, 3.25vw, 2.75rem); font-weight: 720; line-height: 1.1; letter-spacing: -.04em; }
h1 br { display: none; }
h1 span::before { content: " "; }
.hero p { margin-top: .38rem; color: var(--muted); font-size: .9rem; max-width: 710px; }
.hero-budgethub { margin-top: .65rem; }
.hero-budgethub a {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  max-width: 100%;
  min-height: 44px;
  padding: .4rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--tray);
  font-size: .85rem;
  font-weight: 600;
}

.settings { min-width: 0; grid-column: 1; grid-row: 1 / 3; background: var(--paper); border-right: 1px solid #cad4d6; box-shadow: 2px 0 8px #394e5514; }
.settings h2 { padding: 16px 19px; background: #eef2f2; border-bottom: 1px solid var(--line); }
.preset-strip, .context-field, .field-grid { padding: 13px 18px; border-bottom: 1px solid var(--line); }
.strip-label, .field label, .context-header label, .mtp-field { font-size: .84rem; font-weight: 680; }
.preset-list, .quick-context { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; margin-top: .45rem; }
button, .budgethub {
  display: inline-flex; justify-content: center; align-items: center; gap: .3rem;
  border: 1px solid #bdccce; border-radius: 4px; min-height: 44px; padding: .38rem .65rem;
  background: #fff; color: var(--ink); text-decoration: none; text-align: center;
  font-size: .78rem; line-height: 1.25; font-weight: 650;
}
button:hover, .budgethub:hover { border-color: var(--accent); color: var(--accent-dark); }
button[aria-pressed="true"] { background: var(--accent-soft); border-color: #75abb1; color: var(--accent-dark); }
.preset-list button { justify-content: space-between; padding-inline: .46rem; }
.preset-list span, .quick-context button { font-family: var(--mono); }
.preset-list span { color: var(--accent-dark); font-size: .7rem; }
.estimate-jump { display: none; }
.context-header { display: grid; gap: .3rem; }
.token-field { display: flex; align-items: center; border: 1px solid #bac9cb; border-radius: 4px; }
.token-field > span { flex: none; padding-right: .5rem; color: var(--muted); font: .74rem var(--mono); }
input:not([type="checkbox"], [type="range"]), select {
  width: 100%; min-width: 0; min-height: 44px; padding: .33rem .52rem;
  border: 1px solid #bac9cb; border-radius: 4px; background: #fff; color: var(--ink); font-size: .86rem;
}
.token-field input:not([type="checkbox"], [type="range"]) { border: 0; font-family: var(--mono); }
input[type="range"], input[type="checkbox"] { accent-color: var(--accent); }
input[type="range"] { display: block; width: 100%; margin: .6rem 0 .15rem; }
.range-endpoints { display: flex; justify-content: space-between; color: var(--muted); font: .74rem var(--mono); }
.quick-context { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .2rem; }
.quick-context button { padding-inline: .12rem; font-size: .67rem; }
.field-grid { display: grid; gap: .58rem; }
.field label, .field small { display: block; }
.field label { margin-bottom: .23rem; }
.field label span, .field small, .mtp-field small { color: var(--muted); font-size: .75rem; font-weight: 450; }
.field small, .mtp-field small { display: block; margin-top: .18rem; }
.custom-field { margin-top: .45rem; }
.mtp-field { display: flex; min-height: 60px; align-items: center; gap: .55rem; padding: 8px 18px; cursor: pointer; }

.workspace { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr); gap: 14px; align-content: start; padding: 0 clamp(16px, 3vw, 36px) 30px; min-width: 0; }
.result, .comparison, .data-section { min-width: 0; background: #fff; border: 1px solid #c9d4d6; border-radius: 4px; padding: clamp(13px, 1.6vw, 20px); }
.result { display: grid; }
.result h2 { color: var(--muted); font-size: .82rem; font-weight: 680; }
.result-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: .35rem; margin-top: .2rem; }
.result-total strong { color: var(--ink); font: 700 clamp(2.2rem, 4vw, 3.25rem)/1.04 var(--mono); letter-spacing: -.065em; }
.result-total span { color: var(--muted); font: .96rem var(--mono); }
.result-decimal, #result-headroom { color: var(--muted); font: .76rem/1.5 var(--mono); }
.result-fit { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .55rem; margin: .62rem 0; padding-bottom: .55rem; border-bottom: 1px solid var(--line); font-size: .78rem; }
.verdict { padding: .2rem .45rem; font-size: .74rem; font-weight: 750; background: var(--tray); border-radius: 3px; }
[data-fit="fits"] { color: var(--good); background-color: #eaf5ed; }
[data-fit="tight"] { color: var(--caution); background-color: #fff3d9; }
[data-fit="exceeds"] { color: var(--bad); background-color: #fbecea; }
.breakdown div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem; padding-block: .17rem; font-size: .81rem; }
.breakdown dd { margin: 0; font: .76rem/1.55 var(--mono); text-align: right; }
.breakdown small { color: var(--muted); margin-left: .18rem; }
.swatch, .key::before { display: inline-block; width: .53rem; height: .53rem; margin-right: .33rem; background: #486c82; }
.swatch.global, .key-global::before { background: #267884; }
.swatch.local, .key-local::before { background: #78b8c1; }
.swatch.mtp { background: #796b90; }
.swatch.overhead { background: #9a773f; }
.result-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .72rem; }
.budgethub { background: var(--accent); color: #fff; border-color: var(--accent); }
.budgethub:hover { background: var(--accent-dark); color: #fff; }
.budgethub-hint { flex-basis: 100%; width: 0; color: var(--muted); font-size: .8rem; }
#budgethub:not([href]) + .budgethub-hint { display: none; }
#share-fallback { margin-top: .55rem; font-size: .83rem; }

.comparison > div > p, .data-section > p { margin-top: .35rem; color: var(--muted); font-size: .85rem; }
.comparison-chart { margin-top: 1rem; padding: .85rem; border: 1px solid var(--line); border-radius: 3px; background: var(--tray); }
.bar-caption { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .14rem .45rem; font-size: .79rem; }
.bar-caption strong { font: 650 .73rem/1.4 var(--mono); }
.comparison-track, progress { display: block; width: 100%; height: .62rem; border: 0; border-radius: 2px; background: #d9e4e5; }
.comparison-track { margin: .38rem 0 .78rem; background: #829598; }
progress { margin-top: .38rem; }
progress::-webkit-progress-bar { background: #d9e4e5; border-radius: 2px; }
progress::-webkit-progress-value { background: #257d89; border-radius: 2px; }
progress::-moz-progress-bar { background: #257d89; border-radius: 2px; }
.comparison-chart .savings { margin-top: .65rem; color: var(--accent-dark); font-weight: 700; font-size: .81rem; }

.data-section { grid-column: 1 / -1; }
.table-scroll { max-width: 100%; overflow-x: auto; margin-block: .6rem; }
table { width: 100%; min-width: 690px; border-collapse: collapse; font-size: .79rem; text-align: left; }
th, td { border: 1px solid #e1e7e8; padding: .38rem .48rem; }
thead, tr.selected th { background: #eef4f4; }
tr.selected th:first-child { box-shadow: inset 3px 0 var(--accent); }
.tier-table td { font-variant-numeric: tabular-nums; }
.matrix-table td[data-fit] { font-weight: 600; line-height: 1.25; }
.data-section .table-note { font-size: .76rem; }

.methodology, .faq { margin-inline: clamp(16px, 3vw, 36px); padding: 1.4rem 0; }
.method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.4rem; margin-block: 1rem; }
.method-grid h3 { font-size: 1rem; }
.method-grid p, .faq p { color: var(--muted); margin-top: .35rem; font-size: .9rem; }
.topology { width: min(100%, 600px); padding: .82rem; margin-block: .75rem; border: 1px solid var(--line); background: #fff; border-radius: 4px; }
.topology figcaption, .topology-key, .topology-passes { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .2rem; font-size: .76rem; }
.topology-plot { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; margin-block: .5rem; }
.topology-group, .topology-passes { color: var(--muted); font: .7rem var(--mono); }
.layer-cells { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; margin-top: .2rem; }
.layer-cells i { height: 13px; background: #78b8c1; }
.layer-cells .global { background: #267884; }
.topology-key { justify-content: flex-start; gap: .4rem .8rem; margin-top: .7rem; }
.key::before { content: ""; }
.source-links, .related-links { display: flex; flex-wrap: wrap; gap: .32rem 1.05rem; list-style: none; padding: 0; margin: .75rem 0; }
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
summary { padding: .6rem 0; font-weight: 650; }
.faq details p { padding-bottom: .7rem; }
.site-footer { border-top: 1px solid var(--line); background: #e7eded; }
.site-footer .shell { padding: 1.2rem clamp(16px, 3vw, 36px) 1.8rem; color: var(--muted); font-size: .86rem; }
.notice { margin: .7rem 1rem; }

@media (max-width: 1090px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .workbench { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .workbench { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  .hero, .settings, .workspace { grid-column: auto; grid-row: auto; }
  .settings { margin: 0 16px 14px; border: 1px solid var(--line); border-radius: 4px; box-shadow: none; }
  .estimate-jump { display: flex; justify-content: space-between; gap: .4rem; margin-top: .4rem; min-height: 44px; align-items: center; font-size: .8rem; font-weight: 650; }
  .method-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .header-inner { flex-wrap: wrap; padding-inline: 16px; }
  .header-inner nav { width: 100%; }
  .header-inner nav a { min-height: 39px; }
  h1 br { display: initial; }
  h1 span::before { content: none; }
  .breakdown div { gap: .15rem; }
}
