:root {
  color: #172a3d;
  background: #f0f5fa;
  font: 100%/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  --ink: #172a3d;
  --muted: #435b72;
  --blue: #006fba;
  --link: #005eaa;
  --line: #cfdeeb;
  --soft: #edf5fd;
  --white: #fff;
}
*, *::before, *::after { box-sizing: border-box }
body { margin: 0 }
a { color: inherit }
button, input, select { font: inherit }
button { cursor: pointer }
button:disabled { opacity: .6; cursor: not-allowed }
[hidden] { display: none !important }
:focus-visible { outline: 3px solid #0052a4; outline-offset: 3px }
.top :focus-visible, .tool-nav :focus-visible { outline-color: #fff }
.wrap { width: min(1120px, calc(100% - 48px)); margin-inline: auto }
.skip { position: absolute; top: -99px; left: 12px; background: white; padding: 8px; z-index: 3 }
.skip:focus { top: 8px }
.top, .hero { background: var(--blue); color: var(--white) }
.top-row { min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 12px }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 1.24rem; font-weight: 850; letter-spacing: -.025em; text-decoration: none; white-space: nowrap }
.brand img { width: 35px; height: 35px }
.top nav, .tool-nav, .footer div:last-child { display: flex; align-items: center; flex-wrap: wrap }
.top nav { gap: 6px 24px }
.top nav a, .footer a { font-size: .94rem; font-weight: 700; text-decoration: none }
.top nav a:hover, .footer a:hover { text-decoration: underline }
.hero-copy { text-align: center; padding-block: 35px 20px }
h1, h2, h3 { letter-spacing: -.035em; line-height: 1.1 }
.hero h1, .article-head h1, .simple h1 { font-size: clamp(2.15rem, 5.2vw, 4.2rem); margin: 0 0 12px; font-weight: 850; text-wrap: balance }
.hero h1 { max-width: 860px; margin-inline: auto }
.hero .lead { margin: 0 0 22px; color: #fff; font-size: clamp(1.05rem, 2vw, 1.32rem) }
.tool-nav { justify-content: center; gap: 6px; }
.tool-nav a { font-weight: 750; padding: 8px 15px; min-height: 40px; display: inline-flex; align-items: center; border-radius: 9px; text-decoration: none; background: #fff2 }
.tool-nav a:hover { background: #fff4 }
.tool-nav a[aria-current] { background: white; color: #094a80 }
h2 { font-size: clamp(1.55rem, 2.8vw, 2.05rem); margin: 0 0 10px }
.calc-section { scroll-margin-top: 12px; padding: 22px 0 12px }
.home .calc-section { background: linear-gradient(var(--blue) 65px, transparent 65px); padding-top: 0 }
.calc-intro { color: var(--muted); margin: 0 0 12px }
.tool-grid { display: grid; grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr); align-items: start; gap: 16px }
.tool-grid form, .result { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 6px 17px #14456d0c }
.tool-grid fieldset { border: 0; padding: 0; margin: 0; min-width: 0 }
.tool-grid legend { padding: 0; font-size: 1.04rem; font-weight: 800; margin-bottom: 5px }
.quick-fields { display: grid; gap: 12px; margin-bottom: 14px }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px }
.fields.base { grid-template-columns: repeat(3, minmax(0, 1fr)) }
.fields label { display: flex; flex-direction: column; justify-content: end; gap: 4px; font-size: .9rem; font-weight: 650; color: #314c68 }
.fields input, .fields select { width: 100%; min-width: 0; min-height: 45px; border-radius: 8px; border: 1px solid #afc4d8; background: #f8fbff; color: var(--ink); padding: 6px 9px; font-size: 1rem; font-weight: 650 }
.fields select { appearance: none; padding-right: 27px; background: #f8fbff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 6 5 5 5-5' stroke='%23314c68' stroke-width='2' fill='none'/%3E%3C/svg%3E") right 8px center/14px no-repeat }
.fields input:focus, .fields select:focus { background-color: white }
.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center }
.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; border: 1px solid transparent; border-radius: 9px; font-size: .95rem; font-weight: 770 }
.btn.dark { flex: 1 1 auto; background: #ff7b12; color: #19263c }
.btn.dark:hover { background: #f46d03 }
.btn.text { background: transparent; color: var(--link) }
.btn.text:hover { background: var(--soft) }
.btn.light { color: var(--link); background: var(--soft); width: 100% }
.btn.light:hover { background: #dceeff }
.settings { margin-top: 12px; border-top: 1px solid var(--line); }
.settings summary { padding: 9px 0 0; cursor: pointer; color: var(--link); font-size: .93rem; font-weight: 700 }
.settings-fields fieldset { margin-top: 14px }
.error { color: #a12036; margin: 7px 0 0 }
.error:empty { margin: 0 }
.result { scroll-margin-top: 12px }
.result h2 { font-size: 1.5rem }
#metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0 3px }
.result #metrics div { padding: 8px 10px; border-radius: 9px; background: var(--soft) }
.result small, .result-qty span { display: block; font-size: .85rem; color: var(--muted) }
.result #metrics strong, .cost b { color: #07568d; font-size: 1.09rem }
.result-line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line) }
.result-line h3, .result-line p { margin: 0 }
.result-line h3 { font-size: 1.12rem; margin-bottom: 3px }
.result-line p { font-size: .92rem; color: var(--muted); line-height: 1.38 }
.result-qty { text-align: right; white-space: nowrap }
.result-qty strong { display: block; font-size: 1.1rem; color: #07568d }
.cost { display: flex; justify-content: space-between; gap: 6px; padding: 11px 0 }
.fine { margin: 10px 0 0; color: var(--muted); font-size: .88rem }
.guides { padding-block: 28px 42px }
.guides-lead, .deck { margin: 0; color: var(--muted) }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px }
.card { display: block; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 13px; text-decoration: none }
.card:hover { border-color: #3284c3 }
.card:hover h3 { color: var(--link); text-decoration: underline }
.card-key { color: var(--link); font-weight: 760; font-size: .9rem }
.card h3 { margin: 7px 0 6px; font-size: 1.17rem; line-height: 1.2 }
.card p { color: var(--muted); margin: 0; font-size: .94rem }
footer { background: #e4eef8; border-top: 1px solid var(--line) }
.footer { display: flex; justify-content: space-between; gap: 16px; padding-block: 16px 21px }
.footer p { margin: 3px 0 0; color: var(--muted) }
.footer div:last-child { gap: 8px 16px }
.article-head { padding-top: 24px }
.article-head h1, .simple h1 { font-size: clamp(2rem, 4.5vw, 3.5rem); text-wrap: unset }
.label, .crumb, .meta { font-size: .9rem; color: var(--muted); margin: 0 0 10px }
.label { color: var(--link); font-weight: 760; letter-spacing: .07em }
.deck { max-width: 65ch; font-size: 1.08rem }
.prose { max-width: 770px; padding-block: 22px 40px; font-size: 1.07rem; line-height: 1.66 }
.prose h2 { font-size: 1.55rem; margin: 1.3em 0 .4em }
.prose h3 { font-size: 1.22rem; margin: 1.3em 0 .4em }
.prose code { background: #e0edf9; color: var(--link); border-radius: 4px; padding: 2px 4px; overflow-wrap: anywhere }
.prose a, .crumb a { color: var(--link); text-underline-offset: .17em }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 7px }
table { border-collapse: collapse; width: 100%; text-align: left; background: #fff }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top }
th { background: #ddeaf7 }
@media (max-width: 880px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)) } }
@media (max-width: 720px) {
  .wrap { width: calc(100% - 24px) }
  .top-row { min-height: 53px; padding-block: 6px; flex-wrap: wrap; gap: 4px 12px }
  .brand { font-size: 1.12rem }
  .brand img { width: 29px; height: 29px }
  .top nav { gap: 4px 11px }
  .top nav a { font-size: .87rem }
  .hero-copy { padding-block: 19px 13px }
  .hero h1 { font-size: clamp(1.85rem, 6vw, 2.55rem); margin-bottom: 7px }
  .hero .lead { margin-bottom: 12px }
  .tool-nav { gap: 4px }
  .tool-nav a { padding-inline: 8px; min-height: 36px; font-size: .88rem }
  .tool-grid { grid-template-columns: minmax(0, 1fr); gap: 11px }
  .tool-grid form, .result { padding: 13px; border-radius: 12px }
  .fields { gap: 6px }
  .calc-section { padding-top: 15px }
  .guides { padding-top: 21px }
  .footer { display: block }
  .footer div:last-child { margin-top: 10px }
}
@media (max-width: 370px) { .cards { grid-template-columns: minmax(0, 1fr) } .btn.text { width: 100% } }
