/* node7 Energie, Oberfläche 0.3.0
   Leitwarte: kühles Grau-Blau, feste Farben je Energieart, Barlow */

:root {
  --bg: #E9EDF0; --panel: #F7F9FA; --field: #FFFFFF; --ink: #17222D; --muted: #55626E; --rule: #CBD3DA;
  --accent: #1D4F7C; --on-accent: #FFFFFF; --hover: rgba(29, 79, 124, .06);
  --pv: #B87F00; --imp: #B3432A; --exp: #2B7352; --sto: #22707E;
  --ok: #2B7352; --warn: #A86A00; --bad: #B3432A; --info: #1D4F7C;
  --l1: #7A4B26; --l2: #17222D; --l3: #8F9AA4;
  --radius: 12px; --r-sm: 8px; --ctl: 36px;
  --ui: 'Barlow Semi Condensed', 'Roboto Condensed', 'Arial Narrow', system-ui, sans-serif;
  --nums: 'Barlow Condensed', 'Roboto Condensed', 'Arial Narrow', system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1720; --panel: #15212C; --field: #0F1A24; --ink: #E4EAF0; --muted: #9DAAB6; --rule: #2A3946;
    --accent: #86B6E6; --on-accent: #0E1720; --hover: rgba(134, 182, 230, .08);
    --pv: #F2B533; --imp: #EB8467; --exp: #5DC394; --sto: #62BCCB;
    --ok: #5DC394; --warn: #F2B533; --bad: #EB8467; --info: #86B6E6;
    --l1: #B98257; --l2: #E4EAF0; --l3: #7D8A96;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1720; --panel: #15212C; --field: #0F1A24; --ink: #E4EAF0; --muted: #9DAAB6; --rule: #2A3946;
  --accent: #86B6E6; --on-accent: #0E1720; --hover: rgba(134, 182, 230, .08);
  --pv: #F2B533; --imp: #EB8467; --exp: #5DC394; --sto: #62BCCB;
  --ok: #5DC394; --warn: #F2B533; --bad: #EB8467; --info: #86B6E6;
  --l1: #B98257; --l2: #E4EAF0; --l3: #7D8A96;
  color-scheme: dark;
}

/* ---------- Grundlagen ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14.5px/1.45 var(--ui); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-weight: 600; line-height: 1.15; margin: 0; }
h1 { font-size: 23px; }
h2 { font-size: 17px; margin-bottom: 10px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }
.num { font-family: var(--nums); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sub { display: block; font-size: 13px; color: var(--muted); }
.is-bad { color: var(--bad); }
.is-warn { color: var(--warn); font-weight: 500; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: var(--r-sm); z-index: 50; }
.skip:focus { top: 8px; }
code, pre { font: 13px/1.45 var(--mono); }
code { background: var(--hover); border: 1px solid var(--rule); padding: 1px 5px; border-radius: 5px; }
code.wrap, pre.wrap { white-space: pre-wrap; word-break: break-all; }
pre { background: var(--field); border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 12px; overflow-x: auto; }

/* ---------- Kopfzeile ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 24px;
  padding: 6px max(clamp(16px, 3vw, 32px), env(safe-area-inset-left)); background: var(--panel); border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.mainnav { display: flex; gap: 2px; flex: 1 1 auto; }
.mainnav a { padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.mainnav a:hover { background: var(--hover); text-decoration: none; }
.mainnav a[aria-current] { font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); border-radius: 8px 8px 0 0; }
.tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.account { display: flex; align-items: center; gap: 6px; height: var(--ctl); padding: 0 10px 0 4px; border: 1px solid var(--rule); border-radius: 18px; color: var(--ink); }
.account:hover { text-decoration: none; background: var(--hover); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 600; font-size: 12px; }

.tabbar { display: none; }

main { max-width: 1320px; margin: 0 auto; padding: 20px clamp(16px, 3vw, 32px) 40px; display: flex; flex-direction: column; gap: 16px; }
.foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 0 16px 32px; }

/* ---------- Flächen ---------- */
.panel, .card, .hero {
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px clamp(14px, 1.8vw, 20px);
  min-width: 0;
}
.panel.flush { padding: 0; overflow: hidden; }
.pad { padding: 12px 16px; }
.phead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; margin-bottom: 12px; }
.phead.pad { margin: 0; align-items: center; }
.phead h1, .phead h2 { margin: 0; }
.pmeta { display: flex; gap: 16px; color: var(--muted); font-size: 13px; }
.card.narrow { max-width: 440px; width: 100%; margin: 48px auto; }
.card.warn { border-color: var(--warn); border-left-width: 4px; }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.head.between { justify-content: space-between; }
.big { font: 600 30px/1.05 var(--nums); }

.pagehead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.pagehead h1 { font-size: 26px; }
.pagehead p { margin: 4px 0 0; }
.crumb { display: inline-block; color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; color: var(--muted); font-size: 13px; }

.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.split > :first-child { flex: 999 1 600px; min-width: 0; }
.split > .aside { flex: 1 1 320px; }
.maincol, .aside { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

/* ---------- Energiefluss ---------- */
.feeders { position: relative; display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 14px 12px; }
.busbar { position: absolute; top: 0; height: 4px; border-radius: 3px; background: var(--ink);
  left: calc(50% / var(--n, 4)); right: calc(50% / var(--n, 4)); }
.feeder { display: flex; flex-direction: column; align-items: center; text-align: center; color: var(--ink); --c: var(--ink); }
a.feeder:hover { text-decoration: none; }
a.feeder:hover .sym { background: var(--hover); }
.feeder.c-imp { --c: var(--imp); } .feeder.c-exp { --c: var(--exp); } .feeder.c-pv { --c: var(--pv); }
.feeder.c-sto { --c: var(--sto); } .feeder.c-ink { --c: var(--ink); }
.stub { width: 3px; height: 20px; background: var(--c); }
.arrow { color: var(--c); margin: 2px 0; font-size: 17px; line-height: 1; height: 17px; }
.sym { width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--c); display: grid; place-items: center; color: var(--c); background: var(--bg); }
.flabel { margin-top: 8px; font-size: 13px; color: var(--muted); font-weight: 500; }
.fval { font-size: 32px; font-weight: 600; line-height: 1.05; }
.fsub { font-size: 13px; color: var(--muted); max-width: 240px; }

.today { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-top: 18px; border-top: 1px solid var(--rule); }
.today > div { padding: 10px 14px 0 0; }
.today > div + div { padding-left: 14px; border-left: 1px solid var(--rule); }
.tlabel { font-size: 12.5px; color: var(--muted); }
.tval { font-size: 21px; font-weight: 600; line-height: 1.15; white-space: nowrap; }
.tval i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 4px; }
.tsub { font-size: 12.5px; color: var(--muted); }

/* ---------- Geräteliste ---------- */
/* feste Spaltenbreiten, damit alle Zeilen fluchten (jede Zeile ist ein eigenes Raster) */
.dlist { --cols: 16px minmax(0, 1.6fr) minmax(0, .8fr) minmax(0, 1.3fr) 110px 90px; }
.dlist.with-owner { --cols: 16px minmax(0, 1.4fr) minmax(0, .6fr) minmax(0, .8fr) minmax(0, 1.3fr) 110px 90px; }
.dhead, .drow { display: grid; grid-template-columns: var(--cols); gap: 12px; align-items: center; padding: 0 16px; }
.dhead { padding-top: 6px; padding-bottom: 6px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.drow { padding-top: 7px; padding-bottom: 7px; border-bottom: 1px solid var(--rule); color: var(--ink); min-height: 46px; }
.drow:last-of-type { border-bottom: 0; }
.drow:hover { background: var(--hover); text-decoration: none; }
.drow[hidden] { display: none; }
.c-name { min-width: 0; }
.c-name strong, .c-name .sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-name strong { font-weight: 600; }
.c-type, .c-owner { font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r { text-align: right; }
.c-val .num { font-size: 17px; font-weight: 600; line-height: 1.15; white-space: nowrap; }
.c-val { min-width: 0; }
.c-val .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-spark svg { width: 110px; height: 24px; display: block; }
.c-spark polyline { fill: none; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.c-seen { font-size: 12.5px; color: var(--muted); }
.c-seen.is-bad { color: var(--bad); }
.c-val .is-old { color: var(--muted); }
.dempty { padding: 12px 16px; color: var(--muted); margin: 0; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px var(--hover); flex: none; }
.dot.s-online { background: var(--ok); }
.dot.s-stale { background: var(--warn); }
.dot.s-offline, .dot.s-never_seen { background: var(--bad); }

.filters { gap: 10px; }
.search input { width: 220px; max-width: 100%; }

/* Listen in Seitenspalten */
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain > li { border-top: 1px solid var(--rule); padding: 7px 0; }
ul.plain > li:first-child { border-top: 0; padding-top: 0; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--ink); }
a.kv:hover { text-decoration: none; }
a.kv:hover strong { text-decoration: underline; }
.kv strong { font-weight: 500; }
.pill { padding: 1px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; border: 1.5px solid currentColor; white-space: nowrap; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); } .pill.muted { color: var(--muted); }
li.hint { display: flex; gap: 12px; }
li.hint .dot { margin-top: 6px; box-shadow: none; }
li.hint a { color: var(--ink); }

/* ---------- Bedienelemente ---------- */
button, .button {
  appearance: none; border: 1px solid transparent; background: var(--accent); color: var(--on-accent);
  font: inherit; font-weight: 600; padding: 0 14px; min-height: var(--ctl); border-radius: var(--r-sm); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
button:hover, .button:hover { filter: brightness(1.08); text-decoration: none; }
button:disabled { opacity: .6; cursor: progress; }
button.ghost, .button.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
button.ghost:hover, .button.ghost:hover { background: var(--hover); filter: none; }
button.icon { background: transparent; color: var(--ink); border-color: var(--rule); width: var(--ctl); padding: 0; font-size: 17px; }
button.icon:hover { background: var(--hover); filter: none; }
button.danger { background: transparent; color: var(--bad); border-color: transparent; padding: 0 10px; }
button.danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); filter: none; }

.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r-sm); overflow: hidden; background: var(--panel); }
.seg > a, .seg > button {
  min-height: calc(var(--ctl) - 2px); padding: 0 12px; border: 0; border-radius: 0; background: transparent; color: var(--ink);
  font: inherit; font-weight: 500; display: inline-flex; align-items: center;
}
.seg > * + * { border-left: 1px solid var(--rule); }
.seg > a:hover, .seg > button:hover { background: var(--hover); text-decoration: none; filter: none; }
.seg > [aria-current], .seg > [aria-pressed="true"], .seg > a.on { background: var(--ink); color: var(--panel); }

input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: 14.5px; padding: 0 10px; min-height: var(--ctl); border-radius: var(--r-sm);
  border: 1px solid var(--rule); background: var(--field); color: var(--ink);
}
textarea { padding: 8px 10px; resize: vertical; }
textarea.mono { font: 13px/1.45 var(--mono); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
label { display: grid; gap: 3px; font-size: 13px; font-weight: 500; }
label > .muted, label > .small { font-weight: 400; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 14.5px; min-height: 32px; grid-column: 1 / -1; }
label.check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
fieldset { border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 12px 14px; margin: 0; }
legend { padding: 0 6px; font-weight: 600; color: var(--muted); }
.stack { display: grid; gap: 10px; margin-top: 10px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; align-items: start; }
.grid-form .full { grid-column: 1 / -1; }
form.inline { display: inline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.actions.left { justify-content: flex-start; }
section > .actions, form.actions { margin-top: 14px; }
.links { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0 0; }

.flash { padding: 9px 14px; border-radius: var(--r-sm); border: 1px solid; border-left-width: 4px; background: var(--panel); }
.flash.ok { border-color: var(--ok); }
.flash.bad { border-color: var(--bad); color: var(--bad); }

.badge { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1.5px solid currentColor; }
.badge.ok { color: var(--ok); } .badge.bad { color: var(--bad); } .badge.info { color: var(--info); }
.badge.neutral, .badge.muted { color: var(--muted); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--hover); color: var(--muted); }

.st { font-weight: 600; white-space: nowrap; }
.st::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: currentColor; }
.st.online { color: var(--ok); } .st.stale { color: var(--warn); } .st.offline, .st.never_seen { color: var(--bad); }

/* ---------- Tabellen, Protokolle ---------- */
.table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--muted); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.panel.flush th:first-child, .panel.flush td:first-child { padding-left: 16px; }
.panel.flush th:last-child, .panel.flush td:last-child { padding-right: 16px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--hover); }
tr.is-active td { background: color-mix(in srgb, var(--ok) 10%, transparent); }
tr.is-off td { opacity: .55; }
td.actions { text-align: right; white-space: nowrap; }
td.actions > * + * { margin-left: 8px; }

dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 14px; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.aside dl.meta { grid-template-columns: 1fr; gap: 0; }
.aside dl.meta dt { font-size: 12.5px; margin-top: 7px; }
.aside dl.meta dt:first-child { margin-top: 0; }

details.files { border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 10px 12px; background: var(--field); }
details.files summary { cursor: pointer; font-weight: 500; min-height: 24px; }
details.files ul { margin: 8px 0 0; padding-left: 18px; max-height: 320px; overflow: auto; }
details.files textarea { margin-top: 10px; }

ul.log { list-style: none; padding: 0; margin: 0; }
ul.log li { padding: 6px 0; border-bottom: 1px solid var(--rule); }
.audit .chg-line { font-size: 13.5px; overflow-wrap: anywhere; }
.audit del { color: var(--muted); }
.md p { margin: 6px 0; } .md ul { margin: 6px 0; padding-left: 20px; }
.diff { font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; }
.add { color: var(--ok); } .chg { color: var(--warn); } .del { color: var(--bad); }

/* Deploy: Upload */
.upload { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1 1 420px; justify-content: flex-end; }
.upload input[type=text] { flex: 1 1 180px; width: auto; }
.file { position: relative; display: inline-flex; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file span { padding: 0 12px; min-height: var(--ctl); border: 1px dashed var(--muted); border-radius: var(--r-sm); display: inline-flex; align-items: center;
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Gerätedetail ---------- */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.chart { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px clamp(14px, 1.8vw, 20px) 8px; min-width: 0; }
.chart.wide { grid-column: 1 / -1; }
.chart h3 { margin: 0 0 6px; font-size: 16px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; }
.chart h3 .unit { color: var(--muted); font-weight: 400; font-size: 13px; }
.chart .legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); font-weight: 400; }
.chart .legend i { display: inline-block; width: 14px; height: 3px; margin-right: 6px; vertical-align: 4px; }
.chart .plot { position: relative; height: 200px; }
.chart.wide .plot { height: 250px; }
.chart canvas { width: 100%; height: 100%; display: block; }
.chart .tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--rule); border-radius: 8px;
  padding: 5px 9px; font-size: 13px; white-space: nowrap; display: none; z-index: 2; box-shadow: 0 4px 16px rgba(0, 0, 0, .12); }
.chart .empty { height: 160px; display: grid; place-items: center; color: var(--muted); }
.charts.loading { opacity: .5; }

.phases { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.phase { display: grid; grid-template-columns: auto 1fr; gap: 0 14px; align-items: center; }
.phase .ring { grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; font-size: 13px; border: 2.5px solid var(--c, var(--ink)); display: grid; place-items: center; font-weight: 600; }
.ring.l1 { --c: var(--l1); } .ring.l2 { --c: var(--l2); } .ring.l3 { --c: var(--l3); }
.pval { font-size: 21px; font-weight: 600; line-height: 1.1; }
.phase.meters { display: block; border-left: 1px solid var(--rule); padding-left: 16px; }

/* ---------- Schmal ---------- */
@media (max-width: 1000px) {
  .dlist, .dlist.with-owner { --cols: 16px minmax(0, 1fr) minmax(0, 10em); }
  .c-type, .c-owner, .c-spark, .c-seen { display: none; }
  .c-val .sub { display: none; }
  .c-name { min-width: 8em; }
  .dhead { display: none; }
  .drow { border-top: 0; }
}
@media (max-width: 900px) {
  .feeders { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .busbar, .stub { display: none; }
  .fval { font-size: 28px; }
  .today { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today > div, .today > div + div { padding: 12px 12px 0 0; border-left: 0; }
  .today > div { min-width: 0; }
  .tval { font-size: 19px; white-space: normal; overflow-wrap: anywhere; }
  .charts { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body.has-tabs { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .top { padding: 8px 16px; }
  .mainnav, .hide-s { display: none !important; }
  .account { padding: 0; border: 0; height: auto; }
  .avatar { width: 32px; height: 32px; font-size: 13px; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    background: var(--panel); border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
  .tabbar a::before { content: ""; width: 22px; height: 3px; border-radius: 2px; margin-bottom: 6px; background: transparent; }
  .tabbar a[aria-current] { color: var(--ink); font-weight: 600; }
  .tabbar a[aria-current]::before { background: var(--accent); }
  .tabbar a:hover { text-decoration: none; }
  main { padding: 12px 12px 32px; gap: 12px; }
  h1, .pagehead h1 { font-size: 22px; }
  .panel, .card, .hero, .chart { padding: 12px 14px; border-radius: 12px; }
  .panel.flush { padding: 0; }
  .pad, .phead.pad { padding: 10px 14px; }
  .dhead, .drow { padding-left: 14px; padding-right: 14px; }
  .split, .maincol, .aside { gap: 12px; }
  .chart .plot, .chart.wide .plot { height: 190px; }
  .filters { flex-direction: column; align-items: stretch; }
  .search input { width: 100%; }
  .seg { max-width: 100%; overflow-x: auto; }
  .seg > a, .seg > button { padding: 0 11px; }
  .phase.meters { border-left: 0; padding-left: 0; }
  table thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { border-bottom: 1px solid var(--rule); padding: 8px 16px; }
  tbody tr:last-child { border-bottom: 0; }
  td, .panel.flush td:first-child, .panel.flush td:last-child { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; }
  td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 14px; }
  tbody tr:hover td { background: transparent; }
  td.actions { justify-content: flex-start; white-space: normal; }
  .upload { justify-content: stretch; }
  .upload > * { flex: 1 1 100%; }
  .file span { max-width: none; width: 100%; justify-content: center; }
  dl.meta { grid-template-columns: 1fr; }
  dl.meta dt { margin-top: 6px; }
}
/* Touch: Bedienelemente groß genug zum Treffen, Eingaben 16px gegen iOS-Zoom */
@media (pointer: coarse) {
  :root { --ctl: 42px; }
  input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], select, textarea { font-size: 16px; }
  .drow { min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
