/* ENERGY_PILOT_THEME_V18: global optional light palette; dark remains the default.
   Deliberately do not override the fixed HA price-threshold classes. */
:root { color-scheme: dark; }
html[data-ep-theme="light"] { color-scheme: light; }
html[data-ep-theme="light"] body { background:#f2f6fb; color:#172b3d; }
html[data-ep-theme="light"] .sidebar { background:#e9f0f7; border-color:#cbd9e5; }
html[data-ep-theme="light"] .brand small,
html[data-ep-theme="light"] .section-title,
html[data-ep-theme="light"] .sidebar-foot small { color:#536c81; }
html[data-ep-theme="light"] .nav {color:#38556e;}
html[data-ep-theme="light"] .nav.active {background:#d5e9e8;color:#075f53;}
html[data-ep-theme="light"] .sidebar-foot,
html[data-ep-theme="light"] .topbar {border-color:#cedbe6;color:#3f566b;}
html[data-ep-theme="light"] .crumb,
html[data-ep-theme="light"] .dim,
html[data-ep-theme="light"] .legend,
html[data-ep-theme="light"] .muted,
html[data-ep-theme="light"] footer {color:#506a80;}
html[data-ep-theme="light"] p,
html[data-ep-theme="light"] .stat-label,
html[data-ep-theme="light"] .stat small {color:#526a7d;}
html[data-ep-theme="light"] .panel,
html[data-ep-theme="light"] .stat {background:#fff;border-color:#d5e1eb;}
html[data-ep-theme="light"] .notice {background:#e6f5f0;border-color:#abd8ca;color:#145c50;}
html[data-ep-theme="light"] .notice p {color:#396e67;}
html[data-ep-theme="light"] .btn.subtle {background:#e7eff6;color:#23435e;}
html[data-ep-theme="light"] .btn.outline {background:#fff;border-color:#b7cbdc;color:#274b68;}
html[data-ep-theme="light"] .btn.primary {background:#0a987a;color:#fff;}
html[data-ep-theme="light"] .pill.neutral {background:#e4f1fb;color:#1c638c;border-color:#bad6ed;}
html[data-ep-theme="light"] .pill.safety {background:#fff5df;color:#88570e;border-color:#ecd9af;}
html[data-ep-theme="light"] input[type=date],
html[data-ep-theme="light"] input[type=datetime-local],
html[data-ep-theme="light"] select,
html[data-ep-theme="light"] .autoplan-fields input {background:#fff;color:#16354d;border-color:#b7cad9;color-scheme:light;}
html[data-ep-theme="light"] thead,
html[data-ep-theme="light"] #epHorizonPlanner thead,
html[data-ep-theme="light"] #epForecastV06 th,
html[data-ep-theme="light"] #epV07 th {background:#eaf1f8;color:#395a73;}
html[data-ep-theme="light"] th,
html[data-ep-theme="light"] td {color:#2c4960;border-color:#e0e8ef;}
html[data-ep-theme="light"] tr:hover {background:#f1f7fc;}
html[data-ep-theme="light"] tr.current,
html[data-ep-theme="light"] #epHorizonPlanner tr.ep-horizon-current {background:#dceff7;}
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-day td {background:#dbeae9;color:#11665c;}
html[data-ep-theme="light"] #epHorizonPlanner td.ep-horizon-date {color:#4e677b;}
html[data-ep-theme="light"] #epHorizonPlanner td.ep-horizon-time,
html[data-ep-theme="light"] .time-main {color:#17354d;}
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-summary,
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-status,
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-bottom,
html[data-ep-theme="light"] .ep-v06-data,
html[data-ep-theme="light"] .ep-v06-note,
html[data-ep-theme="light"] #epV07 .ep-v07-sub,
html[data-ep-theme="light"] .ha-live-disclaimer,
html[data-ep-theme="light"] .ha-live-status {color:#49687e;}
html[data-ep-theme="light"] #epHorizonPlanner.ep-horizon-dirty .ep-horizon-status {color:#9b5b17;}
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-table-wrap,
html[data-ep-theme="light"] #epForecastV06 .ep-v06-table,
html[data-ep-theme="light"] #epV07 .ep-v07-table {border-color:#d4e2ec;}
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-check {color:#2e526b;}
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-check:has(input:checked) {color:#093f37;}
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-battery-group {background:#d4e0ea;border-color:#d4e0ea;}
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-battery-choice,
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-diy-group [aria-pressed="false"] {background:#f1f5f9;color:#435b70;}
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-battery-choice[aria-pressed="true"] {background:#bfd8e7;color:#103b56;}
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-battery-choice[data-mode="on"][aria-pressed="true"] {background:#087f65;color:#fff;}
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-battery-choice[data-mode="off"][aria-pressed="true"] {background:#a56c32;color:#fff;}
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-diy-group [data-mode="discharge"][aria-pressed="true"] {background:#7155a3;color:#fff;}
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-soc-mini {background:#d5e6e5;}
html[data-ep-theme="light"] #epHorizonPlanner .ep-horizon-pv-track {background:#f0e4cc;}
html[data-ep-theme="light"] .ha-live-card,
html[data-ep-theme="light"] #epV07 .ep-v07-card,
html[data-ep-theme="light"] .analysis-metric {background:#f6f9fc;border-color:#d8e5ee;}
html[data-ep-theme="light"] .ha-live-card h3 {color:#1f4259;}
html[data-ep-theme="light"] .ha-live-item {border-color:#e2eaf1;}
html[data-ep-theme="light"] .ha-live-label {color:#526e84;}
html[data-ep-theme="light"] .ha-live-value {color:#10775e;}
html[data-ep-theme="light"] #epV07 .ep-v07-card p {color:#47647b;}
html[data-ep-theme="light"] .autoplan-panel details {border-color:#dce7ef;}
html[data-ep-theme="light"] .autoplan-panel summary,
html[data-ep-theme="light"] .autoplan-fields label,
html[data-ep-theme="light"] .autoplan-output {color:#405f78;}
html[data-ep-theme="light"] .chart {background-image:repeating-linear-gradient(to top,transparent,transparent 44px,#d9e5ef 45px,#d9e5ef 46px);}
html[data-ep-theme="light"] .chart-axis {color:#556f83;}
/* Legend is independent of the scrollable grid and remains accessible at the bottom. */
#epHorizonPlanner .ep-price-legend {padding:13px 22px 9px;border-top:1px solid #2e465c;}
#epHorizonPlanner .ep-price-legend-title {font-size:12px;font-weight:750;margin-bottom:9px;}
#epHorizonPlanner .ep-price-legend-grid {display:flex;flex-wrap:wrap;gap:8px 15px;align-items:center;}
#epHorizonPlanner .ep-price-legend-item {display:inline-flex;gap:6px;align-items:center;font-size:11px;color:#a6bdcc;white-space:nowrap;}
#epHorizonPlanner .ep-price-legend-chip {display:inline-block;flex:0 0 15px;width:15px;height:12px;border:1px solid rgba(128,147,169,.4);border-radius:3px;}
#epHorizonPlanner .ep-price-legend-solar {display:inline-block;width:24px;height:4px;background:linear-gradient(90deg,#f6b732,#ff7c27);border-radius:20px;}
#epHorizonPlanner .ep-price-legend-note {margin-top:10px;font-size:11px;color:#91adbf;line-height:1.5;}
#epHorizonPlanner .ep-price-legend-chip.ep-price-yellow {background:yellow;}
#epHorizonPlanner .ep-price-legend-chip.ep-price-lightblue {background:lightblue;}
#epHorizonPlanner .ep-price-legend-chip.ep-price-blue {background:blue;}
#epHorizonPlanner .ep-price-legend-chip.ep-price-darkblue {background:darkblue;}
#epHorizonPlanner .ep-price-legend-chip.ep-price-lightgreen {background:lightgreen;}
#epHorizonPlanner .ep-price-legend-chip.ep-price-orange {background:orange;}
#epHorizonPlanner .ep-price-legend-chip.ep-price-red {background:red;}
#epHorizonPlanner .ep-price-legend-chip.ep-price-darkred {background:darkred;}
html[data-ep-theme="light"] #epHorizonPlanner .ep-price-legend {border-color:#d6e3ed;}
html[data-ep-theme="light"] #epHorizonPlanner .ep-price-legend-item,
html[data-ep-theme="light"] #epHorizonPlanner .ep-price-legend-note {color:#45677f;}
#epThemeToggle {min-width:106px;}
#epThemeToggle:focus-visible {outline:2px solid #0dbb96;outline-offset:2px;}
@media(max-width:720px){#epHorizonPlanner .ep-price-legend{padding:13px 14px;}}
