:root {
  --bg: #071720;
  --bg-soft: #0b202b;
  --card: rgba(14, 37, 48, .88);
  --card-light: #112d3a;
  --line: rgba(194, 225, 232, .14);
  --text: #f5f8f3;
  --muted: #9bb1b7;
  --solar: #ffc857;
  --solar-2: #ff9f43;
  --aqua: #62d6ca;
  --panel: #4e9fc8;
  --danger: #ef7968;
  --shadow: rgba(239, 121, 104, .24);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 78% -10%, rgba(255, 187, 70, .14), transparent 30rem),
    linear-gradient(180deg, #071720 0%, #0a1b24 55%, #06151d 100%);
  min-height: 100vh;
}
button, input { font: inherit; }
button { color: inherit; }
.sun-glow { position: fixed; inset: -16rem -14rem auto auto; width: 34rem; height: 34rem; border-radius: 50%; background: rgba(255, 194, 80, .05); filter: blur(18px); pointer-events: none; }

.site-header, main, footer { width: min(1440px, calc(100% - 48px)); margin-inline: auto; }
.site-header { height: 88px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: .94rem; letter-spacing: .01em; }
.brand small { color: var(--muted); margin-top: 2px; font-size: .73rem; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(255, 200, 87, .38); border-radius: 12px; background: rgba(255, 200, 87, .08); }
.brand-mark::before { content: ""; width: 14px; height: 14px; border: 2px solid var(--solar); border-radius: 50%; box-shadow: 0 0 18px rgba(255, 200, 87, .45); }
.status { color: var(--muted); font-size: .78rem; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.025); }
.status i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--aqua); box-shadow: 0 0 10px var(--aqua); }

.hero { display: grid; grid-template-columns: 1.25fr .75fr; gap: 50px; align-items: end; padding: 58px 0 38px; }
.eyebrow { margin: 0 0 10px; color: var(--solar); font-size: .72rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 820px; margin-bottom: 0; font-size: clamp(2.2rem, 4.4vw, 4.65rem); letter-spacing: -.055em; line-height: .98; font-weight: 680; }
h2 { margin-bottom: 4px; font-size: 1.1rem; letter-spacing: -.02em; }
.lede { max-width: 520px; margin-bottom: 4px; color: var(--muted); font-size: 1rem; line-height: 1.65; }

.card { background: linear-gradient(145deg, rgba(17, 45, 58, .94), rgba(10, 30, 40, .94)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 24px 80px rgba(0,0,0,.14); }
.workspace { display: grid; grid-template-columns: minmax(290px, 360px) 1fr; gap: 18px; align-items: start; }
.controls { padding: 22px; position: sticky; top: 16px; }
.card-heading { display: flex; gap: 11px; align-items: center; }
.card-heading p { margin: 0; color: var(--muted); font-size: .73rem; }
.step { display: grid; place-items: center; width: 31px; height: 31px; flex: 0 0 auto; border-radius: 10px; color: var(--solar); background: rgba(255, 200, 87, .09); font: 700 .66rem/1 monospace; border: 1px solid rgba(255, 200, 87, .18); }
.compact { margin-bottom: 18px; }
fieldset { margin: 21px 0 0; padding: 19px 0 0; border: 0; border-top: 1px solid var(--line); }
legend { padding: 0 8px 0 0; color: #dbe7e8; font-size: .78rem; font-weight: 700; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: rgba(0,0,0,.12); }
.segmented button { min-height: 36px; padding: 6px 8px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-size: .78rem; font-weight: 700; transition: .2s ease; }
.segmented button:hover { color: var(--text); background: rgba(255,255,255,.04); }
.segmented button.active { color: #102127; background: var(--solar); box-shadow: 0 4px 16px rgba(255, 200, 87, .18); }
.tilt-presets { grid-template-columns: repeat(4, 1fr); }
.range-line { display: grid; grid-template-columns: 1fr 48px; gap: 12px; align-items: center; margin-top: 13px; }
output { color: var(--text); font-size: .76rem; font-variant-numeric: tabular-nums; text-align: right; }
input[type="range"] { width: 100%; height: 4px; accent-color: var(--solar); cursor: pointer; }
.control-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 15px 0 9px; }
.control-row:first-of-type { margin-top: 4px; }
.control-row span, .control-row b, .control-row small { display: block; }
.control-row b { font-size: .79rem; }
.control-row small { margin-top: 2px; color: var(--muted); font-size: .66rem; }
.gap-control + .gap-control { margin-top: 17px; padding-top: 13px; border-top: 1px solid rgba(125,151,160,.12); }
input[type="number"] { width: 78px; padding: 7px 8px; color: var(--text); text-align: right; font-size: .78rem; font-variant-numeric: tabular-nums; border: 1px solid var(--line); border-radius: 9px; background: rgba(0,0,0,.15); outline: none; }
input[type="number"]:focus { border-color: var(--solar); box-shadow: 0 0 0 3px rgba(255, 200, 87, .08); }
.coordinate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.coordinate-grid label { display: grid; gap: 7px; color: var(--muted); font-size: .7rem; }
.coordinate-grid input[type="number"] { width: 100%; min-height: 38px; text-align: left; }
.panel-dimensions { margin-top: 10px; }
.sublegend { display: block; margin: 13px 0 8px; color: #dbe7e8; font-size: .7rem; font-weight: 700; }
.orientation-tabs { grid-template-columns: repeat(2, 1fr); }
.row-count-tabs { grid-template-columns: repeat(2, 1fr); }
.field-help { margin: 9px 0 10px; color: var(--muted); font-size: .64rem; line-height: 1.45; }
.location-button { width: 100%; min-height: 36px; border: 1px solid rgba(98, 214, 202, .25); border-radius: 10px; color: var(--aqua); background: rgba(98, 214, 202, .07); cursor: pointer; font-size: .72rem; font-weight: 700; }
.location-button:hover { background: rgba(98, 214, 202, .12); }
.location-button:focus-visible { outline: 2px solid var(--aqua); outline-offset: 2px; }
.location-message { min-height: 1.1em; margin: 7px 0 0; color: var(--solar); font-size: .64rem; line-height: 1.4; }
.scene-controls { margin-top: 22px; }
.season-tabs button { font-size: .68rem; padding-inline: 4px; }
.weather-label { margin-top: 17px; }
.weather-tabs { grid-template-columns: repeat(2, 1fr); }
.weather-tabs button { font-size: .66rem; line-height: 1.2; }
.time-label { display: flex; justify-content: space-between; margin: 14px 0 7px; color: var(--muted); font-size: .71rem; }
.time-label output { color: var(--solar); }
.diagram-time-control { margin: 16px 0 10px; padding: 10px 14px; border: 1px solid rgba(255,200,87,.18); border-radius: 12px; background: rgba(255,200,87,.035); }
.diagram-time-control .time-label { margin: 0 0 7px; }
.diagram-time-control input { width: 100%; }

.visual-column { display: grid; gap: 18px; min-width: 0; }
.diagram-card { min-height: 555px; padding: 22px; overflow: hidden; }
.diagram-header { display: flex; justify-content: space-between; align-items: center; }
.legend { display: flex; gap: 15px; color: var(--muted); font-size: .68rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; }
.panel-dot { background: var(--panel); }
.shade-dot { background: var(--danger); opacity: .8; }
.diagram { width: 100%; margin-top: 12px; overflow: hidden; border-radius: 16px; background: linear-gradient(180deg, rgba(87, 137, 156, .09), rgba(9, 24, 32, .02)); }
.diagram svg { display: block; width: 100%; height: auto; min-height: 370px; }
.instant-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.instant { padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.025); }
.instant span, .instant b { display: block; }
.instant span { color: var(--muted); font-size: .64rem; }
.instant b { margin-top: 4px; font-size: .9rem; font-variant-numeric: tabular-nums; }

.results, .daily-results { padding: 22px; }
.production-subsection { margin-top: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.022); }
.results > .production-subsection:first-of-type { margin-top: 18px; }
.production-subsection .card-heading { margin-bottom: 14px; }
.metric-grid { display: grid; grid-template-columns: 1.35fr repeat(3, 1fr); gap: 9px; }
.metric { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.025); }
.metric.primary { background: linear-gradient(145deg, rgba(255, 200, 87, .13), rgba(255, 159, 67, .035)); border-color: rgba(255, 200, 87, .2); }
.metric span, .metric strong, .metric small { display: block; }
.metric span { color: var(--muted); font-size: .65rem; }
.metric strong { margin: 7px 0 5px; font-size: clamp(1.25rem, 2.3vw, 1.85rem); letter-spacing: -.045em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric.primary strong { color: var(--solar); }
.metric small { color: #829aa1; font-size: .58rem; line-height: 1.35; }
.monthly-wrap { margin-top: 17px; }
.monthly-heading { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: .65rem; }
.monthly-bars { height: 78px; display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; align-items: end; padding-top: 17px; }
.month-bar { position: relative; height: 100%; display: flex; align-items: end; border-radius: 5px 5px 2px 2px; background: rgba(255,255,255,.035); }
.month-bar i { display: block; width: 100%; min-height: 2px; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, var(--solar), var(--solar-2)); opacity: .82; }
.month-bar span { position: absolute; inset: auto 0 2px; text-align: center; color: rgba(7,23,32,.86); font-size: .48rem; font-weight: 800; mix-blend-mode: multiply; }
.month-bar > b { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); color: #a9bdc2; font-size: .46rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.daily-profile-wrap { margin-top: 18px; }
.daily-profile-heading { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 10px; color: var(--muted); font-size: .65rem; }
.daily-profile-heading span:last-child { color: var(--aqua); font-variant-numeric: tabular-nums; text-align: right; }
.hourly-chart { display: grid; grid-template-columns: 44px 1fr; gap: 9px; min-width: 0; }
.hourly-scale { display: flex; flex-direction: column; justify-content: space-between; padding: 1px 0 15px; color: #718b92; font-size: .5rem; }
.hourly-scale span:first-child { writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: .05em; }
.hourly-bars { height: 118px; display: grid; grid-template-columns: repeat(24, minmax(3px, 1fr)); gap: 3px; align-items: end; padding-top: 8px; border-bottom: 1px solid rgba(194,225,232,.2); background: repeating-linear-gradient(to bottom, rgba(194,225,232,.07) 0 1px, transparent 1px 33.33%); }
.hour-bar { position: relative; height: 100%; display: flex; align-items: end; border-radius: 4px 4px 0 0; }
.hour-bar i { display: block; width: 100%; min-height: 0; border-radius: 4px 4px 1px 1px; background: linear-gradient(180deg, var(--solar), var(--solar-2)); opacity: .84; transition: height .18s ease, opacity .18s ease; }
.hour-bar.current i { outline: 2px solid var(--aqua); outline-offset: 1px; opacity: 1; }
.hour-bar span { position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%); color: #718b92; font-size: .48rem; font-variant-numeric: tabular-nums; }
.hourly-note { margin: 21px 0 0 53px; color: #718b92; font-size: .58rem; line-height: 1.45; }

.comparison { margin-top: 18px; padding: 22px; }
.comparison-header { display: flex; justify-content: space-between; align-items: center; gap: 30px; }
.comparison h3 { margin: 0; font-size: clamp(1rem, 2vw, 1.35rem); letter-spacing: -.025em; }
.plan-view { position: relative; min-width: 260px; padding: 18px 16px 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(0,0,0,.09); }
.panel-plan { display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(2, 16px); gap: 3px; }
.panel-plan i { border: 1px solid rgba(98, 214, 202, .33); border-radius: 2px; background: linear-gradient(135deg, #2d6f91, #173e5b); }
.panel-plan i.empty { visibility: hidden; }
.panel-plan.portrait i:not(.empty) { background: linear-gradient(45deg, #173e5b, #2d6f91); box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }
.north, .south { position: absolute; color: var(--muted); font: 700 .52rem/1 monospace; letter-spacing: .08em; }
.north { top: 5px; right: 14px; }
.south { bottom: 4px; left: 16px; color: var(--solar); }
.table-wrap { overflow-x: auto; margin-top: 24px; }
table { width: 100%; border-collapse: collapse; min-width: 1080px; }
th, td { padding: 16px 14px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-size: .65rem; line-height: 1.35; font-weight: 650; }
td { font-size: .83rem; }
td:first-child b { display: inline-grid; place-items: center; width: 48px; height: 32px; border: 1px solid var(--line); border-radius: 10px; }
td:first-child small { display: block; margin-top: 5px; color: var(--muted); font-size: .56rem; }
tr.selected td { background: rgba(255, 200, 87, .045); }
tr.selected td:first-child b { color: #102127; background: var(--solar); border-color: var(--solar); }
.good { color: var(--aqua); }
.warn { color: var(--solar); }
.table-note { margin: 12px 0 0; color: var(--muted); font-size: .66rem; line-height: 1.5; }
details { margin-top: 21px; padding-top: 19px; border-top: 1px solid var(--line); }
summary { color: #dce9e9; cursor: pointer; font-size: .77rem; font-weight: 700; }
.assumptions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px 24px; padding-top: 17px; }
.assumptions p { margin-bottom: 10px; color: var(--muted); font-size: .7rem; line-height: 1.6; }
.assumptions b { color: #dbe7e8; }
.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; }
.backup-section, .consumption-section, .balance-section { margin-top: 24px; padding: 24px; }
.backup-section h2, .consumption-section h2, .balance-section h2 { font-size: clamp(1.35rem, 2.5vw, 2rem); }
.subsection-title { margin: 20px 0 12px; font-size: 1rem; }
.backup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.backup-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.025); }
.backup-card:has(input[type="checkbox"]:checked) { border-color: rgba(255,200,87,.4); background: rgba(255,200,87,.055); }
.backup-switch { display: flex; align-items: center; gap: 9px; }
.backup-switch input { width: 19px; height: 19px; margin: 0; accent-color: var(--solar); }
.backup-card small { color: var(--muted); font-size: .64rem; line-height: 1.45; }
.backup-inputs { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.backup-inputs.single { grid-template-columns: minmax(0, 1fr); }
.backup-inputs > span > em { display: block; margin-bottom: 5px; color: var(--muted); font-size: .58rem; font-style: normal; }
.backup-inputs > span > span { display: flex; align-items: center; gap: 6px; }
.backup-inputs input { width: 100%; min-width: 0; min-height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: rgba(0,0,0,.14); font: inherit; }
.backup-inputs input:disabled { opacity: .45; }
.backup-inputs i { color: var(--muted); font-size: .59rem; font-style: normal; white-space: nowrap; }
.backup-card > strong { margin-top: auto; color: var(--solar); font-size: .82rem; }
.consumption-layout { margin-top: 18px; }
.appliance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; }
.appliance { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.025); cursor: pointer; }
.appliance:has(> input:checked) { border-color: rgba(98, 214, 202, .36); background: rgba(98, 214, 202, .07); }
.appliance > input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--aqua); flex: 0 0 auto; }
.appliance span { min-width: 0; }
.appliance b, .appliance small { display: block; }
.appliance b { color: #dce9e9; font-size: .74rem; }
.appliance small { margin-top: 3px; color: var(--muted); font-size: .59rem; line-height: 1.35; }
.adjustable-appliance { grid-column: 1 / -1; }
.appliance-input { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.appliance-input input, .ac-inputs input { width: 76px; min-height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: rgba(0,0,0,.14); font: inherit; }
.appliance-input input:disabled, .ac-inputs input:disabled { opacity: .45; }
.appliance-input em, .ac-inputs em, .ac-inputs small { color: var(--muted); font-size: .59rem; font-style: normal; white-space: nowrap; }
.ac-inputs { display: flex; gap: 12px; margin-left: auto; }
.ac-mode { display: grid; grid-template-columns: auto 62px auto; gap: 5px; align-items: center; }
.ac-inputs input { width: 62px; }
.variable-inputs { display: flex; gap: 12px; margin-left: auto; }
.variable-inputs > span { display: grid; grid-template-columns: auto 70px auto; gap: 5px; align-items: center; }
.variable-inputs em, .variable-inputs small { color: var(--muted); font-size: .59rem; font-style: normal; white-space: nowrap; }
.variable-inputs input { width: 70px; min-height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: rgba(0,0,0,.14); font: inherit; }
.variable-inputs input:disabled { opacity: .45; }
.period-picker { display: flex; flex-wrap: wrap; gap: 5px; width: 100%; margin: 5px 0 0 29px; }
.period-picker button { display: block; padding: 5px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: transparent; font: inherit; font-size: .52rem; cursor: pointer; }
.period-picker button.active { border-color: rgba(98,214,202,.5); color: #c8f5ef; background: rgba(98,214,202,.12); }
.period-picker.disabled { opacity: .35; pointer-events: none; }
.generator-mode { display: flex; align-items: center; gap: 8px; padding-top: 4px; border-top: 1px solid var(--line); }
.generator-mode > input { width: 18px; height: 18px; accent-color: var(--solar); }
.generator-mode > span { display: block; }
.generator-mode > span b { display: block; margin-bottom: 3px; }
.generator-thresholds:has(input:disabled) { opacity: .45; }
.generator-periods { margin-left: 0; }
.manual-generator-label { display: block; margin-top: 2px; }
.manual-generator-label.disabled { opacity: .35; }
.battery-automation { display: none; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.battery-card:has(#battery-enabled:checked) .battery-automation { display: grid; gap: 10px; }
.period-balance { margin-top: 18px; overflow-x: auto; }
.period-title { margin: 0 0 10px; color: var(--muted); font-size: .64rem; font-weight: 700; }
.period-grid { display: grid; grid-template-columns: 108px repeat(5, minmax(58px, 1fr)); gap: 5px; min-width: 470px; margin-top: 5px; }
.period-grid > b, .period-grid > span { min-width: 0; padding: 6px; font-size: .52rem; }
.period-grid > b { color: #dce9e9; }
.period-grid > span { position: relative; overflow: hidden; border-radius: 5px; background: rgba(255,255,255,.045); text-align: right; }
.period-grid em { position: relative; z-index: 1; font-style: normal; font-variant-numeric: tabular-nums; }
.period-fill { position: absolute; inset: 0 auto 0 0; opacity: .35; }
.period-fill.solar { background: var(--solar); }
.period-fill.generator { background: #ffc857; }
.period-fill.consumption { background: var(--aqua); }
.period-fill.batteryUsed { background: #9b8cff; }
.period-fill.deficit { background: #ff8d7f; }
.period-head { margin-bottom: 7px; color: var(--muted); }
.period-head > span { background: none; text-align: right; }
.balance-panel { padding: 16px; border: 1px solid rgba(98, 214, 202, .2); border-radius: 16px; background: rgba(0,0,0,.1); }
.balance-section .balance-panel { margin-top: 18px; }
.ev-surplus-option { display: flex; flex-basis: 100%; gap: 8px; align-items: flex-start; margin: 7px 0 0 29px; padding: 9px 10px; border-radius: 10px; background: rgba(255,200,87,.055); }
.ev-surplus-option input { margin-top: 3px; }
.ev-surplus-option b, .ev-surplus-option small { display: block; }
.ev-surplus-option b { font-size: .64rem; }
.ev-surplus-option small { margin-top: 2px; color: var(--muted); font-size: .56rem; line-height: 1.35; }
.balance-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.balance-metrics > div { min-width: 0; padding: 11px; border-radius: 11px; background: rgba(255,255,255,.035); }
.balance-metrics span, .balance-metrics strong { display: block; }
.balance-metrics span { color: var(--muted); font-size: .56rem; }
.balance-metrics strong { margin-top: 6px; font-size: .98rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.balance-metrics .surplus strong { color: var(--aqua); }
.balance-metrics .deficit strong { color: #ff8d7f; }
.balance-chart { position: relative; margin-top: 20px; }
.balance-chart > p { margin: 0 0 12px; color: var(--muted); font-size: .64rem; font-weight: 700; }
.balance-row { display: grid; grid-template-columns: 92px 1fr 118px; gap: 8px; align-items: center; margin-top: 10px; }
.balance-row > span, .balance-row > b { font-size: .59rem; }
.balance-row > span { color: var(--muted); }
.balance-row > b { text-align: right; font-variant-numeric: tabular-nums; }
.balance-row > div { height: 18px; overflow: hidden; border-radius: 5px; background: rgba(255,255,255,.05); }
.balance-row i { display: block; height: 100%; border-radius: inherit; transition: width .2s ease; }
#production-bar { background: linear-gradient(90deg, var(--solar-2), var(--solar)); }
#generator-bar { background: #ffc857; }
#battery-bar { background: #9b8cff; }
#consumption-bar { background: linear-gradient(90deg, #388b91, var(--aqua)); }
#unused-bar { background: linear-gradient(90deg, #9b6b26, var(--solar)); }
#battery-spent-bar { background: linear-gradient(90deg, #6657c8, #9b8cff); }
#unmet-bar { background: linear-gradient(90deg, #b94f49, #ff8d7f); }
.unused-row, .battery-spent-row, .unmet-row { margin-top: 7px; }
.global-balance-row { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.global-balance-row > div { position: relative; overflow: visible; background: linear-gradient(90deg, rgba(255,141,127,.07) 0 50%, rgba(98,214,202,.07) 50% 100%); }
.global-balance-row > div::after { position: absolute; top: -3px; bottom: -3px; left: 50%; width: 1px; content: ''; background: rgba(220,233,233,.55); }
#global-balance-bar { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, #279e8e, var(--aqua)); }
.global-balance-row.negative #global-balance-bar { background: linear-gradient(90deg, #b94f49, #ff8d7f); }
.global-balance-row > b { color: var(--aqua); }
.global-balance-row.negative > b { color: #ff8d7f; }
.balance-note { margin: 18px 0 0; color: #718b92; font-size: .57rem; line-height: 1.45; }
.deficit-analysis { margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }
.deficit-analysis h3 { margin: 0 0 12px; font-size: .76rem; }
.cause-row { display: grid; grid-template-columns: minmax(110px, 1fr) 1.2fr 72px; gap: 8px; align-items: center; margin-top: 8px; }
.cause-row span, .cause-row b { font-size: .57rem; }
.cause-row b { text-align: right; font-variant-numeric: tabular-nums; }
.cause-row > div { height: 12px; overflow: hidden; border-radius: 4px; background: rgba(255,255,255,.05); }
.cause-row i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6657c8, #ff8d7f); }
.empty-analysis, .recommendations { color: var(--muted); font-size: .59rem; line-height: 1.5; }
.recommendations { margin-top: 14px; padding: 12px; border-radius: 10px; background: rgba(98,214,202,.055); }
.recommendations h4 { margin: 0 0 7px; color: #c8f5ef; font-size: .62rem; }
.recommendations ul { margin: 0; padding-left: 17px; }
.recommendations li + li { margin-top: 5px; }
.report-actions { display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; align-items: center; margin-top: 22px; padding: 20px; border: 1px solid rgba(98, 214, 202, .2); border-radius: 16px; background: linear-gradient(135deg, rgba(98, 214, 202, .075), rgba(255, 200, 87, .035)); }
.report-actions h3 { margin: 0 0 5px; font-size: .92rem; }
.report-actions p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.report-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.report-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 0 17px; border: 1px solid rgba(98, 214, 202, .4); border-radius: 12px; color: #071720; background: var(--aqua); cursor: pointer; font-size: .76rem; font-weight: 800; box-shadow: 0 8px 24px rgba(98, 214, 202, .12); }
.report-button.secondary { color: var(--aqua); background: rgba(98, 214, 202, .07); box-shadow: none; }
.report-button:hover { filter: brightness(1.07); transform: translateY(-1px); }
.report-button:focus-visible { outline: 2px solid var(--solar); outline-offset: 3px; }
.report-button:disabled { cursor: wait; opacity: .65; transform: none; }
.report-button span { font-size: 1rem; line-height: 1; }
.report-message { grid-column: 1 / -1; min-height: 1em; color: var(--aqua) !important; }
footer { display: flex; justify-content: space-between; padding: 30px 0 46px; color: #6f8991; font-size: .65rem; }

@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; gap: 22px; }
  .workspace { grid-template-columns: 1fr; }
  .controls { position: static; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 22px; }
  .controls .card-heading { grid-column: 1 / -1; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  .site-header, main, footer { width: min(100% - 24px, 1440px); }
  .site-header { height: 74px; }
  .status { display: none; }
  .hero { padding: 40px 0 28px; }
  h1 { font-size: 2.45rem; }
  .controls { display: block; padding: 18px; }
  .diagram-card, .results, .daily-results, .comparison { padding: 18px; }
  .diagram-header, .comparison-header { align-items: flex-start; flex-direction: column; }
  .legend { align-self: flex-end; margin-top: -30px; }
  .diagram svg { min-height: 300px; }
  .instant-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric.primary { grid-column: 1 / -1; }
  .daily-profile-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .hourly-chart { grid-template-columns: 34px 1fr; gap: 6px; }
  .hourly-bars { gap: 2px; }
  .hourly-note { margin-left: 40px; }
  .plan-view { width: 100%; }
  .assumptions { grid-template-columns: 1fr; }
  .consumption-layout { grid-template-columns: 1fr; }
  .backup-grid { grid-template-columns: 1fr; }
  .balance-metrics { grid-template-columns: repeat(2, 1fr); }
  .appliance-grid { grid-template-columns: 1fr; }
  .adjustable-appliance { grid-column: auto; align-items: flex-start; flex-wrap: wrap; }
  .appliance-input, .ac-inputs, .variable-inputs { width: 100%; margin: 4px 0 0 29px; }
  .ac-inputs, .variable-inputs { flex-direction: column; }
  .report-actions { grid-template-columns: 1fr; }
  .report-buttons { justify-content: stretch; }
  .report-button { width: 100%; margin-top: 8px; }
  footer { flex-direction: column; gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
  @page { size: A4 portrait; margin: 11mm; }
  :root { color-scheme: light; }
  * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  html, body { color: #14242b; background: #fff !important; }
  body { font-size: 10pt; }
  .sun-glow, .report-actions { display: none !important; }
  .site-header, main, footer { width: 100%; }
  .site-header { height: auto; padding-bottom: 8mm; border-color: #c9d4d8; }
  .brand-mark, .status, .card, .plan-view, .instant, .metric { box-shadow: none !important; }
  .status { color: #40545c; background: #fff; border-color: #c9d4d8; }
  .hero { grid-template-columns: 1fr; gap: 4mm; padding: 9mm 0 7mm; }
  h1 { max-width: none; color: #102a35; font-size: 27pt; line-height: 1.05; }
  .lede, .card-heading p, .table-note, .assumptions p, footer { color: #40545c; }
  .workspace { display: block; }
  .card { color: #14242b; background: #fff; border-color: #bfcdd2; }
  .controls { position: static; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 8mm; padding: 6mm; break-inside: avoid; }
  .controls .card-heading { grid-column: 1 / -1; }
  fieldset, details { border-color: #c9d4d8; }
  legend, summary, .assumptions b { color: #14242b; }
  .segmented { background: #fff; border-color: #c9d4d8; }
  .segmented button { color: #40545c; }
  .segmented button.active { color: #102127; background: #ffc857 !important; }
  input[type="number"] { color: #14242b; background: #fff; border-color: #bfcdd2; }
  .location-button { display: none; }
  .visual-column { margin-top: 7mm; }
  .diagram-card, .results, .daily-results, .comparison { padding: 6mm; break-inside: avoid; }
  .diagram-card { min-height: 0; }
  .diagram { background: #f4f8f9; }
  .diagram svg { min-height: 0; }
  .instant, .metric, .plan-view { background: #fff; border-color: #c9d4d8; }
  .instant span, .metric span, .metric small, th, .north { color: #40545c; }
  .metric.primary { background: #fff8e8; border-color: #e4c46f; }
  .monthly-bars { height: 18mm; }
  .comparison { margin-top: 7mm; }
  .comparison-header { align-items: flex-start; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; }
  th, td { padding: 3mm 2mm; border-color: #c9d4d8; font-size: 7.5pt; }
  th { font-size: 6.5pt; }
  tr.selected td { background: #fff8e8; }
  details { break-inside: avoid; }
  footer { padding: 8mm 0 0; border-top: 1px solid #c9d4d8; }
}
