/* Virginia Child Support Calculator
   Design idea: the court worksheet, filled in. Cool paper, slate ink, a teal accent
   for interaction, and one marker underline beneath the bottom-line amount. */

:root {
  --paper: #f5f8fa;
  --sheet: #ffffff;
  --ink: #1d2a39;
  --ink-2: #3c4b5c;
  --muted: #5f6f80;
  --rule: #d6dee6;
  --rule-strong: #b7c3cf;
  --accent: #0d6b61;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1ee;
  --highlight: #e9b824;
  --warn-bg: #fff3dc;
  --warn-ink: #7a4300;
  --error: #a32a2a;
  --focus: #1f6feb;

  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius-sm: 4px;
  --radius: 8px;
  --gutter: 16px;
  --max: 1180px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10171f; --sheet: #17212c; --ink: #e6edf3; --ink-2: #c4cfda; --muted: #93a3b3;
    --rule: #2b3846; --rule-strong: #3c4c5d; --accent: #4cc0b0; --accent-ink: #062723; --accent-soft: #163631;
    --highlight: #e8c547; --warn-bg: #3a2a0c; --warn-ink: #ffd89a; --error: #ff8a8a; --focus: #79b8ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #10171f; --sheet: #17212c; --ink: #e6edf3; --ink-2: #c4cfda; --muted: #93a3b3;
  --rule: #2b3846; --rule-strong: #3c4c5d; --accent: #4cc0b0; --accent-ink: #062723; --accent-soft: #163631;
  --highlight: #e8c547; --warn-bg: #3a2a0c; --warn-ink: #ffd89a; --error: #ff8a8a; --focus: #79b8ff;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.55 var(--sans); font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--sheet); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.wrap {
  max-width: var(--max); margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

/* Masthead */
.masthead { border-bottom: 1px solid var(--rule); background: var(--sheet); }
.masthead__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; padding-block: 14px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.02rem; }
.brand__mark { width: 28px; height: 28px; color: var(--ink); }
.schedule-badge { margin: 0; font-size: 0.84rem; color: var(--muted); }
.schedule-badge strong { color: var(--ink-2); font-weight: 600; }

/* Light/dark switch */
.masthead__inner { column-gap: 18px; }
.sitenav { margin-left: auto; }
.theme-toggle {
  flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--rule-strong); border-radius: 50%; background: var(--sheet); color: var(--ink-2); cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle__sun { display: none; }
:root[data-theme="dark"] .theme-toggle__sun { display: block; }
:root[data-theme="dark"] .theme-toggle__moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle__moon { display: none; }
}
@media (max-width: 720px) {
  .masthead__inner .brand { order: 1; flex: 1 1 0%; min-width: 0; }
  .masthead__inner .theme-toggle { order: 2; }
  .masthead__inner .sitenav { order: 3; flex-basis: 100%; margin-left: 0; }
}

/* Site navigation */
.sitenav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 0.9rem; }
.sitenav a { color: var(--ink-2); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.sitenav a:hover { color: var(--accent); }
.sitenav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.intro .schedule-badge { margin: -14px 0 24px; }
.footer__links { display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* Guide pages */
.guide { padding-top: 28px; padding-bottom: 56px; }
.guide article { max-width: 70ch; }
.crumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.guide h1 { max-width: 24ch; }
.guide h2 { font-family: var(--serif); font-weight: 600; font-size: 1.45rem; line-height: 1.25; margin: 36px 0 10px; text-wrap: balance; }
.guide h3 { font-size: 1.02rem; margin: 22px 0 4px; }
.guide p, .guide li { color: var(--ink-2); }
.guide p { margin: 0 0 14px; }
.guide .reviewed { font-size: 0.85rem; color: var(--muted); margin-top: -12px; }
.guide .steps { padding-left: 1.3em; display: grid; gap: 10px; }
.guide .note { font-size: 0.88rem; color: var(--muted); }
.guide .cta { margin: 22px 0; }
.guide .btn { display: inline-block; text-decoration: none; }
.table-wrap { overflow-x: auto; margin: 8px 0 12px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); }
table.example { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.example th, table.example td { padding: 8px 12px; border-top: 1px solid var(--rule); text-align: left; vertical-align: top; }
table.example thead th { border-top: 0; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
table.example td:first-child { color: var(--muted); white-space: nowrap; width: 4.5em; }
table.example td:last-child, table.example th:last-child { text-align: right; white-space: nowrap; }
table.example tr.em td { font-weight: 700; color: var(--ink); background: var(--accent-soft); }
.faq { margin-top: 36px; padding-top: 4px; border-top: 1px solid var(--rule); }
.sources { margin-top: 36px; padding: 14px 18px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); }
.sources h2 { font-size: 1.05rem; margin: 0 0 6px; font-family: var(--sans); }
.sources ul { margin: 0; padding-left: 1.1em; font-size: 0.92rem; }

/* Schedule page */
.schedule-status { font-size: 0.88rem; color: var(--muted); margin-top: -6px; }
.lookup { margin: 22px 0 8px; padding: 18px 20px; background: var(--sheet); border: 1px solid var(--rule); border-top: 4px solid var(--accent); border-radius: var(--radius); }
.lookup h2 { margin-top: 0 !important; font-size: 1.2rem !important; }
.lookup__form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; }
.lookup__form label { display: grid; gap: 4px; font-size: 0.9rem; font-weight: 500; }
.lookup__result { margin: 14px 0 6px !important; font-size: 1.05rem; color: var(--ink) !important; }
.lookup__result strong { font-family: var(--serif); font-size: 1.35rem; padding-bottom: 1px; background: linear-gradient(var(--highlight), var(--highlight)) no-repeat left bottom / 100% 3px; }
.lookup__detail { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.lookup__next { font-size: 0.88rem; margin: 0 !important; }
.schedule-wrap { max-height: 70vh; overflow: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); margin: 10px 0 8px; }
table.schedule { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
table.schedule caption { text-align: left; padding: 10px 12px; font-weight: 600; font-size: 0.85rem; color: var(--ink-2); }
table.schedule th, table.schedule td { padding: 6px 12px; text-align: right; white-space: nowrap; border-top: 1px solid var(--rule); }
table.schedule thead th { position: sticky; top: 0; z-index: 1; background: var(--sheet); color: var(--muted); font-size: 0.78rem; font-weight: 600; border-bottom: 1px solid var(--rule-strong); }
table.schedule tbody th { text-align: left; font-weight: 600; color: var(--ink); }
table.schedule td { color: var(--ink-2); }
table.schedule tbody tr:nth-child(even) { background: var(--paper); }
table.schedule tr.is-hit th, table.schedule tr.is-hit td { background: var(--accent-soft); }
table.schedule td.is-hit { font-weight: 700; color: var(--ink); box-shadow: inset 0 -3px 0 var(--highlight); }
@media (max-width: 720px) {
  .lookup__form { grid-template-columns: 1fr; }
  table.schedule th, table.schedule td { padding: 6px 8px; }
}

/* Intro */
.intro { padding-top: 44px; padding-bottom: 8px; }
h1 {
  font-family: var(--serif); font-weight: 600; font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3rem);
  line-height: 1.1; letter-spacing: -0.01em; margin: 0 0 14px; max-width: 22ch; text-wrap: balance;
}
.lede { font-size: 1.1rem; color: var(--ink-2); max-width: 62ch; margin: 0 0 28px; }

.arrangement { border: 0; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.arrangement legend { font-weight: 600; margin-bottom: 10px; padding: 0; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice__body {
  display: grid; gap: 4px; height: 100%; padding: 16px 18px 16px 44px; background: var(--sheet);
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.choice__body::before {
  content: ""; position: absolute; left: 16px; top: 19px; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--rule-strong); background: var(--sheet);
}
.choice input:checked + .choice__body { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.choice input:checked + .choice__body::before { border-color: var(--accent); background: radial-gradient(var(--accent) 0 4px, var(--sheet) 5px); }
.choice input:focus-visible + .choice__body { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice__title { font-weight: 700; }
.choice__desc { color: var(--ink-2); font-size: 0.95rem; }
.choice__form { color: var(--muted); font-size: 0.84rem; margin-top: 4px; }

/* Ads */
.ad-slot {
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.75rem;
  border: 1px dashed var(--rule-strong); border-radius: var(--radius-sm); background: transparent;
}
.ad-slot--leaderboard { min-height: 90px; margin: 4px 0 28px; }
.ad-slot--rail { min-height: 250px; margin-top: 20px; }
.ad-slot[data-live] { border: 0; flex-direction: column; align-items: stretch; gap: 4px; min-height: 0; }
.ad-slot__label { font-size: 0.7rem; color: var(--muted); text-align: center; }
ins.adsbygoogle { display: block; width: 100%; }
ins.adsbygoogle[data-ad-status="unfilled"] { display: none; }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 28px; align-items: start; padding-bottom: 48px; }

/* Input sheet */
.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 24px 24px 12px; }
.sheet__title { font-family: var(--serif); font-weight: 600; font-size: 1.35rem; margin: 8px 0 6px; }
.sheet__title:not(:first-child) { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--rule); }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0 0 14px; max-width: 64ch; }

.grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; align-items: center; }
.grid--compact { margin-bottom: 8px; }
.grid__head { font-weight: 600; font-size: 0.9rem; color: var(--ink-2); align-self: end; }
.grid__label { font-size: 0.95rem; font-weight: 500; padding: 4px 0; }
.grid__label small, .radio-line small { display: block; color: var(--muted); font-weight: 400; font-size: 0.8rem; line-height: 1.35; margin-top: 2px; }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--sheet); width: 100%;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); padding: 8px 10px; min-height: 40px;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input[aria-invalid="true"] { border-color: var(--error); }
.name-input { font-weight: 600; border-style: dashed; }
.name-input::placeholder { color: var(--ink-2); opacity: 1; }
.count { max-width: 7.5rem; }
.money { position: relative; display: block; }
.money::before { content: "$"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.money input { padding-left: 22px; text-align: right; }
.money-period { display: grid; gap: 6px; }
.money-period select { font-size: 0.85rem; min-height: 34px; padding: 4px 6px; }

.block { margin: 10px 0 14px; }
.field { display: grid; gap: 6px; font-weight: 500; border: 0; padding: 0; margin: 0 0 8px; justify-items: start; }
.field legend { padding: 0; margin-bottom: 6px; }
.segmented { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); overflow: hidden; width: max-content; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: block; padding: 8px 18px; cursor: pointer; font-weight: 500; }
.segmented label + label span { border-left: 1px solid var(--rule-strong); }
.segmented input:checked + span { background: var(--accent); color: var(--accent-ink); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }

.more { margin: 24px 0 12px; border-top: 1px solid var(--rule); padding-top: 14px; }
.more summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: 4px 0; }
.more[open] summary { margin-bottom: 14px; }
.more .field { margin-top: 18px; }
.radio-line { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; align-items: start; font-weight: 400; margin: 4px 0; }
.radio-line input { width: auto; min-height: 0; margin-top: 5px; }
.radio-line small { grid-column: 2; }

/* Result */
.result { position: sticky; top: 16px; }
.result__card { background: var(--sheet); border: 1px solid var(--rule); border-top: 4px solid var(--accent); border-radius: var(--radius); padding: 20px 22px; }
.result__form { margin: 0; color: var(--muted); font-size: 0.86rem; }
.result__amount { margin: 6px 0 4px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.mark {
  font-family: var(--serif); font-weight: 700; font-size: clamp(2.6rem, 2rem + 2vw, 3.4rem); line-height: 1.05; letter-spacing: -0.015em;
  padding-bottom: 0.1em;
  /* A marker stroke under the number, drawn as a background so it spans the text exactly. */
  background: linear-gradient(var(--highlight), var(--highlight)) no-repeat left bottom / 100% 0.09em;
}
.mark.is-updating { animation: swipe .45s ease-out; }
.mark--empty, .mobile-total strong.mark--empty { background: none; color: var(--muted); }
@keyframes swipe { from { background-size: 0% 0.09em; } to { background-size: 100% 0.09em; } }
@media (prefers-reduced-motion: reduce) { .mark.is-updating { animation: none; } * { transition: none !important; } }
.result__per { color: var(--muted); font-size: 0.95rem; }
.result__summary { margin: 4px 0 12px; font-weight: 500; }
.warnings { list-style: none; margin: 0 0 12px; padding: 10px 12px; background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius-sm); font-size: 0.88rem; }
.warnings li + li { margin-top: 6px; }
.warnings.is-error { color: var(--error); }
.result__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: var(--radius-sm); padding: 9px 16px;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
}
.btn:hover { filter: brightness(1.08); }
.btn--quiet { background: transparent; color: var(--accent); border-color: var(--rule-strong); }

/* Worksheet table: looks like the court form */
.worksheet { margin-top: 14px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.worksheet[hidden] { display: none; }
.worksheet table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.worksheet caption { text-align: left; padding: 12px 14px 8px; font-family: var(--serif); font-weight: 600; font-size: 1.02rem; }
.worksheet th, .worksheet td { padding: 7px 10px; border-top: 1px solid var(--rule); vertical-align: top; }
.worksheet thead th { font-size: 0.78rem; color: var(--muted); font-weight: 600; text-align: right; border-top: 1px solid var(--rule-strong); }
.worksheet thead th:nth-child(-n+2) { text-align: left; }
.worksheet td.no { color: var(--muted); white-space: nowrap; width: 3.4em; font-size: 0.78rem; padding-top: 9px; }
.worksheet td.v { text-align: right; white-space: nowrap; }
.worksheet td.v[colspan] { text-align: right; }
.worksheet tr.em td { font-weight: 700; background: var(--accent-soft); }
.worksheet tr.section td { font-weight: 600; color: var(--ink-2); background: var(--paper); font-size: 0.8rem; }
.worksheet .note { display: block; color: var(--muted); font-size: 0.76rem; font-weight: 400; margin-top: 2px; }

/* Counsel / lead form */
.counsel {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 28px; padding-top: 36px; padding-bottom: 48px;
  border-top: 1px solid var(--rule);
}
.counsel h2 { font-family: var(--serif); font-weight: 600; font-size: 1.6rem; line-height: 1.2; margin: 0 0 10px; }
.counsel p { color: var(--ink-2); max-width: 52ch; }
.counsel__help { display: grid; gap: 14px; align-content: start; }
.resources { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.resource { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; }
.resource h3 { margin: 0 0 6px; font-size: 1.02rem; }
.resource p { margin: 0 0 8px; color: var(--ink-2); font-size: 0.95rem; }
.resource__links { margin: 0 !important; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.resource__links a { font-weight: 600; }
.resource__links span { color: var(--muted); font-size: 0.88rem; }
.resources__note { margin: 0; font-size: 0.82rem; color: var(--muted); }
.counsel__form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; }
.counsel__form label { display: grid; gap: 4px; font-size: 0.9rem; font-weight: 500; }
.counsel__form .wide { grid-column: 1 / -1; }
.counsel__form .consent { grid-template-columns: auto 1fr; gap: 8px; font-weight: 400; color: var(--ink-2); }
.counsel__form .consent input { width: auto; min-height: 0; margin-top: 4px; }
.hp { position: absolute !important; left: -9999px; }
.form-msg { margin-left: 10px; font-size: 0.9rem; }
.form-msg.is-error { color: var(--error); }

/* Footer */
.footer { border-top: 1px solid var(--rule); background: var(--sheet); color: var(--ink-2); font-size: 0.86rem; padding: 26px 0 34px; }
.footer p { max-width: 90ch; }

/* Saved entries bar */
.saved-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  margin: 0 0 18px; padding: 10px 12px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-sm);
}
.remember { display: inline-flex; align-items: center; gap: 8px; font-size: 0.92rem; font-weight: 500; cursor: pointer; }
.remember input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--accent); }
.btn--small { padding: 6px 12px; font-size: 0.88rem; }
.saved-bar__note { flex-basis: 100%; margin: 0; font-size: 0.8rem; color: var(--muted); }
.saved-bar__note button { font: inherit; font-weight: 600; color: var(--accent); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

/* Case number + PDF status */
.case-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr); gap: 6px 12px; align-items: center; margin: 0 0 18px; }
.case-row label { font-size: 0.95rem; font-weight: 500; }
.case-row small { display: block; color: var(--muted); font-weight: 400; font-size: 0.8rem; }
.pdf-msg { margin: 8px 0 0; font-size: 0.86rem; color: var(--muted); }
.pdf-msg:empty { display: none; }
@media (max-width: 720px) { .case-row { grid-template-columns: 1fr; } }

/* "?" instruction buttons and dialog */
.grid__label { display: flex; align-items: flex-start; gap: 8px; }
.grid__label label { flex: 1; }
.field__label { display: inline-flex; align-items: center; gap: 8px; }
.help {
  flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; padding: 0;
  border-radius: 50%; border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--accent);
  font: 700 0.78rem/1 var(--sans); cursor: pointer; vertical-align: middle;
}
.help:hover { border-color: var(--accent); background: var(--accent-soft); }
.help[hidden] { display: none; }
.sheet__title .help, .result__form .help { margin-left: 4px; }
.help-dialog {
  width: min(680px, calc(100vw - 32px)); max-height: min(80vh, 760px); padding: 0; overflow: auto;
  border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet); color: var(--ink);
}
.help-dialog::backdrop { background: rgb(15 23 32 / 0.45); }
.help-dialog__head {
  position: sticky; top: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 18px 20px 12px; background: var(--sheet); border-bottom: 1px solid var(--rule);
}
.help-dialog__source { margin: 0 0 2px; color: var(--muted); font-size: 0.84rem; }
.help-dialog h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 1.3rem; line-height: 1.25; text-wrap: balance; }
.help-dialog__close { flex: none; width: 34px; height: 34px; border: 1px solid var(--rule-strong); border-radius: 50%; background: var(--sheet); color: var(--ink); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.help-dialog__body { padding: 14px 20px 4px; }
.help-dialog__section + .help-dialog__section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule); }
.help-dialog__section h3 { margin: 0 0 8px; font-size: 0.86rem; font-weight: 600; color: var(--ink-2); }
.help-dialog blockquote { margin: 0; padding-left: 14px; border-left: 3px solid var(--accent); font-family: var(--serif); font-size: 1.02rem; line-height: 1.6; max-width: 64ch; }
.help-dialog blockquote p { margin: 0 0 10px; }
.help-dialog blockquote ul { margin: 0 0 10px; padding-left: 20px; }
.help-dialog__foot { margin: 0; padding: 10px 20px 18px; font-size: 0.84rem; color: var(--muted); }

/* Pinned total on small screens */
.mobile-total { display: none; }
@media (max-width: 960px) {
  .mobile-total {
    display: flex; align-items: baseline; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
    padding: 10px max(var(--gutter), env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(var(--gutter), env(safe-area-inset-left, 0px)); background: var(--sheet);
    border-top: 1px solid var(--rule-strong); color: var(--ink); text-decoration: none; font-size: 0.9rem;
  }
  .mobile-total strong { font-family: var(--serif); font-size: 1.35rem; padding-bottom: 2px; background: linear-gradient(var(--highlight), var(--highlight)) no-repeat left bottom / 100% 3px; }
  .mobile-total span:last-child { color: var(--muted); }
  body { padding-bottom: 64px; }
}
@media print { .mobile-total { display: none !important; } }

/* Show/hide per worksheet */
[data-for][hidden] { display: none !important; }

/* Responsive */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .result { position: static; }
  .counsel { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .arrangement { grid-template-columns: 1fr; }
  .sheet { padding: 18px 14px 8px; }
  .grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .grid > .grid__label { grid-column: 1 / -1; padding-bottom: 0; }
  .grid > .grid__head:first-child { display: none; }
  .counsel__form { grid-template-columns: 1fr; }
  .worksheet { overflow-x: auto; }
  .worksheet table { font-size: 0.8rem; }
  .worksheet th, .worksheet td { padding: 6px 7px; }
}

/* Print: just the filled-in worksheet */
@media print {
  .masthead, .intro, .ad-slot, .sheet, .counsel, .result__actions, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  .layout { display: block; }
  .result { position: static; }
  .worksheet[hidden] { display: block; }
  .result__card, .worksheet { border: 1px solid #999; }
  .mark { background: none; }
}
