:root {
  --ink: #1f2937;
  --muted: #94a3b8;
  --subtle: #f8fafc;
  --line: #e5e7eb;
  --paper: #f3f4f6;
  --panel: #ffffff;
  --solar: #f59e0b;
  --load: #6366f1;
  --grid: #ef4444;
  --export: #10b981;
  --amber-soft: #fff7ed;
  --amber-line: #facc15;
}

* { box-sizing: border-box; }

.app-shell *,
.help-guide *,
.project-toolbar *,
.workspace *,
.panel *,
.chart-panel * {
  min-width: 0;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  max-width: 100vw;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
}

.app-shell {
  max-width: 1368px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 18px 28px;
  overflow-x: hidden;
}

.home-landing {
  display: none;
  margin: 32px 0;
  padding: 34px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.07);
}

.home-copy {
  max-width: 760px;
}

.home-kicker {
  display: inline-flex;
  margin-bottom: 12px;
  color: #8a6100;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.home-copy h2 {
  margin: 0 0 12px;
  max-width: 680px;
  color: #111827;
  font-size: 38px;
  line-height: 1.05;
}

.home-copy p {
  margin: 0;
  max-width: 760px;
  color: #536179;
  font-size: 16px;
  line-height: 1.6;
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.home-choice {
  min-height: 132px;
  padding: 20px;
  color: #172033;
  text-decoration: none;
  background: #f8fafc;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.home-choice:hover,
.home-choice:focus-visible {
  border-color: #f7b500;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
  outline: none;
}

.home-choice strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
}

.home-choice span {
  display: block;
  color: #667085;
  line-height: 1.5;
}

.topbar {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.help-guide-button {
  justify-self: end;
  width: auto;
  min-height: 34px;
  padding: 7px 14px;
  color: #374151;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.help-guide-button:hover,
.help-guide-button:focus-visible {
  border-color: #f7b500;
  outline: none;
}

.help-guide {
  width: min(720px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.28);
}

.help-guide::backdrop {
  background: rgba(15, 23, 42, 0.38);
}

.help-guide-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.help-guide-head h2 {
  margin: 2px 0 0;
  font-size: 22px;
}

.help-guide-head button {
  width: auto;
  align-self: start;
  padding: 7px 12px;
}

.help-guide-body {
  display: grid;
  gap: 10px;
  padding: 18px 20px 20px;
}

.help-guide-body section {
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.help-guide-body h3 {
  margin: 0 0 5px;
  font-size: 14px;
}

.help-guide-body p {
  margin: 0;
  color: #667085;
  line-height: 1.45;
}

.setup-wizard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}

.wizard-legend {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
}

.wizard-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wizard-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.wizard-legend .legend-default {
  background: #e0f2fe;
  border-color: #7dd3fc;
}

.wizard-legend .legend-complete {
  background: #16a34a;
  border-color: #16a34a;
}

.wizard-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 72px;
  padding: 12px;
  background: #f1f5f9;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  cursor: pointer;
}

.wizard-step > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #64748b;
  background: #e2e8f0;
  font-weight: 850;
}

.wizard-step strong,
.wizard-step small {
  display: block;
}

.wizard-step strong {
  color: #334155;
  font-size: 13px;
}

.wizard-step small {
  margin-top: 3px;
  color: #7c8798;
  font-size: 11px;
  line-height: 1.3;
}

.wizard-step.ready {
  background: #eff6ff;
  border-color: #93c5fd;
}

.wizard-step.ready > span {
  color: #1d4ed8;
  background: #dbeafe;
}

.wizard-step.ready strong {
  color: #1e3a8a;
}

.wizard-step.complete {
  background: #ecfdf5;
  border-color: #86efac;
}

.wizard-step.complete > span {
  color: #ffffff;
  background: #16a34a;
}

.wizard-step.complete strong {
  color: #14532d;
}

.wizard-step.optional-active:not(.complete) {
  background: #f5f3ff;
  border-color: #c4b5fd;
}

.wizard-step:hover,
.wizard-step:focus-within {
  border-color: #f7b500;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #f7b500;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin: 0;
  font-size: 15px;
  line-height: 1.1;
  font-weight: 800;
}

#projectSubtitle {
  margin: 2px 0 0;
  color: #8a94a6;
  font-size: 13px;
}

.project-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(170px, 260px) auto minmax(140px, 0.7fr) auto;
  gap: 8px;
  align-items: center;
  margin: 10px 0 12px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.07);
}

.project-toolbar-title span {
  display: block;
  color: #111827;
  font-size: 13px;
  font-weight: 850;
}

.project-toolbar-title p,
.project-status {
  margin: 2px 0 0;
  color: #8a94a6;
  font-size: 11px;
  line-height: 1.25;
}

.project-toolbar-title .estimate-note {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 7px;
  color: #9a5b00;
  background: #fff7d6;
  border: 1px solid #f4d46a;
  border-radius: 999px;
  font-weight: 750;
}

.project-status.success {
  color: #15803d;
  font-weight: 800;
}

.project-toast {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 80;
  min-width: 160px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
  color: #166534;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  font-size: 14px;
  font-weight: 850;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.project-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.project-toolbar > input {
  min-height: 34px;
}

.project-toolbar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.project-toolbar-actions button {
  width: auto;
  min-height: 34px;
  padding: 6px 10px;
  white-space: nowrap;
  background: #f8fafc;
  color: #374151;
  border-color: #d9dee7;
  cursor: pointer;
}

.saved-projects-menu {
  position: relative;
  justify-self: end;
}

.saved-projects-menu summary {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid #d9dee7;
  border-radius: 7px;
  background: #f8fafc;
  color: #374151;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}

.saved-projects-menu summary::-webkit-details-marker {
  display: none;
}

.saved-projects-menu[open] .saved-projects {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 320px;
  max-width: min(420px, 90vw);
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.16);
}

body.residential-mode .commercial-only,
body.commercial-mode .residential-only {
  display: none;
}

body.home-mode .project-toolbar,
body.home-mode .setup-wizard,
body.home-mode .workspace {
  display: none;
}

body.home-mode .home-landing {
  display: block;
}

.legend {
  color: #667085;
  font-size: 13px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.top-legend {
  justify-content: flex-end;
}

.legend span {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 999px;
}

.legend .solar { background: var(--solar); }
.legend .existing-solar { background: #fde68a; border: 1px solid #f59e0b; }
.legend .new-solar { background: #f97316; }
.legend .load { background: var(--load); }
.legend .battery { background: #38bdf8; }
.legend .battery-winter { background: #8b5cf6; }
.legend .grid { background: var(--grid); }
.legend .export { background: var(--export); }
.legend .direct { background: #22c55e; }
.legend .grid-fill { background: #94a3b8; }
.legend .export-fill { background: #fb923c; }
.legend .generated { background: var(--solar); }
.legend .winter-line {
  width: 20px;
  height: 0;
  border-radius: 0;
  border-top: 2px dashed #60a5fa;
  background: transparent;
}

.legend .cashflow-net { background: #5b8def; }
.legend .cashflow-solar-cost { background: #fcd34d; }
.legend .cashflow-battery-cost { background: #3dbb6c; }
.legend .cashflow-accumulated,
.legend .soc-line {
  width: 22px;
  height: 0;
  border-radius: 0;
  border-top: 3px solid #bcd0f7;
  background: transparent;
}
.legend .load-before { background: #cfe0ff; }
.legend .load-after { background: #5b8def; }

.energy-breakdown-legend {
  margin-top: 6px;
}

.hover-zone {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
}

.chart-tooltip {
  position: fixed;
  z-index: 100;
  max-width: 270px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  background: rgba(17, 24, 39, 0.94);
  color: #ffffff;
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.24);
  pointer-events: none;
  white-space: nowrap;
}

.chart-tooltip div + div {
  margin-top: 2px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric,
.panel,
.chart-panel,
.season-card,
.detail-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.07);
}

.metric {
  padding: 12px 14px;
  min-height: 86px;
}

.metric span,
.metric small {
  color: #8a94a6;
  display: block;
  font-size: 12px;
}

.metric strong {
  display: block;
  font-size: clamp(20px, 2vw, 24px);
  margin: 5px 0 3px;
}

.payback-metric {
  border-color: rgba(15, 159, 110, 0.35);
  background: linear-gradient(180deg, #ffffff 0%, #f3fbf7 100%);
}

.system-size-metric {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(180deg, #ffffff 0%, #fff8eb 100%);
}

.battery-size-metric {
  border-color: rgba(126, 34, 206, 0.34);
  background: linear-gradient(180deg, #ffffff 0%, #faf5ff 100%);
}

.battery-size-metric strong {
  color: #6b21a8;
}

.export-metric {
  border-color: rgba(16, 185, 129, 0.38);
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
}

.export-metric strong {
  color: #047857;
}

.overview-system-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.07);
}

.overview-system-summary h2 {
  margin: 0 0 4px;
  color: #101828;
  font-size: 13px;
  line-height: 1.2;
  text-transform: uppercase;
}

.overview-system-summary p {
  margin: 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.4;
}

.overview-system-summary button {
  flex: 0 0 auto;
}

.workspace {
  display: grid;
  grid-template-columns: 326px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.controls {
  display: grid;
  gap: 12px;
  position: sticky;
  top: 10px;
}

.panel {
  padding: 14px;
  display: grid;
  gap: 11px;
}

.flow-panel {
  display: block;
  padding: 0;
  overflow: hidden;
}

.flow-panel > summary {
  min-height: 62px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.flow-panel > summary::-webkit-details-marker,
.sub-panel > summary::-webkit-details-marker {
  display: none;
}

.flow-panel > summary::after {
  content: "+";
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid #d9dee7;
  border-radius: 50%;
  color: #b45309;
  background: #fff;
  font-weight: 850;
}

.flow-panel[open] > summary::after {
  content: "-";
}

.flow-panel > summary small {
  grid-column: 1 / -1;
  color: #8a94a6;
  font-size: 12px;
  line-height: 1.35;
}

.flow-panel-title {
  display: block;
  margin-top: 3px;
  color: #111827;
  font-size: 15px;
  font-weight: 850;
  text-transform: uppercase;
}

.flow-panel-body {
  padding: 0 14px 14px;
  display: grid;
  gap: 11px;
}

.flow-group {
  display: grid;
  gap: 11px;
}

.sub-panel {
  border: 1px solid #eef1f4;
  background: #fbfcfe;
  border-radius: 8px;
}

.sub-panel > summary {
  min-height: 38px;
  padding: 10px;
  color: #374151;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}

.sub-panel > summary::after {
  content: "Open";
  float: right;
  color: #b45309;
}

.sub-panel[open] > summary::after {
  content: "Close";
}

.sub-panel-body {
  border-top: 1px solid #eef1f4;
  padding: 10px;
  display: grid;
  gap: 9px;
}

.panel-kicker {
  color: #b45309;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.panel h2,
.chart-panel h2,
.detail-grid h2 {
  margin-bottom: 8px;
  font-size: 15px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0;
}

.segment {
  border-top: 1px solid var(--line);
  padding-top: 11px;
  display: grid;
  gap: 9px;
}

.segment h3 {
  margin: 0;
  font-size: 13px;
  color: #374151;
}

.secondary-action {
  justify-self: start;
  width: auto;
  min-height: 34px;
  padding-inline: 12px;
}

label {
  display: grid;
  gap: 5px;
  color: #667085;
  font-size: 12px;
}

input, select, button, textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid #d9dee7;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 7px 9px;
  font: inherit;
}

input[readonly] {
  color: #667085;
  background: #f8fafc;
}

.readonly-value {
  width: 100%;
  min-height: 36px;
  border: 1px solid #d9dee7;
  border-radius: 7px;
  background: #f8fafc;
  color: #344054;
  padding: 8px 9px;
  font: inherit;
}

textarea {
  resize: vertical;
  line-height: 1.35;
}

input[type="range"] { padding: 0; }

.input-with-suffix {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  border: 1px solid #d9dee7;
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}

.input-with-suffix input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.input-suffix {
  display: grid;
  place-items: center;
  min-width: 38px;
  border-left: 1px solid #d9dee7;
  background: #f8fafc;
  color: #475467;
  font-weight: 850;
}

.controls button {
  background: #f8fafc;
  color: #374151;
  border-color: #d9dee7;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.66;
}

.field-note {
  margin: -2px 0 0;
  color: #8a94a6;
  font-size: 12px;
  line-height: 1.35;
}

.description-box,
.existing-solar-box,
.equipment-box,
.system-sizing,
.tariff-panel {
  border: 1px solid #eef1f4;
  background: #fbfcfe;
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 9px;
}

.saved-projects {
  display: grid;
  gap: 8px;
}

.saved-project {
  border: 1px solid #eef1f4;
  background: #fff;
  border-radius: 7px;
  padding: 9px;
  display: grid;
  gap: 6px;
}

.saved-project strong {
  font-size: 13px;
}

.saved-project small {
  color: #8a94a6;
}

.saved-project-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.saved-project-actions button {
  width: auto;
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.checkbox-row {
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
}

.existing-solar-inputs,
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.client-size-choices {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.price-override-panel {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1.5px solid #16a34a;
  border-radius: 8px;
  background: #f0fdf4;
}

.price-override-panel label {
  color: #166534;
  font-size: 13px;
  font-weight: 850;
}

.price-override-panel input {
  min-height: 42px;
  border-color: #16a34a;
  background: #fff;
  font-size: 18px;
  font-weight: 850;
}

.price-override-panel .field-note {
  color: #2f6f4e;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.hidden {
  display: none !important;
}

.input-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.two-option-tabs {
  grid-template-columns: repeat(2, 1fr);
}

.input-mode-tabs button {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.input-mode-tabs button.active {
  background: var(--amber-soft);
  border-color: #f6d365;
  color: #b45309;
  font-weight: 800;
}

.input-pane {
  display: grid;
  gap: 9px;
}

.tariff-rows {
  display: grid;
  gap: 7px;
}

.tariff-row {
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 6px;
  color: #667085;
  font-size: 12px;
}

.bill-upload {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px dashed #b9c4d6;
  border-radius: 8px;
  background: #f8fbff;
  color: #344054;
  cursor: pointer;
}

.bill-upload.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
}

.bill-upload span {
  font-weight: 850;
}

.bill-upload small {
  color: #667085;
}

.bill-analysis {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #d9e2f1;
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
  font-size: 12px;
}

.bill-analysis strong {
  color: #101828;
}

.bill-analysis ul {
  margin: 0;
  padding-left: 18px;
}

.commercial-rate-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.results {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.output-tabs {
  position: sticky;
  top: 10px;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  background: rgba(243, 244, 246, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(8px);
}

.output-tabs button {
  min-height: 36px;
  padding: 7px 10px;
  border-color: #d9dee7;
  background: #fff;
  color: #667085;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  white-space: normal;
}

.output-tabs button.active {
  color: #b45309;
  background: var(--amber-soft);
  border-color: #f6d365;
}

.output-panel:not(.active) {
  display: none !important;
}

@media (max-width: 760px) {
  .output-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    position: static;
  }

  .output-tabs button:first-child {
    grid-column: 1 / -1;
  }
}

.system-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.suggestions-intro {
  grid-column: 1 / -1;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.suggestions-intro span {
  display: block;
  margin-bottom: 4px;
  color: #111827;
  font-size: 14px;
  font-weight: 850;
}

.suggestions-intro p {
  margin: 0;
  color: #667085;
  line-height: 1.45;
}

.system-options.single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 420px;
  margin: 0 auto;
}

.system-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 9px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.07);
}

.system-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.system-card.active {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.18);
}

.system-card .tag {
  color: #8a94a6;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.system-card .size {
  font-size: 23px;
  font-weight: 850;
}

.system-card .score {
  color: #b45309;
  font-size: 12px;
  font-weight: 850;
}

.option-label {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 3px;
}

.option-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12px;
}

.option-table tr + tr {
  border-top: 1px solid #eef1f4;
}

.option-table th,
.option-table td {
  padding: 6px 0;
}

.option-table th {
  width: 48%;
  color: #667085;
  font-weight: 600;
  text-align: left;
  white-space: normal;
}

.option-table td {
  font-weight: 850;
  text-align: right;
  white-space: normal;
  overflow-wrap: anywhere;
}

.equipment-guide {
  display: grid;
  gap: 10px;
}

.equipment-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.equipment-card {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.equipment-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.equipment-card-head span {
  color: #667085;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.equipment-card strong {
  color: #111827;
  font-size: 16px;
  line-height: 1.25;
}

.equipment-card p,
.equipment-card small,
.equipment-card em,
.equipment-note {
  margin: 0;
  color: #667085;
  line-height: 1.45;
}

.equipment-card small {
  color: #344054;
}

.equipment-card em {
  color: #047857;
  font-style: normal;
  font-weight: 800;
}

.equipment-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.equipment-links a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid #d9dee7;
  border-radius: 999px;
  color: #0f5d66;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.equipment-note {
  font-size: 12px;
}

@media (max-width: 980px) {
  .equipment-list {
    grid-template-columns: 1fr;
  }

  .equipment-card-head {
    grid-template-columns: 1fr;
  }

  .equipment-links {
    justify-content: flex-start;
  }
}

.season-stack {
  display: grid;
  gap: 10px;
}

.battery-only-control {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.choice-button {
  justify-self: start;
  border: 1px solid #cfd7e3;
  background: #ffffff;
  color: #344054;
  font-weight: 800;
}

.choice-button.active {
  border-color: #16a34a;
  background: #dcfce7;
  color: #166534;
}

.season-card {
  padding: 13px 14px 12px;
}

.season-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  margin-bottom: 6px;
}

.season-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.season-title h2 {
  margin: 0;
  font-size: 15px;
}

.badge {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  line-height: 1;
  color: #047857;
  background: #dcfce7;
}

.badge.interpolated {
  color: #b45309;
  background: #fef3c7;
}

.season-desc {
  margin: 0;
  color: #98a2b3;
  font-size: 13px;
}

.season-stats {
  display: grid;
  grid-template-columns: repeat(5, auto);
  gap: 14px;
  text-align: right;
}

.season-stats span {
  display: block;
  color: #98a2b3;
  font-size: 12px;
}

.season-stats strong {
  font-size: 16px;
}

.solar-value { color: var(--solar); }
.load-value { color: var(--load); }
.grid-value { color: var(--grid); }
.export-value { color: var(--export); }
.saving-value { color: #16a34a; font-weight: 800; }

.chart-panel {
  padding: 16px 18px;
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.chart-header p {
  color: #98a2b3;
  margin-bottom: 0;
  font-size: 13px;
}

.chart-subheader {
  margin-top: 14px;
  margin-bottom: 4px;
}

.chart-subheader h3 {
  margin: 0;
  color: #334155;
  font-size: 15px;
}

.chart-subheader p {
  margin: 2px 0 0;
  color: #98a2b3;
  font-size: 13px;
}

.chart-controls {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.chart-controls label {
  min-width: 118px;
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
}

.chart-controls select {
  min-height: 32px;
  padding: 5px 28px 5px 9px;
  font-size: 13px;
  background-color: #fff;
}

.view-toggle {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  background: #f8fafc;
  min-width: 146px;
}

.view-toggle button {
  border: 0;
  background: transparent;
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 6px;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.view-toggle button.active {
  background: #fff;
  color: #b45309;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.axis { stroke: #e5e7eb; stroke-width: 1; }
.grid-line { stroke: #edf1f5; stroke-width: 1; }
.line-load { fill: none; stroke: var(--load); stroke-width: 2; }
.line-solar { fill: none; stroke: var(--solar); stroke-width: 2.4; }
.line-winter { fill: none; stroke: #60a5fa; stroke-width: 2.4; stroke-dasharray: 5 4; }
.line-grid { fill: none; stroke: var(--grid); stroke-width: 2; }
.line-export { fill: none; stroke: var(--export); stroke-width: 2; }
.area-solar { fill: rgba(245, 158, 11, 0.15); }
.area-existing-solar { fill: rgba(253, 230, 138, 0.42); stroke: rgba(245, 158, 11, 0.45); stroke-width: 0.6; }
.area-new-solar { fill: rgba(249, 115, 22, 0.18); stroke: rgba(249, 115, 22, 0.5); stroke-width: 0.7; }
.area-battery-discharge { fill: rgba(56, 189, 248, 0.36); stroke: rgba(2, 132, 199, 0.65); stroke-width: 1.2; }
.area-battery-discharge-winter { fill: rgba(124, 58, 237, 0.34); stroke: rgba(109, 40, 217, 0.65); stroke-width: 1.2; }
.flow-title { fill: #172033; font-size: 18px; font-weight: 800; }
.flow-label { fill: #172033; font-size: 15px; font-weight: 800; paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.flow-small { fill: #667085; font-size: 12px; }
.flow-node { stroke-width: 3; }
.flow-node-grid { fill: #f3fee7; stroke: #84cc16; }
.flow-node-site { fill: #f8fafc; stroke: #cbd5e1; }
.flow-node-solar { fill: #dcfce7; stroke: #22c55e; }
.flow-node-battery { fill: #faf5ff; stroke: #7e22ce; }
.flow-node-title { fill: #334155; font-size: 14px; font-weight: 800; }
.flow-node-value { fill: #172033; font-size: 18px; font-weight: 800; }
.flow-battery-title,
.flow-battery-value { fill: #6b21a8; }
.flow-solar-arrow,
.flow-export { fill: none; stroke: #16a34a; stroke-linecap: round; opacity: 0.9; }
.flow-grid-arrow { stroke: #84cc16; stroke-linecap: round; opacity: 0.9; }
.flow-battery-charge { stroke: #16a34a; stroke-linecap: round; opacity: 0.9; }
.flow-battery-arrow { stroke: #7e22ce; stroke-linecap: round; opacity: 0.9; }
.flow-force-charge { fill: none; stroke: #f59e0b; stroke-linecap: round; opacity: 0.92; }
.flow-force-label { fill: #92400e; }
.bar-month { fill: var(--solar); }
.bar-existing-solar { fill: #fde68a; stroke: #f59e0b; stroke-width: 0.8; }
.bar-new-solar { fill: #f97316; }
.bar-direct { fill: #22c55e; opacity: 0.86; }
.bar-battery { fill: #38bdf8; opacity: 0.88; }
.bar-grid { fill: #94a3b8; opacity: 0.65; }
.bar-exported { fill: #fb923c; opacity: 0.82; }
.bar-battery-day { fill: #38bdf8; opacity: 0.75; }
.bar-cashflow-net { fill: #5b8def; opacity: 0.88; }
.bar-cashflow-solar-cost { fill: #fcd34d; opacity: 0.92; }
.bar-cashflow-battery-cost { fill: #3dbb6c; opacity: 0.92; }
.line-cashflow-accumulated { fill: none; stroke: #c7d7f7; stroke-width: 4; stroke-linecap: round; }
.metric-independence { fill: rgba(199, 215, 247, 0.9); }
.metric-solar-utilisation { fill: rgba(252, 211, 77, 0.9); }
.metric-battery-utilisation { fill: rgba(61, 187, 108, 0.92); }
.area-load-after { fill: rgba(91, 141, 239, 0.18); }
.free-power-band { fill: rgba(245, 158, 11, 0.13); }
.free-power-border { stroke: #f59e0b; stroke-width: 1.2; stroke-dasharray: 4 4; }
.free-power-label { fill: #92400e; font-size: 11px; font-weight: 800; }
.area-daily-solar { fill: rgba(252, 211, 77, 0.22); }
.line-load-before { fill: none; stroke: #cfe0ff; stroke-width: 3; stroke-linecap: round; }
.line-load-after { fill: none; stroke: #5b8def; stroke-width: 3; stroke-linecap: round; }
.line-daily-solar { fill: none; stroke: #fcd34d; stroke-width: 3; stroke-linecap: round; }
.line-soc { fill: none; stroke: #3dbb6c; stroke-width: 3.4; stroke-linecap: round; }
.soc-axis-label { fill: #10b981; }
.chart-label { fill: #98a2b3; font-size: 11px; }

.cashflow-table-wrap,
.energy-metrics-panel {
  margin-top: 10px;
}

.cashflow-table-wrap summary {
  display: inline-grid;
  min-height: 32px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.cashflow-table-wrap[open] {
  overflow-x: auto;
}

.cashflow-table {
  width: 100%;
  min-width: 760px;
  margin-top: 10px;
  border-collapse: collapse;
}

.cashflow-table th,
.cashflow-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef1f4;
  text-align: right;
  white-space: nowrap;
}

.cashflow-table th:first-child,
.cashflow-table td:first-child {
  text-align: left;
}

.cashflow-table th {
  color: #98a2b3;
  font-size: 12px;
  text-transform: uppercase;
}

.finance-guide {
  display: grid;
  gap: 16px;
}

.finance-section {
  display: grid;
  gap: 10px;
}

.finance-section + .finance-section {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.finance-section-heading h3 {
  margin: 0 0 4px;
  color: #101828;
  font-size: 13px;
  line-height: 1.2;
  text-transform: uppercase;
}

.finance-section-heading p {
  margin: 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.4;
}

.finance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.finance-quick-overview .finance-card {
  grid-template-rows: minmax(34px, auto) auto 1fr;
  align-items: start;
}

.finance-quick-overview .finance-card strong {
  display: flex;
  align-items: flex-end;
  min-height: 34px;
}

.finance-cost-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.finance-cost-summary article {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.finance-cost-summary span {
  color: #667085;
  font-size: 12px;
  font-weight: 850;
}

.finance-cost-summary strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
}

.finance-cost-summary small {
  color: #667085;
  font-size: 11px;
  line-height: 1.35;
}

.finance-cost-summary .finance-cost-total {
  border-color: #f6d365;
  background: var(--amber-soft);
}

.finance-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.finance-card span {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.finance-card strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1.05;
}

.finance-card small {
  color: #8a94a6;
  line-height: 1.35;
}

.finance-card.positive strong {
  color: #15803d;
}

.finance-card.negative strong {
  color: #b45309;
}

.finance-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.finance-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 13px;
}

.finance-table th,
.finance-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef1f4;
  text-align: right;
  white-space: nowrap;
}

.finance-table th:first-child,
.finance-table td:first-child {
  text-align: left;
}

.finance-table th {
  color: #667085;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 850;
}

.finance-table td {
  color: var(--ink);
  font-weight: 750;
}

.finance-table tr:last-child td {
  border-bottom: 0;
}

.finance-table .positive {
  color: #15803d;
}

.finance-table .negative {
  color: #b45309;
}

.finance-disclaimer {
  margin: 12px 0 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.45;
}

.energy-metric-row + .energy-metric-row {
  margin-top: 14px;
}

.energy-metric-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 4px;
}

.energy-metric-head h3 {
  margin: 0;
  font-size: 15px;
}

.energy-metric-head span {
  color: #66516f;
  font-size: 13px;
}

.energy-metric-head strong {
  color: #3b82f6;
}

.solar-consumption-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1fr);
  gap: 24px;
  align-items: center;
}

.solar-donut {
  max-width: 360px;
  margin: 0 auto;
  display: block;
}

.donut-self { fill: #fcd34d; }
.donut-export { fill: #5b8def; }
.donut-curtailed { fill: #8f8888; }
.donut-direct { fill: #cfe0ff; }
.donut-battery { fill: #3dbb6c; }
.donut-center-label { fill: #66516f; font-size: 13px; }
.donut-center-value { fill: #0f172a; font-size: 30px; font-weight: 850; }

.solar-consumption-list {
  display: grid;
  gap: 12px;
}

.solar-consumption-sub {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: #f7f7f8;
}

.solar-consumption-line {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.solar-consumption-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--swatch);
}

.solar-consumption-line span {
  color: #66516f;
  font-size: 13px;
}

.solar-consumption-line strong {
  display: block;
  color: #0f172a;
  font-size: 18px;
}

.solar-consumption-line b {
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.monthly-table-wrap {
  overflow-x: auto;
}

.monthly-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.monthly-table th,
.monthly-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #eef1f4;
  text-align: right;
  white-space: nowrap;
}

.monthly-table th:first-child,
.monthly-table td:first-child {
  text-align: left;
}

.monthly-table th {
  color: #98a2b3;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.monthly-table th span {
  font-weight: 400;
  text-transform: none;
}

.selfbar {
  display: inline-grid;
  grid-template-columns: 58px 42px;
  align-items: center;
  gap: 8px;
}

.selfbar i {
  height: 6px;
  background: #eef1f6;
  border-radius: 999px;
  overflow: hidden;
}

.selfbar i::before {
  content: "";
  display: block;
  width: var(--p);
  height: 100%;
  background: #9aa9ff;
  border-radius: inherit;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.detail-grid article {
  padding: 16px;
}

dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid #eef1f4;
  padding-bottom: 8px;
}

dt { color: #667085; }
dd { margin: 0; font-weight: 800; text-align: right; }

ul { margin: 0; padding-left: 18px; color: #667085; }
li + li { margin-top: 8px; }

@media (max-width: 1100px) {
  .topbar { grid-template-columns: 1fr; }
  .help-guide-button { justify-self: start; }
  .setup-wizard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-toolbar { grid-template-columns: 1fr 1fr; }
  .project-toolbar-title,
  .project-status { grid-column: 1 / -1; }
  .project-toolbar-actions { justify-content: flex-start; flex-wrap: wrap; }
  .saved-projects-menu { justify-self: start; }
  .top-legend { justify-content: flex-start; }
  .workspace { grid-template-columns: 1fr; }
  .controls { position: static; grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app-shell { padding: 10px; }
  .advisor-bar { padding: 14px; }
  .brand-lockup { align-items: flex-start; }
  .brand-mark { width: 38px; height: 38px; }
  h1 { font-size: 22px; }
  .home-landing { margin-top: 18px; padding: 22px; }
  .home-copy h2 { font-size: 30px; }
  .home-actions { grid-template-columns: 1fr; }
  .home-choice { min-height: 0; }
  .setup-wizard { grid-template-columns: 1fr; }
  .wizard-step { min-height: 64px; }
  .help-guide-head { align-items: flex-start; }
  .help-guide-body { padding: 14px; }
  .project-toolbar { grid-template-columns: 1fr; }
  .project-toolbar-actions { display: grid; grid-template-columns: 1fr; }
  .project-toolbar-actions button,
  .saved-projects-menu,
  .saved-projects-menu summary { width: 100%; }
  .saved-projects-menu[open] .saved-projects { left: 0; right: auto; min-width: 100%; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-system-summary { display: grid; }
  .overview-system-summary button { width: 100%; }
  .controls, .detail-grid { grid-template-columns: 1fr; }
  .system-options,
  .existing-solar-inputs,
  .finance-cost-summary,
  .finance-grid,
  .two-col { grid-template-columns: 1fr; }
  .season-head { grid-template-columns: 1fr; }
  .season-stats { grid-template-columns: repeat(2, 1fr); text-align: left; }
  .metric { min-height: 74px; }
  .panel,
  .chart-panel,
  .season-card,
  .detail-grid article { border-radius: 7px; }
  .chart-header { display: grid; grid-template-columns: 1fr; }
  .view-toggle { width: 100%; }
  .legend { justify-content: flex-start; gap: 10px; }
  .chart-panel { padding: 13px; }
  .chart-panel svg { min-width: 0; width: 100%; }
  #energyFlowChart { min-width: 0; }
  .monthly-table-wrap { max-width: 100%; overflow-x: auto; }
  table:not(.option-table) { min-width: 620px; }
  .solar-consumption-panel { grid-template-columns: 1fr; }
  .solar-donut { max-width: 300px; }
  .energy-metric-head { display: grid; }
}

@media (max-width: 440px) {
  .app-shell { padding: 8px; }
  .metric strong { font-size: 21px; }
  .season-stats { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
}
