:root {
    color-scheme: light;
    --ink: #17201d;
    --muted: #61706a;
    --line: #d7ded9;
    --paper: #f7f8f4;
    --panel: #ffffff;
    --pv: #e2a915;
    --load: #2d8c7f;
    --grid: #6f5cc2;
    --battery: #33834d;
    --danger: #b44046;
    --shadow: 0 18px 45px rgba(21, 30, 26, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 248, 244, 0.98)),
        repeating-linear-gradient(90deg, rgba(45, 140, 127, 0.08) 0, rgba(45, 140, 127, 0.08) 1px, transparent 1px, transparent 96px);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    letter-spacing: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px clamp(18px, 4vw, 52px);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 10;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1.04;
    font-weight: 800;
}

h2 {
    font-size: clamp(22px, 3vw, 32px);
    line-height: 1.1;
}

.eyebrow {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

.status-stack {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 8px;
}

.auth-panel {
    display: grid;
    justify-items: end;
    gap: 6px;
    min-width: min(360px, 100%);
}

.login-form {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.login-form input {
    width: 116px;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    padding: 0 10px;
}

.login-form button,
.auth-summary button {
    min-height: 34px;
    border: 1px solid rgba(45, 140, 127, 0.34);
    border-radius: 8px;
    background: var(--ink);
    color: #ffffff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    padding: 0 12px;
}

.auth-summary {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.auth-summary span {
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.auth-status {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.auth-hint {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-shell {
    width: min(460px, 100%);
}

.login-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
    display: grid;
    gap: 14px;
    padding: clamp(22px, 5vw, 34px);
}

.login-card h1 {
    font-size: 34px;
}

.login-lead {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.login-page-form {
    display: grid;
    gap: 9px;
}

.login-page-form label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.login-page-form input {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    padding: 0 12px;
}

.login-page-form button,
.login-link-button {
    min-height: 44px;
    border: 1px solid rgba(45, 140, 127, 0.34);
    border-radius: 8px;
    background: var(--ink);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-weight: 900;
    padding: 0 16px;
    text-decoration: none;
}

.login-alert {
    margin-bottom: 0;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    border-radius: 999px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid var(--line);
    background: var(--panel);
}

.status-ok {
    color: #17613b;
    border-color: rgba(51, 131, 77, 0.28);
    background: rgba(51, 131, 77, 0.1);
}

.status-error {
    color: var(--danger);
    border-color: rgba(180, 64, 70, 0.26);
    background: rgba(180, 64, 70, 0.1);
}

.status-pending {
    color: var(--muted);
}

.shell {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: clamp(18px, 4vw, 52px);
}

.alert {
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(180, 64, 70, 0.28);
    border-left: 4px solid var(--danger);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #73262b;
}

.module-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 12px 30px rgba(21, 30, 26, 0.08);
    padding: 8px;
    overflow-x: auto;
}

.module-submenu {
    margin-top: -10px;
    margin-bottom: 22px;
    border-color: rgba(45, 140, 127, 0.28);
    background: rgba(242, 249, 246, 0.9);
}

.module-submenu.is-advanced-hidden {
    display: none;
}

.module-tab {
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 900;
    padding: 0 14px;
    white-space: nowrap;
}

.module-tab.active {
    border-color: rgba(45, 140, 127, 0.36);
    background: var(--ink);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(21, 30, 26, 0.16);
}

.module-tab:hover,
.module-tab:focus-visible {
    border-color: rgba(45, 140, 127, 0.46);
    outline: none;
}

.module-panel.is-module-hidden {
    display: none !important;
}

.access-note {
    margin-bottom: 14px;
    border: 1px solid rgba(111, 92, 194, 0.24);
    border-radius: 8px;
    background: rgba(111, 92, 194, 0.08);
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
    padding: 12px 14px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.metric {
    display: flex;
    min-height: 154px;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 8px;
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    overflow: visible;
    position: relative;
}

.metric:hover,
.metric:focus,
.metric:focus-within {
    z-index: 30;
}

.metric::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 5px;
    background: var(--accent, var(--line));
}

.metric-pv {
    --accent: var(--pv);
}

.metric-load {
    --accent: var(--load);
}

.metric-grid {
    --accent: var(--grid);
}

.metric-battery {
    --accent: var(--battery);
}

.metric-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.metric strong {
    font-size: clamp(28px, 4vw, 46px);
    line-height: 1;
    white-space: nowrap;
}

.metric small {
    color: var(--muted);
    font-size: 14px;
}

.metric-inline-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.metric-inline-card {
    min-width: 0;
    min-height: 242px;
    border: 1px solid rgba(35, 42, 39, 0.18);
    border-top: 4px solid var(--accent, var(--line));
    border-radius: 8px;
    background: #171a1a;
    box-shadow: var(--shadow);
    color: #eef4f2;
    padding: 14px;
}

.metric-inline-content {
    height: 100%;
}

.metric-inline-card .metric-hover-bars {
    height: 142px;
}

.metric-inline-card .metric-hover-head strong {
    font-size: 18px;
}

.flow-history-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.flow-history-card {
    min-height: 318px;
}

.flow-history-card .metric-hover-bars {
    height: 200px;
}

.flow-history-load {
    --accent: #2d8c7f;
}

.flow-history-pv {
    --accent: #e5ad12;
}

.metric-inline-empty {
    min-height: 214px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aab6b3;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.metric-hover-panel {
    position: absolute;
    left: 0;
    bottom: calc(100% + 12px);
    width: min(380px, calc(100vw - 36px));
    box-sizing: border-box;
    border: 1px solid rgba(35, 42, 39, 0.18);
    border-radius: 10px;
    background: rgba(18, 20, 20, 0.97);
    box-shadow: 0 18px 42px rgba(8, 10, 10, 0.35);
    color: #eef4f2;
    opacity: 0;
    overflow: hidden;
    padding: 14px;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.metric:nth-child(n+3) .metric-hover-panel {
    left: auto;
    right: 0;
}

.metric:hover .metric-hover-panel,
.metric:focus .metric-hover-panel,
.metric:focus-within .metric-hover-panel {
    opacity: 1;
    transform: translateY(0);
}

.metric-hover-content {
    min-width: 0;
    max-width: 100%;
    display: grid;
    gap: 8px;
    overflow: hidden;
}

.metric-hover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.metric-hover-head span,
.metric-hover-content small,
.metric-hover-empty {
    color: #aab6b3;
    font-size: 12px;
    font-weight: 800;
}

.metric-hover-head strong {
    color: #ffffff;
    font-size: 16px;
    line-height: 1;
}

.metric-hover-direction {
    color: #d6dfdc;
    font-size: 12px;
    font-weight: 900;
}

.metric-hover-bars {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 118px;
    display: grid;
    grid-template-columns: repeat(24, minmax(0, 1fr));
    gap: 3px;
    align-items: end;
    border-block: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    padding-block: 8px;
}

.metric-hover-bars.signed {
    align-items: center;
    position: relative;
}

.metric-hover-bars.signed::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 1px dashed rgba(255, 255, 255, 0.25);
}

.metric-hover-bars.directional {
    align-items: stretch;
    position: relative;
}

.metric-hover-bars.directional::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 1px dashed rgba(255, 255, 255, 0.25);
}

.metric-hover-bar {
    height: 100%;
    min-width: 0;
    display: flex;
    align-items: end;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.metric-hover-bar.negative {
    align-items: start;
}

.metric-hover-bars.signed .metric-hover-bar {
    height: 50%;
    align-self: start;
    align-items: end;
}

.metric-hover-bars.signed .metric-hover-bar.negative {
    align-self: end;
    align-items: start;
}

.metric-hover-bars.signed .metric-hover-bar.missing {
    height: 100%;
    align-self: center;
    align-items: center;
}

.metric-hover-bar.directional {
    display: grid;
    grid-template-rows: 1fr 1fr;
    align-items: stretch;
}

.metric-hover-bar.directional span {
    justify-self: center;
    width: min(100%, 9px);
}

.metric-hover-positive {
    align-self: end;
    border-radius: 999px 999px 3px 3px;
}

.metric-hover-negative {
    align-self: start;
    border-radius: 3px 3px 999px 999px;
}

.metric-hover-positive.import {
    background: #5aa8ff;
}

.metric-hover-negative.export {
    background: #38c78b;
}

.metric-hover-positive.charge {
    background: #46c4ad;
}

.metric-hover-negative.discharge {
    background: #f0ad3d;
}

.metric-hover-bar span {
    display: block;
    width: min(100%, 10px);
    min-height: 2px;
    border-radius: 999px 999px 3px 3px;
    background: var(--accent, var(--load));
}

.metric-hover-bar.negative span {
    border-radius: 3px 3px 999px 999px;
    background: #de6b75;
}

.metric-hover-bar.import span {
    background: #5aa8ff;
}

.metric-hover-bar.export span {
    background: #38c78b;
}

.metric-hover-bar.charge span {
    background: #46c4ad;
}

.metric-hover-bar.discharge span {
    background: #f0ad3d;
}

.metric-hover-bar.directional span {
    height: 100%;
    min-height: 0;
    transform: scaleY(var(--bar-scale, 0));
}

.metric-hover-bar.directional .metric-hover-positive {
    border-radius: 999px 999px 3px 3px;
    transform-origin: bottom center;
}

.metric-hover-bar.directional .metric-hover-negative {
    border-radius: 3px 3px 999px 999px;
    transform-origin: top center;
}

.metric-hover-bar.directional .metric-hover-positive.import {
    background: #5aa8ff;
}

.metric-hover-bar.directional .metric-hover-negative.export {
    background: #38c78b;
}

.metric-hover-bar.directional .metric-hover-positive.charge {
    background: #46c4ad;
}

.metric-hover-bar.directional .metric-hover-negative.discharge {
    background: #f0ad3d;
}

.metric-hover-bar.missing span {
    height: 2px !important;
    background: rgba(255, 255, 255, 0.18);
}

.metric-hover-axis {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    color: #87928f;
    font-size: 10px;
    font-weight: 800;
}

.metric-hover-axis span:nth-child(2),
.metric-hover-axis span:nth-child(3),
.metric-hover-axis span:nth-child(4) {
    text-align: center;
}

.metric-hover-axis span:last-child {
    text-align: right;
}

.metric-hover-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.metric-hover-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #d6dfdc;
    font-size: 10px;
    font-weight: 900;
}

.metric-hover-legend span::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
}

.metric-hover-legend .import {
    color: #5aa8ff;
}

.metric-hover-legend .export {
    color: #38c78b;
}

.metric-hover-legend .charge {
    color: #46c4ad;
}

.metric-hover-legend .discharge {
    color: #f0ad3d;
}

.metric-hover-empty {
    min-height: 116px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.battery-kpi-card[data-battery-hover-metric] {
    position: relative;
    cursor: help;
}

.battery-hover-panel {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    z-index: 30;
    width: min(430px, calc(100vw - 36px));
    box-sizing: border-box;
    border: 1px solid rgba(35, 42, 39, 0.18);
    border-radius: 10px;
    background: rgba(18, 20, 20, 0.98);
    box-shadow: 0 18px 42px rgba(8, 10, 10, 0.35);
    color: #eef4f2;
    opacity: 0;
    overflow: hidden;
    padding: 14px;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.battery-kpi-grid .battery-kpi-card:nth-child(3n) .battery-hover-panel {
    left: auto;
    right: 0;
}

.battery-kpi-card:hover .battery-hover-panel,
.battery-kpi-card:focus .battery-hover-panel,
.battery-kpi-card:focus-within .battery-hover-panel {
    opacity: 1;
    transform: translateY(0);
}

.battery-sample-content .metric-hover-head strong {
    font-size: 18px;
}

.battery-sample-bars {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 136px;
    grid-template-columns: repeat(var(--sample-count, 24), minmax(0, 1fr));
    gap: 0;
    overflow: hidden;
}

.battery-sample-bars .metric-hover-bar {
    min-width: 0;
    overflow: hidden;
}

.battery-sample-bars .metric-hover-bar span {
    width: min(100%, 4px);
}

.energy-band {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
    gap: 18px;
    margin-top: 22px;
    align-items: stretch;
}

.flow-board {
    min-height: 390px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 248, 244, 0.86)),
        repeating-linear-gradient(90deg, rgba(97, 112, 106, 0.08) 0, rgba(97, 112, 106, 0.08) 1px, transparent 1px, transparent 96px),
        repeating-linear-gradient(0deg, rgba(97, 112, 106, 0.06) 0, rgba(97, 112, 106, 0.06) 1px, transparent 1px, transparent 78px);
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(90px, 1fr));
    align-items: center;
    padding: clamp(16px, 3vw, 34px);
    position: relative;
    overflow: hidden;
}

.flow-node {
    min-width: 0;
    min-height: 124px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 16px;
    position: relative;
    z-index: 2;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(21, 30, 26, 0.1);
}

.flow-node::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 5px;
    background: var(--accent, var(--line));
}

.flow-visual {
    width: 52px;
    height: 52px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--accent, var(--muted));
    display: flex;
    align-items: center;
    justify-content: center;
}

.flow-visual svg {
    width: 38px;
    height: 38px;
}

.flow-copy {
    min-width: 0;
    display: grid;
    gap: 8px;
}

.flow-copy span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.flow-copy strong {
    font-size: clamp(20px, 2.3vw, 30px);
    line-height: 1;
    white-space: nowrap;
}

.flow-copy small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.flow-node.source {
    --accent: var(--pv);
    grid-column: 1 / 3;
    grid-row: 1;
    border-color: rgba(226, 169, 21, 0.45);
}

.flow-node.source .flow-visual {
    border-color: rgba(226, 169, 21, 0.38);
    background: rgba(226, 169, 21, 0.11);
}

.flow-node.home {
    --accent: var(--load);
    grid-column: 3 / 5;
    grid-row: 2;
    border-color: rgba(45, 140, 127, 0.45);
}

.flow-node.home .flow-visual {
    border-color: rgba(45, 140, 127, 0.38);
    background: rgba(45, 140, 127, 0.1);
}

.flow-node.grid {
    --accent: var(--grid);
    grid-column: 5 / 7;
    grid-row: 2;
    border-color: rgba(111, 92, 194, 0.45);
}

.flow-node.grid .flow-visual {
    border-color: rgba(111, 92, 194, 0.38);
    background: rgba(111, 92, 194, 0.1);
}

.flow-node.battery {
    --accent: var(--battery);
    grid-column: 2 / 4;
    grid-row: 3;
    border-color: rgba(51, 131, 77, 0.45);
}

.flow-node.battery .flow-visual {
    border-color: rgba(51, 131, 77, 0.38);
    background: rgba(51, 131, 77, 0.1);
}

.flow-line {
    height: 6px;
    background: linear-gradient(90deg, var(--pv), var(--load), var(--grid));
    border-radius: 999px;
    opacity: 0.72;
    z-index: 1;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.58), 0 8px 18px rgba(45, 140, 127, 0.18);
}

.flow-line-a {
    grid-column: 2 / 5;
    grid-row: 1 / 3;
    transform: rotate(28deg);
}

.flow-line-b {
    grid-column: 4 / 6;
    grid-row: 2;
}

.energy-map {
    min-height: 440px;
    background: #101111;
    border-color: #1e2424;
    color: #e9eeee;
    display: grid;
    grid-template-columns: minmax(92px, 1fr) minmax(132px, 1.1fr) minmax(112px, 0.9fr) minmax(132px, 1.1fr) minmax(92px, 1fr);
    grid-template-rows: 118px 120px 150px;
    gap: 0;
    padding: clamp(16px, 2.5vw, 28px);
    box-shadow: 0 18px 45px rgba(10, 12, 12, 0.28);
    overflow: hidden;
}

.energy-map .flow-node,
.energy-map .flow-line {
    display: none;
}

.map-top,
.map-side,
.map-center,
.map-bottom {
    position: relative;
    z-index: 2;
}

.map-pv {
    grid-column: 2 / 5;
    grid-row: 1;
    align-self: start;
    justify-self: center;
    display: grid;
    justify-items: center;
    gap: 3px;
    color: #f7aa19;
}

.map-pv strong,
.map-grid strong,
.map-load strong {
    font-size: 15px;
    line-height: 1;
}

.map-pv small,
.map-grid small,
.map-load small,
.map-battery small {
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
}

.map-pv em {
    color: #f7aa19;
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
}

.map-icon {
    position: relative;
    width: 58px;
    height: 52px;
}

.pv-icon {
    width: 52px;
    height: 34px;
}

.pv-icon span,
.pv-icon b {
    position: absolute;
    top: 4px;
    width: 15px;
    height: 15px;
    border-radius: 1px;
    background: #f7aa19;
}

.pv-icon span {
    left: 10px;
    clip-path: polygon(0 0, 100% 0, 70% 100%, 0 100%);
}

.pv-icon b {
    left: 27px;
    clip-path: polygon(0 0, 100% 0, 100% 55%, 0 100%);
}

.pv-icon i {
    position: absolute;
    left: 25px;
    top: 15px;
    width: 13px;
    height: 24px;
    background: #f7aa19;
    clip-path: polygon(38% 0, 100% 0, 63% 43%, 100% 43%, 20% 100%, 43% 55%, 0 55%);
}

.map-value {
    min-width: 86px;
    min-height: 34px;
    border: 2px solid currentColor;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    background: rgba(16, 17, 17, 0.92);
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.pv-value {
    color: #f7aa19;
}

.map-grid {
    grid-column: 1 / 3;
    grid-row: 2;
    align-self: center;
    justify-self: start;
    display: grid;
    grid-template-columns: 76px auto;
    grid-template-rows: auto auto auto;
    align-items: center;
    column-gap: 10px;
    color: #6ba4df;
}

.grid-icon {
    grid-row: 1 / 4;
    color: #6ba4df;
}

.grid-icon::before,
.grid-icon::after {
    content: "";
    position: absolute;
    left: 13px;
    width: 34px;
    border-top: 6px solid currentColor;
    transform: skewX(-18deg);
}

.grid-icon::before {
    top: 4px;
    box-shadow: -5px 13px 0 -1px currentColor, 4px 25px 0 -1px currentColor;
}

.grid-icon::after {
    top: 13px;
    height: 34px;
    border-left: 6px solid currentColor;
    border-right: 6px solid currentColor;
    border-top: 0;
    transform: skewX(-16deg);
}

.grid-value {
    color: #6ba4df;
}

.map-load {
    grid-column: 4 / 6;
    grid-row: 2;
    align-self: center;
    justify-self: end;
    display: grid;
    grid-template-columns: auto 78px;
    grid-template-rows: auto auto auto;
    align-items: center;
    column-gap: 10px;
    color: #62d7c4;
    text-align: right;
}

.home-icon {
    grid-column: 2;
    grid-row: 1 / 4;
    color: #6ba4df;
}

.home-icon::before {
    content: "";
    position: absolute;
    inset: 8px 2px 0;
    background: currentColor;
    clip-path: polygon(50% 0, 100% 39%, 85% 39%, 85% 100%, 15% 100%, 15% 39%, 0 39%);
}

.home-icon::after {
    content: "";
    position: absolute;
    left: 30px;
    top: 17px;
    width: 17px;
    height: 35px;
    background: #101111;
    clip-path: polygon(42% 0, 100% 0, 58% 43%, 100% 43%, 18% 100%, 43% 54%, 0 54%);
}

.load-value {
    color: #62d7c4;
}

.map-center {
    grid-column: 2 / 5;
    grid-row: 2;
    align-self: center;
    justify-self: center;
    width: 160px;
    height: 126px;
}

.map-inverter {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 54px;
    height: 54px;
    transform: translate(-50%, -50%);
    border-radius: 3px;
    background: #c9c9c2;
    box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.22);
}

.map-inverter span {
    position: absolute;
    left: 7px;
    top: 8px;
    width: 40px;
    height: 13px;
    background: #1c1c1c;
}

.map-inverter b {
    position: absolute;
    left: 18px;
    top: 24px;
    width: 22px;
    height: 22px;
    border: 3px solid #1c1c1c;
    border-left-color: transparent;
    border-radius: 50%;
}

.map-inverter b::after {
    content: "";
    position: absolute;
    right: -4px;
    top: 11px;
    border: 5px solid transparent;
    border-left-color: #1c1c1c;
    transform: rotate(36deg);
}

.map-note {
    position: absolute;
    top: 35px;
    color: #94a5a5;
    font-size: 10px;
    line-height: 1.25;
}

.map-note-left {
    right: calc(50% + 38px);
    text-align: right;
}

.map-note-right {
    left: calc(50% + 38px);
}

.map-battery {
    grid-column: 2 / 5;
    grid-row: 3;
    align-self: end;
    justify-self: center;
    display: grid;
    grid-template-columns: auto 54px auto;
    grid-template-rows: auto auto auto;
    align-items: center;
    column-gap: 12px;
    color: #ffb12a;
}

.battery-value {
    grid-column: 1 / 4;
    justify-self: center;
    margin-bottom: 8px;
    color: #ffb1ba;
}

.battery-meta {
    grid-column: 1;
    grid-row: 2 / 4;
    display: grid;
    gap: 6px;
    text-align: right;
    color: #ffb1ba;
    font-size: 12px;
    font-weight: 800;
}

.map-battery-icon {
    grid-column: 2;
    grid-row: 2 / 4;
    width: 42px;
    height: 64px;
    border: 4px solid #e9a82f;
    border-radius: 4px;
    padding: 4px;
    display: flex;
    align-items: end;
    background: #101111;
    position: relative;
}

.map-battery-icon::before {
    content: "";
    position: absolute;
    left: 10px;
    top: -10px;
    width: 18px;
    height: 6px;
    background: #e9a82f;
    border-radius: 2px 2px 0 0;
}

.map-battery-icon span {
    display: block;
    width: 100%;
    min-height: 4px;
    border-radius: 2px;
    background: repeating-linear-gradient(0deg, #f0a41a 0 5px, #ffca4c 5px 8px);
}

.map-battery strong {
    grid-column: 3;
    grid-row: 2;
    color: #ffd7dc;
    font-size: clamp(20px, 3vw, 28px);
}

.map-battery small {
    grid-column: 3;
    grid-row: 3;
    color: #ffd7dc;
}

.wire {
    position: absolute;
    z-index: 1;
    background: #9aa2a2;
}

.wire::before,
.wire::after {
    content: "";
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.wire-pv {
    left: 50%;
    top: 110px;
    width: 3px;
    height: 96px;
    color: #f7aa19;
}

.wire-pv::before,
.wire-pv::after,
.wire-battery::before,
.wire-battery::after {
    left: -2px;
}

.wire-pv::before,
.wire-battery::before {
    top: -2px;
}

.wire-pv::after,
.wire-battery::after {
    bottom: -2px;
}

.wire-grid {
    left: 95px;
    right: calc(50% + 28px);
    top: 219px;
    height: 3px;
    color: #6ba4df;
}

.wire-load {
    left: calc(50% + 28px);
    right: 95px;
    top: 219px;
    height: 3px;
    color: #62d7c4;
}

.wire-grid::before,
.wire-load::before {
    left: -2px;
    top: -2px;
}

.wire-grid::after,
.wire-load::after {
    right: -2px;
    top: -2px;
}

.wire-battery {
    left: 50%;
    top: 246px;
    width: 3px;
    height: 86px;
    color: #ffb1ba;
}

.energy-map {
    min-height: 470px;
    grid-template-columns: minmax(126px, 1fr) minmax(160px, 1fr) minmax(126px, 1fr);
    grid-template-rows: 58px 126px 126px 130px;
    gap: 8px 18px;
    border-color: #303435;
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(28, 29, 29, 0.98), rgba(23, 24, 24, 0.98)),
        radial-gradient(circle at 72% 38%, rgba(44, 169, 137, 0.13), transparent 34%);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
}

.energy-map::before {
    content: "";
    position: absolute;
    inset: 18px;
    border-radius: 9px;
    background:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 92px 78px;
    opacity: 0.7;
    pointer-events: none;
}

.map-title {
    grid-column: 1 / -1;
    grid-row: 1;
    position: relative;
    z-index: 3;
    align-self: start;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.map-title h2 {
    margin: 0;
    color: #f5f7f7;
    font-size: clamp(20px, 2.2vw, 26px);
    line-height: 1.1;
}

.map-title span {
    margin-top: 4px;
    color: #a8b0b0;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.map-pv,
.map-grid,
.map-load,
.map-battery {
    width: 126px;
    height: 126px;
    border: 3px solid currentColor;
    border-radius: 999px;
    background:
        radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.08), transparent 44%),
        #141616;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.06),
        0 0 0 5px rgba(255, 255, 255, 0.025),
        0 12px 30px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-align: center;
}

.map-pv {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    justify-self: center;
    color: #f4a300;
}

.map-grid {
    grid-column: 1;
    grid-row: 3;
    align-self: center;
    justify-self: end;
    color: #4da3df;
}

.map-load {
    grid-column: 3;
    grid-row: 3;
    align-self: center;
    justify-self: start;
    color: #22c55e;
}

.map-battery {
    grid-column: 2;
    grid-row: 4;
    align-self: start;
    justify-self: center;
    color: #42d0bd;
}

.map-value {
    min-width: auto;
    min-height: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    color: #f7fbfb;
    font-size: 12px;
    line-height: 1.1;
}

.map-pv strong,
.map-grid strong,
.map-load strong,
.map-battery strong {
    color: #ffffff;
    font-size: 16px;
    line-height: 1.05;
}

.map-pv small,
.map-grid small,
.map-load small,
.map-battery small,
.map-pv em {
    max-width: 94px;
    color: #bec7c7;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.15;
    text-transform: none;
}

.map-icon {
    width: 32px;
    height: 28px;
    flex: 0 0 auto;
}

.pv-icon {
    width: 36px;
    height: 26px;
}

.pv-icon span,
.pv-icon b,
.pv-icon i {
    transform: scale(0.72);
    transform-origin: 50% 50%;
}

.grid-icon,
.home-icon {
    grid-column: auto;
    grid-row: auto;
    color: currentColor;
}

.grid-icon::before,
.grid-icon::after {
    left: 5px;
    width: 23px;
    border-top-width: 4px;
}

.grid-icon::before {
    top: 1px;
    box-shadow: -3px 9px 0 -1px currentColor, 3px 18px 0 -1px currentColor;
}

.grid-icon::after {
    top: 8px;
    height: 24px;
    border-left-width: 4px;
    border-right-width: 4px;
}

.home-icon::before {
    inset: 4px 3px 0;
}

.home-icon::after {
    display: none;
}

.map-center {
    grid-column: 2;
    grid-row: 3;
    align-self: center;
    justify-self: center;
    width: 92px;
    height: 92px;
    border: 2px solid #8f7cf4;
    border-radius: 999px;
    background:
        radial-gradient(circle, rgba(143, 124, 244, 0.18), transparent 58%),
        #151717;
    box-shadow: 0 0 0 5px rgba(143, 124, 244, 0.08), 0 12px 24px rgba(0, 0, 0, 0.24);
}

.map-inverter {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #242727;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.map-inverter span {
    left: 9px;
    top: 10px;
    width: 22px;
    height: 6px;
    border-radius: 999px;
    background: #d7dddd;
}

.map-inverter b {
    left: 12px;
    top: 19px;
    width: 18px;
    height: 18px;
    border-color: #d7dddd;
    border-left-color: transparent;
}

.map-inverter b::after {
    right: -5px;
    top: 8px;
    border-left-color: #d7dddd;
}

.map-note {
    top: auto;
    bottom: 12px;
    color: #aab3b3;
    font-size: 9px;
}

.map-note-left {
    right: calc(50% + 12px);
}

.map-note-right {
    left: calc(50% + 12px);
}

.battery-value,
.battery-meta,
.map-battery-icon,
.map-battery strong,
.map-battery small {
    grid-column: auto;
    grid-row: auto;
}

.battery-value {
    order: 3;
    margin: 0;
    color: #ffffff;
}

.battery-meta {
    order: 5;
    gap: 0;
    max-width: 96px;
    color: #aeb8b8;
    font-size: 9px;
    line-height: 1.2;
    text-align: center;
}

.map-battery-icon {
    order: 1;
    width: 20px;
    height: 32px;
    border-width: 2px;
    border-color: currentColor;
    border-radius: 3px;
    padding: 2px;
    background: #151717;
}

.map-battery-icon::before {
    left: 5px;
    top: -5px;
    width: 8px;
    height: 3px;
    background: currentColor;
}

.map-battery-icon span {
    background: linear-gradient(180deg, #72e3d2, #1fb7a4);
}

.wire {
    z-index: 1;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.74;
    box-shadow: 0 0 12px currentColor;
}

.wire::before,
.wire::after {
    width: 6px;
    height: 6px;
    background: currentColor;
}

.wire-pv {
    left: 50%;
    top: 178px;
    width: 2px;
    height: 72px;
    color: #f4a300;
}

.wire-grid {
    left: calc(50% - 196px);
    right: calc(50% + 46px);
    top: 284px;
    color: #4da3df;
}

.wire-load {
    left: calc(50% + 46px);
    right: calc(50% - 196px);
    top: 284px;
    color: #22c55e;
}

.wire-battery {
    left: 50%;
    top: 318px;
    width: 2px;
    height: 64px;
    color: #42d0bd;
}

.wire-pv::before,
.wire-pv::after,
.wire-battery::before,
.wire-battery::after {
    left: -2px;
}

.wire-grid::before,
.wire-load::before {
    left: -2px;
}

.wire-grid::after,
.wire-load::after {
    right: -2px;
}

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

.summary-panel > div {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.summary-panel span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.summary-panel strong {
    font-size: clamp(22px, 3vw, 34px);
}

.basic-band {
    margin-top: 22px;
    border-top: 1px solid var(--line);
    padding-top: 24px;
}

.basic-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 14px;
}

.basic-panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 18px;
    display: grid;
    gap: 16px;
}

.basic-action-panel {
    grid-column: 1 / -1;
}

.basic-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.basic-panel-head span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.basic-panel-head strong {
    color: var(--ink);
    font-size: clamp(21px, 2.5vw, 32px);
    line-height: 1.05;
    text-align: right;
}

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

.basic-stat-card {
    min-width: 0;
    border: 1px solid rgba(97, 112, 106, 0.18);
    border-radius: 8px;
    background: rgba(250, 252, 248, 0.72);
    padding: 13px;
    display: grid;
    gap: 6px;
}

.basic-stat-card span,
.basic-stat-card small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.basic-stat-card strong {
    color: var(--ink);
    font-size: clamp(18px, 2vw, 25px);
    line-height: 1.05;
}

.basic-bars {
    min-height: 192px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
    padding-top: 4px;
}

.basic-energy-bar {
    height: 186px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 8px;
    align-items: end;
    text-align: center;
}

.basic-energy-bar strong {
    min-height: 21px;
    font-size: 12px;
    white-space: nowrap;
}

.basic-energy-bar div {
    height: 126px;
    display: flex;
    align-items: end;
    justify-content: center;
}

.basic-energy-bar div span {
    display: block;
    width: min(100%, 42px);
    min-height: 6px;
    border-radius: 999px 999px 3px 3px;
    background: var(--load);
}

.basic-energy-bar.pv div span {
    background: var(--pv);
}

.basic-energy-bar.load div span {
    background: var(--load);
}

.basic-energy-bar.import div span {
    background: var(--grid);
}

.basic-energy-bar.export div span {
    background: var(--battery);
}

.basic-energy-bar small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.basic-action-choice {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.basic-action-choice button {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 900;
    padding: 9px 12px;
}

.basic-action-choice button.active,
.basic-action-choice button:hover,
.basic-action-choice button:focus-visible {
    border-color: rgba(45, 140, 127, 0.42);
    background: var(--ink);
    color: #ffffff;
    outline: none;
}

.basic-recommendation {
    border: 1px solid rgba(97, 112, 106, 0.18);
    border-left: 5px solid var(--load);
    border-radius: 8px;
    background: rgba(250, 252, 248, 0.78);
    padding: 15px;
    display: grid;
    gap: 8px;
}

.basic-recommendation span,
.basic-recommendation small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.basic-recommendation strong {
    color: var(--ink);
    font-size: clamp(20px, 2.2vw, 28px);
    line-height: 1.05;
}

.basic-recommendation p {
    margin: 0;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.45;
}

.basic-recommendation.sell {
    border-left-color: #33834d;
}

.basic-recommendation.battery {
    border-left-color: var(--battery);
}

.basic-recommendation.use {
    border-left-color: var(--load);
}

.basic-recommendation.neutral {
    border-left-color: #6f5cc2;
}

.daily-charts-band {
    margin-top: 22px;
    border-top: 1px solid var(--line);
    padding-top: 24px;
}

.daily-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1.1fr 1fr;
    gap: 14px;
}

.chart-panel {
    min-width: 0;
    min-height: 270px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
}

.chart-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.chart-card-head span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.chart-card-head strong {
    max-width: 60%;
    text-align: right;
    font-size: clamp(18px, 2.2vw, 26px);
    line-height: 1.1;
}

.data-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    padding: 0 12px;
    white-space: nowrap;
}

.data-pill.ok {
    border-color: rgba(51, 131, 77, 0.28);
    background: rgba(51, 131, 77, 0.1);
    color: #17613b;
}

.data-pill.error {
    border-color: rgba(180, 64, 70, 0.28);
    background: rgba(180, 64, 70, 0.1);
    color: var(--danger);
}

.data-pill.sell {
    border-color: rgba(51, 131, 77, 0.28);
    background: rgba(51, 131, 77, 0.1);
    color: #17613b;
}

.data-pill.battery {
    border-color: rgba(66, 208, 189, 0.34);
    background: rgba(66, 208, 189, 0.12);
    color: #0d6f64;
}

.data-pill.use {
    border-color: rgba(226, 169, 21, 0.32);
    background: rgba(226, 169, 21, 0.14);
    color: #6d5310;
}

.data-pill.discharge {
    border-color: rgba(51, 131, 77, 0.3);
    background: rgba(51, 131, 77, 0.12);
    color: #17613b;
}

.data-pill.charge {
    border-color: rgba(45, 140, 127, 0.3);
    background: rgba(45, 140, 127, 0.12);
    color: #17695f;
}

.data-pill.hold {
    border-color: rgba(226, 169, 21, 0.34);
    background: rgba(226, 169, 21, 0.14);
    color: #6d5310;
}

.data-pill.neutral {
    border-color: rgba(111, 92, 194, 0.24);
    background: rgba(111, 92, 194, 0.1);
    color: #4e4288;
}

.balance-chart {
    display: grid;
    gap: 16px;
}

.balance-row {
    display: grid;
    gap: 8px;
}

.balance-row-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.balance-row-head span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.balance-row-head strong {
    font-size: 18px;
}

.balance-track {
    height: 18px;
    border-radius: 999px;
    background: rgba(97, 112, 106, 0.14);
    overflow: hidden;
}

.balance-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--load);
}

.balance-row.export .balance-track span,
.balance-row.cost-out .balance-track span {
    background: var(--battery);
}

.balance-row.import .balance-track span,
.balance-row.cost-in .balance-track span {
    background: var(--grid);
}

.daily-energy-chart {
    min-height: 185px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
}

.daily-energy-bar {
    min-width: 0;
    height: 185px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 8px;
    align-items: end;
    text-align: center;
}

.daily-energy-bar strong {
    min-height: 22px;
    font-size: 13px;
    white-space: nowrap;
}

.daily-energy-bar div {
    height: 132px;
    min-height: 0;
    display: flex;
    align-items: end;
    justify-content: center;
}

.daily-energy-bar div span {
    display: block;
    width: min(100%, 44px);
    min-height: 6px;
    border-radius: 999px 999px 3px 3px;
    background: var(--load);
}

.daily-energy-bar.pv div span {
    background: var(--pv);
}

.daily-energy-bar.load div span {
    background: var(--load);
}

.daily-energy-bar.import div span {
    background: var(--grid);
}

.daily-energy-bar.export div span {
    background: var(--battery);
}

.daily-energy-bar small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.load-report-band {
    margin-top: 22px;
    border-top: 1px solid var(--line);
    padding-top: 24px;
}

.load-report-band[hidden],
.load-forecast-band[hidden] {
    display: none;
}

.load-forecast-band {
    margin-top: 22px;
    border-top: 1px solid var(--line);
    padding-top: 24px;
}

.load-report-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.load-date-picker {
    box-shadow: 0 8px 22px rgba(21, 30, 26, 0.08);
}

.load-report-tools .selected-range-pill {
    margin: 0;
}

.load-report-stats,
.load-forecast-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-top: 14px;
    margin-bottom: 16px;
}

.load-stat-card {
    min-width: 0;
    min-height: 118px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
}

.load-stat-card span,
.load-stat-card small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.load-stat-card strong {
    font-size: clamp(18px, 2.1vw, 27px);
    line-height: 1.12;
}

.load-forecast-chart {
    min-height: 360px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.93), rgba(244, 248, 246, 0.86)),
        linear-gradient(rgba(97, 112, 106, 0.08) 1px, transparent 1px);
    background-size: auto, 100% 64px;
    box-shadow: var(--shadow);
    padding: 18px 14px;
    overflow-x: auto;
}

.load-forecast-bars {
    min-width: 860px;
    min-height: 318px;
    display: grid;
    grid-template-columns: repeat(24, minmax(24px, 1fr));
    gap: 7px;
    align-items: end;
}

.load-forecast-bar {
    min-width: 0;
    min-height: 5px;
    border: 1px solid rgba(45, 140, 127, 0.28);
    border-radius: 8px 8px 3px 3px;
    background: linear-gradient(180deg, rgba(45, 140, 127, 0.86), rgba(32, 109, 98, 0.96));
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding: 8px 2px 5px;
    position: relative;
}

.load-forecast-bar.discharge-candidate {
    border-color: rgba(226, 169, 21, 0.9);
    background: linear-gradient(180deg, #e2a915, #9f720b);
    box-shadow: 0 0 0 2px rgba(226, 169, 21, 0.16);
}

.load-forecast-bar.discharge-candidate::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -12px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #e2a915;
    transform: translateX(-50%);
    box-shadow: 0 0 0 4px rgba(226, 169, 21, 0.18);
}

.load-forecast-bar span {
    display: none;
}

.load-forecast-bar strong {
    color: rgba(255, 255, 255, 0.95);
    font-size: 11px;
    font-weight: 900;
}

.load-forecast-bar small {
    max-width: 100%;
    color: rgba(255, 255, 255, 0.96);
    font-size: 9px;
    font-weight: 900;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.load-forecast-marker-row {
    background: rgba(226, 169, 21, 0.12);
}

.load-daily-chart,
.load-hourly-chart {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 18px 14px;
    overflow-x: auto;
}

.load-daily-chart {
    min-height: 260px;
    margin-bottom: 16px;
}

.load-hourly-chart {
    min-height: 340px;
}

.load-day-bars,
.load-hour-bars {
    display: grid;
    align-items: end;
    gap: 7px;
}

.load-day-bars {
    min-width: 720px;
    min-height: 220px;
    grid-template-columns: repeat(14, minmax(32px, 1fr));
}

.load-hour-bars {
    min-width: 860px;
    min-height: 304px;
    grid-template-columns: repeat(24, minmax(24px, 1fr));
}

.load-day-bar,
.load-hour-bar {
    min-width: 0;
    min-height: 5px;
    border: 0;
    border-radius: 8px 8px 3px 3px;
    background: linear-gradient(180deg, var(--load), #29756d);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding: 8px 2px 5px;
}

.load-day-bar {
    cursor: pointer;
}

.load-day-bar:hover,
.load-day-bar.active {
    outline: 2px solid var(--pv);
    outline-offset: 2px;
}

.load-day-bar.unavailable {
    opacity: 0.42;
    background: linear-gradient(180deg, #9da9a3, #74807a);
}

.load-day-bar.feed-in-adjusted,
.load-hour-bar.feed-in-adjusted {
    border: 1px solid rgba(226, 169, 21, 0.88);
    background: linear-gradient(180deg, #d09b10, #7c5b0b);
    box-shadow: 0 0 0 2px rgba(226, 169, 21, 0.14);
}

.load-feed-in-row {
    background: rgba(226, 169, 21, 0.12);
}

.load-day-bar span,
.load-hour-bar span {
    display: block;
    color: rgba(255, 255, 255, 0.98);
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.36);
    white-space: nowrap;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.load-hour-bar span {
    font-size: 9px;
}

.load-day-bar small,
.load-hour-bar strong {
    color: rgba(255, 255, 255, 0.94);
    font-size: 11px;
    font-weight: 800;
}

.load-table-wrap {
    max-height: 460px;
}

.hourly-details {
    margin-top: 16px;
}

.hourly-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 8px 24px rgba(21, 30, 26, 0.07);
    padding: 12px 14px;
    color: var(--ink);
    cursor: pointer;
    list-style: none;
}

.hourly-details summary::-webkit-details-marker {
    display: none;
}

.hourly-details summary::after {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--ink);
    font-size: 20px;
    font-weight: 800;
}

.hourly-details[open] summary::after {
    content: "-";
}

.hourly-details summary span {
    font-size: 15px;
    font-weight: 900;
}

.hourly-details summary small {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.hourly-details[open] summary {
    margin-bottom: 14px;
    border-color: rgba(90, 170, 154, 0.42);
    background: rgba(239, 248, 245, 0.92);
}

.hourly-details .load-hourly-chart,
.hourly-details .hourly-chart,
.hourly-details .price-report-chart,
.hourly-details .sell-chart {
    margin-bottom: 16px;
}

.hour-window-controls {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 10px;
}

.hour-window-button {
    border: 1px solid rgba(90, 170, 154, 0.36);
    border-radius: 999px;
    background: rgba(239, 248, 245, 0.94);
    color: var(--ink);
    cursor: pointer;
    font-size: 12px;
    font-weight: 900;
    padding: 8px 12px;
}

.hour-window-button:hover,
.hour-window-button:focus-visible {
    border-color: rgba(90, 170, 154, 0.72);
    box-shadow: 0 0 0 3px rgba(90, 170, 154, 0.16);
    outline: none;
}

.is-hour-hidden {
    display: none !important;
}

.weather-band {
    margin-top: 22px;
    border-top: 1px solid var(--line);
    padding-top: 24px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 246, 0.96));
    border: 1px solid rgba(190, 206, 198, 0.78);
    box-shadow: 0 14px 36px rgba(21, 30, 26, 0.1);
    padding: 22px;
}

.weather-band[hidden] {
    display: none;
}

.weather-head-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.weather-band .section-head h2 {
    color: #101816;
    font-size: clamp(24px, 3.2vw, 36px);
    font-weight: 900;
}

.weather-band .eyebrow {
    color: #2d6f66;
}

.range-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(45, 140, 127, 0.28);
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(21, 30, 26, 0.1);
    padding: 2px 2px 2px 14px;
}

.range-picker label {
    color: #7d5f48;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
}

.range-picker select,
.range-picker input {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    color: #111816;
    font: inherit;
    font-weight: 700;
    padding: 0 12px;
}

.range-picker select {
    min-width: 118px;
    cursor: pointer;
}

.range-picker input {
    min-width: 168px;
}

.date-stepper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.range-picker button {
    min-height: 42px;
    border: 1px solid rgba(215, 199, 179, 0.9);
    border-radius: 999px;
    background: #f5eee4;
    color: #211914;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0 18px;
}

.range-picker button:hover {
    background: #efe2d2;
}

.range-picker .date-step-button {
    width: 42px;
    min-width: 42px;
    padding: 0;
    border-color: rgba(45, 140, 127, 0.28);
    background: #f8fcfa;
    color: #163b36;
    font-size: 22px;
    line-height: 1;
}

.range-picker .date-step-button:hover {
    background: #edf8f5;
}

.range-picker .date-step-button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.selected-range-pill {
    display: inline-flex;
    align-items: center;
    min-height: 46px;
    border-radius: 18px;
    border: 1px solid rgba(45, 140, 127, 0.26);
    background: rgba(45, 140, 127, 0.12);
    color: var(--ink);
    font-size: 17px;
    font-weight: 800;
    margin: 0 0 14px;
    padding: 0 16px;
}

.weather-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.weather-stat-card {
    min-width: 0;
    min-height: 118px;
    border: 1px solid rgba(190, 206, 198, 0.9);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 12px 30px rgba(21, 30, 26, 0.12);
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
}

.weather-stat-card span,
.weather-stat-card small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.weather-stat-card strong {
    color: #111816;
    font-size: clamp(22px, 2.6vw, 32px);
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.weather-chart {
    min-height: 360px;
    border: 1px solid rgba(190, 206, 198, 0.9);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 12px 30px rgba(21, 30, 26, 0.12);
    padding: 18px 14px;
    overflow-x: auto;
}

.weather-bars {
    min-width: 980px;
    min-height: 324px;
    display: grid;
    gap: 6px;
    align-items: stretch;
}

.weather-bar {
    min-width: 0;
    min-height: 0;
    height: 100%;
    border-radius: 8px 8px 3px 3px;
    background: rgba(95, 109, 103, 0.16);
    color: #ffffff;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    padding: 8px 2px 5px;
}

.weather-forecast-fill,
.weather-actual-fill {
    position: absolute;
    bottom: 0;
    display: block;
}

.weather-forecast-fill {
    left: 0;
    right: 0;
    height: var(--forecast-height, 0%);
    border-radius: 8px 8px 3px 3px;
    background: var(--muted);
}

.weather-actual-fill {
    left: 5px;
    right: 5px;
    height: var(--actual-height, 0%);
    border: 2px solid rgba(255, 255, 255, 0.92);
    border-bottom: 0;
    border-radius: 7px 7px 2px 2px;
    background: #17201d;
    box-shadow: 0 -6px 14px rgba(23, 32, 29, 0.16);
}

.weather-bar.high .weather-forecast-fill {
    background: linear-gradient(180deg, var(--pv), #c79213);
}

.weather-bar.medium .weather-forecast-fill {
    background: linear-gradient(180deg, var(--load), #307d85);
}

.weather-bar.low .weather-forecast-fill {
    background: linear-gradient(180deg, #93a19b, #6f7d77);
}

.weather-bar.rain .weather-forecast-fill {
    background: linear-gradient(180deg, var(--grid), #5c539d);
}

.weather-bar.current {
    outline: 2px solid var(--battery);
    outline-offset: 2px;
}

.weather-bar span {
    display: none;
    position: absolute;
}

.weather-bar strong {
    font-size: 11px;
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 3px rgba(23, 32, 29, 0.4);
}

.weather-bar small {
    color: rgba(255, 255, 255, 0.92);
    font-size: 9px;
    font-weight: 800;
    position: relative;
    z-index: 2;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-shadow: 0 1px 3px rgba(23, 32, 29, 0.45);
}

.weather-table-wrap {
    max-height: 460px;
    border-color: rgba(190, 206, 198, 0.9);
    box-shadow: 0 10px 26px rgba(21, 30, 26, 0.08);
}

.supla-band {
    margin-top: 22px;
    border-top: 1px solid var(--line);
    padding-top: 24px;
}

.supla-band[hidden] {
    display: none;
}

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

.supla-card {
    min-width: 0;
    min-height: 132px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.supla-card span,
.supla-card small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.supla-card strong {
    font-size: clamp(21px, 2.5vw, 31px);
    line-height: 1.1;
}

.supla-phase-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.supla-phase-card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    padding: 14px;
    display: grid;
    gap: 10px;
}

.supla-phase-card > strong {
    font-size: 18px;
}

.supla-phase-card div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid rgba(215, 222, 217, 0.72);
    padding-top: 9px;
}

.supla-phase-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.supla-phase-card b {
    text-align: right;
    font-size: 16px;
}

.sell-plan-band {
    margin-top: 22px;
    border-top: 1px solid var(--line);
    padding-top: 24px;
}

.sell-context-grid,
.sell-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.sell-stats-grid {
    margin-top: 12px;
}

.sell-plan-details {
    margin-top: 12px;
}

.sell-decision-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--grid);
    border-radius: 8px;
    background: color-mix(in srgb, var(--panel) 94%, var(--grid) 6%);
    box-shadow: var(--shadow);
    padding: 14px;
}

.sell-decision-card.automation-off {
    border-left-color: var(--muted);
    background: color-mix(in srgb, var(--panel) 94%, var(--muted) 6%);
}

.sell-decision-card.sell {
    border-left-color: var(--battery);
    background: color-mix(in srgb, var(--panel) 92%, var(--battery) 8%);
}

.sell-decision-card.use {
    border-left-color: var(--pv);
    background: color-mix(in srgb, var(--panel) 92%, var(--pv) 8%);
}

.sell-decision-card.discharge {
    border-left-color: var(--battery);
    background: color-mix(in srgb, var(--panel) 90%, var(--battery) 10%);
}

.sell-decision-card.charge {
    border-left-color: var(--load);
    background: color-mix(in srgb, var(--panel) 90%, var(--load) 10%);
}

.sell-decision-card.hold {
    border-left-color: var(--pv);
    background: color-mix(in srgb, var(--panel) 90%, var(--pv) 10%);
}

.sell-decision-card div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sell-decision-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.sell-decision-card strong {
    font-size: clamp(17px, 1.8vw, 24px);
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.sell-decision-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.sell-control-card {
    align-items: flex-start;
}

.sell-control-toggle {
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #ffffff;
    background: var(--muted);
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    padding: 11px 16px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(21, 30, 26, 0.12);
}

.sell-control-toggle.enabled {
    background: var(--battery);
}

.sell-control-toggle.disabled {
    background: var(--danger);
}

.sell-decision-card .battery-action-choice {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
}

.battery-action-choice button {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    padding: 7px 9px;
}

.battery-action-choice button.active,
.battery-action-choice button:hover,
.battery-action-choice button:focus-visible {
    border-color: rgba(45, 140, 127, 0.42);
    background: var(--ink);
    color: #ffffff;
    outline: none;
}

.sell-context-card,
.sell-stat-card {
    min-width: 0;
    min-height: 116px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
}

.sell-context-card span,
.sell-context-card small,
.sell-stat-card span,
.sell-stat-card small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.sell-context-card strong,
.sell-stat-card strong {
    font-size: clamp(18px, 2.1vw, 26px);
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.sell-battery-chart {
    margin-top: 14px;
}

.sell-battery-plan {
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(244, 248, 246, 0.96), rgba(255, 255, 255, 0.98)),
        var(--panel);
    box-shadow: var(--shadow);
    padding: 16px 14px;
    overflow-x: auto;
}

.sell-battery-head {
    min-width: 920px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.sell-battery-head div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sell-battery-head span,
.sell-battery-head small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.sell-battery-head strong {
    color: var(--ink);
    font-size: clamp(20px, 2vw, 30px);
    line-height: 1.05;
}

.sell-window-controls {
    align-items: center;
    text-align: center;
}

.sell-window-controls strong {
    font-size: 14px;
    line-height: 1.2;
}

.sell-window-controls button {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--panel) 86%, var(--load) 14%);
    color: var(--ink);
    font-weight: 900;
    padding: 8px 12px;
    cursor: pointer;
}

.sell-window-controls button:disabled {
    cursor: default;
    opacity: 0.45;
}

.sell-battery-bars {
    min-width: 920px;
    min-height: 190px;
    display: grid;
    grid-template-columns: repeat(24, minmax(26px, 1fr));
    gap: 7px;
    align-items: end;
    border-top: 1px dashed rgba(97, 112, 106, 0.36);
    border-bottom: 1px dashed rgba(97, 112, 106, 0.24);
    padding-top: 18px;
    position: relative;
}

.sell-battery-bar {
    min-height: 12px;
    border-radius: 8px 8px 3px 3px;
    background: rgba(97, 112, 106, 0.18);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 7px 2px 5px;
}

.sell-battery-bar.discharge {
    background: linear-gradient(180deg, var(--battery), #64ad70);
    box-shadow: 0 10px 20px rgba(51, 131, 77, 0.18);
}

.sell-battery-bar.charge {
    background: linear-gradient(180deg, var(--load), #44b7aa);
}

.sell-battery-bar.surplus {
    background: linear-gradient(180deg, var(--grid), #7b6ed0);
}

.sell-battery-bar.hold {
    background: linear-gradient(180deg, var(--pv), #c99519);
}

.sell-battery-bar span {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    padding: 2px 5px;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
}

.sell-battery-bar strong {
    font-size: 12px;
}

.sell-battery-axis {
    min-width: 920px;
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    padding-top: 8px;
}

.sell-linechart {
    min-width: 920px;
    padding-top: 8px;
}

.sell-linechart svg {
    display: block;
    width: 100%;
    min-width: 920px;
    height: auto;
    overflow: visible;
}

.sell-line-grid {
    stroke: rgba(97, 112, 106, 0.24);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.sell-line-grid.soft {
    stroke: rgba(97, 112, 106, 0.14);
}

.sell-line-path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3.5;
    vector-effect: non-scaling-stroke;
}

.sell-line-path.price {
    stroke: var(--grid);
}

.sell-line-path.energy {
    stroke: var(--battery);
}

.sell-line-path.discharge {
    stroke: var(--load);
    stroke-width: 2.4;
}

.sell-line-path.charge-plan {
    stroke: var(--pv);
    stroke-width: 2.6;
    stroke-dasharray: 3 7;
}

.sell-line-path.soc {
    stroke: #8b6510;
    stroke-width: 3;
}

.sell-line-area.energy {
    fill: rgba(51, 131, 77, 0.13);
    stroke: none;
}

.sell-line-threshold {
    fill: none;
    stroke-dasharray: 8 7;
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.sell-line-threshold.sell {
    stroke: rgba(51, 131, 77, 0.86);
}

.sell-line-threshold.charge {
    stroke: rgba(45, 140, 127, 0.82);
}

.sell-line-point {
    fill: var(--grid);
    stroke: #ffffff;
    stroke-width: 2;
    cursor: help;
    vector-effect: non-scaling-stroke;
}

.sell-line-point.sell,
.sell-line-point.surplus,
.sell-line-point.discharge {
    fill: var(--battery);
}

.sell-line-point.charge,
.sell-line-point.use,
.sell-line-point.energy {
    fill: var(--load);
}

.sell-line-point.hold {
    fill: var(--pv);
}

.sell-line-point.soc {
    fill: #8b6510;
}

.sell-line-point.charge-plan {
    fill: var(--pv);
}

.sell-line-point.neutral {
    fill: var(--grid);
}

.sell-line-axis,
.sell-line-value {
    fill: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.sell-line-value {
    fill: var(--ink);
    font-size: 11px;
}

.sell-line-axis.soc-axis {
    fill: #8b6510;
    font-size: 11px;
}

.sell-line-legend {
    min-width: 920px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    align-items: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    padding-top: 8px;
}

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

.sell-line-legend i {
    width: 22px;
    height: 3px;
    border-radius: 999px;
    background: var(--grid);
}

.sell-line-legend i.energy,
.sell-line-legend i.sell {
    background: var(--battery);
}

.sell-line-legend i.discharge {
    background: var(--load);
}

.sell-line-legend i.charge-plan {
    background: var(--pv);
}

.sell-line-legend i.charge {
    background: var(--load);
}

.sell-line-legend i.hold {
    background: var(--pv);
}

.sell-line-legend i.soc {
    background: #8b6510;
}

.sell-chart {
    min-height: 360px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 18px 14px;
    margin-top: 16px;
    overflow-x: auto;
}

.sell-bars {
    min-width: 920px;
    min-height: 324px;
    display: grid;
    grid-template-columns: repeat(24, minmax(26px, 1fr));
    gap: 7px;
    align-items: end;
    position: relative;
}

.sell-bars::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: var(--baseline, 0%);
    border-top: 1px dashed rgba(97, 112, 106, 0.55);
}

.sell-bar {
    min-width: 0;
    min-height: 6px;
    border-radius: 8px 8px 3px 3px;
    background: var(--load);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
    padding: 8px 2px 5px;
    position: relative;
    z-index: 1;
}

.sell-bar.sell {
    background: linear-gradient(180deg, var(--battery), #69ad73);
}

.sell-bar.use {
    background: linear-gradient(180deg, var(--pv), #b58a1d);
}

.sell-bar.discharge {
    background: linear-gradient(180deg, var(--battery), #64ad70);
}

.sell-bar.charge {
    background: linear-gradient(180deg, var(--load), #44b7aa);
}

.sell-bar.hold {
    background: linear-gradient(180deg, var(--pv), #c99519);
}

.sell-bar.neutral {
    background: linear-gradient(180deg, var(--grid), var(--load));
}

.sell-bar span {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    padding: 2px 5px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.sell-bar strong {
    font-size: 13px;
}

.sell-bar small {
    max-width: 100%;
    color: rgba(255, 255, 255, 0.92);
    font-size: 10px;
    font-weight: 700;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.sell-table-wrap {
    max-height: 460px;
}

.sell-row-sell {
    background: rgba(51, 131, 77, 0.08);
}

.sell-row-use {
    background: rgba(226, 169, 21, 0.1);
}

.sell-row-discharge {
    background: rgba(51, 131, 77, 0.1);
}

.sell-row-charge {
    background: rgba(45, 140, 127, 0.09);
}

.sell-row-hold {
    background: rgba(226, 169, 21, 0.08);
}

.battery-band,
.tariff-band,
.forecast-band,
.info-tabs-band,
.config-band {
    margin-top: 22px;
    border-top: 1px solid var(--line);
    padding-top: 24px;
}

.battery-dashboard {
    display: grid;
    grid-template-columns: minmax(260px, 0.85fr) minmax(420px, 1.6fr);
    gap: 14px;
    align-items: stretch;
}

.battery-hero-card,
.battery-kpi-card,
.battery-plan-card,
.battery-entity-card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.battery-hero-card {
    min-height: 320px;
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    gap: 18px;
    padding: 18px;
}

.battery-hero-head,
.battery-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.battery-hero-head span,
.battery-card-head span,
.battery-kpi-card span,
.battery-kpi-card small,
.battery-card-head small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.battery-hero-head strong {
    color: var(--ink);
    font-size: clamp(34px, 5vw, 62px);
    line-height: 0.95;
}

.battery-soc-meter {
    align-self: center;
    height: 74px;
    border: 1px solid rgba(45, 140, 127, 0.28);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(180, 64, 70, 0.12), rgba(226, 169, 21, 0.12), rgba(51, 131, 77, 0.12)),
        rgba(244, 248, 246, 0.9);
    padding: 8px;
    position: relative;
    overflow: hidden;
}

.battery-soc-meter::after {
    content: "";
    position: absolute;
    inset: 14px;
    border: 1px dashed rgba(97, 112, 106, 0.16);
    border-radius: 6px;
    pointer-events: none;
}

.battery-soc-meter span {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #46c4ad, var(--battery));
    box-shadow: 0 10px 24px rgba(51, 131, 77, 0.22);
    transition: width 220ms ease;
}

.battery-mode-pill {
    justify-self: start;
    border: 1px solid rgba(45, 140, 127, 0.25);
    border-radius: 999px;
    background: rgba(45, 140, 127, 0.08);
    color: var(--ink);
    font-size: 13px;
    font-weight: 900;
    padding: 8px 12px;
}

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

.battery-kpi-card {
    min-height: 126px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding: 15px;
}

.battery-kpi-card strong {
    color: var(--ink);
    font-size: clamp(20px, 2.2vw, 30px);
    line-height: 1.05;
}

.battery-kpi-card .battery-hover-panel span,
.battery-kpi-card .battery-hover-panel small {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    text-transform: none;
}

.battery-kpi-card .battery-hover-panel .metric-hover-head span,
.battery-kpi-card .battery-hover-panel .metric-hover-content small,
.battery-kpi-card .battery-hover-panel .metric-hover-empty {
    color: #aab6b3;
    font-size: 12px;
    font-weight: 800;
}

.battery-kpi-card .battery-hover-panel .metric-hover-head strong {
    color: #ffffff;
}

.battery-plan-card,
.battery-entity-card {
    grid-column: 1 / -1;
    padding: 16px;
}

.battery-card-head strong {
    display: block;
    color: var(--ink);
    font-size: 20px;
    line-height: 1.1;
    margin-top: 4px;
}

.battery-plan-hours {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 32px;
    margin: 10px 0 14px;
}

.battery-plan-hours span {
    border: 1px solid rgba(226, 169, 21, 0.45);
    border-radius: 999px;
    background: rgba(226, 169, 21, 0.12);
    color: #7a5708;
    font-size: 13px;
    font-weight: 900;
    padding: 7px 10px;
}

.battery-plan-chart {
    min-height: 210px;
    display: grid;
    grid-template-columns: repeat(24, minmax(22px, 1fr));
    gap: 6px;
    align-items: end;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(rgba(97, 112, 106, 0.08) 1px, transparent 1px),
        rgba(244, 248, 246, 0.82);
    background-size: 100% 52px, auto;
    overflow-x: auto;
    padding: 16px 12px;
}

.battery-plan-bar {
    min-width: 0;
    min-height: 6px;
    border: 1px solid rgba(45, 140, 127, 0.22);
    border-radius: 8px 8px 3px 3px;
    background: linear-gradient(180deg, rgba(45, 140, 127, 0.75), rgba(32, 109, 98, 0.94));
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    padding: 7px 2px 5px;
}

.battery-plan-bar.discharge-candidate {
    border-color: rgba(226, 169, 21, 0.92);
    background: linear-gradient(180deg, #e2a915, #9f720b);
    box-shadow: 0 0 0 2px rgba(226, 169, 21, 0.14);
}

.battery-plan-bar strong {
    color: #ffffff;
    font-size: 10px;
    font-weight: 900;
}

.battery-plan-bar small {
    color: rgba(255, 255, 255, 0.96);
    font-size: 8px;
    font-weight: 900;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.battery-entity-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0 0;
}

.battery-entity-row {
    border: 1px solid rgba(97, 112, 106, 0.15);
    border-radius: 8px;
    background: rgba(244, 248, 246, 0.76);
    display: grid;
    gap: 7px;
    margin: 0;
    padding: 12px;
}

.battery-entity-row.error {
    border-color: rgba(180, 64, 70, 0.32);
    background: rgba(180, 64, 70, 0.08);
}

.battery-entity-row dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.battery-entity-row dd {
    display: grid;
    gap: 5px;
    margin: 0;
}

.battery-entity-row strong {
    color: var(--ink);
    font-size: 18px;
}

.battery-entity-row code {
    color: var(--ink);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.battery-entity-row small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.battery-status-discharge {
    border-color: rgba(226, 169, 21, 0.42);
    background: rgba(226, 169, 21, 0.14);
}

.battery-status-charge {
    border-color: rgba(70, 196, 173, 0.36);
    background: rgba(70, 196, 173, 0.12);
}

.battery-status-idle {
    border-color: rgba(97, 112, 106, 0.22);
    background: rgba(97, 112, 106, 0.08);
}

.info-tabs-band {
    color: var(--ink);
}

.info-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    padding: 4px;
}

.info-tab-button {
    min-height: 38px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 900;
    padding: 0 15px;
}

.info-tab-button.active {
    background: var(--ink);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(21, 30, 26, 0.16);
}

.info-tab-button:focus-visible {
    outline: 3px solid rgba(45, 140, 127, 0.25);
    outline-offset: 2px;
}

.info-panel {
    margin-top: 14px;
}

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

.info-card {
    min-height: 168px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 26px rgba(21, 30, 26, 0.07);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.info-card strong {
    color: var(--ink);
    font-size: 18px;
    line-height: 1.15;
}

.info-card p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.info-card code {
    border: 1px solid rgba(97, 112, 106, 0.18);
    border-radius: 6px;
    background: rgba(244, 248, 246, 0.92);
    color: var(--ink);
    font-size: 12px;
    padding: 2px 5px;
}

.dashboard-settings-form {
    margin-bottom: 22px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.settings-card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 26px rgba(21, 30, 26, 0.07);
    display: grid;
    gap: 9px;
    align-content: start;
    margin: 0;
    padding: 16px;
}

.settings-card.entity-map-card {
    grid-column: 1 / -1;
    padding: 18px;
}

.settings-card legend {
    color: var(--ink);
    font-size: 17px;
    font-weight: 900;
    padding: 0 4px;
}

.settings-note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
}

.settings-card label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.settings-card input,
.settings-card select {
    min-width: 0;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    padding: 0 11px;
}

.settings-card input:disabled,
.settings-card select:disabled {
    background: rgba(239, 244, 242, 0.8);
    color: rgba(31, 43, 38, 0.48);
    cursor: not-allowed;
}

.entity-map-actions {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.2fr) auto auto;
    align-items: end;
    gap: 10px;
    border: 1px solid rgba(45, 140, 127, 0.18);
    border-radius: 8px;
    background: rgba(239, 248, 245, 0.56);
    padding: 10px;
}

.entity-map-actions label:not(.settings-check) {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.entity-map-actions select {
    width: 100%;
    min-height: 38px;
}

.entity-map-actions input {
    width: 100%;
}

.entity-map-actions button {
    min-height: 38px;
    border: 1px solid rgba(45, 140, 127, 0.32);
    border-radius: 999px;
    background: rgba(239, 248, 245, 0.96);
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    padding: 0 14px;
}

.entity-map-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(320px, 1fr));
    gap: 12px;
}

.entity-map-grid label {
    min-width: 0;
    border: 1px solid rgba(97, 112, 106, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.74);
    display: grid;
    gap: 6px;
    line-height: 1.25;
    overflow: hidden;
    padding: 10px;
}

.entity-map-grid input,
.entity-map-grid select {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.control-state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.control-state-grid label {
    min-width: 0;
    border: 1px solid rgba(97, 112, 106, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.74);
    display: grid;
    gap: 6px;
    line-height: 1.25;
    padding: 10px;
}

.control-state-grid input {
    width: 100%;
}

.entity-field-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 6px;
    align-items: stretch;
}

.entity-field-control input {
    min-width: 0;
}

.entity-pick-button {
    width: 40px;
    min-height: 38px;
    border: 1px solid rgba(45, 140, 127, 0.34);
    border-radius: 8px;
    background: rgba(239, 248, 245, 0.96);
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    line-height: 1;
}

.entity-pick-button:hover,
.entity-pick-button:focus-visible {
    border-color: rgba(45, 140, 127, 0.72);
    outline: none;
}

.entity-suggestion-hint {
    min-height: 16px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.entity-picker-panel {
    border: 1px solid rgba(45, 140, 127, 0.28);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 14px 36px rgba(18, 32, 27, 0.12);
    padding: 10px;
    display: grid;
    gap: 8px;
}

.entity-picker-panel strong {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--muted);
}

.entity-picker-panel span {
    color: var(--muted);
    font-size: 12px;
}

.entity-picker-list {
    max-height: 260px;
    overflow-y: auto;
    display: grid;
    gap: 6px;
}

.entity-picker-list button {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(250, 252, 251, 0.96);
    padding: 8px;
    text-align: left;
    cursor: pointer;
    display: grid;
    gap: 3px;
}

.entity-picker-list button:hover,
.entity-picker-list button:focus-visible {
    border-color: rgba(45, 140, 127, 0.7);
    background: rgba(239, 248, 245, 0.96);
    outline: none;
}

.entity-picker-list button.suggested {
    border-color: rgba(229, 173, 18, 0.72);
    background: linear-gradient(180deg, rgba(255, 249, 229, 0.98), rgba(255, 255, 255, 0.96));
}

.entity-picker-list button.selected {
    border-color: rgba(45, 140, 127, 0.9);
    background: rgba(220, 243, 238, 0.96);
    box-shadow: inset 4px 0 0 rgba(45, 140, 127, 0.9);
}

.entity-picker-list code {
    overflow-wrap: anywhere;
    font-size: 12px;
    font-weight: 900;
}

.entity-picker-list span {
    overflow-wrap: anywhere;
}

.entity-picker-list em {
    color: #8a6400;
    font-size: 10px;
    font-style: normal;
    font-weight: 900;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.settings-card .settings-check {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
}

.settings-card .settings-check input {
    width: 17px;
    height: 17px;
    min-height: 0;
    accent-color: var(--load);
}

.settings-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
}

.settings-actions p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.settings-actions code {
    border: 1px solid rgba(97, 112, 106, 0.18);
    border-radius: 6px;
    background: rgba(244, 248, 246, 0.92);
    color: var(--ink);
    font-size: 12px;
    padding: 1px 5px;
}

.settings-actions button {
    min-height: 42px;
    border: 1px solid rgba(45, 140, 127, 0.32);
    border-radius: 999px;
    background: rgba(239, 248, 245, 0.96);
    color: var(--ink);
    cursor: pointer;
    flex: 0 0 auto;
    font: inherit;
    font-weight: 900;
    padding: 0 18px;
}

.settings-actions button:hover,
.settings-actions button:focus-visible {
    border-color: rgba(45, 140, 127, 0.72);
    box-shadow: 0 0 0 3px rgba(45, 140, 127, 0.13);
    outline: none;
}

.tenant-admin-panel {
    margin: 24px 0;
}

.tenant-summary-grid,
.tenant-admin-grid,
.tenant-lists-grid {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.tenant-summary-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.tenant-summary-card,
.tenant-form,
.tenant-list-card,
.tenant-pairing-box,
.tenant-credentials-box {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 24px rgba(21, 30, 26, 0.07);
}

.tenant-summary-card {
    display: grid;
    gap: 6px;
    padding: 14px;
}

.tenant-summary-card span,
.tenant-row span,
.tenant-row small,
.tenant-pairing-box span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.tenant-summary-card strong {
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
}

.tenant-admin-grid,
.tenant-lists-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tenant-form {
    display: grid;
    gap: 10px;
    padding: 16px;
}

.tenant-form h4,
.tenant-list-head h4 {
    margin: 0;
    color: var(--ink);
    font-size: 17px;
}

.tenant-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.tenant-form input,
.tenant-form select {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    padding: 0 11px;
}

.tenant-form .settings-check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-size: 13px;
    letter-spacing: 0;
    text-transform: none;
}

.tenant-form .settings-check input {
    width: 17px;
    height: 17px;
    min-height: 0;
    accent-color: var(--load);
}

.tenant-inline-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tenant-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tenant-form button {
    min-height: 42px;
    border: 1px solid rgba(45, 140, 127, 0.32);
    border-radius: 999px;
    background: rgba(239, 248, 245, 0.96);
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    padding: 0 16px;
}

.tenant-form-actions button {
    flex: 1 1 150px;
}

.tenant-form button:hover,
.tenant-form button:focus-visible {
    border-color: rgba(45, 140, 127, 0.72);
    box-shadow: 0 0 0 3px rgba(45, 140, 127, 0.13);
    outline: none;
}

.tenant-pairing-box,
.tenant-credentials-box {
    display: grid;
    gap: 8px;
    margin-top: 14px;
    padding: 16px;
}

.tenant-pairing-box strong,
.tenant-credentials-box strong {
    color: var(--ink);
    font-size: 22px;
    overflow-wrap: anywhere;
}

.tenant-pairing-box p,
.tenant-credentials-box p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.tenant-pairing-box code,
.tenant-credentials-box code {
    overflow-wrap: anywhere;
}

.tenant-credentials-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.tenant-credentials-head div {
    display: grid;
    gap: 5px;
}

.tenant-credentials-head span,
.tenant-new-secret span,
.tenant-secret-row span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.tenant-credentials-head button,
.tenant-row-action {
    min-height: 34px;
    border: 1px solid rgba(45, 140, 127, 0.32);
    border-radius: 999px;
    background: rgba(239, 248, 245, 0.96);
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    padding: 0 12px;
}

.tenant-credentials-head button:hover,
.tenant-credentials-head button:focus-visible,
.tenant-row-action:hover,
.tenant-row-action:focus-visible {
    border-color: rgba(45, 140, 127, 0.72);
    box-shadow: 0 0 0 3px rgba(45, 140, 127, 0.13);
    outline: none;
}

.tenant-new-secret {
    display: grid;
    gap: 6px;
    border: 1px solid rgba(226, 169, 21, 0.35);
    border-radius: 8px;
    background: rgba(255, 249, 233, 0.76);
    padding: 12px;
}

.tenant-new-secret strong {
    font-size: 20px;
}

.tenant-secret-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.tenant-secret-row {
    min-width: 0;
    display: grid;
    gap: 5px;
    border: 1px solid rgba(97, 112, 106, 0.14);
    border-radius: 8px;
    background: rgba(248, 251, 249, 0.9);
    padding: 10px;
}

.tenant-secret-row code {
    color: var(--ink);
    font-size: 12px;
    line-height: 1.35;
}

.tenant-secret-note {
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.tenant-list-card {
    padding: 14px;
}

.tenant-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.tenant-list-head span {
    border: 1px solid rgba(45, 140, 127, 0.2);
    border-radius: 999px;
    background: rgba(239, 248, 245, 0.9);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    padding: 5px 9px;
}

.tenant-list {
    display: grid;
    gap: 8px;
}

.tenant-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(97, 112, 106, 0.14);
    border-radius: 8px;
    background: rgba(248, 251, 249, 0.9);
    padding: 10px;
}

.tenant-row div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.tenant-row strong {
    min-width: 0;
    color: var(--ink);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tenant-row small {
    display: grid;
    gap: 2px;
    text-align: right;
}

.tenant-row em {
    color: var(--muted);
    font-style: normal;
    font-weight: 700;
}

.tenant-instance-row[data-status="online"] {
    border-color: rgba(33, 158, 101, 0.42);
}

.tenant-instance-row[data-status="offline"] {
    border-color: rgba(216, 95, 112, 0.42);
}

.tenant-instance-row[data-status="waiting"] {
    border-color: rgba(226, 166, 27, 0.44);
}

.tenant-instance-row[data-status="dane gotowe"] {
    border-color: rgba(39, 145, 133, 0.32);
}

.config-entity-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    border-top: 1px solid var(--line);
    padding-top: 18px;
}

.unused-entity-head {
    margin-top: 28px;
}

.config-entity-head h3 {
    margin: 0;
    color: var(--ink);
    font-size: 22px;
    line-height: 1.12;
}

.config-band {
    color: var(--muted);
}

.config-band summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    cursor: pointer;
    list-style: none;
}

.config-band summary::-webkit-details-marker {
    display: none;
}

.config-band summary::after {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font-size: 22px;
    font-weight: 700;
    flex: 0 0 auto;
}

.config-band[open] summary::after {
    content: "-";
}

.entity-count {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    padding: 0 10px;
    margin-left: auto;
    white-space: nowrap;
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}

.refresh-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    cursor: pointer;
    font-weight: 700;
}

.refresh-button:hover {
    border-color: #9ca9a3;
}

.day-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.day-tab {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    cursor: pointer;
    font-weight: 700;
    padding: 0 12px;
}

.day-tab.active {
    border-color: rgba(45, 140, 127, 0.45);
    background: rgba(45, 140, 127, 0.12);
}

.day-tab.unavailable {
    color: var(--muted);
    opacity: 0.58;
}

.plain-link {
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
}

.plain-link:hover {
    text-decoration: underline;
}

.diagnostics-panel {
    border-top: 1px solid var(--line);
    padding-top: 24px;
}

.search-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-form input {
    width: min(360px, 48vw);
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    font: inherit;
}

.hourly-chart {
    display: grid;
    grid-template-columns: repeat(24, minmax(20px, 1fr));
    gap: 5px;
    min-height: 190px;
    align-items: end;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 18px 12px 12px;
}

.module-note {
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.hour-bar {
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.hour-bar span {
    width: 100%;
    min-height: 4px;
    border-radius: 999px 999px 2px 2px;
    background: var(--load);
}

.hour-bar.negative span {
    background: var(--battery);
}

.hour-bar.current span {
    outline: 2px solid var(--pv);
    outline-offset: 2px;
}

.hour-bar small {
    color: var(--muted);
    font-size: 10px;
}

.table-wrap {
    margin-top: 16px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.price-day-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.price-day-card {
    min-height: 134px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
}

.price-day-card span,
.price-day-card small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.price-day-card strong {
    font-size: clamp(20px, 2.6vw, 30px);
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.price-day-card.unavailable {
    border-color: rgba(180, 64, 70, 0.28);
}

.price-strategy-card {
    border-color: rgba(45, 140, 127, 0.28);
}

.price-strategy-card.peak {
    background: linear-gradient(135deg, rgba(239, 248, 245, 0.95), #ffffff);
}

.price-strategy-card.average {
    background: linear-gradient(135deg, rgba(245, 238, 228, 0.92), #ffffff);
}

.price-strategy-card small {
    overflow-wrap: anywhere;
}

.advice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.advice-item {
    min-height: 98px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.advice-item span,
.advice-item small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.advice-item strong {
    font-size: clamp(17px, 2vw, 24px);
    line-height: 1.15;
}

.price-report-chart {
    min-height: 360px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 18px 14px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.price-bars {
    min-width: 860px;
    min-height: 324px;
    display: grid;
    grid-template-columns: repeat(24, minmax(22px, 1fr));
    gap: 7px;
    align-items: end;
    position: relative;
}

.price-bars::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: var(--baseline, 0%);
    border-top: 1px dashed rgba(97, 112, 106, 0.55);
}

.price-bar {
    min-width: 0;
    min-height: 4px;
    border: 0;
    border-radius: 8px 8px 3px 3px;
    background: linear-gradient(180deg, var(--grid), var(--load));
    color: #ffffff;
    cursor: default;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 7px 2px 4px;
    position: relative;
    z-index: 1;
}

.price-bar.negative {
    background: linear-gradient(180deg, var(--battery), #5da96f);
}

.price-bar span {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    min-width: max-content;
    border-radius: 8px;
    background: var(--ink);
    color: #ffffff;
    padding: 7px 9px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: var(--shadow);
}

.price-bar:hover span,
.price-bar:focus-visible span {
    display: block;
}

.price-bar small {
    color: rgba(255, 255, 255, 0.92);
    font-size: 10px;
    font-weight: 700;
}

.chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--muted);
    font-weight: 700;
}

.forecast-table-wrap {
    max-height: 460px;
}

table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: right;
    white-space: nowrap;
}

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

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

tr.current-row {
    background: rgba(226, 169, 21, 0.12);
}

tr.warning-row {
    background: rgba(180, 64, 70, 0.08);
}

code {
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
}

.mini-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(51, 131, 77, 0.1);
    color: #17613b;
}

.mini-nieznany,
.mini-niedostepny,
.mini-rozlaczony,
.mini-pusty {
    background: rgba(180, 64, 70, 0.1);
    color: var(--danger);
}

.entity-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: 16px;
}

.unused-entity-list {
    max-height: 380px;
    overflow: auto;
    padding-right: 4px;
}

.entity-item {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(150px, 0.25fr) minmax(0, 1fr) minmax(110px, 0.18fr) minmax(82px, 0.12fr);
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.84);
    padding: 8px 12px;
}

.entity-item-muted {
    opacity: 0.72;
}

.entity-item code,
.entity-item span,
.entity-item strong,
.entity-item small {
    overflow-wrap: anywhere;
}

.entity-item span {
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
}

.entity-item code {
    color: var(--muted);
    font-size: 13px;
}

.entity-value {
    color: var(--ink);
    font-size: 15px;
    text-align: right;
}

.entity-status {
    justify-self: end;
    border-radius: 999px;
    padding: 5px 9px;
    background: rgba(97, 112, 106, 0.1);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.entity-status.ok {
    background: rgba(51, 131, 77, 0.1);
    color: #17613b;
}

.entity-status.error {
    background: rgba(180, 64, 70, 0.1);
    color: var(--danger);
}

@media (max-width: 980px) {
    .metrics-grid,
    .metric-inline-grid,
    .flow-history-grid,
    .basic-grid,
    .basic-stat-grid,
    .energy-band,
    .daily-charts-grid,
    .load-report-stats,
    .load-forecast-stats,
    .weather-stats-grid,
    .supla-grid,
    .supla-phase-grid,
    .sell-context-grid,
    .sell-stats-grid,
    .sell-decision-card,
    .price-day-grid,
    .battery-dashboard,
    .battery-kpi-grid,
    .battery-entity-list,
    .tenant-summary-grid,
    .tenant-admin-grid,
    .tenant-lists-grid,
    .tenant-secret-grid,
    .info-grid,
    .advice-grid {
        grid-template-columns: 1fr 1fr;
    }

    .flow-board,
    .summary-panel,
    .flow-history-grid {
        grid-column: 1 / -1;
    }

    .entity-map-actions {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 680px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .status-stack {
        align-items: flex-start;
    }

    .auth-panel {
        justify-items: start;
        width: 100%;
    }

    .login-form {
        justify-content: flex-start;
    }

    .metrics-grid,
    .metric-inline-grid,
    .flow-history-grid,
    .energy-band,
    .daily-charts-grid,
    .load-report-stats,
    .load-forecast-stats,
    .weather-stats-grid,
    .supla-grid,
    .supla-phase-grid,
    .sell-context-grid,
    .sell-stats-grid,
    .sell-decision-card,
    .price-day-grid,
    .battery-dashboard,
    .battery-kpi-grid,
    .battery-entity-list,
    .entity-map-grid,
    .tenant-summary-grid,
    .tenant-admin-grid,
    .tenant-lists-grid,
    .tenant-secret-grid,
    .advice-grid,
    .info-grid,
    .entity-list {
        grid-template-columns: 1fr;
    }

    .entity-map-actions {
        grid-template-columns: 1fr;
    }

    .chart-card-head,
    .basic-panel-head,
    .balance-row-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .chart-card-head strong,
    .basic-panel-head strong {
        max-width: 100%;
        text-align: left;
    }

    .data-pill {
        white-space: normal;
    }

    .entity-item {
        grid-template-columns: 1fr;
    }

    .tenant-row {
        grid-template-columns: 1fr;
    }

    .tenant-row small {
        text-align: left;
    }

    .tenant-credentials-head {
        align-items: stretch;
        flex-direction: column;
    }

    .entity-value {
        text-align: left;
    }

    .entity-status {
        justify-self: start;
    }

    .flow-board {
        grid-template-columns: 1fr;
        grid-template-rows: none;
        gap: 12px;
    }

    .flow-node.source,
    .flow-node.home,
    .flow-node.grid,
    .flow-node.battery {
        grid-column: auto;
        grid-row: auto;
    }

    .flow-line {
        display: none;
    }

    .hourly-chart {
        grid-template-columns: repeat(12, minmax(20px, 1fr));
    }

    .section-head,
    .search-form,
    .config-entity-head,
    .settings-actions,
    .weather-head-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .info-tabs {
        width: 100%;
    }

    .info-tab-button {
        flex: 1;
    }

    .range-picker {
        align-items: stretch;
        border-radius: 12px;
        flex-direction: column;
        padding: 12px;
        width: 100%;
    }

    .range-picker select,
    .range-picker input,
    .range-picker button {
        width: 100%;
    }

    .date-stepper {
        width: 100%;
    }

    .date-stepper input {
        flex: 1;
        min-width: 0;
    }

    .range-picker .date-stepper .date-step-button {
        flex: 0 0 44px;
        width: 44px;
    }

    .load-report-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .load-report-tools .selected-range-pill {
        width: 100%;
    }

    .day-tabs {
        justify-content: flex-start;
    }

    .search-form input {
        width: 100%;
    }
}

@media (max-width: 680px) {
    .energy-map {
        min-width: 0;
        min-height: 430px;
        grid-template-columns: minmax(92px, 1fr) minmax(112px, 1fr) minmax(92px, 1fr);
        grid-template-rows: 54px 112px 112px 118px;
        gap: 8px;
        padding: 16px 12px;
        overflow: hidden;
    }

    .map-pv,
    .map-grid,
    .map-load,
    .map-battery {
        width: 106px;
        height: 106px;
    }

    .map-center {
        width: 74px;
        height: 74px;
    }

    .map-title {
        gap: 8px;
    }

    .map-title h2 {
        font-size: 19px;
    }

    .map-title span {
        display: none;
    }

    .map-pv small,
    .map-grid small,
    .map-load small,
    .map-battery small,
    .map-pv em,
    .battery-meta {
        font-size: 8px;
    }

    .map-pv strong,
    .map-grid strong,
    .map-load strong,
    .map-battery strong {
        font-size: 14px;
    }

    .wire-pv {
        top: 158px;
        height: 60px;
    }

    .wire-grid {
        left: calc(50% - 142px);
        right: calc(50% + 36px);
        top: 258px;
    }

    .wire-load {
        left: calc(50% + 36px);
        right: calc(50% - 142px);
        top: 258px;
    }

    .wire-battery {
        top: 292px;
        height: 54px;
    }
}
