.schedule-inline-fields {
  display: grid;
  grid-template-columns: 9rem minmax(12rem, 1fr) 8rem;
  gap: .55rem;
  align-items: center;
  flex: 1;
}

.schedule-inline-fields input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: .45rem .55rem;
  font: 600 .86rem var(--sans);
}

.schedule-inline-fields input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-color: var(--accent);
}

.schedule-desktop-editor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
}

.schedule-mobile-view,
.schedule-mobile-editor {
  display: none;
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1100px 520px at 8% -12%, #e7efe9 0%, transparent 55%),
    radial-gradient(900px 480px at 100% 0%, #f0e8dc 0%, transparent 52%),
    linear-gradient(180deg, #f7f4ee 0%, var(--bg) 42%, #efebe3 100%);
  color: var(--text);
  font-family: var(--sans);
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.subtitle {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.controls {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.account-filter-label {
  display: grid;
  gap: .25rem;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 700;
}

.minimum-cash-control {
  display: grid;
  gap: .1rem;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-elev);
  color: var(--text);
  padding: .35rem .7rem;
  text-align: left;
  cursor: pointer;
  font-family: var(--sans);
}
.minimum-cash-control span { color: var(--muted); font-size: .68rem; font-weight: 700; }
.minimum-cash-control strong { font-size: .86rem; }
.minimum-cash-control strong[data-source="suggested"]::after { content: " · suggested"; color: var(--muted); font-size: .7rem; font-weight: 500; }
.minimum-cash-input-label { display: grid; gap: .35rem; font-weight: 700; }
.minimum-cash-input-label input { min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: .6rem; font: 600 1rem var(--sans); }
.minimum-cash-suggestion { color: var(--muted); font-size: .85rem; }
.minimum-cash-actions { flex-wrap: wrap; }
#minimum-cash-reset { margin-right: auto; border: 0; background: transparent; color: var(--accent); }
#minimum-cash-cancel { border: 1px solid var(--line); background: transparent; color: var(--text); }
#minimum-cash-save { border: 0; background: var(--btn-bg); color: var(--btn-fg); }

.account-filter-label select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-elev);
  color: var(--text);
  padding: .45rem .7rem;
  font: 600 .85rem var(--sans);
}

.horizon-toggle,
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elev);
}

.horizon-btn,
.view-btn {
  font: inherit;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.horizon-btn.is-active,
.view-btn.is-active {
  background: var(--accent-soft, #e7efe9);
  color: var(--text);
}

button#refresh {
  font: inherit;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
}

.hero {
  margin-top: 1.5rem;
  margin-bottom: 1.25rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.hero h1 {
  font-family: var(--sans);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 0.4rem;
  font-weight: 700;
}

.meta,
.summary {
  color: var(--muted);
  margin: 0.2rem 0;
  max-width: 42rem;
}

.empty {
  margin: 1.5rem 0;
  padding: 1.5rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
}

.empty h2 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.solvency {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1rem;
  margin: 1rem 0 1.25rem;
}

.solvency-card {
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--bg-elev) 0%, #fcfdfc 70%, var(--accent-soft, #e7efe9) 100%);
  box-shadow: var(--shadow);
}

.solvency-eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.7rem;
  color: var(--muted);
}

.solvency-value {
  margin: 0.35rem 0 0.15rem;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 650;
}

.solvency-when {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.cushion-chip {
  display: inline-block;
  margin: 0;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  background: var(--accent-soft, #e7efe9);
}

.cushion-chip.tone-safe { background: #dcefe2; color: #1f5a36; }
.cushion-chip.tone-caution { background: #f5e6c8; color: #6a4a12; }
.cushion-chip.tone-danger { background: #f3d6d4; color: #7a2a24; }
.cushion-chip.tone-calm { background: #e8e6e1; color: #444; }

.cushion-body,
.driver {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 36rem;
}

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

.solvency-side {
  display: grid;
  gap: 0.75rem;
}

.stat {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 650;
}

.mono {
  font-family: var(--mono);
}

.panel {
  margin: 1.25rem 0;
  padding: 1.15rem 1.25rem 1.35rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
}

.panel-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.wide-chart-host {
  margin-top: 1rem;
  min-height: 220px;
}

.wide-chart-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  align-items: stretch;
}

.wide-chart-scale {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--mono);
  padding: 0.2rem 0;
}

.wide-chart {
  position: relative;
  height: 220px;
}

.wide-chart-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.wide-chart-svg .cash-line {
  fill: none;
  stroke: var(--accent, #2f6b4f);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.wide-chart-svg .scenario-line {
  fill: none;
  stroke: #8a5a2b;
  stroke-width: 2.25;
  stroke-dasharray: 7 5;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0.95;
}

.wide-chart-svg .buffer-line {
  fill: none;
  stroke: #b08a3c;
  stroke-width: 1.25;
  stroke-dasharray: 5 4;
  opacity: 0.85;
}

.wide-chart-svg .low-pin {
  fill: #c45c26;
  stroke: #fff;
  stroke-width: 2;
}

.wide-chart-svg .scrub-dot {
  fill: var(--accent, #2f6b4f);
  stroke: #fff;
  stroke-width: 2;
}

.wide-chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.wide-chart-tooltip {
  position: absolute;
  transform: translate(-50%, -120%);
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  font-size: 0.75rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 2;
}

.monthly-bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(2.4rem, 1fr);
  gap: 0.35rem;
  align-items: end;
  height: 200px;
  margin-top: 0.5rem;
}

.monthly-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  height: 100%;
  justify-content: flex-end;
}

.monthly-bar-fill {
  width: 100%;
  max-width: 2.2rem;
  border-radius: 6px 6px 2px 2px;
  background: var(--accent, #2f6b4f);
  min-height: 4px;
}

.monthly-bar-fill.is-negative {
  background: #b85c4a;
}

.monthly-bar-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
}

.scrubber {
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: #f4f1ea;
  border: 1px solid var(--line);
}

.scrubber-date {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.scrubber-cash {
  margin: 0.2rem 0;
  font-size: 1.2rem;
  font-weight: 650;
}

.scrubber-flows {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.schedule-month {
  margin-top: 1rem;
}

.schedule-month:first-child {
  margin-top: 0.35rem;
}

.schedule-month-title {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.schedule-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto auto;
  gap: 0.65rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
}

.schedule-date {
  color: var(--muted);
  font-size: 0.85rem;
}

.schedule-main {
  min-width: 0;
}

.schedule-label {
  font-weight: 600;
}

.schedule-class {
  display: inline-block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.schedule-amount {
  font-weight: 650;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.schedule-amount.is-outflow {
  color: #8a3b32;
}

.schedule-amount.is-inflow {
  color: #1f5a36;
}

.schedule-details {
  border-top: 1px solid var(--line);
}

.schedule-details:first-of-type {
  border-top: 0;
}

.schedule-row-summary {
  list-style: none;
  cursor: pointer;
}

.schedule-row-summary::-webkit-details-marker {
  display: none;
}

.schedule-row-summary .schedule-label::before {
  content: "▸ ";
  color: var(--muted);
  font-weight: 400;
}

.schedule-details[open] .schedule-row-summary .schedule-label::before {
  content: "▾ ";
}

.schedule-expand-hint {
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent, #0f6b63);
}

.schedule-composition-block {
  padding: 0.15rem 0 0.55rem;
  background: #f7f4ee;
  border-radius: 0 0 10px 10px;
  margin-bottom: 0.25rem;
}

.schedule-composition-section {
  grid-column: 1 / -1;
  margin: 0.45rem 0.75rem 0.15rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(28, 32, 36, 0.08);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent, #0f6b63);
}

.schedule-composition {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.35rem 0.75rem 0.35rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.schedule-composition.is-added {
  color: var(--text);
  font-weight: 500;
}

.schedule-composition::before {
  content: "";
  grid-column: 1;
}

.schedule-composition-label {
  grid-column: 2;
  padding-left: 0.25rem;
}

.schedule-composition-amount {
  grid-column: 3;
  color: var(--text);
  font-weight: 600;
}

.schedule-remove-btn {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-elev);
  color: var(--muted);
  cursor: pointer;
}

.schedule-remove-btn:hover {
  color: #9b3b2a;
  border-color: #9b3b2a;
}

.schedule-composition .schedule-remove-btn {
  grid-column: 4;
}

.schedule-remove-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  align-items: center;
}

.schedule-row .schedule-remove-wrap {
  grid-column: 4;
}

.inline-empty {
  color: var(--muted);
  margin: 0.75rem 0 0;
}

.vs-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0.85rem;
}

.vs-lane-title {
  margin: 0 0 0.2rem;
  font-size: 0.98rem;
}

.vs-lane-sub {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.vs-lane-card {
  margin-top: 1.35rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.vs-row {
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}

.vs-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.vs-row-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}

.vs-row-label {
  font-weight: 650;
}

.vs-row-meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.vs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.vs-chip {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-soft, #d7ebe7);
  color: var(--text);
}

.vs-chip.is-up {
  background: #f5e6c8;
}

.vs-chip.is-down {
  background: #e8e6e1;
}

.vs-learning .vs-row-label {
  font-weight: 500;
  color: var(--muted);
}

.vs-subhead {
  margin: 1rem 0 0.15rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.vs-subhint {
  margin-bottom: 0.5rem;
}

.vs-payday {
  border-top: 1px solid var(--line);
  padding: 0.15rem 0;
}

.vs-payday:first-of-type {
  border-top: 1px solid var(--line);
}

.vs-payday summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.45rem 0;
  font-weight: 600;
}

.vs-payday summary::-webkit-details-marker {
  display: none;
}

.vs-payday-when::before {
  content: "▸";
  display: inline-block;
  width: 1rem;
  margin-right: 0.25rem;
  color: var(--muted);
  font-weight: 400;
}

.vs-payday[open] .vs-payday-when::before {
  content: "▾";
}

.vs-payday-amt {
  flex-shrink: 0;
}

.vs-cat {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.3rem 0 0.3rem 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.vs-cat-amount {
  font-family: var(--mono);
  color: var(--text);
  font-weight: 600;
}

.limitations {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.limitations h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.limitations ul {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
}

.scenario-legend {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.scenario-active-count {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent, #2f6b4f);
  white-space: nowrap;
}

.scenario-layers {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.scenario-layer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem 0.85rem;
  align-items: start;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.scenario-layer:last-child {
  border-bottom: 0;
}

.scenario-layer.is-off {
  opacity: 0.55;
}

.scenario-layer-toggle {
  margin-top: 0.2rem;
}

.scenario-layer-name {
  margin: 0;
  font-weight: 600;
}

.scenario-layer-meta {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.scenario-layer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.scenarios-workspace .scenario-layers { display: grid; gap: 10px; }
.scenario-columns-header,
.scenarios-workspace .scenario-layer { grid-template-columns: minmax(0, 1fr) 74px 190px 58px; column-gap: 14px; }
.scenario-columns-header { display: grid; align-items: end; padding: 0 0 .45rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .02em; }
.scenario-columns-header span:not(:first-child) { text-align: center; line-height: 1.25; }
.scenarios-workspace .scenario-layer { align-items: center; }
.scenario-toggle-group { display: contents; }
.scenario-switch { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); white-space: nowrap; cursor: pointer; }
.scenario-switch { justify-self: center; }
.scenario-switch input {
  appearance: none;
  width: 36px;
  height: 20px;
  margin: 0;
  border: 1px solid #a9b3ae;
  border-radius: 999px;
  background: #d8dedb radial-gradient(circle at 9px 50%, #fff 0 6px, transparent 6.5px);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.scenario-switch input:checked { border-color: #245e47; background: #2f6b4f radial-gradient(circle at 26px 50%, #fff 0 6px, transparent 6.5px); }
.scenario-switch input:focus-visible { outline: 3px solid rgba(47, 107, 79, .24); outline-offset: 2px; }
.scenario-switch input:disabled { opacity: .78; cursor: not-allowed; }
.scenario-switch:has(input:disabled) { cursor: default; }
.scenario-delete { justify-self: end; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.scenario-row-actions { display: flex; justify-self: end; align-items: center; gap: 2px; }
.scenario-builder { width: min(760px, calc(100vw - 28px)); max-height: 90vh; border: 1px solid var(--line); border-radius: 18px; padding: 0; color: var(--ink); }
.scenario-builder::backdrop { background: rgba(20, 31, 29, .38); backdrop-filter: blur(3px); }
.scenario-builder-form { padding: 24px; overflow: auto; max-height: 90vh; }
.scenario-builder-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.scenario-builder-head h2 { margin: 2px 0 0; }
.scenario-builder-head button { border: 0; background: transparent; font-size: 1.8rem; color: var(--muted); cursor: pointer; }
.scenario-type-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.scenario-type-cards label { position: relative; }
.scenario-type-cards input { position: absolute; opacity: 0; }
.scenario-type-cards span { display: grid; gap: 4px; height: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.scenario-type-cards small { color: var(--muted); line-height: 1.35; }
.scenario-type-cards input:checked + span { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand); }
.scenario-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.scenario-fields label { display: grid; gap: 6px; font-size: .82rem; color: var(--muted); }
.scenario-fields input, .scenario-fields select { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; color: var(--ink); background: #fff; }
.finance-fields { border: 1px solid var(--line); border-radius: 13px; margin: 20px 0 0; padding: 16px; }
.finance-fields legend { padding: 0 7px; font-weight: 700; }
.field-note { color: var(--muted); font-size: .8rem; line-height: 1.45; margin: 14px 0 0; }
.scenario-builder-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.scenario-builder-actions button { padding: 10px 16px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
@media (max-width: 650px) {
  .scenario-type-cards, .scenario-fields { grid-template-columns: 1fr; }
  .scenario-columns-header { display: none !important; }
  .scenarios-workspace .scenario-layer { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; row-gap: 8px; }
  .scenarios-workspace .scenario-layer > div:first-child { grid-column: 1 / -1; }
  .scenario-switch { justify-self: start; white-space: normal; }
  .scenario-switch::after { content: attr(data-mobile-label); margin-left: 7px; font-size: .78rem; color: var(--muted); }
  .scenario-builder { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .scenario-builder-form { min-height: 100dvh; max-height: 100dvh; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); }
  .scenario-builder-head { position: sticky; top: -18px; z-index: 2; margin: -18px -16px 18px; padding: 18px 16px 12px; background: #fff; border-bottom: 1px solid var(--line); }
  .scenario-builder-actions { position: sticky; bottom: calc(-24px - env(safe-area-inset-bottom)); margin: 20px -16px calc(-24px - env(safe-area-inset-bottom)); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); }
  .scenario-builder-actions button { flex: 1; min-height: 48px; }
  .scenario-fields input, .scenario-fields select { min-height: 48px; font-size: 16px; }
  .scenario-type-cards span { min-height: 68px; }
  .scenario-delete, .scenario-switch { min-height: 44px; }
  .scenario-row-actions { grid-column: 1 / -1; justify-self: start; }
}

.scenario-layer-actions button {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
}

.scenario-layer-actions button:hover {
  border-color: var(--accent, #2f6b4f);
}

.scenario-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  align-items: end;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.account-review details > summary { cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.account-review details > summary span:first-child { display: grid; gap: .2rem; }
.account-review details > summary small { color: var(--muted); font-weight: 400; }
.account-review-list { display: grid; gap: .75rem; margin-top: 1rem; }
.account-review-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.account-review-row > div:first-child { display: grid; gap: .2rem; }
.account-review-row small { color: var(--muted); }
.account-review-controls { display: flex; gap: .5rem; }
.account-review-controls select, .account-review-controls button { min-height: 40px; }
.account-review-controls select { background: #fff; color: #1f2925; border: 1px solid var(--line); }
.account-review-controls button { background: #245e47; color: #fff; border: 1px solid #245e47; font-weight: 700; padding: .55rem .85rem; border-radius: 8px; }
.account-review-controls button:hover { background: #194a36; border-color: #194a36; }
.account-review-controls button:focus-visible { outline: 3px solid rgba(47, 107, 79, .24); outline-offset: 2px; }
.planned-transfer-list { display: grid; gap: .65rem; margin-bottom: .8rem; }
.planned-transfer-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.planned-transfer-row > div { display: grid; gap: .2rem; }
.planned-transfer-row small { color: var(--muted); }
.planned-transfer-row button { min-height: 38px; }

.scenario-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.scenario-form input,
.scenario-form select {
  font: inherit;
  font-weight: 500;
  color: var(--text);
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
}

.scenario-add-btn {
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  border: 0;
  border-radius: 8px;
  background: var(--accent, #2f6b4f);
  color: #fff;
  cursor: pointer;
}

.scenario-status {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.scenario-timing-hint {
  margin: 0.55rem 0 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--muted);
}

.scenario-status.is-error {
  color: #9b3b2a;
}

.edit-scope-dialog {
  width: min(31rem, calc(100vw - 2rem));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  padding: 0;
  box-shadow: 0 24px 70px rgba(28, 25, 21, .22);
}

.edit-scope-dialog::backdrop {
  background: rgba(28, 25, 21, .42);
}

.edit-scope-dialog form { padding: 1.35rem; }
.edit-scope-dialog h2 { margin: 0; font-family: var(--sans); }
.edit-scope-dialog form > p { color: var(--muted); margin: .35rem 0 1rem; }
.edit-scope-dialog fieldset { display: grid; gap: .65rem; border: 0; padding: 0; margin: 0; }
.edit-scope-dialog fieldset label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .7rem;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .8rem;
  cursor: pointer;
}
.edit-scope-dialog input { margin-top: .2rem; accent-color: var(--accent); }
.edit-scope-dialog label span { display: grid; gap: .15rem; }
.edit-scope-dialog small { color: var(--muted); }
.edit-scope-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }
.edit-scope-actions button { min-height: 40px; padding: .55rem .9rem; border-radius: 8px; font: 700 .86rem var(--sans); cursor: pointer; }
#edit-scope-cancel { border: 1px solid var(--line); background: transparent; color: var(--text); }
#edit-scope-confirm { border: 0; background: var(--btn-bg); color: var(--btn-fg); }

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

@media (max-width: 720px) {
  .wide-chart-host {
    min-height: 0;
    margin-top: 0.75rem;
  }

  .wide-chart-wrap {
    position: relative;
    display: block;
  }

  .wide-chart-scale {
    position: absolute;
    inset: 0.35rem auto 1.5rem 0.25rem;
    z-index: 1;
    pointer-events: none;
  }

  .wide-chart-scale span {
    width: max-content;
    padding: 0.08rem 0.2rem;
    border-radius: 4px;
    background: rgba(247, 244, 238, 0.82);
  }

  .wide-chart {
    width: 100%;
    height: 200px;
  }

  .wide-chart-axis {
    font-size: 0.68rem;
  }

  .schedule-desktop-editor {
    display: none;
  }

  .schedule-mobile-view {
    grid-column: 1 / -1;
    width: 100%;
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 1fr) auto auto;
    gap: 0.55rem;
    align-items: center;
  }

  .schedule-mobile-view .schedule-amount {
    grid-column: auto;
  }

  .schedule-mobile-menu {
    position: relative;
  }

  .schedule-more-btn {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font: 700 1.35rem/1 var(--sans);
    cursor: pointer;
  }

  .schedule-more-btn:hover,
  .schedule-more-btn:focus-visible {
    background: rgba(15, 107, 99, 0.08);
    color: var(--accent);
  }

  .schedule-mobile-menu-popover {
    position: absolute;
    top: calc(100% + 0.2rem);
    right: 0;
    z-index: 5;
    min-width: 10.5rem;
    padding: 0.3rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-elev);
    box-shadow: 0 10px 28px rgba(28, 32, 36, 0.16);
  }

  .schedule-mobile-menu-popover button {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 0.55rem 0.7rem;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text);
    font: 600 0.84rem var(--sans);
    text-align: left;
  }

  .schedule-mobile-menu-popover button:hover,
  .schedule-mobile-menu-popover button:focus-visible {
    background: rgba(15, 107, 99, 0.08);
  }

  .schedule-mobile-editor {
    grid-column: 1 / -1;
    width: 100%;
  }

  .is-mobile-editing > .schedule-mobile-view {
    display: none;
  }

  .is-mobile-editing > .schedule-mobile-editor {
    display: block;
  }

  .schedule-mobile-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.55rem;
  }

  .schedule-mobile-edit-actions button {
    min-height: 44px;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg-elev);
    color: var(--text);
    font: 650 0.82rem var(--sans);
  }

  .schedule-mobile-edit-actions .is-primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
  }

  .schedule-composition > .schedule-mobile-view,
  .schedule-composition > .schedule-mobile-editor {
    grid-column: 1 / -1;
  }

  .schedule-inline-fields {
    grid-template-columns: 1fr;
    grid-column: 1 / -1;
  }

  .shell {
    padding: 1rem 1rem 5.5rem;
  }

  .top {
    flex-direction: column;
    align-items: flex-start;
  }

  .solvency {
    grid-template-columns: 1fr;
  }

  .schedule-row {
    grid-template-columns: 3.5rem 1fr;
  }

  .schedule-amount,
  .schedule-remove-wrap {
    grid-column: 2;
    justify-self: end;
  }

  .schedule-remove-wrap {
    margin-top: 0.25rem;
  }

  .scenario-layer {
    grid-template-columns: auto 1fr;
  }

  .scenario-layer-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .schedule-inline-fields input, #open-scenario-builder { min-height: 44px; }

  .account-review-row, .planned-transfer-row { align-items: stretch; flex-direction: column; }
  .account-review-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .account-review-controls select, .account-review-controls button,
  .schedule-remove-btn { min-height: 44px; }
  .edit-scope-dialog { width: calc(100vw - 1rem); margin: auto .5rem; }
  .edit-scope-dialog fieldset label { min-height: 58px; }
}
