/* ─── Design Tokens ─── */
:root {
  --bg: #07090f;
  --panel: #0f1219;
  --border: #1e2433;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --accent: #f59e0b;
  --solar: #f59e0b;
  --battery: #38bdf8;
  --ev: #34d399;
  --negative: #ef4444;
  --positive: #22c55e;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-1: 0 1px 3px rgba(0,0,0,.4);
  --shadow-2: 0 4px 20px rgba(0,0,0,.5);
  --shadow-glow-solar: 0 0 30px rgba(245,158,11,.15);
  --shadow-glow-battery: 0 0 30px rgba(56,189,248,.15);
  --shadow-glow-ev: 0 0 30px rgba(52,211,153,.15);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --panel: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-dim: #64748b;
    --shadow-1: 0 1px 3px rgba(0,0,0,.08);
    --shadow-2: 0 4px 20px rgba(0,0,0,.1);
    --shadow-glow-solar: 0 0 30px rgba(245,158,11,.1);
    --shadow-glow-battery: 0 0 30px rgba(56,189,248,.1);
    --shadow-glow-ev: 0 0 30px rgba(52,211,153,.1);
    color-scheme: light;
  }
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
}

/* ─── Sticky ROI (mirrors hero when scrolled out of view) ─── */
.sticky-roi-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 10px clamp(16px, 4vw, 32px);
  padding-top: calc(10px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  transform: translateY(-100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.22s var(--ease-out), opacity 0.22s var(--ease-out), visibility 0.22s;
}

@media (prefers-reduced-motion: reduce) {
  .sticky-roi-bar {
    transition: none;
  }
}

.sticky-roi-bar.is-visible {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sticky-roi-inner {
  max-width: 800px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 2px;
  align-items: baseline;
}

.sticky-roi-brand {
  grid-column: 1;
  grid-row: 1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.sticky-roi-main {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

.sticky-roi-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(26px, 7vw, 40px);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.sticky-roi-number.flash {
  animation: flash 0.4s var(--ease-out);
}

.sticky-roi-unit {
  font-size: clamp(12px, 2.8vw, 15px);
  color: var(--text-dim);
  font-weight: 500;
  white-space: nowrap;
  max-width: min(42vw, 180px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.sticky-roi-sub {
  grid-column: 1;
  grid-row: 2;
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.35;
  min-width: 0;
}

@media (max-width: 520px) {
  .sticky-roi-inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .sticky-roi-brand {
    grid-row: 1;
  }
  .sticky-roi-main {
    grid-column: 1;
    grid-row: 2;
    justify-content: flex-start;
  }
  .sticky-roi-sub {
    grid-column: 1;
    grid-row: 3;
  }
}

/* ─── Hero ─── */
.hero {
  text-align: center;
  padding: clamp(32px, 6vw, 64px) 0 clamp(24px, 4vw, 40px);
}

.hero-title {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.hero-sub {
  color: var(--text-dim);
  font-size: clamp(14px, 2vw, 18px);
  margin-top: 4px;
}

/* ─── Result Card ─── */
.result-card {
  position: relative;
  margin-top: clamp(20px, 3vw, 32px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 4vw, 36px);
  box-shadow: var(--shadow-2), var(--shadow-glow-solar);
}

.result-card-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 12px;
}

/* Share menu (same behaviour as Plug or Pump — local tokens) */
.share-dropdown {
  position: relative;
}
.share-dropdown > summary.share-btn {
  list-style: none;
  cursor: pointer;
}
.share-dropdown > summary.share-btn::-webkit-details-marker {
  display: none;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  transition: color 180ms var(--ease-out), border-color 180ms var(--ease-out), background 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.share-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.08);
  transform: translateY(-1px);
}
.share-btn:active { transform: translateY(0); }
.share-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.share-btn.copied { color: var(--ev); border-color: var(--ev); background: rgba(52, 211, 153, 0.1); }

.share-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 220px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow-2);
}
@media (max-width: 600px) {
  .share-menu {
    left: 0;
    right: auto;
    min-width: 0;
    width: min(320px, calc(100vw - 48px));
    max-width: calc(100vw - 48px);
  }
}

.share-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  transition: background 120ms var(--ease-out);
}
.share-menu-item:hover {
  background: rgba(245, 158, 11, 0.08);
}
.share-menu-item:active {
  background: rgba(56, 189, 248, 0.12);
}

.share-menu-divider {
  height: 1px;
  margin: 8px 4px;
  background: var(--border);
  border: none;
}

.share-menu-hint {
  margin: 4px 8px 10px;
  padding: 0;
  font-size: 11px;
  line-height: 1.45;
  font-weight: 400;
  color: var(--text-dim);
}

.share-menu-item.share-menu-social {
  font-size: 12px;
}

.result-main {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
}

.result-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(48px, 10vw, 80px);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  transition: color 0.3s var(--ease-out);
}

.result-number.flash {
  animation: flash 0.4s var(--ease-out);
}

@keyframes flash {
  0% { transform: scale(1.06); filter: brightness(1.3); }
  100% { transform: scale(1); filter: brightness(1); }
}

.result-unit {
  font-size: clamp(16px, 2.5vw, 22px);
  color: var(--text-dim);
  font-weight: 500;
}

.result-subtitle {
  color: var(--text-dim);
  font-size: 14px;
  margin-top: 8px;
  text-align: center;
}

/* ─── Breakdown Bars ─── */
.breakdown-bars {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 60px 1fr 70px;
  align-items: center;
  gap: 10px;
}

.bar-label {
  font-size: 13px;
  color: var(--text-dim);
  text-align: right;
}

.bar-track {
  height: 24px;
  background: var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.6s var(--ease-out);
  min-width: 2px;
}

.bar-solar { background: var(--solar); }
.bar-battery { background: var(--battery); }
.bar-ev { background: var(--ev); }

.bar-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text);
}

/* ─── Savings Grid ─── */
.savings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.savings-cell {
  text-align: center;
}

.savings-amount {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 600;
}

.savings-cell:nth-child(1) .savings-amount { color: var(--solar); }
.savings-cell:nth-child(2) .savings-amount { color: var(--battery); }
.savings-cell:nth-child(3) .savings-amount { color: var(--ev); }

.savings-label {
  font-size: 12px;
  color: var(--text-dim);
}

/* ─── Panel ─── */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 4vw, 32px);
  margin-top: 20px;
  box-shadow: var(--shadow-1);
}

.panel h2 {
  font-size: clamp(16px, 2.5vw, 20px);
  font-weight: 600;
  margin-bottom: 20px;
}

/* ─── Fields ─── */
.field {
  margin-bottom: 20px;
}

.field:last-child {
  margin-bottom: 0;
}

.field > label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

.field-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.supply-field-lead {
  margin-bottom: 10px;
  margin-top: 0;
}

/* ─── Inline Input ─── */
.inline-input {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
}

.inline-input input[type="number"] {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  width: 100%;
  transition: border-color 0.2s;
}

.inline-input input:focus {
  outline: none;
  border-color: var(--accent);
}

.input-unit, .input-prefix {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
}

.input-prefix {
  font-family: 'JetBrains Mono', monospace;
}

/* ─── Select ─── */
select {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  width: 100%;
  max-width: 300px;
  cursor: pointer;
  transition: border-color 0.2s;
}

select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ─── Presets ─── */
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.preset {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  white-space: nowrap;
}

.preset:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.preset.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 600;
}

/* ─── Toggle ─── */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 500;
}

.toggle-label input[type="checkbox"] {
  appearance: none;
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-label input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 0.2s var(--ease-out);
}

.toggle-label input[type="checkbox"]:checked {
  background: var(--accent);
}

.toggle-label input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}

/* ─── Slider ─── */
.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-row input[type="range"] {
  flex: 1;
  appearance: none;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(245,158,11,.3);
}

.slider-row input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.slider-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  min-width: 44px;
  text-align: right;
  color: var(--accent);
  font-weight: 500;
}

/* ─── Long-run + cost chart ─── */
.long-run-lead {
  margin-bottom: 12px;
}

.tariff-inflation-basis {
  margin-top: 12px;
  line-height: 1.55;
}

.field-inline-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 520px) {
  .field-inline-row {
    grid-template-columns: 1fr;
  }
}

.field-compact .inline-input {
  max-width: 160px;
}

.chart-hint {
  margin-bottom: 14px;
}

.cost-chart-scenario-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  max-width: 640px;
  margin: 0 auto 12px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

@media (prefers-color-scheme: light) {
  .cost-chart-scenario-bar {
    background: rgba(0, 0, 0, 0.03);
  }
}

.cost-chart-scenario-bar-label {
  font-weight: 600;
  color: var(--text);
  margin-right: 4px;
}

.cost-chart-scenario-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.cost-chart-scenario-opt input {
  accent-color: var(--accent);
}

.cost-model-chart {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.cost-model-chart-svg-wrap {
  position: relative;
}

.cost-chart-axis-unit {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-dim);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.cost-chart-tooltip {
  pointer-events: none;
  min-width: 200px;
  max-width: min(320px, 94vw);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.cost-tip-title {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
}

.cost-tip-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 4px;
}

/* Tooltip rows: colour matches SVG line stroke (label + value). */
.cost-chart-tooltip .cost-tip-line-ben span {
  color: var(--accent);
}

.cost-chart-tooltip .cost-tip-line-grid span {
  color: var(--text-dim);
}

.cost-chart-tooltip .cost-tip-line-grid-with span {
  color: var(--battery);
}

.cost-chart-tooltip .cost-tip-line-scen-a span {
  color: #a78bfa;
}

.cost-chart-tooltip .cost-tip-line-scen-b span {
  color: #2dd4bf;
}

.cost-chart-tooltip .cost-tip-line-scen-c span {
  color: #fb923c;
}

.cost-chart-tooltip .cost-tip-line-scen-d span {
  color: #38bdf8;
}

.cost-chart-tooltip .cost-tip-line-meta span {
  color: var(--text-dim);
}

.cost-chart-tooltip .cost-tip-line-net-pos span,
.cost-chart-tooltip .cost-tip-line-net-neg span {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cost-chart-tooltip .cost-tip-line-net-pos span {
  color: var(--positive);
}

.cost-chart-tooltip .cost-tip-line-net-neg span {
  color: var(--negative);
}

.chart-hover-hint {
  margin-top: 10px;
  margin-bottom: 0;
  font-size: 12px;
  text-align: center;
  color: var(--text-dim);
}

.cost-model-svg {
  width: 100%;
  height: auto;
  display: block;
}

.cost-model-svg .chart-plot-bg {
  fill: var(--border);
}

.cost-model-svg .line-ben {
  stroke: var(--accent);
}

.cost-model-svg .line-grid {
  stroke: var(--text-dim);
}

.cost-model-svg .line-grid-with-solar {
  stroke: var(--battery);
}

.cost-model-svg .line-grid-scen {
  stroke-width: 1.1;
  stroke-dasharray: 5 4;
  opacity: 0.75;
  pointer-events: none;
}

.cost-model-svg .line-grid-scen-a {
  stroke: #a78bfa;
}

.cost-model-svg .line-grid-scen-b {
  stroke: #2dd4bf;
}

.cost-model-svg .line-grid-scen-c {
  stroke: #fb923c;
}

.cost-model-svg .line-grid-scen-d {
  stroke: #38bdf8;
}

.cost-chart-legend-scenarios {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.legend-scenarios-title {
  display: block;
  width: 100%;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.legend-scen .legend-swatch {
  height: 2px;
  border-radius: 0;
}

.legend-scen-a .legend-swatch {
  background: repeating-linear-gradient(
    90deg,
    #a78bfa 0 4px,
    transparent 4px 8px
  );
}

.legend-scen-b .legend-swatch {
  background: repeating-linear-gradient(
    90deg,
    #2dd4bf 0 4px,
    transparent 4px 8px
  );
}

.legend-scen-c .legend-swatch {
  background: repeating-linear-gradient(
    90deg,
    #fb923c 0 4px,
    transparent 4px 8px
  );
}

.legend-scen-d .legend-swatch {
  background: repeating-linear-gradient(
    90deg,
    #38bdf8 0 4px,
    transparent 4px 8px
  );
}

.cost-model-svg .line-cost {
  stroke: var(--text-dim);
}

.cost-model-svg .chart-grid-line {
  stroke: var(--border);
  stroke-width: 1;
  opacity: 0.65;
}

.cost-model-svg .chart-crosshair {
  stroke: var(--text-dim);
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.cost-model-svg .chart-payback-line {
  stroke: var(--positive);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  opacity: 0.92;
  pointer-events: none;
}

.cost-model-svg .chart-payback-label {
  fill: var(--positive);
  font-size: 4.25px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  pointer-events: none;
}

.cost-model-svg .chart-dot-ben {
  fill: var(--accent);
  stroke: var(--panel);
  stroke-width: 1;
}

.cost-model-svg .chart-dot-grid {
  fill: var(--text-dim);
  stroke: var(--panel);
  stroke-width: 1;
}

.cost-model-svg .chart-dot-grid-with {
  fill: var(--battery);
  stroke: var(--panel);
  stroke-width: 1;
}

.cost-tip-section-label {
  display: block;
  margin-top: 10px;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.cost-tip-section-label:first-of-type {
  margin-top: 4px;
}

.cost-tip-micro {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-dim);
}

.cost-tip-micro-b {
  margin-top: 6px;
  margin-bottom: 2px;
}

.cost-tip-annual span:last-child {
  font-variant-numeric: tabular-nums;
}

.cost-chart-tooltip .cost-tip-line-ben.cost-tip-annual span,
.cost-chart-tooltip .cost-tip-line-grid.cost-tip-annual span,
.cost-chart-tooltip .cost-tip-line-grid-with.cost-tip-annual span {
  font-variant-numeric: tabular-nums;
}

.cost-chart-axis {
  fill: var(--text-dim);
  font-size: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.cost-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-dim);
  justify-content: center;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-swatch {
  width: 18px;
  height: 3px;
  border-radius: 1px;
  flex-shrink: 0;
}

.legend-ben .legend-swatch {
  background: var(--accent);
}

.legend-cost .legend-swatch {
  background: repeating-linear-gradient(
    90deg,
    var(--text-dim) 0 3px,
    transparent 3px 5px
  );
  height: 2px;
}

.legend-grid .legend-swatch {
  background: var(--text-dim);
  opacity: 0.85;
}

.legend-grid-with .legend-swatch {
  background: var(--battery);
}

/* ─── Cumulative Timeline (legacy bars removed) ─── */
.timeline-chart {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.timeline-bar {
  display: grid;
  grid-template-columns: 36px 1fr 80px;
  align-items: center;
  gap: 8px;
  height: 22px;
}

.timeline-year {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
}

.timeline-track {
  height: 16px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.timeline-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s var(--ease-out), background-color 0.3s;
  position: absolute;
}

.timeline-fill.negative { background: var(--negative); left: auto; right: 50%; }
.timeline-fill.positive { background: var(--positive); left: 50%; }

.timeline-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
}

.timeline-payback-marker {
  font-size: 12px;
  color: var(--positive);
  font-weight: 600;
  text-align: center;
  margin-top: 4px;
}

.timeline-note {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
}

/* ─── Scenario Table ─── */
.scenario-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.scenario-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.scenario-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.scenario-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.scenario-table tbody tr:last-child td {
  border-bottom: none;
}

.scenario-table td:first-child {
  font-weight: 500;
}

.scenario-table .featured {
  background: rgba(245, 158, 11, 0.06);
}

.scenario-table .featured td:first-child::before {
  content: '\25B6 ';
  color: var(--accent);
  font-size: 10px;
}

/* ─── Methodology ─── */
.methodology details {
  border-bottom: 1px solid var(--border);
  padding: 0 0 4px;
}

.methodology details:last-child {
  border-bottom: none;
}

.methodology summary {
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  padding: 12px 0;
  color: var(--text);
  list-style: none;
}

.methodology summary::before {
  content: '\25B6';
  display: inline-block;
  margin-right: 8px;
  font-size: 10px;
  color: var(--text-dim);
  transition: transform 0.2s;
}

.methodology details[open] summary::before {
  transform: rotate(90deg);
}

.methodology p, .methodology ul {
  font-size: 13px;
  color: var(--text-dim);
  margin: 4px 0 12px;
  line-height: 1.5;
}

.methodology ul {
  padding-left: 20px;
}

.methodology li {
  margin-bottom: 4px;
}

.methodology code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.src-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0 16px;
}

.src-table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-dim);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.src-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}

.src-table tbody tr:last-child td {
  border-bottom: none;
}

/* ─── Announcement banner (Plug or Pump) ─── */
.announcement-banner {
  margin: 0 0 20px;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent) 14%, var(--panel)) 0%,
    color-mix(in srgb, var(--battery) 10%, var(--panel)) 100%
  );
  box-shadow: var(--shadow-1);
}

.announcement-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
}

.announcement-text {
  flex: 1;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  min-width: 0;
}

.announcement-text a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.announcement-text a:hover {
  text-decoration: underline;
}

.announcement-dismiss {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out);
}

.announcement-dismiss:hover {
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text);
}

.announcement-banner[hidden] {
  display: none;
}

/* ─── Footer ─── */
footer {
  text-align: center;
  padding: 32px 0;
  font-size: 13px;
  color: var(--text-dim);
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .bar-row {
    grid-template-columns: 50px 1fr 60px;
  }

  .scenario-table {
    font-size: 13px;
  }

  .scenario-table th, .scenario-table td {
    padding: 8px 8px;
  }

  .presets {
    gap: 6px;
  }

  .preset {
    padding: 5px 10px;
    font-size: 12px;
  }

  .savings-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* ─── Utility ─── */
[hidden] { display: none !important; }

/* Smooth appearance for toggled sections */
#batteryOptions, #evOptions {
  animation: fadeIn 0.25s var(--ease-out);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
