.forecast-panel {
  padding: clamp(16px, 3.2vw, 30px);
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  background: var(--surface);
}
.forecast-panel > .eyebrow { margin-bottom: 8px; }
.forecast-controls { min-inline-size: 0; margin: 20px 0 0; padding: 0; border: 0; }
.forecast-controls legend { margin-bottom: 8px; padding: 0; color: var(--accent-soft); font-weight: 700; }
.forecast-controls label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: var(--night);
  cursor: pointer;
}
.forecast-toggles label + label { margin-top: 8px; }
.forecast-toggles input { flex: none; width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--accent); }
.forecast-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.forecast-fields label { align-items: stretch; flex-direction: column; gap: 6px; cursor: text; }
.forecast-fields input {
  min-height: 44px;
  width: 100%;
  min-width: 0;
  margin-top: auto;
  padding-inline: 8px;
  border: 1px solid #756d60;
  background: var(--surface);
  color: var(--foreground);
  font: inherit;
  font-variant-numeric: tabular-nums;
}
.forecast-field-note { grid-column: 1 / -1; color: var(--muted); font-size: .875rem; }
.forecast-fields input[aria-invalid="true"] { border-color: #ffb3a9; }
.forecast-results { margin-block: 18px; }
[data-budget-forecast] { margin-top: 18px; }
.forecast-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.forecast-metrics div { min-width: 0; padding: 10px 0; border-top: 1px solid var(--line); }
.forecast-metrics dt { color: var(--muted); font-size: .875rem; }
.forecast-metrics dd { color: var(--accent-soft); font-size: clamp(1.05rem, 2.4vw, 1.5rem); font-weight: 700; font-variant-numeric: tabular-nums; }
.forecast-metrics .forecast-note { color: var(--muted); font-size: .875rem; font-weight: 400; }
.forecast-panel [data-negative] { color: #ffb3a9; }
.forecast-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.forecast-chart text { fill: var(--muted); font: 16px var(--sans); }
.forecast-grid { fill: none; stroke: var(--line); stroke-width: 1; }
.forecast-zero { fill: none; stroke: var(--muted); stroke-width: 1.25; }
.forecast-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.forecast-chart[data-comparing] .forecast-base { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 5; }
.forecast-chart figcaption { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .875rem; }
.forecast-chart figcaption span:nth-child(-n+2)::before { content: ""; display: inline-block; width: 18px; margin-right: 5px; border-top: 2px solid var(--accent); vertical-align: middle; }
.forecast-chart[data-comparing] figcaption span.forecast-key-base::before { border-top-style: dashed; border-color: var(--muted); }
.forecast-chart { margin-top: 14px; }
.forecast-decision { padding-inline-start: 11px; border-inline-start: 2px solid var(--accent); font-weight: 700; }
.forecast-toggles + .forecast-decision { margin-top: 14px; }
.forecast-equation { color: var(--muted); font-size: .875rem; }
.forecast-threshold { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); }
.forecast-threshold span, .forecast-threshold strong { display: block; }
.forecast-threshold span { color: var(--muted); font-size: .875rem; }
.forecast-threshold strong { color: var(--accent-soft); font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.forecast-panel .forecast-apply { min-height: 44px; cursor: pointer; }
.forecast-panel .forecast-apply:disabled { opacity: .65; cursor: default; }
.forecast-detail { margin-block: 18px; border-block: 1px solid var(--line); }
.forecast-detail summary { padding-block: 12px; color: var(--accent-soft); font-weight: 700; cursor: pointer; }
.forecast-table { width: 100%; margin-bottom: 10px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.forecast-table caption { padding-bottom: 8px; color: var(--muted); font-size: .875rem; text-align: left; }
.forecast-table :is(th, td) { padding: 7px 5px; border-bottom: 1px solid var(--line); text-align: right; }
.forecast-table tr > :first-child { padding-left: 0; text-align: left; }
.forecast-table tr:last-child > :is(th, td) { border-bottom: 0; }

@media (max-width: 520px) {
  .forecast-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .forecast-metrics div:last-child { grid-column: 1 / -1; }
  .forecast-table { font-size: .875rem; }
  .forecast-chart text { font-size: 20px; }
}

@media (max-width: 350px) {
  .forecast-fields { grid-template-columns: minmax(0, 1fr); }
}
