/* Shared stylesheet (no framework). Fonts are self-hosted (SIL OFL, see fonts/OFL-*.txt). */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/inter-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("fonts/jetbrains-mono-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Icons: inline SVG from the /assets/icons.svg sprite (Font Awesome Free, CC BY 4.0) */
.ico { display: inline-block; width: 1em; height: 1em; fill: currentColor; vertical-align: -0.125em; flex: none; overflow: visible; }
:root {
  --bg: #f1f5f9;
  --dot: rgba(15, 23, 42, .06);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #cbd5e1;
  --border-soft: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --faint: #64748b;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-ink: #ffffff;
  --accent-soft: rgba(2, 132, 199, .10);
  --hi: #0369a1;
  --amber: #f59e0b;
  --ok: #047857;
  --note-bg: #fffbeb;
  --note-border: #fcd34d;
  --note-text: #78350f;
  --tip-bg: #f0f9ff;
  --tip-border: #7dd3fc;
  --tip-text: #0c4a6e;
  --navy: #0f172a;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 14px rgba(15, 23, 42, .06);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #090d16;
  --dot: rgba(245, 158, 11, .07);
  --surface: #0f172a;
  --surface-2: #020617;
  --border: #1e293b;
  --border-soft: #1e293b;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --faint: #94a3b8;
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --accent-ink: #0f172a;
  --accent-soft: rgba(245, 158, 11, .12);
  --hi: #fbbf24;
  --ok: #34d399;
  --note-bg: rgba(245, 158, 11, .10);
  --note-border: rgba(245, 158, 11, .35);
  --note-text: #fde68a;
  --tip-bg: rgba(14, 165, 233, .10);
  --tip-border: rgba(14, 165, 233, .35);
  --tip-text: #bae6fd;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 20px 20px;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img, svg { max-width: 100%; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
::selection { background: #fbbf24; color: #0f172a; }
.wrap { width: 100%; max-width: 1340px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--amber); color: #0f172a; padding: 8px 12px; border-radius: 8px; z-index: 100; font-weight: 700; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--navy); color: #fff; border-bottom: 2px solid var(--amber); box-shadow: 0 4px 16px rgba(0, 0, 0, .25); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--amber); color: #0f172a; display: grid; place-items: center; font-size: 18px; border: 1px solid #fcd34d; flex: none; }
.brand-name { font-weight: 900; font-size: 20px; letter-spacing: -.02em; line-height: 1.1; }
.brand-name span { color: #fbbf24; }
.brand-tag { display: block; font-size: 11px; color: #cbd5e1; font-weight: 500; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.hbtn { background: #1e293b; color: #f1f5f9; border: 1px solid #334155; border-radius: 12px; padding: 8px 12px; font: 600 13px/1.2 var(--sans); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.hbtn:hover { background: #334155; color: #fff; }
.hbtn .ico { color: #fbbf24; }

/* Mega menu (works without JS via <details>) */
.menu { position: static; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; left: 0; right: 0; top: 100%; background: var(--navy); border-bottom: 2px solid var(--amber); box-shadow: 0 16px 32px rgba(0, 0, 0, .35); max-height: calc(100vh - 66px); overflow-y: auto; }
.menu-panel .wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; padding-top: 18px; padding-bottom: 22px; align-items: start; }
.menu-col h3 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: #fbbf24; font-family: var(--mono); }
.menu-col a { display: block; color: #e2e8f0; text-decoration: none; padding: 5px 0; font-size: 14px; font-weight: 500; }
.menu-col a:hover, .menu-col a[aria-current="page"] { color: #fbbf24; }

/* Right-hand navigation (calculator and guide pages). Only on wide screens; smaller screens use the header menu. */
.sidenav { display: none; }
@media (min-width: 1100px) {
  .with-side { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 24px; align-items: start; }
  .sidenav { display: block; position: sticky; top: 84px; }
  .sidenav-in { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 10px; max-height: calc(100vh - 104px); overflow-y: auto; scrollbar-width: thin; }
  .sidenav-h { margin: 0 6px 8px; font: 700 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--hi); }
  .sidenav details + details { border-top: 1px solid var(--border-soft); }
  .sidenav summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 9px 6px; font-size: 13.5px; font-weight: 750; color: var(--text); cursor: pointer; border-radius: 8px; }
  .sidenav summary::-webkit-details-marker { display: none; }
  .sidenav summary:hover { background: var(--accent-soft); }
  .sidenav summary .ico { color: var(--accent); }
  .sidenav summary span { flex: 1; min-width: 0; }
  .sidenav summary b { font: 700 11px/1 var(--mono); color: var(--faint); background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 999px; padding: 3px 7px; }
  .sidenav details > div { display: flex; flex-direction: column; padding: 2px 0 8px 14px; margin-left: 12px; border-left: 2px solid var(--border-soft); }
  .sidenav details a { color: var(--muted); text-decoration: none; font-size: 13.5px; padding: 5px 8px; border-radius: 6px; line-height: 1.35; }
  .sidenav details a:hover { color: var(--accent); background: var(--accent-soft); }
  .sidenav details a[aria-current="page"] { color: var(--hi); background: var(--accent-soft); font-weight: 750; box-shadow: inset 3px 0 0 var(--accent); }
  .sidenav-ask { display: flex; align-items: center; gap: 7px; margin: 8px 6px 0; font-size: 13px; font-weight: 700; text-decoration: none; color: var(--muted); }
  .sidenav-ask .ico { color: var(--amber); }
  .sidenav-ask:hover { color: var(--accent); }
  .sidenav-all { display: block; margin: 10px 6px 0; padding-top: 10px; border-top: 1px solid var(--border-soft); font-size: 13px; font-weight: 700; text-decoration: none; }
}
@media print { .sidenav { display: none !important; } .with-side { display: block; } }

/* ---------- Page head ---------- */
main { flex: 1 0 auto; padding: 20px 0 40px; }
.crumbs { font-size: 13px; color: var(--faint); margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.crumbs li + li::before { content: "›"; margin-right: 6px; color: var(--border); }
.crumbs a { color: var(--faint); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.page-head { margin-bottom: 18px; }
.kicker { display: inline-block; font: 700 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--hi); background: var(--accent-soft); border: 1px solid var(--accent-soft); padding: 6px 9px; border-radius: 7px; }
h1 { font-size: clamp(26px, 4.2vw, 38px); line-height: 1.15; letter-spacing: -.025em; margin: 10px 0 8px; font-weight: 900; }
.lead { font-size: 17px; color: var(--muted); margin: 0; max-width: 820px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.stack > * + * { margin-top: 20px; }
.card > h2 { font-size: 22px; line-height: 1.25; letter-spacing: -.015em; margin: 0 0 14px; font-weight: 850; }
.prose > h2:first-child { margin-top: 0; }

/* ---------- Calculator layout ---------- */
.calc-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 20px; align-items: start; margin-bottom: 20px; }
.calc-form { display: flex; flex-direction: column; gap: 16px; }
.form-h { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 4px 0 -4px; font-weight: 800; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .lbl { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.help { font-size: 12.5px; color: var(--faint); line-height: 1.45; }
.inp { position: relative; display: flex; align-items: stretch; }
.inp input, .field select {
  width: 100%; min-width: 0; font: 700 16px/1.3 var(--mono); color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 11px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.field select { font: 600 14.5px/1.35 var(--sans); padding-right: 34px; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%), linear-gradient(135deg, var(--faint) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 12px) 52%; background-size: 6px 6px; background-repeat: no-repeat; }
.inp input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inp .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 700 13px var(--mono); color: var(--faint); pointer-events: none; }
.inp.has-unit input { padding-right: 46px; }
.inp .pre { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font: 700 15px var(--mono); color: var(--ok); pointer-events: none; }
.inp.has-pre input { padding-left: 28px; color: var(--ok); }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { opacity: .5; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.panel { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
[hidden] { display: none !important; }

/* Diagrams: inline SVG figures inside calculator forms */
:root { --dg-brick: #c2410c; --dg-brick-2: #9a3412; --dg-mortar: #e2e8f0; --dg-block: #94a3b8; --dg-slab: #a8a29e; --dg-bed: #e8d5a8; --dg-mot: #cbd5e1; --dg-mot-dot: #64748b; --dg-soil: #a16207; --dg-soil-2: #854d0e; --dg-timber: #d6a86b; --dg-timber-2: #a0703a; --dg-conc: #b8b8b2; --dg-conc-top: #dcdcd6; --dg-conc-side: #9a9a93; }
:root[data-theme="dark"] { --dg-timber: #9a6a35; --dg-timber-2: #6b4520; --dg-conc: #6b6b66; --dg-conc-top: #85857f; --dg-conc-side: #55554f;--dg-brick: #ea580c; --dg-brick-2: #c2410c; --dg-mortar: #334155; --dg-block: #64748b; --dg-slab: #78716c; --dg-bed: #a8915e; --dg-mot: #475569; --dg-mot-dot: #94a3b8; --dg-soil: #854d0e; --dg-soil-2: #713f12; }
.dg { margin: 0; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 14px; padding: 12px 12px 10px; }
/* SVG text is sized for ~11px on phones; max-width keeps it ~15px on desktop */
.dg svg { display: block; width: 100%; max-width: 400px; height: auto; margin: 0 auto; }
.dg figcaption { font-size: 12.5px; line-height: 1.45; color: var(--faint); margin-top: 6px; }
.dg text { font-family: var(--sans); font-size: 20px; font-weight: 600; fill: var(--muted); }
.dg .dg-h { font-size: 21px; font-weight: 800; fill: var(--text); }
.dg .dg-s { font-size: 18px; fill: var(--faint); }
.dg .dg-line { stroke: var(--faint); stroke-width: 1.2; fill: none; }
.dg .dg-line-w { stroke: #fff; stroke-width: 1.2; fill: none; }
.dg .dg-brick { fill: var(--dg-brick); stroke: var(--dg-brick-2); stroke-width: 1; }
.dg .dg-block { fill: var(--dg-block); }
.dg .dg-mortar { fill: var(--dg-mortar); }
.dg .dg-slab { fill: var(--dg-slab); }
.dg .dg-bed { fill: var(--dg-bed); }
.dg .dg-mot { fill: var(--dg-mot); }
.dg .dg-mot-dot { fill: var(--dg-mot-dot); }
.dg .dg-soil { fill: var(--dg-soil); }
.dg .dg-soil-line { stroke: var(--dg-soil-2); stroke-width: 2; }
.dg .dg-tie { stroke: var(--faint); stroke-width: 2; stroke-dasharray: 4 3; fill: none; }
.dg .dg-frame { fill: none; stroke: transparent; stroke-width: 2.5; }
.dg .dg-timber { fill: var(--dg-timber); stroke: var(--dg-timber-2); stroke-width: 1; }
.dg .dg-slat { stroke: var(--dg-timber-2); stroke-width: 1; }
.dg .dg-joint { stroke: var(--dg-mortar); stroke-width: 3; }
.dg .dg-conc { fill: var(--dg-conc); } .dg .dg-conc-top { fill: var(--dg-conc-top); } .dg .dg-conc-side { fill: var(--dg-conc-side); }
.dg .dg-ins { fill: var(--dg-ins); stroke: var(--dg-ins-2); stroke-width: 1; }
.dg .dg-ins-2 { fill: var(--dg-ins-top); stroke: var(--dg-ins-2); stroke-width: 1; }
.dg .dg-ceil { fill: var(--dg-mortar); }
:root { --dg-ins: #fde68a; --dg-ins-top: #fcd34d; --dg-ins-2: #d97706; }
:root[data-theme="dark"] { --dg-ins: #a16207; --dg-ins-top: #ca8a04; --dg-ins-2: #fbbf24; }
.dg .dg-roof { fill: none; stroke: var(--dg-brick); stroke-width: 9; stroke-linejoin: round; stroke-linecap: round; }
.dg .dg-pipe { fill: var(--surface); stroke: var(--text); stroke-width: 2; }
.dg .dg-joist { stroke: var(--dg-timber-2); stroke-width: 3; stroke-dasharray: 6 4; }
.dg .dg-post { fill: var(--text); }
.dg text.dg-w { fill: #fff; }
.dg text.dg-halo { fill: var(--text); paint-order: stroke; stroke: var(--dg-mot); stroke-width: 6px; stroke-linejoin: round; }
.dg-opt { transition: opacity .2s; }
/* The page script sets data-sel to the picked option; .dg-opt.dg-<value> is highlighted (all shown until then) */
.dg[data-sel] .dg-opt { opacity: .4; }
.dg[data-sel="single"] .dg-single, .dg[data-sel="double"] .dg-double, .dg[data-sel="cavity"] .dg-cavity { opacity: 1; }
.dg[data-sel="single"] .dg-single .dg-frame, .dg[data-sel="double"] .dg-double .dg-frame, .dg[data-sel="cavity"] .dg-cavity .dg-frame { stroke: var(--accent); }

.seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.seg label { flex: 1 1 auto; position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: 8px 10px; border-radius: 9px; font-size: 13.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 3px solid var(--amber); }

.check { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14.5px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.presets .lbl { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 4px; }
.chip { font: 700 13px/1.2 var(--mono); padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Result panel ---------- */
.result { scroll-margin-top: 80px; border: 2px solid var(--accent); position: sticky; top: 84px; display: flex; flex-direction: column; gap: 16px; }
.res-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding-bottom: 14px; border-bottom: 1px solid var(--border-soft); }
.res-label { font: 800 12px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--hi); }
.res-value { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; }
.res-value b { font: 900 clamp(38px, 6vw, 52px)/1 var(--mono); letter-spacing: -.03em; }
.res-value b.long { font-size: clamp(28px, 3.6vw, 38px); }
.res-value span { font: 700 15px var(--mono); color: var(--faint); }
.res-sub { font: 500 12.5px/1.45 var(--mono); color: var(--faint); margin-top: 6px; }
.res-badge { text-align: right; flex: none; }
.res-badge small { display: block; font: 600 11px var(--mono); text-transform: uppercase; color: var(--faint); }
.res-badge strong { font: 800 18px var(--mono); }
.res-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 12px; padding: 11px 12px; }
.stat small { display: block; font-size: 12px; font-weight: 600; color: var(--faint); line-height: 1.3; }
.stat strong { display: block; font: 800 19px/1.25 var(--mono); margin-top: 3px; color: var(--hi); overflow-wrap: anywhere; }
.stat span { display: block; font: 500 11.5px/1.35 var(--mono); color: var(--faint); margin-top: 2px; }
.note { background: var(--note-bg); border: 1px solid var(--note-border); color: var(--note-text); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.5; }
.note strong:first-child { display: block; margin-bottom: 2px; }
.tip { background: var(--tip-bg); border: 1px solid var(--tip-border); color: var(--tip-text); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.5; }
.cost { background: #0f172a; color: #fff; border-radius: 12px; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid #1e293b; }
.cost small { display: block; font-size: 12.5px; color: #cbd5e1; font-weight: 600; }
.cost span { display: block; font: 500 11.5px/1.4 var(--mono); color: #94a3b8; }
.cost b { font: 900 26px var(--mono); color: #fbbf24; white-space: nowrap; }
.res-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 800 13.5px/1.2 var(--sans); padding: 11px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn .ico { color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary .ico { color: inherit; }
.btn.primary:hover { background: var(--accent-hover); color: var(--accent-ink); }

/* ---------- Content ---------- */
.prose { font-size: 16px; line-height: 1.7; color: var(--muted); }
.prose h2 { color: var(--text); font-size: 23px; line-height: 1.25; letter-spacing: -.015em; margin: 28px 0 10px; font-weight: 850; }
.prose h3 { color: var(--text); font-size: 18px; margin: 22px 0 8px; font-weight: 800; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose strong { color: var(--text); }
.prose code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); border: 1px solid var(--border-soft); padding: 1px 5px; border-radius: 5px; }
.formula { font: 600 14px/1.6 var(--mono); background: var(--surface-2); border: 1px solid var(--border-soft); border-left: 4px solid var(--accent); padding: 12px 14px; border-radius: 10px; color: var(--text); margin: 0 0 14px; overflow-x: auto; white-space: pre-wrap; }
.table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
th { background: #0f172a; color: #fff; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:nth-child(even) td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td { font-family: var(--mono); font-size: 13.5px; color: var(--text); }
td:first-child { font-weight: 700; }

.faq { margin-top: 20px; }
.faq details { border: 1px solid var(--border-soft); border-radius: 12px; padding: 0 14px; background: var(--surface-2); }
.faq details + details { margin-top: 10px; }
.faq summary { cursor: pointer; font-weight: 800; padding: 13px 0; color: var(--text); list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 800 18px var(--mono); color: var(--accent); }
.faq details[open] summary::after { content: "–"; }
.faq .ans { padding: 0 0 14px; color: var(--muted); }
.faq .ans p:last-child { margin-bottom: 0; }

.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tool { border: 1px solid var(--border-soft); background: var(--surface-2); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text); }
.tool:hover { border-color: var(--accent); color: var(--text); }
.tool strong { font-size: 15px; line-height: 1.35; }
.tool span { font-size: 13.5px; color: var(--faint); flex: 1; }
.tool em { font-style: normal; font-weight: 800; font-size: 13px; color: var(--accent); }
.disclosure { font-size: 12.5px; color: var(--faint); margin: 12px 0 0; }
.tools-box > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tools-box > summary::-webkit-details-marker { display: none; }
.tools-box > summary h2 { margin: 0; font-size: 18px; }
.tools-box > summary::after { content: "+"; font: 800 20px var(--mono); color: var(--accent); }
.tools-box[open] > summary { margin-bottom: 14px; }
.tools-box[open] > summary::after { content: "–"; }

.checked { margin: 10px 0 0; font-size: 13.5px; color: var(--faint); display: flex; align-items: center; gap: 6px; }
.checked .ico { color: var(--accent); }

/* Manual ad units (only present when config.json has adsenseSlots); fixed min-height avoids layout shift */
.ad-slot { margin: 0 0 20px; text-align: center; min-height: 280px; }
.ad-slot .ad-label { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 4px; }
.prose .ad-slot { margin: 22px 0; min-height: 250px; }
.sidenav .ad-slot { margin: 14px 0 0; min-height: 250px; }
.sidenav:has(.ad-slot) .sidenav-in { max-height: calc(100vh - 384px); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.ccard { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.ccard:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.ccard .ic { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--hi); font-size: 18px; }
.ccard strong { display: block; font-size: 16px; line-height: 1.3; }
.ccard span { display: block; font-size: 13.5px; color: var(--faint); margin-top: 3px; line-height: 1.45; }
.cat-h { display: flex; align-items: center; gap: 10px; font-size: 21px; margin: 34px 0 14px; letter-spacing: -.01em; scroll-margin-top: 90px; }
.cat-h .ico { color: var(--amber); }
.cat-more { margin-left: auto; font-size: 14px; font-weight: 700; white-space: nowrap; }
.menu-col h3 a { color: inherit; text-decoration: none; }
.menu-col h3 a:hover { text-decoration: underline; }
.hub-cards { margin-bottom: 24px; }

/* Email sign-up line under a result */
.sub-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border); font-size: 14px; color: var(--muted); }
.sub-line .ico { color: var(--accent); }
.sub-line a { font-weight: 800; }

/* Header search pop-up */
.srch { margin: 4px 0 10px; }
.srch-res { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; }
.srch-res a { display: flex; flex-direction: column; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 10px; text-decoration: none; color: var(--text); background: var(--surface-2); }
.srch-res a:hover, .srch-res a:focus { border-color: var(--accent); }
.srch-res span { font-size: 12.5px; color: var(--faint); }
.srch-none { color: var(--muted); font-size: 14px; padding: 6px 2px; }

/* "Read the guide / Plan the whole project" links under a calculator */
.learn { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 0 0 20px; }
.learn-i { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-left: 4px solid var(--amber); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.learn-i:hover { border-color: var(--accent); color: var(--text); }
.learn-i .ico { font-size: 20px; color: var(--amber); flex: none; }
.learn-i small { display: block; font: 700 11px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin-bottom: 3px; }
.learn-i strong { font-size: 15.5px; line-height: 1.3; }

/* Home hero */
.hero { background: var(--navy); color: #fff; border-radius: 20px; padding: 28px 22px; border: 1px solid #1e293b; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(245, 158, 11, .14) 1px, transparent 1px); background-size: 18px 18px; pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; margin-top: 12px; }
.hero h1 span { color: #fbbf24; }
.hero p { color: #cbd5e1; font-size: 17px; max-width: 760px; margin: 0; }
.hero .kicker { color: #fbbf24; background: rgba(245, 158, 11, .15); border-color: rgba(245, 158, 11, .35); }
.search { margin-top: 20px; position: relative; max-width: 560px; }
.search input { width: 100%; font: 600 16px var(--sans); padding: 14px 16px 14px 44px; border-radius: 14px; border: 2px solid #f59e0b; background: #fff; color: #0f172a; }
.search .ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #64748b; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; font: 600 13px var(--mono); color: #cbd5e1; }
.hero-stats .ico { color: #fbbf24; margin-right: 6px; }
.hero p.hero-own { font-size: 14.5px; margin-top: 12px; }
.hero-own a { color: #fbbf24; font-weight: 700; }
.hero-own a:hover { color: #fde68a; }
.empty { display: none; padding: 20px; text-align: center; color: var(--faint); }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 32px 0 22px; font-size: 14px; color: var(--faint); }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 22px; }
.foot-grid h3 { font: 800 11.5px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--text); margin: 0 0 8px; }
.foot-grid a { display: block; color: var(--faint); text-decoration: none; padding: 3px 0; }
.foot-grid a:hover { color: var(--accent); }
.foot-legal { border-top: 1px solid var(--border-soft); margin-top: 24px; padding-top: 16px; font-size: 13px; line-height: 1.6; }

/* Toast */
.toast { position: fixed; right: 16px; bottom: 16px; z-index: 60; background: #0f172a; color: #fff; border: 2px solid #f59e0b; border-radius: 12px; padding: 11px 14px; font-weight: 700; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); display: flex; gap: 8px; align-items: center; transform: translateY(150%); transition: transform .25s; max-width: calc(100vw - 32px); }
.toast.show { transform: none; }
.toast .ico { color: #fbbf24; }
.print-head { display: none; }

/* Merchant prices */
.price-hint { font-size: 12.5px; line-height: 1.45; color: var(--faint); margin-top: -2px; }
.price-hint b { color: var(--ok); font-family: var(--mono); }
.price-hint a { font-weight: 700; }
.price-hint .ph-item { display: block; font-size: 11.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buy { border: 1px solid var(--border-soft); background: var(--surface-2); border-radius: 12px; padding: 12px 12px 10px; }
.buy-h { display: flex; align-items: center; gap: 7px; font: 800 12px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--hi); margin-bottom: 8px; }
.buy-t { font-size: 13.5px; }
.buy-t td { padding: 7px 0; border-bottom: 1px dashed var(--border-soft); background: transparent !important; font-family: var(--sans); vertical-align: middle; }
.buy-t tr:last-child td { border-bottom: 0; }
.buy-n { display: block; font-weight: 700; color: var(--text); }
.buy-q { font: 600 12px var(--mono); color: var(--faint); }
.buy-o { text-align: right; }
.buy-o a { display: inline-block; margin: 2px 0 2px 6px; padding: 3px 8px; border-radius: 8px; border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; text-decoration: none; color: var(--text); background: var(--surface); white-space: nowrap; }
.buy-o a b { font-family: var(--mono); }
.buy-o a.best { border-color: var(--ok); color: var(--ok); }
.buy-o a:hover { border-color: var(--accent); }
.buy-tot { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.buy-tot b { font-family: var(--mono); color: var(--text); }
.buy-tot span:first-child b { color: var(--ok); }
.buy-note { margin: 8px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--faint); }
@media (max-width: 480px) { .buy-t td { display: block; text-align: left; padding: 4px 0; } .buy-t tr { display: block; padding: 4px 0; border-bottom: 1px dashed var(--border-soft); } .buy-t td { border: 0; } .buy-o a { margin: 2px 6px 2px 0; } }

/* Embedded calculators (/embed/<slug>/) */
body.embed { min-height: 0; background-image: none; }
body.embed main { padding: 12px 0 8px; }
body.embed .wrap { padding: 0 12px; }
body.embed .result { top: 12px; }
body.embed .resbar { display: none !important; }
body.embed .calc-grid { margin-bottom: 10px; }
.embed-h { font-size: 22px; margin: 0 0 12px; letter-spacing: -.02em; }
.embed-credit { margin: 0; text-align: center; font-size: 13px; color: var(--faint); }
.embed-cta { margin: 0; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.embed-cta .ico { color: var(--accent); }
.embed-code { width: 100%; min-height: 150px; font: 500 13px/1.5 var(--mono); color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; resize: vertical; }
.embed-preview { border: 1px dashed var(--border); border-radius: 14px; padding: 10px; background: var(--surface-2); }
.embed-preview iframe { width: 100%; border: 0; height: 900px; display: block; background: var(--bg); border-radius: 10px; }

/* Cookie consent */
.cc { position: fixed; z-index: 70; left: 16px; bottom: 16px; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); color: var(--text); border: 2px solid var(--amber); border-radius: 16px; padding: 18px; box-shadow: 0 18px 50px rgba(0, 0, 0, .35); font-size: 14px; line-height: 1.55; }
.cc h2 { margin: 0 0 8px; font-size: 17px; display: flex; gap: 8px; align-items: center; }
.cc h2 .ico { color: var(--amber); }
.cc p { margin: 0 0 12px; color: var(--muted); }
.cc-details { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.cc-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.cc-row small { display: block; color: var(--faint); font-size: 12.5px; }
.cc-row input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.cc-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cc-btns .btn { padding: 10px 8px; font-size: 13px; }
.cc-btns [data-cc="accept"], .cc-btns [data-cc="reject"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (max-width: 480px) { .cc { left: 8px; right: 8px; bottom: 8px; width: auto; } .cc-btns { grid-template-columns: 1fr 1fr; } .cc-btns [data-cc="manage"] { grid-column: 1 / -1; grid-row: 2; } }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.linkbtn:hover { color: var(--accent-hover); }
.callout { margin-bottom: 18px; }
.callout strong:first-child { display: block; }
.legal-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; }
.legal-links a, .legal-links button { color: var(--faint); font: inherit; font-size: 13px; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.legal-links a:hover, .legal-links button:hover { color: var(--accent); }
.resbar { display: none; }
@media (max-width: 900px) {
  .resbar { display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 35; align-items: center; gap: 10px; background: #0f172a; color: #fff; border: 2px solid #f59e0b; border-radius: 14px; padding: 11px 14px; text-decoration: none; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); transition: transform .2s, opacity .2s; }
  .resbar:hover { color: #fff; }
  .resbar span { font-size: 12.5px; color: #cbd5e1; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .resbar b { font: 800 16px var(--mono); color: #fbbf24; white-space: nowrap; }
  .resbar .ico { color: #fbbf24; }
  .resbar.away { transform: translateY(150%); opacity: 0; pointer-events: none; }
}

/* ---------- Responsive ---------- */
.hide-sm { display: inline; }
@media (max-width: 900px) {
  .calc-grid { grid-template-columns: 1fr; }
  .result { position: static; }
}
@media (max-width: 640px) {
  .brand-tag, .hide-sm { display: none; }
  .brand-name { font-size: 18px; }
  .card { padding: 16px; }
  .hbtn { padding: 8px 10px; }
  .res-actions { grid-template-columns: 1fr 1fr; }
  .res-actions .btn:last-child { grid-column: 1 / -1; }
  .lead { font-size: 16px; }
  .hero { padding: 22px 16px; }
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff !important; color: #000 !important; }
  :root { --surface: #fff; --surface-2: #fff; --text: #000; --muted: #222; --faint: #444; --hi: #000; --border: #999; --border-soft: #bbb; --accent: #000; }
  .site-header, .site-footer, .calc-form, .no-print, .res-actions, .crumbs, .toast, .lead, .kicker { display: none !important; }
  .calc-grid { display: block; }
  .result { border: 1px solid #000; box-shadow: none; position: static; }
  .cost { background: #fff; color: #000; border: 1px solid #000; }
  .cost b, .cost small, .cost span { color: #000; }
  .print-head { display: block; font-size: 12px; margin-bottom: 8px; }
  main { padding: 0; }
}

/* Saved jobs: header badge, "Add to job" pop-up and the /my-jobs/ page */
.jobs-count { background: #f59e0b; color: #0f172a; border-radius: 999px; min-width: 18px; padding: 1px 5px; font: 800 11px/16px var(--mono); text-align: center; }
.res-actions.job-actions { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 8px; }
/* Text-heavy tables in guides: normal font, and on phones scroll sideways rather than squash */
.table-text td { font-family: var(--sans); font-size: 14.5px; line-height: 1.45; vertical-align: top; }
@media (max-width: 560px) { .prose .table-text table { min-width: 560px; } }
/* Planners inside guides (e.g. the garden wall planner) */
.wp { background: var(--surface-2); border: 1px solid var(--border-soft); border-left: 4px solid var(--accent); border-radius: 14px; padding: 16px; margin: 0 0 12px; display: flex; flex-direction: column; gap: 14px; }
.wp .table-wrap { margin: 0; background: var(--surface); }
.wp td { vertical-align: top; }
.wp td .help { font-size: 12.5px; }
.wp td { font-family: var(--sans); }
@media (max-width: 560px) {
  .wp { padding: 12px; margin-left: -4px; margin-right: -4px; }
  .wp thead { display: none; }
  .wp table, .wp tbody, .wp tr, .wp td { display: block; width: 100%; }
  .wp tr { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
  .wp td { border: 0 !important; padding: 2px 0 !important; text-align: left; }
  .wp td:nth-child(2) { font-weight: 700; color: var(--text); }
}
.wp .cost { margin: 0; }
.res-actions.wp-act { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.wp-act .btn { text-decoration: none; }
.prose .checklist { list-style: none; padding-left: 0; }
.prose .checklist li { position: relative; padding-left: 30px; }
.prose .checklist li::before { content: ""; position: absolute; left: 2px; top: 4px; width: 16px; height: 16px; border: 2px solid var(--accent); border-radius: 4px; }
.jdlg { position: fixed; inset: 0; z-index: 80; background: rgba(2, 6, 23, .6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.jdlg[hidden] { display: none; }
.jdlg-box { position: relative; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow: auto; }
.jdlg-box h2 { display: flex; align-items: center; gap: 8px; font-size: 20px; line-height: 1.3; margin: 0 28px 8px 0; }
.jdlg-box h2 .ico { color: var(--accent); }
.jdlg-x { position: absolute; top: 12px; right: 12px; background: none; border: 0; color: var(--faint); font-size: 18px; cursor: pointer; padding: 4px; }
.jdlg-p { margin: 0 0 14px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.jdlg-form fieldset { border: 0; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.jdlg-form legend, .jdlg-lbl { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 6px; padding: 0; }
.jdlg-lbl { display: grid; gap: 6px; margin-bottom: 14px; }
.jdlg-lbl span { font-weight: 500; color: var(--faint); }
.jdlg-opt { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 700; font-size: 14.5px; }
.jdlg-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.jdlg-opt input { accent-color: var(--accent); width: 17px; height: 17px; margin: 0; }
.jdlg-opt small { display: block; font-weight: 500; font-size: 12px; color: var(--faint); }
.jdlg-in { width: 100%; font: 600 15px/1.3 var(--sans); color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.jdlg-in:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea.jdlg-in { resize: vertical; min-height: 96px; font-weight: 500; line-height: 1.45; }
/* Visitor messages (suggest a calculator / report a problem) */
.fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.fb-note { margin: -4px 0 12px; font-size: 12.5px; color: var(--faint); }
.fb-err { margin: 0 0 12px; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; background: var(--note-bg); border: 1px solid var(--note-border); color: var(--note-text); }
.fb-link { margin: 12px 0 0; text-align: center; font-size: 13px; }
.fb-link a { color: var(--faint); display: inline-flex; align-items: center; gap: 6px; }
.fb-link a:hover { color: var(--accent); }
.fb-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.empty .btn { margin: 4px 4px 0; }
.ask-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ask-card .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--note-bg); color: var(--amber); font-size: 20px; flex: none; }
.ask-card > div { flex: 1 1 260px; }
.ask-card h2 { margin: 0 0 2px; font-size: 19px; }
.ask-card p { margin: 0; color: var(--muted); }
.jdlg-act { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.jobs-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.jobs-bar select { flex: 1 1 220px; min-width: 0; font: 700 15px/1.3 var(--sans); color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; }
.job-head h2 { margin: 0; font-size: 24px; letter-spacing: -.015em; }
.job-meta { margin: 4px 0 0; font-size: 13px; color: var(--faint); }
.job-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.job-tools .btn { padding: 9px 11px; }
.shop-t { width: 100%; border-collapse: collapse; font-size: 15px; }
.shop-t td { padding: 9px 6px; border-bottom: 1px solid var(--border-soft); vertical-align: top; font-family: var(--sans); font-size: 15px; font-weight: 400; }
/* Phones: logo on its own row, then the header buttons as a labelled row (icon above a short label),
   like an app's tab bar. The header scrolls away here instead of sticking, so it costs no screen space. */
@media (max-width: 760px) {
  .site-header { position: relative; }
  .site-header .wrap { flex-wrap: wrap; row-gap: 8px; min-height: 0; padding-top: 10px; padding-bottom: 10px; }
  .head-actions { width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
  .head-actions .menu { display: block; }
  .head-actions .hbtn { width: 100%; flex-direction: column; justify-content: center; gap: 3px; padding: 7px 4px; font-size: 11.5px; position: relative; white-space: nowrap; }
  .head-actions .hbtn .ico { width: 18px; height: 18px; }
  .head-actions .hbtn .hide-sm { display: inline; }
  .head-actions .jobs-count { position: absolute; top: 3px; right: 6px; }
}
@media (max-width: 440px) {
  .brand { gap: 8px; }
  .brand-mark { width: 36px; height: 36px; }
}
.shop-t td:first-child { width: 34px; }
.shop-t input { width: 19px; height: 19px; accent-color: var(--ok); margin: 2px 0 0; cursor: pointer; }
.shop-t .q { text-align: right; font: 800 15px var(--mono); white-space: nowrap; }
.shop-t .src { display: block; font-size: 12px; color: var(--faint); margin-top: 2px; }
.shop-t label { font-weight: 700; cursor: pointer; }
.shop-t tr.done label, .shop-t tr.done .q { text-decoration: line-through; color: var(--faint); }
.job-items { display: grid; gap: 12px; }
.job-item { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.job-item h3 { margin: 0; font-size: 16px; }
.job-item h3 small { font-weight: 600; color: var(--faint); }
.job-item .big { font: 900 22px var(--mono); color: var(--hi); margin: 6px 0 2px; }
.job-item details { margin-top: 8px; font-size: 14px; }
.job-item summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.job-item dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 0; }
.job-item dt { color: var(--faint); }
.job-item dd { margin: 0; font-family: var(--mono); font-weight: 600; }
.job-item .row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.job-item .row-btns .btn { padding: 8px 10px; font-size: 13px; }
.job-banner { border: 2px solid var(--amber); }
.job-empty { text-align: center; padding: 34px 20px; }
.job-empty .ico { font-size: 34px; color: var(--accent); }
@media print {
  .jobs-bar, .job-tools, .job-item .row-btns, .job-banner { display: none !important; }
  .job-item details { display: block; }
  .job-item details > * { display: block; }
}

/* "Next for this job" links under a result (and in the Add to job dialog) */
.next { border: 1px solid var(--border-soft); background: var(--surface-2); border-radius: 12px; padding: 12px 12px 10px; }
.next-h { display: flex; align-items: center; gap: 7px; font: 800 12px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--hi); margin-bottom: 8px; }
.next ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.next a { display: block; padding: 9px 34px 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); text-decoration: none; position: relative; line-height: 1.35; }
.next a::after { content: "→"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--accent); font-weight: 800; }
.next a:hover { border-color: var(--accent); }
.next a b { display: block; font-size: 14.5px; }
.next a span { display: block; font-size: 12.5px; color: var(--faint); }
.next-note { margin: 8px 0 0; font-size: 12px; color: var(--faint); }
.jdlg-body .next { margin: 0 0 14px; }

/* Install-the-app strip */
.inst { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; border: 1px dashed var(--accent); border-radius: 12px; padding: 12px; background: var(--accent-soft); font-size: 13.5px; line-height: 1.45; }
.inst > .ico { font-size: 22px; color: var(--accent); }
.inst > span:first-of-type { flex: 1 1 200px; color: var(--muted); }
.inst b { display: block; color: var(--text); font-size: 14.5px; }
.inst-b { display: flex; align-items: center; gap: 12px; }
.inst-b .btn { padding: 8px 14px; }
.jdlg-body .inst { margin: 0 0 14px; }

/* "Your last measurements are filled in" */
.restored { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 14px; padding: 8px 12px; border-radius: 10px; background: var(--tip-bg); border: 1px solid var(--tip-border); color: var(--tip-text); font-size: 13.5px; }
.restored .linkbtn { color: inherit; font-weight: 700; }

/* Homepage: pick up where you left off */
.resume { margin: 0 0 28px; }
.resume-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 14px; margin-bottom: 12px; }
.resume-h h2 { margin: 0; font-size: 19px; display: flex; align-items: center; gap: 8px; }
.resume-h h2 .ico { color: var(--amber); }
.resume-h .linkbtn { font-size: 13px; color: var(--faint); }
.resume-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.resume-c { display: block; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); color: var(--text); text-decoration: none; line-height: 1.35; }
.resume-c:hover { border-color: var(--accent); color: var(--text); }
.resume-c small { display: block; font: 700 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.resume-c b { display: block; font-size: 14.5px; margin-top: 2px; }
.resume-c span { display: block; font-size: 12.5px; color: var(--ok); margin-top: 2px; }
.resume-c.job { border: 2px solid var(--amber); }
#projects { margin-bottom: 30px; }

/* Project planners */
.proj { display: grid; gap: 18px; }
.proj-in h2 { margin: 0 0 2px; font-size: 20px; }
.proj-in > .help { margin: 0 0 12px; }
.proj-form .row { margin: 0; }
.proj-job { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; border: 2px solid var(--amber); border-radius: 12px; padding: 12px 14px; background: var(--note-bg); }
.proj-job:empty { display: none; }
.proj-job > div { flex: 1 1 260px; }
.proj-job b { display: flex; align-items: center; gap: 7px; font-size: 15.5px; }
.proj-job span { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.proj-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.proj-steps li { display: flex; align-items: center; gap: 14px; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.proj-steps li.done { border-color: var(--ok); }
.proj-n { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font: 900 15px var(--mono); background: var(--accent-soft); color: var(--hi); }
.proj-steps li.done .proj-n { background: var(--ok); color: #fff; }
.proj-t { flex: 1; min-width: 0; }
.proj-t h3 { margin: 0; font-size: 16px; line-height: 1.3; }
.proj-t p { margin: 2px 0 0; font-size: 13.5px; color: var(--faint); line-height: 1.45; }
.proj-done { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 12.5px; font-weight: 700; color: var(--ok); }
.proj-steps .btn { flex: none; }
@media (max-width: 560px) {
  .proj-steps li { flex-wrap: wrap; }
  .proj-steps .btn { width: 100%; justify-content: center; }
}

/* Email sign-up card */
.sub-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.sub-card .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 20px; flex: none; }
.sub-card > div { flex: 1 1 260px; }
.sub-card h2 { margin: 0 0 2px; font-size: 19px; }
.sub-card p { margin: 0; color: var(--muted); }
.jdlg-form .check { margin: 0 0 10px; font-weight: 500; font-size: 14px; align-items: flex-start; }
.jdlg-form .check input { margin-top: 1px; flex: none; }

/* My jobs: price changes since saving */
.price-chg { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; line-height: 1.5; }
.price-chg > div { flex: 1 1 280px; }
.price-chg b { display: flex; align-items: center; gap: 7px; }
.price-chg ul { margin: 6px 0 0; padding-left: 20px; }
.price-chg.down { background: rgba(4, 120, 87, .08); border: 1px solid var(--ok); }
.price-chg.down .ico { color: var(--ok); }
.price-chg.up { background: var(--note-bg); border: 1px solid var(--note-border); color: var(--note-text); }
@media print { .next, .inst, .restored, .resume, .price-chg .btn, .proj-job { display: none !important; } }

/* Custom material calculator: pieces editor and "My calculators" */
.pieces { display: grid; gap: 8px; }
.pc { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 40px 10px 10px; background: var(--surface-2); position: relative; }
.pc.neg { border-style: dashed; border-color: var(--note-border); background: var(--note-bg); }
.pc > select { flex: 1 1 140px; min-width: 0; font: 600 14px/1.3 var(--sans); color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 10px; align-self: flex-end; }
.pc-t { font-weight: 800; font-size: 13px; align-self: center; color: var(--muted); }
.pc-f { display: flex; flex-direction: column; gap: 3px; flex: 1 1 96px; min-width: 0; }
.pc-f > span:first-child { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.pc-f .inp input { padding: 8px 10px; font-size: 15px; }
.pc-f .inp.has-unit input { padding-right: 36px; }
.pc-f .inp .unit { right: 9px; font-size: 12px; }
.pc-q { flex: 0 1 84px; }
.pc-neg { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); padding-bottom: 9px; cursor: pointer; }
.pc-neg input { width: 18px; height: 18px; accent-color: var(--amber); }
.pc-x { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--faint); font-size: 20px; line-height: 1; cursor: pointer; }
.pc-x:hover { background: var(--accent-soft); color: var(--text); }
.pc-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.pc-foot .btn { padding: 8px 12px; }
.pc-tot { font: 700 14px var(--mono); color: var(--hi); }
.mycalc { border: 1px solid var(--border-soft); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
.mycalc-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.mycalc-h b { display: flex; align-items: center; gap: 7px; font-size: 14.5px; }
.mycalc-h .btn { padding: 7px 11px; font-size: 13px; }
.mycalc .help { margin: 6px 0 0; }
.mycalc-l { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.mycalc-c { display: inline-flex; align-items: center; }
.mycalc-c .chip { border-radius: 10px 0 0 10px; font-family: var(--sans); }
.mycalc-x { border: 1px solid var(--border); border-left: 0; border-radius: 0 10px 10px 0; background: var(--surface-2); color: var(--faint); padding: 0 9px; align-self: stretch; cursor: pointer; font-size: 16px; }
.mycalc-x:hover { color: var(--text); }
.inp input[type="text"] { font-family: var(--sans); font-weight: 600; }