:root {
  color-scheme: light dark;
  --canvas: light-dark(#f5f7fb, #111318);
  --panel: light-dark(#ffffff, #1b1e26);
  --surface: light-dark(#f0f3f9, #232834);
  --surface-active: light-dark(#eaf0ff, #253653);
  --text: light-dark(#1a2232, #eef1f7);
  --muted: light-dark(#576378, #aeb8ca);
  --border: light-dark(#dbe1ec, #343b49);
  --border-subtle: light-dark(#e7ebf3, #2c323e);
  --control-border: light-dark(#7e8a9e, #6e7b91);
  --accent: light-dark(#2454d6, #9cbbff);
  --on-accent: light-dark(#ffffff, #11224d);
  --warning: light-dark(#885409, #efc784);
  --warning-bg: light-dark(#fff4de, #392d1e);
  --danger: light-dark(#b22d42, #ffadba);
  --danger-bg: light-dark(#fff0f0, #3c2429);
  --blue: light-dark(#2c63ad, #a9c9ff);
  --purple: light-dark(#76559f, #cfb6ed);
  --orange: light-dark(#9d4f26, #efb897);
  --slate: light-dark(#5b687c, #bdc5d3);
  --focus: light-dark(#2454d6, #bfd2ff);
  --shadow-color: light-dark(#15213d10, #00000025);
  --shadow: 0 8px 30px var(--shadow-color);
  --radius: 12px;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  font-size: var(--text-body-medium, 14px);
  line-height: var(--leading-body-medium, 1.5);
  background: var(--canvas);
  color: var(--text);
}
:root[data-storage="canvas"][data-color-mode="dark"]:not([data-theme-preference="light"]) { color-scheme: dark; }
:root[data-storage="canvas"][data-color-mode="light"]:not([data-theme-preference="dark"]) { color-scheme: light; }
:root[data-theme-preference="dark"] { color-scheme: dark; }
:root[data-theme-preference="light"] { color-scheme: light; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); }
html { scroll-padding-block: 16px calc(var(--quick-results-space, 0px) + 16px); }
button, input, select { font: inherit; }
button, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, input, select, summary, a, [tabindex] { scroll-margin-block: 12px; }
button { min-height: 40px; padding: 7px 13px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; line-height: 1.4; transition: box-shadow 140ms ease; }
button:hover:not(:disabled) { background: var(--surface); border-color: var(--control-border); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .48; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, var(--text)); border-color: transparent; box-shadow: 0 3px 10px #15213d1a; }
button.quiet-danger { color: var(--danger); }
a { color: var(--blue); text-underline-offset: 3px; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 25px; letter-spacing: -.04em; line-height: 1.2; font-weight: 700; }
h2 { font-size: 18px; letter-spacing: -.02em; line-height: 1.35; font-weight: 650; }
h3 { font-size: 14px; line-height: 1.4; font-weight: 650; }
p { max-width: 75ch; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.app-shell { max-width: 1200px; margin: 0 auto; padding: 28px 28px 24px; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 12px; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { display: block; flex: none; width: 46px; height: 46px; }
.brand p { font-size: 12px; color: var(--muted); margin-top: 5px; }
.masthead-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; }
.theme-control { display: flex; align-items: center; gap: 4px; padding: 0 8px; width: 99px; border: 1px solid var(--border); background: var(--panel); border-radius: 9px; color: var(--muted); }
.theme-control svg { flex: none; }
.theme-control select { width: 64px; min-height: 34px; padding: 4px 0; border: 0; border-radius: 5px; background: transparent; font-size: 12px; cursor: pointer; }
.theme-notice { color: var(--muted); font-size: 11px; margin: 4px 0 10px; }
.save-status { font-size: 11px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.save-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.save-status[data-state="saved"] { color: var(--accent); }
.save-status[data-state="error"] { color: var(--danger); }
.save-status[data-state="saving"] { color: var(--warning); }
.privacy-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; color: var(--muted); font-size: 11px; margin: 6px 0 14px; }
.privacy-bar .check-label { min-height: 28px; }
.privacy-bar > span { align-self: center; }
.warning-text { color: var(--warning); flex-basis: 100%; }
html[data-storage="canvas"] #browser-privacy, html[data-storage="canvas"] #clear-device-data { display: none; }
.data-menu { position: relative; font-size: 12px; }
.data-menu > summary { border: 1px solid var(--border); background: var(--panel); padding: 6px 10px; border-radius: 9px; min-height: 36px; display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; }
.data-menu-content { position: absolute; top: calc(100% + 8px); right: 0; width: 220px; z-index: 30; display: grid; padding: 7px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: 0 12px 36px #15213d24; }
.data-menu-content button { border-color: transparent; text-align: left; }
.scenario-bar { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: end; padding: 15px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.scenario-bar > .field { flex-basis: 100%; margin: 0; }
.saved-plans { margin-top: 8px; }
.saved-plans > summary { font-size: 11px; font-weight: 400; }
#working-plan-name { max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scenario-picker { display: grid; gap: 5px; min-width: 150px; width: min(410px, 100%); }
.scenario-picker > span { font-size: 11px; color: var(--muted); font-weight: 600; }
.scenario-picker select { min-height: 37px; font-weight: 600; width: 100%; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.tabs { display: flex; border: 1px solid var(--border); background: var(--surface); padding: 4px; border-radius: 12px; margin-top: 8px; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs > button { flex: 1; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 12px; padding: 10px 12px; min-height: 36px; white-space: nowrap; }
.tabs > button[aria-selected="true"] { color: var(--accent); background: var(--panel); box-shadow: 0 2px 6px #15213d12; }
.tabs > button:hover:not(:disabled) { background: var(--panel); color: var(--text); }
.tab-panel { padding-top: 18px; }
.plan-layout { display: grid; grid-template-columns: minmax(310px, 410px) minmax(0, 1fr); gap: 22px 32px; align-items: start; }
.loan-editor { min-width: 0; grid-column: 1; grid-row: 1; padding: 22px; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
.loan-advanced { min-width: 0; grid-column: 1; grid-row: 2; }
.plan-insights { grid-column: 2; grid-row: 1 / span 2; padding: 26px; border: 1px solid var(--border); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
.editor-section { border-bottom: 1px solid var(--border-subtle); padding-bottom: 18px; margin-bottom: 18px; }
.editor-section:last-child { margin-bottom: 0; border-bottom: 0; }
.editor-section > h2, .editor-section > h3 { margin-bottom: 14px; }
.loan-editor h2 { display: flex; align-items: center; gap: 9px; font-size: 15px; }
.step-number { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 25px; height: 25px; border-radius: 8px; font-size: 11px; font-weight: 700; background: var(--surface-active); color: var(--accent); }
.question-heading { margin: 22px 0 12px; }
.loan-editor .editor-section:first-child { border: 0; padding-bottom: 0; }
.amount-field .amount-entry input { font-size: 25px; font-weight: 600; padding: 8px 12px; }
.amount-entry { display: grid; grid-template-columns: minmax(0, 1fr) 100px; gap: 8px; }
.amount-entry select { font-size: 16px; }
.amount-field .amount-entry > input, .amount-field .amount-entry > select { height: 56px; min-height: 56px; }
.amount-field .field-hint { color: var(--accent); font-size: 12px; }
.loan-mode { margin-bottom: 10px; }
.loan-mode button { flex: 1; }
.mode-hint { margin-bottom: 18px; }
.next-payment-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 10px; font-size: 11px; color: var(--muted); margin: -10px 0 14px; }
.term-entry { display: grid; grid-template-columns: minmax(90px, 1fr) 88px; gap: 8px; }
.term-entry select { font-size: 14px; padding-inline: 6px; }
.term-entry:has(input[data-long-value="true"]) { grid-template-columns: minmax(0, 1fr); }
.payment-section { padding: 16px; border: 1px solid var(--accent); border-radius: 12px; background: var(--surface-active); }
#monthly-payment { font-size: 26px; font-weight: 650; height: 56px; min-height: 56px; line-height: 1.2; }
.payment-breakdown { color: var(--accent); font-size: 12px; }
.payment-error { color: var(--danger); font-size: 12px; margin: 2px 0; scroll-margin-bottom: 20px; }
.field-error { color: var(--danger); font-size: 11px; line-height: 1.5; }
.payment-section > .field-hint { margin-top: 10px; }
.payment-actions > button, #legacy-payment-notice > button { min-height: 44px; }
.payment-actions > button { max-width: 100%; }
.payment-actions > button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.payment-composer { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.payment-composer > p { overflow-wrap: anywhere; }
.payment-composer .payment-actions { margin-top: 10px; }
#monthly-payment-label { color: var(--text); font-weight: 550; }
#legacy-payment-notice > button { display: block; }
#use-monthly-schedule { margin-bottom: 12px; }
.advanced-heading { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.loan-advanced { padding: 4px 12px; }
.loan-advanced > details { margin-bottom: 0; padding: 6px 0; }
.simple-rule { font-size: 12px; color: var(--accent); padding-top: 10px; }
.active-settings { font-size: 12px; background: var(--surface-active); padding: 10px; border-radius: 6px; margin-top: 10px; }
.next-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.next-actions button { min-height: 40px; }
.result-detail { border-top: 1px solid var(--border); padding: 10px 0; }
.result-detail > summary { font-size: 12px; }
.result-detail .reading-section { margin-top: 12px; margin-bottom: 12px; }
.result-detail .cost-section { border: 0; padding: 12px 0; }
.section-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 14px; }
.section-intro { font-size: 12px; color: var(--muted); margin: -5px 0 16px; }
.field { display: grid; align-content: start; gap: 5px; margin-bottom: 13px; min-width: 0; }
.field label { font-size: 12px; font-weight: 550; }
.field label span { color: var(--muted); font-weight: 400; }
input:not([type="checkbox"]), select { border: 1px solid var(--control-border); border-radius: 8px; color: var(--text); background: var(--panel); padding: 8px 10px; width: 100%; min-width: 0; min-height: 44px; font-size: 16px; font-variant-numeric: tabular-nums; transition: box-shadow 140ms ease; }
input:hover, select:hover { border-color: var(--accent); }
input:not([type="checkbox"]):focus-visible, select:focus-visible { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent); }
input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-bg); }
input::placeholder { color: var(--muted); opacity: 1; font-size: 12px; }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; flex-shrink: 0; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 12px; }
.loan-editor .field-grid { grid-template-columns: minmax(200px, 1.25fr) minmax(140px, 1fr); row-gap: 10px; margin-bottom: 13px; }
.loan-editor .field-grid > .field { margin-bottom: 0; }
.loan-editor .field > label { min-height: 18px; }
.loan-editor .field:has(#tenure[data-long-value="true"]) { grid-column: 1 / -1; }
.loan-editor[data-compact="true"] .field-grid, .loan-editor[data-money-compact="true"] .amount-entry { grid-template-columns: minmax(0, 1fr); }
.field-hint, .table-note { color: var(--muted); font-size: 11px; line-height: 1.6; }
.field-hint + .field { margin-top: 12px; }
.preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin: -5px 0 16px; }
.preset-row button { padding: 4px 9px; min-height: 34px; font-weight: 500; font-size: 11px; background: var(--surface); border-color: transparent; border-radius: 7px; }
.preset-row button[aria-pressed="true"] { background: var(--surface-active); color: var(--accent); border-color: var(--accent); font-weight: 650; }
.text-button, .inline-button { border: 0; padding: 0; min-height: 28px; background: transparent; text-align: left; color: var(--accent); }
.text-button:hover:not(:disabled), .inline-button:hover:not(:disabled) { background: transparent; text-decoration: underline; }
.inline-button { display: inline; min-height: auto; font: inherit; text-decoration: underline; text-underline-offset: 3px; }
summary { cursor: pointer; font-size: 12px; font-weight: 600; list-style: none; display: flex; align-items: baseline; gap: 7px; padding: 7px 0; min-height: 32px; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "›"; font-size: 16px; line-height: 1; display: inline-block; transform-origin: center; }
details[open] > summary::before { transform: rotate(90deg); }
.details-content { padding-top: 12px; }
.details-content > .field-hint { margin-bottom: 14px; }
.count { color: var(--muted); font-weight: 400; }
.event-row { display: grid; grid-template-columns: 68px minmax(0, 1fr) auto; gap: 8px; align-items: end; margin-bottom: 12px; }
.event-row .field { margin: 0; }
.event-row label { font-size: 10px; }
.event-row button { min-height: 37px; padding: 7px; font-size: 14px; }
.empty-list { font-size: 11px; color: var(--muted); margin-bottom: 12px; }
.result-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.result-heading h2 { overflow-wrap: anywhere; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
#result-freshness { padding: 4px 8px; border: 1px solid var(--border); border-radius: 20px; font-size: 10px; color: var(--accent); }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 16px; padding: 0 0 18px; border-bottom: 1px solid var(--border-subtle); }
.metric { display: grid; align-content: start; gap: 4px; min-width: 0; margin: 0; }
.metric dt { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.metric dd { margin: 0; font-size: clamp(21px, 2.5vw, 29px); font-weight: 650; line-height: 1.2; letter-spacing: -.035em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric small { color: var(--muted); font-size: 11px; }
.metric.payoff dd { color: var(--accent); font-size: 22px; }
.metric.interest-total { grid-column: 1 / -1; padding: 17px 18px; background: var(--surface); border: 1px solid var(--border); border-top: 2px solid var(--accent); border-radius: 12px; }
.metric.interest-total dd { font-size: 38px; color: var(--text); letter-spacing: -.045em; }
.savings-line { padding: 12px 0; color: var(--accent); font-size: 12px; line-height: 1.7; }
.savings-line.negative { color: var(--warning); }
.balance-figure { margin: 20px 0 28px; }
.balance-figure .section-heading { align-items: baseline; margin-bottom: 6px; }
.check-label { display: inline-flex; gap: 6px; font-size: 11px; color: var(--muted); cursor: pointer; align-items: center; white-space: nowrap; }
.chart { width: 100%; min-height: 180px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: var(--border-subtle); stroke-width: 1; stroke-dasharray: 3 5; }
.chart-axis { fill: var(--muted); font-size: 10px; font-family: inherit; }
.chart-line { fill: none; stroke-width: 1.8; opacity: .85; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart-line.selected { stroke-width: 3; opacity: 1; }
.series-0 { stroke: var(--accent); color: var(--accent); }
.series-1 { stroke: var(--blue); color: var(--blue); }
.series-2 { stroke: var(--warning); color: var(--warning); }
.series-3 { stroke: var(--purple); color: var(--purple); }
.series-4 { stroke: var(--orange); color: var(--orange); }
.series-5 { stroke: var(--slate); color: var(--slate); }
.chart-line.selected { stroke: var(--accent); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 5px 13px; margin: 2px 0 10px; }
.legend-item { display: inline-flex; gap: 6px; align-items: center; font-size: 10px; color: var(--muted); }
.legend-item.selected { font-weight: 650; color: var(--text); }
.legend-item.selected .legend-swatch { color: var(--accent); }
.legend-swatch { width: 15px; height: 0; border-top: 2px solid currentColor; flex: none; }
.legend-swatch.dashed { border-top-style: dashed; }
figcaption { font-size: 10px; color: var(--muted); line-height: 1.5; max-width: 75ch; }
.cost-section { border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); padding: 20px 0; }
.cost-section .section-heading { margin-bottom: 12px; }
#cost-chart svg { width: 100%; height: 24px; display: block; }
.cost-principal { fill: var(--accent); color: var(--accent); }
.cost-interest { fill: var(--warning); color: var(--warning); }
.cost-fees { fill: var(--purple); color: var(--purple); }
.cost-breakdown { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 13px 0 0; }
.cost-item { min-width: 0; }
.cost-item dt { color: var(--muted); font-size: 10px; display: flex; gap: 5px; align-items: center; }
.cost-item dd { margin: 4px 0 0; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.cost-swatch { width: 7px; height: 7px; background: currentColor; flex: none; }
.fee-breakdown-details { margin-top: 14px; }
.definition-list { margin: 12px 0 0; display: grid; gap: 9px; }
.definition-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(100px, auto); gap: 12px; align-items: baseline; }
.definition-row dt { color: var(--muted); font-size: 12px; }
.definition-row dd { margin: 0; text-align: right; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.reading-section { margin-top: 25px; }
.reading-section h3 { margin-bottom: 10px; }
.reading-section p + p { margin-top: 9px; }
.reading-section > p:not(.field-hint) { font-size: 12px; color: var(--muted); line-height: 1.65; }
.reading-section .field-hint { margin-top: 12px; }
.page-intro { margin: 0 0 26px; }
.page-intro h2 { font-size: 23px; margin-bottom: 9px; letter-spacing: -.03em; }
.page-intro p { font-size: 13px; color: var(--muted); line-height: 1.65; }
.table-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); scrollbar-width: thin; background: var(--panel); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-size: 11px; color: var(--muted); padding: 10px 13px; border-bottom: 1px solid var(--border-subtle); }
th, td { padding: 13px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border-subtle); }
thead th { font-size: 10px; font-weight: 600; background: var(--surface); color: var(--muted); position: sticky; top: 0; z-index: 1; }
th:first-child, td:first-child { text-align: left; }
tbody th { font-weight: 500; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr.selected { background: var(--surface-active); }
tbody tr:hover { background: var(--surface); }
tbody tr.selected:hover { background: var(--surface-active); }
.table-select { border: 0; padding: 0; min-height: 28px; color: var(--accent); text-align: left; white-space: normal; min-width: 135px; max-width: 210px; overflow-wrap: anywhere; background: transparent; }
.table-select:hover:not(:disabled) { background: transparent; text-decoration: underline; }
.cell-detail { display: block; font-size: 10px; font-weight: 400; color: var(--muted); margin-top: 3px; }
.table-note { margin-top: 12px; }
.comparison-current { background: var(--surface-active); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px; padding: 15px 18px; margin-bottom: 20px; font-size: 13px; }
.options-overview { margin-bottom: 22px; }
.options-overview table { table-layout: fixed; }
.options-overview th, .options-overview td { padding: 12px 8px; white-space: normal; overflow-wrap: anywhere; }
.options-overview th:first-child { width: 31%; }
.options-overview .cell-detail { font-size: 10px; }
.options-overview tbody td:last-child { color: var(--text); font-weight: 600; }
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.option-card { border: 1px solid var(--border); border-radius: 14px; background: var(--panel); padding: 22px; display: flex; flex-direction: column; min-width: 0; box-shadow: var(--shadow); }
.option-card.current { border: 2px solid var(--accent); padding: 21px; }
.option-card h3 { font-size: 17px; }
.option-subtitle { font-size: 12px; color: var(--muted); margin-top: 5px; }
.option-card .definition-list { margin: 18px 0 12px; gap: 12px; }
.option-card .definition-row:nth-child(2) dd { color: var(--accent); }
.option-card .definition-row:nth-child(3) dd { font-size: 19px; color: var(--text); }
.option-card .definition-row:nth-child(5) { padding-top: 10px; border-top: 1px solid var(--border); }
.option-cash { font-size: 11px; color: var(--muted); margin-bottom: 18px; }
.option-card > button { margin-top: auto; min-height: 40px; }
.option-card .current-option { color: var(--accent); opacity: 1; background: var(--surface-active); }
.saved-comparisons { margin: 26px 0 0; padding-top: 14px; border-top: 1px solid var(--border); }
.quick-results { display: none; }
.small { font-size: 11px; }
.muted { color: var(--muted); }
.positive { color: var(--accent); }
.negative { color: var(--warning); }
.goals-layout { display: grid; grid-template-columns: minmax(250px, 310px) minmax(0, 1fr); gap: 36px; }
.goal-inputs { padding-right: 25px; border-right: 1px solid var(--border-subtle); }
.target-options { margin-top: 12px; }
.target-option { padding: 15px 0; border-bottom: 1px solid var(--border-subtle); display: grid; gap: 5px; }
.target-option .target-label { color: var(--muted); font-size: 12px; }
.target-option strong { font-size: 25px; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.target-option p { font-size: 11px; color: var(--muted); }
.target-action { justify-self: start; margin-top: 5px; color: var(--accent); border-color: var(--accent); }
.goal-results { border: 1px solid var(--border); background: var(--panel); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.goal-results > .field-hint { margin-top: 15px; }
.tenure-section { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }
.tenure-section > .field-hint { margin-top: 12px; }
.fit-label { font-size: 10px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px; }
.fit-label.yes { color: var(--accent); border-color: var(--accent); }
.fit-label.no { color: var(--warning); }
.schedule-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.segmented { display: inline-flex; border: 1px solid var(--border); background: var(--panel); padding: 3px; border-radius: 9px; gap: 2px; }
.segmented button { border: 0; background: transparent; color: var(--muted); padding: 5px 15px; min-height: 30px; }
.segmented button[aria-pressed="true"] { background: var(--surface-active); color: var(--accent); }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 14px; font-size: 11px; color: var(--muted); }
#schedule-footer { margin-top: 9px; }
.notice { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); padding: 12px 15px; font-size: 12px; margin-bottom: 16px; overflow-wrap: anywhere; }
.notice p + .button-row { margin-top: 9px; }
.notice.warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.notice.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.notice strong { display: block; margin-bottom: 4px; }
#cash-feasibility-warning p + p { margin-top: 9px; }
.results-paused-note { display: none; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; color: var(--muted); font-size: 12px; margin-bottom: 20px; }
[data-results-state="paused"] [data-results] { display: none !important; }
[data-results-state="pending"] [data-results], [data-results-state="error"] [data-results] { display: none !important; }
[data-results-state="paused"] .results-paused-note { display: block; }
#comparison-notes { margin-top: 20px; }
footer { margin-top: 36px; border-top: 1px solid var(--border); padding-top: 15px; }
.assumptions > summary { font-size: 12px; color: var(--muted); }
.assumption-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 25px; padding: 18px 0; }
.assumption-grid h3 { margin-bottom: 9px; font-size: 12px; }
.assumption-grid p { font-size: 11px; color: var(--muted); line-height: 1.7; }
.assumption-grid p + p { margin-top: 9px; }
.footer-note { color: var(--muted); font-size: 10px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px 20px; max-width: none; padding-top: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: 12px; background: var(--canvas); padding: 10px; z-index: 100; }
.skip-link:focus { top: 10px; }
.print-only { display: none; }
.mobile-shortcut { display: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 850px) {
  .app-shell { padding: 20px; }
  .plan-layout, .goals-layout { gap: 20px; grid-template-columns: minmax(270px, 300px) minmax(0, 1fr); }
  .goal-inputs { padding-right: 20px; }
  .plan-insights { padding: 18px; }
  .cost-breakdown { grid-template-columns: 1fr; gap: 7px; }
  .cost-item { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
  .cost-item dd { margin-top: 0; }
  .masthead-actions { max-width: 190px; gap: 6px; }
  .assumption-grid { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 660px) {
  .app-shell { padding: 16px 16px calc(var(--quick-results-space, 110px) + 24px); }
  .masthead { gap: 12px; align-items: start; padding-bottom: 8px; }
  .brand { gap: 9px; }
  .brand-mark { width: 34px; height: 34px; margin-top: 2px; }
  h1 { font-size: 20px; }
  .brand p { font-size: 11px; max-width: 165px; }
  .masthead-actions { flex-direction: row; align-items: center; gap: 6px; min-width: 150px; max-width: 158px; }
  .save-status { order: 2; justify-content: flex-end; width: 100%; font-size: 10px; line-height: 1.3; text-align: right; }
  .theme-control { width: 84px; padding: 0 6px; }
  .theme-control select { width: 51px; min-height: 32px; font-size: 11px; }
  .data-menu > summary { min-height: 32px; font-size: 11px; }
  .scenario-bar { padding: 12px; gap: 9px; flex-wrap: wrap; }
  .scenario-picker { flex: 1 1 190px; }
  .scenario-actions { gap: 5px; }
  .scenario-actions button { padding: 6px 9px; min-height: 34px; font-size: 11px; }
  .tabs { justify-content: space-between; gap: 2px; margin-top: 6px; padding: 3px; }
  .tabs > button { padding: 8px 4px; font-size: 10px; flex-shrink: 0; min-height: 34px; }
  .tab-panel { padding-top: 14px; }
  .privacy-bar { gap: 3px 12px; margin-bottom: 6px; }
  .question-heading { margin-top: 10px; }
  .loan-editor .editor-section { margin-bottom: 14px; }
  .plan-layout, .goals-layout { display: flex; flex-direction: column; gap: 22px; }
  .loan-editor { order: 0; width: 100%; padding: 12px; border-radius: 13px; }
  .loan-editor .preset-row { margin-bottom: 12px; }
  .loan-editor .section-heading { margin-bottom: 10px; }
  .loan-editor h2 { font-size: 14px; gap: 7px; }
  .step-number { width: 22px; height: 22px; border-radius: 7px; font-size: 10px; }
  .plan-insights { order: 1; width: 100%; padding: 18px; }
  .loan-advanced { order: 2; width: 100%; }
  .goal-inputs { padding: 0; border-right: 0; width: 100%; }
  .goal-results { width: 100%; padding: 18px; }
  .result-heading { margin-bottom: 16px; }
  .mobile-shortcut { display: inline-flex; }
  #jump-to-inputs { margin: -3px 0 20px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; }
  .metric dd { font-size: 26px; }
  .metric.payoff dd { font-size: 21px; }
  .metric.interest-total dd { font-size: 33px; }
  .chart { min-height: 160px; }
  .cost-breakdown { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .cost-item { display: block; }
  .cost-item dd { font-size: 12px; margin-top: 5px; }
  .reading-section { margin-top: 21px; }
  .page-intro h2 { font-size: 21px; }
  .page-intro { margin-bottom: 20px; }
  .editor-section { margin-bottom: 21px; padding-bottom: 21px; }
  .field-grid { gap: 12px; }
  .field label { font-size: 12px; }
  .field-hint, .table-note { font-size: 11px; }
  .target-options { display: grid; grid-template-columns: 1fr; }
  .target-option { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 5px 12px; }
  .target-option p { grid-column: 1 / -1; }
  .target-action { grid-column: 1 / -1; }
  .target-option strong { font-size: 23px; }
  .tenure-section { margin-top: 26px; }
  th, td { padding: 11px; }
  .option-grid { grid-template-columns: 1fr; }
  .options-overview th, .options-overview td { font-size: 11px; padding: 10px 5px; }
  .options-overview thead th { font-size: 10px; }
  .options-overview .cell-detail { font-size: 9px; }
  .option-card { padding: 18px; }
  .option-card.current { padding: 17px; }
  .quick-results { display: grid; grid-template-columns: 1fr .85fr 1.1fr auto; gap: 8px; position: fixed; bottom: 0; left: 0; width: 100%; z-index: 20; background: var(--panel); border: 1px solid var(--border); border-bottom: 0; border-radius: 13px 13px 0 0; padding: 12px 14px max(12px, env(safe-area-inset-bottom)); box-shadow: 0 -5px 24px #15213d20; }
  .quick-results > div { display: grid; gap: 3px; min-width: 0; }
  .quick-results span { color: var(--muted); font-size: 9px; }
  .quick-results strong { font-size: 13px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  #quick-interest { color: var(--text); }
  #quick-payoff { color: var(--accent); }
  .quick-results button { align-self: center; padding: 5px 8px; font-size: 10px; color: var(--accent); }
  .quick-extra-note { grid-column: 1 / -1; font-size: 10px; color: var(--muted); overflow-wrap: anywhere; }
  body:has(input:focus) .quick-results { display: none; }
  .payment-section { padding: 12px; }
}
@media (max-width: 370px) {
  .app-shell { padding: 14px 12px calc(var(--quick-results-space, 110px) + 24px); }
  .brand-mark { width: 32px; height: 32px; }
  h1 { font-size: 19px; }
  .scenario-bar { align-items: stretch; }
  .scenario-picker { flex-basis: 100%; }
  .scenario-actions { justify-content: flex-end; width: 100%; }
  .metric dd { font-size: 24px; }
  .cost-breakdown { grid-template-columns: 1fr; }
  .cost-item { display: flex; }
  .cost-item dd { margin-top: 0; }
  .tabs { gap: 2px; }
  .tabs > button { font-size: 9px; padding-left: 3px; padding-right: 3px; }
  .quick-results { padding-left: 10px; padding-right: 10px; gap: 5px; }
  .quick-results strong { font-size: 11px; }
}
@media print {
  .privacy-bar, .theme-notice { display: none; }
  :root { color-scheme: light !important; font-size: 10px; --canvas: #fff; --panel: #fff; --surface: #f0f3f9; --text: #1a2232; --muted: #576378; --border: #dbe1ec; --border-subtle: #e7ebf3; --accent: #2454d6; --warning: #885409; --purple: #7555a0; --shadow: none; }
  .brand-mark { filter: grayscale(1); box-shadow: none; }
  .plan-insights { box-shadow: none; border-color: var(--border); }
  .app-shell { max-width: none; padding: 0; }
  .masthead-actions, .scenario-actions, .saved-plans, .tabs, .loan-editor, .loan-advanced, .goal-inputs, .schedule-toolbar, .pagination, .check-label, .skip-link, #panel-schedule, .text-button, .inline-button, .mobile-shortcut, .target-action, .quick-results, .next-actions, .option-card > button, #storage-error, #action-confirm { display: none !important; }
  .tab-panel[hidden] { display: block !important; }
  #panel-schedule[hidden] { display: none !important; }
  .plan-layout, .goals-layout { display: block; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric.interest-total { grid-column: auto; padding: 0; border: 0; background: transparent; }
  .tab-panel { page-break-before: auto; margin-top: 24px; }
  .table-scroll { overflow: visible; border-radius: 0; }
  table { font-size: 9px; }
  th, td { padding: 7px 5px; }
  .table-select { font-size: 9px; min-width: 0; max-width: 130px; }
  .chart { max-width: 650px; }
  .assumptions .assumption-grid { display: grid !important; }
  .print-only { display: block; margin-top: 24px; }
  .print-only h2 { margin-bottom: 12px; }
  tr { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  .scenario-bar { background: transparent; }
}
