/* Structure only. Colour, type and corner shape come from each site's theme tokens:
   --bg --surface --ink --muted --line --accent --on-accent --accent-2 --tint
   --font-d --font-b --r (corner radius) --hw (headline weight) */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{margin:0;background:var(--bg);color:var(--ink);font:1rem/1.55 var(--font-b);text-rendering:optimizeLegibility}
a{color:var(--accent-2);text-underline-offset:.18em}
a:hover{text-decoration-thickness:2px}
:focus-visible{outline:3px solid var(--accent-2);outline-offset:2px}
h1,h2,h3{font-family:var(--font-d);font-weight:var(--hw,700);line-height:1.12;letter-spacing:-.01em;margin:0}
h1{font-size:clamp(1.9rem,4.6vw,3.25rem);max-width:20ch}
h2{font-size:clamp(1.3rem,2.4vw,1.75rem);margin-bottom:.6rem}
h3{font-size:1.08rem;margin-bottom:.5rem}
p{margin:0 0 .9rem;max-width:70ch}
small{font-size:.82rem;color:var(--muted)}
.skip{position:absolute;left:-999px}
.skip:focus{left:1rem;top:1rem;background:var(--surface);padding:.5rem .8rem;z-index:9}

.top,main,.foot{width:min(100% - 2rem,74rem);margin-inline:auto}
.top{display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap;padding:1rem 0;border-bottom:1px solid var(--line)}
.brand{display:flex;align-items:center;gap:.6rem;font:700 1.12rem/1 var(--font-d);color:var(--ink);text-decoration:none}
.mark{display:grid;place-items:center;width:2.1rem;height:2.1rem;border-radius:var(--r);background:var(--accent);color:var(--on-accent);font:700 .86rem/1 var(--font-b)}
.top nav{display:flex;gap:1.1rem;flex-wrap:wrap;font-size:.94rem}
.top nav a{color:var(--ink);text-decoration:none;padding:.3rem 0;border-bottom:2px solid transparent}
.top nav a:hover{border-color:var(--accent)}

.top nav a.lang{border:1.5px solid var(--line);border-radius:99px;padding:.2rem .7rem}
.hero{padding:2.4rem 0 1.6rem}
.home .hero{padding-top:3.2rem}
.lede{font-size:1.14rem;color:var(--muted);margin:.9rem 0 0;max-width:58ch}
.crumbs{font-size:.86rem;margin-bottom:.9rem;display:flex;flex-wrap:wrap;gap:.2rem .5rem}
.crumbs a{color:var(--muted)}
.crumbs a::after{content:"/";margin-left:.5rem;color:var(--line)}

/* The tool: inputs on the left, the answer on the right. */
.tool{display:grid;grid-template-columns:minmax(17rem,22rem) minmax(0,1fr);gap:2rem;align-items:start;padding:1.6rem 0 2.4rem;border-top:3px solid var(--ink)}
.tool form{display:grid;gap:.9rem;background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:1.1rem}
.tool>*{min-width:0}
.fld{display:grid;gap:.28rem;min-width:0}
.fld[hidden],.lst[hidden]{display:none}
.fld label,.fld legend,.lst legend{font-weight:650;font-size:.92rem}
.unit{font-style:normal;font-weight:400;color:var(--muted)}
input[type=number],input[type=text],select,textarea{width:100%;font:inherit;color:var(--ink);background:var(--bg);border:1.5px solid var(--line);border-radius:calc(var(--r)*.6);padding:.5rem .6rem;min-height:2.6rem}
input:hover,select:hover{border-color:var(--muted)}
input[type=checkbox]{width:1.1rem;height:1.1rem;accent-color:var(--accent);vertical-align:-.15em}
.chk label{font-weight:500}
fieldset{border:0;margin:0;padding:0;min-width:0}
.multi .opts{display:flex;flex-wrap:wrap;gap:.35rem .5rem;margin-top:.3rem}
.multi .opts label{font-weight:500;font-size:.9rem;border:1.5px solid var(--line);border-radius:99px;padding:.22rem .7rem .22rem .5rem;cursor:pointer;background:var(--bg)}
.multi .opts label:has(:checked){border-color:var(--accent);background:var(--tint)}
.lst{display:grid;gap:.6rem}
.lst .row{display:grid;grid-template-columns:repeat(auto-fit,minmax(6.2rem,1fr));gap:.5rem;align-items:end;padding:.7rem;border:1px dashed var(--line);border-radius:calc(var(--r)*.6)}
.lst .row .fld label{font-size:.8rem;font-weight:600}
button{font:inherit;cursor:pointer;border-radius:calc(var(--r)*.6);border:1.5px solid var(--ink);background:transparent;color:var(--ink);padding:.45rem .85rem;min-height:2.5rem}
button:hover{background:var(--ink);color:var(--bg)}
button.add{border-style:dashed;justify-self:start}
button.del{font-size:.8rem;min-height:2.6rem;border-color:var(--line);color:var(--muted)}
.acts{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;margin-bottom:1.1rem}
.acts button:first-child{background:var(--accent);border-color:var(--accent);color:var(--on-accent);font-weight:650}
.acts button:first-child:hover{filter:brightness(.92)}
#msg{font-size:.88rem;color:var(--muted)}

.sum{display:grid;grid-template-columns:repeat(auto-fit,minmax(9rem,1fr));gap:0;margin:0 0 1.2rem;border-block:1px solid var(--line)}
.sum div{padding:.8rem 1rem .8rem 0}
.sum div+div{padding-left:1rem;border-left:1px solid var(--line)}
.sum dt{font-size:.84rem;color:var(--muted)}
.sum dd{margin:0;font:var(--hw,700) 1.7rem/1.15 var(--font-d);font-variant-numeric:tabular-nums}
.sum dd small{display:block;font:400 .8rem/1.3 var(--font-b);margin-top:.2rem}
.notes{list-style:none;margin:0 0 1.2rem;padding:0;display:grid;gap:.4rem}
.notes li{padding:.55rem .8rem;border-left:4px solid var(--muted);background:var(--surface);font-size:.94rem}
.notes .n-bad{border-color:#b3261e}.notes .n-warn{border-color:#b26a00}.notes .n-ok{border-color:#1b7f4b}
.rsec{margin-bottom:1.6rem}
.note{color:var(--muted);font-size:.92rem}
.fig{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:.8rem;margin-bottom:.8rem;overflow-x:auto}
.fig svg{display:block;width:100%;height:auto;max-height:30rem}
.tw{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:.95rem;font-variant-numeric:tabular-nums}
th,td{text-align:left;padding:.5rem .7rem .5rem 0;border-bottom:1px solid var(--line);vertical-align:top}
thead th{font-size:.82rem;color:var(--muted);font-weight:600;border-bottom:2px solid var(--ink)}
tbody th{font-weight:600}
.ticks{list-style:none;padding:0;margin:0;display:grid;gap:.3rem}
.ticks li{padding-left:1.6rem;position:relative}
.ticks li::before{content:"";position:absolute;left:0;top:.3em;width:.9rem;height:.9rem;border:1.5px solid var(--muted);border-radius:3px}

.block,.prose,.links,.faq{padding:1.8rem 0;border-top:1px solid var(--line)}
.lk{list-style:none;padding:0;margin:.6rem 0 0;display:grid;grid-template-columns:repeat(auto-fill,minmax(14rem,1fr));gap:.1rem 1.6rem}
.lk li{padding:.45rem 0;border-bottom:1px solid var(--line)}
.lk a{font-weight:600;text-decoration:none}
.lk a:hover{text-decoration:underline}
.lk span{display:block;font-size:.84rem;color:var(--muted)}
.lk.tight{grid-template-columns:repeat(auto-fill,minmax(9rem,1fr))}
details{border-bottom:1px solid var(--line);padding:.7rem 0}
summary{font-weight:650;cursor:pointer}
details p{margin:.5rem 0 0}
.foot{border-top:1px solid var(--line);padding:1.4rem 0 2.4rem;margin-top:1rem;font-size:.86rem;color:var(--muted)}
.foot nav{display:flex;flex-wrap:wrap;gap:.4rem 1.2rem}
.foot a{color:var(--muted)}

@media (max-width:52rem){
  .tool{grid-template-columns:minmax(0,1fr);gap:1.4rem}
  .tool form{grid-template-columns:1fr 1fr;align-items:end}
  .tool form>.lst,.tool form>.multi,.tool form>.fld:has(select),.tool form>.fld:has(input[type=text]),.tool form>.fld:has(textarea),.tool form>.chk{grid-column:1/-1}
  .sum div+div{padding-left:.8rem}
}
/* Count fields: thumb-sized minus and plus around the number */
.step{display:grid;grid-template-columns:2.9rem minmax(0,1fr) 2.9rem;gap:.35rem}
.step input{text-align:center;font-variant-numeric:tabular-nums}
.st{min-height:2.9rem;padding:0;font-size:1.35rem;line-height:1;font-weight:600}
input[type=number]{-moz-appearance:textfield}
.step input::-webkit-outer-spin-button,.step input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}

/* Results bar pinned to the bottom of the screen on phones */
.peek{position:fixed;left:0;right:0;bottom:0;z-index:20;display:none;align-items:center;gap:.8rem;
  padding:.65rem 1rem calc(.65rem + env(safe-area-inset-bottom));background:var(--ink);color:var(--bg);box-shadow:0 -6px 18px rgba(0,0,0,.18)}
.peek.on{display:flex}
.peek-v span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.peek-v{margin:0;flex:1;min-width:0;display:flex;flex-direction:column;gap:.05rem;font-size:.84rem;line-height:1.3;font-weight:600;font-variant-numeric:tabular-nums}
.peek-go{flex:none;background:var(--accent);border-color:var(--accent);color:var(--on-accent);font-weight:700;min-height:2.75rem}
.peek-go:hover{background:var(--accent);color:var(--on-accent);filter:brightness(.95)}

@media (max-width:52rem){
  /* Brand on one line, menu as a single swipeable row */
  .top{flex-wrap:nowrap;flex-direction:column;align-items:stretch;gap:.5rem;padding:.75rem 0}
  .top nav{flex-wrap:nowrap;overflow-x:auto;gap:1.2rem;padding-bottom:.2rem;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .top nav::-webkit-scrollbar{display:none}
  .top nav a{white-space:nowrap;padding:.45rem 0}
  .hero{padding:1.6rem 0 1.2rem}
  .home .hero{padding-top:2rem}
  .lede{font-size:1.02rem}
  /* Tap targets of at least 44px */
  button,.acts button{min-height:2.75rem}
  input[type=number],input[type=text],select{min-height:2.9rem;font-size:16px}
  .acts{position:sticky;top:0;z-index:5;background:var(--bg);padding:.5rem 0;margin-top:-.5rem}
  .acts button{flex:1 1 auto}
  .lst .row{grid-template-columns:1fr 1fr}
  .lst .row .del{grid-column:1/-1;justify-self:end;min-height:2.2rem;border:0;background:none;text-decoration:underline;color:var(--muted);padding:0 .2rem}
  summary{padding:.4rem 0}
  .tw{margin-right:-1rem;padding-right:1rem}
  table{font-size:.9rem}
  .foot{padding-bottom:5.5rem}
  #out{scroll-margin-top:4.5rem}
}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
@media print{.peek{display:none!important}}
@media print{
  .top nav,.foot,.acts,.tool form,.links,.faq,.crumbs,.skip{display:none!important}
  body{background:#fff;color:#000}
  .tool{display:block;border:0;padding:0}
  .fig,.notes li{background:#fff}
  .rsec{break-inside:avoid}
}
