:root {
  --canvas: #f7f5ef;
  --surface: #ffffff;
  --surface-blue: #f2f7f9;
  --mist: #e8f1f5;
  --blue-soft: #9db9c8;
  --blue: #2f6f96;
  --navy: #173b52;
  --navy-2: #245976;
  --text: #253944;
  --muted: #69777f;
  --faint: #94a0a6;
  --line: #dbe3e6;
  --line-strong: #c7d4da;
  --sage: #5f8060;
  --sage-bg: #f1f6ef;
  --amber: #a76f1d;
  --amber-bg: #fff8ed;
  --coral: #b45d51;
  --coral-bg: #fff3f0;
  --danger: #a9524c;
  --shadow: 0 12px 40px rgba(36, 67, 84, 0.07);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--canvas);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-header {
  position: sticky;
  z-index: 30;
  top: 0;
  min-height: 76px;
  padding: 0 max(28px, calc((100vw - 1500px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--navy);
  text-decoration: none;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand svg {
  width: 36px;
  height: 36px;
  color: var(--blue);
  stroke-width: 1.6;
}

.header-actions,
.privacy-note,
.btn {
  display: flex;
  align-items: center;
}

.header-actions {
  gap: 18px;
}

.privacy-note {
  gap: 7px;
  color: var(--muted);
  white-space: nowrap;
  font-size: 14px;
}

.privacy-note svg {
  width: 17px;
  height: 17px;
}

.step-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: thin;
}

.step-track {
  width: min(1340px, calc(100vw - 56px));
  min-width: 960px;
  min-height: 92px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: center;
}

.step-item {
  position: relative;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--muted);
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  white-space: nowrap;
}

.step-item:not(:last-child)::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 50%;
  left: calc(100% - 24px);
  width: 48px;
  height: 1px;
  background: var(--line-strong);
}

.step-number {
  position: relative;
  z-index: 1;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 16px;
}

.step-item.active,
.step-item.complete {
  color: var(--navy);
  font-weight: 600;
}

.step-item.active .step-number {
  color: #fff;
  background: var(--navy-2);
  border-color: var(--navy-2);
  box-shadow: 0 5px 14px rgba(36, 89, 118, 0.18);
}

.step-item.complete .step-number {
  color: var(--blue);
  border-color: var(--blue-soft);
}

.app-main {
  width: min(1500px, calc(100vw - 40px));
  margin: 22px auto 48px;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.side-panel {
  padding: 25px 20px;
  background: #fbfcfc;
  border-right: 1px solid var(--line);
}

.side-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--navy);
  font-weight: 650;
}

.autosave-state {
  color: var(--sage);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.autosave-state i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  background: #6d9a6b;
  border-radius: 50%;
}

.family-placeholder {
  min-height: 164px;
  margin-top: 17px;
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.family-placeholder svg {
  width: 42px;
  height: 42px;
  margin-bottom: 13px;
  color: var(--blue-soft);
}

.family-placeholder strong {
  color: var(--text);
  font-size: 16px;
}

.family-placeholder span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.side-progress {
  margin-top: 28px;
}

.side-progress h3 {
  margin: 0 0 12px 7px;
  color: var(--text);
  font-size: 15px;
}

.side-progress ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.side-progress li {
  margin: 2px 0;
}

.side-progress button {
  width: 100%;
  padding: 7px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
}

.side-progress b {
  flex: 0 0 27px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-weight: 500;
}

.side-progress .active button {
  color: var(--blue);
  font-weight: 650;
}

.side-progress .active b {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.side-progress .complete b {
  color: var(--sage);
  border-color: #b8ceb8;
}

.side-tip {
  margin-top: 26px;
  padding: 15px;
  color: var(--muted);
  background: var(--surface-blue);
  border: 1px solid #d7e7ee;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.side-tip strong {
  color: var(--blue);
  font-size: 13px;
}

.side-tip p {
  margin: 5px 0 0;
}

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.report-mode .app-main {
  grid-template-columns: minmax(0, 1fr);
  width: min(1290px, calc(100vw - 40px));
}

.report-mode .side-panel,
.report-mode .workspace > .action-bar {
  display: none;
}

.report-mode #stepContent {
  padding-inline: 54px;
}

#stepContent {
  min-height: 650px;
  padding: 36px 42px 48px;
}

.page-heading {
  margin-bottom: 29px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.page-heading h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(27px, 2.5vw, 36px);
  line-height: 1.28;
  letter-spacing: 0.01em;
}

.page-heading p {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.form-section {
  margin-top: 30px;
}

.section-header {
  margin-bottom: 17px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.section-header h2 {
  margin: 0;
  color: var(--navy);
  font-size: 20px;
}

.section-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.field {
  min-width: 0;
  grid-column: span 4;
}

.field.span-6 {
  grid-column: span 6;
}

.field.span-8 {
  grid-column: span 8;
}

.field.span-12 {
  grid-column: span 12;
}

.field label,
.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.field small {
  display: block;
  margin-top: 5px;
  color: var(--faint);
  font-size: 12px;
}

.required {
  margin-left: 3px;
  color: var(--coral);
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: 45px;
  padding: 10px 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 150, 0.1);
}

input::placeholder,
textarea::placeholder {
  color: #a0aaaf;
}

.concern-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.choice-card {
  min-height: 62px;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.choice-card:hover {
  border-color: var(--blue-soft);
  transform: translateY(-1px);
}

.choice-card:has(input:checked) {
  color: var(--navy);
  background: #f2f7fb;
  border-color: var(--blue);
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--blue);
}

.btn {
  min-height: 43px;
  padding: 9px 16px;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  color: #8d989d;
  background: #e7ebed;
  border-color: #d8dfe2;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn:focus-visible,
.icon-btn:focus-visible {
  outline: 3px solid rgba(47, 111, 150, 0.18);
  outline-offset: 2px;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  min-width: 154px;
  color: #fff;
  background: var(--navy-2);
  border-color: var(--navy-2);
  box-shadow: 0 5px 15px rgba(36, 89, 118, 0.14);
}

.btn-primary:hover {
  background: var(--navy);
}

.btn-outline {
  color: var(--navy-2);
  background: #fff;
  border-color: var(--blue);
}

.btn-outline:hover,
.btn-quiet:hover {
  background: var(--surface-blue);
}

.btn-quiet {
  min-height: 39px;
  color: var(--navy);
  background: #fff;
  border-color: var(--line-strong);
  font-weight: 550;
}

.btn-ghost {
  color: var(--muted);
  border-color: transparent;
}

.btn-small {
  min-height: 35px;
  padding: 6px 11px;
  font-size: 13px;
}

.danger-text {
  color: var(--danger);
}

.action-bar {
  position: sticky;
  z-index: 20;
  bottom: 0;
  min-height: 84px;
  padding: 17px 28px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
}

.action-bar-left,
.action-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.entity-card {
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.entity-header {
  min-height: 58px;
  padding: 12px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #f8fafb;
  border-bottom: 1px solid var(--line);
}

.entity-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.entity-index {
  flex: 0 0 29px;
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: var(--mist);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}

.entity-title strong {
  color: var(--navy);
  font-size: 16px;
}

.entity-title span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.entity-body {
  padding: 20px;
}

.inline-checks {
  min-height: 45px;
  padding: 9px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}

.stats-grid {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 11px;
}

.stat-card {
  min-height: 91px;
  padding: 15px;
  background: var(--surface-blue);
  border: 1px solid #dce9ee;
  border-radius: 10px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  margin-top: 4px;
  color: var(--navy);
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
}

.stat-card small {
  color: var(--faint);
  font-size: 11px;
}

.stat-card.negative {
  background: var(--coral-bg);
  border-color: #efcfc8;
}

.stat-card.negative strong {
  color: var(--coral);
}

.expense-list {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.expense-row {
  min-width: 900px;
  padding: 10px 13px;
  display: grid;
  grid-template-columns: 30px 1.35fr 0.85fr 0.75fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.expense-row:last-child {
  border-bottom: 0;
}

.expense-row input,
.expense-row select {
  min-height: 38px;
  padding: 7px 9px;
  font-size: 12px;
}

.expense-index {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: var(--mist);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

.expense-head {
  color: var(--muted);
  background: #f8fafb;
  font-size: 11px;
  font-weight: 700;
}

.expense-annual {
  color: var(--muted);
  font-size: 11px;
}

.asset-list {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.asset-row {
  min-width: 980px;
  padding: 10px 13px;
  display: grid;
  grid-template-columns: 30px 1fr 1.25fr 1fr 0.65fr 1.4fr auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.asset-row:last-child {
  border-bottom: 0;
}

.asset-row input,
.asset-row select {
  min-height: 38px;
  padding: 7px 9px;
  font-size: 12px;
}

.asset-percent {
  color: var(--blue);
  font-weight: 700;
  text-align: center;
}

.asset-summary {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(160px, 0.75fr) minmax(160px, 0.75fr) minmax(300px, 1.5fr);
  gap: 11px;
}

.asset-chart-card {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.asset-chart-card > span {
  color: var(--muted);
  font-size: 12px;
}

.asset-allocation {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.asset-allocation-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
}

.asset-allocation-row span {
  color: var(--muted);
}

.asset-track {
  height: 7px;
  margin-top: 4px;
  overflow: hidden;
  background: #e6edef;
  border-radius: 999px;
}

.asset-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #79aebe);
  border-radius: inherit;
}

.asset-empty {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.cashflow-stats {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
}

.coverage-member {
  margin-bottom: 22px;
  border-top: 3px solid var(--mist);
}

.coverage-member > .entity-header {
  border-bottom: 0;
}

.coverage-table {
  display: grid;
  grid-template-columns: 1.2fr 0.75fr 0.75fr 0.9fr 1.3fr auto;
  align-items: center;
}

.coverage-table.header {
  padding: 9px 14px;
  color: var(--muted);
  background: #fafbfb;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.coverage-row {
  padding: 11px 14px;
  gap: 9px;
  border-bottom: 1px solid #edf0f1;
}

.coverage-row:last-child {
  border-bottom: 0;
}

.coverage-name {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--navy);
  font-weight: 600;
}

.coverage-row input[type="text"],
.coverage-row input[type="number"] {
  min-height: 37px;
  padding: 7px 9px;
  font-size: 13px;
}

.coverage-row.is-off .coverage-detail {
  opacity: 0.45;
}

.review-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.medical-extras {
  grid-column: 1 / -1;
  margin: 4px 0 7px 27px;
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px 18px;
  background: var(--surface-blue);
  border-radius: 8px;
}

.medical-extras .check-inline {
  font-size: 12px;
}

.goal-gap {
  color: var(--coral);
  font-weight: 700;
  font-size: 17px;
}

.goal-summary {
  margin-top: 22px;
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  color: var(--navy);
  background: var(--surface-blue);
  border: 1px solid #dbe8ed;
  border-radius: 12px;
}

.goal-summary p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.goal-summary strong {
  white-space: nowrap;
  font-size: 27px;
}

.diagnosis-card {
  margin-bottom: 28px;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  border: 1px solid;
  border-radius: 12px;
}

.diagnosis-card.high {
  background: var(--coral-bg);
  border-color: #edcbc3;
}

.diagnosis-card.medium {
  background: var(--amber-bg);
  border-color: #ead7b6;
}

.diagnosis-card.low {
  background: var(--sage-bg);
  border-color: #cdddc9;
}

.diagnosis-label {
  min-height: 56px;
  padding: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--coral);
  border-radius: 9px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
}

.diagnosis-card.medium .diagnosis-label {
  background: var(--amber);
}

.diagnosis-card.low .diagnosis-label {
  background: var(--sage);
}

.diagnosis-card h2 {
  margin: 0;
  color: var(--navy);
  font-size: 20px;
}

.diagnosis-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.diagnosis-card.compact {
  margin: 0 0 18px;
  padding: 16px 18px;
  grid-template-columns: 115px minmax(0, 1fr);
}

.diagnosis-card.compact h2 {
  font-size: 17px;
}

.analysis-section {
  margin-top: 34px;
}

.dimension-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dimension-card {
  min-height: 152px;
  padding: 17px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--blue-soft);
  border-radius: 10px;
}

.dimension-card.high {
  border-top-color: var(--coral);
}

.dimension-card.medium {
  border-top-color: var(--amber);
}

.dimension-card.low {
  border-top-color: var(--sage);
}

.dimension-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.dimension-head h3 {
  margin: 0;
  color: var(--navy);
  font-size: 15px;
}

.dimension-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.dimension-card.high .dimension-head span {
  color: var(--coral);
}

.dimension-card.medium .dimension-head span {
  color: var(--amber);
}

.dimension-card.low .dimension-head span {
  color: var(--sage);
}

.dimension-card p {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.reference-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.reference-row {
  padding: 15px 17px;
  display: grid;
  grid-template-columns: 1fr 2fr 2fr;
  gap: 20px;
  align-items: start;
  border-bottom: 1px solid var(--line);
}

.reference-row:last-child {
  border-bottom: 0;
}

.reference-row:nth-child(odd):not(.reference-head) {
  background: #fbfcfc;
}

.reference-row strong {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  font-size: 13px;
}

.reference-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.reference-head {
  color: var(--muted);
  background: var(--surface-blue);
  font-size: 12px;
  font-weight: 700;
}

.status-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  display: inline-block;
  background: var(--blue-soft);
  border-radius: 50%;
}

.status-dot.high {
  background: var(--coral);
}

.status-dot.medium {
  background: var(--amber);
}

.status-dot.low {
  background: var(--sage);
}

.roadmap {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}

.roadmap-step {
  position: relative;
  min-height: 250px;
  padding: 19px 18px 18px 52px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.roadmap-number {
  position: absolute;
  top: 18px;
  left: 17px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.roadmap-content > span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.roadmap-content h3 {
  margin: 3px 0 12px;
  color: var(--navy);
  font-size: 16px;
}

.roadmap-content ul {
  margin: 0;
  padding-left: 17px;
}

.roadmap-content li {
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
}

.optimization-list {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
  list-style: none;
  counter-reset: optimization;
}

.optimization-list li {
  position: relative;
  min-height: 66px;
  padding: 13px 14px 13px 48px;
  color: var(--muted);
  background: var(--surface-blue);
  border: 1px solid #dce8ed;
  border-radius: 9px;
  counter-increment: optimization;
  font-size: 12px;
}

.optimization-list li::before {
  content: counter(optimization);
  position: absolute;
  top: 14px;
  left: 14px;
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: #fff;
  border: 1px solid var(--blue-soft);
  border-radius: 50%;
  font-weight: 700;
}

.reference-disclaimer {
  margin: 10px 0 0;
  color: var(--faint);
  font-size: 11px;
}

.analysis-overview {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 22px;
  margin: 30px 0 27px;
}

.analysis-meter,
.analysis-note {
  padding: 22px;
  background: var(--surface-blue);
  border: 1px solid #dce8ed;
  border-radius: 12px;
}

.analysis-meter h3,
.analysis-note h3 {
  margin: 0 0 14px;
  color: var(--navy);
  font-size: 16px;
}

.meter-row {
  margin-top: 13px;
}

.meter-label {
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.meter-track {
  height: 8px;
  overflow: hidden;
  background: #dae5e9;
  border-radius: 99px;
}

.meter-fill {
  height: 100%;
  background: var(--blue);
  border-radius: inherit;
  transition: width 350ms ease;
}

.analysis-note p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.analysis-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}

.analysis-group {
  min-height: 240px;
  padding: 18px;
  border-radius: 11px;
  border: 1px solid;
}

.analysis-group.priority {
  background: var(--coral-bg);
  border-color: #efcfc8;
}

.analysis-group.review {
  background: var(--amber-bg);
  border-color: #edd9b8;
}

.analysis-group.longterm {
  background: var(--sage-bg);
  border-color: #cfdfcb;
}

.analysis-group h2 {
  margin: 0 0 13px;
  font-size: 18px;
}

.analysis-group.priority h2 {
  color: var(--coral);
}

.analysis-group.review h2 {
  color: var(--amber);
}

.analysis-group.longterm h2 {
  color: var(--sage);
}

.analysis-group ul {
  margin: 0;
  padding: 0 0 0 19px;
}

.analysis-group li {
  margin: 9px 0;
  color: #4b5b63;
  font-size: 13px;
}

.empty-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.report {
  max-width: 1080px;
  margin: 0 auto;
}

.report-heading {
  text-align: center;
  border-bottom-color: var(--blue-soft);
}

.report-heading h1 {
  font-size: clamp(30px, 3vw, 41px);
  letter-spacing: 0.1em;
}

.report-family-name {
  margin: 24px 0 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--navy);
  font-size: 22px;
  font-weight: 700;
}

.report-family-name svg {
  width: 28px;
  height: 28px;
  color: var(--blue);
}

.report-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.report-stats.six {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-stats .stat-card {
  min-height: 103px;
  padding: 17px;
}

.report-section {
  margin-top: 30px;
}

.report-section h2 {
  margin: 0 0 14px;
  padding-bottom: 8px;
  color: var(--navy);
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}

.report-three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 25px;
}

.report-asset-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
  gap: 28px;
}

.report-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.report-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-list li {
  padding: 8px 0;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  border-bottom: 1px dashed var(--line);
  color: var(--muted);
  font-size: 13px;
}

.report-list b {
  color: var(--text);
  font-weight: 600;
}

.goal-progress {
  margin-top: 14px;
}

.goal-progress .track {
  height: 20px;
  display: flex;
  overflow: hidden;
  background: #e1e8eb;
  border-radius: 6px;
}

.goal-progress .prepared {
  display: grid;
  place-items: center;
  min-width: 0;
  color: #fff;
  background: var(--blue);
  font-size: 10px;
}

.goal-progress .gap {
  flex: 1;
  display: grid;
  place-items: center;
  color: var(--text);
  background: #d9e4e8;
  font-size: 10px;
}

.report-recommendations {
  margin-top: 30px;
}

.report-recommendations .analysis-columns {
  grid-template-columns: repeat(3, 1fr);
}

.report-recommendations .analysis-group {
  min-height: 170px;
}

.report .dimension-card {
  min-height: 128px;
}

.report .dimension-card p {
  margin-top: 9px;
}

.report .reference-row {
  padding: 11px 13px;
  gap: 14px;
}

.report .roadmap-step {
  min-height: 220px;
}

.report-optimization {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.notes-area {
  min-height: 130px;
  padding: 15px;
  color: var(--muted);
  white-space: pre-wrap;
  background-image: repeating-linear-gradient(transparent, transparent 31px, #dce4e7 32px);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
}

.report-disclaimer {
  margin: 32px 0 0;
  padding-top: 18px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
}

.report-actions {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(23, 59, 82, 0.28);
  backdrop-filter: blur(3px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(760px, 100%);
  max-height: min(680px, calc(100vh - 48px));
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 25px 75px rgba(19, 48, 65, 0.2);
}

.modal-header {
  position: sticky;
  top: 0;
  padding: 22px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  color: var(--navy);
  font-size: 22px;
}

.modal-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-blue);
}

.archive-list {
  padding: 12px 24px 24px;
}

.archive-item {
  padding: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.archive-item:last-child {
  border-bottom: 0;
}

.archive-item strong {
  display: block;
  color: var(--navy);
  font-size: 16px;
}

.archive-item span {
  color: var(--muted);
  font-size: 12px;
}

.archive-actions {
  display: flex;
  gap: 8px;
}

.archive-empty {
  padding: 55px 20px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 200;
  right: 26px;
  bottom: 26px;
  max-width: 360px;
  padding: 12px 17px;
  color: #fff;
  background: var(--navy);
  border-radius: 9px;
  box-shadow: 0 10px 30px rgba(23, 59, 82, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.muted {
  color: var(--muted);
}

.number {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1120px) {
  .app-main {
    grid-template-columns: 225px minmax(0, 1fr);
  }

  #stepContent {
    padding-inline: 28px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .cashflow-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .concern-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .coverage-table {
    grid-template-columns: 1.2fr 0.8fr 0.8fr;
  }

  .coverage-table.header {
    display: none;
  }

  .coverage-row {
    gap: 10px;
  }

  .coverage-row > *:nth-child(4),
  .coverage-row > *:nth-child(5),
  .coverage-row > *:nth-child(6) {
    grid-column: span 1;
  }

  .report-three,
  .analysis-columns,
  .report-asset-layout {
    grid-template-columns: 1fr;
  }

  .dimension-grid,
  .roadmap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .report-stats.six {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 820px) {
  .app-header {
    min-height: 66px;
    padding: 0 18px;
  }

  .brand {
    font-size: 19px;
  }

  .brand svg {
    width: 30px;
    height: 30px;
  }

  .privacy-note {
    display: none;
  }

  .step-track {
    width: auto;
    min-height: 76px;
  }

  .app-main {
    width: calc(100vw - 24px);
    margin-top: 12px;
    display: block;
  }

  .side-panel {
    display: none;
  }

  #stepContent {
    min-height: 580px;
    padding: 27px 20px 35px;
  }

  .report-mode #stepContent {
    padding-inline: 20px;
  }

  .field,
  .field.span-6,
  .field.span-8 {
    grid-column: span 6;
  }

  .field.span-12 {
    grid-column: span 12;
  }

  .analysis-overview {
    grid-template-columns: 1fr;
  }

  .dimension-grid,
  .roadmap,
  .optimization-list,
  .report-optimization {
    grid-template-columns: 1fr;
  }

  .reference-head {
    display: none;
  }

  .reference-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .diagnosis-card {
    grid-template-columns: 1fr;
  }

  .diagnosis-label {
    min-height: 42px;
    justify-self: start;
    padding-inline: 14px;
  }

  .action-bar {
    padding: 12px 16px;
    align-items: flex-end;
  }

  .action-bar-left .danger-text,
  #deleteCurrentBtn {
    display: none;
  }
}

@media (max-width: 560px) {
  .header-actions .btn {
    padding-inline: 10px;
  }

  .header-actions .btn svg {
    display: none;
  }

  .step-track {
    min-width: 850px;
  }

  .app-main {
    width: 100%;
    margin: 0;
    border-inline: 0;
    border-radius: 0;
  }

  .form-grid {
    gap: 14px;
  }

  .field,
  .field.span-6,
  .field.span-8,
  .field.span-12 {
    grid-column: span 12;
  }

  .concern-grid,
  .stats-grid,
  .cashflow-stats,
  .asset-summary,
  .report-stats {
    grid-template-columns: 1fr;
  }

  .report-stats.six {
    grid-template-columns: 1fr;
  }

  .coverage-table {
    grid-template-columns: 1fr;
  }

  .medical-extras {
    margin-left: 0;
  }

  .action-bar {
    gap: 6px;
  }

  .action-bar-left {
    display: none;
  }

  .action-bar-right {
    width: 100%;
  }

  .action-bar-right .btn-outline {
    flex: 1 1 auto;
    padding-inline: 8px;
    font-size: 12px;
  }

  .btn-primary {
    flex: 0 0 122px;
    min-width: 122px;
  }

  .goal-summary,
  .archive-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .report-heading h1 {
    letter-spacing: 0.04em;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@page {
  size: A4;
  margin: 13mm;
}

@media print {
  :root {
    --canvas: #fff;
  }

  body {
    background: #fff;
    color: #23343d;
    font-size: 11px;
  }

  .no-print,
  .toast {
    display: none !important;
  }

  .app-main {
    width: 100%;
    margin: 0;
    display: block;
    border: 0;
    box-shadow: none;
  }

  #stepContent {
    min-height: auto;
    padding: 0;
  }

  .report {
    max-width: none;
  }

  .report-heading {
    margin-bottom: 14px;
    padding-bottom: 12px;
  }

  .report-heading h1 {
    font-size: 27px;
  }

  .report-heading p {
    font-size: 11px;
  }

  .report-family-name {
    margin-top: 14px;
    font-size: 17px;
  }

  .report-stats .stat-card {
    min-height: 70px;
    padding: 10px;
    break-inside: avoid;
  }

  .stat-card strong {
    font-size: 16px;
  }

  .report-section,
  .report-recommendations {
    margin-top: 17px;
    break-inside: avoid;
  }

  .report-section h2 {
    margin-bottom: 7px;
    font-size: 14px;
  }

  .report-list li {
    padding: 4px 0;
    font-size: 10px;
  }

  .report-recommendations .analysis-columns,
  .report-three {
    grid-template-columns: repeat(3, 1fr);
  }

  .analysis-group,
  .report-recommendations .analysis-group {
    min-height: 115px;
    padding: 10px;
    break-inside: avoid;
  }

  .analysis-group h2 {
    font-size: 13px;
  }

  .analysis-group li {
    margin: 4px 0;
    font-size: 9px;
  }

  .notes-area {
    min-height: 78px;
  }

  .report-disclaimer {
    margin-top: 15px;
    padding-top: 10px;
    font-size: 9px;
  }
}
