:root {
  color-scheme: light;
  --forest: #174a3b;
  --forest-deep: #10382e;
  --leaf: #dcebe3;
  --citrus: #d36d3d;
  --ink: #1d2b27;
  --muted: #64736d;
  --line: #d7dfdb;
  --paper: #f5f7f4;
  --white: #ffffff;
  --soft: #edf2ee;
  --danger: #a13e31;
  --font: "DM Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

button, input, select { font: inherit; }

.topbar {
  min-height: 62px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: white;
  background: var(--forest-deep);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.wordmark-mark {
  display: grid;
  width: 28px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid #91b6a4;
  border-radius: 50%;
  color: #d5e8dc;
  font-family: var(--mono);
  font-size: 14px;
}

.runtime { display: flex; align-items: center; gap: 8px; color: #d4e2db; font-size: 12px; }
.runtime-dot { width: 8px; aspect-ratio: 1; border-radius: 50%; background: #e0a55c; }
.runtime-dot.ready { background: #73c89a; }
.runtime-dot.error { background: #ed8b72; }

main { max-width: 1280px; margin: 0 auto; padding: 42px clamp(20px, 5vw, 72px) 72px; }

.intro { max-width: 790px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 8px; color: var(--citrus); font: 500 11px/1.3 var(--mono); letter-spacing: 0.08em; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 700px; margin-bottom: 10px; color: var(--forest-deep); font-size: clamp(32px, 4vw, 48px); line-height: 1.08; font-weight: 600; }
.intro-copy { max-width: 630px; margin-bottom: 20px; color: #53635c; font-size: 16px; }
.year-note { display: flex; align-items: flex-start; gap: 10px; max-width: 760px; padding: 12px 14px; border-left: 3px solid var(--citrus); background: #f4e9e1; color: #58463c; }
.year-note p { margin: 0; font-size: 12px; }
.note-mark { display: grid; flex: 0 0 17px; width: 17px; aspect-ratio: 1; place-items: center; border: 1px solid #9a5d40; border-radius: 50%; color: #9a5d40; font: 600 11px var(--mono); }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, 0.9fr); align-items: start; gap: clamp(28px, 4vw, 56px); }
form { min-width: 0; }
.form-heading, .results-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.form-heading h2, .results-heading h2 { margin: 0; color: var(--forest-deep); font-size: 24px; font-weight: 600; }
.quiet-button { padding: 8px 11px; border: 1px solid #aebdb4; border-radius: 4px; background: transparent; color: var(--forest); font-size: 12px; font-weight: 600; cursor: pointer; }
.quiet-button:hover { background: var(--leaf); }

fieldset { min-width: 0; margin: 22px 0 0; padding: 18px 0 21px; border: 0; border-top: 1px solid var(--line); }
legend { padding: 0 12px 0 0; color: var(--ink); font-size: 16px; font-weight: 700; }
.step { margin-right: 8px; color: var(--citrus); font: 500 12px var(--mono); }
.section-help { max-width: 620px; margin: 5px 0 16px; color: var(--muted); font-size: 12px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.field { display: grid; min-width: 0; gap: 6px; color: #34443d; font-size: 12px; font-weight: 600; }
.field b { color: var(--citrus); }
.field small { display: block; color: #76827d; font-size: 10px; font-weight: 400; }
.field-wide { grid-column: 1 / -1; }
.money-input, select { min-width: 0; height: 40px; border: 1px solid #cbd5cf; border-radius: 4px; background: var(--white); }
.money-input { display: flex; align-items: center; gap: 7px; padding: 0 10px; }
.money-input > span { color: #76827d; font: 12px var(--mono); }
.money-input:focus-within, select:focus { border-color: var(--forest); outline: 2px solid #bad5c6; outline-offset: 1px; }
.money-input input { width: 100%; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font: 13px var(--mono); }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { margin: 0; }
input[type="number"] { appearance: textfield; }
select { padding: 0 10px; color: var(--ink); font-size: 13px; }
.check-row { display: flex; align-items: flex-start; gap: 9px; color: #53635c; font-size: 12px; }
.check-row input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--forest); }
fieldset > .check-row { margin-top: 15px; }
.check-grid { display: grid; gap: 10px; margin-top: 15px; }
.form-actions { padding-top: 3px; }
.primary-button { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: space-between; padding: 0 16px; border: 0; border-radius: 4px; background: var(--forest); color: white; font-weight: 700; cursor: pointer; }
.primary-button:hover:not(:disabled) { background: #22624e; }
.primary-button:disabled { cursor: wait; opacity: 0.55; }
.primary-button span:last-child { font: 20px var(--mono); }
.form-error { min-height: 18px; margin: 7px 0 0; color: var(--danger); font-size: 12px; }

.results { position: sticky; top: 20px; min-width: 0; padding-top: 2px; }
.results-heading { display: block; margin-bottom: 18px; }
.results-heading .section-help { margin-bottom: 0; }
.regime-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.regime-card { min-width: 0; padding: 15px; border: 1px solid var(--line); border-top: 4px solid var(--forest); background: var(--white); }
.regime-card.old { border-top-color: var(--citrus); }
.regime-name { margin: 0 0 12px; color: var(--muted); font: 500 11px var(--mono); text-transform: uppercase; }
.monthly-label { margin-bottom: 2px; color: var(--muted); font-size: 11px; }
.monthly-value { margin: 0 0 14px; color: var(--forest-deep); font: 600 clamp(21px, 2.2vw, 29px)/1.2 var(--mono); overflow-wrap: anywhere; }
.result-list { margin: 0; }
.result-row { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-top: 1px solid #e8ede9; font-size: 11px; }
.result-row dt { color: var(--muted); }
.result-row dd { margin: 0; color: var(--ink); font: 500 11px var(--mono); text-align: right; }
.tax-note { min-height: 30px; margin: 9px 0 0; color: var(--muted); font-size: 10px; }

.sweep-section { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.sweep-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sweep-heading h3 { margin: 0; color: var(--forest-deep); font-size: 19px; font-weight: 600; }
.sweep-tag { padding: 5px 7px; background: var(--leaf); color: var(--forest); font-size: 10px; font-weight: 600; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.sweep-table { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: 10px; white-space: nowrap; }
.sweep-table caption { padding: 11px 0 6px; color: var(--forest); font: 500 10px var(--mono); text-align: left; text-transform: uppercase; }
.sweep-table th, .sweep-table td { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.sweep-table th:first-child, .sweep-table td:first-child { text-align: left; }
.sweep-table th { color: var(--muted); font-weight: 600; }
.sweep-table td { font-family: var(--mono); }
.result-caveat { margin: 15px 0 0; color: var(--muted); font-size: 10px; }
.site-footer { display: flex; justify-content: space-between; gap: 16px; padding: 17px clamp(20px, 5vw, 72px); border-top: 1px solid var(--line); color: var(--muted); font: 10px var(--mono); }

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .results { position: static; }
  .regime-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .topbar { min-height: 56px; padding-inline: 16px; }
  .runtime { max-width: 150px; font-size: 10px; }
  main { padding: 30px 16px 48px; }
  h1 { font-size: 34px; }
  .intro-copy { font-size: 14px; }
  .form-heading { align-items: center; }
  .form-heading h2, .results-heading h2 { font-size: 21px; }
  .field-grid { gap: 12px 10px; }
  .field-grid .field { font-size: 11px; }
  .regime-grid { gap: 8px; }
  .regime-card { padding: 11px 9px; }
  .monthly-value { font-size: 20px; }
  .result-row { font-size: 10px; }
  .result-row dd { font-size: 10px; }
  .site-footer { flex-direction: column; padding: 15px 16px; }
}