:root {
  --bg: #ffffff;
  --fg: #1c1f24;
  --muted: #5b6470;
  --accent: #d98a00;
  --border: #e4e7eb;
  --header-bg: #14171c;
  --header-fg: #f3f4f6;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171c; --fg: #e8eaee; --muted: #9aa3af; --border: #2a2f37; }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); }
a:hover { text-decoration: none; }
img { max-width: 100%; height: auto; }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--header-bg);
  color: var(--header-fg);
}
.site-header .logo {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
}
.site-header nav { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.site-header nav a { color: var(--header-fg); text-decoration: none; font-size: 0.95rem; }
.site-header nav a:hover { color: var(--accent); }

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}
h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 1rem; }
h2 { margin-top: 2.2rem; }
table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
th, td { padding: 0.5rem 0.75rem; border: 1px solid var(--border); text-align: left; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ==========================================================
   Calculator + long-form page components
   Append to the END of assets/css/main.css (reuses its tokens).
   Used first by calculators/fsm-total-cost-calculator.html
   ========================================================== */

:root {
  --surface: #f6f7f9;
  --seg-sub: #5f6f83;
  --seg-seat: #d98a00;
  --seg-add: #2f8f83;
  --seg-proc: #b4553f;
  --seg-wage: #3f6fa8;
  --warn-bg: #fff6e0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #1b1f26;
    --seg-sub: #8a9bb0;
    --seg-seat: #e8a21a;
    --seg-add: #4fb3a6;
    --seg-proc: #d9765f;
    --seg-wage: #6a99d6;
    --warn-bg: #2b2412;
  }
}

.page-meta { color: var(--muted); font-size: 0.9rem; margin: 0 0 1.5rem; }
.lede { font-size: 1.1rem; }
.callout {
  background: var(--warn-bg);
  border-left: 4px solid var(--accent);
  padding: 0.8rem 1rem;
  margin: 1.25rem 0;
  font-size: 0.95rem;
}
.callout p { margin: 0; }

.vars dt { font-weight: 600; margin-top: 0.9rem; }
.vars dd { margin: 0.1rem 0 0; color: var(--muted); }
.formula {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font: 0.9rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}

/* Calculator */
.calc { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; margin: 1.5rem 0; }
.calc fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; min-width: 0; }
.calc legend { font-weight: 700; font-size: 1.05rem; padding: 0; margin-bottom: 0.6rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.9rem 1.1rem; }
.field label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 0.25rem; }
.field .hint { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }
.calc input, .calc select {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.55rem 0.65rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.calc input:focus-visible, .calc select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}
.status { font-size: 0.88rem; margin: 0.6rem 0 0; color: var(--muted); }
.status strong { color: var(--fg); }

.result { border-top: 2px solid var(--border); padding-top: 1.25rem; }
.total { font-size: 2.6rem; font-weight: 700; line-height: 1.1; margin: 0; font-variant-numeric: tabular-nums; }
.total-sub { color: var(--muted); margin: 0.3rem 0 1rem; }
.bar { display: flex; height: 22px; border-radius: 4px; overflow: hidden; background: var(--border); margin: 0.5rem 0 1rem; }
.bar span { display: block; height: 100%; min-width: 0; }
.sw { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 2px; margin-right: 0.45rem; vertical-align: -1px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dominance { font-size: 1.02rem; margin: 0.75rem 0 0; }

.scenarios th[scope="col"] { text-align: right; }
.scenarios tr.total-row td, .scenarios tr.total-row th { font-weight: 700; background: var(--surface); }

details.faq { border-top: 1px solid var(--border); padding: 0.85rem 0; }
details.faq:last-of-type { border-bottom: 1px solid var(--border); }
details.faq summary { cursor: pointer; font-weight: 600; }
details.faq p { margin: 0.6rem 0 0; }

.related { padding-left: 1.2rem; }
.related li { margin-bottom: 0.5rem; }
.small { font-size: 0.88rem; color: var(--muted); }

@media (max-width: 520px) {
  .total { font-size: 2.1rem; }
  .calc { padding: 1rem; }
}

/* ----------------------------------------------------------
   Wide layout. Opt in per page with <main class="wide">.
   Text, tools and tables all use the full column width.
   To narrow the text again, change --prose-max (e.g. 100ch or 900px).
   Calculator inputs sit beside a sticky results panel at 900px+.
   ---------------------------------------------------------- */
main.wide {
  max-width: 1200px;
  --prose-max: none;
}
main.wide > p,
main.wide > ul,
main.wide > ol,
main.wide > dl,
main.wide > details,
main.wide > .callout { max-width: var(--prose-max); }
main.wide > .formula { width: fit-content; max-width: 100%; }

@media (min-width: 900px) {
  /* Definition lists flow into two columns so short entries use the width */
  main.wide > dl.vars {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 3rem;
  }
  .calc-split {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
    gap: 2rem;
    align-items: start;
  }
  .calc-split .result {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
  }
}

/* ==========================================================
   Compliance guide components
   Appended for compliance/w2-vs-1099-field-technicians-guide.html
   (reuses the tokens above; nothing above this line was changed)
   ========================================================== */

/* Page navigation for long guides */
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.9rem 1.1rem; margin: 1.25rem 0; }
.toc p { margin: 0 0 0.4rem; font-weight: 700; }
.toc ol { margin: 0; padding-left: 1.2rem; columns: 260px; column-gap: 2rem; }
.toc li { margin-bottom: 0.25rem; break-inside: avoid; }

/* Side-by-side illustrative cases */
.case-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.case { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--seg-sub); border-radius: 6px; padding: 0.9rem 1.1rem; }
.case h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.case p { margin: 0.4rem 0 0; font-size: 0.95rem; }
.case .small { margin-top: 0.6rem; }

/* Self-check questions (radio groups inside .calc) */
.q-group { margin: 1.4rem 0 0.6rem; font-size: 1.1rem; }
.q-group:first-child { margin-top: 0; }
.q-group .tag { font-size: 0.75rem; font-weight: 600; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0.05rem 0.55rem; margin-left: 0.4rem; vertical-align: 2px; white-space: nowrap; }
.calc .q { margin: 0 0 1.1rem; }
.calc .q legend { font-size: 0.98rem; font-weight: 600; margin-bottom: 0.4rem; }
.q .hint { display: block; font-size: 0.82rem; color: var(--muted); margin: -0.2rem 0 0.5rem; }
.opts { display: grid; gap: 0.45rem; }
.opt { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.6rem 0.75rem; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 0.93rem; line-height: 1.45; }
.opt:hover { border-color: var(--muted); }
.opt:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.opt:focus-within { outline: 3px solid var(--accent); outline-offset: 1px; }
.calc .opt input[type="radio"] { width: 1.05rem; height: 1.05rem; padding: 0; margin: 0.18rem 0 0; flex: none; accent-color: var(--accent); }
.calc select.wide-select { max-width: 26rem; }

/* Buttons */
.btn { font: inherit; font-size: 0.95rem; font-weight: 600; padding: 0.5rem 1rem; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }

/* Self-check results */
.verdict-title { font-size: 1.5rem; font-weight: 700; line-height: 1.2; margin: 0; }
.verdict-text { margin: 0.5rem 0 1rem; }
.lean { display: inline-block; padding: 0.1rem 0.55rem; font-size: 0.85rem; font-weight: 600; white-space: nowrap; color: var(--fg); background: var(--surface); border-left: 6px solid var(--lean-c, var(--muted)); border-radius: 3px; }
.lean-ic { --lean-c: var(--seg-add); }
.lean-ee { --lean-c: var(--seg-proc); }
.lean-mixed { --lean-c: var(--seg-seat); }
.lean-none { --lean-c: var(--border); color: var(--muted); }
.result .callout { margin: 1rem 0 0; }
.result h3 { font-size: 1rem; margin: 1.1rem 0 0.4rem; }
.result ul { margin: 0.3rem 0 0; padding-left: 1.2rem; font-size: 0.95rem; }
.result li { margin-bottom: 0.35rem; }

/* Source tables: keep long URLs from stretching the layout */
.sources td { overflow-wrap: anywhere; font-size: 0.92rem; }

/* Compact results table inside the sticky panel */
.result table th, .result table td { padding: 0.4rem 0.55rem; font-size: 0.92rem; }
.result table th[scope="row"] { font-weight: 600; text-align: left; }

/* ==========================================================
   Audit checklist components
   Appended for compliance/osha-residential-trades-safety-checklist.html
   (reuses tokens above; nothing above this line was changed)
   ========================================================== */

.badge-critical {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.12rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--seg-proc);
  border-radius: 999px;
  vertical-align: 1px;
  white-space: nowrap;
}

/* Self-check result panel status colors, same .lean chip used by the
   classification guide's self-check (see .lean-ic etc. above) */
.lean.osha-complete { --lean-c: var(--seg-add); }
.lean.osha-partial { --lean-c: var(--seg-seat); }
.lean.osha-unaddressed { --lean-c: var(--border); color: var(--muted); }
.lean.osha-critical { --lean-c: var(--seg-proc); }

.checklist-progress {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin: 1.25rem 0;
}
.checklist-progress .progress-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.checklist-progress .progress-label { font-weight: 700; font-size: 0.95rem; }
.checklist-progress .progress-count { color: var(--muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.progress-track { height: 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; margin-top: 0.6rem; }
.progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.2s ease; }
.checklist-actions { display: flex; gap: 0.6rem; margin-top: 0.75rem; flex-wrap: wrap; }
.checklist-actions .btn { font-size: 0.85rem; padding: 0.4rem 0.8rem; }

.checklist-section { margin-top: 2.4rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 2px solid var(--border); padding-bottom: 0.4rem; }
.section-head h2 { margin: 0; }
.section-count { color: var(--muted); font-size: 0.85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

.check-list { list-style: none; margin: 1.1rem 0; padding: 0; display: grid; gap: 0.55rem; }
.check-item label {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.96rem;
  line-height: 1.5;
}
.check-item label:has(input:checked) { border-color: var(--seg-add); box-shadow: inset 0 0 0 1px var(--seg-add); }
.check-item label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 1px; }
.check-item input[type="checkbox"] { width: 1.15rem; height: 1.15rem; margin: 0.15rem 0 0; flex: none; accent-color: var(--seg-add); }
.check-item .cite { display: block; margin-top: 0.2rem; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

@media print {
  .site-header, .site-footer, .checklist-actions, .checklist-progress, .callout, .related, #next { display: none !important; }
  .check-item label { border: none; background: none; padding: 0.2rem 0; }
  .check-item input[type="checkbox"] { accent-color: #000; }
  a { color: inherit; text-decoration: none; }
}
