:root {
  color-scheme: light;
  --navy-950: #0b1f3a;
  --navy-800: #153b6f;
  --navy-700: #1c4f91;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --ink: #132a44;
  --muted: #60758a;
  --line: #b6c9e2;
  --line-soft: #dce6f2;
  --surface: #ffffff;
  --page: #f4f8fd;
  --green: #15945f;
  --green-soft: #edf9f3;
  --red: #c22a2a;
  --red-soft: #fff0f0;
  --amber: #b86500;
  --amber-soft: #fff7e8;
  --purple: #7c3aed;
  --purple-soft: #f2ecff;
  --shadow: 0 12px 30px rgba(29, 63, 112, 0.08);
  --shadow-soft: 0 4px 14px rgba(29, 63, 112, 0.06);
  font-family: "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #edf4fc 0, #f8fbff 420px, #f4f8fd 100%);
}

button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

a { color: var(--blue-600); }

.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;
}

.app-shell {
  width: min(1540px, calc(100% - 28px));
  min-height: calc(100vh - 28px);
  margin: 14px auto;
  background: var(--surface);
  border: 1px solid #9fb6d6;
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: clip;
}

.app-header {
  min-height: 74px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--navy-800);
  text-decoration: none;
  font-weight: 750;
  letter-spacing: 0.04em;
  font-size: 1.15rem;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--blue-600), var(--navy-700));
  border-radius: 11px;
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.24);
}

.main-tabs { display: flex; align-self: stretch; }

.tab-button {
  min-width: 180px;
  padding: 0 24px;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.tab-button:hover { color: var(--navy-700); background: var(--blue-50); }
.tab-button.is-active { color: var(--navy-800); border-bottom-color: var(--blue-600); }

.header-status { justify-self: end; }
.save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 0.82rem;
}
.save-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--blue-500); }
.save-status.is-saved { color: #0d7348; border-color: #a6ddc4; background: var(--green-soft); }
.save-status.is-saved::before { background: var(--green); }

#app {
  min-height: calc(100vh - 104px);
  padding: 26px;
  background: linear-gradient(180deg, #ffffff 0, #f9fbfe 100%);
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; color: var(--navy-950); font-size: clamp(1.5rem, 2.2vw, 2.1rem); letter-spacing: -0.03em; }
h2 { margin-bottom: 4px; color: var(--navy-800); font-size: 1.15rem; }
h3 { margin-bottom: 0; color: var(--navy-800); font-size: 1rem; }
p { margin-bottom: 0; color: var(--muted); line-height: 1.65; }

.panel, .stat-card, .detail-card, .chart-section {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 7px;
  color: var(--blue-600);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.input-intro, .dashboard-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
  padding: 24px 26px;
  margin-bottom: 18px;
  border-color: #8eaad0;
  background:
    radial-gradient(circle at 96% 4%, rgba(37, 99, 235, 0.09), transparent 32%),
    #fff;
}

.mode-switch {
  flex: none;
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f3f7fc;
}
.input-toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.sample-button { min-height: 40px; color: var(--blue-600); background: #f7fbff; }

.mode-button {
  padding: 10px 16px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.mode-button.is-active { color: #fff; background: linear-gradient(135deg, var(--blue-600), var(--navy-700)); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.23); }

.input-form { display: grid; gap: 18px; }
.form-section { padding: 24px 26px; }

.section-heading {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 13px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}
.section-heading.with-action { grid-template-columns: auto 1fr auto; align-items: center; }
.step-number {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(145deg, var(--blue-600), var(--navy-700));
  font-weight: 800;
}

.form-grid { display: grid; align-items: start; gap: 16px 18px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { min-width: 0; display: grid; gap: 7px; color: var(--ink); }
.field-label { color: var(--navy-800); font-size: 0.86rem; font-weight: 750; }
.required-mark { display: inline-flex; margin-left: 6px; padding: 1px 5px; border-radius: 999px; color: #b42318; background: #fff0ee; font-size: .62rem; line-height: 1.35; vertical-align: middle; }
.field-hint { color: var(--muted); font-size: 0.76rem; line-height: 1.4; }
.form-input, .form-select {
  width: 100%;
  min-height: 43px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid #b9c9dd;
  border-radius: 9px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-input:hover, .form-select:hover { border-color: #7697c2; }
.form-input:focus, .form-select:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); outline: 0; }
.input-with-unit { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; color: var(--muted); }

.primary-button, .secondary-button, .text-button, .icon-button {
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 10px;
  font-weight: 750;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--blue-600), var(--navy-700));
  border: 1px solid var(--blue-600);
  box-shadow: 0 5px 15px rgba(37, 99, 235, .22);
}
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(37, 99, 235, .28); }
.secondary-button { color: var(--navy-800); background: #fff; border: 1.5px solid #8eaad0; }
.secondary-button:hover { background: var(--blue-50); border-color: var(--blue-600); }
.secondary-button:disabled { opacity: .48; cursor: not-allowed; background: #f3f5f8; }
.text-button { min-height: auto; padding: 6px 8px; background: transparent; border: 0; color: var(--blue-600); }
.text-button.danger, .icon-button.danger { color: var(--red); }
.icon-button { width: 42px; padding: 8px; align-self: end; color: var(--red); background: var(--red-soft); border: 1px solid #efc1c1; }

.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.sticky-actions { position: sticky; bottom: 12px; z-index: 10; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.94); box-shadow: 0 10px 28px rgba(26, 57, 102, .14); backdrop-filter: blur(12px); }

.editor-stack { display: grid; gap: 16px; }
.field-groups-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-group { min-width: 0; padding: 15px; border: 1px solid #d6e1ee; border-radius: 11px; background: #fff; }
.field-group-title { margin-bottom: 13px; padding-bottom: 9px; color: var(--navy-800); border-bottom: 1px solid #e6edf5; font-size: .88rem; font-weight: 800; letter-spacing: .03em; }
.adult-groups .field-group:nth-child(2), .child-groups .university-group { grid-column: span 1; }
.quick-future-groups { grid-template-columns: .75fr 1.4fr 1fr; }
.editor-card { padding: 18px; background: #f4f8fd; border: 2px solid #a9bfdc; border-radius: 13px; box-shadow: 0 4px 12px rgba(29, 63, 112, .05); }
.editor-card-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.family-add-control { display: flex; align-items: end; gap: 9px; padding: 10px; border: 1px solid #b7c9df; border-radius: 11px; background: #f8fbff; }
.family-add-control label { min-width: 150px; display: grid; gap: 4px; color: var(--navy-800); font-size: .76rem; font-weight: 750; }
.family-add-control .form-select { min-height: 38px; padding: 7px 9px; }
.family-add-control .secondary-button { white-space: nowrap; }
.compact-family-card { border-color: #b7c9df; background: #fff; }
.card-note { margin: 12px 0 0; color: var(--muted); font-size: .78rem; }
.empty-family-state { padding: 22px; color: var(--muted); border: 1.5px dashed #b7c9df; border-radius: 12px; background: #fbfdff; text-align: center; }
.input-badge, .forecast-badge, .stat-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .71rem;
  font-weight: 800;
  letter-spacing: .03em;
}
.input-badge { color: #1750a0; background: #e3efff; }
.forecast-badge { color: #5542a9; background: #eeebff; }
.stat-badge { color: #8c5500; background: #fff1cf; }

.estimate-box {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid #c8c5ee;
  border-radius: 11px;
  background: #c8c5ee;
}
.estimate-box > div { display: grid; gap: 4px; padding: 12px 14px; background: #f5f3ff; }
.estimate-box span { color: #7167a8; font-size: .75rem; }
.estimate-box strong { color: #40328e; }
.education-path-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-top: 16px; overflow: hidden; border: 1px solid #b7c9df; border-radius: 11px; background: #b7c9df; }
.education-path-summary > div { display: grid; gap: 4px; padding: 12px 14px; background: #f5f9ff; }
.education-path-summary span { color: var(--muted); font-size: .74rem; }
.education-path-summary strong { color: var(--navy-800); font-size: .86rem; }
.education-path-summary .education-total { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; background: #edf4ff; }
.education-path-summary .education-total strong { color: var(--blue-600); font-size: 1rem; }
.source-note { margin-top: 14px; font-size: .78rem; }

.event-list { display: grid; gap: 12px; }
.event-row { display: grid; grid-template-columns: 1.5fr .8fr 1fr auto; gap: 14px; align-items: end; padding: 14px; border: 1px solid var(--line-soft); border-radius: 11px; background: #fbfdff; }

.dashboard-toolbar { margin-bottom: 14px; }
.dashboard-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }
.compact-field { min-width: 155px; }
.display-options { display: flex; align-items: center; gap: 18px; padding: 14px 18px; margin-bottom: 14px; }
.display-options[hidden] { display: none; }
.check-control { display: inline-flex; align-items: center; gap: 8px; color: var(--navy-800); font-weight: 700; }
.check-control input { width: 18px; height: 18px; accent-color: var(--blue-600); }
.option-note { margin-left: auto; color: var(--muted); font-size: .82rem; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-card { min-width: 0; display: grid; gap: 7px; padding: 17px 18px; border-color: #b7c9df; }
.stat-jump { width: 100%; color: inherit; border-style: solid; border-width: 1px; font: inherit; text-align: left; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.stat-jump:hover { transform: translateY(-2px); border-color: var(--blue-600); box-shadow: 0 9px 20px rgba(29, 63, 112, .13); }
.stat-jump:active { transform: translateY(0); }
.stat-card strong { color: var(--navy-950); font-size: clamp(1.25rem, 2vw, 1.75rem); letter-spacing: .02em; }
.stat-card > span { color: var(--muted); font-size: .82rem; }
.stat-title { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--navy-800); font-weight: 750; }
.stat-card.forecast { background: linear-gradient(145deg, #fff, #f7f6ff); border-color: #c6c2ec; }
.stat-card.safe-card { background: linear-gradient(145deg, #fff, #f0faf5); border-color: #a8d8c2; }
.stat-card.danger-card { background: linear-gradient(145deg, #fff, #fff2f2); border-color: #e8b7b7; }

.insight-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-bottom: 14px; }
.insight-card { display: flex; align-items: center; gap: 13px; padding: 14px 17px; border: 1.5px solid; border-radius: 12px; }
.insight-jump { width: 100%; font: inherit; text-align: left; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.insight-jump:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(29, 63, 112, .12); }
.insight-card.warning { color: #7a2c2c; background: var(--red-soft); border-color: #edbcbc; }
.insight-card.success { color: #155d42; background: var(--green-soft); border-color: #a7d9c1; }
.insight-icon { flex: none; width: 28px; height: 28px; display: grid; place-items: center; color: #fff; border-radius: 50%; font-weight: 900; }
.warning .insight-icon { background: var(--red); }
.success .insight-icon { background: var(--green); }

.chart-section { margin-bottom: 14px; overflow: hidden; border-color: #8eaad0; }
.chart-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 13px 18px; padding: 12px 16px; color: var(--muted); background: #f8fbff; border-bottom: 1px solid var(--line); font-size: .78rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-line, .legend-dash { width: 25px; border-top: 3px dashed; }
.legend-line.total { border-color: #173f7a; }
.legend-line.scenario-base { border-color: #173f7a; }
.legend-line.scenario-cautious { border-color: #b27616; }
.legend-line.scenario-stress { border-color: #c22a2a; }
.legend-line.cash { border-color: #2580ee; }
.legend-line.invest { border-color: #7c3aed; }
.legend-dash { border-top: 2px dashed #60758a; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; background: #173f7a; }
.legend-bar { width: 8px; height: 14px; border-radius: 2px; }
.legend-bar.positive { background: var(--green); }
.legend-bar.negative { background: var(--red); }

.scenario-switcher { position: absolute; z-index: 4; top: var(--scenario-switcher-top); left: 18px; width: 188px; display: flex; flex-direction: column; gap: 7px; }
.scenario-button { position: relative; width: 100%; display: grid; gap: 3px; padding: 8px 9px; color: var(--navy-800); background: rgba(255, 255, 255, .96); border: 1.5px solid #bfd0e4; border-radius: 9px; text-align: left; cursor: pointer; box-shadow: 0 2px 7px rgba(42, 75, 116, .08); transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.scenario-button:hover { border-color: var(--blue-500); transform: translateY(-1px); }
.scenario-button:focus-visible { outline: 3px solid rgba(37, 99, 235, .28); outline-offset: 2px; }
.scenario-button.is-active { border-color: var(--blue-600); box-shadow: 0 0 0 2px rgba(37, 99, 235, .12); }
.scenario-button-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.scenario-button-heading strong { font-size: .94rem; }
.scenario-selected-mark { color: var(--blue-700); font-size: .68rem; font-weight: 800; }
.scenario-outcome { color: var(--navy-950); font-size: .72rem; font-weight: 800; line-height: 1.3; letter-spacing: -.02em; }
.scenario-assumptions { position: absolute; z-index: 12; top: 50%; left: calc(100% + 10px); width: 245px; padding: 11px 13px; color: #fff; background: rgba(19, 43, 76, .96); border: 1px solid rgba(255, 255, 255, .2); border-radius: 9px; box-shadow: 0 8px 24px rgba(24, 45, 74, .24); text-align: left; opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-50%) translateX(-4px); transition: opacity .15s ease, transform .15s ease, visibility .15s ease; }
.scenario-assumptions::before { content: ''; position: absolute; top: 50%; right: 100%; border: 7px solid transparent; border-right-color: rgba(19, 43, 76, .96); transform: translateY(-50%); }
.scenario-assumptions strong { display: block; margin-bottom: 6px; color: #fff; font-size: .78rem; }
.scenario-assumptions ul { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.scenario-assumptions li { color: rgba(255, 255, 255, .9); font-size: .72rem; line-height: 1.35; }
.scenario-assumptions li::before { content: '・'; }
.scenario-button:hover .scenario-assumptions, .scenario-button:focus-visible .scenario-assumptions, .scenario-button.is-tooltip-open .scenario-assumptions { opacity: 1; visibility: visible; transform: translateY(-50%) translateX(0); }
.scenario-button-base { border-left: 4px solid #173f7a; }
.scenario-button-cautious { border-left: 4px solid #b27616; }
.scenario-button-stress { border-left: 4px solid #c22a2a; }
.improvement-switcher { position: absolute; z-index: 4; top: var(--improvement-switcher-top); left: 18px; width: 188px; display: grid; gap: 6px; margin: 0; padding: 0; border: 0; }
.improvement-switcher legend { margin-bottom: 3px; color: var(--muted); font-size: .72rem; font-weight: 800; }
.improvement-option { display: grid; gap: 5px; padding: 7px 8px; color: var(--navy-800); background: rgba(255, 255, 255, .96); border: 1.5px solid #bfd0e4; border-radius: 8px; box-shadow: 0 2px 6px rgba(42, 75, 116, .07); }
.improvement-option.is-selected { border-color: var(--blue-600); background: #f4f8ff; box-shadow: 0 0 0 2px rgba(37, 99, 235, .1); }
.improvement-option-main { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.improvement-option-heading { display: flex; align-items: center; gap: 6px; }
.improvement-option-heading input { margin: 0; accent-color: var(--blue-600); cursor: pointer; }
.improvement-option-heading strong { font-size: .78rem; white-space: nowrap; }
.improvement-spinbox { display: flex; align-items: center; justify-content: flex-end; gap: 3px; min-width: 0; }
.improvement-spinbox input { width: 50px; min-width: 0; padding: 3px 2px 3px 5px; color: var(--navy-950); background: #fff; border: 1px solid #9fb6d6; border-radius: 5px; font: inherit; font-size: .72rem; font-weight: 800; }
.improvement-spinbox input:focus { outline: 2px solid rgba(37, 99, 235, .22); border-color: var(--blue-600); }
.improvement-spinbox span { color: var(--muted); font-size: .62rem; white-space: nowrap; }
.improvement-option-note { color: var(--muted); }
.improvement-option > .improvement-option-note { font-size: .67rem; line-height: 1.25; }
.chart-scroll { position: relative; width: 100%; min-width: 0; overflow: hidden; background: #fff; }
.future-chart { display: block; width: 100%; min-width: 0; height: auto; font-family: inherit; }
.future-chart text { fill: var(--ink); font-size: 12px; }
.chart-panel { fill: #fff; stroke: #9fb6d6; stroke-width: 1.5; }
.risk-band { fill: rgba(194, 42, 42, .07); }
.selected-year-band { fill: rgba(37, 99, 235, .07); }
.year-grid { stroke: #dce6f2; stroke-width: 1; }
.year-grid.major { stroke: #a8bdd8; stroke-width: 1.2; }
.year-label { fill: var(--muted) !important; font-size: 11px !important; }
.year-label.selected { fill: var(--blue-600) !important; font-weight: 800; }
.gutter-line { stroke: #8eaad0; stroke-width: 1.5; }
.row-line { stroke: #e7edf5; stroke-width: 1; }
.row-name, .section-title { fill: var(--navy-800) !important; font-weight: 800; }
.section-title { font-size: 13px !important; letter-spacing: .03em; }
.section-unit, .axis-label { fill: var(--muted) !important; font-size: 10px !important; }
.milestone-dot { fill: var(--blue-600); }
.pension-dot { fill: var(--green); }
.milestone-label, .event-label { fill: var(--navy-800) !important; font-size: 10px !important; font-weight: 700; }
.selected-age-dot { fill: var(--blue-600); stroke: #fff; stroke-width: 2; }
.selected-age-label { fill: var(--blue-600) !important; font-size: 10px !important; font-weight: 800; }
.event-stem { stroke: var(--navy-700); stroke-width: 1.5; }
.stage-band { stroke-width: 1; }
.stage-preschool { fill: #fff7e8; stroke: #e3b866; }
.stage-elementary { fill: #edf9f3; stroke: #7ec3a3; }
.stage-junior { fill: #eff6ff; stroke: #86b1e7; }
.stage-high { fill: #e6f5ff; stroke: #6bb7df; }
.stage-university { fill: #f2ecff; stroke: #a78be4; }
.stage-independent { fill: #f0f3f7; stroke: #b8c3d0; }
.stage-label { fill: var(--navy-800) !important; font-size: 10px !important; font-weight: 700; }
.value-grid { stroke: #e6edf6; stroke-width: 1; }
.asset-zero-line { stroke: #52677f; stroke-width: 1.7; stroke-dasharray: 4 3; }
.asset-zero-label { fill: #52677f !important; font-size: 9px !important; font-weight: 800; paint-order: stroke; stroke: #fff; stroke-width: 3; }
.asset-line { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.forecast-line { stroke-dasharray: 7 6; }
.total-line { stroke: #173f7a; }
.scenario-total-line { stroke-dasharray: 8 6; transition: opacity .18s ease, stroke-width .18s ease; }
.scenario-base-line { stroke: #173f7a; }
.scenario-cautious-line { stroke: #b27616; }
.scenario-stress-line { stroke: #c22a2a; }
.scenario-active-line { stroke-width: 4; opacity: 1; }
.scenario-muted-line { stroke-width: 2.2; opacity: .28; }
.cash-line { stroke: #2580ee; }
.invest-line { stroke: #7c3aed; }
.input-point { stroke: #fff; stroke-width: 2; }
.total-point { fill: #173f7a; }
.scenario-base-point { fill: #173f7a; }
.scenario-cautious-point { fill: #b27616; }
.scenario-stress-point { fill: #c22a2a; }
.cash-point { fill: #2580ee; }
.invest-point { fill: #7c3aed; }
.selected-point { fill: #fff; stroke: var(--blue-600); stroke-width: 3; }
.selected-callout { pointer-events: none; }
.selected-callout-box { fill: rgba(255, 255, 255, .96); stroke: #8eb7ec; stroke-width: 1.2; filter: drop-shadow(0 3px 6px rgba(35, 72, 120, .14)); }
.selected-callout-title { fill: var(--blue-700) !important; font-size: 10px !important; font-weight: 800; }
.selected-callout-detail { fill: var(--navy-700) !important; font-size: 10px !important; font-weight: 700; }
.zero-line { stroke: #60758a; stroke-width: 1.4; }
.cashflow-bar.positive { fill: var(--green); }
.cashflow-bar.negative { fill: var(--red); }
.cashflow-bar.comparison-before { fill: rgba(255, 255, 255, .64); stroke-width: 1.5; }
.cashflow-bar.comparison-before.positive { stroke: var(--green); }
.cashflow-bar.comparison-before.negative { stroke: var(--red); }
.cashflow-bar.comparison-after { stroke: #fff; stroke-width: 1; }
.cashflow-callout { pointer-events: none; }
.cashflow-callout-box { fill: rgba(255, 255, 255, .97); stroke-width: 1.3; filter: drop-shadow(0 3px 7px rgba(35, 72, 120, .16)); }
.cashflow-callout.positive .cashflow-callout-box { stroke: #55a772; }
.cashflow-callout.negative .cashflow-callout-box { stroke: #df7777; }
.cashflow-callout-title { font-size: 10px !important; font-weight: 800; }
.cashflow-callout.positive .cashflow-callout-title { fill: #18723a !important; }
.cashflow-callout.negative .cashflow-callout-title { fill: #b42323 !important; }
.cashflow-callout-detail { fill: var(--navy-700) !important; font-size: 9px !important; font-weight: 700; }
.selected-year-line { stroke: var(--blue-600); stroke-width: 1.5; pointer-events: none; }
.year-hit { fill: transparent; cursor: pointer; }
.year-hit:hover { fill: rgba(37, 99, 235, .05); }

.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.detail-card { min-width: 0; padding: 16px; }
.detail-title { min-height: 27px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 10px; margin-bottom: 8px; color: var(--navy-800); border-bottom: 1px solid var(--line-soft); font-weight: 800; }
.detail-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 7px 0; color: var(--muted); font-size: .82rem; }
.detail-row strong { color: var(--ink); text-align: right; }
.detail-row.emphasis { margin-top: 3px; padding-top: 10px; border-top: 1px solid var(--line-soft); color: var(--ink); font-weight: 800; }
.positive-text { color: var(--green) !important; }
.negative-text { color: var(--red) !important; }
.risk-year-row { width: 100%; display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; color: var(--muted); background: transparent; border: 0; border-bottom: 1px solid #edf1f6; text-align: left; cursor: pointer; }
.risk-year-row:hover { color: var(--blue-600); }
.risk-year-row strong { color: var(--red); white-space: nowrap; }

.dashboard-footer { display: flex; justify-content: space-between; gap: 18px; margin-top: 15px; padding: 13px 5px 0; color: var(--muted); font-size: .75rem; }

@media (max-width: 1100px) {
  .app-header { grid-template-columns: 1fr auto; }
  .main-tabs { order: 3; grid-column: 1 / -1; height: 48px; justify-content: center; border-top: 1px solid var(--line-soft); }
  .header-status { grid-column: 2; }
  .tab-button { min-width: 150px; }
  .form-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-groups-grid, .quick-future-groups { grid-template-columns: 1fr; }
  .stat-grid, .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .estimate-box { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .education-path-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body { background: #fff; }
  .app-shell { width: 100%; margin: 0; min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
  .app-header { position: relative; min-height: auto; padding: 14px 16px 0; gap: 12px; }
  .brand { font-size: 1rem; }
  .brand-mark { width: 30px; height: 30px; }
  .header-status { display: none; }
  .main-tabs { width: calc(100% + 32px); margin-left: -16px; }
  .tab-button { flex: 1; min-width: 0; padding: 0 8px; font-size: .9rem; }
  #app { padding: 14px; }
  .input-intro, .dashboard-toolbar { align-items: stretch; flex-direction: column; padding: 19px; }
  .mode-switch { width: 100%; }
  .input-toolbar-actions { width: 100%; justify-content: stretch; }
  .input-toolbar-actions > * { width: 100%; }
  .mode-button { flex: 1; }
  .form-section { padding: 18px; }
  .section-heading.with-action { grid-template-columns: auto 1fr; }
  .section-heading.with-action > .secondary-button { grid-column: 1 / -1; width: 100%; }
  .section-heading.with-action > .family-add-control { grid-column: 1 / -1; width: 100%; }
  .form-grid.three, .form-grid.two, .stat-grid, .detail-grid, .insight-row { grid-template-columns: 1fr; }
  .event-row { grid-template-columns: 1fr 1fr; }
  .event-row .field:first-child { grid-column: 1 / -1; }
  .event-row .icon-button { justify-self: end; }
  .estimate-box { grid-template-columns: 1fr 1fr; }
  .form-actions { flex-wrap: wrap; }
  .sticky-actions { bottom: 6px; }
  .sticky-actions .primary-button { flex: 1; }
  .dashboard-actions { justify-content: stretch; }
  .dashboard-actions > * { flex: 1; min-width: 145px; }
  .display-options { align-items: flex-start; flex-direction: column; gap: 12px; }
  .option-note { margin-left: 0; }
  .chart-legend { gap: 10px 14px; }
  .dashboard-footer { flex-direction: column; }
}

@media (max-width: 430px) {
  .form-grid.three, .event-row, .estimate-box, .education-path-summary { grid-template-columns: 1fr; }
  .family-add-control { align-items: stretch; flex-direction: column; }
  .family-add-control label { width: 100%; }
  .event-row .field:first-child { grid-column: auto; }
  .stat-card strong { font-size: 1.35rem; }
  .section-heading { grid-template-columns: 1fr; }
  .step-number { width: 28px; height: 28px; }
}
