/* eTherm Analytics – ruhiges, datenorientiertes Layout mit dunkler Seitenleiste */
:root {
  color-scheme: light;
  --bg: #eef0f2;
  --surface-1: #ffffff;
  --surface-2: #f3f4f5;
  --surface-3: #e6e8ea;
  --ink-1: #16181a;
  --ink-2: #52514e;
  --ink-3: #7c7b76;
  --line: #dfe2e5;
  --grid: #e7e9eb;
  --accent: #0b6bcb;
  --accent-ink: #ffffff;
  --accent-soft: #e3effb;
  --side: #1b1c1e;
  --side-ink: #c9cbcf;
  --side-hover: #2a2c2f;
  --good: #1a7f37;
  --warn: #b25e00;
  --crit: #c62828;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --radius: 8px;
  --cold: #2a78d6;
  --hot: #e34948;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121314; --surface-1: #1a1a19; --surface-2: #232422; --surface-3: #2d2e2c;
    --ink-1: #f4f4f2; --ink-2: #c3c2b7; --ink-3: #8f8e87; --line: #30312f; --grid: #2a2b29;
    --accent: #3987e5; --accent-soft: #1d2a3a; --side: #0e0f10; --side-hover: #1f2123;
    --good: #4cc26b; --warn: #e3a13b; --crit: #ef6b6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --cold: #3987e5; --hot: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121314; --surface-1: #1a1a19; --surface-2: #232422; --surface-3: #2d2e2c;
  --ink-1: #f4f4f2; --ink-2: #c3c2b7; --ink-3: #8f8e87; --line: #30312f; --grid: #2a2b29;
  --accent: #3987e5; --accent-soft: #1d2a3a; --side: #0e0f10; --side-hover: #1f2123;
  --good: #4cc26b; --warn: #e3a13b; --crit: #ef6b6b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --cold: #3987e5; --hot: #e66767;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink-1); }
body { min-height: 100vh; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--ink-3); }
small { font-size: 12px; }
.ic { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

/* ───── Formularelemente ───── */
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=color]), select {
  background: var(--surface-1); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; min-height: 36px; width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=color] { width: 36px; height: 28px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; background: var(--surface-1); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field.inline { display: flex; align-items: center; gap: 8px; margin: 0; }
.field.inline select { width: auto; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check.small { font-size: 12px; color: var(--ink-2); margin: 10px 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border-radius: 6px; border: 1px solid var(--line); background: var(--surface-1); cursor: pointer; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; cursor: pointer; color: var(--ink-2); flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink-1); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.danger:hover { color: var(--crit); }
.icon-btn:disabled { opacity: .35; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 120px; }
.row.end { justify-content: flex-end; }
.w-s { max-width: 80px; } .w-xs { max-width: 64px; }
.center { text-align: center; }

/* ───── Anmeldung ───── */
.auth-wrap { min-height: 100vh; display: grid; place-content: center; padding: 24px 16px; gap: 14px; }
.auth-card { width: min(420px, calc(100vw - 32px)); background: var(--surface-1); border-radius: 12px; box-shadow: var(--shadow); padding: 28px; border: 1px solid var(--line); }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.auth-brand small { display: block; color: var(--ink-3); }
.auth-card h1 { font-size: 20px; margin-bottom: 14px; }
.auth-card .muted { margin: -6px 0 16px; font-size: 13px; }
.auth-foot { text-align: center; color: var(--ink-3); font-size: 12px; margin: 0; }
.logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #ffd35a; }
.logo .ic { fill: #ffd35a; stroke: none; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.passkey { gap: 8px; }
.form-msg { padding: 9px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 13px; }
.form-msg.error { background: color-mix(in srgb, var(--crit) 12%, transparent); color: var(--crit); }
.boot-loader { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; margin: 40vh auto; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───── Shell ───── */
.shell { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-head { padding: 18px 16px 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 16px; }
.brand:hover { text-decoration: none; }
.side-site { padding: 8px 16px 14px; border-bottom: 1px solid #2b2d30; }
.side-site small { display: block; font-size: 11px; color: #8d9096; margin-bottom: 4px; }
.site-select { background: #26282b !important; border-color: #34363a !important; color: #fff !important; min-height: 32px !important; font-size: 13px; }
.nav { padding: 10px 8px; display: grid; gap: 2px; }
.nav-group { font-size: 11px; color: #8d9096; padding: 12px 10px 4px; text-transform: uppercase; letter-spacing: .04em; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--side-ink); font-size: 13.5px; }
.nav a:hover { background: var(--side-hover); text-decoration: none; color: #fff; }
.nav a.on { background: #2f3236; color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.side-foot { margin-top: auto; padding: 10px 8px 16px; border-top: 1px solid #2b2d30; display: grid; gap: 2px; }
.side-btn { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; background: none; border: 0; color: var(--side-ink); cursor: pointer; text-align: left; font-size: 13.5px; }
.side-btn:hover { background: var(--side-hover); color: #fff; }
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; background: var(--surface-1); padding: 10px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 16px; flex: 1; }
.menu-btn { display: none; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--surface-2); color: var(--ink-1); font-size: 12px; line-height: 1.2; }
.user-chip:hover { text-decoration: none; background: var(--surface-3); }
.user-chip small { display: block; color: var(--ink-3); font-size: 11px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 11px; }
.main { padding: 16px 20px 40px; display: grid; gap: 14px; align-content: start; }
.scrim { display: none; }
.loading { color: var(--ink-3); padding: 30px; display: flex; gap: 10px; align-items: center; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }

/* ───── Karten & Raster ───── */
.card { background: var(--surface-1); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 12px 16px 0; flex-wrap: wrap; }
.card-head h2 { font-size: 13px; }
.card-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.card-actions { display: flex; align-items: center; gap: 2px; }
.card-body { padding: 10px 16px 16px; min-width: 0; }
.card.error { padding: 16px; color: var(--crit); }
.grid-top { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.grid-top > .span-2 { grid-column: span 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.span-all { grid-column: 1 / -1; }
.stack { display: grid; gap: 14px; }
.card.full { position: fixed; inset: 12px; z-index: 100; overflow: auto; }
body.has-full::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 99; }

/* ───── Zeitraum-Leiste ───── */
.period-card { padding: 8px 14px; }
.period-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.period-nav { display: flex; align-items: center; gap: 4px; }
.date-input { width: 160px !important; min-height: 32px !important; }
.range-inputs { display: flex; align-items: center; gap: 6px; }
.range-inputs .date-input { width: 145px !important; }
.period-label { color: var(--ink-2); font-size: 13px; font-weight: 500; margin-left: auto; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 16px; border-radius: 999px; cursor: pointer; font-size: 13px; color: var(--ink-2); min-width: 64px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg button:not(.on):hover { background: var(--surface-3); }
.seg.sm button { padding: 3px 12px; font-size: 12px; min-width: 0; }
.kpis { display: flex; gap: 22px; flex-wrap: wrap; margin-left: auto; }
.kpi small { display: block; color: var(--ink-3); font-size: 11px; }
.kpi b { font-size: 16px; font-variant-numeric: tabular-nums; }

/* ───── Diagramme ───── */
.chart { position: relative; width: 100%; }
.svgchart { display: block; overflow: visible; font-size: 11px; }
.svgchart text { fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.svgchart .panel-title { fill: var(--ink-2); font-weight: 600; font-size: 11.5px; }
.svgchart .ax-label { font-size: 10.5px; }
.svgchart .empty-label { fill: var(--ink-3); font-size: 13px; }
.grid { stroke: var(--grid); stroke-width: 1; }
.grid.v { stroke-dasharray: 2 4; }
.grid.zero { stroke: var(--ink-3); stroke-opacity: .45; }
.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.area { opacity: .16; stroke: none; }
.band-track { fill: var(--surface-2); }
.cross { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.dot { stroke: var(--surface-1); stroke-width: 2; pointer-events: none; }
.brush { fill: var(--accent); fill-opacity: .12; stroke: var(--accent); stroke-opacity: .5; pointer-events: none; }
.marker { stroke-width: 1.5; stroke-dasharray: 4 3; }
.hit { cursor: crosshair; }
.hit.click, .cell.click, .cell-empty.click { cursor: pointer; }
.bar-g { transition: opacity .12s; }
.bar-g.dim { opacity: .45; }
.cell { stroke: none; }
.cell-empty { fill: var(--surface-2); opacity: .5; }
.cell-zero { fill: var(--surface-3); }
.cell:hover, .cell-empty:hover, .cell-zero:hover { stroke: var(--ink-1); stroke-width: 1.5; }
.chart-host { min-height: 60px; }
.tt {
  position: absolute; z-index: 30; pointer-events: none; background: var(--surface-1); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14); padding: 8px 10px; font-size: 12px; min-width: 170px; max-width: 320px;
}
.tt-head { font-weight: 600; margin-bottom: 4px; color: var(--ink-1); }
.tt-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 7px; align-items: center; color: var(--ink-2); line-height: 1.7; }
.tt-row i { width: 10px; height: 10px; border-radius: 3px; }
.tt-row b { color: var(--ink-1); font-weight: 600; font-variant-numeric: tabular-nums; }
.tt-row b.strong { border-top: 1px solid var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.lg-item { display: flex; gap: 7px; align-items: flex-start; background: none; border: 0; padding: 4px 2px; cursor: pointer; text-align: left; font-size: 12.5px; color: var(--ink-2); }
.lg-item .lg-l { display: grid; line-height: 1.3; }
.lg-item b { color: var(--ink-1); font-variant-numeric: tabular-nums; }
.lg-item.off { opacity: .45; }
.lg-item.off .sw { background: transparent !important; outline: 2px solid var(--ink-3); outline-offset: -2px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; margin-top: 2px; }
.scale-legend { display: flex; align-items: center; gap: 8px; justify-content: flex-end; font-size: 11px; color: var(--ink-3); margin-top: 6px; }
.scale-legend i { width: 120px; height: 8px; border-radius: 4px; }

/* Ringe */
.ring-track { fill: none; stroke: var(--surface-3); stroke-width: 11; }
.ring-val { fill: none; stroke-width: 11; stroke-linecap: round; transition: stroke-dasharray .4s ease; }
.ring-num { font-size: 22px; font-weight: 600; fill: var(--ink-1) !important; }
.ring-unit { font-size: 11px; fill: var(--ink-3); }
.ring-sub { font-size: 10px; fill: var(--ink-3); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-box { background: var(--surface-2); border-radius: 6px; padding: 14px; display: grid; justify-items: center; gap: 8px; }
.stat-box h3 { font-size: 13px; display: flex; gap: 6px; align-items: center; }
.stat-box .info { color: var(--ink-3); cursor: help; display: inline-flex; }
.stat-legend { display: grid; gap: 3px; font-size: 12.5px; }
.stat-legend > div { display: grid; grid-template-columns: 12px auto auto; gap: 7px; align-items: center; }
.stat-legend b { font-variant-numeric: tabular-nums; margin-left: 6px; }
.ring-dot { width: 11px; height: 11px; border-radius: 50%; border: 2.5px solid; }

/* Energiefluss */
.flow-card .card-body { display: grid; place-items: center; }
.flow { width: 100%; max-width: 560px; height: auto; }
.flow text { fill: var(--ink-2); }
.fn-title { font-size: 12px; }
.fn-val { font-size: 13px; font-weight: 700; fill: var(--ink-1) !important; font-variant-numeric: tabular-nums; }
.fn-sub { font-size: 11px; fill: var(--ink-3) !important; }
.fn-ic path { fill: none; stroke: var(--ink-1); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.fl-base { fill: none; stroke: var(--line); stroke-width: 2; }
.fl-flow { fill: none; stroke: transparent; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 3 12; }
.fl-flow.on { stroke: var(--accent); animation: flow 1s linear infinite; }
.fl-flow.on.rev { animation-direction: reverse; }
@keyframes flow { to { stroke-dashoffset: -15; } }
@media (prefers-reduced-motion: reduce) { .fl-flow.on, .rod-glow { animation: none !important; } }

/* Pufferspeicher */
.tank-wrap { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 18px; align-items: center; }
.tank-svg { width: 100%; height: auto; }
.tank-svg text { fill: var(--ink-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.tank-svg .t-val { font-size: 14px; font-weight: 700; fill: var(--ink-1); }
.tank-svg .t-title { font-size: 11px; fill: var(--ink-3); }
.tank-svg .shell { fill: none; stroke: var(--ink-3); stroke-width: 2; }
.tank-svg .insul { fill: var(--surface-2); stroke: var(--line); }
.tank-svg .pipe { stroke: var(--ink-3); stroke-width: 4; stroke-linecap: round; fill: none; }
.tank-svg .rod { stroke: var(--ink-3); stroke-width: 5; stroke-linecap: round; }
.tank-svg .rod.on { stroke: #eb6834; }
.tank-svg .rod-glow { fill: #eb6834; opacity: 0; }
.tank-svg .rod-glow.on { opacity: .35; animation: glow 1.4s ease-in-out infinite alternate; }
.tank-svg .sensor { fill: var(--surface-1); stroke: var(--ink-1); stroke-width: 1.5; }
.tank-svg .etherm-box { fill: var(--surface-1); stroke: var(--ink-3); stroke-width: 1.5; }
@keyframes glow { from { opacity: .15; } to { opacity: .5; } }
.tank-facts { display: grid; gap: 10px; }
.big-num { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; margin: 2px 0 6px; }
.big-num small { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.fact { display: grid; grid-template-columns: 1fr auto; gap: 4px; font-size: 13px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.fact span { color: var(--ink-3); }
.fact b { font-variant-numeric: tabular-nums; }
.temp-scale { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-3); }
.temp-scale i { flex: 1; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--cold), #c3c2b7, var(--hot)); }

/* Zusammenfassung */
.sum-list { display: grid; gap: 8px; margin-top: 10px; }
.sum-item { background: var(--surface-2); border-radius: 6px; padding: 9px 12px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.sum-l { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.sum-l .sw { margin: 0; width: 10px; height: 10px; }
.sum-v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; grid-row: span 2; align-self: center; text-align: right; }
.sum-p { font-size: 11.5px; color: var(--ink-3); }
.sum-p b { color: var(--ink-2); font-weight: 600; }
.delta { margin-left: 6px; font-weight: 600; }
.delta.up { color: var(--good); } .delta.down { color: var(--warn); }
.mini { width: 100%; }

/* Protokoll */
.all-good { text-align: center; padding: 18px 10px 8px; }
.all-good h3 { font-size: 16px; margin-top: 8px; }
.ok-ic { color: var(--accent); display: inline-block; }
.ok-ic .ic { stroke-width: 2.4; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 360px; overflow: auto; }
.log li { display: grid; grid-template-columns: 22px 140px 1fr; gap: 8px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.log time { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.log li.critical .lvl, tr.critical td:first-child { color: var(--crit); }
.log li.good .lvl { color: var(--good); }
.log li .lvl { color: var(--ink-3); display: inline-flex; }
.faults { margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.faults summary { cursor: pointer; color: var(--ink-3); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); margin-left: 6px; }
.badge.critical { background: color-mix(in srgb, var(--crit) 14%, transparent); color: var(--crit); }
.badge.good { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface-1); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 12.5px; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* Tabellen */
.table-wrap { overflow: auto; max-height: 560px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-3); padding: 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface-1); white-space: nowrap; }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl.mono td { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.form-tbl td { padding: 4px 6px; }
.form-tbl input:not([type=checkbox]):not([type=color]), .form-tbl select { min-height: 30px; padding: 4px 8px; }
.row-actions { white-space: nowrap; text-align: right; }

/* Analyse */
.analysis { display: grid; grid-template-columns: 250px 1fr; gap: 14px; align-items: start; }
.picker { padding: 14px; position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; }
.picker h2 { font-size: 13px; margin-bottom: 8px; }
.pick-group { border-top: 1px solid var(--line); padding: 6px 0; }
.pick-group summary { cursor: pointer; font-weight: 600; font-size: 12.5px; padding: 4px 0; color: var(--ink-2); }
.pick-group .check, .pick-list .check { display: flex; padding: 4px 0; font-size: 13px; }
.pick-group .sw, .pick-list .sw { margin: 0; }
.pick-list { display: grid; max-height: 60vh; overflow: auto; min-width: 320px; }
.zoom-lbl { font-size: 12px; color: var(--ink-3); margin-right: 6px; }

/* Import */
.dropzone { border: 2px dashed var(--line); border-radius: 10px; padding: 34px 16px; text-align: center; cursor: pointer; transition: .15s; background: var(--surface-2); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.busy { opacity: .6; pointer-events: none; }
.dropzone h2 { font-size: 17px; margin: 6px 0 4px; }
.dz-ic { color: var(--accent); }
.dz-btns { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.note { display: flex; gap: 10px; background: var(--accent-soft); border-radius: 6px; padding: 10px 12px; font-size: 13px; color: var(--ink-2); }
.note > span { color: var(--accent); }
.queue { display: grid; gap: 4px; margin-top: 12px; max-height: 360px; overflow: auto; }
.q-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 120px minmax(160px, 260px); gap: 10px; align-items: center; font-size: 12.5px; padding: 5px 4px; border-bottom: 1px solid var(--line); }
.q-name { display: flex; gap: 6px; align-items: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-size { color: var(--ink-3); text-align: right; }
.q-bar { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.q-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.q-row.skip { opacity: .55; } .q-row.done .q-bar i { background: var(--good); width: 100% !important; }
.q-row.err .q-st { color: var(--crit); } .q-row.skip .q-bar i { width: 100%; background: var(--ink-3); }

/* Einstellungen */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.settings-body { display: grid; gap: 14px; }
.pk-list { display: grid; gap: 8px; margin-bottom: 12px; }
.pk { display: grid; grid-template-columns: 34px 1fr auto auto; gap: 10px; align-items: center; background: var(--surface-2); border-radius: 6px; padding: 8px 10px; }
.pk small { display: block; }
.pk-ic { color: var(--accent); }
.widget-list { display: grid; gap: 4px; }
.widget-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; background: var(--surface-2); border-radius: 6px; }
.state-colors { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 8px; }
.card-body h3 { font-size: 13px; margin-top: 8px; }

/* Leer / Hinweise */
.empty-state { padding: 40px 20px; text-align: center; display: grid; justify-items: center; gap: 10px; }
.empty-state p { max-width: 520px; color: var(--ink-2); margin: 0; }
.empty-ic { color: var(--accent); }

/* Dialoge & Meldungen */
.modal { border: 0; border-radius: 10px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--surface-1); color: var(--ink-1); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal::backdrop { background: rgba(0, 0, 0, .45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; }
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 8px 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px 16px; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink-1); color: var(--surface-1); padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-size: 13px; transition: .4s; }
.toast.error { background: var(--crit); color: #fff; }
.toast.success { background: var(--good); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ───── Responsiv ───── */
@media (max-width: 1100px) {
  .grid-top { grid-template-columns: 1fr; }
  .analysis { grid-template-columns: 1fr; }
  .picker { position: static; max-height: none; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  body.side-open .side { transform: none; }
  body.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 50; }
  .menu-btn { display: inline-grid; }
  .main { padding: 12px 16px 32px; }
  .topbar { padding: 8px 16px; }
  .user-chip span:last-child { display: none; }
  .grid-2, .stats-grid { grid-template-columns: 1fr; }
  .tank-wrap { grid-template-columns: 1fr; }
  .period-label { margin-left: 0; width: 100%; }
  .seg button { min-width: 0; padding: 5px 12px; }
  .q-row { grid-template-columns: 1fr auto; }
  .q-row .q-bar { grid-column: 1 / -1; }
  .log li { grid-template-columns: 22px 1fr; }
  .log li span:last-child { grid-column: 2; }
  .kpis { margin-left: 0; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr; }
  .date-input { width: 140px !important; }
}

/* ───── Schichtenspeicher-Modell ───── */
.tank-card .tank-wrap { grid-template-columns: minmax(260px, 420px) 1fr; }
.tank-pic { width: 100%; }
.tank-svg .t-inner { font-size: 12px; fill: var(--ink-1); opacity: .55; }
.tank-svg .port-lbl { font-size: 10.5px; fill: var(--ink-2); }
.tank-svg .pipe { stroke-width: 5; }
.tank-svg .pipe-e { stroke: var(--ink-2); }
.tank-svg .flow-in { fill: none; stroke: transparent; stroke-width: 3; stroke-dasharray: 3 8; stroke-linecap: round; }
.tank-svg .flow-in.on { stroke: #eb6834; animation: flow 0.9s linear infinite; }
.tank-svg .t-sens { font-size: 11px; font-weight: 700; fill: var(--ink-1); paint-order: stroke; stroke: var(--surface-1); stroke-width: 3px; }
.tank-svg .front-line { stroke: var(--ink-1); stroke-width: 1.5; stroke-dasharray: 5 3; }
.tank-svg .front-lbl { font-size: 10.5px; font-weight: 600; fill: var(--ink-1); paint-order: stroke; stroke: var(--surface-1); stroke-width: 3px; }
.svgchart .grid.over { stroke: var(--surface-1); stroke-opacity: .35; }
.sensor-line { stroke: var(--ink-1); stroke-width: 1; stroke-dasharray: 3 4; opacity: .7; pointer-events: none; }
.svgchart .sensor-lbl { font-size: 10.5px; font-weight: 700; fill: var(--ink-1); paint-order: stroke; stroke: var(--surface-1); stroke-width: 3px; }
.front-path { fill: none; stroke: var(--ink-1); stroke-width: 2; pointer-events: none; }
.port-tick { stroke: var(--ink-2); stroke-width: 3; }
.port-tick.e { stroke: #eb6834; }
.temp-grad, .scale-legend i.temp-grad { background: linear-gradient(90deg, var(--cold), #c3c2b7, var(--hot)); }
.scale-legend .lg-front, .scale-legend .lg-sens { margin-right: 10px; color: var(--ink-2); }
.prose p, .prose li { font-size: 13.5px; line-height: 1.55; }
.prose ol { padding-left: 20px; }
.pct { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

.tank-svg .lance { fill: none; stroke: var(--ink-2); stroke-width: 5; stroke-linejoin: round; opacity: .75; }
.tank-svg .lance-hole { stroke: var(--surface-1); stroke-width: 2; }
.tank-svg .lance-lbl { font-size: 10px; fill: var(--ink-1); opacity: .7; }
.tank-svg .wellrohr { fill: none; stroke: var(--ink-1); stroke-width: 2.5; stroke-linejoin: round; opacity: .22; }
.tank-svg .floor { stroke: var(--ink-3); stroke-width: 1.5; }
.tank-svg .foot { stroke: var(--ink-3); stroke-width: 2; fill: none; }
.tank-svg .nozzle { fill: var(--surface-2); stroke: var(--ink-3); }
.tank-svg .muff { fill: var(--surface-2); stroke: var(--ink-3); stroke-width: 1; }
.tank-svg .pipe-dhw { stroke: #2a78d6; }
.tank-svg .dim { stroke: var(--ink-3); stroke-width: 1; }
.tank-svg .dim-lbl { font-size: 9.5px; fill: var(--ink-3); }

/* ───── Ersparnis & Optimierung ───── */
.page-tabs a { padding: 10px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.page-tabs a:hover { text-decoration: none; color: var(--ink-1); }
.page-tabs a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.period-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.period-row .period-bar { flex: 1; }
.export-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.kpi-grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 14px; }
.kpi-tile { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: grid; gap: 4px; align-content: start; }
.kpi-tile .kpi-l { font-size: 12px; font-weight: 600; color: var(--ink-2); display: flex; gap: 7px; align-items: center; }
.kpi-tile .kpi-l .sw { margin: 0; width: 10px; height: 10px; }
.kpi-tile .kpi-v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-tile.big .kpi-v { font-size: 32px; color: var(--good); }
.kpi-tile .kpi-s { font-size: 11.5px; color: var(--ink-3); }
.sankey { width: 100%; height: auto; }
.sankey .sk-band { opacity: .35; }
.sankey .sk-lbl { font-size: 12px; font-weight: 600; fill: var(--ink-1); }
.sankey .sk-val { font-size: 11.5px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.sankey .sk-note { font-size: 11.5px; fill: var(--good); font-weight: 600; }
.cmp-row { display: grid; grid-template-columns: minmax(150px, 1fr) 2fr auto; gap: 12px; align-items: center; padding: 8px 0; }
.cmp-l { font-size: 13px; font-weight: 600; display: grid; }
.cmp-l small { font-weight: 400; color: var(--ink-3); }
.cmp-bar { height: 14px; background: var(--surface-2); border-radius: 7px; overflow: hidden; }
.cmp-bar i { display: block; height: 100%; border-radius: 7px; }
.cmp-row b { font-variant-numeric: tabular-nums; }
.cmp-result { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-weight: 600; }
.cmp-result b { font-size: 22px; }
.pos { color: var(--good); } .neg { color: var(--crit); }
.warn { color: var(--warn); }
p.small, .small { font-size: 12.5px; }
.lg-item.static { cursor: default; }
.month-picks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.rec-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.rec.idle { opacity: .75; }
.rec-main { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; background: var(--surface-2); border-radius: 6px; padding: 12px; }
.rec-main small, .rec-kpis small { display: block; color: var(--ink-3); font-size: 11.5px; }
.rec-main b { font-size: 22px; }
.rec-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0; }
.rec-kpis b { font-size: 15px; font-variant-numeric: tabular-nums; }
.safety { display: grid; gap: 4px; margin: 6px 0 10px; }
.safety-bar { position: relative; height: 10px; background: var(--surface-2); border-radius: 5px; }
.safety-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; }
.safety-bar b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-1); }
.safety small { color: var(--ink-2); }
.rec details { margin-top: 6px; }
.rec details summary { cursor: pointer; color: var(--accent); }
.print-only { display: none; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .rec-grid { grid-template-columns: 1fr; } }
@media print {
  :root { --bg: #fff; }
  body { background: #fff; }
  .side, .topbar, .no-print, .scrim, #toasts { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .print-only { display: block; }
  .print-head h1 { font-size: 20px; margin-bottom: 2px; }
  .card, .kpi-tile { box-shadow: none; break-inside: avoid; border-color: #ccc; }
  .table-wrap { max-height: none; overflow: visible; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .svgchart { max-width: 100%; height: auto; }
  .tt { display: none !important; }
}
.note-warn { background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--ink-1); border-left: 3px solid var(--warn); padding: 8px 10px; border-radius: 4px; }
.note-ok { background: color-mix(in srgb, var(--good) 10%, transparent); border-left: 3px solid var(--good); padding: 8px 10px; border-radius: 4px; }
.ctrl-tbl td.chg { font-weight: 700; color: var(--accent); background: var(--accent-soft); }
.ctrl-tbl td.why { font-size: 12px; color: var(--ink-2); min-width: 260px; max-width: 420px; white-space: normal; }
.ctrl-tbl td { vertical-align: top; }
.todo { margin-top: 14px; background: var(--surface-2); border-radius: 6px; padding: 12px 16px; }
.todo ol { margin: 8px 0; padding-left: 20px; }
.todo li { margin: 4px 0; font-weight: 600; }
@media print { .ctrl-tbl input { border: 0; } .ctrl-tbl td.why { max-width: none; } }
.ctrl-tbl input[type=number] { width: 78px !important; max-width: none; }

/* ───── Mobile-first-Feinschliff (am Ende, damit diese Regeln gewinnen) ───── */
.hit { touch-action: pan-y; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
@media (max-width: 860px) {
  input:not([type=checkbox]):not([type=color]), select { font-size: 16px; }   /* verhindert Auto-Zoom auf iOS */
  .main { padding: 10px 10px 32px; gap: 10px; }
  .card-head { padding: 12px 12px 0; }
  .card-body { padding: 8px 12px 14px; }
  .tank-card .tank-wrap, .tank-wrap { grid-template-columns: 1fr; }
  .period-bar { gap: 10px; }
  .period-nav { width: 100%; }
  .period-nav .date-input { flex: 1; width: auto !important; }
  .range-inputs { flex: 1; }
  .range-inputs .date-input { width: auto !important; flex: 1; min-width: 0; }
  .seg { width: 100%; }
  .seg button { flex: 1; }
  .period-row .export-btns { width: 100%; }
  .period-row .export-btns .btn { flex: 1; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-tile.big { grid-column: 1 / -1; }
  .kpi-tile .kpi-v { font-size: 20px; }
  .kpi-tile.big .kpi-v { font-size: 30px; }
  .cmp-row { grid-template-columns: 1fr auto; }
  .cmp-row .cmp-bar { grid-column: 1 / -1; grid-row: 2; }
  .rec-main b { font-size: 18px; }
  .rec-kpis { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .legend { gap: 2px 12px; }
  .tabs, .page-tabs { overflow-x: auto; scrollbar-width: none; }
  .card-actions { flex-wrap: wrap; }
  .log li { grid-template-columns: 20px 1fr; }
  .log li time { grid-column: 2; font-size: 12px; }
  .log li > span:last-child { grid-column: 2; }
  .user-chip { padding: 2px; }
  .topbar h1 { font-size: 15px; }
  /* SVG-Schriften größer, da die Grafiken verkleinert dargestellt werden */
  .flow .fn-title { font-size: 17px; } .flow .fn-val { font-size: 19px; } .flow .fn-sub { font-size: 15px; }
  .flow .ring-num { font-size: 26px; } .flow .ring-sub { font-size: 13px; }
  .tank-svg .port-lbl { font-size: 13px; } .tank-svg .t-sens { font-size: 14px; } .tank-svg .front-lbl { font-size: 13px; }
  .tank-svg .t-title, .tank-svg .dim-lbl, .tank-svg .lance-lbl { font-size: 12px; }
  .sankey .sk-lbl { font-size: 15px; } .sankey .sk-val { font-size: 14px; } .sankey .sk-note { font-size: 14px; }
}
.cfg-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0 14px; }
.cfg-summary > div { background: var(--surface-2); border-radius: 6px; padding: 10px 12px; display: grid; gap: 2px; }
.cfg-summary small { color: var(--ink-3); font-size: 11.5px; }
.cfg-summary b { font-size: 16px; }
.field.grow { flex: 1; min-width: 200px; }
.stack-s { display: grid; gap: 6px; }
@media (max-width: 860px) { .cfg-summary { grid-template-columns: 1fr 1fr; } }
.ctrl-help { background: var(--surface-2); border-radius: 6px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
.ctrl-help summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.ctrl-help ul { margin: 8px 0 4px; padding-left: 20px; }
.ctrl-help li { margin: 4px 0; }
.fc-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.fc-month { margin-bottom: 4px; }
@media (max-width: 860px) { .fc-grid { grid-template-columns: repeat(3, 1fr); } }

/* AE SiteLink */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 14px; font-size: 13px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
textarea.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
textarea.mono { width: 100%; resize: vertical; }
.ae-out { margin: 12px 0; display: grid; gap: 10px; }
.ae-out .note-ok p, .ae-out .note-warn p { margin: 4px 0; overflow-wrap: anywhere; }
.ae-log summary, .ae-adv summary { cursor: pointer; font-weight: 600; margin: 8px 0; }
.ae-log pre { white-space: pre-wrap; word-break: break-all; max-height: 320px; overflow: auto; background: var(--surface-2); padding: 8px; border-radius: 4px; font-size: 11.5px; }
.ae-step { margin: 8px 0; font-size: 13px; }
.ae-adv { margin-top: 16px; border-top: 1px solid var(--line, rgba(127,127,127,.2)); padding-top: 8px; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }
.ae-debug { display: grid; gap: 6px; margin-top: 10px; }
.ae-dbg { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 12.5px; }
.ae-dbg.bad { border-left: 3px solid var(--bad, #e34948); }
.ae-dbg summary { cursor: pointer; overflow-wrap: anywhere; }
.ae-dbg-part { margin: 8px 0; }
.ae-dbg-part pre { white-space: pre-wrap; word-break: break-all; max-height: 360px; overflow: auto; background: var(--surface-2); padding: 8px; border-radius: 4px; font-size: 11.5px; margin: 4px 0 0; }
.ae-steps { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; font-size: 13px; counter-reset: st; }
.ae-steps li { display: flex; gap: 8px; align-items: baseline; color: var(--ink-2); }
.ae-steps li::before { counter-increment: st; content: counter(st) "."; font-weight: 600; min-width: 1.2em; }
.ae-steps .ae-tick { display: inline-block; width: 1.1em; color: var(--good); font-weight: 700; }
.ae-steps li.done { color: var(--ink-1); }
.side-ver { display: block; padding: 8px 12px 0; font-size: 11px; color: #8a8f96; text-decoration: none; }
.side-ver:hover { color: #c9cdd2; }
.svgchart .pts-line { stroke-dasharray: 4 4; stroke-width: 1.4; fill: none; opacity: .8; }
.svgchart .pt { stroke: var(--surface-1); stroke-width: 1.5; }
.tbl.compact td, .tbl.compact th { padding: 4px 8px; font-size: 12.5px; }

/* Werteleiste unter dem Verlaufsdiagramm (Hager-Flow-Stil) */
.chart-legend { margin-top: 10px; padding: 12px 4px 2px; border-top: 1px solid var(--line); }
.cl-head { font-size: 15px; font-weight: 600; color: var(--ink-1); margin: 0 0 10px 6px; font-variant-numeric: tabular-nums; min-height: 1.4em; }
.cl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; }
.cl-item { display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto auto; column-gap: 8px; align-items: center; text-align: left; background: none; border: 0; padding: 6px; border-radius: 6px; font: inherit; color: inherit; cursor: pointer; }
.cl-item:hover { background: var(--surface-2); }
.cl-item i { grid-row: 1 / span 2; width: 22px; height: 10px; border-radius: 3px; }
.cl-l { font-size: 13px; color: var(--ink-2); line-height: 1.3; }
.cl-v { grid-column: 2; font-size: 16px; font-weight: 600; color: var(--ink-1); font-variant-numeric: tabular-nums; }
.cl-s { grid-column: 2; font-size: 11.5px; color: var(--ink-3, var(--ink-2)); font-variant-numeric: tabular-nums; }
.cl-item.off { opacity: .45; }
.cl-item.off i { background: transparent !important; outline: 1.5px dashed var(--ink-2); }
.cl-item.band { cursor: default; }
.cl-item.band:hover { background: none; }
@media (max-width: 600px) { .cl-grid { grid-template-columns: 1fr 1fr; } .cl-v { font-size: 15px; } }

.settings-links { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 4px 4px 12px; font-size: 13px; }
.settings-links a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; }
.settings-links a:hover { color: var(--accent); }

/* Heute (live) / Stromnetz */
.section-title { font-size: 15px; font-weight: 600; margin: 18px 4px 8px; color: var(--ink-1); }
.live-dot { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.live-dot::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #1baf7a; box-shadow: 0 0 0 0 rgba(27, 175, 122, .6); animation: livepulse 2s infinite; }
@keyframes livepulse { 70% { box-shadow: 0 0 0 8px rgba(27, 175, 122, 0); } 100% { box-shadow: 0 0 0 0 rgba(27, 175, 122, 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot::before { animation: none; } }
/* große Kacheln ohne Wertung (Live-Werte): Zahl in normaler Schriftfarbe */
.kpi-tile.big.neutral .kpi-v { color: var(--ink-1); }

.date-pair { display: inline-flex; gap: 6px; }
select.date-input { padding-right: 28px; }
.svgchart .line.dash { stroke-dasharray: 6 4; stroke-width: 1.8; }

/* Datenempfang */
.src-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 2px 6px; font-size: 12.5px; }
.src-title { font-weight: 600; color: var(--ink-2); margin-right: 2px; }
.src-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; background: var(--surface-1); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; cursor: default; }
.src-chip b { color: var(--ink-1); font-weight: 600; }
.src-chip i { width: 8px; height: 8px; border-radius: 50%; background: #8a8984; flex: none; }
.src-chip.ok i { background: #1baf7a; }
.src-chip.warn i { background: #eda100; }
.src-chip.bad i { background: #e34948; }
.src-chip.info i { background: #2a78d6; }
.src-chip.off { opacity: .7; }
.w-l { width: 100%; max-width: 360px; margin: 6px 0 10px; }
.seg.sm-seg button { padding: 3px 10px; min-width: 0; font-size: 12px; }
.card-actions .muted.small { margin-right: 4px; }

/* Energiefluss Balkonkraftwerk (hell, Hager-Stil) */
.flow-wrap { overflow-x: auto; }
.flow-svg { display: block; width: 100%; max-width: 760px; min-width: 520px; height: auto; margin: 0 auto; font-family: inherit; }
.fl-node > rect:first-child { fill: var(--surface-1); stroke: var(--line); stroke-width: 1; filter: drop-shadow(0 1px 2px rgba(16, 24, 40, .06)); }
.fl-t { font-size: 12px; fill: var(--ink-3); }
.fl-v { font-size: 19px; font-weight: 600; fill: var(--ink-1); font-variant-numeric: tabular-nums; }
.fl-s { font-size: 11px; fill: var(--ink-3); }
.fl-bg { fill: none; stroke: var(--surface-3); stroke-width: 3; }
.fl-run { fill: none; stroke-linecap: round; stroke-dasharray: 6 8; animation: fl-move 1s linear infinite; }
.fl-run.rev { animation-direction: reverse; }
.fl-bar { fill: var(--surface-3); }
@keyframes fl-move { to { stroke-dashoffset: -14; } }
@media (prefers-reduced-motion: reduce) { .fl-run { animation: none; } }
.batt-card { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.batt-ic { flex: none; width: 96px; }
.batt-svg { display: block; width: 96px; height: auto; }
.batt-body { fill: var(--surface-2); stroke: var(--ink-3); stroke-width: 4; }
.batt-cap { fill: var(--ink-3); }
.batt-t { font-size: 24px; font-weight: 700; fill: var(--ink-1); }
.batt-card .kv { flex: 1; min-width: 240px; }
/* überbrückte Messlücke im Diagramm */
.svgchart .line.gap { stroke-dasharray: 2 4; stroke-width: 1.4; opacity: .55; }
/* Anteile der Verbraucher */
.share-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--surface-2); margin-bottom: 14px; }
.share-bar > span { min-width: 3px; }
.batt-lim { stroke: var(--ink-2); stroke-width: 2; stroke-dasharray: 4 3; }
.batt-lt { font-size: 11px; fill: var(--ink-2); }
.batt-ic { width: 210px; }
.batt-svg { width: 210px; }
.fl-lim { stroke: var(--ink-1); stroke-width: 2; }

/* Wärmepumpe: Systemübersicht (hell, Hager-Stil) */
.wp-overview { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.wp-side { display: grid !important; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: 12px; }
@media (max-width: 900px) { .wp-side { grid-template-columns: 1fr; } }
.wp-scene { overflow-x: auto; }
.wp-svg { display: block; width: 100%; max-width: 1100px; min-width: 560px; height: auto; margin: 0 auto; font-family: inherit; }
.wp-house { fill: var(--surface-2); stroke: var(--line); stroke-width: 3; stroke-linejoin: round; }
.wp-ground { stroke: var(--ink-3); stroke-width: 2; }
.wp-sun circle { fill: #f5c451; } .wp-sun line { stroke: #f5c451; stroke-width: 3; stroke-linecap: round; }
.wp-rad rect { fill: var(--surface-1); stroke: var(--ink-3); stroke-width: 2; }
.wp-unit { fill: var(--surface-1); stroke: var(--ink-3); stroke-width: 2; }
.wp-unit.on { stroke: var(--accent); }
.wp-bolt { fill: none; stroke: var(--ink-3); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.wp-bolt.on { stroke: #eda100; }
.wp-fanring { fill: var(--surface-2); stroke: var(--ink-3); stroke-width: 2; }
.wp-fan path, .wp-fan circle { fill: var(--ink-3); }
.wp-fan.spin { animation: wp-spin 1.6s linear infinite; transform-box: fill-box; transform-origin: center; }
.wp-fan.spin path, .wp-fan.spin circle { fill: var(--accent); }
@keyframes wp-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .wp-fan.spin { animation: none; } }
.wp-tankbox { fill: var(--surface-1); stroke: var(--ink-3); stroke-width: 2.5; }
.wp-v { font-size: 17px; font-weight: 600; fill: var(--ink-1); font-variant-numeric: tabular-nums; }
.wp-t { font-size: 12px; fill: var(--ink-3); }
.wp-s { font-size: 12px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.wp-side { display: flex; flex-direction: column; gap: 12px; }
.wp-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 700px) { .wp-stats { grid-template-columns: 1fr 1fr; } }
.wp-stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--surface-1); }
.wp-stat.on { border-color: var(--accent); background: var(--accent-soft); }
.wp-stat-l { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; }
.wp-stat-v { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: .02em; }
.wp-stat-s { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.wp-tankcard { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--surface-1); }
.wp-tankwrap { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.wp-tank { width: 150px; height: auto; display: block; }
.wp-tick { stroke: var(--ink-3); stroke-width: 1.5; }
.wp-soll { stroke: var(--ink-1); stroke-width: 2; stroke-dasharray: 5 3; }
.wp-tankwrap .kv { flex: 1; min-width: 160px; }
.wp-onfill { paint-order: stroke; stroke: var(--surface-1); stroke-width: 4px; stroke-linejoin: round; }
.wp-pipe { fill: none; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.wp-flow { stroke: rgba(255, 255, 255, .85); stroke-width: 2.5; }
.wp-tag { font-weight: 700; fill: var(--ink-1); }
.wp-coil { fill: none; stroke: #eda100; stroke-width: 2.5; stroke-linecap: round; }
.wp-unit.etherm { stroke: #eda100; }
.wp-pufwrap { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 20px; align-items: center; }
@media (max-width: 800px) { .wp-pufwrap { grid-template-columns: 1fr; } }
.wp-pufpic .tank-svg { width: 100%; height: auto; display: block; }
.wp-pump { fill: var(--surface-1); stroke: var(--ink-3); stroke-width: 2; }
.wp-pump.on { stroke: var(--accent); }
.wp-pumptri { fill: var(--ink-3); }
.wp-mix { fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linejoin: round; }
.wp-sensor { fill: var(--surface-1); stroke: var(--ink-1); stroke-width: 1.5; }
.wp-hit { fill: transparent; cursor: pointer; }
.wp-hit:hover { fill: rgba(11, 107, 203, .06); stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 3; }
.modal:has(.wp-curve) { width: min(900px, calc(100vw - 32px)); }
.wp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.wp-chip { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--ink-2); background: var(--surface-1); }
.wp-chip.on { border-color: var(--accent); background: var(--accent-soft); }
.wp-today { display: flex; flex-direction: column; gap: 14px; }
.wp-today-row { display: flex; gap: 10px; align-items: flex-start; }
.wp-today-row .sw { width: 10px; height: 10px; border-radius: 3px; margin-top: 6px; flex: none; }
.wp-today-v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tank-svg .pipe-hkv { stroke: #e34948; }
.tank-svg .pipe-hkr { stroke: #7fb8e8; }

/* Energiemanagement */
.ems-state { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ems-badge { border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: 13px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.ems-badge.on { background: #fdecea; color: #b3261e; border-color: #f2b8b5; }
.ems-badge.sim { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.ems-badge.hand { background: #fff4e0; color: #8a5a00; border-color: #f5d29a; }
.ems-checks { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; gap: 4px; font-size: 13px; }
.ems-checks li { display: flex; gap: 8px; align-items: center; }
.ems-checks li.ok span { color: var(--good); } .ems-checks li.no span { color: var(--crit); } .ems-checks li.no { color: var(--ink-2); }
.ems-progress { position: relative; height: 14px; border-radius: 7px; background: var(--surface-3); overflow: hidden; margin: 10px 0; }
.ems-progress span { position: absolute; inset: 0 auto 0 0; background: #e34948; border-radius: 7px; }
.ems-progress b { position: absolute; right: 8px; top: -2px; font-size: 11px; color: var(--ink-1); }

/* Ersparnis: Warmwasser-Deckung */
.dhw-gauge { height: 8px; border-radius: 4px; background: var(--line, #e3e2dc); overflow: hidden; margin: 6px 0 4px; }
.dhw-gauge i { display: block; height: 100%; background: #2a78d6; border-radius: 4px; transition: width .3s; }

/* Gruppierte Liste (Apple-Stil): eine gerundete Fläche, Zeilen durch Linien getrennt */
.mod-list { display: flex; flex-direction: column; margin: 8px 0 14px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-1); }
.mod-row { padding: 11px 14px; cursor: pointer; }
.mod-row + .mod-row { border-top: 1px solid var(--line); }
.mod-row > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.mod-row .row { gap: 6px; flex-wrap: nowrap; }

/* Wärmepumpe: Laufprotokoll, Extremwerte */
.wp-mode { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: #eef0f2; color: var(--ink-1); }
.wp-mode.dhw { background: #f1e6fb; color: #7a2fb8; }
.wp-mode.ch { background: #fde8e8; color: #b8282a; }
.wp-mode.mix { background: #fff2d9; color: #8a5a00; }
tr.wp-run-on td { background: #f2fbf6; }
.wp-ext .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; }

/* ───── Übersicht (Kacheln) ───── */
.board-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.board-head .section-title { margin: 0; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.bw { min-width: 0; }
.bw.s { grid-column: span 1; } .bw.m { grid-column: span 2; } .bw.l { grid-column: 1 / -1; }
.bw.card { padding: 14px 16px; margin: 0; }
.bw.bare > .bw-body > .grid-top { margin: 0; }
.bw-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.bw-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; color: var(--ink-2); text-decoration: none; }
a.bw-title[href]:hover { color: var(--accent, #2a78d6); }
.bw-tools { display: flex; gap: 4px; align-items: center; }
.bw-size { font-size: 12px; padding: 2px 4px; height: auto; width: auto; }
.bw-v { font-size: 28px; font-weight: 700; line-height: 1.15; color: var(--ink-1); }
.bw-s { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.bw-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 8px 0 4px; }
.bw-bar i { display: block; height: 100%; border-radius: 4px; }
.bw-kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0 0; font-size: 13px; }
.bw-kv dt { color: var(--ink-3); } .bw-kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.bw-list { display: grid; gap: 6px; }
.bw-row { display: grid; grid-template-columns: minmax(0, 1.2fr) 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.bw-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bw-row i { display: block; height: 6px; border-radius: 3px; }
.board.editing .bw { outline: 2px dashed var(--line); outline-offset: 3px; cursor: grab; }
.board.editing .bw.bare { background: var(--surface-1); border-radius: 14px; padding: 10px; }
.bw.drag { opacity: .4; } .bw.over { outline-color: #2a78d6 !important; }
.board-tray h3 { margin: 20px 0 8px; font-size: 14px; }
.board-add { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.bw-add { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px; background: transparent; cursor: pointer; }
.bw-add:hover { border-color: #2a78d6; }
.bw-add small { color: var(--ink-3); }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } .bw.m { grid-column: 1 / -1; } }
@media (max-width: 600px) { .board { grid-template-columns: minmax(0, 1fr); } .bw.s, .bw.m { grid-column: 1 / -1; } }
.bw.bare .src-bar { margin: 0; }

/* ───── Einstellungen (Aufbau wie die macOS-Systemeinstellungen) ───── */
.set-shell { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 22px; align-items: start; }
.set-nav { position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow-y: auto; padding-bottom: 12px; }
.set-group { margin-bottom: 14px; }
.set-gtitle { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; margin: 0 10px 6px; }
.set-list { background: var(--surface-1); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.set-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; text-align: left; font: inherit; color: var(--ink-1); cursor: pointer; }
.set-item + .set-item { border-top: 1px solid var(--line); }
.set-item:hover { background: var(--surface-2); }
.set-item.on { background: var(--accent); color: var(--accent-ink); }
.set-item.on .set-l small { color: inherit; opacity: .85; }
.set-ic { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.set-ic .ic { stroke: #fff; }
.set-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #8a8984, #52514e); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.set-item.profile { padding: 12px 10px; }
.set-l { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.set-l small { font-size: 12px; color: var(--ink-3); }
.set-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.set-dot.on { background: #1baf7a; }
.set-chev { color: var(--ink-3); display: none; }
.set-ver { margin: 10px; }
.set-pane { min-width: 0; }
.set-pane-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.set-pane-head h1 { font-size: 22px; margin: 0; }
.set-back { display: none; align-items: center; gap: 2px; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; padding: 4px 0; }
.set-pane .card { border-radius: 12px; }
.set-pane .stack > .muted:first-child { margin: 0 2px; }
@media (max-width: 899px) {
  .set-shell { grid-template-columns: minmax(0, 1fr); }
  .set-shell.show-pane .set-nav, .set-shell.show-list .set-pane { display: none; }
  .set-nav { position: static; max-height: none; }
  .set-item { padding: 11px 12px; }
  .set-chev { display: inline-flex; }
  .set-back { display: inline-flex; }
  .set-pane-head { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* Listenzeilen mit Schalter rechts (Module, Kacheln, Darstellung) */
.mod-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.mod-row > span:first-child { flex: 1; min-width: 0; }
.mod-row.dim { opacity: .6; }
.mod-state { font-style: normal; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9px; background: var(--surface-3); color: var(--ink-2); margin-left: 8px; vertical-align: 1px; }
.mod-state.on { background: #dff5e9; color: #146c3a; }
input.switch { appearance: none; -webkit-appearance: none; width: 42px; height: 25px; border-radius: 13px; background: var(--surface-3); position: relative; cursor: pointer; flex: none; transition: background .2s; margin: 0; border: 0; }
input.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
input.switch:checked { background: #34c759; }
input.switch:checked::after { transform: translateX(17px); }
input.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Changelog */
.cl-h { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin: 12px 0 4px; color: var(--ink-3); }
.cl-h:first-child { margin-top: 0; }
.cl-h.neu { color: #146c3a; } .cl-h.behoben { color: #b25e00; } .cl-h.sicherheit { color: #c62828; }
.cl-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.cl-list code { font-size: 12px; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }

/* Stromtarif */
.tar-row { align-items: flex-end; }
.tar-grid { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.tar-f { margin: 0; }
.tar-f span { font-size: 12px; }

.tar-h { font-size: 12.5px; margin: 14px 0 4px; color: var(--ink-2); }
.bill-wrap { margin: 10px 0; }
.bill-wrap summary { cursor: pointer; color: var(--accent); font-size: 13px; }
table.bill { max-width: 460px; margin-top: 8px; }
table.bill tr.sub td { border-top: 1px solid var(--line); }
table.bill tr.sum td { font-weight: 700; border-top: 1px solid var(--line); }

/* Stromtarif: Bestandteile als Tabelle wie auf der Rechnung */
.tar-parts { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-1); }
.tar-part { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto minmax(0, 0.9fr) 32px; gap: 8px; align-items: center; padding: 8px 12px; }
.tar-part + .tar-part { border-top: 1px solid var(--line); }
.tar-part.head { font-size: 12px; color: var(--ink-3); padding-top: 6px; padding-bottom: 6px; background: var(--surface-2); }
.tar-part input, .tar-part select { width: 100%; }
.tar-part-add { padding: 8px 12px; border-top: 1px solid var(--line); }
@media (max-width: 600px) { .tar-part { grid-template-columns: 1fr 1fr; } .tar-part.head { display: none; } }

/* Seiten anpassen (layout.js): ausgeblendete Karten/Kennzahlen, Knopf in der Kopfzeile */
.lay-off { display: none !important; }
.cust-btn { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 600px) { .cust-btn span { display: none; } }

/* Datenqualität */
.badge.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.tbl-wrap { overflow-x: auto; }
.health-banner.good { border-left: 4px solid var(--good); }
.health-banner.warn { border-left: 4px solid var(--warn); }
.health-banner.bad { border-left: 4px solid var(--crit); }
.hb-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hb-head b { font-size: 15px; }
.health-banner.good .hb-head > span:first-child { color: var(--good); }
.health-banner.warn .hb-head > span:first-child { color: var(--warn); }
.health-banner.bad .hb-head > span:first-child { color: var(--crit); }
.hb-list { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.hb-list li.error { color: var(--crit); }
.cov { font-weight: 600; font-variant-numeric: tabular-nums; }
.cov.good { color: var(--good); } .cov.warn { color: var(--warn); } .cov.bad { color: var(--crit); }
.cron-bars { display: grid; gap: 6px; }
.cron-bar { display: grid; grid-template-columns: minmax(0, 11em) 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; }
.cron-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cron-bar i { height: 8px; border-radius: 4px; background: var(--accent); min-width: 2px; }
.cron-bar b { font-variant-numeric: tabular-nums; }

/* PV-Prognose */
.fc-days { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fc-day { display: grid; gap: 2px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-1); color: var(--ink-1); cursor: pointer; font: inherit; font-size: 12.5px; }
.fc-day.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.fc-day small { color: var(--ink-3); font-size: 11.5px; }
.fc-day > b { font-size: 20px; font-variant-numeric: tabular-nums; }
.fc-mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fc-mini > div { display: grid; gap: 1px; font-size: 12px; }
.fc-mini small { color: var(--ink-3); }
.fc-mini b { font-size: 18px; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .fc-days { grid-template-columns: 1fr; } }
.tar-part.meter-row { grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr) 32px; }
@media (max-width: 700px) { .tar-part.meter-row { grid-template-columns: 1fr 1fr; } }
.tbl tr.dim td { opacity: .55; }

/* Jahresbericht + Druckansicht */
.report-head h1 { font-size: 22px; margin: 4px 0 2px; }
.report-head p { margin: 0; }
.tbl.report tr.sum td { font-weight: 700; border-top: 2px solid var(--line); }
.tbl.report tr.prev td { color: var(--ink-3); }
@media print {
  .side, .topbar, .scrim, .no-print, .cust-btn, .toast, .card-actions { display: none !important; }
  .shell, .content { display: block !important; }
  .main { padding: 0 !important; gap: 10px !important; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
  .tbl th { position: static; }
  .tbl tr:hover td { background: none; }
}
.form-msg.info { background: var(--accent-soft); color: var(--accent); }
.pv-array { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-1); }
.pv-array-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.pv-array-head .muted { flex: 1; }

/* Eigene Schnittstellen */
pre.code { background: var(--surface-2); padding: 10px 12px; border-radius: 8px; font-size: 12px; overflow-x: auto; white-space: pre; }
.tar-part.gen-map { grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) 90px minmax(0, 1.4fr); }
.gen-fields { max-height: 340px; overflow: auto; }
.tbl td.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; word-break: break-all; }
@media (max-width: 700px) { .tar-part.gen-map { grid-template-columns: 1fr 1fr; } }

/* Einstellungszeilen mit Eingabefeld/Auswahl rechts: Beschriftung behält Platz, Feld nimmt nur den Rest (schmal: umbrechen) */
.mod-row { flex-wrap: wrap; }
.mod-row > span:first-child { flex: 1 1 220px; }
.mod-row > input:not(.switch):not([type="checkbox"]):not([type="radio"]), .mod-row > select { flex: 0 1 340px; width: auto; min-width: 0; max-width: 100%; }

/* API-Dokumentation (/api/v1/docs) */
body.apidocs { background: var(--surface-0, #f3f4f6); }
body.apidocs .main { max-width: 1100px; margin: 0 auto; }
.api-toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 20px; font-size: 13px; }
.api-toc > div { display: grid; gap: 3px; }
.api-toc a { color: var(--ink-1); text-decoration: none; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.api-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.api-path { font-size: 14px; font-weight: 600; }
.api-m { display: inline-block; min-width: 44px; text-align: center; font: 700 11px/1 ui-monospace, Menlo, monospace; padding: 4px 6px; border-radius: 5px; color: #fff; background: #0b6bcb; }
.api-m.POST { background: #1a7f37; }
.api-body { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
pre.api-res { max-height: 420px; overflow: auto; }

/* Wetter in der PV-Prognose */
.wx-ic { vertical-align: middle; flex: none; }
.fc-wx { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.fc-wx .t-hi { color: #d64541; }
.fc-wx .t-lo { color: #2a78d6; }
.fc-wxrow { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.fc-wxrow > div { display: grid; justify-items: center; gap: 1px; font-size: 12px; }
.fc-wxrow small { color: var(--ink-3); font-size: 11px; }
.fc-wxrow small.rain { color: #2a78d6; min-height: 13px; }
@media (max-width: 520px) { .fc-wxrow { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 8px; } }

/* ───── Energiefluss (Hager-Stil, flow.js) und Statistik-Ringe ───── */
:root { --ef-sun: #f2b600; --ef-navy: #1f3a68; --ef-sky: #9cc8f2; --ef-green: #1baf7a; --ef-grey: #c9ccd0; --ef-dot: #2a78d6; --ef-hot: #e34948; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ef-sun: #e3ad00; --ef-navy: #3d63a8; --ef-sky: #a3d0fa; --ef-green: #199e70; --ef-grey: #4a4b48; --ef-dot: #5aa2f0; --ef-hot: #e66767; } }
:root[data-theme="dark"] { --ef-sun: #e3ad00; --ef-navy: #3d63a8; --ef-sky: #a3d0fa; --ef-green: #199e70; --ef-grey: #4a4b48; --ef-dot: #5aa2f0; --ef-hot: #e66767; }
.ef-card .card-body { display: grid; place-items: center; }
.ef-wrap { width: 100%; max-width: 820px; }
.ef-wrap.compact { max-width: 420px; }
.ef { display: block; width: 100%; height: auto; }
.ef-line { fill: none; stroke: var(--line); stroke-width: 2; stroke-linejoin: round; }
.ef-line.on { stroke: var(--ink-3); stroke-width: 1.8; }
.ef-arrow { fill: var(--ef-dot); }
.ef-dot { fill: var(--ef-dot); }
.ef-circle { fill: var(--surface-1); stroke: var(--line); stroke-width: 1.5; }
.ef-node.on .ef-circle { stroke: var(--ink-3); }
.ef-node.k-pv.on .ef-circle { stroke: var(--ef-sun); stroke-width: 2; }
.ef-node.k-hp.hot .ef-circle { stroke: var(--ef-hot); stroke-width: 2; }
.ef-node.k-hp.hot .ef-ic path { stroke: var(--ef-hot); }
.ef-node.k-eth.hot .ef-circle { stroke: var(--ef-hot); stroke-width: 2; }
.ef-node.k-eth.hot .ef-ic path { stroke: var(--ef-hot); }
.ef-ic path { fill: none; stroke: var(--ink-1); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ef-t { fill: var(--ink-3); }
.ef-t.ef-hot { fill: var(--ef-hot); font-weight: 600; }
.ef-v { fill: var(--ink-1); font-weight: 700; font-variant-numeric: tabular-nums; }
.ef-bat-body { fill: none; stroke: var(--ink-1); stroke-width: 1.5; }
.ef-bat-tip { fill: var(--ink-1); }
.ef-bat-fill { fill: var(--ef-green); opacity: .35; }
.ef-bat.low .ef-bat-fill { fill: var(--ef-hot); }
.ef-bat-t { font-size: 8.5px; font-weight: 700; fill: var(--ink-1); font-variant-numeric: tabular-nums; }
.ef-ring-bg { fill: var(--surface-1); }
.ef-ring-track { fill: none; stroke: var(--surface-3); stroke-width: 11; }
.ef-ring-own { fill: none; stroke: var(--ef-sun); stroke-width: 11; }
.ef-ring-grid { fill: none; stroke: var(--ef-navy); stroke-width: 11; }
.ef-ring-num { font-weight: 700; fill: var(--ink-1); font-variant-numeric: tabular-nums; }
.ef-ring-sub { fill: var(--ink-3); }
.st-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.st-box { background: var(--surface-2); border-radius: var(--radius); padding: 14px; display: grid; justify-items: center; align-content: start; gap: 10px; }
.st-box h3 { font-size: 13px; margin: 0; justify-self: start; }
.st-donut svg { display: block; }
.st-track { fill: none; stroke: var(--surface-3); stroke-width: 13; }
.st-arc { fill: none; stroke-width: 13; }
.st-arc.own { stroke: var(--ef-sun); } .st-arc.navy { stroke: var(--ef-navy); } .st-arc.sky { stroke: var(--ef-sky); }
.st-arc.green { stroke: var(--ef-green); } .st-arc.grey { stroke: var(--ef-grey); }
.st-num { font-size: 20px; font-weight: 700; fill: var(--ink-1); font-variant-numeric: tabular-nums; }
.st-sub { font-size: 9.5px; fill: var(--ink-3); }
.st-legend { display: grid; gap: 4px; font-size: 12.5px; width: 100%; max-width: 260px; }
.st-legend > div { display: grid; grid-template-columns: 11px 1fr auto; gap: 8px; align-items: center; }
.st-legend b { font-variant-numeric: tabular-nums; }
.st-dot { width: 11px; height: 11px; border-radius: 50%; display: block; }
.st-dot.own { background: var(--ef-sun); } .st-dot.navy { background: var(--ef-navy); } .st-dot.sky { background: var(--ef-sky); }
.st-dot.green { background: var(--ef-green); } .st-dot.grey { background: var(--ef-grey); }
.st-note { font-size: 12px; color: var(--ink-2); font-weight: 600; }
@media (max-width: 860px) { .st-grid { grid-template-columns: minmax(0, 1fr); } }
.push-state { display: flex; align-items: center; gap: 8px; }
.push-thr { display: inline-flex; align-items: center; gap: 6px; }
.push-thr input { width: 84px !important; min-height: 32px; }
/* Erste Schritte (views/start.js) */
.setup-banner { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 12px; border-radius: 10px; background: var(--accent-soft); color: var(--ink-1); font-size: 13.5px; }
.setup-banner > span:first-child { color: var(--accent); display: inline-flex; }
.setup-banner > span:nth-child(2) { flex: 1; min-width: 0; }
.setup-banner a { font-weight: 600; }
.start-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.start-head h3 { margin: 0; flex: 1; min-width: 12em; font-size: 15px; }
.start-step .card-body > p { margin: 6px 0 0; }
.start-step.ok { opacity: .85; }
.start-sub { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.start-sub ul { margin: 4px 0; padding-left: 1.2em; }
.start-src { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.start-src .src-chip { white-space: normal; }
.start-bar { margin: 4px 0 10px; }
.start-bar i { background: var(--good); }
.tank-hint { margin: 8px 0 0; }

/* Verbraucher: anklickbare Geräte (Kacheln, Tabellenzeilen) und Leistungsbalken der Kompaktliste */
.clickable { cursor: pointer; }
.kpi-tile.clickable:hover { border-color: var(--accent); }
tr.clickable:hover td { background: var(--accent-soft); }
.bar-track { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; }
.consumer-list td { vertical-align: middle; }

/* Sortierbare Tabellen (assets/js/tablesort.js): Kopf anklickbar, Pfeil zeigt die Richtung */
.tbl.sortable thead th { cursor: pointer; user-select: none; }
.tbl.sortable thead th:hover { color: var(--ink-1); }
.tbl.sortable thead th::after { content: '↕'; margin-left: 4px; opacity: .25; font-size: 10px; }
.tbl.sortable thead th:empty::after { content: none; }
.tbl.sortable thead th.sort-asc::after { content: '▲'; opacity: .8; }
.tbl.sortable thead th.sort-desc::after { content: '▼'; opacity: .8; }
