:root {
    --ink: #14211d;
    --muted: #6b7873;
    --paper: #f3f6f4;
    --card: #fff;
    --green: #159a69;
    --green-dark: #086044;
    --lime: #c5ea72;
    --line: #dee6e1;
    --shadow: 0 14px 34px rgba(21, 47, 37, .065);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background: radial-gradient(circle at 90% 5%, rgba(197,234,114,.17), transparent 25%), var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.topbar {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 max(calc((100vw - 1220px) / 2), 4vw);
    background: rgba(255,255,255,.82);
    border-bottom: 1px solid rgba(220,229,223,.9);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    z-index: 5;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
    display: grid; place-items: center; width: 39px; height: 39px; border-radius: 12px;
    background: linear-gradient(145deg, #1ab77d, var(--green-dark));
    box-shadow: 0 8px 20px rgba(24,163,111,.22);
}
.brand-mark > span { width: 19px; height: 10px; border: 3px solid white; border-left: 0; border-right: 0; transform: skewX(-28deg); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: -.015em; }
.brand small { color: var(--muted); margin-top: 2px; font-size: 10px; }
.desktop-nav { display: flex; align-self: stretch; gap: 6px; margin-left: 6vw; }
.desktop-nav a { display: flex; align-items: center; padding: 0 14px; color: var(--muted); font-size: 12px; font-weight: 700; text-decoration: none; position: relative; }
.desktop-nav a.active { color: var(--green-dark); }
.desktop-nav a.active::after { content: ""; position: absolute; height: 2px; left: 14px; right: 14px; bottom: 0; background: var(--green); }
.header-actions { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.system-state { display: flex; align-items: center; gap: 8px; }
.system-state > span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(21,154,105,.1); }
.system-state strong, .system-state small { display: block; font-size: 10px; }
.system-state small { color: var(--muted); margin-top: 2px; }
.voice-state { display: flex; align-items: center; gap: 8px; }
.voice-state > span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(21,154,105,.1); }
.voice-state strong, .voice-state small { display: block; font-size: 10px; }
.voice-state small { color: var(--muted); margin-top: 2px; }
.voice-state.offline > span { background: #d84b4b; box-shadow: 0 0 0 5px rgba(216,75,75,.1); }
.voice-state.checking > span { background: #d99a28; box-shadow: 0 0 0 5px rgba(217,154,40,.1); }
.sync-icon { font-size: 17px; margin-right: 4px; }
main { width: min(1220px, 92vw); margin: 0 auto; padding: 48px 0 76px; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; margin-bottom: 30px; }
.title-row { display: flex; align-items: center; gap: 17px; }
.page-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 17px; color: white; background: linear-gradient(145deg, var(--green), var(--green-dark)); font-size: 28px; box-shadow: 0 12px 26px rgba(21,154,105,.2); }
.eyebrow { margin: 0 0 10px; letter-spacing: .18em; font-size: 11px; font-weight: 800; color: var(--green-dark); }
h1 { font-size: clamp(34px, 4vw, 48px); line-height: 1; letter-spacing: -.045em; margin: 0; }
.intro { color: var(--muted); font-size: 15px; line-height: 1.6; max-width: 690px; margin: 20px 0 0 71px; }
.hero-status { display: flex; gap: 12px; align-items: center; min-width: 245px; padding: 13px 16px; background: rgba(255,255,255,.66); border: 1px solid var(--line); border-radius: 14px; }
.hero-status strong, .hero-status small { display: block; }
.hero-status small { color: var(--muted); margin-top: 4px; }
.pulse { width: 11px; height: 11px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 8px rgba(24,163,111,.12); }
.card { background: rgba(255,255,255,.94); border: 1px solid rgba(220,229,223,.95); border-radius: 18px; box-shadow: var(--shadow); }
.workspace { padding: 23px; }
.workspace-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding-bottom: 19px; margin-bottom: 19px; border-bottom: 1px solid #edf1ee; }
.workspace-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.range-note { color: var(--muted); background: #f3f7f4; padding: 8px 11px; border-radius: 8px; font-size: 10px; font-weight: 700; }
.filters { display: grid; grid-template-columns: 1.2fr 1.1fr .85fr .85fr .95fr auto auto; gap: 12px; align-items: end; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
select, input {
    width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 12px; padding: 0 13px;
    font: inherit; color: var(--ink); background: #fbfdfb; outline: none;
}
select:focus, input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(24,163,111,.12); }
.button { min-height: 46px; border-radius: 12px; border: 0; padding: 0 17px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.primary { color: white; background: var(--green); }
.secondary { color: var(--green-dark); background: #eaf7f1; }
.ghost { color: var(--ink); background: transparent; border: 1px solid var(--line); }
.plant-summary-dialog { width: min(620px, 90vw); border: 1px solid var(--line); border-radius: 20px; padding: 25px; color: var(--ink); background: var(--card); box-shadow: 0 24px 70px rgba(20,33,29,.22); }
.plant-summary-dialog::backdrop { background: rgba(20,33,29,.32); backdrop-filter: blur(3px); }
.summary-dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.summary-dialog-heading h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.dialog-close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; }
.summary-period { margin: 8px 0 18px; color: var(--muted); font-size: 12px; }
.plant-summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.plant-summary-item { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #f8fbf9; }
.plant-summary-item small, .plant-summary-item strong { display: block; }
.plant-summary-item small { color: var(--muted); font-size: 11px; font-weight: 700; }
.plant-summary-item strong { margin-top: 7px; font-size: 20px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 18px 0; }
.plant-flow, .breakdown-card { padding: 25px; margin-top: 18px; }
.plant-flow-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.plant-flow-heading h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 26px; letter-spacing: -.035em; }
.plant-flow-heading p:not(.eyebrow) { color: var(--muted); margin: 6px 0 0; font-size: 12px; }
.plant-flow-heading .latest-reading { margin-top: 7px; font-size: 11px; }.latest-reading strong { color: var(--ink); font-weight: 800; }
.plant-flow-selector { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.plant-select-pill { border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; background: #fff; color: var(--muted); font: inherit; font-size: 10px; font-weight: 800; cursor: pointer; }
.plant-select-pill.active { border-color: var(--green); color: var(--green-dark); background: #eaf7f1; }
.online-pill { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; color: #fff; background: #54bd42; font-size: 11px; letter-spacing: 0; }
.flow-board { display: grid; grid-template-columns: 1fr 110px 1fr; grid-template-rows: 1fr 1fr; gap: 28px 40px; align-items: center; min-height: 275px; padding: 26px 48px; border-radius: 20px; background: linear-gradient(145deg, #edf5ff, #fff 52%, #f6f3ff); position: relative; overflow: hidden; }
.flow-board::before, .flow-board::after { content: ""; position: absolute; left: 50%; top: 50%; background: #d1a900; transform: translate(-50%, -50%); z-index: 0; }
.flow-board::before { width: 1px; height: 78%; }
.flow-board::after { width: 78%; height: 1px; }
.flow-node { min-height: 98px; padding: 17px 22px; border-radius: 60px; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; position: relative; z-index: 1; border: 1px solid rgba(255,255,255,.85); }
.flow-node strong { grid-column: 1 / -1; font-size: 15px; }
.flow-node small { color: #64736e; font-size: 11px; }
.flow-node b { grid-column: 2; grid-row: 3; font-size: 11px; font-weight: 600; color: #64736e; text-align: right; }
.flow-node em { grid-column: 2; grid-row: 2; color: var(--ink); font-size: 19px; font-weight: 800; font-style: normal; text-align: right; }
.flow-discharge { grid-column: 2; grid-row: 4; color: #64736e; font-size: 10px; text-align: right; }
.flow-voltage { grid-column: 2; grid-row: 5; color: #64736e; font-size: 10px; text-align: right; }
.flow-pv { background: linear-gradient(110deg, #fff2b7, #fffdf0); border-left: 4px solid #f0c900; }
.flow-grid { background: linear-gradient(110deg, #d5f5ff, #f5fdff); border-left: 4px solid #52cdeb; }
.flow-battery { background: linear-gradient(110deg, #c9ebde, #f1fbf7); border-left: 4px solid #159a69; }
.flow-load { background: linear-gradient(110deg, #efd3f3, #fff7ff); border-left: 4px solid #b44ad1; }
.flow-center { grid-column: 2; grid-row: 1 / 3; width: 90px; height: 90px; justify-self: center; display: grid; place-items: center; align-content: center; gap: 2px; border: 2px solid #d09c00; border-radius: 50%; background: #fff; position: relative; z-index: 2; }
.flow-center span { font-size: 25px; color: #64736e; }.flow-center b { font-size: 13px; }.flow-center small { color: var(--muted); font-size: 10px; }
.inverter-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); gap: 14px; }
.inverter-flow-card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: #fff; text-align: left; cursor: pointer; transition: .18s; color: var(--ink); }
.inverter-flow-card:hover { border-color: var(--green); transform: translateY(-2px); box-shadow: 0 10px 22px rgba(21, 47, 37, .08); }
.inverter-card-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }.inverter-card-top strong { font-size: 13px; }.inverter-card-top small { width: 100%; color: var(--muted); margin-left: 15px; font-size: 11px; }.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #54bd42; }
.mini-flow-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 15px 0; }.mini-flow-grid span { padding: 9px; border-radius: 10px; display: flex; justify-content: space-between; gap: 6px; font-size: 10px; }.mini-flow-grid em { font-style: normal; font-weight: 800; }.mini-pv { background: #fff7cf; }.mini-grid { background: #e6f8ff; }.mini-battery { background: #e4f5ed; }.mini-load { background: #f6e7fa; }
.inverter-card-foot { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }.inverter-card-foot b { color: var(--ink); font-size: 12px; }.open-detail { margin-left: auto; color: var(--green-dark); font-weight: 800; }
.metric { padding: 22px; }
.metric-top { display: flex; align-items: center; justify-content: space-between; }
.metric small, .metric span { display: block; color: var(--muted); }
.metric strong { display: block; margin: 16px 0 6px; font-size: 27px; letter-spacing: -.035em; overflow: hidden; text-overflow: ellipsis; }
.metric span { font-size: 11px; }
.metric-icon { display: grid !important; place-items: center; width: 31px; height: 31px; border-radius: 9px; font-size: 16px !important; font-weight: 800; }
.metric-icon.blue { color: #3377b7; background: #ecf4fb; }
.metric-icon.amber { color: #b97915; background: #fdf4e4; }
.metric-icon.green { color: var(--green-dark); background: #eaf7f1; }
.metric-icon.violet { color: #7664ae; background: #f1eef9; }
.chart-card, .table-card { padding: 26px; margin-top: 16px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-heading h2 { margin: 0; font-size: 23px; }
.section-heading p:not(.eyebrow) { color: var(--muted); margin: 6px 0 0; font-size: 12px; }
.section-heading > span { color: var(--muted); font-size: 12px; }
.date-chip, .record-count { background: #f2f6f3; padding: 9px 12px; border-radius: 9px; }
.solis-tabs { display: flex; gap: 6px; margin: 0 0 10px; padding: 4px; background: #f3f7f4; border-radius: 12px; width: fit-content; }
.solis-tab { border: 0; background: transparent; color: var(--muted); border-radius: 9px; padding: 8px 16px; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.solis-tab.active { background: #fff; color: var(--green); box-shadow: 0 2px 8px rgba(24, 68, 48, .12); }
.chart-context { display: flex; align-items: center; gap: 8px; margin: 0 0 11px; color: var(--muted); font-size: 11px; }
.chart-context .context-label { color: var(--ink); font-weight: 800; }
.context-separator { color: #b1c1b8; }
.chart-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 13px; margin: -8px 0 4px; color: var(--muted); font-size: 11px; }
.chart-legend > span { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; color: var(--ink); }
.legend-toggle { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-size: 11px; font-weight: 700; cursor: pointer; }
.legend-toggle input { width: 13px; height: 13px; min-height: 0; margin: 0; accent-color: var(--green); cursor: pointer; }
.legend-swatch { display: inline-block; width: 20px; height: 3px; border-radius: 3px; background: #f5c400; }
.legend-swatch.battery { background: #159a69; }
.legend-swatch.discharge { background: #8069b5; }
.legend-swatch.grid-import { background: #d75555; }
.legend-swatch.grid-export { background: #4a82c3; }
.legend-swatch.load { background: #d48c24; }
.legend-swatch.temperature { background: #9b59b6; }
.chart-axis-label { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.chart-wrap { height: 330px; position: relative; }
.chart-tooltip { position: absolute; z-index: 2; min-width: 176px; padding: 9px 11px; border-radius: 8px; color: #fff; background: rgba(15, 40, 31, .94); box-shadow: 0 5px 16px rgba(15, 40, 31, .22); font-size: 11px; pointer-events: none; }
.chart-tooltip strong { display: block; margin-bottom: 6px; font-size: 12px; }
.chart-tooltip div { display: flex; align-items: center; gap: 6px; justify-content: space-between; margin-top: 3px; }
.chart-tooltip i { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.chart-tooltip b { margin-left: 10px; white-space: nowrap; }
.grid-band-card { padding: 26px; margin-top: 16px; }
.grid-band-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0 6px; }
.grid-band-metrics article { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.55); }
.grid-band-metrics small, .grid-band-metrics span { display: block; color: var(--muted); font-size: 10px; font-weight: 700; }
.grid-band-metrics strong { display: block; margin: 7px 0 3px; color: var(--ink); font-size: 22px; }
.grid-band-chart-wrap { height: 220px; margin-top: 12px; }
.grid-band-table-wrap { margin-top: 14px; }
.grid-band-table-wrap table { min-width: 520px; }
@media (max-width: 720px) { .grid-band-card { padding: 18px; } .grid-band-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; } .grid-band-metrics article { padding: 11px; } .grid-band-metrics strong { font-size: 18px; } }
canvas { width: 100%; height: 100%; }
.table-wrap { overflow: auto; max-height: 420px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { position: sticky; top: 0; background: white; color: var(--muted); text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); }
.empty { text-align: center; color: var(--muted); padding: 45px; }
#toast {
    position: fixed; right: 24px; bottom: 24px; max-width: 380px; padding: 14px 18px;
    color: white; background: var(--ink); border-radius: 12px; box-shadow: var(--shadow);
    opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s;
}
#toast.show { opacity: 1; transform: translateY(0); }
footer { width: min(1220px, 92vw); margin: 0 auto; padding: 24px 0 34px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 11px; }
.footer-brand .brand-mark { width: 34px; height: 34px; border-radius: 10px; box-shadow: none; }
@media (max-width: 980px) {
    .desktop-nav, .system-state { display: none; }
    .filters { grid-template-columns: repeat(2, 1fr); }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .hero { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 600px) {
    .topbar { padding: 0 16px; min-height: 68px; }
    .header-actions .secondary { font-size: 0; width: 44px; padding: 0; }
    .header-actions .secondary .sync-icon { display: inline; font-size: 22px; margin: 0; }
    .header-actions .plant-summary-button { font-size: 0; width: 44px; padding: 0; }
    .header-actions .plant-summary-button .summary-icon { display: inline; font-size: 19px; }
    main { width: min(92vw, 1220px); padding-top: 30px; }
    .page-icon { width: 46px; height: 46px; border-radius: 14px; }
    .intro { margin-left: 0; }
    .workspace { padding: 17px; }
    .workspace-heading { flex-direction: column; }
    .filters, .metrics { grid-template-columns: 1fr; }
    .plant-summary-grid { grid-template-columns: 1fr; }
    .plant-flow, .breakdown-card { padding: 18px; }
    .plant-flow-heading { flex-direction: column; }.plant-flow-heading h2 { font-size: 22px; }
    .flow-board { grid-template-columns: 1fr; grid-template-rows: auto; gap: 12px; padding: 18px; }
    .flow-board::before, .flow-board::after { display: none; }.flow-center { grid-column: 1; grid-row: auto; order: -1; width: 74px; height: 74px; }
    .section-heading { align-items: flex-start; flex-direction: column; }
    .chart-card, .table-card { padding: 18px; }
    .chart-wrap { height: 265px; }
    .solis-tabs { width: 100%; overflow-x: auto; }
.solis-tab { flex: 1 0 auto; padding-inline: 13px; }
.chart-context { flex-wrap: wrap; }
    h1 { font-size: 34px; }
    footer { flex-direction: column; align-items: flex-start; }
    #toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}
