.planning-page {
  box-sizing: border-box;
  width: min(1120px, calc(100% - 32px));
  margin: 28px auto 52px;
  color: #1d314d;
}

.planning-page *,
.planning-page *::before,
.planning-page *::after { box-sizing: border-box; }

.planning-page .print-report-header,
.planning-page .print-only { display: none; }

.planning-intro {
  max-width: 820px;
  margin: 0 0 22px;
  color: #405976;
  font-size: 1.02rem;
  line-height: 1.7;
}

.planning-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: -8px 0 22px;
}

.planning-trust p {
  margin: 0;
  padding: 9px 12px;
  border: 1px solid #cfe1ef;
  border-radius: 999px;
  background: #f4faff;
  color: #355675;
  font-size: .88rem;
}

#planningChart[hidden],
#planningChartSummary[hidden] { display: none; }

.planning-page > section,
.planning-calculator {
  margin-bottom: 24px;
  padding: clamp(20px, 4vw, 32px);
  border: 1px solid #d8e4f0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(28, 66, 108, .07);
}

.planning-page h2 { margin: 0 0 16px; color: #173b66; }
.planning-page h3 { color: #254c78; }
.planning-page #entry { min-width: 0; }
.planning-page #entry::before { content: none; }
ol.breadcrumb.planning-breadcrumb { height: auto; min-height: 50px; flex-wrap: wrap; }

.planning-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
}

.planning-advanced {
  margin-top: 18px;
  border: 1px solid #cbdceb;
  border-radius: 12px;
  background: #f8fbfe;
}

.planning-advanced:not([open]) > :not(summary) { display: none; }

.planning-advanced > summary {
  min-height: 48px;
  padding: 13px 16px;
  color: #24517d;
  cursor: pointer;
  font-weight: 800;
}

.planning-advanced > p {
  margin: 0;
  padding: 0 16px 14px;
  color: #526b88;
  font-size: .9rem;
}

.planning-advanced .planning-fields {
  padding: 18px 16px 0;
  border-top: 1px solid #d9e5ef;
  background: #fff;
}

.planning-field label {
  display: block;
  margin-bottom: 7px;
  color: #263e5c;
  font-weight: 700;
}

.planning-input-wrap {
  display: flex;
  align-items: center;
  min-height: 48px;
  overflow: hidden;
  border: 1px solid #a9bfd6;
  border-radius: 10px;
  background: #fff;
}

.planning-input-wrap > span {
  flex: 0 0 auto;
  padding: 0 12px;
  color: #526b88;
  font-weight: 700;
}

.planning-field input,
.planning-field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #a9bfd6;
  border-radius: 10px;
  background: #fff;
  color: #172b48;
  font: inherit;
}

.planning-input-wrap input {
  min-width: 0;
  border: 0;
  border-radius: 0;
}

.planning-field input:focus-visible,
.planning-field select:focus-visible,
.schedule-actions button:focus-visible {
  outline: 3px solid #8cc5ff;
  outline-offset: 2px;
}

.planning-field [aria-invalid="true"] { background: #fff4f1; }
.field-error {
  min-height: 20px;
  margin: 5px 0 0;
  color: #a1331f;
  font-size: .86rem;
}

.planning-results {
  margin-top: 26px;
  padding: 24px;
  border: 1px solid #cae0f3;
  border-radius: 16px;
  background: linear-gradient(145deg, #f4faff, #eaf5ff);
}

#planningResult {
  color: #075e48;
  overflow-wrap: anywhere;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 800;
}

#planningSummary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.summary-item {
  min-width: 0;
  padding: 13px;
  border: 1px solid #d3e2f0;
  border-radius: 11px;
  background: #fff;
}

.summary-item span,
.summary-item strong { display: block; }
.summary-item span { color: #526b88; font-size: .84rem; }
.summary-item strong {
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: #173b66;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

#planningBreakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin-top: 20px;
}

.breakdown-item {
  display: grid;
  grid-template-columns: minmax(46px, var(--segment)) minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: #324d6b;
  font-size: .88rem;
}

.breakdown-marker { height: 10px; border-radius: 999px; background: #2377c8; }
.breakdown-user .breakdown-marker { background: #13866d; }
.breakdown-employer .breakdown-marker { background: #7657b5; }
.breakdown-growth .breakdown-marker { border: 2px solid #8a5a00; background: #f0b64d; }
.breakdown-withdrawal .breakdown-marker { border: 2px dashed #a33f3f; background: #f7c7c7; }

#planningChart {
  min-height: 230px;
  margin-top: 24px;
  padding: 10px;
  border: 1px solid #d4e2ef;
  border-radius: 12px;
  background: #fff;
}

#planningChart svg { display: block; width: 100%; height: auto; min-height: 210px; }
.chart-axis { stroke: #9eb1c4; stroke-width: 1.5; }
.chart-line { stroke: #1768ad; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.chart-label { fill: #425d79; font: 700 14px system-ui, sans-serif; }
#planningChartSummary { margin: 10px 0 0; color: #425d79; line-height: 1.55; }

.planning-schedule { margin-top: 26px; }
.schedule-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.schedule-actions button {
  min-width: 145px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid #1768ad;
  border-radius: 9px;
  background: #1768ad;
  color: #fff;
  font: 700 .94rem system-ui, sans-serif;
  cursor: pointer;
}
.schedule-actions button:last-of-type { background: #fff; color: #1768ad; }
.schedule-actions button:disabled { cursor: wait; opacity: .58; }
.export-status { min-height: 24px; margin: 0 0 10px; color: #315b83; font-size: .9rem; }

.schedule-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #d7e2ee;
  border-radius: 12px;
  background: linear-gradient(to right, #fff 30%, rgba(255,255,255,0)),
    linear-gradient(to left, #fff 30%, rgba(255,255,255,0)) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(35,67,103,.18), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(35,67,103,.18), transparent) 100% 0;
  background-attachment: local, local, scroll, scroll;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 12px 100%, 12px 100%;
}

.planning-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.planning-table caption { padding: 12px; text-align: left; font-weight: 700; }
.planning-table th,
.planning-table td {
  padding: 10px 12px;
  border-top: 1px solid #e3eaf2;
  text-align: left;
  white-space: nowrap;
}
.planning-table th { position: sticky; top: 0; z-index: 1; background: #eaf3fb; color: #274a70; }
.planning-table td.number { text-align: right; font-variant-numeric: tabular-nums; }
.planning-table tbody tr:nth-child(even) { background: #f8fbfe; }

.planning-page p,
.planning-page li { line-height: 1.65; }
.planning-faq details { padding: 13px 0; border-top: 1px solid #dfe7ef; }
.planning-faq summary { cursor: pointer; color: #244c78; font-weight: 700; }
.planning-disclaimer { padding: 15px 18px; border-left: 4px solid #6f8da9; background: #f3f7fa; }

@media (max-width: 720px) {
  .breadcrumb { flex-wrap: wrap; }
  .planning-page { width: min(100% - 20px, 1120px); margin-top: 18px; overflow-x: clip; }
  .planning-page > section,
  .planning-calculator { padding: 18px; border-radius: 14px; }
  .planning-fields,
  #planningSummary,
  #planningBreakdown { grid-template-columns: 1fr; }
  .planning-trust { display: grid; gap: 8px; }
  .planning-trust p { border-radius: 12px; }
  .schedule-actions button { flex: 1 1 100%; width: 100%; }
  #planningChart { min-height: 180px; padding: 4px; }
  #planningChart svg { min-height: 170px; }
}

@media print {
  @page { size: letter landscape; margin: .45in; }

  body { background: #fff !important; color: #111 !important; }
  body > header,
  body > footer,
  .breadcrumb,
  .heading-gradient-bar,
  #heading,
  .planning-intro,
  .planning-trust,
  .schedule-actions,
  .export-status,
  .planning-formula,
  .planning-example,
  .planning-faq,
  .tool-related,
  aside,
  .ad-container { display: none !important; }

  .planning-page { width: 100%; margin: 0; color: #111; }
  .planning-page #entry { display: none; }
  .planning-page .print-only { display: block; }
  .planning-page .print-report-header { display: block; margin-bottom: 16px; }
  .planning-page .print-report-header h2 { margin-bottom: 5px; }
  .planning-page .print-report-header p { margin: 2px 0; font-size: 8.5pt; }
  .planning-page > section,
  .planning-calculator {
    margin: 0 0 15px;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .planning-results { break-inside: avoid; padding: 12px; border: 1px solid #777; background: #fff; }
  #planningChart,
  #planningChartSummary { display: none; }
  #planningSummary { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  #planningBreakdown { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 12px; }
  .summary-item { padding: 7px; border-color: #999; }
  .summary-item span { font-size: 7.5pt; }
  .summary-item strong { font-size: 9pt; }

  #planningPrintInputs { margin-top: 12px; }
  #planningPrintInputs h2 { margin-bottom: 6px; font-size: 11pt; }
  #planningPrintInputs dl {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, auto));
    gap: 3px 12px;
    margin: 0;
    font-size: 7.5pt;
  }
  #planningPrintInputs dt { font-weight: 700; }
  #planningPrintInputs dd { margin: 0; }

  .schedule-table-wrap { overflow: visible; border: 0; background: none; }
  .planning-table { min-width: 0; font-size: 7pt; }
  .planning-table thead { display: table-header-group; }
  .planning-table tr { break-inside: avoid; }
  .planning-table th { position: static; background: #eee !important; }
  .planning-table th,
  .planning-table td { padding: 3px 4px; white-space: normal; }
  .planning-assumptions { break-before: page; }
  .planning-disclaimer { break-inside: avoid; border-color: #555; background: #fff; font-size: 8.5pt; }
}
