* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  color-scheme: light;
  --ink: #17243a;
  --muted: #53627a;
  --line: #d8e0ec;
  --panel: #ffffff;
  --wash: #f6f8fb;
  --blue: #184f95;
  --blue-dark: #113d76;
  --mint: #e7f5ef;
  --mint-ink: #1b5c43;
  --error: #8f2727;
  --shadow: 0 12px 32px rgba(23, 36, 58, .06);
}
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--wash); color: var(--ink); font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.55; }
a { color: var(--blue); text-underline-offset: .18em; }
a:hover { color: var(--blue-dark); }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #e3a627; outline-offset: 3px; }
.skip-link { position: absolute; top: -4rem; left: 1rem; z-index: 10; padding: .6rem .85rem; background: #fff; border: 2px solid var(--blue); border-radius: .5rem; }
.skip-link:focus { top: .75rem; }
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.header-inner { width: min(1080px, calc(100% - 2rem)); min-width: 0; margin: 0 auto; min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .65rem; background: #e7f0fb; color: var(--blue); font-size: .83rem; }
nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .35rem 1.1rem; }
nav a { color: var(--muted); font-size: .9rem; font-weight: 650; text-decoration: none; }
nav a:hover { color: var(--blue); }
.page-shell { width: min(920px, calc(100% - 2rem)); min-width: 0; margin: 0 auto; padding: 2.25rem 0 4rem; }
.hero { max-width: 780px; margin: 0 auto 1.6rem; text-align: center; }
.eyebrow, .step-label { margin: 0 0 .4rem; color: var(--blue); font-size: .76rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
h1, h2, p { overflow-wrap: anywhere; }
h1 { margin: .15rem 0 .8rem; font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.08; letter-spacing: -.045em; }
h2 { margin: 0; font-size: clamp(1.2rem, 3vw, 1.5rem); line-height: 1.25; letter-spacing: -.025em; }
.hero-copy { max-width: 700px; margin: 0 auto 1rem; color: var(--muted); font-size: 1.08rem; }
.hero-note { display: inline-block; max-width: 700px; margin: .2rem auto 0; padding: .65rem .9rem; border: 1px solid #d5e4f5; border-radius: .75rem; background: #eef5fc; color: #304967; font-size: .92rem; text-align: left; }
.planner-form { display: grid; gap: 1rem; min-width: 0; }
.panel, .results-section, .text-panel, .safety-panel { min-width: 0; padding: clamp(1rem, 3vw, 1.5rem); border: 1px solid var(--line); border-radius: 1rem; background: var(--panel); box-shadow: var(--shadow); }
.section-heading, .results-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.step-label { margin-bottom: .25rem; }
.tag { flex: 0 0 auto; padding: .28rem .6rem; border: 1px solid #d9e4f3; border-radius: 99px; background: #f2f6fc; color: #395678; font-size: .75rem; font-weight: 750; }
.field-grid { display: grid; gap: .9rem; min-width: 0; }
.field-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: grid; gap: .42rem; min-width: 0; color: #263850; font-size: .92rem; font-weight: 700; }
input, select { width: 100%; min-width: 0; min-height: 46px; padding: .62rem .72rem; border: 1px solid #bac8da; border-radius: .6rem; background: #fff; color: var(--ink); }
input::placeholder { color: #8896a8; }
input:disabled, select:disabled { background: #edf0f4; color: #69768a; cursor: not-allowed; }
.field-help { margin: .7rem 0 0; color: var(--muted); font-size: .88rem; }
.mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; margin: 0 0 1rem; padding: 0; border: 0; }
.mode-options legend { margin-bottom: .55rem; color: #263850; font-size: .92rem; font-weight: 700; }
.radio-card { display: flex; align-items: flex-start; gap: .65rem; min-width: 0; padding: .8rem; border: 1px solid var(--line); border-radius: .75rem; background: #fbfcfe; cursor: pointer; }
.radio-card:has(input:checked) { border-color: #7ba8d7; background: #f1f7fd; }
.radio-card input { flex: 0 0 auto; width: 1.05rem; min-height: 1.05rem; height: 1.05rem; margin: .2rem 0 0; accent-color: var(--blue); }
.radio-card span { display: grid; gap: .18rem; min-width: 0; }
.radio-card strong { color: var(--ink); font-size: .92rem; }
.radio-card small { color: var(--muted); font-size: .8rem; font-weight: 450; line-height: 1.35; }
.split-fields { min-width: 0; }
#equal-fields label { max-width: 17rem; }
.person-list { display: grid; gap: .65rem; min-width: 0; }
.person-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .65rem; min-width: 0; }
.person-row label { min-width: 0; }
.person-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-top: .8rem; }
.person-actions .field-help { margin: 0; }
.button { min-height: 44px; padding: .65rem 1rem; border: 1px solid transparent; border-radius: .65rem; font-weight: 750; }
.button-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 15px rgba(24, 79, 149, .18); }
.button-primary:hover { background: var(--blue-dark); }
.button-secondary { border-color: #b9c9dc; background: #fff; color: var(--blue-dark); }
.button-secondary:hover { background: #f2f7fc; }
.button-small { min-height: 42px; padding: .55rem .75rem; font-size: .83rem; }
.button-remove { border-color: #d8e0ec; background: #fff; color: #6b3940; }
.button:disabled { opacity: .48; cursor: not-allowed; }
.submit-row { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1rem; }
.submit-note { margin: 0; color: var(--muted); font-size: .88rem; }
.error-box { padding: .8rem 1rem; border: 1px solid #e6b4b4; border-radius: .7rem; background: #fff0f0; color: var(--error); font-weight: 700; }
.results-section { margin-top: 1.5rem; scroll-margin-top: 1rem; }
.results-heading { align-items: flex-end; }
.results-summary { margin: -.4rem 0 1rem; color: var(--muted); }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; }
.summary-card { display: grid; align-content: start; gap: .2rem; min-width: 0; padding: .8rem; border: 1px solid var(--line); border-radius: .7rem; background: #fbfcfe; }
.summary-card span { color: var(--muted); font-size: .8rem; font-weight: 650; }
.summary-card strong { font-size: clamp(1rem, 2.4vw, 1.3rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.summary-card small { color: var(--muted); font-size: .73rem; }
.summary-total { border-color: #a9c7e8; background: #eef5fc; }
.reconciliation-box { margin: 1rem 0; padding: .85rem 1rem; border: 1px solid #b6d9ca; border-radius: .75rem; background: var(--mint); color: var(--mint-ink); }
.reconciliation-box strong { display: block; font-size: 1rem; }
.reconciliation-box p { margin: .25rem 0 0; color: #315e4d; font-size: .88rem; }
.table-wrap { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; border: 1px solid var(--line); border-radius: .75rem; }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
caption { padding: .7rem .85rem; color: var(--muted); font-size: .83rem; font-weight: 700; text-align: left; }
th, td { padding: .72rem .8rem; border-top: 1px solid #e7ecf2; text-align: left; vertical-align: middle; white-space: nowrap; }
thead th { background: #f2f5f9; color: #34465e; font-size: .8rem; }
tbody th { font-size: .9rem; }
.money-cell { text-align: right; }
.adjustment-cell { color: #715126; }
.due-cell { color: #123f73; font-weight: 800; }
tfoot th, tfoot td { border-top: 2px solid #b9c8da; background: #f7f9fc; font-weight: 800; }
.result-disclaimer { margin: .75rem 0 0; color: var(--muted); font-size: .84rem; }
.text-panel, .safety-panel { margin-top: 1rem; }
.text-panel p { color: #3e4e63; }
.text-panel p:last-child { margin-bottom: 0; }
.text-panel ul { padding-left: 1.2rem; color: #3e4e63; }
.text-panel li + li { margin-top: .45rem; }
.rounding-panel { background: #fbfcfe; }
.safety-panel { border-color: #eadcb3; background: #fffaf0; }
.safety-panel h2 { font-size: 1.15rem; }
.safety-panel ul { margin-bottom: 0; padding-left: 1.2rem; color: #574b31; }
.safety-panel li + li { margin-top: .35rem; }
.site-footer { border-top: 1px solid var(--line); background: #fff; }
.site-footer > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; width: min(920px, calc(100% - 2rem)); margin: 0 auto; padding: 1rem 0 1.4rem; color: var(--muted); font-size: .84rem; }
.site-footer p { margin: 0; }

@media (max-width: 680px) {
  .header-inner { align-items: flex-start; flex-direction: column; justify-content: center; gap: .45rem; padding: .7rem 0; }
  nav { justify-content: flex-start; gap: .3rem .85rem; }
  nav a { font-size: .82rem; }
  .page-shell { padding-top: 1.4rem; }
  .hero { text-align: left; }
  .hero-note { display: block; }
  .field-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .mode-options { grid-template-columns: minmax(0, 1fr); }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-heading, .results-heading { align-items: flex-start; }
  .results-heading { flex-direction: column; gap: .5rem; }
}
@media (max-width: 380px) {
  .page-shell, .header-inner, .site-footer > div { width: calc(100% - 1.25rem); }
  .panel, .results-section, .text-panel, .safety-panel { padding: .85rem; border-radius: .8rem; }
  .section-heading { gap: .4rem; }
  .tag { font-size: .68rem; padding: .25rem .45rem; }
  .person-row { grid-template-columns: minmax(0, 1fr); }
  .person-row .button { justify-self: start; }
  .summary-card { padding: .65rem; }
  .summary-card strong { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
