/* V1.15 budget phases: one visible chart result and consistent change controls. */
.budget-phase-planner {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#budget-phase-back-to-tax {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  min-width: 44px;
  min-height: 44px;
  text-align: right;
}

.budget-phase-heading {
  padding-top: 52px;
}

.budget-phase-workspace {
  min-width: 0;
}

.budget-phase-workspace[hidden] {
  display: none;
}

.budget-phase-heading h3 {
  margin-bottom: 2px;
}

.budget-phase-chart-container {
  min-width: 0;
  margin-top: 18px;
  padding: 14px 14px 12px;
  border: 1px solid #c9d7e2;
  border-radius: 14px;
  background: #fff;
}

.budget-phase-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.budget-phase-chart-meta {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 -8px;
}

.budget-phase-chart-meta .budget-phase-basis {
  display: inline-flex;
}

.budget-phase-single-note {
  margin: 8px 0 2px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
}

.budget-phase-single-note[hidden] {
  display: none;
}

.budget-phase-change-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.budget-phase-change-choice[hidden] {
  display: none;
}

.budget-phase-change-choice legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 850;
}

.budget-phase-change-choice label {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  padding: 11px 13px;
  border: 1px solid #d2d8e3;
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
}

.budget-phase-change-choice label:has(input:checked) {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(30, 47, 138, .12);
}

.budget-phase-change-choice input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin: 0;
}

.budget-phase-change-choice span {
  display: grid;
  gap: 2px;
}

.budget-phase-change-choice small {
  color: var(--muted);
  line-height: 1.35;
}

.budget-phase-change-confirmation {
  margin-top: 14px;
  padding: 13px;
  border-left: 4px solid #a33;
  background: #fff5f5;
}

.budget-phase-preview-actions {
  margin-top: 14px;
  padding: 13px;
  border-left: 4px solid #b28a34;
  background: #fff9ec;
}

.budget-phase-saved-status {
  position: fixed;
  z-index: 1000;
  inset-inline-start: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  width: min(430px, calc(100vw - 32px));
  box-sizing: border-box;
  margin: 0;
  padding: 13px 16px;
  transform: translateX(-50%);
  border: 1px solid #a9d3bc;
  border-left: 4px solid #2f7a56;
  border-radius: 10px;
  background: #f1faf5;
  box-shadow: 0 10px 28px rgb(17 42 75 / 18%);
  color: #1f6244;
  font-weight: 800;
  text-align: center;
}

.budget-phase-saved-status[hidden] {
  display: none;
}

.budget-phase-change-confirmation[hidden],
.budget-phase-preview-actions[hidden] {
  display: none;
}

.budget-phase-change-confirmation p,
.budget-phase-preview-actions p {
  margin: 0 0 10px;
  font-weight: 750;
  line-height: 1.45;
}

.budget-phase-change-confirmation > div,
.budget-phase-preview-actions > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.budget-phase-change-confirmation button,
.budget-phase-preview-actions button {
  min-height: 48px;
}

.budget-phase-change-keep {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

div.budget-phase-card {
  cursor: default;
}

.budget-phase-editor {
  position: relative;
  border-color: #dcc58f;
  background: #fffdf8;
}

.budget-phase-editor-back {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  text-align: right;
}

.budget-phase-editor-back[hidden] {
  display: none;
}

.budget-phase-editor-head .eyebrow {
  color: #8a641f;
}

.budget-phase-fields {
  grid-template-columns: minmax(0, 1fr);
}

.budget-phase-fields > label,
.budget-phase-slider {
  grid-column: 1;
}

.budget-phase-additional-summary {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
  padding: 14px;
  border: 1px solid #dcc58f;
  border-radius: 12px;
  background: #fffaf0;
}

.budget-phase-additional-summary[hidden] {
  display: none;
}

.budget-phase-additional-summary h5,
.budget-phase-additional-summary h6,
.budget-phase-additional-summary p,
.budget-phase-additional-summary dl {
  margin: 0;
}

.budget-phase-additional-summary h5 {
  color: var(--ink);
  font-size: 15px;
}

.budget-phase-additional-intro,
.budget-phase-additional-note,
.budget-phase-additional-basis {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.budget-phase-additional-note {
  padding-top: 2px;
  color: var(--ink);
}

.budget-phase-additional-periods {
  display: grid;
  gap: 10px;
}

.budget-phase-additional-periods article {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #ead9b5;
}

.budget-phase-additional-periods article:first-child {
  padding-top: 0;
  border-top: 0;
}

.budget-phase-additional-summary h6 {
  color: #8a641f;
  font-size: 13px;
}

.budget-phase-additional-values {
  display: grid;
  gap: 6px;
}

.budget-phase-additional-values > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.budget-phase-additional-values dt,
.budget-phase-additional-values dd {
  margin: 0;
}

.budget-phase-additional-values dd {
  text-align: right;
  font-weight: 750;
}

.budget-phase-additional-total {
  padding-top: 7px;
  border-top: 1px solid #dcc58f;
  color: var(--ink);
  font-weight: 800;
}

.budget-phase-start-fields {
  display: grid;
  min-width: 0;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px 10px;
}

.budget-phase-start-error,
.budget-phase-date-hint {
  grid-column: 1 / -1;
}

.budget-phase-date-hint {
  margin: 3px 0 8px;
  padding: 11px 13px;
  border-left: 3px solid #b28a34;
  background: #fffaf0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.budget-phase-start-fields > span {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 800;
}

.budget-phase-start-panel,
.budget-phase-start-mode {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.budget-phase-start-mode {
  margin: 0;
  padding: 0;
  border: 0;
}

.budget-phase-start-mode label {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #d2d8e3;
  border-radius: 10px;
  background: #f7f9fc;
  cursor: pointer;
}

.budget-phase-start-mode label:has(input:checked) {
  border-color: #b28a34;
  background: #fffaf0;
  box-shadow: 0 0 0 3px rgba(178, 138, 52, .12);
}

.budget-phase-start-mode input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.budget-phase-start-panel[hidden] {
  display: none;
}

.budget-phase-start-panel label {
  display: grid;
  min-width: 0;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
}

.budget-phase-start-fields input[type="text"],
.budget-phase-start-fields select {
  width: 100%;
  min-width: 0;
  height: 54px;
  padding: 12px 14px;
  border: 1px solid #adb6c7;
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
}

.budget-phase-start-error {
  margin: 0;
}

@media (max-width: 760px) {
  .budget-phase-change-choice {
    grid-template-columns: minmax(0, 1fr);
  }

  .budget-phase-change-confirmation > div,
  .budget-phase-preview-actions > div {
    display: grid;
  }

  .budget-phase-change-confirmation button,
  .budget-phase-preview-actions button {
    width: 100%;
  }

  .budget-phase-start-panel {
    grid-template-columns: minmax(0, 1fr);
  }

}

/* V1.15 final retirement-budget UX: one concise task with optional guidance. */
.need-direct-heading {
  display: grid;
  gap: 7px;
  max-width: 46rem;
}

.need-direct-heading h2,
.need-direct-heading p {
  margin: 0;
}

.need-direct-heading h2 {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.15;
}

.need-direct-heading p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.need-budget-help {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.need-budget-help > summary {
  display: flex;
  min-height: 48px;
  align-items: center;
  padding: 7px 2px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.4;
  cursor: pointer;
}

.need-budget-help > summary:focus-visible {
  outline: 3px solid rgba(30, 47, 138, .28);
  outline-offset: 2px;
  border-radius: 5px;
}

.need-budget-help > div {
  display: grid;
  gap: 10px;
  padding: 2px 2px 14px;
  font-size: 13px;
  line-height: 1.55;
}

.need-budget-help p {
  margin: 0;
}

.budget-retirement-additional:not(.is-expense-focus) {
  padding: 0;
  border: 0;
  background: transparent;
}

.budget-additional-trigger {
  border-color: #c6ad71 !important;
  background: #fff !important;
  color: var(--blue) !important;
}

.budget-additional-trigger:hover {
  border-color: #9b7934 !important;
  background: #fff9ec !important;
}

.budget-additional-action-help {
  margin: 8px 2px 0 !important;
  color: var(--muted) !important;
  font-size: 12px;
  line-height: 1.45;
}

@media(max-width:760px) {
  .need-direct-heading h2 { font-size: 27px; }
  .need-budget-help > summary { min-height: 52px; }
}

.retirement-tax-internal-states[hidden] {
  display: none;
}

.retirement-tax-uncertainty-help {
  margin-top: 2px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.retirement-tax-uncertainty-help summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  color: var(--blue);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.retirement-tax-uncertainty-help ul {
  margin: 0;
  padding: 0 0 8px 20px;
  font-size: 14px;
  line-height: 1.55;
}

.retirement-tax-uncertainty-help li + li {
  margin-top: 5px;
}

/* Bars have one value, while age labels sit on a fixed horizontal axis. */
.budget-phase-chart {
  height: 300px;
  min-height: 300px;
  align-items: stretch;
  gap: 8px;
  box-sizing: border-box;
  padding: 16px 10px 0;
  overflow-x: auto;
  overflow-y: hidden;
  border-left: 0;
  border-bottom: 0;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 10px;
  scrollbar-gutter: stable;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

.budget-phase-chart.is-single {
  justify-content: center;
  overflow-x: hidden;
  scroll-snap-type: none;
}

.budget-phase-chart.is-single .budget-phase-column {
  width: min(100%, 280px);
  max-width: 280px;
  flex: 1 1 220px;
}

.budget-phase-column {
  display: grid;
  height: 100%;
  min-width: 112px;
  flex: 1 0 112px;
  grid-template-rows: minmax(0, 1fr) 50px;
  align-items: end;
  scroll-snap-align: start;
}

.budget-phase-column .budget-phase-card {
  width: 100%;
  min-width: 0;
  max-height: 220px;
  align-self: end;
  box-sizing: border-box;
  flex: 0 0 auto;
  white-space: nowrap;
}

.budget-phase-column .budget-phase-card[aria-pressed="true"] {
  border-color: #b28a34;
  background: #fff9ec;
  color: var(--ink);
}

.budget-phase-add-column {
  display: grid;
  height: 100%;
  min-width: 64px;
  flex: 0 0 64px;
  grid-template-rows: minmax(0, 1fr) 50px;
  align-items: end;
  scroll-snap-align: end;
  scroll-margin-inline-end: 10px;
}

.budget-phase-add-inline {
  position: relative;
  display: grid;
  width: 52px;
  height: 52px;
  align-self: end;
  justify-self: center;
  place-items: center;
  box-sizing: border-box;
  margin-bottom: max(4px, calc(var(--last-phase-height, 96px) / 2 - 26px));
  padding: 0;
  border: 2px solid #b28a34;
  border-radius: 50%;
  background: #fff9ec;
  color: #8a641f;
  font: inherit;
  font-size: 0;
  cursor: pointer;
}

.budget-phase-add-inline span {
  position: relative;
  display: block;
  width: 24px;
  height: 24px;
}

.budget-phase-add-inline span::before,
.budget-phase-add-inline span::after {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 24px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  content: "";
  transform: translate(-50%, -50%);
}

.budget-phase-add-inline span::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.budget-phase-add-inline:hover {
  border-color: #8a641f;
  background: #fbf1dc;
}

.budget-phase-add-inline:focus-visible {
  outline: 4px solid rgba(178, 138, 52, .35);
  outline-offset: 3px;
}

.budget-phase-add-axis {
  display: block;
  height: 50px;
  box-sizing: border-box;
  border-top: 2px solid #9ca9b6;
}

.budget-phase-cancel {
  min-height: 44px;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.budget-phase-cancel:hover {
  color: var(--ink);
}

.budget-phase-cancel:focus-visible {
  border-radius: 6px;
  outline: 3px solid rgba(30, 47, 138, .25);
  outline-offset: 2px;
}

.budget-phase-age {
  display: flex;
  height: 50px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border-top: 2px solid #9ca9b6;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  padding-inline: 4px;
  text-align: center;
  white-space: normal;
}

@media (max-width: 760px) {
  .retirement-tax-uncertainty-help summary,
  .retirement-tax-uncertainty-help ul {
    font-size: 15px;
  }

  .budget-phase-chart-container {
    padding: 12px 7px 10px;
  }

  .budget-phase-chart {
    height: 300px;
    min-height: 300px;
    padding-inline: 7px;
  }

  .budget-phase-column {
    min-width: 112px;
    flex-basis: 112px;
  }
}

/* Schritt 1 bleibt ein Hauptschritt, wird aber in zwei klare Aufgaben geteilt. */
.retirement-step-one-view[hidden] {
  display: none;
}

#retirement-age-view .fields {
  grid-template-columns: 1fr;
}

#retirement-age-view .retirement-choice {
  max-width: 100%;
}

@media (max-width: 700px) {
  .retirement-step-one-view .actions {
    display: grid;
    grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr);
  }

  .retirement-step-one-view .actions button {
    width: 100%;
    min-width: 0;
    min-height: 54px;
  }
}
