/* Shared look for every page. DESIGN.md explains the rules; a page's own <style> adds only what is its own. */
:root{color-scheme:light;
  --bg:#f4f4f1;--panel:#ffffff;--raised:#ecece8;--line:#e2e2dc;--ink:#1f1b16;--mute:#585852;--rose:#b23a24;--on-rose:#ffffff;--tint:#faeee8;--tint-line:#efd9cf;--warn:#7a4d00;--warn-tint:#fbf2df;--warn-line:#ecd6a8;--dusk:#76766f;--dusk2:#b3b3ab;--ok:var(--ink);--shadow:rgba(31,27,22,.12);
  /* chart series: one colour per entity, in bar order (DESIGN.md, Chart series) */
  --s-tax:var(--rose);--s-cb:#d77a64;--s-aa:#f3cfc4;--s-ni:#64645d;--s-loan:#a2a29a;--s-help:#d2d2ca;--s-mar:#8a8a82;--s-cglo:#e3a08f;--s-kept:var(--ink)}

*{box-sizing:border-box;min-width:0}
html,body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.55 "Schibsted Grotesk","Schibsted fallback",system-ui,-apple-system,"Segoe UI",sans-serif;overflow-x:clip}   /* figures are tabular everywhere: fonts.css gives Schibsted Grotesk tabular digits */
h1{font:400 clamp(34px,5vw,52px)/1.05 "Schibsted Grotesk",sans-serif;letter-spacing:-.025em;margin:0 0 12px;text-wrap:balance}
h2{font:500 clamp(22px,2.6vw,28px)/1.15 "Schibsted Grotesk",sans-serif;letter-spacing:-.01em;margin:0 0 8px;text-wrap:balance}
h3{font:500 20px/1.3 "Schibsted Grotesk",sans-serif;margin:24px 0 8px}
p,li{text-wrap:pretty}
p{margin:0 0 12px;max-width:68ch}
.lede{color:var(--mute);font-size:18px}
a{color:var(--rose);text-underline-offset:2px}
::selection{background:rgba(178,58,36,.25)}
input{caret-color:var(--rose)}
:focus-visible{outline:2px solid var(--rose);outline-offset:2px}
[hidden]{display:none!important}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* tool tabs: a ruled row, the current tool underlined in ink */
.modes{display:flex;flex-wrap:wrap;gap:4px;margin:0;border-bottom:1px solid var(--line)}
.modes a{color:var(--mute);text-decoration:none;padding:10px 14px;min-height:44px;border-bottom:2px solid transparent;margin-bottom:-1px}
.modes a:hover{color:var(--ink)}
.modes a[aria-current=page]{color:var(--ink);font-weight:500;border-bottom-color:var(--ink)}
@media (max-width:420px){.modes{gap:0}.modes a{padding:10px}}
@media (max-width:820px){.modes{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}.modes a{flex:none}}   /* phones and tablets: the tab row scrolls rather than leaving one tab on a line of its own */

/* panels and the form: white panels hold only the inputs and the main result; every other section is ruled (.ruled) on the page ground */
.ruled{border-top:1px solid var(--line);padding-top:20px}
.ruled.lead{border-top:2px solid var(--ink)}
.panel{background:var(--panel);border:1px solid var(--line);border-radius:16px;padding:20px}
label{display:block;position:relative;font-size:14px;color:var(--mute);margin-bottom:8px}
input[type=number],input[type=email],input[type=text],input[type=date],input[type=search],select{width:100%;font:16px "Schibsted Grotesk",sans-serif;color:var(--ink);background:var(--bg);border:1px solid var(--line);border-radius:10px;padding:11px 12px;min-height:44px}
input::placeholder{color:#76766e;opacity:1}
.money{position:relative}.money span{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--mute)}.money input{padding-left:26px}
.row2{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px}
.row2>div{display:flex;flex-direction:column;justify-content:flex-end}
.check{display:flex;gap:8px;align-items:center;font-size:14px;color:var(--ink);min-height:44px;margin:0}
.check input{width:18px;height:18px;min-height:0;accent-color:var(--rose);flex:none}
summary{cursor:pointer;font-weight:500;min-height:32px}summary:hover{color:var(--rose)}
.note{font-size:13px;color:var(--mute);margin:0}
.fieldwarn{font-size:14px;color:var(--rose);margin:4px 0 0}
.linkbtn{background:none;border:0;padding:0;font:inherit;color:var(--rose);text-decoration:underline;text-underline-offset:2px;cursor:pointer}
.btn{font:500 16px "Schibsted Grotesk",sans-serif;border-radius:10px;padding:12px 20px;min-height:44px;cursor:pointer;border:1px solid var(--rose);background:var(--rose);color:var(--on-rose)}
.btn:hover{filter:brightness(1.08)}
.btn.ghost{background:transparent;color:var(--ink);border-color:var(--line)}.btn.ghost:hover{background:var(--raised);border-color:var(--dusk);filter:none}
/* something to check: a tinted box with a full border */
.callout{background:var(--tint);border:1px solid var(--tint-line);border-radius:10px;padding:12px 16px}

/* a warning: amber, for warnings only, never for a figure (decision 5, 5 December 2026) */
.warn{background:var(--warn-tint);border:1px solid var(--warn-line);border-radius:10px;padding:10px 14px;font-size:14px;line-height:1.45;color:var(--ink)}
.warn b{color:var(--warn);font-weight:500}

/* figures */
/* key figures as ruled rows, label left and figure right, never a row of tiles */
.stats{border-top:1px solid var(--line);margin-bottom:16px}
.stats>div{display:flex;flex-direction:row-reverse;justify-content:space-between;align-items:baseline;gap:12px;padding:10px 0;border-bottom:1px solid var(--line)}
.stats b{font-weight:500;white-space:nowrap}
.stats span{color:var(--ink)}
.scroll{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:16px}
th,td{padding:8px 12px;border-bottom:1px solid var(--line);text-align:right}
th:first-child,td:first-child{text-align:left}
thead th{color:var(--mute);font-weight:400;font-size:13px}
tr.tot td{font-weight:500;border-bottom:0;border-top:2px solid var(--dusk)}
@media (max-width:420px){table{font-size:14px}th,td{padding:8px 4px}}

/* segmented bars: parts split by a 2px gap in the panel colour, with a key that prints every value */
.stack,.bar{display:flex;height:16px;border-radius:4px;overflow:hidden}
.stack i,.bar i{display:block;height:100%;transition:width .4s cubic-bezier(.22,1,.36,1)}
.stack i+i,.bar i+i{border-left:2px solid var(--panel)}
.key{display:flex;flex-wrap:wrap;gap:4px 16px;font-size:14px;color:var(--mute);margin:8px 0 0}
.key b{font-weight:500;color:var(--ink)}
.key span::before{content:'';display:inline-block;width:10px;height:10px;border-radius:2px;margin-right:6px;background:var(--c)}
svg text{font:13px "Schibsted Grotesk",sans-serif;fill:var(--mute);paint-order:stroke;stroke:var(--panel);stroke-width:4px}
/* chart readout that follows the pointer or the arrow keys */
.readout{position:absolute;z-index:4;pointer-events:none;background:var(--panel);border:1px solid var(--dusk2);border-radius:10px;padding:8px 12px;font-size:14px;line-height:1.4;color:var(--mute);white-space:nowrap;box-shadow:0 4px 16px var(--shadow)}
.readout b{display:block;font:500 18px/1.2 "Schibsted Grotesk",sans-serif;color:var(--ink)}

/* calculator layout: inputs left, the result right and sticky; one column on phones */
.grid{display:grid;grid-template-columns:minmax(0,5fr) minmax(0,7fr);gap:24px;align-items:start}
@media (min-width:821px){.result{position:sticky;top:16px}}
@media (max-width:820px){.grid{grid-template-columns:minmax(0,1fr)}}
/* phones: a dark bar on the bottom edge carries the headline and scrolls to the result */
.sticky{font:500 15px "Schibsted Grotesk",sans-serif;width:100%;border:0;cursor:pointer;text-align:left;text-decoration:none;position:fixed;left:0;right:0;bottom:0;background:var(--ink);color:var(--panel);padding:12px 16px calc(12px + env(safe-area-inset-bottom,0px));display:none;justify-content:space-between;gap:12px;z-index:5}
@media (max-width:820px){.sticky.on{display:flex}}

/* the other calculators: one page column, the calculator grid full width */
.page{max-width:1240px;margin:0 auto;padding:clamp(24px,4vw,56px) max(5vw,16px)}
.page>*{max-width:760px}
.page>h1{max-width:960px;font-size:clamp(28px,4.4vw,44px)}   /* the tools' headings are questions, longer than the main one */
.page>.lede{font-size:16px}
.page>.grid{max-width:none;margin-top:24px}
.page>.grid+p{margin-top:32px}
.page>.modes{margin-top:24px}
.page h2{margin-top:40px;padding-top:20px;border-top:1px solid var(--line)}   /* sections below a calculator are ruled, not boxed */
.page>.note{margin:16px 0 12px}
.page .row2{margin-bottom:12px}
.page .big{font:400 clamp(24px,2.6vw,32px)/1.15 "Schibsted Grotesk",sans-serif;letter-spacing:-.015em;margin:0 0 16px;padding:0;border:0;text-wrap:balance}   /* the answer as a sentence, as on the main calculator */
/* the working inside a result: a plain section under an ink rule (index.html styles its own steps table) */
.work{border-top:1px solid var(--ink);margin:16px 0 0;padding-top:0}
.work>summary{list-style:none;display:flex;justify-content:space-between;align-items:center;padding:14px 0;min-height:44px}
.work>summary::-webkit-details-marker{display:none}
.work>summary::after{content:'Show';font-weight:400;font-size:14px;color:var(--mute)}.work[open]>summary::after{content:'Hide'}
@media (max-width:520px){.page .row2{grid-template-columns:minmax(0,1fr)}}
@media (max-width:820px){.page{padding-bottom:72px}}
.more{font-size:13px}.more a{color:var(--mute);text-decoration:none}.more a:hover{color:var(--ink);text-decoration:underline}
@media (prefers-reduced-motion:reduce){.stack i,.bar i{transition:none}}

/* the logo, top left of every page; 28px tall keeps it above its 120px minimum width */
.brand{display:inline-block;margin:0 0 clamp(16px,3vw,32px)}.brand img{display:block;width:auto;height:28px}
