:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #202e32;
  background: #f5f7f7;
  --accent: #285fa0;
  --muted: #596a6e;
  --border: #dce4e3;
}

* { box-sizing: border-box; }
body { margin: 0; }
.page { max-width: 1180px; margin: 0 auto; padding: 60px 32px 28px; }
.page-header { max-width: 760px; margin-bottom: 36px; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: .75rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2rem, 4.3vw, 3.2rem); line-height: 1.12; letter-spacing: -.045em; }
.subtitle { margin: 18px 0 0; color: var(--muted); font-size: 1.08rem; line-height: 1.6; }
h2 { margin: 0; font-size: 1.3rem; letter-spacing: -.025em; }
.calculator-layout { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.3fr); gap: 24px; align-items: start; }
.card { padding: 30px; border: 1px solid var(--border); border-radius: 20px; background: #fff; box-shadow: 0 5px 22px #203d3604; }
.card-intro { color: var(--muted); font-size: .9rem; line-height: 1.6; margin: 10px 0 26px; }
.field { min-width: 0; margin: 0 0 25px; padding: 0; border: 0; }
.field:last-child { margin-bottom: 0; }
label, legend { font-size: .9rem; font-weight: 650; }
legend { padding: 0; margin-bottom: 11px; }
select, input[type="number"] { width: 100%; min-height: 48px; border: 1px solid #bfcfcd; border-radius: 9px; background: #fff; color: inherit; font: inherit; }
select { display: block; margin-top: 10px; padding: 10px 12px; }
.choices { display: flex; gap: 10px; }
.choice { display: flex; align-items: center; gap: 9px; min-height: 46px; padding: 10px 18px; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; }
.choice:has(input:checked) { background: #edf3fa; border-color: var(--accent); color: var(--accent); }
input[type="radio"] { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.currency-input { position: relative; margin-top: 10px; }
.currency-input span { position: absolute; left: 15px; top: 12px; color: var(--muted); }
.currency-input input { padding: 10px 12px 10px 33px; }
.helper { color: var(--muted); font-size: .8rem; line-height: 1.5; margin: 9px 0 0; }
[hidden] { display: none !important; }
.results { display: grid; gap: 20px; min-width: 0; }
.current-pay { border-top: 4px solid var(--accent); }
.metrics { margin: 24px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.metrics > div { min-width: 0; }
.metrics dt { font-size: .83rem; color: var(--muted); line-height: 1.5; }
.metrics dd { margin: 8px 0 0; font-size: 1.05rem; font-weight: 650; letter-spacing: -.02em; }
.metrics .primary-metric { grid-column: 1 / -1; padding-bottom: 25px; border-bottom: 1px solid var(--border); }
.primary-metric dd { font-size: clamp(1.75rem, 3.1vw, 2.5rem); color: var(--accent); line-height: 1.2; }
.rise-metrics > div:last-child { grid-column: 1 / -1; }
.preview-status { margin: 0; padding: 0 8px; color: var(--muted); font-size: .82rem; line-height: 1.6; }
.timeline-section { margin-top: 42px; }
.timeline { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; list-style: none; margin: 18px 0 0; padding: 0; }
.timeline li { padding: 18px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.timeline h3 { margin: 0; font-size: .8rem; font-weight: 650; line-height: 1.5; }
.timeline p { margin: 10px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
footer { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }
footer p { max-width: 970px; margin: 0; color: var(--muted); font-size: .75rem; line-height: 1.8; }

@media (max-width: 900px) {
  .timeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card { padding: 24px; }
}

@media (max-width: 680px) {
  .page { padding: 32px 20px 24px; }
  .page-header { margin-bottom: 28px; }
  .calculator-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .card { padding: 24px 20px; border-radius: 16px; }
  .metrics { gap: 22px 16px; }
  .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline-section { margin-top: 32px; }
}

/* Keep longer classification labels and reference notes inside small screens. */
select { min-width: 0; max-width: 100%; }
.metrics dd, .timeline p { overflow-wrap: anywhere; }
.deductions-note { margin-top: 18px; }
#employment-basis-note { margin-top: 22px; }

.input-error { color: #a32b35; font-size: .82rem; line-height: 1.5; margin: 8px 0 0; }
.input-error:empty { display: none; }
[aria-invalid="true"] { border-color: #a32b35; }
.deduction-metrics { border-top: 1px solid var(--border); padding-top: 22px; }
.timeline-kind { display: block; margin-top: 8px; font-size: .7rem; color: var(--muted); line-height: 1.5; }
.assumptions { margin-top: 32px; }
.assumptions p { font-size: .82rem; line-height: 1.7; color: var(--muted); }
a { color: var(--accent); overflow-wrap: anywhere; }

.metrics dd.tax-helper { font-size: .8rem; font-weight: 400; letter-spacing: normal; line-height: 1.5; color: var(--muted); }

/* Version 2: one-off payments remain separate from ordinary pay. */
.upcoming-section { margin-top: 36px; }
.eligibility-choice { display: flex; align-items: flex-start; gap: 12px; margin-top: 20px; line-height: 1.6; cursor: pointer; }
.eligibility-choice input { flex-shrink: 0; width: 18px; height: 18px; margin: 4px 0 0; accent-color: var(--accent); }
.payment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin: 22px 0 18px; }
.payment-card { min-width: 0; }
.payment-date { font-weight: 700; margin: 0 0 16px; }
.payment-card h3 { margin: 0; font-size: 1.2rem; }
.payment-metrics { grid-template-columns: minmax(0, 1fr); gap: 18px; }
.payment-total { border-top: 1px solid var(--border); padding-top: 18px; }
.payment-total dd { color: var(--accent); font-size: 1.8rem; }
.backpay-breakdown { margin: 22px 0 14px; border-top: 1px solid var(--border); padding-top: 16px; }
.backpay-breakdown summary { color: var(--accent); font-size: .9rem; font-weight: 650; cursor: pointer; }
.backpay-breakdown .metrics { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 680px) { .payment-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; } }

/* Consistent timeline labels and a readable companion information page. */
.timeline-values { margin: 14px 0 0; }
.timeline-values > div + div { margin-top: 16px; }
.timeline-values dt { font-size: .72rem; line-height: 1.5; color: var(--muted); }
.timeline-values dd { margin: 5px 0 0; font-size: .95rem; font-weight: 650; overflow-wrap: anywhere; }
.disclaimer-page { max-width: 900px; }
.disclaimer-page h1 { margin-top: 24px; }
.disclaimer-content section + section { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--border); }
.disclaimer-content p, .disclaimer-content li { color: var(--muted); font-size: .95rem; line-height: 1.8; }
.disclaimer-content li + li { margin-top: 8px; }
@media (max-width: 680px) { .timeline-section .timeline { grid-template-columns: minmax(0, 1fr); } }

/* Give the calculator title the full page width on larger screens. */
@media (min-width: 1000px) {
  .page:not(.disclaimer-page) .page-header { max-width: none; }
  .page:not(.disclaimer-page) h1 { font-size: clamp(2rem, 3.5vw, 2.75rem); white-space: nowrap; }
}
