:root {
    color-scheme: light;
    --ink: #1d2c29;
    --muted: #687772;
    --line: #d9e1d9;
    --paper: #f3f5ef;
    --surface: #fffefa;
    --forest: #213732;
    --solar: #d79726;
    --home: #398b6b;
    --import: #d5684d;
    --export: #397f93;
    --flow-blue: #1686b8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background-color: var(--paper);
    background-image: repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(44, 72, 61, 0.025) 40px);
    font-family: "Avenir Next", "Trebuchet MS", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
a {
    font: inherit;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid #d79726;
    outline-offset: 3px;
}

[hidden] {
    display: none !important;
}

.app-shell {
    min-height: 100vh;
}

.primary-nav {
    position: fixed;
    z-index: 20;
    inset: 0 auto 0 0;
    display: flex;
    width: 232px;
    flex-direction: column;
    padding: 28px 16px 18px;
    color: #f3f5ef;
    background: var(--forest);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 8px 54px;
    color: inherit;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 1.4px;
    text-decoration: none;
}

.brand-icon {
    display: grid;
    width: 38px;
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 5px;
    color: #f1bd59;
    font-family: Georgia, serif;
    font-size: 24px;
}

.nav-link {
    display: flex;
    width: 100%;
    min-height: 50px;
    align-items: center;
    gap: 14px;
    margin: 3px 0;
    padding: 0 13px;
    border: 0;
    border-radius: 5px;
    color: #ced9d2;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: color 160ms ease, background 160ms ease;
}

.nav-link:hover,
.nav-link.is-active {
    color: #fffefa;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.is-active {
    box-shadow: inset 3px 0 #e0a63e;
}

.nav-link svg {
    width: 21px;
    height: 21px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.nav-footnote {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: auto 8px 6px;
    color: #aebeb5;
    font-size: 12px;
}

.status-dot,
.pulse-dot {
    width: 8px;
    height: 8px;
    flex: none;
    border-radius: 50%;
    background: #6cc391;
}

.status-dot.is-offline {
    background: #df765d;
}

.main-column {
    min-height: 100vh;
    margin-left: 232px;
}

.topbar {
    display: flex;
    min-height: 112px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px clamp(22px, 4vw, 62px);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 254, 250, 0.72);
}

.topbar h1,
.section-intro h2,
.scene-heading h2,
.section-heading h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
}

.topbar h1 {
    font-size: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    color: #77837d;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.3px;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--muted);
    font-size: 12px;
}

.status-meta,
.account-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.account-name {
    color: var(--ink);
    font-size: 11px;
}

.account-meta form {
    margin: 0;
}

.logout-button {
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--ink);
    background: var(--surface);
    cursor: pointer;
    font-size: 11px;
}

.logout-button:hover {
    border-color: var(--import);
}

.login-page {
    min-height: 100vh;
    background-color: var(--forest);
    background-image: radial-gradient(ellipse at 12% 10%, rgba(224, 166, 62, 0.2), transparent 42%),
        repeating-linear-gradient(135deg, transparent, transparent 54px, rgba(255, 255, 255, 0.025) 55px);
}

.login-shell {
    display: grid;
    min-height: 100vh;
    align-content: center;
    justify-items: center;
    gap: 28px;
    padding: 32px 18px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #f3f5ef;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 1px;
    text-decoration: none;
}

.login-panel {
    width: min(100%, 390px);
    padding: 30px;
    border: 1px solid rgba(29, 44, 41, 0.12);
    border-radius: 5px;
    background: var(--surface);
    box-shadow: 0 18px 55px rgba(5, 20, 15, 0.2);
}

.login-panel h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 30px;
    font-weight: 500;
}

.login-description {
    margin: 7px 0 24px;
    color: var(--muted);
    font-size: 13px;
}

.login-form {
    display: grid;
    gap: 9px;
}

.login-form > label:not(.remember-option) {
    margin-top: 7px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
}

.login-form > input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--ink);
    background: #fff;
    font: inherit;
}

.login-form > input:focus-visible {
    outline: 2px solid var(--home);
    outline-offset: 1px;
}

.remember-option {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 10px 0 8px;
    color: var(--muted);
    font-size: 12px;
}

.remember-option input {
    width: 16px;
    height: 16px;
    accent-color: var(--home);
}

.login-submit {
    min-height: 45px;
    border: 0;
    border-radius: 4px;
    color: #fff;
    background: var(--forest);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.login-submit:hover {
    background: #31534a;
}

.login-error {
    margin: 0 0 16px;
    padding: 10px 12px;
    border-left: 3px solid var(--import);
    color: #843e30;
    background: #fbefeb;
    font-size: 12px;
}

#status.online {
    color: #38795e;
}

#status.offline {
    color: #ae4f3b;
}

#clock {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    font-size: 15px;
    font-weight: 700;
}

.container {
    width: min(100%, 1480px);
    margin: 0 auto;
    padding: 32px clamp(20px, 4vw, 62px) 60px;
}

.page-view.is-active {
    animation: page-enter 280ms ease both;
}

@keyframes page-enter {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-intro,
.scene-heading,
.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
}

.section-intro {
    margin-bottom: 18px;
}

.section-intro h2,
.scene-heading h2,
.section-heading h2 {
    font-size: 25px;
}

.refresh-note,
.scene-unit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.pulse-dot {
    box-shadow: 0 0 0 4px rgba(74, 153, 112, 0.13);
    animation: breathe 1.8s ease-in-out infinite;
}

@keyframes breathe {
    50% { box-shadow: 0 0 0 7px rgba(74, 153, 112, 0.04); }
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.metric-card {
    min-width: 0;
    padding: 18px 20px 16px;
    border: 1px solid var(--line);
    border-top: 3px solid var(--metric-accent);
    border-radius: 6px;
    background: var(--surface);
}

.metric-solar { --metric-accent: var(--solar); }
.metric-load { --metric-accent: var(--home); }
.metric-grid { --metric-accent: var(--import); }

.metric-heading {
    display: flex;
    align-items: center;
    gap: 9px;
}

.metric-mark {
    display: grid;
    width: 25px;
    aspect-ratio: 1;
    place-items: center;
    border-radius: 4px;
    color: #fff;
    background: var(--metric-accent);
    font-family: Georgia, serif;
    font-size: 13px;
}

.label {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
}

.value {
    display: block;
    overflow-wrap: anywhere;
    margin-top: 15px;
    font-size: 29px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.metric-caption {
    display: block;
    min-height: 16px;
    margin-top: 9px;
    color: var(--muted);
    font-size: 11px;
}

.daily-summary {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 5px;
    margin: 0 0 18px;
    color: var(--muted);
    text-align: right;
}

.daily-summary-values {
    display: flex;
    max-width: 100%;
    align-items: baseline;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px 18px;
    font-size: 11px;
}

.daily-summary-date {
    font-size: 10px;
    font-weight: 700;
}

.daily-summary-item {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
}

.daily-summary-item strong {
    color: var(--ink);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.daily-summary-item small {
    font-size: 9px;
}

.daily-summary-status {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 10px;
}

.daily-summary-status .history-spinner {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.energy-scene {
    overflow: hidden;
    margin: 0 0 30px;
    padding: 22px 22px 16px;
    border: 1px solid #d8dfd7;
    border-radius: 7px;
    background-color: #e8eee7;
    background-image: linear-gradient(rgba(255,255,255,0.24) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.24) 1px, transparent 1px);
    background-size: 24px 24px;
}

.scene-heading {
    align-items: center;
    padding: 0 4px;
}

.scene-heading h2 {
    font-size: 22px;
}

.energy-flow-diagram {
    display: flex;
    max-width: 1120px;
    flex-direction: column;
    margin: 20px auto 16px;
}

.mobile-roof-arrays {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.mobile-roof-array {
    min-width: 0;
    padding: 15px 18px 16px;
    border: 1px solid #52696a;
    background: #20383e;
    color: #f5f7ef;
    box-shadow: 0 6px 14px rgba(29, 49, 46, 0.13);
}

.mobile-roof-array:first-child {
    clip-path: polygon(0 12%, 100% 0, 100% 100%, 0 100%);
}

.mobile-roof-west {
    clip-path: polygon(0 0, 100% 12%, 100% 100%, 0 100%);
}

.mobile-array-heading {
    display: flex;
    min-height: 30px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    overflow-wrap: anywhere;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.mobile-array-heading strong {
    color: #f2c66c;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mobile-panel-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-top: 12px;
}

.mobile-panel-grid i {
    display: block;
    aspect-ratio: 1.7;
    border: 1px solid #88a9ac;
    background: linear-gradient(145deg, #365a63, #29454e);
}

.mobile-flow-arrow {
    position: relative;
    display: grid;
    height: 42px;
    place-items: center;
    color: #8b9a91;
}

.mobile-flow-arrow .flow-tube {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(50% - 1px);
    width: 2px;
    border-radius: 1px;
    background: #b8c9d3;
}

.flow-particles {
    position: absolute;
    z-index: 2;
    top: 1px;
    bottom: 1px;
    left: calc(50% - 1px);
    width: 2px;
    animation: particles-down 1100ms linear infinite;
    opacity: 0;
}

.flow-particles i {
    position: absolute;
    top: 0;
    left: -1px;
    width: 4px;
    height: 13px;
    border-radius: 3px;
    background: linear-gradient(180deg, transparent, #48bfe9 30%, #f0fcff 52%, #1686b8 76%, transparent);
    box-shadow: 0 0 5px rgba(22, 134, 184, 0.65);
}

.mobile-flow-arrow.is-active .flow-particles {
    opacity: 1;
}

.mobile-flow-arrow.is-reversed .flow-particles {
    animation-direction: reverse;
}

@keyframes particles-down {
    to { transform: translateY(calc(100% - 13px)); }
}

.mobile-flow-arrow.is-active .flow-tube {
    border-color: var(--flow-blue);
}

.mobile-flow-arrow.is-reversed {
    transform: rotate(180deg);
}

.mobile-inverter {
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    border: 1px solid #70837a;
    border-radius: 5px;
    color: #f7f6ef;
    background: #334a42;
}

.inverter-name {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.1px;
}

.inverter-name span {
    color: #c1d0c6;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0;
}

.inverter-production {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 4px;
}

.inverter-production span {
    color: #c1d0c6;
    font-size: 11px;
}

.inverter-production strong {
    color: #f2c66c;
    font-size: 23px;
    font-variant-numeric: tabular-nums;
}

.mobile-branches {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "home grid";
    gap: 16px;
    margin-top: -5px;
    padding-top: 27px;
}

.mobile-branches::before {
    position: absolute;
    top: 0;
    right: calc(25% - 4px);
    left: calc(25% - 4px);
    height: 2px;
    background: #b8c9d3;
    content: "";
}

.mobile-branches::after {
    position: absolute;
    z-index: 2;
    top: -4px;
    left: 50%;
    width: 10px;
    height: 10px;
    border: 2px solid #b7c8d6;
    border-radius: 50%;
    background: #f8fbfa;
    content: "";
    transform: translateX(-50%);
}

.mobile-branches.is-active::before {
    background-image: linear-gradient(90deg, transparent, #48bfe9 30%, #f0fcff 52%, #1686b8 76%, transparent);
    background-position: -36px 0;
    background-size: 36px 2px;
    background-repeat: repeat-x;
    animation: particles-across 900ms linear infinite;
}

.mobile-branches.is-reversed::before {
    animation-direction: reverse;
}

@keyframes particles-across {
    to { background-position-x: 0; }
}

.mobile-branch {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 142px;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding: 14px 12px;
    border-top: 2px solid #9ba99f;
    text-align: center;
    transition: border-color 180ms ease, background 180ms ease;
}

.mobile-branch::before {
    position: absolute;
    top: -27px;
    left: calc(50% - 1px);
    width: 2px;
    height: 27px;
    background: #b8c9d3;
    content: "";
}

.mobile-branch::after {
    position: absolute;
    z-index: 1;
    top: -27px;
    left: calc(50% - 1px);
    width: 2px;
    height: 13px;
    border-radius: 3px;
    background: linear-gradient(180deg, transparent, #48bfe9 30%, #f0fcff 52%, #1686b8 76%, transparent);
    box-shadow: 0 0 5px rgba(22, 134, 184, 0.65);
    content: "";
    opacity: 0;
}

.mobile-branch.is-active::after {
    background: linear-gradient(180deg, transparent, #51c8f3 25%, #f1fcff 50%, #1686b8 75%, transparent);
    box-shadow: 0 0 5px rgba(22, 134, 184, 0.8);
    animation: particle-through-branch 850ms linear infinite;
    opacity: 1;
}

.mobile-branch.is-active::before {
    background: #1686b8;
}

.mobile-branch.is-reversed::after {
    animation-direction: reverse;
}

@keyframes particle-through-branch {
    to { transform: translateY(var(--branch-flow-distance, 15px)); }
}

.mobile-branch > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
}

.mobile-branch > strong {
    overflow-wrap: anywhere;
    font-size: 19px;
    font-variant-numeric: tabular-nums;
}

.mobile-branch > small {
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.3;
}

.mobile-home-branch {
    grid-area: home;
    --branch-color: var(--flow-blue);
    border-top-color: var(--home);
}

.mobile-grid-branch {
    grid-area: grid;
    --branch-color: var(--flow-blue);
    border-top-color: var(--export);
}

.mobile-home-branch.is-active { background: rgba(240, 248, 242, 0.46); }
.mobile-grid-branch.is-active { background: rgba(244, 248, 248, 0.46); }
.mobile-grid-branch.is-reversed { border-top-color: var(--import); }

.branch-icon {
    display: block;
    width: 32px;
    height: 32px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.4;
}

.home-branch-icon { color: var(--home); }
.grid-branch-icon { color: var(--export); }

.scene-legend,
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    color: var(--muted);
    font-size: 11px;
}

.scene-legend span,
.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.scene-legend i,
.chart-legend i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: currentColor;
}

.legend-solar,
.series-pv { color: var(--solar); }
.legend-home,
.series-load { color: var(--home); }
.legend-network,
.series-import { color: var(--import); }
.series-export { color: var(--export); }

.measurements {
    margin-top: 28px;
}

.section-heading {
    align-items: center;
    margin-bottom: 15px;
}

.section-heading h2 {
    font-size: 22px;
}

.measure-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.measure-block {
    padding: 15px 17px 10px;
    border-top: 1px solid #aebdb2;
    background: rgba(255, 254, 250, 0.66);
}

.measure-block h3 {
    display: flex;
    justify-content: space-between;
    margin: 0 0 9px;
    font-size: 14px;
}

.measure-block h3 span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.8px;
}

.measure-block div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #e3e8e1;
    color: var(--muted);
    font-size: 12px;
}

.measure-block strong {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.period-switch {
    display: flex;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #e8ede6;
}

.period-switch button {
    min-width: 72px;
    padding: 8px 10px;
    border: 0;
    border-radius: 4px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-size: 12px;
}

.period-switch button.is-active {
    color: var(--ink);
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(35, 53, 45, 0.13);
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.report-summary article {
    min-width: 0;
    padding: 14px 16px;
    border-left: 3px solid var(--report-accent);
    background: var(--surface);
}

.report-summary article:nth-child(1) { --report-accent: var(--solar); }
.report-summary article:nth-child(2) { --report-accent: var(--home); }
.report-summary article:nth-child(3) { --report-accent: var(--import); }
.report-summary article:nth-child(4) { --report-accent: var(--export); }

.report-summary span,
.report-summary strong {
    display: block;
}

.report-summary span {
    color: var(--muted);
    font-size: 11px;
}

.report-summary strong {
    margin-top: 8px;
    font-size: 22px;
    font-variant-numeric: tabular-nums;
}

.history-chart {
    padding: 20px 20px 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
}

.chart-heading {
    margin-bottom: 16px;
}

.history-date-nav {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    max-width: 100%;
}

#historyRange {
    min-width: 0;
    max-width: 240px;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
}

.history-date-nav button {
    display: grid;
    width: 32px;
    height: 32px;
    flex: none;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--ink);
    background: transparent;
    cursor: pointer;
}

.history-date-nav button:disabled {
    color: #aeb8b1;
    cursor: default;
}

.history-date-nav svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.chart-legend {
    gap: 10px 18px;
    margin-bottom: 5px;
}

.chart-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.history-loader {
    position: absolute;
    z-index: 3;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
}

.history-spinner {
    width: 26px;
    height: 26px;
    flex: none;
    border: 3px solid var(--line);
    border-top-color: var(--home);
    border-radius: 50%;
    animation: history-spin 800ms linear infinite;
}

@keyframes history-spin {
    to { transform: rotate(360deg); }
}

.chart-tooltip {
    position: absolute;
    z-index: 2;
    top: 8px;
    width: 208px;
    max-width: calc(100% - 8px);
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    box-shadow: 0 3px 14px rgba(30, 50, 40, 0.14);
    pointer-events: none;
    font-size: 11px;
}

.chart-tooltip time {
    display: block;
    font-weight: 700;
}

.chart-tooltip-caption {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.chart-tooltip dl {
    margin: 8px 0 0;
}

.chart-tooltip dl div {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 3px 0;
}

.chart-tooltip dd {
    margin: 0;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.chart-crosshair {
    stroke: #94aaa0;
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.chart-point {
    stroke: var(--surface);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.chart-cursor {
    pointer-events: none;
}

.history-chart-svg:focus-visible {
    outline: 2px solid var(--home);
    outline-offset: -2px;
}

.history-chart-svg {
    touch-action: pan-y;
}

.history-chart-svg {
    display: block;
    width: 100%;
    height: auto;
    min-height: 210px;
}

.chart-gridline {
    stroke: #e4e9e3;
    stroke-width: 1;
}

.chart-axis-label {
    fill: #78847e;
    font-family: "Avenir Next", "Trebuchet MS", sans-serif;
    font-size: 11px;
}

.chart-series {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.5;
    vector-effect: non-scaling-stroke;
}

.history-message {
    min-height: 20px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.history-message.is-error {
    color: #ae4f3b;
}

.data-method,
.coverage-label {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.coverage-label {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
    .primary-nav {
        width: 205px;
    }

    .main-column {
        margin-left: 205px;
    }

    .container {
        padding-right: 22px;
        padding-left: 22px;
    }

    .value {
        font-size: 25px;
    }

    .report-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .primary-nav {
        inset: auto 0 0;
        width: 100%;
        height: calc(66px + env(safe-area-inset-bottom));
        flex-direction: row;
        justify-content: center;
        gap: 8px;
        padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow: 0 -5px 20px rgba(22, 45, 37, 0.12);
    }

    .brand-mark,
    .nav-footnote {
        display: none;
    }

    .nav-link {
        width: min(50%, 210px);
        min-height: 50px;
        justify-content: center;
        gap: 9px;
        margin: 0;
        padding: 0 12px;
        font-size: 12px;
    }

    .nav-link.is-active {
        box-shadow: inset 0 3px #e0a63e;
    }

    .main-column {
        margin-left: 0;
    }

    .topbar {
        min-height: 88px;
        padding: 16px 17px;
    }

    .topbar h1 {
        font-size: 22px;
    }

    .eyebrow {
        font-size: 9px;
        letter-spacing: 1px;
    }

    .topbar-meta {
        align-items: flex-end;
        flex-direction: column;
        gap: 5px;
        font-size: 10px;
    }

    #clock {
        font-size: 13px;
    }

    .container {
        padding: 23px 14px calc(92px + env(safe-area-inset-bottom));
    }

    .section-intro {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 14px;
    }

    .section-intro h2 {
        font-size: 23px;
    }

    .refresh-note {
        font-size: 11px;
    }

    .cards {
        gap: 7px;
        margin-bottom: 16px;
    }

    .metric-card {
        padding: 11px 9px 9px;
    }

    .metric-heading {
        gap: 5px;
    }

    .metric-mark {
        width: 20px;
        font-size: 11px;
    }

    .label {
        font-size: 8px;
        letter-spacing: 0.3px;
    }

    .value {
        margin-top: 12px;
        font-size: 18px;
    }

    .metric-caption {
        min-height: 24px;
        margin-top: 7px;
        font-size: 9px;
        line-height: 1.3;
    }

    .daily-summary-values {
        gap: 5px 12px;
        font-size: 10px;
    }

    .daily-summary-item {
        align-items: flex-end;
        flex-direction: column;
        gap: 2px;
    }

    .daily-summary-status {
        font-size: 9px;
    }

    .energy-scene {
        margin-bottom: 24px;
        padding: 17px 12px 13px;
    }

    .scene-heading {
        align-items: flex-start;
    }

    .scene-heading h2,
    .section-heading h2 {
        font-size: 20px;
    }

    .scene-unit {
        font-size: 10px;
    }

    .energy-flow-diagram {
        margin: 15px 0 13px;
    }

    .mobile-roof-arrays {
        gap: 7px;
    }

    .mobile-roof-array {
        padding: 9px 8px 8px;
    }

    .mobile-array-heading {
        min-height: 37px;
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        font-size: 8px;
        letter-spacing: 0.2px;
    }

    .mobile-array-heading strong {
        font-size: 10px;
    }

    .mobile-panel-grid {
        gap: 3px;
        margin-top: 7px;
    }

    .mobile-flow-arrow {
        height: 27px;
    }

    .mobile-inverter {
        min-height: 58px;
        gap: 8px;
        padding: 9px 12px;
    }

    .inverter-name {
        font-size: 10px;
    }

    .inverter-name span,
    .inverter-production span {
        font-size: 9px;
    }

    .inverter-production strong {
        font-size: 18px;
    }

    .mobile-branches {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas: "home grid";
        gap: 4px;
        padding-top: 24px;
    }

    .mobile-branches::before {
        right: calc(25% - 1px);
        left: calc(25% - 1px);
    }

    .mobile-branch {
        min-height: 116px;
        gap: 4px;
        padding: 8px 3px;
    }

    .mobile-branch::before {
        top: -24px;
        height: 24px;
    }

    .mobile-branch::after {
        top: -24px;
        --branch-flow-distance: 12px;
    }

    .mobile-branch > span {
        font-size: 8px;
    }

    .mobile-branch > strong {
        font-size: 12px;
    }

    .mobile-branch > small {
        font-size: 8px;
    }

    .scene-legend {
        gap: 9px 14px;
        font-size: 10px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .measure-grid {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .measure-block {
        padding: 12px 13px 7px;
    }

    .history-intro {
        gap: 15px;
    }

    .period-switch {
        width: 100%;
    }

    .period-switch button {
        min-width: 0;
        flex: 1;
        padding: 8px 4px;
        font-size: 11px;
    }

    .report-summary {
        gap: 7px;
        margin-bottom: 16px;
    }

    .report-summary article {
        padding: 11px 10px;
    }

    .report-summary span {
        min-height: 28px;
        font-size: 10px;
        line-height: 1.35;
    }

    .report-summary strong {
        margin-top: 6px;
        font-size: 18px;
    }

    .history-chart {
        padding: 15px 10px 13px;
    }

    .chart-heading {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .chart-legend {
        gap: 8px 12px;
        font-size: 10px;
    }

    .history-chart-svg {
        min-height: 170px;
    }

    .chart-axis-label {
        font-size: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}