/* Gig Tax Calculator — design tokens, layout and components.
   Mobile first. Breakpoints: 640 (tablet), 1024 (desktop two-column). */

:root {
  color-scheme: light dark;
  --bg: #f4f1e9;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --ink: #101a17;
  --muted: #57635e;
  --line: #e2ddd0;
  --brand: #0f6b52;
  --brand-ink: #ffffff;
  --signal: #d6f26b;
  --signal-ink: #1a2400;
  --warn-bg: #fff3d6;
  --warn-ink: #5a3b00;
  --warn-line: #f0d28a;
  --tip-bg: #e4f5ec;
  --tip-ink: #0b4a37;
  --tip-line: #b6e0cb;
  --info-bg: #eef1f6;
  --info-ink: #2a3445;
  --info-line: #d3d9e4;
  --dock-bg: #0d1a16;
  --dock-ink: #f3f6f2;
  --dock-muted: #9db3aa;
  --dock-chip: rgba(255, 255, 255, 0.08);
  --focus: #1f6feb;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 26, 23, 0.06), 0 8px 24px rgba(16, 26, 23, 0.06);
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --dock-h: 0px;
  --tile-accent: var(--signal);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1210;
    --surface: #121d19;
    --surface-2: #17241f;
    --ink: #eef3ef;
    --muted: #9bb0a7;
    --tile-accent: #0b4a37; /* the selected tile is light in dark mode, so its accent must be dark */
    --line: #25362f;
    --brand: #4fd1a5;
    --brand-ink: #04170f;
    --warn-bg: #3a2c08;
    --warn-ink: #ffe3a3;
    --warn-line: #6b5113;
    --tip-bg: #0f2c22;
    --tip-ink: #b8f0d6;
    --tip-line: #1f5a43;
    --info-bg: #1a2530;
    --info-ink: #cfd9e6;
    --info-line: #2c3c4d;
    --dock-bg: #05100c;
    --focus: #6aa6ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--dock-h) + 12px); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.15; margin: 0; }
p { margin: 0 0 0.75em; }
a { color: var(--brand); text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header / footer ---------- */
.site-head { padding: max(10px, env(safe-area-inset-top)) 0 10px; }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { white-space: nowrap; display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.brand svg { width: 30px; height: 30px; flex: none; }
.site-nav { display: flex; gap: 4px; flex-wrap: nowrap; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 10px 12px; border-radius: 10px; font-size: 0.95rem; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; }
.site-nav a:hover { background: var(--surface); color: var(--ink); }
.site-foot { margin-top: 56px; padding: 32px 0 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.92rem; }
.site-foot .wrap { display: grid; gap: 20px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.foot-links a { color: var(--muted); padding: 0; min-height: 44px; min-width: 44px; justify-content: center; display: inline-flex; align-items: center; }
.foot-note { max-width: 70ch; }

/* ---------- Intro ---------- */
main { display: flex; flex-direction: column; }
.intro { padding-top: 14px; padding-bottom: 8px; }
.eyebrow { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; }
.intro h1 { font-family: var(--display); font-size: clamp(1.7rem, 5.5vw, 2.7rem); letter-spacing: -0.02em; }
.lede { color: var(--muted); max-width: 62ch; margin-top: 8px; display: none; }

/* ---------- Dock (always-visible results) ---------- */
.dock { order: -1; position: sticky; top: 0; z-index: 40; padding: max(8px, env(safe-area-inset-top)) 12px 8px; margin: 0; background: linear-gradient(var(--bg) 78%, transparent); }
.dock-inner { background: var(--dock-bg); color: var(--dock-ink); border-radius: 22px; padding: 14px 16px 12px; box-shadow: 0 10px 30px rgba(5, 16, 12, 0.28); display: grid; gap: 10px; grid-template-columns: 1fr auto; align-items: end; max-width: 1180px; margin: 0 auto; }
.dock-primary { min-width: 0; }
.dock-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dock-muted); margin: 0 0 2px; display: flex; align-items: center; gap: 6px; }
.dock-total { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(2.2rem, 11vw, 3.6rem); line-height: 1; letter-spacing: -0.03em; color: var(--signal); font-variant-numeric: tabular-nums; }
.dock.is-refund .dock-total { color: #8be9c4; }
.dock-sub { margin: 6px 0 0; color: var(--dock-muted); font-size: 0.88rem; }
.dock-figs { display: grid; grid-template-columns: repeat(3, auto); gap: 6px; margin: 0; }
.fig { background: var(--dock-chip); border-radius: 14px; padding: 8px 10px; min-width: 0; }
.fig dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dock-muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.fig dd { margin: 2px 0 0; font-weight: 700; font-size: 1.02rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dock-dates { grid-column: 1 / -1; display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; overflow: hidden; max-height: 60px; transition: max-height 0.25s ease, opacity 0.2s ease; }
.dock-dates li { flex: 1; background: var(--dock-chip); border-radius: 10px; padding: 5px 8px; font-size: 0.74rem; color: var(--dock-muted); display: flex; flex-direction: column; min-width: 0; }
.dock-dates li b { color: var(--dock-ink); font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.dock-dates li.is-next { outline: 1.5px solid var(--signal); }
.dock-status { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; padding: 3px 10px; border-radius: 999px; background: var(--dock-chip); color: var(--dock-muted); }
.badge.is-warn { background: #5a4410; color: #ffe6a8; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.dock-more { margin-left: auto; font-size: 0.8rem; color: var(--signal); text-decoration: none; padding: 6px 4px; }
.dock .tip { background: transparent; color: var(--dock-muted); border-color: rgba(255, 255, 255, 0.25); }
/* Compact mode keeps the headline numbers in view while typing or scrolling. */
.lbl-short { display: none; }
.dock.is-compact .dock-dates, .dock.is-compact .dock-status { max-height: 0; opacity: 0; margin: 0; padding: 0; overflow: hidden; }
.dock.is-compact .dock-inner { padding: 8px 14px 10px; gap: 6px; }
.dock.is-compact .dock-total { font-size: clamp(1.8rem, 8vw, 2.4rem); }
.dock.is-compact .dock-sub { display: none; }
.dock.is-compact .lbl-long { display: none; }
.dock.is-compact .lbl-short { display: inline; }
.dock.is-compact .fig { padding: 5px 9px; display: flex; align-items: baseline; gap: 6px; }
.dock.is-compact .fig dt { font-size: 0.68rem; }
.dock.is-compact .fig dd { margin: 0; font-size: 0.92rem; }
.dock.is-compact .fig .tip { display: none; }
@media (max-width: 639px) {
  .dock-inner { grid-template-columns: 1fr; }
  .dock-figs { grid-template-columns: repeat(3, 1fr); }
  .dock.is-compact .dock-figs { grid-template-columns: repeat(3, auto); justify-content: start; }
  .fig dd { font-size: 0.95rem; }
}
@media (max-width: 639px) and (max-height: 700px) {
  .dock-inner { padding: 10px 14px 8px; gap: 6px; }
  .dock-sub { display: none; }
  .dock-total { font-size: clamp(2rem, 9vw, 2.6rem); }
  .fig { padding: 5px 9px; }
  .dock-dates li { padding: 3px 8px; }
}
@media (min-width: 640px) {
  .lede { display: block; }
  .dock-inner { padding: 16px 22px 14px; gap: 12px 24px; }
  .dock-figs { gap: 10px; }
  .fig { padding: 10px 14px; }
  .fig dd { font-size: 1.25rem; }
  .dock.is-compact .dock-inner { grid-template-columns: 1fr auto; align-items: center; }
}
/* Desktop: the estimate becomes a compact card pinned to the top right, over the results column. It takes no layout
   height of its own (negative bottom margin = its measured height), so the form keeps the full left side. */
@media (min-width: 1024px) {
  .dock { align-self: flex-end; width: 372px; padding: 14px 0 0; background: none; margin: 0 max(16px, calc((100% - 1180px) / 2 + 16px)) calc(-1 * var(--dock-h)) 0; pointer-events: none; }
  .dock-inner { pointer-events: auto; grid-template-columns: 1fr; align-items: stretch; gap: 8px; padding: 14px 16px 12px; border-radius: 18px; }
  .dock-total { font-size: 2.6rem; }
  .dock-sub { display: none; }
  .dock-figs { justify-self: stretch; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .fig { padding: 6px 9px; }
  .fig dt { font-size: 0.66rem; }
  .fig dd { font-size: 1rem; margin-top: 1px; }
  .dock .lbl-long { display: none; }
  .dock .lbl-short { display: inline; }
  .dock-dates { max-width: none; max-height: none; gap: 5px; }
  .dock-dates li { padding: 3px 7px; font-size: 0.68rem; }
  .dock-dates li b { font-size: 0.78rem; }
  .dock-status { gap: 4px 8px; }
  /* compact state needs no extra squeeze on a card that is already small */
  .dock.is-compact .dock-dates, .dock.is-compact .dock-status { max-height: none; opacity: 1; overflow: visible; }
  .dock.is-compact .dock-inner { grid-template-columns: 1fr; align-items: stretch; padding: 14px 16px 12px; gap: 8px; }
  .dock.is-compact .dock-label .lbl-long, .dock.is-compact .dock-label { display: flex; }
  .dock.is-compact .dock-total { font-size: 2.6rem; }
  .dock.is-compact .fig { display: block; padding: 6px 9px; }
  .dock.is-compact .fig .tip { display: inline-grid; }
  .dock.is-compact .fig dd { margin-top: 1px; font-size: 1rem; }
  .dock.is-compact .dock-figs { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Layout ---------- */
.layout { display: grid; gap: 16px; margin-top: 16px; align-items: start; }
@media (min-width: 1024px) {
  .layout { grid-template-columns: minmax(0, 1fr) 420px; gap: 24px; }
  :root { --dock-h: 252px; } /* first-paint estimate; the ResizeObserver replaces it with the measured height */
  .intro { min-height: calc(var(--dock-h) + 6px); }
  .intro > * { max-width: calc(100% - 396px); } /* keep the heading clear of the pinned card */
  .col-results { position: sticky; top: calc(var(--dock-h) + 28px); max-height: calc(100vh - var(--dock-h) - 44px); overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
}

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.card > summary, .card-head { list-style: none; display: flex; align-items: center; gap: 12px; padding: 16px 18px; min-height: 60px; cursor: pointer; }
.card > summary::-webkit-details-marker { display: none; }
.card-head { cursor: default; }
.card h2, .card h3 { font-size: 1.1rem; font-family: var(--display); letter-spacing: -0.01em; }
.card .sum { margin-left: auto; font-size: 0.9rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.card .chev { width: 20px; height: 20px; flex: none; transition: transform 0.2s ease; color: var(--muted); }
.card[open] > summary .chev { transform: rotate(180deg); }
.card-body { padding: 4px 18px 20px; display: grid; gap: 14px; }
.card-body.cols { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .card-body.cols { grid-template-columns: 1fr 1fr; gap: 14px 18px; }
  .card-body .span2 { grid-column: 1 / -1; }
}

/* ---------- Fields ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 0.92rem; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.field-hint { font-size: 0.8rem; color: var(--muted); margin: -2px 0 0; }
.money, .plain { display: flex; align-items: center; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: var(--radius-sm); min-height: 52px; transition: border-color 0.15s, box-shadow 0.15s; }
.money:focus-within, .plain:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.money i { font-style: normal; color: var(--muted); padding-left: 14px; font-size: 1.05rem; }
.money input, .plain input, .plain select { flex: 1; min-width: 0; border: 0; background: transparent; padding: 12px 14px; font-size: 1.1rem; font-variant-numeric: tabular-nums; outline: none; min-height: 50px; width: 100%; }
.money input { padding-left: 6px; }
.plain select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.unit { color: var(--muted); padding-right: 14px; font-size: 0.9rem; }
.tip { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 0.72rem; font-weight: 700; line-height: 1; display: inline-grid; place-items: center; cursor: help; flex: none; padding: 0; position: relative; }
.tip::after { content: ""; position: absolute; inset: -11px; }
.tip:hover, .tip[aria-expanded="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.dock .tip:hover, .dock .tip[aria-expanded="true"] { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
#tip-pop { position: fixed; z-index: 90; max-width: min(320px, calc(100vw - 24px)); background: var(--ink); color: var(--bg); padding: 12px 14px; border-radius: 12px; font-size: 0.88rem; line-height: 1.4; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3); pointer-events: none; }

/* Segmented radio groups */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 14px; padding: 4px; }
.seg.wrap2 { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; text-align: center; min-height: 44px; padding: 6px 8px; border-radius: 10px; font-weight: 600; font-size: 0.95rem; color: var(--muted); transition: background 0.15s, color 0.15s; line-height: 1.15; }
.seg input:checked + span { background: var(--ink); color: var(--bg); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }

/* Profile tiles */
.profiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.profile { position: relative; }
.profile input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.profile .tile { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 12px 6px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface-2); min-height: 112px; transition: all 0.15s; }
.profile svg { width: 34px; height: 34px; color: var(--muted); }
.profile b { font-size: 0.95rem; }
.profile small { color: var(--muted); font-size: 0.72rem; line-height: 1.2; }
.profile input:checked + .tile { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.profile input:checked + .tile svg, .profile input:checked + .tile small { color: var(--tile-accent); }
.profile input:focus-visible + .tile { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Checkbox and slider */
.check { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: var(--radius-sm); min-height: 52px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); margin: 0; flex: none; }
.slider { display: grid; gap: 6px; }
.slider input[type="range"] { width: 100%; accent-color: var(--brand); height: 44px; margin: 0; }
.slider output { font-weight: 700; font-variant-numeric: tabular-nums; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.ghost { background: transparent; }
.btn svg { width: 18px; height: 18px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Vehicle compare strip */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cmp { border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--surface-2); }
.cmp small { color: var(--muted); display: block; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; }
.cmp b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.cmp.is-better { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, var(--surface)); }
.cmp.is-better small::after { content: " · saves more"; color: var(--brand); font-weight: 700; }

/* ---------- Results ---------- */
.notices { display: grid; gap: 8px; margin-bottom: 12px; }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 14px; font-size: 0.9rem; line-height: 1.4; border: 1px solid; }
.notice > span:first-child { flex: none; width: 18px; height: 18px; margin-top: 1px; display: block; }
.notice svg { width: 18px; height: 18px; display: block; }
.notice.n-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.notice.n-tip { background: var(--tip-bg); color: var(--tip-ink); border-color: var(--tip-line); }
.notice.n-info { background: var(--info-bg); color: var(--info-ink); border-color: var(--info-line); }
.rows { margin: 0; padding: 0 18px 14px; }
.sh-list { margin: 0; padding: 0; }
.rrow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px dashed var(--line); font-size: 0.95rem; }
.rrow:first-child { border-top: 0; }
.rrow dt { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.rrow dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.rrow.strong dt { color: var(--ink); font-weight: 600; }
.rrow.strong dd { font-size: 1.02rem; }
.plan { padding: 0 18px 18px; display: grid; gap: 10px; }
.plan table { width: 100%; border-collapse: collapse; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.plan th, .plan td { text-align: left; padding: 8px 4px; border-top: 1px dashed var(--line); }
.plan th:last-child, .plan td:last-child { text-align: right; }
.prov { font-size: 0.78rem; color: var(--muted); margin: 14px 4px 0; }
.empty-hint { padding: 0 18px 18px; color: var(--muted); font-size: 0.92rem; }

/* ---------- Reference + prose ---------- */
.reference, .prose { margin-top: 40px; }
.reference h2, .prose h2 { font-family: var(--display); font-size: 1.5rem; margin-bottom: 14px; }
.ref-grid { display: grid; gap: 12px; }
@media (min-width: 720px) { .ref-grid { grid-template-columns: 1fr 1fr; } }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); -webkit-overflow-scrolling: touch; }
.tbl-wrap.scroll { max-height: 360px; overflow-y: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
table.data caption { text-align: left; font-weight: 700; padding: 12px 14px 4px; font-family: var(--display); font-size: 1.05rem; }
table.data th, table.data td { padding: 9px 14px; text-align: left; border-top: 1px solid var(--line); white-space: nowrap; }
table.data thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
table.data td:last-child, table.data th:last-child { text-align: right; }
.prose { max-width: 74ch; }
.prose h3 { font-size: 1.1rem; margin: 22px 0 6px; }
.ad-slot { margin: 20px 0; min-height: 90px; }

/* ---------- Content pages ---------- */
.page { padding: 8px 0 0; max-width: 78ch; }
.page h1 { font-family: var(--display); font-size: clamp(1.8rem, 6vw, 2.6rem); letter-spacing: -0.02em; margin: 18px 0 12px; }
.page h2 { font-family: var(--display); font-size: 1.4rem; margin: 30px 0 10px; }
.page h3 { margin: 20px 0 6px; }
.page ul, .page ol { padding-left: 1.2em; }
.page li { margin-bottom: 6px; }
.callout { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--brand); border-radius: 14px; padding: 14px 16px; margin: 16px 0; }
.crumbs { font-size: 0.88rem; color: var(--muted); margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.chip { padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 0.92rem; min-height: 40px; display: inline-flex; align-items: center; }
.chip:hover { border-color: var(--ink); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- Print ---------- */
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .site-head, .site-foot, .col-inputs, .actions, .skip, .tip, .ad-slot, #tip-pop, .dock-more { display: none !important; }
  .dock { position: static; padding: 0; margin: 0 0 12px; }
  .dock-inner { background: #fff; color: #000; box-shadow: none; border: 2px solid #000; border-radius: 8px; }
  .dock-total { color: #000; }
  .dock-label, .dock-sub, .fig dt { color: #333; }
  .fig, .dock-dates li, .badge { background: #f2f2f2; color: #000; }
  .layout { display: block; }
  .col-results { position: static; max-height: none; overflow: visible; }
  .card { box-shadow: none; break-inside: avoid; }
  .card .chev { display: none; }
}

/* ---------- Small additions ---------- */
.card-head .btn { margin-left: auto; min-height: 44px; padding: 0 14px; font-size: 0.9rem; }
.actions { margin-top: 14px; }
.reference .tbl-wrap + .tbl-wrap, .reference .ref-grid + .tbl-wrap { margin-top: 12px; }
.toast { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; max-width: min(92vw, 420px); box-shadow: var(--shadow); background: var(--ink); color: var(--bg); border-color: var(--ink); }
#tip-pop[hidden] { display: none; }
.field-label label { cursor: pointer; }
@media (max-width: 639px) {
  .fig dt { white-space: normal; line-height: 1.15; }
  .card-body { padding: 4px 14px 18px; }
  .card > summary, .card-head { padding: 14px; }
  .rows, .plan { padding-left: 14px; padding-right: 14px; }
  .actions .btn { flex: 1 1 100%; }
}

.field.check-field { display: flex; align-items: center; gap: 10px; }
.field.check-field .check { flex: 1; }
.toast.notice { display: block; }

@media (max-width: 479px) {
  .site-nav a:first-child { display: none; }
  .site-head { padding-bottom: 4px; }
  .brand span { font-size: 0.98rem; }
  .site-nav a { padding: 10px 8px; font-size: 0.9rem; }
}
@media (max-width: 439px) {
  .site-nav a:nth-child(3) { display: none; } /* About stays in the footer */
}
@media (max-width: 359px) {
  .site-head .wrap { gap: 4px; }
  .brand span { font-size: 0.9rem; }
  .site-nav { gap: 0; }
  .site-nav a { padding: 10px 6px; font-size: 0.85rem; }
}
