/* Lox Portal. Seitenleiste mit Miniservern, rechts Status, Zählerkacheln, Diagramm, Bausteinliste. */
:root {
  /* Loxone-Stil: dunkle Flaechen wie in der App, Gruen als einzige Akzentfarbe */
  --bg: #121314; --surface: #1d1f20; --sunken: #17191a; --raised: #282b2d;
  --ink: #f4f6f5; --muted: #9aa19d; --line: #2f3335;
  --energy: #69c350; --energy-soft: #1c3016; --energy-ink: #0b1608;
  --ok: #69c350; --ok-soft: #1c3016; --bad: #ff6b62; --bad-soft: #3a1a18; --warn: #f7b55c; --warn-soft: #382a12;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
h1 { font-size: 26px; line-height: 1.15; margin: 0; letter-spacing: -0.02em; font-weight: 700; }
h2 { font-size: 13px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--energy); font-weight: 700; }
h3 { font-size: 15px; margin: 0 0 4px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.err { color: var(--bad); font-size: 14px; }
.hint { color: var(--muted); font-size: 12px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--energy); outline-offset: 2px; }
label { font-size: 13px; font-weight: 600; margin-top: 8px; }
input, select { background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0; }
select { width: auto; max-width: 100%; }

.btn { background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--energy); color: var(--energy-ink); border-color: var(--energy); }
.btn.primary:hover { filter: brightness(1.08); border-color: var(--energy); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); border-color: var(--line); }
.btn.ask { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn[disabled] { opacity: 0.55; cursor: default; }

.mark { display: inline-flex; align-items: end; gap: 3px; height: 22px; }
.mark span { width: 6px; border-radius: 2px; background: var(--energy); }
.mark span:nth-child(1) { height: 9px; opacity: 0.55; }
.mark span:nth-child(2) { height: 22px; }
.mark span:nth-child(3) { height: 15px; opacity: 0.8; }

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 6px; }
.gate-card h1 { margin-top: 10px; }
.gate-card .btn { margin-top: 16px; padding: 11px 14px; }
.gate-card p { margin-bottom: 6px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; letter-spacing: -0.01em; background: none; border: 0; padding: 0; cursor: pointer; }
.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; max-width: 1280px; margin: 0 auto; padding: 24px 20px 64px; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: minmax(0, 1fr); padding: 16px 16px 48px; } }

.side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ms-list { display: flex; flex-direction: column; gap: 8px; }
.ms { display: flex; flex-direction: column; gap: 2px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; cursor: pointer; width: 100%; }
.ms strong { font-size: 15px; overflow-wrap: anywhere; }
.ms small { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.ms[aria-current="true"] { border-color: var(--energy); box-shadow: inset 3px 0 0 var(--energy); }
.ms .st { font-size: 12px; font-weight: 600; }
.ms .st.on { color: var(--ok); }
.ms .st.off { color: var(--warn); }
.ms-none { color: var(--muted); font-size: 14px; border: 1px dashed var(--line); border-radius: var(--r); padding: 14px; }
.add { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.add .btn { margin-top: 10px; }
.add .hint { margin-top: 8px; }

.main { min-width: 0; display: flex; flex-direction: column; gap: 22px; }
#view { display: flex; flex-direction: column; gap: 30px; }
#dash { display: flex; flex-direction: column; gap: 20px; }
.banner { border-radius: var(--r); padding: 12px 16px; border: 1px solid var(--warn); background: var(--warn-soft); color: var(--ink); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner.bad { border-color: var(--bad); background: var(--bad-soft); }
.empty { border: 1px dashed var(--line); border-radius: 16px; padding: 40px 28px; display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.empty h2 { text-transform: none; letter-spacing: -0.01em; font-size: 20px; color: var(--ink); margin: 0; }

.head { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; justify-content: space-between; }
.head-act { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 7px; border-radius: 99px; padding: 4px 12px; font-size: 13px; font-weight: 600; background: var(--sunken); color: var(--muted); }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; text-align: left; cursor: pointer; min-width: 0; }
.tile:hover { border-color: var(--energy); }
.tile[aria-pressed="true"] { border-color: var(--energy); box-shadow: 0 0 0 1px var(--energy); }
.tile-name { display: flex; flex-direction: column; min-width: 0; }
.tile-name strong { overflow-wrap: anywhere; }
.tile-name small { color: var(--muted); font-size: 12px; }
.tile-now { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.tile-now span { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.tile-now.live { color: var(--energy); }
.tile-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.tile-row div { display: flex; flex-direction: column; min-width: 0; }
.tile-row small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.tile-row b { font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }

.chart-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.chart-head h2 { margin: 0; }
.chart-ctl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.chart-ctl select { padding: 7px 10px; background: var(--raised); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--raised); }
.seg button { border: 0; background: none; padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--energy); color: var(--energy-ink); }
.sum { display: flex; flex-wrap: wrap; gap: 6px 28px; margin-bottom: 8px; }
.sum div { display: flex; flex-direction: column; }
.sum small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.sum b { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.chart { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 12px 8px; min-height: 120px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .msg { padding: 32px 12px; color: var(--muted); text-align: center; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart .bar { fill: var(--energy); }
.chart .bar:hover { opacity: 0.75; }
.chart .line { fill: none; stroke: var(--energy); stroke-width: 2; stroke-linejoin: round; }
.chart .area { fill: var(--energy); opacity: 0.14; }
details { margin-top: 10px; }
details > summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.scroll { overflow-x: auto; margin-top: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 14px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
th.num { text-align: right; }

.room { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.room > summary { list-style: none; cursor: pointer; padding: 13px 16px; display: flex; justify-content: space-between; gap: 12px; font-weight: 600; color: var(--ink); font-size: 15px; }
.room > summary::-webkit-details-marker { display: none; }
.room > summary small { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.room[open] > summary { border-bottom: 1px solid var(--line); }
details.room { margin-top: 0; }
.ctl { display: grid; grid-template-columns: minmax(150px, 260px) minmax(0, 1fr); gap: 4px 16px; padding: 10px 16px; border-top: 1px solid var(--line); }
.ctl:first-of-type { border-top: 0; }
.ctl.sub { background: var(--sunken); padding-left: 30px; }
.ctl-id { display: flex; flex-direction: column; min-width: 0; }
.ctl-id strong { font-weight: 600; overflow-wrap: anywhere; }
.ctl-id small { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.vals { display: flex; flex-wrap: wrap; gap: 3px 16px; font-size: 13px; color: var(--muted); min-width: 0; align-content: center; }
.vals b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 560px) { .ctl { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: no-preference) { .btn, .tile, .ms { transition: border-color .12s, box-shadow .12s; } }

.back { background: none; border: 0; padding: 0 0 4px; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.back:hover { color: var(--ink); }
.dsum b { font-size: 26px; }
.dsum { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; gap: 10px 36px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; text-align: left; cursor: pointer; min-width: 0; width: 100%; }
.card:hover { border-color: var(--energy); }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.brand strong { color: var(--ink); }
.card-top strong { font-size: 18px; letter-spacing: -0.01em; overflow-wrap: anywhere; line-height: 1.25; }
.card-top small { display: block; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 2px; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.facts div { display: flex; flex-direction: column; min-width: 0; }
.facts small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.facts b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.facts .wide { grid-column: 1 / -1; }
.tag { display: inline-block; border-radius: 6px; padding: 1px 8px; font-size: 12px; font-weight: 600; background: var(--sunken); color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.upd { background: var(--warn-soft); color: var(--warn); }
.card-note { color: var(--muted); font-size: 13px; }
.card-note.err { color: var(--bad); }
.card-go { color: var(--muted); font-size: 13px; font-weight: 600; }
.card:hover .card-go { color: var(--ink); }
.cards-none { border: 1px dashed var(--line); border-radius: 16px; padding: 32px 24px; color: var(--muted); }
.skel { color: var(--muted); }

.top-act { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.who { color: var(--muted); font-size: 13px; margin-right: 4px; }
#admin { display: flex; flex-direction: column; gap: 22px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.grid2 .wide { grid-column: 1 / -1; }
@media (max-width: 620px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld label { margin-top: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chk { display: inline-flex; align-items: center; gap: 8px; background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; font-size: 14px; font-weight: 500; margin: 0; cursor: pointer; }
.chk input { width: auto; accent-color: var(--energy); }
.checks-none { color: var(--muted); font-size: 13px; }
.invite { margin-top: 18px; border: 1px solid var(--energy); background: var(--energy-soft); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.kv { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.kv span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; min-width: 130px; }
.kv code, pre { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
pre { margin: 0; background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; padding: 12px; white-space: pre-wrap; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
a.btn { text-decoration: none; display: inline-block; }
.rows { display: flex; flex-direction: column; }
.urow { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line); }
.urow:first-child { border-top: 0; padding-top: 0; }
.urow-top { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; justify-content: space-between; }
.urow-top strong { font-size: 15px; overflow-wrap: anywhere; }
.urow-top small { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.rows-none { color: var(--muted); font-size: 14px; }

.msum { margin-bottom: 10px; font-size: 14px; }
.msg { display: flex; flex-direction: column; gap: 6px; padding: 14px 0; border-top: 1px solid var(--line); }
.msg:first-child { border-top: 0; padding-top: 0; }
.msg:last-child { padding-bottom: 0; }
.msg.done { opacity: 0.62; }
.msg-top { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; justify-content: space-between; }
.msg-top strong { font-size: 15px; overflow-wrap: anywhere; }
.msg-top small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.msg p { color: var(--muted); font-size: 14px; white-space: pre-line; max-width: 80ch; overflow-wrap: anywhere; }
.msg a { color: var(--energy); font-size: 13px; }
.sev { display: inline-block; border-radius: 6px; padding: 1px 8px; font-size: 12px; font-weight: 700; margin-right: 8px; vertical-align: 1px; background: var(--sunken); color: var(--muted); }
.sev.warning { background: var(--warn-soft); color: var(--warn); }
.sev.important, .sev.critical { background: var(--bad-soft); color: var(--bad); }

.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.flow-box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.flow-box small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.flow-box b { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.flow-box b span { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.flow-box em { font-style: normal; font-size: 13px; color: var(--muted); }
.flow-box.prod b { color: var(--energy); }
.flow-box.out b { color: var(--energy); }
.flow-box.in b { color: var(--warn); }
.nodes { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.node { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 14px; }
.node:first-child { border-top: 0; }
.node.top { font-weight: 600; }
.node.child { padding-left: 34px; color: var(--muted); background: var(--sunken); }
.node span { min-width: 0; overflow-wrap: anywhere; }
.node b { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; color: var(--ink); }
.wb { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 14px; }
.wb-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 12px; align-items: baseline; }
.wb-top strong { font-size: 16px; }
.wb .facts { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

#sess-agg { margin: 0 0 12px; padding: 16px 18px; }
#sess-agg table td:last-child, #sess-agg table th:last-child { padding-right: 0; }

.efm-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 8px 8px 0; margin-bottom: 12px; }
.efm-scroll { overflow-x: auto; }
.efm-svg { display: block; width: 100%; min-width: 600px; height: auto; font-family: var(--sans); }
.efm-track { fill: none; stroke: var(--line); stroke-linecap: round; opacity: 0.55; }
.efm-line { fill: none; stroke-linecap: round; stroke-dasharray: 1 15; animation: efm-move 0.9s linear infinite; }
@keyframes efm-move { to { stroke-dashoffset: -16; } }
.efm-line.prod, .efm-line.exp { stroke: var(--energy); }
.efm-line.imp { stroke: var(--warn); }
.efm-line.load { stroke: var(--ink); opacity: 0.75; }
@media (prefers-reduced-motion: reduce) { .efm-line { animation: none; stroke-dasharray: 8 8; } }
.efm-node circle { fill: var(--raised); stroke: var(--line); stroke-width: 2; }
.efm-node.prod circle { stroke: var(--energy); }
.efm-node.grid circle { stroke: var(--warn); }
.efm-node.stor circle { stroke: var(--energy); }
.efm-node.hub circle { fill: var(--sunken); stroke: var(--ink); stroke-width: 2.5; }
.efm-node.idle circle { stroke: var(--line); }
.efm-ico { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.efm-node.prod .efm-ico { stroke: var(--energy); }
.efm-node.hub .efm-ico { stroke: var(--ink); }
.efm-val { fill: var(--ink); font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.efm-node.hub .efm-val { font-size: 23px; }
.efm-unit { fill: var(--muted); font-size: 11px; font-weight: 600; }
.efm-lab { fill: var(--ink); font-size: 13px; font-weight: 600; }
.efm-note { font-size: 12px; font-weight: 600; fill: var(--muted); }
.efm-note.good { fill: var(--energy); }
.efm-note.warn { fill: var(--warn); }
.efm-chips { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 4px 14px 16px; }
.efm-chips div { display: flex; flex-direction: column; }
.efm-chips small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.efm-chips b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.efm-chips b.good { color: var(--energy); }
.efm-chips b.warn { color: var(--warn); }

.efm-node.grid.exp circle { stroke: var(--energy); }
.efm-in { fill: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
