/* heizung.ferrano.de – Heizzentrale (Entwurf 2), hell/dunkel */

/* Schriften lokal (DSGVO: keine Google-Server). Dateien siehe fonts/LIESMICH.txt.
   Fehlen sie, greifen die Systemschriften. */
@font-face { font-family: 'IBM Plex Sans'; src: url('fonts/ibm-plex-sans-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('fonts/ibm-plex-sans-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('fonts/ibm-plex-sans-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('fonts/ibm-plex-sans-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('fonts/ibm-plex-mono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('fonts/ibm-plex-mono-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --sans: 'IBM Plex Sans', 'Helvetica Neue', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --r: 10px;
}
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1216; --card: #171C22; --line: #2A323C; --ink: #ECE9E3; --muted: #A3ACB7;
  --track: #232A32; --chip-on: #2A323C; --dashed: #56606B; --dot-off: #5E6772;
  --accent: #FF8A3D; --on-accent: #1A0E05; --mid: #7A4A2A; --on-mid: #FFFFFF;
  --ok: #34D399; --warn: #F5B14C; --warn-bg: #33250F; --warn-line: #7A5418; --warn-ink: #FFE1B0;
  --tank1: #C2410C; --tank2: #9A4A1E; --tank3: #4A3A33; --tt1: #FFFFFF; --tt2: #FFFFFF; --tt3: #FFFFFF;
  --s-kessel: #FF8A3D; --s-ruecklauf: #FFC247; --s-p-oben: #FF5A5F; --s-p-mitte: #D98CFF; --s-p-unten: #B58B7A;
  --s-ww: #F2E27A; --s-hk1: #5AA9FF; --s-hk2: #9CD1FF; --s-kol: #34D399; --s-aussen: #E6E6E6;
  --s-abgas: #C9CED6; --s-o2: #5AA9FF; --s-lade: #FF8A3D;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F4F5F7; --card: #FFFFFF; --line: #D9DEE4; --ink: #14181D; --muted: #58616C;
  --track: #E6E9ED; --chip-on: #E1E6EC; --dashed: #9AA3AD; --dot-off: #9AA3AD;
  --accent: #C2410C; --on-accent: #FFFFFF; --mid: #EE9A5E; --on-mid: #14181D;
  --ok: #059669; --warn: #B45309; --warn-bg: #FFF4E5; --warn-line: #F2C38B; --warn-ink: #5C3A0B;
  --tank1: #C2410C; --tank2: #EE9A5E; --tank3: #F7D3B5; --tt1: #FFFFFF; --tt2: #14181D; --tt3: #14181D;
  --s-kessel: #C2410C; --s-ruecklauf: #B7791F; --s-p-oben: #B91C1C; --s-p-mitte: #9333EA; --s-p-unten: #8B5E4A;
  --s-ww: #A16207; --s-hk1: #1D4ED8; --s-hk2: #0284C7; --s-kol: #047857; --s-aussen: #14181D;
  --s-abgas: #475569; --s-o2: #1D4ED8; --s-lade: #C2410C;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 28px 40px 56px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 700px) { .wrap { padding: 18px 16px 40px; gap: 14px; } }

/* Kopf */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand svg { flex-shrink: 0; stroke: var(--accent); }
.brand-name { display: block; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.brand-sub { display: block; font-size: 13px; color: var(--muted); }
.header-right { display: flex; align-items: center; gap: 20px; }
.tabs { display: flex; gap: 28px; }
.tab { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; font-size: 15px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.theme-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
:root[data-theme="light"] .theme-btn .i-sun, :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }

/* Hinweise */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--r); color: var(--warn-ink); font-size: 15px; }
.notice svg { flex-shrink: 0; margin-top: 2px; stroke: currentColor; }

/* Karten allgemein */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.h-label { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

/* Kennzahlen */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 800px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; }
.kpi-label { font-size: 13px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.kpi-value { display: flex; align-items: baseline; gap: 6px; }
.kpi-value .num { font-size: 30px; font-weight: 600; line-height: 1.1; }
.kpi-value .text { font-size: 26px; font-weight: 600; line-height: 1.15; }
.kpi-unit { font-size: 15px; color: var(--muted); }
.kpi-sub { font-size: 13px; color: var(--muted); }
.live-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--ok); display: inline-block; }
.live-dot.stale { background: var(--warn); }

/* Anlagenschema */
.schema { display: grid; grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1.05fr) 64px minmax(0, 1fr); gap: 0 8px; align-items: stretch; }
.col { display: flex; flex-direction: column; gap: 14px; }
.col-head { font-size: 12px; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; min-height: 18px; }
.arrows { display: flex; flex-direction: column; justify-content: space-around; padding-top: 32px; }
.arrow { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); text-align: center; }
.arrow-down { display: none; align-items: center; justify-content: center; gap: 10px; font-size: 12px; color: var(--muted); }
.flow line, .flow path { stroke: var(--dashed); stroke-width: 2; fill: none; }
.flow line { stroke-dasharray: 4 4; }
.flow.on line, .flow.on path { stroke: var(--accent); stroke-dasharray: none; }
@media (max-width: 900px) {
  .schema { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .arrows { display: none; }
  .arrow-down { display: flex; }
}

.node { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; }
.node.active { border-color: var(--accent); }
.node-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.node-status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.node-status::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--dot-off); }
.node.active .node-status::before { background: var(--accent); }
.node-main { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.node-main .num { font-size: 38px; font-weight: 600; line-height: 1; }
.node-main .unit { font-size: 15px; color: var(--muted); }
.node-main .sub { font-size: 13px; color: var(--muted); margin-left: 6px; }
.rows { display: flex; flex-direction: column; }
.row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 6px 0; border-top: 1px solid var(--line); }
.row > span:first-child { color: var(--muted); }

.tank-card { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; height: 100%; }
.tank { display: flex; flex-direction: column; flex-grow: 1; min-height: 240px; border: 2px solid var(--dashed); border-radius: 22px; overflow: hidden; }
.layer { flex-grow: 1; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
.layer > span:first-child { font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.layer .num { font-size: 24px; font-weight: 600; }
.layer.l1 { background: var(--tank1); color: var(--tt1); }
.layer.l2 { background: var(--tank2); color: var(--tt2); }
.layer.l3 { background: var(--tank3); color: var(--tt3); }
.bar { height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--accent); transition: width 0.4s ease; }
@media (prefers-reduced-motion: reduce) { .bar > div { transition: none; } }

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

/* Verlauf */
.controls { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-title { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.period { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); flex-wrap: wrap; }
.seg button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 500; letter-spacing: 0.04em; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 700; }
.nav-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.icon-btn { width: 44px; height: 44px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.custom { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding: 14px 16px; }
.custom label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.custom input { min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; }
.btn { min-height: 44px; padding: 0 18px; border: 0; border-radius: 8px; background: var(--ink); color: var(--bg); font: inherit; font-weight: 600; cursor: pointer; }

.panel { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px; }
@media (max-width: 700px) { .panel { padding: 16px 14px; } }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--chip-on); }
.chip[aria-pressed="false"] { color: var(--muted); }
.chip .sw { width: 12px; height: 3px; border-radius: 2px; }
.chart { position: relative; width: 100%; touch-action: pan-y; }
.chart svg { display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ylab, .chart .xlab { fill: var(--muted); font-family: var(--mono); font-size: 11px; }
.chart .cursor { stroke: var(--muted); stroke-width: 1; }
.chart .empty { margin: 0; padding: 40px 0; text-align: center; color: var(--muted); }
.tip { position: absolute; top: 8px; z-index: 2; min-width: 160px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); font-size: 13px; pointer-events: none; }
.tip-time { font-family: var(--mono); color: var(--muted); margin-bottom: 6px; }
.tip-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip-row .sw { width: 10px; height: 3px; border-radius: 2px; flex-shrink: 0; }
.tip-row .l { display: flex; align-items: center; gap: 6px; }
.small-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.small-grid h3 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

.lane { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; align-items: center; }
@media (max-width: 700px) { .lane { grid-template-columns: 96px minmax(0, 1fr); gap: 8px; } }
.lane-label { font-size: 14px; color: var(--muted); }
.lane-track { position: relative; height: 26px; border-radius: 5px; overflow: hidden; background: var(--track); }
.lane-seg { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; padding: 0 6px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.lane-seg.on { background: var(--accent); color: var(--on-accent); }
.lane-seg.mid { background: var(--mid); color: var(--on-mid); }
.lane-seg.idle { background: var(--chip-on); color: var(--ink); }
.lane-seg.warn { background: var(--warn); color: #1A0E05; }
.lane-axis { position: relative; height: 16px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.lane-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
