:root {
  --ink: #0f172a;
  --muted: #475569;
  --paper: #f8fafc;
  --card: #fff;
  --line: #e2e8f0;
  --accent: #0f766e;
  --accent-deep: #115e59;
  --positive: #047857;
  --negative: #b91c1c;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .04);
  --sans: "Outfit", "Segoe UI", sans-serif;
  color-scheme: light;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
}
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); }
h1, h2, h3, .cards strong, dd, .total strong { font-family: var(--sans); }
h1 {
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  font-weight: 650;
  letter-spacing: -.03em;
  line-height: 1.15;
  margin: 0 0 12px;
  color: var(--ink);
}
h1::after {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  margin-top: 14px;
  border-radius: 99px;
  background: var(--accent);
}
h2 { font-size: 1.25rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.3; margin: 1.4rem 0 .6rem; color: var(--ink); }
.page-hero h2, .horizon > h2, .purchase-panel > h2, .target-panel > h2, .existing-overview > h2, .editorial > h2:first-child, .report-download h2, .calculator-loading h2, #calculator-inputs > h2, .tool-inputs legend { margin-top: 0; }
h3 { font-size: 1.05rem; font-weight: 650; margin-top: 24px; }
p { line-height: 1.65; }
a { color: var(--accent-deep); }
button, select, input { font: inherit; color: var(--ink); }
button, select {
  padding: 10px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
button { cursor: pointer; font-weight: 600; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease; }
button:hover { background: #f8fafc; border-color: #94a3b8; }
button:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.scenario-toolbar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.import { max-width: 100%; }
input[type=file] { max-width: 100%; background: white; border-radius: 8px; }
.notice {
  background: #fffbeb;
  color: var(--ink);
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #fde68a;
}
.calculator { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 24px; margin-top: 24px; align-items: start; }
.calculator > section { min-width: 0; }
#calculator-inputs, .tool-inputs, .page-hero:has(p), .property-card, .editor, .purchase-panel, .existing-overview, .target-panel, .horizon, .editorial, .support-cta, .personal-income, .report-download, .calculator-loading {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
#calculator-inputs { padding: 22px 18px 8px; }
.page-hero { margin: 0 0 20px; }
.page-hero:has(p) { padding: 28px 32px 8px; }
.page-hero h1, .page-hero p { position: relative; }
.page-hero:not(:has(p)) { background: transparent; border: 0; box-shadow: none; padding: 0; margin-bottom: 8px; }
.control { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 8px; margin: 0 0 16px; padding-bottom: 12px; border-bottom: 1px solid #f1f5f9; }
.control label { font-weight: 600; line-height: 1.35; }
.control label span {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .02em;
  vertical-align: 1px;
}
.control input[type=number] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.control input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
section > label { display: block; margin: 16px 0; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cards article {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  padding: 16px 16px 14px 18px;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.cards article::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #cbd5e1; }
.cards span { display: block; font-size: .8rem; color: var(--muted); font-weight: 550; }
.cards strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  font-weight: 650;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.cards article.stat-lead { background: #f0fdfa; }
.cards article.stat-lead::before { background: var(--accent); }
.cards article.stat-lead span { color: #115e59; }
.cards article.stat-alert { background: #fef2f2; }
.cards article.stat-alert::before { background: var(--negative); }
.cards article.stat-alert strong { color: var(--negative); }
.table-wrap { max-width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; font-variant-numeric: tabular-nums; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 650; color: #334155; letter-spacing: .01em; }
details { padding: 12px 0; }
summary { cursor: pointer; font-weight: 650; }
nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 20px; }
nav a { padding: 8px 12px; color: #334155; text-decoration: none; border-radius: 8px; font-weight: 600; }
nav a:hover { background: #f1f5f9; color: var(--ink); }
nav a.active { background: #f0fdfa; color: var(--accent-deep); }
.stacked { display: grid; gap: 8px; margin-bottom: 18px; font-weight: 600; }
input:not([type=checkbox]):not([type=range]):not([type=file]), select {
  min-width: 0;
  max-width: 100%;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}
.stacked input, .stacked select, .form-grid input, .form-grid select { width: 100%; padding: 10px 12px; }
.portfolio-totals { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); margin: 24px 0; }
.portfolio-totals strong { font-size: clamp(1.1rem, 1.6vw, 1.35rem); }
.property-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; margin: 24px 0; }
.property-card, .editor, .purchase-panel, .existing-overview, .target-panel, .horizon { padding: 20px; margin: 20px 0; min-width: 0; }
.property-card { margin: 0; overflow-wrap: anywhere; }
.existing-overview h2, .existing-overview p, .existing-overview strong { color: var(--ink); }
.existing-overview a { color: var(--accent-deep); font-weight: 650; }
.editor { border-top: 3px solid var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.form-grid label { display: grid; gap: 8px; align-content: start; font-weight: 600; }
dl { margin: 16px 0; }
dl > div { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
dt { font-weight: 550; color: var(--muted); }
dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.positive { color: var(--positive); font-weight: 650; }
.negative, .validation-errors { color: var(--negative); font-weight: 650; }
.muted { color: var(--muted); font-size: .92rem; }
.disclaimer-callout {
  margin: 20px 0;
  padding: 16px 18px;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  color: var(--ink);
}
.disclaimer-callout p { margin: 0 0 8px; line-height: 1.6; }
.disclaimer-callout p:last-child { margin: 0; }
.disclaimer-callout strong { font-weight: 650; }
.total {
  font-size: 1.15rem;
  padding: 14px 16px;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 10px;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.total strong { color: #fff; }
.empty { padding: 32px 0; }
.editorial { max-width: 760px; margin: 32px 0; padding: 28px 28px 12px; line-height: 1.7; }
.editorial h2 { margin-top: 28px; }
.editorial h2:first-child { margin-top: 0; }
.editorial li { margin: 8px 0; }
.lead { font-size: 1.12rem; max-width: 44rem; color: #334155; }
.tool-inputs { padding: 20px 18px 8px; min-width: 0; }
.tool-inputs legend { font-size: 1.15rem; font-weight: 650; margin-bottom: 16px; padding: 0 4px; }
.tax-inputs { max-width: 640px; }
.tool-inputs .toolbar { margin-bottom: 20px; }
.support-cta { padding: 20px; margin-top: 28px; }
.support-cta h2 { font-size: 1.1rem; }
.support-link { display: inline-block; padding: 10px 0; font-weight: 650; }
.primary-link {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 650;
}
.primary-link:hover { background: var(--accent-deep); color: #fff; }
.skip-link { position: absolute; left: 16px; top: -100px; padding: 12px; background: #fff; color: var(--ink); z-index: 40; border-radius: 8px; border: 1px solid var(--line); }
.skip-link:focus { top: 8px; }
[hidden] { display: none !important; }
button, select, input:not([type=checkbox]):not([type=range]) { min-height: 44px; }
main p, main h1, main h2, footer p { overflow-wrap: anywhere; }
main a { text-underline-offset: 3px; }
fieldset { min-width: 0; max-width: 100%; }
@media (max-width: 760px) { .calculator { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .property-card, .editor, .purchase-panel, .existing-overview, .target-panel, .horizon, .editorial, .page-hero:has(p) { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
  .loading-spinner { animation: none !important; }
}
.calculator-shortcuts { display: none; }
.table-hint { color: var(--muted); font-size: .85rem; margin-bottom: 8px; }
.table-wrap { overscroll-behavior-x: contain; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.table-wrap th { background: #f8fafc; color: #334155; }
.table-wrap tbody tr:nth-child(even) td { background: #f8fafc; }
.table-wrap th:first-child, .table-wrap td:first-child { position: sticky; left: 0; min-width: 80px; max-width: 160px; white-space: normal; overflow-wrap: anywhere; }
.table-wrap th:first-child { background: #f8fafc; }
.table-wrap td:first-child { background: #fff; }
.table-wrap tbody tr:nth-child(even) td:first-child { background: #f8fafc; }
.control input[type=range] { min-height: 44px; height: 44px; margin: 0; cursor: pointer; }
input[type=checkbox] { width: 20px; height: 20px; vertical-align: middle; accent-color: var(--accent); flex-shrink: 0; }
label:has(> input[type=checkbox]) { min-height: 44px; display: flex; align-items: center; gap: 10px; }
summary { min-height: 44px; padding: 10px 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 760px) {
  .calculator-shortcuts {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 8px;
    gap: 8px;
    background: rgba(248, 250, 252, .96);
    border: 1px solid var(--line);
    border-radius: 10px;
  }
  .calculator-shortcuts a { flex: 1; text-align: center; padding: 12px 8px; background: var(--accent); color: #fff; border-radius: 8px; text-decoration: none; }
  #calculator-inputs, #calculator-results { scroll-margin-top: 80px; }
  .cards article { padding: 14px 14px 12px 16px; }
}
@media (max-width: 600px) {
  .scenario-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .scenario-toolbar > label { grid-column: 1 / -1; display: grid; gap: 8px; }
  .scenario-toolbar button { width: 100%; padding: 10px 8px; }
  .scenario-toolbar select, .scenario-toolbar input { width: 100%; }
  .control { grid-template-columns: minmax(0, 1fr) 112px; column-gap: 12px; }
  input, select, textarea { font-size: 16px; }
}
@media (max-width: 360px) { .cards { grid-template-columns: minmax(0, 1fr); } }
.calculator-loading { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; padding: 24px; margin: 24px 0; }
.calculator-loading > div { flex: 1; min-width: 180px; }
.calculator-loading h2 { margin: 4px 0 8px; font-size: 1.25rem; }
.calculator-loading h2::after { display: none; }
.calculator-loading p { margin: 0; color: var(--muted); }
.calculator-loading .loading-brand { color: var(--accent); font-weight: 650; font-size: .8rem; letter-spacing: .04em; }
.loading-spinner {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 3px solid #ccfbf1;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: calculator-spin 1s linear infinite;
}
@keyframes calculator-spin { to { transform: rotate(360deg); } }
@media (max-width: 600px) {
  .calculator-loading { padding: 20px; gap: 16px; }
  .calculator-loading > div { order: 3; flex-basis: 100%; }
  .loading-spinner { margin-left: auto; }
}
.slider-guide { grid-column: 1 / -1; font-size: .8rem; line-height: 1.5; color: var(--muted); }
.personal-income { margin: 20px 0; padding: 18px 16px 8px; }
.take-home-highlight {
  padding: 20px;
  background: #0f172a;
  color: #fff;
  border-radius: 12px;
  margin: 16px 0;
}
.take-home-highlight span, .take-home-highlight strong { display: block; }
.take-home-highlight span { color: #cbd5e1; }
.take-home-highlight strong { font-size: clamp(1.5rem, 3.5vw, 2.2rem); font-weight: 650; margin: 8px 0; overflow-wrap: anywhere; color: #fff; font-variant-numeric: tabular-nums; }
.restore-notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.report-download { padding: 1.1rem 1.2rem; margin: 1rem 0 1.25rem; }
.report-download h2 { font-size: 1.15rem; margin-top: 0; }
.report-download .muted { color: var(--muted); }
.report-download button { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 650; }
.report-download button:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.report-download p:last-child { margin-bottom: 0; }
.horizon h2 { margin-bottom: 14px; }
.trajectory { margin: 12px 0 18px; padding-top: 4px; }
.trajectory figcaption { font-weight: 650; margin: 0 0 8px; color: var(--ink); }
.trajectory svg { width: 100%; height: 140px; display: block; }
.trajectory-area { fill: rgba(15, 118, 110, .12); }
.trajectory-line { fill: none; stroke: #0f766e; stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.trajectory-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; margin-top: 6px; }
@media (max-width: 600px) {
  .cards { grid-template-columns: 1fr; }
  .report-download button { width: 100%; }
}
