:root {
  --paper: #f4f1ea;
  --ink: #17201f;
  --muted: #56605e;
  --line: #d6d1c6;
  --accent: #0f4c4a;
  --accent-soft: #e2ecea;
  --gold: #e0a03a;
  --warn: #8a4b08;
  --error: #a32c1c;
  --sheet: #fffefb;
  --sans: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --doc: Arial, Helvetica, sans-serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 16.5px; line-height: 1.5; background: var(--paper); }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }
button, input, select { font: inherit; color: inherit; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 12px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 10; }

header.site .wrap, footer.site .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 10px 24px; flex-wrap: wrap; }
header.site .wrap { padding-top: 20px; padding-bottom: 16px; }
.brand { font-size: 24px; font-weight: 800; letter-spacing: -0.7px; text-decoration: none; color: var(--accent); }
.brand b { color: var(--ink); font-weight: 500; }
.site nav { display: flex; gap: 6px 20px; flex-wrap: wrap; }
.site nav a { text-decoration: none; color: var(--muted); font-size: 15px; font-weight: 600; padding: 4px 0; }
.site nav a[aria-current="page"] { color: var(--ink); box-shadow: 0 2px 0 var(--gold); }
footer.site { border-top: 1px solid var(--line); margin-top: 96px; }
footer.site .wrap { padding-top: 28px; padding-bottom: 40px; }
footer.site .brand { font-size: 19px; }

.start { padding: 28px 0 26px; max-width: 860px; }
h1 { font-size: clamp(31px, 5vw, 54px); line-height: 1.04; letter-spacing: -1.6px; margin: 0 0 14px; font-weight: 800; text-wrap: balance; }
.lead { font-size: 18px; color: var(--muted); margin: 0; max-width: 44em; }

/* The band: house inputs on paper, the result on petrol. */
.band { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--accent); color: #fff; border-radius: 8px; overflow: hidden; margin-bottom: 30px; }
.band-inputs { padding: 24px 26px 26px; background: var(--sheet); color: var(--ink); border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; }
.band-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.band h2, .fields h2 { margin: 0; font-size: 13px; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 700; color: var(--accent); }
.band .band-inputs > h2 { margin-bottom: 14px; }
.readout { padding: 26px 30px; display: flex; flex-direction: column; min-width: 0; }
.readout-label { margin: 0; font-size: 13px; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 700; color: #f3d39c; }
.readout-amount { margin: 6px 0 14px; font-size: clamp(44px, 6.6vw, 78px); line-height: 1; font-weight: 800; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.readout-amount strong { font-weight: 800; }
.readout-amount span { display: block; font-size: 17px; letter-spacing: 0; font-weight: 600; margin-top: 10px; color: #d7e6e3; }
.readout[data-state="example"] .readout-amount, .readout[data-state="draft"] .readout-amount { opacity: 0.6; }
.readout-detail { margin: 0; font-size: 15px; color: #d7e6e3; max-width: 36em; }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 16px; margin: 0 0 12px; font-size: 15px; }
.facts dt { color: #f3d39c; font-weight: 600; }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
table.overview { margin: 4px 0 0; color: #fff; font-size: 15px; }
table.overview th { color: #f3d39c; border-bottom-color: #f3d39c; }
table.overview td { border-bottom-color: rgba(255, 255, 255, 0.18); }
table.overview td span { color: #c4d8d4; font-size: 13px; margin-left: 4px; white-space: nowrap; }
.n { text-align: right !important; white-space: nowrap; }

.workspace { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 52px; align-items: start; }
.fields { counter-reset: part; }
.fields section { padding: 22px 0 24px; border-bottom: 1px solid var(--line); counter-increment: part; }
.fields h2 { margin-bottom: 12px; }
.fields h2::before { content: counter(part, decimal-leading-zero); color: var(--gold); margin-right: 10px; font-variant-numeric: tabular-nums; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; }
input[type="text"], select { width: 100%; min-height: 46px; padding: 10px 12px; font-size: 16px; background: var(--sheet); border: 1px solid var(--line); border-radius: 5px; font-variant-numeric: tabular-nums; transition: border-color 0.15s ease; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 18px) 20px, calc(100% - 12px) 20px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 34px; }
input[type="text"]:hover, select:hover { border-color: var(--muted); }
input[aria-invalid="true"] { border-color: var(--error); box-shadow: inset 3px 0 0 var(--error); }
input::placeholder { color: #8f9694; }
.hint { font-size: 13.5px; color: var(--muted); margin: 5px 0 0; }
.section-hint { margin: 0 0 8px; }
.error { font-size: 13.5px; color: var(--error); margin: 5px 0 0; font-weight: 600; }
.error:empty { display: none; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.row { padding: 16px 0; border-top: 1px dashed var(--line); }
.row:first-child { border-top: 0; padding-top: 6px; }
.row legend { font-size: 13px; font-weight: 700; color: var(--muted); padding: 0; margin-bottom: 8px; }
.more { border-top: 0; padding: 12px 0 0; }
.more summary { font-size: 14.5px; color: var(--accent); }
.more .grid { margin-top: 10px; }
.row .remove { margin-top: 8px; font-size: 14px; min-height: 28px; }
.check { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; padding: 4px 0 10px; font-size: 15.5px; cursor: pointer; }
input[type="checkbox"] { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.file-actions { display: flex; gap: 8px; flex-wrap: wrap; }

button { cursor: pointer; border: 1.5px solid var(--accent); background: var(--accent); color: #fff; border-radius: 5px; padding: 10px 16px; min-height: 46px; font-size: 15.5px; font-weight: 700; transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease; }
button:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); }
button.secondary { background: transparent; border-color: var(--ink); color: var(--ink); }
button.secondary:hover:not(:disabled) { color: #fff; }
button:disabled { opacity: 0.35; cursor: not-allowed; }
button.link, .analytics-settings { border: 0; background: none; color: var(--muted); padding: 0; min-height: 32px; font-weight: 400; font-size: inherit; text-decoration: underline; text-underline-offset: 3px; }
button.link:hover:not(:disabled), .analytics-settings:hover { background: none; color: var(--accent); }
button.add { color: var(--accent); font-weight: 700; text-decoration: none; font-size: 15.5px; }
#sample { color: var(--accent); font-weight: 700; font-size: 15px; }
#reset { margin-top: 12px; font-size: 15px; }

.output { position: sticky; top: 0; align-self: start; container-type: inline-size; min-width: 0; }
.output-inner { padding-top: 18px; display: flex; flex-direction: column; max-height: 100vh; }
.exports { display: flex; gap: 8px; flex-wrap: wrap; }
.status { margin: 10px 0 0; font-size: 15px; font-weight: 600; color: var(--muted); }
.status[data-state="ready"] { color: var(--accent); }
.warnings { margin-top: 12px; padding: 10px 16px; background: #f8ecd6; border-left: 4px solid var(--gold); font-size: 14.5px; border-radius: 0 5px 5px 0; }
.warnings ul { margin: 0; padding-left: 18px; }
.warnings li { margin: 3px 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.tabs:empty { display: none; }
.tab { min-height: 38px; padding: 6px 12px; font-size: 14.5px; background: transparent; color: var(--ink); border: 1px solid var(--line); font-weight: 600; }
.tab[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab:hover:not(:disabled) { color: #fff; }
.sheet { margin: 14px 0 24px; background: var(--sheet); color: #111; font-family: var(--doc); font-size: max(12.5px, 1.75cqi); line-height: 1.5; padding: 6cqi 6.5cqi 7cqi 8cqi; box-shadow: 0 1px 0 rgba(15, 30, 28, 0.08), 0 18px 40px -18px rgba(15, 30, 28, 0.42); overflow-y: auto; min-height: 0; overflow-wrap: anywhere; animation: sheet-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.sheet.is-example > * { opacity: 0.55; }
.sheet p, .sheet-quote p { margin: 0 0 0.75em; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px); } }
.s-sender { font-size: 0.8em; color: #555; text-decoration: underline; text-underline-offset: 3px; }
.s-recipient { margin-bottom: 1.6em !important; }
.s-title { font-size: 1.2em; margin: 0 0 0.8em; }
.s-blank { color: #8a939b; font-style: italic; }
.s-scroll { overflow-x: auto; }
.s-table { font-size: 0.92em; margin: 0.6em 0 1em; }
.s-table th { font-size: 0.85em; text-transform: none; letter-spacing: 0; color: #333; border-bottom-color: #111; }
.s-table td, .s-table th { padding: 5px 10px 5px 0; }
.s-table tfoot td { border-bottom: 0; padding-top: 6px; }
.s-total td { font-weight: 700; font-size: 1.1em; border-top: 1.5px solid #111; }
.s-note { font-size: 0.85em; color: #444; }
.s-close { margin-top: 1.4em !important; }

.next { margin-top: 72px; border-top: 2px solid var(--ink); padding-top: 26px; }
.next > h2 { font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -0.9px; line-height: 1.1; margin: 0 0 26px; font-weight: 800; }
.next ol { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; }
.next li { counter-increment: step; }
.next li::before { content: counter(step, decimal-leading-zero); display: block; font-size: 13px; font-weight: 700; letter-spacing: 1.4px; color: var(--gold); margin-bottom: 8px; }
.next h3 { margin: 0 0 8px; font-size: 19px; line-height: 1.25; }
.next p { margin: 0 0 10px; color: var(--muted); font-size: 15.5px; }
details { border-top: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; font-size: 15.5px; min-height: 28px; }
summary:hover { color: var(--accent); }
details p { margin: 8px 0 2px; }

.downloads { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); }
.download { display: block; padding: 20px 22px 22px 0; text-decoration: none; border-right: 1px solid var(--line); margin-right: 22px; }
.download:last-child { border-right: 0; margin-right: 0; }
.download strong { display: block; font-size: 20px; letter-spacing: -0.3px; margin-bottom: 6px; }
.download strong::after { content: " ↓"; color: var(--gold); }
.download.primary strong::after { content: " →"; }
.download span { color: var(--muted); font-size: 15px; }
.download:hover strong { color: var(--accent); }
.quick .band { margin-bottom: 0; }

.article { max-width: 760px; margin-top: 80px; overflow-x: clip; }
.article.page { margin-top: 40px; }
.article h1 { font-size: clamp(30px, 4.8vw, 44px); }
.article h2 { font-size: 26px; line-height: 1.15; letter-spacing: -0.6px; margin: 50px 0 12px; font-weight: 800; }
.article h3 { font-size: 18.5px; margin: 30px 0 8px; }
.article p, .article ul, .article ol { margin: 0 0 14px; }
.article ul { padding-left: 20px; }
.article ol { padding-left: 22px; }
.article li { margin-bottom: 5px; }
table { border-collapse: collapse; width: 100%; margin: 18px 0; font-size: 15px; font-variant-numeric: tabular-nums; }
caption { text-align: left; color: var(--muted); font-size: 14px; padding-bottom: 8px; }
th, td { text-align: left; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: break-word; }
thead th { font-size: 12.5px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted); border-bottom-color: var(--ink); }
td:last-child, th:last-child { padding-right: 0; }
.article > table { display: block; overflow-x: auto; max-width: 100%; }
.article tfoot td { border-bottom: 0; }
.sheet-quote { margin: 0 0 14px; padding: 22px 24px; background: var(--sheet); border-left: 3px solid var(--accent); font-family: var(--doc); font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.guide .lead { margin-bottom: 26px; }
.crumbs { margin: 0 0 10px; font-size: 13px; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 700; }
.crumbs a { text-decoration: none; color: var(--accent); }
.meta { font-size: 13.5px; color: var(--muted); margin: 0 0 22px; }
.guide-links { list-style: none; padding: 0 !important; border-top: 1px solid var(--line); }
.guide-links li { border-bottom: 1px solid var(--line); margin: 0; padding: 12px 0; }
.guide-links a { font-weight: 700; text-decoration: none; }
.guide-links span { display: block; color: var(--muted); font-size: 15px; }
.changes { list-style: none; padding: 0 !important; }
.changes time { font-weight: 700; margin-right: 8px; }

.notice { color: var(--muted); border-left: 3px solid var(--line); padding-left: 14px; }
.analytics-consent { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto; background: var(--ink); color: #fff; padding: 16px 18px; border-radius: 6px; z-index: 20; font-size: 15px; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.5); }
.analytics-consent p { margin: 0 0 12px; }
.analytics-consent .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.analytics-consent button.secondary { border-color: #fff; color: #fff; }
footer .notice { flex-basis: 100%; margin: 0; }
footer .notice:empty { display: none; }

@media (max-width: 980px) {
  .band { grid-template-columns: 1fr; }
  .band-inputs { border-right: 1px solid var(--line); border-radius: 8px 8px 0 0; }
  .workspace { grid-template-columns: 1fr; gap: 0; }
  .output { position: static; }
  .output-inner { max-height: none; }
  .sheet { max-height: 75vh; }
  .next ol { grid-template-columns: 1fr; gap: 26px; }
  .downloads { grid-template-columns: 1fr; }
  .download { border-right: 0; margin-right: 0; border-bottom: 1px solid var(--line); padding-right: 0; }
  .download:last-child { border-bottom: 0; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 16px; }
  .band-inputs { padding: 18px 16px 20px; }
  .readout { padding: 22px 18px; }
  .grid { grid-template-columns: 1fr; }
  .exports { width: 100%; }
  .exports button { flex: 1 1 auto; }
  .sheet { padding: 22px 18px; }
  .article { margin-top: 56px; }
  table.overview { font-size: 13.5px; }
  table.overview th, table.overview td { padding-right: 8px; }
  table.overview td span { display: block; margin-left: 0; }
  #overview { overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print {
  header.site, footer.site, .band, .fields, .toolbar, .status, .tabs, .next, .article, .start, .analytics-consent, .skip, .warnings { display: none !important; }
  .workspace { display: block; } .output { position: static; } .output-inner { max-height: none; padding: 0; }
  .sheet { box-shadow: none; max-height: none; overflow: visible; margin: 0; padding: 0; font-size: 10.5pt; animation: none; }
  .sheet.is-example > * { opacity: 1; }
  body { background: #fff; }
  @page { size: A4; margin: 18mm 18mm 20mm 22mm; }
}
