/*
 * Family Dashboard – optimiert für iPad mit iOS 12 (Safari 12).
 * Bewusst verzichtet: Flexbox-gap, aspect-ratio, inset, :is(), clamp(). Abstände über margin.
 */
:root {
  --bg: #0f1216;
  --panel: #181d23;
  --panel-2: #20262e;
  --line: #2a313b;
  --text: #e8ecf1;
  --muted: #8b95a3;
  --accent: #4f9cf9;
  --sun: #f5b82e;
  --green: #4cc38a;
  --red: #ef5b5b;
  --radius: 14px;
  /* Diagrammfarben (in app.js gespiegelt: E_COLORS) */
  --c-pv: #f5b82e;
  --c-house: #4f9cf9;
  --c-soc: #4cc38a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
}

button { font: inherit; color: inherit; }

/* --- Kopfzeile --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 18px;
  padding-top: env(safe-area-inset-top);
}
.clock #time { font-size: 40px; font-weight: 200; letter-spacing: 1px; }
.clock .date { margin-left: 14px; font-size: 18px; color: var(--muted); }
.status { font-size: 12px; color: var(--muted); text-align: right; }
.status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 4px 0 12px; background: var(--green); }
.status .dot.err { background: var(--red); }
.status .dot.off { background: var(--line); }

/* --- Raster: 3 Spalten im Querformat --- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  grid-gap: 12px;
  height: calc(100% - 64px);
  padding: 0 12px 12px;
}
.stack { display: flex; flex-direction: column; min-height: 0; }
.stack > .panel + .panel { margin-top: 12px; }
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel.grow { flex: 1; }
/* Energie nur so hoch wie nötig, die Rollos bekommen den restlichen Platz */
.stack > #panel-energy { flex: none; }
.stack > #panel-shutters { flex: 1; }
.stack > #panel-shutters .panel-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
/* Linke Spalte: Termine und Steckdosen je zur Hälfte */
#col-left > .panel { flex: 1 1 0; }
.panel h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 12px 14px 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.panel-body { padding: 0 14px 14px; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.empty, .muted { color: var(--muted); }
.empty { padding: 20px 0; text-align: center; }
.error { margin-top: 8px; font-size: 12px; color: var(--red); }

/* Hochformat: untereinander */
@media (orientation: portrait) {
  html, body { overflow: auto; }
  /* Hochkant: eine Spalte, alle Kacheln direkt im Raster – so gilt die Reihenfolge aus dem Konto über alle Spalten */
  .grid { grid-template-columns: 1fr; height: auto; }
  .stack, #col-left { display: contents; }
  #panel-weather, #panel-calendar, #panel-plugs { max-height: 40vh; }
  .grid .panel { margin-top: 0 !important; }
}

/* --- Kalender --- */
.day { margin-bottom: 14px; }
.day-head { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.day-head.today { color: var(--accent); }
.event {
  display: flex;
  padding: 8px 10px;
  margin-bottom: 6px;
  background: var(--panel-2);
  border-radius: 10px;
  border-left: 4px solid var(--accent);
}
.event .t { width: 54px; flex-shrink: 0; font-size: 13px; color: var(--muted); padding-top: 1px; }
.event .t .allday { font-size: 11px; }
.event.past { opacity: .45; }
.event.running { background: rgba(79, 156, 249, .12); }
.event .live { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 8px; font-size: 11px; font-weight: 600;
  color: #fff; background: var(--accent); vertical-align: 2px; }
/* "Jetzt"-Linie */
.now-line { position: relative; height: 0; margin: 10px 0 12px; border-top: 2px solid var(--red); }
.now-line:before { content: ''; position: absolute; left: -2px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.now-line span { position: absolute; right: 0; top: -9px; padding: 0 6px; font-size: 11px; font-weight: 600; color: var(--red); background: var(--panel); }
.past-note { font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.event .t b { display: block; color: var(--text); font-weight: 600; font-size: 14px; }
.event .title { font-weight: 500; }
.event .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* --- Kameras --- */
.cams { display: flex; flex-wrap: wrap; margin: 0 -5px; }
.cam { width: 50%; padding: 0 5px 10px; }
.cam-frame {
  position: relative;
  padding-top: 56.25%; /* 16:9 ohne aspect-ratio */
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}
.cam-frame img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-frame video.tile-live, .cam-frame img.tile-live {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; background: transparent;
  opacity: 0; -webkit-transition: opacity .4s; transition: opacity .4s;
}
.cam-frame .tile-live.ready { opacity: 1; }
.cam-label { z-index: 1; }
.cam-frame .placeholder {
  position: absolute; top: 50%; left: 0; right: 0;
  margin-top: -9px; text-align: center; font-size: 13px; color: var(--muted);
}
.cam-label {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 18px 8px 6px;
  font-size: 13px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75));
}
.cam-label .src { float: right; font-size: 11px; opacity: .7; text-transform: uppercase; }
.cam-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.cam.offline .cam-frame { opacity: .45; }
/* Babycam nicht erreichbar: eingeklappt */
.cam.collapsed .cam-down { display: flex; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-radius: 10px;
  background: var(--panel-2); font-size: 16px; }
.cam.collapsed .cam-down-ico { margin-right: 10px; font-size: 20px; }
.cam.collapsed .cam-down b { margin-right: 4px; }
.cam.collapsed .cam-down .muted { width: 100%; margin: 2px 0 0 30px; font-size: 12px; }

/* --- Energie --- */
.pv { display: flex; align-items: baseline; }
.pv .big { font-size: 34px; font-weight: 200; }
.pv .unit { font-size: 18px; color: var(--muted); margin-left: 4px; }
.pv .ico { font-size: 26px; margin-right: 10px; color: var(--sun); }
.yield { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
/* Akku-Kennzahl: Hero-Zahl + Tagesverlauf. Polarität: rein = blau, raus = orange (validiert auf dunklem Grund). */
:root { --chg-in: #3987e5; --chg-out: #d95926; }
.kpi { margin: 2px 0 8px; padding: 8px 12px; background: var(--panel-2); border-radius: 10px; }
.kpi-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.kpi-value { font-size: 32px; font-weight: 300; line-height: 1.1; margin: 0 0 2px; }
.kpi-unit { font-size: 18px; color: var(--muted); margin-left: 3px; }
.kpi-chart { height: 60px; overflow: hidden; }
.kpi-chart svg { display: block; }
.battery-svg .grid { stroke: var(--line); stroke-width: 0.5; }
.battery-svg .tick { fill: var(--muted); font-size: 7px; }
.battery-svg .area { fill: var(--muted); fill-opacity: .12; }
.battery-svg .line { fill: none; stroke: var(--muted); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.battery-svg .now { fill: var(--text); }
.battery-svg rect.in { fill: var(--chg-in); }
.battery-svg rect.out { fill: var(--chg-out); }
.kpi-foot { display: flex; justify-content: space-between; font-size: 12px; margin-top: 4px; }
.in { color: var(--chg-in); }
.out { color: var(--chg-out); }
.flows { display: flex; margin: 0 -4px; }
.flow { flex: 1; margin: 0 4px; padding: 6px; background: var(--panel-2); border-radius: 10px; text-align: center; }
.flow .v { font-size: 17px; font-weight: 500; }
.flow .l { font-size: 11px; color: var(--muted); margin-top: 2px; }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* --- Rollos --- */
.h-actions .btn + .btn { margin-left: 8px; }
.shutter { display: flex; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.shutter:last-child { border-bottom: 0; }
.shutter .info { flex: 1; min-width: 0; }
.shutter .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shutter .room { font-size: 11px; color: var(--muted); }
.shutter .lvl { height: 4px; margin-top: 5px; border-radius: 2px; background: var(--panel-2); }
.shutter .lvl div { height: 100%; border-radius: 2px; background: var(--accent); }
.shutter .ctrl { flex-shrink: 0; margin-left: 10px; }
.shutter .ctrl .btn { width: 44px; height: 40px; padding: 0; margin-left: 4px; font-size: 16px; }
.shutter.unreach { opacity: .5; }
/* Kompakte Rollo-Kachel: eine Zeile je Raum */
.shutter.compact { padding: 6px 0; }
.shutter.compact .info { cursor: pointer; }
.shutter.compact .name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Raumname links, Stand ("oben" / "unten" / "40 % unten") direkt daneben */
.shutter.compact .name-row { display: flex; align-items: baseline; min-width: 0; }
.shutter.compact .name-row .name { flex-shrink: 0; overflow: visible; }
.shutter.compact .name-row .pos { flex-shrink: 1; min-width: 0; margin-left: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Balken zeigt, wie weit die Rollos unten sind */
.shutter.compact .room { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shutter.compact .lvl { height: 3px; margin-top: 4px; }
.shutter.compact .ctrl .btn { width: 44px; height: 44px; min-height: 44px; padding: 0; font-size: 17px; margin-left: 5px; }

.btn {
  display: inline-block;
  min-height: 44px;
  padding: 10px 16px;
  font-size: 15px;
  border: 0;
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
}
.btn:active { background: var(--line); }
a.btn, a.btn:visited { color: inherit; text-decoration: none; }
.btn.small { min-height: 34px; padding: 7px 12px; font-size: 13px; text-transform: none; letter-spacing: 0; }

/* iOS Safari löst click auf Nicht-Schaltflächen nur mit cursor:pointer aus */
.cam, .panel h2, .dim, .step-link { cursor: pointer; }

/* --- Bewegung: Kamera-Kachel hervorheben, Rest schmal zur Seite (nicht ausgeblendet) --- */
body.motion-mode .grid { grid-template-columns: 0.78fr 2.2fr 0.78fr; }
body.motion-mode #panel-calendar .h-actions, body.motion-mode .stack .h-actions { display: none; }
body.motion-mode #panel-calendar, body.motion-mode .stack { opacity: .55; }
body.motion-mode #panel-cameras { box-shadow: inset 0 0 0 2px var(--sun); }
body.motion-mode #panel-cameras h2 { color: var(--sun); }
.cams .cam:only-child { width: 100%; }
/* Dashboard: alle Kameras so groß wie die Babycam, untereinander */
#cameras .cams .cam { width: 100%; }
.cams .cam.motion-active { width: 100%; -webkit-order: -1; order: -1; }
.cam.motion-active .cam-frame { box-shadow: 0 0 0 3px var(--sun); }
.cam.motion-active .cam-label { font-size: 17px; }
.motion-badge {
  display: none; position: absolute; top: 10px; right: 10px; z-index: 2;
  padding: 4px 10px; border-radius: 12px; background: rgba(0, 0, 0, .65);
  color: var(--sun); font-size: 14px; font-weight: 600;
}
.cam.motion-active .motion-badge { display: block; }
.motion-badge .pulse {
  display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%;
  background: var(--sun); -webkit-animation: pulse 1s infinite; animation: pulse 1s infinite;
}
@-webkit-keyframes pulse { 50% { opacity: .2; } }
@keyframes pulse { 50% { opacity: .2; } }
/* Schmale Seitenspalten: Texte kürzen statt umbrechen */
body.motion-mode .event .sub, body.motion-mode .shutter .room, body.motion-mode .yield { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Schmale Spalte: Raumname oben, Knöpfe darunter über die volle Breite */
body.motion-mode .shutter.compact { display: block; padding: 6px 0 8px; }
body.motion-mode .shutter.compact .room, body.motion-mode .shutter.compact .lvl { display: none; }
body.motion-mode .shutter.compact .name-row .pos { font-size: 12px; }
body.motion-mode .shutter.compact .ctrl { display: flex; margin: 4px 0 0; }
body.motion-mode .shutter.compact .ctrl .btn { flex: 1; width: auto; margin: 0 2px; }
@media (orientation: portrait) {
  body.motion-mode .grid { grid-template-columns: 1fr 1fr; }
  body.motion-mode #panel-cameras { -webkit-order: -1; order: -1; }
}

/* --- Babyphone --- */
#babyphone-toggle.on { background: var(--sun); color: #111; font-weight: 600; }
#babyphone-toggle.on .pulse { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #111; -webkit-animation: pulse 1s infinite; animation: pulse 1s infinite; }
#babyphone-toggle.wait { background: var(--line); color: var(--sun); }
.babyphone-resume {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; padding: 18px; text-align: center;
  background: var(--sun); color: #111; font-size: 18px; font-weight: 600; cursor: pointer;
}

/* --- Energie: Dashboard-Kachel (animiert) --- */
.pv .sun { display: inline-block; -webkit-transition: color .6s, text-shadow .6s; transition: color .6s, text-shadow .6s; color: var(--muted); }
.pv .sun.producing { color: var(--sun); text-shadow: 0 0 14px rgba(245, 184, 46, .7); -webkit-animation: spin 24s linear infinite; animation: spin 24s linear infinite; }
@-webkit-keyframes spin { to { -webkit-transform: rotate(360deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
.flow .v small { font-size: 12px; color: var(--muted); font-weight: 400; }
.flow .arrow { display: none; margin-right: 4px; font-size: 13px; }
.flow .arrow.in, .flow .arrow.out { display: inline-block; -webkit-animation: nudge 1.4s ease-in-out infinite; animation: nudge 1.4s ease-in-out infinite; }
.flow .arrow.in:before { content: '↓'; }
.flow .arrow.out:before { content: '↑'; }
.chev { display: inline-block; -webkit-animation: nudge 1.4s ease-in-out infinite; animation: nudge 1.4s ease-in-out infinite; }
@-webkit-keyframes nudge { 50% { -webkit-transform: translateY(-2px); opacity: .55; } }
@keyframes nudge { 50% { transform: translateY(-2px); opacity: .55; } }

/* --- Energie: Detailansicht --- */
.e-grid { display: flex; flex-wrap: wrap; margin: 0 -5px; }
.e-tile { padding: 0 5px 10px; }
.e-tile.w25 { width: 25%; } .e-tile.w16 { width: 16.6666%; } .e-tile.w33 { width: 33.3333%; } .e-tile.w50 { width: 50%; } .e-tile.w100 { width: 100%; }
/* Vier Kennzahlen als 2×2 neben dem Energiefluss */
.e-sub-grid { display: flex; flex-wrap: wrap; height: 100%; margin: 0 -5px -10px; }
.e-sub-grid .e-tile { padding-bottom: 10px; }
.e-sub-grid .e-big { font-size: 26px; margin: 0; }
.e-sub-grid .e-card { padding: 8px 10px; }
.e-legend { display: inline-block; float: right; }
.e-legend span { margin-left: 10px; font-size: 12px; }
.e-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.bvals { display: flex; justify-content: space-around; margin: 6px 0; font-size: 17px; }
.bstate-inline.in { color: var(--chg-in); } .bstate-inline.out { color: var(--chg-out); }
.e-card { height: 100%; padding: 10px 12px 12px; background: var(--panel); border-radius: 12px; overflow: hidden; }
.e-card.center { text-align: center; }
.e-title { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.e-card.center .e-title { text-align: left; }
.e-big { font-size: 34px; font-weight: 300; line-height: 1.15; margin: 4px 0; }
.e-big small { font-size: 16px; margin-left: 4px; color: var(--muted); }
.e-card.center .e-big { font-size: 34px; margin: 4px 0 2px; }
.e-sub { font-size: 12px; color: var(--muted); }
.e-phases { display: flex; justify-content: space-between; margin-top: 8px; }
.e-phases div { text-align: center; }
.e-phases b { display: block; font-size: 20px; font-weight: 400; }
.e-phases span { font-size: 12px; color: var(--muted); }
.spark { display: block; width: 100%; max-width: 190px; margin-top: 4px; }
.spark path { fill: none; stroke-width: 1.5; }
.echart { display: block; }
.echart .g { stroke: var(--line); stroke-width: 1; }
.echart .t, .gauge .t, .eflow .t { fill: var(--muted); font-size: 11px; }
.echart .t.v { fill: var(--text); }
.echart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; }
/* Aufbau-Animationen beim Öffnen */
.echart .ln.draw { stroke-dasharray: 3000; stroke-dashoffset: 3000; -webkit-animation: draw 1.4s ease-out forwards; animation: draw 1.4s ease-out forwards; }
.echart .area.draw { opacity: 0; -webkit-animation: fadein 1s .5s ease-out forwards; animation: fadein 1s .5s ease-out forwards; }
@-webkit-keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@-webkit-keyframes fadein { to { opacity: 1; } }
@keyframes fadein { to { opacity: 1; } }
.echart .bar.grow { -webkit-transform-origin: 50% 100%; transform-origin: 50% 100%; -webkit-transform-box: fill-box; transform-box: fill-box;
  -webkit-animation: grow .7s ease-out both; animation: grow .7s ease-out both; }
@-webkit-keyframes grow { from { -webkit-transform: scaleY(0); } to { -webkit-transform: scaleY(1); } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
/* Rundanzeigen */
.gauges { display: flex; align-items: center; justify-content: space-around; }
.e-tile.w50 .gauges .gauge { width: 44%; max-width: 170px; height: auto; }
/* Dashboard-Kachel: Energiefluss mit Akku-Tagesverlauf im Hintergrund */
.eflow-wrap { position: relative; }
.eflow.compact { max-height: 200px; }
/* Tagesverlauf als eigenes kleines Diagramm unter dem Energiefluss (nicht mehr im Hintergrund):
   Skalen im Rand neben der Zeichenfläche, damit nichts über den Linien liegt */
.soc-chart { position: relative; height: 92px; margin: 8px 0 2px; border-top: 1px solid var(--line); }
.soc-plot { position: absolute; left: 40px; right: 40px; top: 10px; bottom: 18px; }
.soc-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.soc-plot .area { fill: var(--c-soc); fill-opacity: .18; }
.soc-plot .line { fill: none; stroke: var(--c-soc); stroke-width: 2; vector-effect: non-scaling-stroke; }
.soc-plot .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.soc-plot .pline { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.soc-plot .pline.pv { stroke: var(--c-pv); }
.soc-plot .pline.house { stroke: var(--c-house); stroke-opacity: .85; }
.soc-now { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--c-soc); }
.soc-y { position: absolute; left: -40px; width: 34px; white-space: nowrap; margin-top: -7px; text-align: right; font-size: 10px; line-height: 14px; color: var(--muted); }
.soc-y.right { left: auto; right: -40px; width: 36px; white-space: nowrap; text-align: left; }
.soc-x { position: absolute; bottom: -16px; margin-left: -10px; font-size: 10px; color: var(--muted); }
.e-legend-row { display: flex; flex-wrap: wrap; align-items: center; font-size: 11px; color: var(--muted); }
.e-legend-row b { color: var(--c-soc); margin-right: 6px; }
.e-legend-row .soc-key:first-of-type { margin-left: 0; }
.soc-key { display: inline-block; width: 12px; height: 3px; margin: 0 4px 0 10px; border-radius: 2px; }
.soc-key.soc { background: var(--c-soc); } .soc-key.pv { background: var(--c-pv); } .soc-key.house { background: var(--c-house); }
.e-foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 4px; }
.e-foot .in { color: var(--chg-in); } .e-foot .out { color: var(--chg-out); }
.gauge .gtrack { fill: none; stroke: var(--panel-2); stroke-width: 12; stroke-linecap: round; }
.gauge .garc { fill: none; stroke-width: 12; stroke-linecap: round; -webkit-transition: stroke-dasharray .8s ease-out; transition: stroke-dasharray .8s ease-out; }
.gauge .gv { fill: var(--text); font-size: 19px; font-weight: 500; }
.bstate { font-size: 26px; font-weight: 300; color: var(--muted); }
.bstate.in { color: var(--chg-in); } .bstate.out { color: var(--chg-out); }
.btable { width: 100%; border-collapse: collapse; }
.btable th { font-size: 12px; color: var(--muted); font-weight: 400; text-align: left; padding: 4px 6px; }
.btable td { font-size: 20px; padding: 6px; background: var(--panel-2); border-right: 2px solid var(--panel); }
/* Energiefluss */
.flow-card { padding-bottom: 6px; }
.eflow { display: block; width: 100%; max-height: 200px; }
.eflow .ftrack { fill: none; stroke: var(--panel-2); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.eflow .fline { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 3 11;
  -webkit-animation: flowdash 1.5s linear infinite; animation: flowdash 1.5s linear infinite; }
@-webkit-keyframes flowdash { to { stroke-dashoffset: -28; } }
@keyframes flowdash { to { stroke-dashoffset: -28; } }
.eflow .fnode { fill: var(--panel-2); stroke-width: 2.5; }
.eflow .fedge { font-size: 13px; font-weight: 600; paint-order: stroke; stroke: var(--panel); stroke-width: 3px; }
.eflow .farrow { -webkit-animation: fpulse 1.2s ease-in-out infinite; animation: fpulse 1.2s ease-in-out infinite; }
@-webkit-keyframes fpulse { 50% { opacity: .35; } }
@keyframes fpulse { 50% { opacity: .35; } }
.eflow .ficon { font-size: 24px; }
.eflow .fval { fill: var(--text); font-size: 17px; font-weight: 500; }
@media (orientation: portrait) {
  .e-tile.w25 { width: 50%; } .e-tile.w16 { width: 33.3333%; } .e-tile.w50, .e-tile.w33 { width: 100%; }
}

/* --- Detailansichten --- */
.detail { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.detail-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; }
.detail-head h1 { margin: 0; font-size: 26px; font-weight: 300; }
.detail-body { flex: 1; min-height: 0; padding: 0 18px 24px; }
.stat-grid { display: flex; flex-wrap: wrap; margin: 0 -5px 8px; }
.stat { width: 25%; padding: 0 5px 10px; }
.stat-inner { padding: 10px 12px; background: var(--panel); border-radius: 10px; height: 100%; }
.stat .l { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 300; margin-top: 2px; }
.stat .v small { font-size: 14px; color: var(--muted); margin-left: 3px; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sm-grid { display: flex; flex-wrap: wrap; margin: 0 -5px; }
.sm { width: 50%; padding: 0 5px 10px; }
.sm-inner { padding: 10px 12px; background: var(--panel); border-radius: 10px; }
.sm-title { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.sm-title b { color: var(--text); font-weight: 500; }
.sm svg { display: block; }
.sm .area { fill: var(--muted); fill-opacity: .14; }
.sm .line { fill: none; stroke: var(--muted); stroke-width: 1.2; }
.sm .area.pv { fill: var(--sun); fill-opacity: .2; }
.sm .line.pv { stroke: var(--sun); }
.sm .grid { stroke: var(--line); stroke-width: .5; }
.sm .tick { fill: var(--muted); font-size: 9px; }
.sm rect.in { fill: var(--chg-in); }
.sm rect.out { fill: var(--chg-out); }
.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 14px 0 8px; }
.days-table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--panel); border-radius: 10px; overflow: hidden; }
.days-table th, .days-table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.days-table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.days-table th:first-child, .days-table td:first-child { text-align: left; }
.days-table tr:last-child td { border-bottom: 0; }
.bars { display: flex; align-items: flex-end; height: 110px; margin: 0 -3px 4px; }
.bar-col { flex: 1; margin: 0 3px; text-align: center; font-size: 11px; color: var(--muted); }
.bar-col .b { background: var(--sun); border-radius: 4px 4px 0 0; margin: 0 auto 4px; width: 70%; }
.bar-col .n { color: var(--text); font-size: 12px; }
.cal-cols { -webkit-column-count: 2; column-count: 2; -webkit-column-gap: 16px; column-gap: 16px; }
.cal-cols .day { -webkit-column-break-inside: avoid; break-inside: avoid; }
/* Handy und Hochformat: eine Spalte – zwei Termine nebeneinander sind dort zu schmal */
@media (max-width: 760px), (orientation: portrait) { .cal-cols { -webkit-column-count: 1; column-count: 1; } }
.cams.big .cam { width: 50%; }
.cams.big .cam-label { font-size: 16px; }
.all-shutters { display: flex; margin: 0 -5px 14px; }
.all-shutters .btn { flex: 1; margin: 0 5px; min-height: 52px; font-size: 16px; font-weight: 500; background: var(--panel); }
.detail-tools { display: flex; justify-content: space-between; align-items: center; margin: -4px 0 12px; font-size: 13px; }
/* Raumkarten: Breite nach Anzahl der Rollos (1 = ein Drittel, 2 = zwei Drittel, 3+ = ganze Breite) */
.room-grid { display: flex; flex-wrap: wrap; margin: 0 -6px; }
.room-card { padding: 0 6px 12px; }
.room-card.span-1 { width: 33.3333%; }
.room-card.span-2 { width: 66.6666%; }
.room-card.span-3 { width: 100%; }
.room-inner { height: 100%; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
.room-head { display: flex; align-items: center; padding: 12px 14px 6px; }
.room-name { flex: 1; font-size: 19px; font-weight: 500; }
.room-state { font-size: 13px; color: var(--muted); margin-left: 8px; }
.room-head .move { min-width: 44px; min-height: 40px; margin: 0 6px 0 0; font-size: 15px; }
.room-head .move:last-child { margin: 0 0 0 8px; }
.room-head .move[disabled] { opacity: .25; }
.room-grid.reorder .room-inner { box-shadow: inset 0 0 0 2px var(--accent); }
.room-all { padding: 4px 14px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.room-all .btn { color: var(--text); font-size: 15px; }
.room-shutters { display: flex; }
.shutter-row { flex: 1; min-width: 0; padding: 10px 14px 12px; }
.shutter-row + .shutter-row { border-left: 1px solid var(--line); }
.shutter-row.unreach { opacity: .5; }
.row-head { display: flex; justify-content: space-between; font-size: 15px; }
.row-head .muted { font-size: 13px; }
.shutter-row .lvl { height: 4px; margin: 6px 0 8px; border-radius: 2px; background: var(--panel-2); }
.shutter-row .lvl div { height: 100%; border-radius: 2px; background: var(--accent); }
.sbtns { display: flex; margin: 6px -3px 0; }
.sbtns .btn { flex: 1; min-width: 0; margin: 0 3px; padding: 10px 4px; }
.sbtns.presets .btn { font-size: 14px; }
.sbtns .btn.cur { background: var(--accent); color: #fff; }
.sbtns .btn.busy, .all-shutters .btn.busy { opacity: .5; }
.room-card.focus .room-name { color: var(--accent); }
@media (orientation: portrait) {
  .room-card.span-1 { width: 50%; }
  .room-card.span-2, .room-card.span-3 { width: 100%; }
}
/* Kalenderfarben */
.cal-colors { background: var(--panel); border-radius: var(--radius); padding: 4px 14px; }
.cal-color-row { display: flex; align-items: center; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cal-color-row:last-child { border-bottom: 0; }
.cal-color-name { width: 200px; font-size: 15px; }
.cal-color-name .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; }
.swatches { display: flex; flex-wrap: wrap; align-items: center; }
.swatch { width: 40px; height: 40px; margin: 3px; border: 0; border-radius: 50%; cursor: pointer; }
.swatch.cur { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--text); }
.swatches .btn.small { margin-left: 8px; }
.totals { font-size: 13px; color: var(--muted); margin-top: 10px; }

/* --- Modal --- */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, .85); z-index: 20; display: flex; align-items: center; justify-content: center; }
.modal-inner { width: 92%; max-width: 1100px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 20px; }
.modal-head .btn { margin-left: 8px; }
/* Titel kürzt sich, die Knöpfe bleiben immer in einer Zeile */
.modal-head > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-head > span:last-child { display: flex; flex-wrap: nowrap; flex-shrink: 0; }
.modal-head > span:last-child .btn { white-space: nowrap; }
@media (max-width: 520px) {
  .modal-head { font-size: 18px; }
  .modal-head > span:last-child .btn { margin-left: 6px; padding: 8px 10px; font-size: 14px; }
}
.modal-img-wrap { position: relative; min-height: 40vh; background: #000; border-radius: var(--radius); overflow: hidden; }
.modal-img-wrap img, .modal-img-wrap video { display: block; width: 100%; background: #000; }
/* Laden: letztes Standbild abgedunkelt im Hintergrund, Live erst einblenden, wenn es läuft */
.modal-img-wrap #modal-img, .modal-img-wrap video { position: relative; z-index: 1; -webkit-transition: opacity .5s; transition: opacity .5s; }
.modal-img-wrap .pending { opacity: 0; }
.modal-still { position: absolute; top: 0; left: 0; height: 100%; object-fit: cover; z-index: 0; opacity: 0;
  -webkit-filter: brightness(.45) blur(2px); filter: brightness(.45) blur(2px); -webkit-transition: opacity .5s; transition: opacity .5s; }
.modal-still.show { opacity: 1; }
.modal-still.plain { -webkit-filter: none; filter: none; }
.modal-loading.failed { justify-content: flex-end; padding-bottom: 14px; font-size: 14px; }
.modal-loading { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: #fff; font-size: 16px; text-shadow: 0 1px 3px #000; }
.modal-loading .spinner { width: 54px; height: 54px; margin-bottom: 14px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .25);
  border-top-color: var(--accent); -webkit-animation: spin 1s linear infinite; animation: spin 1s linear infinite; }
.modal-loading .loading-bar { position: relative; width: 50%; max-width: 280px; height: 4px; margin-top: 14px; border-radius: 2px;
  background: rgba(255, 255, 255, .2); overflow: hidden; }
.modal-loading .loading-bar i { position: absolute; top: 0; left: -40%; width: 40%; height: 100%; border-radius: 2px; background: var(--accent);
  -webkit-animation: slide 1.4s ease-in-out infinite; animation: slide 1.4s ease-in-out infinite; }
.modal-loading.failed .spinner, .modal-loading.failed .loading-bar { display: none; }
@-webkit-keyframes slide { 0% { left: -40%; } 100% { left: 100%; } }
@keyframes slide { 0% { left: -40%; } 100% { left: 100%; } }
#modal-info { margin-top: 8px; font-size: 13px; }

.dim { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #000; opacity: .55; z-index: 25; }
.toast {
  position: fixed; left: 50%; bottom: 24px; width: 320px; margin-left: -160px;
  padding: 12px 16px; border-radius: 10px; background: var(--panel-2); text-align: center; z-index: 30;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
}
.topright { display: flex; align-items: center; }
.fresh { font-size: 12px; color: var(--muted); margin-right: 6px; white-space: nowrap; }
.fresh.stale { color: var(--sun); font-weight: 600; }
.topright .btn { margin-left: 14px; }

/* --- Anmeldung --- */
.login { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.login-box { width: 300px; text-align: center; }
.login-box h1 { font-weight: 200; font-size: 34px; margin: 0 0 24px; }
.login-box input {
  display: block; width: 100%; margin-bottom: 12px; padding: 12px 14px;
  font-size: 17px; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; -webkit-appearance: none;
}
.btn.primary { width: 100%; padding: 12px; background: var(--accent); color: #fff; font-size: 17px; }
/* Zwei-Faktor */
.login-box { max-height: 100%; overflow-y: auto; }
#login-2fa { width: 360px; }
#login-2fa .btn { width: 100%; margin-top: 8px; }
.twofa-setup p { font-size: 14px; text-align: left; line-height: 1.4; }
.twofa-qr { background: #fff; border-radius: 12px; padding: 10px; width: 220px; height: 220px; margin: 8px auto; }
.twofa-qr svg { width: 200px; height: 200px; display: block; }
#twofa-secret { font-size: 13px; word-break: break-all; color: var(--text); }
#twofa-code { font-size: 26px; letter-spacing: 6px; text-align: center; }
/* Mein Konto */
.account-box { max-width: 420px; background: var(--panel); border-radius: var(--radius); padding: 16px; }
.account-box input[type="password"], .account-box input[type="text"] { display: block; width: 100%; margin-bottom: 10px; padding: 11px 13px; font-size: 16px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; -webkit-appearance: none; }
.account-box .btn + .btn { margin-left: 8px; }

.hidden { display: none !important; }

/* Sechs Kennzahlen in einer Reihe: etwas kleinere Zahlen */
.e-tile.w16 .e-card.center .e-big { font-size: 30px; }
.e-tile.w16 .e-sub { font-size: 11px; }

/* --- Steckdosen --- */
.plug { display: flex; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.plug:last-child { border-bottom: 0; }
.plug-text { flex: 1; min-width: 0; }
.plug-name { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plug-sub { font-size: 12px; color: var(--muted); }
.plug.offline .plug-name, .plug-card.offline .plug-name { color: var(--muted); }
.plug-switch { position: relative; width: 60px; height: 34px; margin: 5px 0 5px 10px; padding: 0; border: 0; border-radius: 17px;
  background: var(--line); -webkit-transition: background .2s; transition: background .2s; flex: none; }
.plug-switch .knob { position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%; background: #fff;
  -webkit-transition: -webkit-transform .2s; transition: transform .2s; }
.plug-switch.on { background: var(--green); }
.plug-switch.on .knob { -webkit-transform: translateX(26px); transform: translateX(26px); }
.plug-switch[disabled] { opacity: .35; }
.plug-switch.big { width: 72px; height: 40px; border-radius: 20px; }
.plug-switch.big .knob { width: 34px; height: 34px; }
.plug-switch.big.on .knob { -webkit-transform: translateX(32px); transform: translateX(32px); }
.plug-cards { display: flex; flex-wrap: wrap; margin: 0 -6px; }
.plug-card { width: 25%; padding: 0 6px 12px; }
.plug-card .plug-card-head { display: flex; align-items: flex-start; justify-content: space-between; }
.plug-card { box-sizing: border-box; }
.plug-card-head, .plug-big, .plug-card > .plug-sub { background: var(--panel); }
.plug-card-head { padding: 14px 14px 0; border-radius: var(--radius) var(--radius) 0 0; }
.plug-big { padding: 10px 14px 0; font-size: 30px; font-weight: 300; }
.plug-card > .plug-sub { padding: 2px 14px 14px; border-radius: 0 0 var(--radius) var(--radius); }
.plug-card.on .plug-big { color: var(--green); }
@media (orientation: portrait) { .plug-card { width: 50%; } }
@media (max-width: 600px) { .plug-card { width: 100%; } }

/* Schaltmodus der Steckdose */
.plug-mode { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 8px; background: var(--panel-2); color: var(--muted); font-size: 11px; }
.plug-mode.sma { color: var(--sun); }

/* --- Handy: eine Spalte, Babyphone-Kamera zuerst --- */
@media (max-width: 600px) {
  html, body { overflow: auto; }
  .topbar { height: auto; min-height: 52px; padding: 6px 12px; padding-top: calc(6px + env(safe-area-inset-top)); flex-wrap: wrap; }
  .clock #time { font-size: 28px; }
  .clock .date { margin-left: 8px; font-size: 14px; }
  .status, .fresh { display: none; }
  .topright .btn { margin-left: 8px; }
  .grid, body.motion-mode .grid { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column;
    height: auto; padding: 0 8px 12px; }
  .grid > * { margin-bottom: 10px; }
  #panel-cameras { -webkit-order: -2; order: -2; }
  .grid > .stack { -webkit-order: -1; order: -1; }
  #col-left { -webkit-order: 0; order: 0; }
  #col-left > .panel { -webkit-flex: none; flex: none; max-height: none; }
  #panel-cameras .panel-body { padding-bottom: 4px; }
  #col-left > .panel + .panel { margin-top: 10px; }
  .stack > #panel-shutters .panel-body, .grid .scroll { overflow: visible; } /* nur Kacheln, Detailansichten scrollen weiter */
  body.motion-mode #panel-calendar, body.motion-mode .stack { opacity: 1; }
  /* Babyphone (lokale Kamera) zuerst und groß, weitere Kameras darunter */
  .cams .cam[data-id^="rtsp:"] { -webkit-order: -1; order: -1; width: 100%; }
  .cams .cam.motion-active { -webkit-order: -2; order: -2; }
  .panel h2 { padding: 10px 12px 6px; }
  .panel-body { padding: 0 12px 12px; }
  /* Detailansichten */
  .e-tile.w16, .e-tile.w25 { width: 50%; }
  .e-tile.w33, .e-tile.w50 { width: 100%; }
  .cams.big .cam { width: 100%; }
}

/* Push-Einstellungen im Konto */
#push-box .check-row { display: block; padding: 8px 0; font-size: 16px; cursor: pointer; }
/* eigenes Kästchen mit deutlichem Haken (iOS zeigt sonst nur einen leeren Kreis) */
#push-box .check-row input { position: relative; display: inline-block; width: 24px; height: 24px; margin: 0 10px 0 0; padding: 0;
  vertical-align: middle; border: 2px solid var(--muted); border-radius: 6px; background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none; }
#push-box .check-row input:checked { background: var(--accent); border-color: var(--accent); }
#push-box .check-row input:checked::after { content: ''; position: absolute; left: 6px; top: 1px; width: 6px; height: 12px;
  border: solid #fff; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); transform: rotate(45deg); }
#push-box .btn { margin: 8px 6px 0 0; }

/* Blink-Aufnahmen in der Kamera-Detailansicht */
.clips-title { margin-top: 18px; }
.clips { display: flex; flex-wrap: wrap; margin: 0 -5px; }
.clip { width: 25%; padding: 0 5px 12px; cursor: pointer; }
.clip-thumb { position: relative; padding-top: 56.25%; border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.clip-thumb img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.clip-play { position: absolute; top: 50%; left: 50%; margin: -18px 0 0 -14px; font-size: 30px; color: var(--muted); }
.clip-meta { margin-top: 5px; font-size: 13px; color: var(--muted); }
.clip-meta b { color: var(--text); font-weight: 500; }
@media (orientation: portrait) { .clip { width: 33.333%; } }
@media (max-width: 600px) { .clip { width: 50%; } }

/* Tooltips der Energie-Detailansicht (Kennzahlen und Diagramme) */
.chart-tip { position: fixed; z-index: 40; min-width: 180px; max-width: 300px; padding: 10px 12px; border-radius: 10px;
  background: rgba(17, 21, 27, .96); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  font-size: 13px; pointer-events: none; }
.chart-tip .tip-title { font-weight: 600; margin-bottom: 6px; }
.chart-tip table { width: 100%; border-collapse: collapse; }
.chart-tip td { padding: 2px 0; color: var(--muted); white-space: nowrap; }
.chart-tip td + td { padding-left: 14px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-tip i { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 2px; vertical-align: -1px; }
.chart { position: relative; }
.tip-mark { position: absolute; top: 0; bottom: 18px; pointer-events: none; }
.tip-mark.line { width: 1px; background: rgba(255, 255, 255, .45); }
.tip-mark.col { background: rgba(255, 255, 255, .07); border-radius: 4px; }
.e-card.has-tip { cursor: pointer; }
/* Auto-Ladung: Anteile PV / Akku / Netz */
.ev-share { margin: 8px 0 4px; }
.ev-share-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); }
.ev-share-bar span { display: block; height: 100%; }
.ev-share-bar span + span { border-left: 2px solid var(--panel); }
.ev-share-legend { margin-top: 5px; font-size: 12px; color: var(--muted); }
.ev-share-legend span { display: inline-block; margin-right: 12px; white-space: nowrap; }
.ev-share-legend b { color: var(--text); font-weight: 500; }
.ev-share-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
/* Ladeanzeige in Kacheln und Detailansichten */
.empty.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px 0; color: var(--muted); }
.empty.loading .spinner { display: block; width: 26px; height: 26px; margin-bottom: 8px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .12);
  border-top-color: var(--accent); -webkit-animation: spin .9s linear infinite; animation: spin .9s linear infinite; }
.empty.loading span { -webkit-animation: loadpulse 1.6s ease-in-out infinite; animation: loadpulse 1.6s ease-in-out infinite; }
.empty.loading .loading-bar { position: relative; display: block; width: 120px; height: 3px; margin-top: 10px; border-radius: 2px;
  background: rgba(255, 255, 255, .08); overflow: hidden; }
.empty.loading .loading-bar i { position: absolute; top: 0; left: -40%; width: 40%; height: 100%; border-radius: 2px; background: var(--accent);
  -webkit-animation: slide 1.4s ease-in-out infinite; animation: slide 1.4s ease-in-out infinite; }
@-webkit-keyframes loadpulse { 50% { opacity: .45; } }
@keyframes loadpulse { 50% { opacity: .45; } }
.echart .hdot { stroke: var(--panel); stroke-width: 1.5; }
.cam.collapsed { cursor: default; }
/* Platzhalter-Bild der eingeklappten Babycam nie zeigen (die Bildaktualisierung würde es sonst einblenden) */
.cam.collapsed img { display: none !important; }

/* --- Heller Modus (pro Benutzer unter „Konto“ wählbar; Standard ist dunkel) --------------- */
:root[data-theme="light"] {
  --bg: #eef1f5;
  --panel: #ffffff;
  --panel-2: #e8ecf1;
  --line: #d5dbe3;
  --text: #18202a;
  --muted: #5b6676;
  --accent: #2b74d6;
  --sun: #b97f00;
  --green: #1c9460;
  --red: #d33f3f;
  --chg-in: #2b6fd0;
  --chg-out: #c24e1a;
  --c-pv: #d99a00;
  --c-house: #2b74d6;
  --c-soc: #1c9460;
}
[data-theme="light"] .panel, [data-theme="light"] .e-card { box-shadow: 0 1px 3px rgba(20, 30, 45, .08); }
[data-theme="light"] .chart-tip { background: rgba(255, 255, 255, .98); box-shadow: 0 8px 24px rgba(20, 30, 45, .18); }
[data-theme="light"] .tip-mark.line { background: rgba(20, 30, 45, .35); }
[data-theme="light"] .tip-mark.col { background: rgba(20, 30, 45, .06); }
[data-theme="light"] .empty.loading .spinner { border-color: rgba(20, 30, 45, .12); border-top-color: var(--accent); }
[data-theme="light"] .empty.loading .loading-bar { background: rgba(20, 30, 45, .08); }
[data-theme="light"] .event.running { background: rgba(43, 116, 214, .1); }
[data-theme="light"] .pv .sun.producing { text-shadow: 0 0 12px rgba(217, 154, 0, .45); }
/* Auswahl Hell/Dunkel im Konto */
.theme-pick { display: flex; margin: 6px 0 4px; }
.theme-pick .btn { flex: 1; margin-right: 8px; }
.theme-pick .btn:last-child { margin-right: 0; }
.theme-pick .btn.cur { background: var(--accent); color: #fff; }
/* Ereignisse der Kameras (Kamera-Details) */
.event-filter { margin: 4px 0 10px; }
.event-filter .btn { margin: 0 6px 6px 0; }
.event-filter .btn.cur { background: var(--accent); color: #fff; }
.event-wait { display: flex; align-items: center; margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); font-size: 14px; }
.event-wait.hidden { display: none; }
.event-wait .spinner { display: inline-block; width: 18px; height: 18px; margin-right: 10px; border-radius: 50%; border: 3px solid var(--line);
  border-top-color: var(--accent); -webkit-animation: spin .9s linear infinite; animation: spin .9s linear infinite; }
.clip-badge { position: absolute; right: 6px; bottom: 6px; width: 26px; height: 26px; line-height: 26px; text-align: center; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; }
.clip.no-video { cursor: default; }
.clip.no-video .clip-thumb { opacity: .6; }
/* Knopf „Live“ je Kamera: Live-Bild in der Kachel dauerhaft an, bis es ausgeschaltet wird */
.live-pin { position: absolute; top: 8px; left: 8px; z-index: 3; padding: 5px 10px; border: 0; border-radius: 14px;
  background: rgba(0, 0, 0, .6); color: #fff; font-size: 13px; cursor: pointer; }
.live-pin.on { background: var(--red); }
.live-pin .pulse { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #fff;
  -webkit-animation: pulse 1s infinite; animation: pulse 1s infinite; }
/* --- Menüleiste unten (App-Bereiche, angelehnt an die SMA-App) ------------------------------ */
.detail-body { padding-bottom: 110px; } /* Platz für die schwebende Leiste */
.detail-sub { display: flex; padding: 0 18px 10px; }
.detail-sub.hidden { display: none; }
.detail-sub .btn { margin-right: 8px; }
.detail-sub .btn.cur { background: var(--accent); color: #fff; }
.tabbar {
  /* immer sichtbar (auch auf dem Dashboard); Vollbild, Abdunkeln und Anmeldung liegen darüber */
  position: fixed; left: 50%; bottom: 14px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 18;
  display: flex; width: 94%; max-width: 640px; padding: 6px; -webkit-transform: translateX(-50%); transform: translateX(-50%);
  border-radius: 30px; border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(32, 38, 46, .82); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.tab {
  flex: 1; min-width: 0; padding: 7px 2px 6px; border: 0; border-radius: 22px; background: transparent;
  color: var(--text); font-size: 11.5px; line-height: 1.2; text-align: center; cursor: pointer;
  -webkit-transition: background .2s, color .2s; transition: background .2s, color .2s;
}
.tab span { display: block; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-ico { display: block; width: 25px; height: 25px; margin: 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round; }
.tab.cur { background: rgba(255, 255, 255, .08); color: var(--accent); }
[data-theme="light"] .tabbar { background: rgba(255, 255, 255, .85); border-color: rgba(20, 30, 45, .08); box-shadow: 0 10px 30px rgba(20, 30, 45, .18); }
[data-theme="light"] .tab.cur { background: rgba(43, 116, 214, .1); }
@media (min-width: 900px) { .tab { font-size: 13px; } .tab-ico { width: 27px; height: 27px; } }
/* --- Licht (Philips Hue) ------------------------------------------------------------------- */
.hue-all { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; padding: 12px 16px;
  background: var(--panel); border-radius: var(--radius); font-size: 17px; }
.hue-grid { display: flex; flex-wrap: wrap; margin: 0 -6px; }
.hue-card { width: 100%; margin: 0 6px 12px; padding: 14px 16px 16px; border-radius: 18px; background: var(--panel);
  color: var(--text); -webkit-transition: background .4s; transition: background .4s; }
@media (min-width: 760px) { .hue-card { width: calc(50% - 12px); } }
@media (min-width: 1150px) { .hue-card { width: calc(33.333% - 12px); } }
.hue-card.on { color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.hue-card.on.dark-text { color: #1b1f24; }
.hue-row { display: flex; align-items: center; }
.hue-ico { width: 40px; font-size: 26px; }
.hue-name { flex: 1; min-width: 0; font-size: 19px; font-weight: 500; }
.hue-name small { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; opacity: .7; }
.hue-name small + small { display: inline; }
.hue-card .plug-switch.on { background: rgba(255, 255, 255, .35); }
.hue-card.dark-text .plug-switch.on { background: rgba(0, 0, 0, .25); }
/* Helligkeitsregler als breite Leiste wie in der Hue-App */
.hue-dim { width: 100%; height: 26px; margin: 14px 0 0; padding: 0; background: transparent; -webkit-appearance: none; appearance: none; }
.hue-dim::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: rgba(127, 127, 127, .35); }
.hue-dim::-moz-range-track { height: 8px; border-radius: 4px; background: rgba(127, 127, 127, .35); }
.hue-dim::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -9px; border-radius: 50%; background: #fff; border: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4); -webkit-appearance: none; appearance: none; }
.hue-dim::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.hue-dim[disabled] { opacity: .45; }
.hue-autos { max-width: 720px; }
.hue-auto { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 16px 18px;
  background: var(--panel); border-radius: 18px; }
.hue-auto b { display: block; font-size: 18px; font-weight: 500; }
.hue-auto span { display: block; margin-top: 4px; color: var(--muted); font-size: 14px; }
/* --- Fernbedienung (Harmony) ---------------------------------------------------------------- */
.remote-acts { display: flex; flex-wrap: wrap; margin-bottom: 14px; }
.remote-acts .btn { margin: 0 8px 8px 0; padding: 10px 14px; }
.remote-acts .btn.cur { background: var(--accent); color: #fff; }
.remote-acts .btn.off.cur { background: var(--panel-2); color: var(--muted); }
.remote { max-width: 360px; margin: 6px auto 0; padding: 22px 18px; border-radius: 28px; background: var(--panel); }
.dpad { --dp: 240px; position: relative; width: var(--dp); height: var(--dp); margin: 0 auto 14px; border-radius: 50%; background: var(--panel-2); }
.rk { position: relative; overflow: hidden; border: 0; border-radius: 16px; background: var(--panel-2); color: var(--text); font-size: 16px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none;
  -webkit-transition: -webkit-transform .12s ease, background .15s ease, box-shadow .15s ease, color .15s ease;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease, color .15s ease; }
.rk .rk-cap { position: relative; z-index: 1; }
.rk[disabled] { opacity: .3; cursor: default; }
/* Mauszeiger darüber (nur Geräte mit Maus) bzw. Finger darüber (.hot, per Skript): anheben, farbiger Rand */
.rk.hot { background: var(--line); -webkit-transform: translateY(-1px) scale(1.06); transform: translateY(-1px) scale(1.06);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .28), 0 0 0 3px var(--rk-color, var(--accent)) inset; color: var(--rk-color, var(--accent)); }
.dpad .rk.hot { background: rgba(79, 156, 249, .22); }
@media (hover: hover) {
  .rk:not([disabled]):hover { background: var(--line); -webkit-transform: translateY(-1px) scale(1.04); transform: translateY(-1px) scale(1.04);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .28), 0 0 0 2px var(--rk-color, var(--accent)) inset; }
  .dpad .rk:not([disabled]):hover { background: rgba(79, 156, 249, .18); }
  .remote-acts .btn:not(.cur):hover { background: var(--line); -webkit-transform: translateY(-1px); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
}
/* Drücken: Taste in ihrer Farbe aufleuchten, Welle von der Mitte, kurzer Lichtring */
.rk.k-ok { --rk-color: var(--green); }
.rk.k-volume_up, .rk.k-volume_down { --rk-color: var(--sun); }
.rk.k-mute { --rk-color: var(--red); }
.rk.k-back, .rk.k-menu { --rk-color: #b388ff; }
.rk.pressed { -webkit-transform: scale(.9); transform: scale(.9); background: var(--rk-color, var(--accent)); color: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .18), 0 0 18px var(--rk-color, var(--accent)); }
@media (hover: hover) {
  .rk:not([disabled]):active { -webkit-transform: scale(.9); transform: scale(.9); background: var(--rk-color, var(--accent)); color: #fff; }
}
.rk .rk-ink { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: rgba(255, 255, 255, .55); opacity: 0; -webkit-transform: scale(0); transform: scale(0); pointer-events: none; }
.rk.pressed .rk-ink { -webkit-animation: rkink .45s ease-out; animation: rkink .45s ease-out; }
@-webkit-keyframes rkink { 0% { opacity: .7; -webkit-transform: scale(0); } 100% { opacity: 0; -webkit-transform: scale(14); } }
@keyframes rkink { 0% { opacity: .7; transform: scale(0); } 100% { opacity: 0; transform: scale(14); } }
.remote-acts .btn { -webkit-transition: background .15s, -webkit-transform .12s, box-shadow .15s; transition: background .15s, transform .12s, box-shadow .15s; }
.remote-acts .btn.pressed { -webkit-transform: scale(.95); transform: scale(.95); background: var(--accent); color: #fff; box-shadow: 0 0 16px var(--accent); }
/* Energie-Ansicht beim Öffnen: Kacheln steigen nacheinander auf, Tachos laufen hoch, Mini-Kurven und
   Anteilsbalken ziehen von links nach rechts auf (Verzögerung je Kachel über --d) */
.e-grid.intro > .e-tile { opacity: 0; -webkit-animation: tilein .5s var(--d, 0ms) cubic-bezier(.2, .7, .3, 1) forwards;
  animation: tilein .5s var(--d, 0ms) cubic-bezier(.2, .7, .3, 1) forwards; }
@keyframes tilein { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.e-grid.intro > .e-tile .garc { -webkit-animation: gsweep 1.1s calc(var(--d, 0ms) + 200ms) ease-out both;
  animation: gsweep 1.1s calc(var(--d, 0ms) + 200ms) ease-out both; }
@keyframes gsweep { from { stroke-dasharray: 0 400; } }
.e-grid.intro > .e-tile .spark, .e-grid.intro > .e-tile .ev-share-bar {
  -webkit-animation: reveal 1s calc(var(--d, 0ms) + 250ms) ease-out both; animation: reveal 1s calc(var(--d, 0ms) + 250ms) ease-out both; }
@keyframes reveal { from { -webkit-clip-path: inset(0 100% 0 0); clip-path: inset(0 100% 0 0); }
  to { -webkit-clip-path: inset(0 0 0 0); clip-path: inset(0 0 0 0); } }
.e-grid.intro > .e-tile .eflow { -webkit-animation: fadein .8s calc(var(--d, 0ms) + 150ms) ease-out both; animation: fadein .8s calc(var(--d, 0ms) + 150ms) ease-out both; }

@media (prefers-reduced-motion: reduce) {
  .e-grid.intro > .e-tile { opacity: 1; }
  .e-grid.intro > .e-tile, .e-grid.intro > .e-tile * { -webkit-animation: none !important; animation: none !important; }
  .rk, .remote-acts .btn { -webkit-transition: none; transition: none; }
  .rk.pressed .rk-ink { -webkit-animation: none; animation: none; }
}
/* Steuerkreuz skaliert mit --dp (die Fernbedienung verkleinert es, damit alles ohne Scrollen passt) */
.dpad .rk { position: absolute; width: 30%; height: 30%; border-radius: 50%; background: transparent; font-size: 22px; }
.dpad .d-up { top: 1.7%; left: 35%; } .dpad .d-down { bottom: 1.7%; left: 35%; }
.dpad .d-left { left: 1.7%; top: 35%; } .dpad .d-right { right: 1.7%; top: 35%; }
.dpad .d-ok { top: 29.2%; left: 29.2%; width: 41.6%; height: 41.6%; background: var(--panel); font-size: 20px; font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
/* Steuerkreuz: gedrückte Taste leuchtet in ihrer Farbe (schlägt die Hintergrundregeln darüber) */
.dpad .rk.pressed { background: var(--rk-color, var(--accent)); }
@media (hover: hover) { .dpad .rk:not([disabled]):active { background: var(--rk-color, var(--accent)); } }
.remote-apps { display: flex; margin: 0 0 16px; }
.remote-apps .rk { flex: 1; height: 64px; margin: 0 5px; padding: 6px 4px; font-size: 12px; font-weight: 500; }
.remote-apps .rk-cap { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; }
.remote-apps .rk-logo { width: 34px; height: 34px; border-radius: 8px; margin-bottom: 3px; object-fit: cover; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.remote-apps .rk-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.remote-apps .rk-cap.no-logo .rk-name { font-size: 15px; }
.rk.k-app { --rk-color: #ff7a59; }
.remote-row { display: flex; margin-top: 10px; }
.remote-row .rk { flex: 1; height: 54px; margin: 0 5px; }
.remote-row .rk.small { flex: 0 0 64px; }

/* Platz für die Menüleiste unten: Dashboard-Raster endet über der Leiste */
.tabbar.hidden { display: none; }
.grid { height: calc(100% - 64px - 92px); }
@media (orientation: portrait) { .grid { height: auto; padding-bottom: 104px; } }
@media (max-width: 600px) { .grid, body.motion-mode .grid { padding-bottom: 104px; } }
/* Menüleiste näher an den unteren Rand und etwas flacher (überlappt den Home-Balken des iPhones
   wie in der SMA-App) – verdeckt weniger vom Inhalt */
.tabbar { bottom: 6px; bottom: calc(4px + env(safe-area-inset-bottom) * .35); padding: 4px; border-radius: 26px; }
.tab { padding: 5px 2px 4px; border-radius: 20px; font-size: 11px; }
.tab span { margin-top: 2px; }
.tab-ico { width: 23px; height: 23px; }
@media (min-width: 900px) { .tab { font-size: 12px; } .tab-ico { width: 25px; height: 25px; } }
.detail-body { padding-bottom: 92px; }
.grid { height: calc(100% - 64px - 74px); }
@media (orientation: portrait) { .grid { padding-bottom: 86px; } }
@media (max-width: 600px) { .grid, body.motion-mode .grid { padding-bottom: 86px; } }
/* noch tiefer: praktisch bündig am unteren Rand (auch über dem Home-Balken) */
.tabbar { bottom: 2px; }
.detail-body { padding-bottom: 76px; }
.grid { height: calc(100% - 64px - 64px); }
@media (orientation: portrait) { .grid { padding-bottom: 70px; } }
@media (max-width: 600px) { .grid, body.motion-mode .grid { padding-bottom: 70px; } }
/* Handy: Leiste ganz unten angedockt (volle Breite bis zur Unterkante, wie iOS-Apps);
   die Symbole bleiben knapp über dem Home-Balken */
@media (max-width: 760px) {
  .tabbar { left: 0; right: 0; bottom: 0; width: 100%; max-width: none; -webkit-transform: none; transform: none;
    border-radius: 18px 18px 0 0; border-width: 1px 0 0; padding: 4px 4px calc(2px + env(safe-area-inset-bottom) * .55); }
}
/* Feste Rasterhöhe (über der Menüleiste) nur im Querformat am iPad/Desktop – auf dem Handy und
   im Hochformat wachsen die Kacheln mit ihrem Inhalt (sonst überlagern sie sich) */
@media (orientation: portrait), (max-width: 600px) {
  html, body { height: auto; min-height: 100%; overflow-x: hidden; overflow-y: visible; } /* die Seite selbst scrollt (iOS) */
  .grid, body.motion-mode .grid { height: auto; }
}
/* Unterauswahl (z. B. Zuhause: Rollos, Steckdosen, Licht …): auf dem Handy waagerecht wischbar */
.detail-sub { overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
.detail-sub .btn { flex: 0 0 auto; }
/* Handy: jede Raumkarte der Rollos über die volle Breite (halbe Breite wirkt unübersichtlich) */
@media (max-width: 600px) { .room-card.span-1, .room-card.span-2, .room-card.span-3 { width: 100%; } }
/* --- Staubsauger ---------------------------------------------------------------------------- */
.vac-grid { display: flex; flex-wrap: wrap; margin: 0 -6px; }
.vac-card { width: 100%; margin: 0 6px 12px; padding: 16px; border-radius: 18px; background: var(--panel); }
@media (min-width: 760px) { .vac-card { width: calc(50% - 12px); } }
.vac-card.active { box-shadow: inset 0 0 0 2px var(--green); }
.vac-head { display: flex; align-items: center; }
.vac-head > div { flex: 1; min-width: 0; }
.vac-head b { display: block; font-size: 19px; font-weight: 500; }
.vac-head span { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.vac-ico { font-size: 30px; margin-right: 12px; }
.vac-bat { position: relative; width: 44px; height: 18px; border: 2px solid var(--muted); border-radius: 5px; overflow: hidden; }
.vac-bat i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--green); }
.vac-pct { width: auto !important; margin: 0 0 0 8px !important; color: var(--text) !important; font-size: 15px !important; }
.vac-stats { margin-top: 10px; color: var(--muted); font-size: 13px; }
.vac-btns { display: flex; flex-wrap: wrap; margin-top: 14px; }
.vac-btns .btn { flex: 1 1 auto; margin: 0 8px 8px 0; padding: 12px 10px; }
.vac-btns .btn.primary-soft { background: var(--accent); color: #fff; }
.vac-btns .btn[disabled] { opacity: .35; }
/* --- Gruppenleiste über dem Menü (z. B. Zuhause: Rollos, Steckdosen, Licht, TV, Sauger) ------- */
.subbar { position: fixed; left: 50%; bottom: 72px; z-index: 17; width: 94%; max-width: 640px;
  -webkit-transform: translateX(-50%); transform: translateX(-50%); }
.subbar.hidden { display: none; }
.subbar .groups { display: flex; padding: 4px; border-radius: 22px; border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(32, 38, 46, .88); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.grp { flex: 1; min-width: 0; padding: 5px 2px 4px; border: 0; border-radius: 18px; background: transparent; color: var(--text);
  font-size: 10.5px; line-height: 1.2; cursor: pointer; }
.grp span { display: block; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grp-ico { display: block; width: 20px; height: 20px; margin: 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round; }
.grp.cur { background: rgba(255, 255, 255, .1); color: var(--accent); }
/* Unterauswahl einer Gruppe (z. B. Licht: Räume | Automationen) als Segment-Schalter darüber */
.subbar .seg { display: flex; width: 70%; max-width: 320px; margin: 0 auto 6px; padding: 3px; border-radius: 16px;
  background: rgba(32, 38, 46, .88); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: 0 6px 18px rgba(0, 0, 0, .3); }
.subbar .seg button { flex: 1; padding: 6px 8px; border: 0; border-radius: 13px; background: transparent; color: var(--text); font-size: 13px; cursor: pointer; }
.subbar .seg button.cur { background: var(--accent); color: #fff; }
[data-theme="light"] .subbar .groups, [data-theme="light"] .subbar .seg { background: rgba(255, 255, 255, .9); border-color: rgba(20, 30, 45, .08);
  box-shadow: 0 8px 24px rgba(20, 30, 45, .16); }
[data-theme="light"] .grp.cur { background: rgba(43, 116, 214, .1); }
body.has-subbar .detail-body { padding-bottom: 170px; }
@media (max-width: 760px) {
  .subbar { bottom: calc(66px + env(safe-area-inset-bottom) * .55); width: 96%; }
}
/* Staubsauger: Karte (Zusatzmodul) */
.vac-head[data-vac-open] { cursor: pointer; }
.vac-more { margin-left: 6px; color: var(--accent); font-size: 13px; font-weight: 400; }
.vac-back { margin-bottom: 10px; }
.vac-card.single { width: auto; max-width: 820px; }
.vac-map { position: relative; width: 100%; height: 0; margin-top: 14px; border-radius: 14px; background: var(--panel-2); overflow: hidden; }
.vac-map img, .vac-map .vac-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.vac-map img { image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated; }
.vac-path { fill: none; stroke: #fff; stroke-opacity: .75; stroke-width: .6; stroke-linejoin: round; stroke-linecap: round; }
.vac-dock { fill: var(--green); stroke: #fff; stroke-width: .6; }
.vac-robot { fill: var(--accent); stroke: #fff; stroke-width: .8; }
.vac-dir { stroke: #fff; stroke-width: .8; stroke-linecap: round; }
.vac-map-legend { display: flex; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.vac-map-legend span { margin-right: 14px; }
.vac-map-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 50%; vertical-align: -1px; }
.lg-robot { background: var(--accent); } .lg-dock { background: var(--green); }
.vac-map-legend i.lg-path { height: 2px; border-radius: 1px; background: var(--text); vertical-align: 3px; }
/* Zeitpläne der Sauger */
.vac-timers { max-width: 820px; }
.vt-row { display: flex; align-items: center; margin-bottom: 10px; padding: 12px 14px; border-radius: 16px; background: var(--panel); }
.vt-row.off .vt-main { opacity: .5; }
.vt-row.editing { display: block; }
.vt-main { flex: 1; min-width: 0; cursor: pointer; }
.vt-main b { display: block; font-size: 24px; font-weight: 400; }
.vt-main span { color: var(--muted); font-size: 13px; }
.vt-form input[type=time] { padding: 8px 10px; font: inherit; font-size: 22px; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; -webkit-appearance: none; }
.vt-days { display: flex; flex-wrap: wrap; margin: 12px 0; }
.vt-day { width: 42px; height: 42px; margin: 0 6px 6px 0; border: 0; border-radius: 50%; background: var(--panel-2); color: var(--text); font-size: 14px; cursor: pointer; }
.vt-day.on { background: var(--accent); color: #fff; }
.vt-actions .btn { margin: 0 8px 6px 0; }
.vt-actions .btn.primary-soft { background: var(--accent); color: #fff; }
.vt-add { margin-top: 2px; }
/* Eingabe-Elemente des Browsers (Uhrzeit, Auswahl …) passend zum Modus */
:root { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
/* Zeitpläne innerhalb der Saugerkarte (unter den Knöpfen) */
.vac-card .vt-title { margin: 14px 0 8px; font-size: 13px; font-weight: 600; letter-spacing: .5px; color: var(--muted); text-transform: uppercase; }
.vac-card .vt-title small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.vac-card .vt-row { background: var(--panel-2); }
.vac-card .vt-form input[type=time], .vac-card .vt-day:not(.on) { background: var(--panel); }
.vt-none { padding: 6px 2px 10px; color: var(--muted); font-size: 13px; }
/* Zeitplan: Modus und Intensität */
.vt-sels { display: flex; flex-wrap: wrap; margin: 0 -4px 8px; }
.vt-sel { display: block; width: 50%; padding: 0 4px 8px; font-size: 12px; color: var(--muted); }
.vt-sel span { display: block; margin-bottom: 3px; }
.vt-sel select { width: 100%; padding: 9px 10px; font: inherit; font-size: 15px; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; }
.vt-hint { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
/* Zeitplan wird gespeichert: Zeile abgeblendet und gesperrt, Knopf mit drehendem Kreis */
.vt-row.saving { opacity: .75; pointer-events: none; }
.vt-row.saving .plug-switch { -webkit-animation: loadpulse 1s ease-in-out infinite; animation: loadpulse 1s ease-in-out infinite; }
.btn-spin { display: inline-block; width: 14px; height: 14px; margin: 0 8px -2px 0; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff; -webkit-animation: spin .8s linear infinite; animation: spin .8s linear infinite; }

/* Auto */
.car-main { display: flex; align-items: center; margin-top: 10px; }
.car-gauge { width: 140px; flex: 0 0 auto; margin-right: 16px; }
.car-gauge .gauge { width: 100%; height: auto; }
.car-charge { flex: 1; min-width: 0; font-size: 15px; line-height: 1.4; }
.car-charge b { font-weight: 500; font-size: 17px; }
.car-charge .car-full { font-size: 22px; font-weight: 300; margin: 2px 0; }
.car-charge .muted { color: var(--muted); font-size: 13px; }
.car-facts { margin-top: 8px; }
.car-row { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--panel-2); font-size: 14px; }
.car-row span { color: var(--muted); margin-right: 12px; }
.car-row b { font-weight: 500; text-align: right; white-space: nowrap; }
.car-climate { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--panel-2); }
.car-climate-head { font-size: 15px; font-weight: 500; }
.car-climate-head span { color: var(--muted); font-weight: 400; margin-left: 6px; }

/* Kurzbefehle (Konto) */
.sc-howto { margin: 8px 0 10px; font-size: 14px; line-height: 1.5; }
.sc-row { display: flex; align-items: center; flex-wrap: wrap; margin: 0 0 8px; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); }
.sc-row b { flex: 0 0 70px; }
.sc-row .sc-url { flex: 1 1 160px; min-width: 0; font-size: 11px; word-break: break-all; color: var(--muted); margin-right: 8px; }
.sc-row .btn.small { flex: 0 0 auto; margin: 0; }
.sc-group { margin: 12px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.sc-foot { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.account-box .sc-foot .btn + .btn { margin-left: 0; }

/* Termine anlegen/ändern */
.cal-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; }
.cal-tools .muted { font-size: 13px; }
.cal-tools .btn.primary-soft { background: var(--accent); color: #fff; }
.event { cursor: pointer; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.event:active { background: var(--panel-2); }
/* Kontextmenü zum Termin (Gedrückthalten) */
.cal-sheet { position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 30; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; justify-content: center; }
.cal-sheet-inner { width: 100%; max-width: 480px; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; background: var(--panel); }
.cal-sheet-title { font-size: 17px; font-weight: 500; margin-bottom: 12px; }
.cal-sheet-title span { display: block; margin-top: 4px; font-size: 13px; font-weight: 400; color: var(--muted); }
.cal-sheet-inner .btn { display: block; width: 100%; margin: 0 0 8px; padding: 13px; font-size: 16px; text-align: center; box-sizing: border-box; }
.cal-sheet-inner .btn.primary { background: var(--accent); color: #fff; }
@media (min-width: 760px) { .cal-sheet { align-items: center; } .cal-sheet-inner { border-radius: 18px; } }
.cal-form { max-width: 480px; background: var(--panel); border-radius: var(--radius); padding: 16px; }
.cal-form input[type="text"], .cal-form textarea, .cal-form select { display: block; width: 100%; margin-bottom: 10px; padding: 11px 13px; font-size: 16px;
  color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; box-sizing: border-box; font-family: inherit; }
.cal-form textarea { resize: vertical; }
.cal-form .cf-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-form .cf-row span { width: 56px; color: var(--muted); font-size: 14px; }
.cal-form .cf-row input { flex: 1; min-width: 0; padding: 9px 10px; font-size: 16px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; font-family: inherit; }
.cal-form .cf-row input[type="time"] { flex: 0 0 110px; }
.cal-form .cf-allday { display: block; margin: 0 0 10px; font-size: 15px; }
.cal-form .cf-cal-fixed { margin: -4px 0 10px; font-size: 14px; }
.cal-form .cf-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.cal-form .cf-btns .btn { margin: 0; }
.cal-form .cf-btns .btn.primary { width: auto; flex: 1 1 140px; }
.cal-form .btn.danger { color: var(--red); margin-left: auto; }

/* Wetter */
.stack > #panel-weather { flex: none; }
.wx-now { display: flex; align-items: center; gap: 10px; }
.wx-icon { font-size: 38px; line-height: 1; }
.wx-temp { font-size: 34px; font-weight: 300; line-height: 1; }
.wx-text { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); line-height: 1.35; }
.wx-text b { color: var(--text); font-weight: 500; }
.wx-text span { display: block; }
.wx-hours { display: flex; margin: 10px -4px 0; overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; padding-bottom: 4px; }
.wx-hours::-webkit-scrollbar { display: none; }
.wx-h { flex: 0 0 56px; display: flex; flex-direction: column; align-items: center; font-size: 12px; color: var(--muted); scroll-snap-align: start; }
.wx-h .i { font-size: 18px; margin: 2px 0; }
.wx-h b { color: var(--text); font-weight: 500; }
.wx-h .p { font-size: 11px; } .wx-h .p.wet { color: var(--accent); font-weight: 600; }
.wx-stale { font-size: 12px; margin-top: 6px; }
.radar { margin-top: 10px; }
.radar-map { position: relative; width: 100%; max-width: 384px; height: 256px; margin: 0 auto; overflow: hidden; border-radius: 12px; background: #1a2230; }
.radar-tiles { position: absolute; width: 768px; height: 768px; }
.radar-tiles img { position: absolute; width: 256px; height: 256px; }
.radar-tiles .rain { image-rendering: auto; }
.radar-tiles .map { opacity: .75; }
.radar-tiles .rain { opacity: 0; -webkit-transition: opacity .2s; transition: opacity .2s; }
.radar-tiles .rain.on { opacity: .85; }
.radar-pin { position: absolute; left: 50%; top: 50%; font-size: 22px; -webkit-transform: translate(-50%, -100%); transform: translate(-50%, -100%); pointer-events: none; }
.radar-map { cursor: grab; }
.radar-here { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #2f80ed; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(47, 128, 237, .3); pointer-events: none; }
.radar-tiles img { -webkit-user-drag: none; -webkit-user-select: none; user-select: none; pointer-events: none; }
.radar-zoom { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px; }
.radar-zoom button { width: 34px; height: 34px; border: 0; border-radius: 9px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.radar-zoom button[disabled] { opacity: .35; }
.radar-map { touch-action: none; }
.radar-bar { position: absolute; left: 8px; right: 8px; bottom: 34px; display: flex; align-items: center; gap: 8px; }
.radar-bar button { width: 34px; height: 30px; border: 0; border-radius: 9px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 15px; cursor: pointer; }
.radar-bar input[type=range] { flex: 1; height: 30px; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; }
.radar-bar input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .55); }
.radar-bar input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.radar-time { position: absolute; right: 8px; bottom: 6px; padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 600; background: rgba(0, 0, 0, .55); color: #fff; }
#radar-toggle.cur { background: var(--accent); color: #fff; }

/* Rollo-Automatik: Rückfrage */
.auto-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 14px 10px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--panel); border-left: 4px solid var(--sun); }
.auto-banner.hidden { display: none; }
.auto-text { flex: 1 1 260px; font-size: 15px; }
.auto-text b { margin-right: 6px; }
.auto-btns { display: flex; gap: 8px; }
.auto-btns .btn.primary-soft { background: var(--accent); color: #fff; }

/* Konto: Startseite anpassen */
.pref-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.pref-row label, .pref-row > span:first-child { display: flex; align-items: center; gap: 8px; }
.pref-row input[type="checkbox"] { width: 20px; height: 20px; }
.pref-move .btn.small { min-height: 30px; padding: 4px 10px; margin-left: 6px; }
.pref-move .btn[disabled] { opacity: .3; }

/* Licht-Kachel */
.stack > #panel-lights { flex: none; }
.light-row { display: flex; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.light-row:last-child { border-bottom: 0; }
.light-ico { font-size: 20px; margin-right: 10px; }
.light-name { flex: 1; min-width: 0; font-size: 15px; }
.light-name small { display: block; font-size: 12px; color: var(--muted); }
.light-row.on .light-name { font-weight: 500; }
.light-row .plug-switch { margin: 0 0 0 10px; }

/* Konto: Übersicht in Bereichen */
.account-box.wide { max-width: 560px; }
.acct-head { display: flex; align-items: center; gap: 14px; padding: 4px 4px 16px; }
.acct-avatar { display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 24px; font-weight: 600; }
.acct-head b { display: block; font-size: 19px; font-weight: 500; }
.acct-head div span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.acct-group { margin: 0 0 14px; border-radius: 14px; background: var(--panel-2); overflow: hidden; }
.acct-group-title { padding: 10px 14px 4px; font-size: 12px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.acct-row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-top: 1px solid var(--line); cursor: pointer; color: inherit; text-decoration: none; font-size: 16px; }
.acct-group-title + .acct-row { border-top: 0; }
.acct-row:active { background: var(--line); }
.acct-row.static { cursor: default; }
.acct-row.danger .acct-label { color: var(--red); }
.acct-ico { width: 28px; text-align: center; font-size: 20px; }
.acct-label { flex: 1; }
.acct-value { color: var(--muted); font-size: 14px; }
.acct-chev { color: var(--muted); font-size: 20px; line-height: 1; }
.acct-sub-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.acct-sub-head b { font-size: 18px; font-weight: 500; }
.drag-handle { margin-right: 10px; color: var(--muted); font-size: 18px; cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; padding: 4px 6px; }
.pref-row.draggable { background: var(--panel); border-radius: 10px; margin-bottom: 6px; padding: 6px 8px; border-bottom: 0; }
.pref-row.dragging { opacity: .6; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.pref-row.draggable label { flex: 1; }

/* Vollbild-Zoom (zwei Finger), Verschieben (ein Finger) */
.modal-img-wrap { overflow: hidden; }
/* nie den Seiten-Zoom des Browsers (federt zurück): ungezoomt nur Wischen erlaubt, gezoomt gar nichts */
.modal-img-wrap { touch-action: pan-x pan-y; }
.modal-img-wrap.zoomed { touch-action: none; }
.modal-img-wrap #modal-img, .modal-img-wrap video, .modal-img-wrap .modal-still { -webkit-transform-origin: 50% 50%; transform-origin: 50% 50%; }

/* Rollos – Detailansicht: Karten je Raum */
.sh-all { background: var(--panel); border-radius: var(--radius); padding: 12px 14px 14px; margin-bottom: 12px; }
.sh-all-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sh-all-head b { font-size: 17px; font-weight: 500; }
.sh-all-head .muted { flex: 1; font-size: 13px; }
.sbtns.big .btn { min-height: 50px; font-size: 16px; font-weight: 500; }
.sh-rooms { display: grid; grid-template-columns: 1fr; grid-gap: 12px; }
@media (min-width: 760px) { .sh-rooms { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1150px) { .sh-rooms { grid-template-columns: 1fr 1fr 1fr; } }
.sh-room { background: var(--panel); border-radius: var(--radius); padding: 12px 14px 14px; }
.sh-room.focus, .sh-rooms.reorder .sh-room { box-shadow: inset 0 0 0 2px var(--accent); }
.sh-room-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sh-room-name { flex: 1; font-size: 19px; font-weight: 500; }
.sh-room-state { font-size: 13px; color: var(--muted); }
.sh-move { display: flex; gap: 4px; } .sh-move .btn { min-height: 34px; padding: 4px 10px; } .sh-move .btn[disabled] { opacity: .25; }
.sh-bar { height: 6px; border-radius: 3px; background: var(--line); margin: 2px 0 8px; } .sh-bar div { height: 100%; border-radius: 3px; background: var(--accent); }
.sh-ctl .sbtns { margin-top: 0; } .sh-ctl .sbtns.presets { margin-top: 6px; }
.sh-slider { width: 100%; height: 34px; margin: 8px 0 0; -webkit-appearance: none; appearance: none; background: transparent; }
.sh-slider::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--line); }
.sh-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.sh-slider[disabled] { opacity: .35; }
.sh-list { margin-top: 10px; border-top: 1px solid var(--line); }
.sh-item { padding: 10px 0 4px; border-bottom: 1px solid var(--line); } .sh-item:last-child { border-bottom: 0; }
.sh-item.unreach { opacity: .5; }
.sh-item-head { display: flex; justify-content: space-between; font-size: 15px; } .sh-item-head .muted { font-size: 13px; }
.sh-item-row { display: flex; align-items: center; gap: 10px; }
.sh-item-row .sh-slider { flex: 1; margin: 0; }
.sbtns.mini { flex: 0 0 auto; margin: 0; } .sbtns.mini .btn { min-height: 36px; min-width: 40px; padding: 6px 8px; font-size: 14px; }
.sh-unreach { font-size: 12px; color: var(--muted); margin-top: 4px; }
.sh-hint { font-size: 12px; margin: 12px 2px 0; }

/* Twinkly */
.light-row.offline { opacity: .5; }
.tw-list { display: flex; flex-wrap: wrap; margin: 0 -6px; }
.tw-card { width: 100%; margin: 0 6px 12px; padding: 6px 14px 12px; border-radius: 18px; background: var(--panel); }
@media (min-width: 760px) { .tw-card { width: calc(50% - 12px); } }
.tw-card .light-row { border-bottom: 0; }
.tw-ctl { display: flex; align-items: center; gap: 10px; }
.tw-ctl .hue-dim { flex: 1; }
.tw-movie { flex: 0 0 46%; padding: 8px 10px; font-size: 14px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }

/* Rollo-Kachel: Karte je Raum */
.sh-tile { padding: 10px 0 10px; border-bottom: 1px solid var(--line); }
.sh-tile:last-child { border-bottom: 0; }
.sh-tile.unreach { opacity: .55; }
.sh-tile-head { display: flex; align-items: center; gap: 8px; cursor: pointer; margin-bottom: 6px; }
.sh-tile-ico { font-size: 18px; }
.sh-tile-name { flex: 1; min-width: 0; font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-tile-state { font-size: 13px; color: var(--muted); }
.sh-tile .sh-bar { margin: 0 0 8px; }
.sh-tile .ctrl.sbtns { margin: 0 -3px; }
.sh-tile .ctrl .btn { flex: 1; min-height: 42px; padding: 8px 4px; font-size: 15px; }
.sh-tile .ctrl .btn[data-stop] { flex: 0 0 56px; }

/* Gong (Ring Chime) */
.stack > #panel-chime { flex: none; }
.chime-row { padding: 6px 0 4px; }
.chime-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.chime-name { font-size: 16px; font-weight: 500; }
.chime-state { font-size: 13px; color: var(--red); font-variant-numeric: tabular-nums; }
.chime-row.on .chime-state { color: var(--green); }
.chime-hint { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.chime-btns { display: flex; gap: 6px; }
.chime-btns .btn { flex: 1; min-width: 0; min-height: 42px; padding: 8px 2px; font-size: 14px; }
.chime-btns .btn.mute.cur { background: var(--red); color: #fff; }
.chime-btns .btn.onbtn.cur { background: var(--green); color: #fff; }

/* für Passwort-Manager lesbar, aber unsichtbar (z. B. Benutzername im Code-Schritt) */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Live-Video: Berührungen gehen an den Rahmen (freier Zoom), nicht an den iOS-Player */
.modal-img-wrap video[data-live] { pointer-events: none; }

.vac-card .vt-toggle { cursor: pointer; -webkit-user-select: none; user-select: none; }

/* Samsung-Fernseher: Auswahl der Fernbedienung, Zustand, Quellen */
/* Auswahl der Fernbedienung: alle Räume in einer Reihe, gleich breit (bei vielen waagerecht wischbar) */
.remote-acts.remote-pick { display: flex; flex-wrap: nowrap; gap: 8px; margin-bottom: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.remote-acts.remote-pick .btn { flex: 1 1 0; min-width: 0; margin: 0; padding: 9px 4px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.remote-pick .rp-ico { font-size: 15px; }
.remote-acts.remote-pick { margin-bottom: 10px; }
.remote-state { align-self: center; font-size: 13px; }
.remote-input { width: 100%; max-width: 320px; padding: 10px 12px; font-size: 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.k-home .rk-cap, .k-channel_up .rk-cap, .k-channel_down .rk-cap { font-size: 15px; }

/* Fernbedienung kompakt: alles ohne Scrollen auf dem Handy */
.remote { padding: 14px 12px; }
.remote-apps { margin-bottom: 12px; }
.remote-apps .rk { height: 58px; }
.remote-row { margin-top: 8px; }
.remote-row .rk { height: 46px; }
.remote-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.remote-top .btn { margin: 0; padding: 10px 12px; white-space: nowrap; }
.remote-top .remote-input { flex: 1; min-width: 0; max-width: none; padding: 9px 10px; }
.remote-top .remote-state { white-space: nowrap; }
.detail-body .remote-acts + .section-title { margin-top: 4px; }
.remote-apps .rk { height: 50px; }
.remote-apps .rk-logo { width: 28px; height: 28px; }
.remote-row .rk { height: 44px; }
.remote-row.tight .rk { margin: 0 3px; font-size: 17px; }
.remote-acts { margin-bottom: 8px; }
.remote-acts .btn { margin-bottom: 6px; }
.remote-row.tight .rk .rk-cap { white-space: nowrap; }
.remote-row.tight .rk[data-svol] { font-size: 14px; }
.remote-apps .rk { margin: 0 3px; }
.remote-apps .rk-cap.no-logo .rk-name { font-size: 14px; }

/* Hinweis „Fernseher läuft“ beim Aufruf: schwebt über dem Inhalt, verschwindet nach 5 s */
.tv-banner { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 10px); z-index: 40; width: calc(100% - 28px); max-width: 460px; margin: 0;
  -webkit-transform: translateX(-50%); transform: translateX(-50%); box-shadow: 0 8px 28px rgba(0, 0, 0, .45); }
.tv-banner { flex-wrap: nowrap; padding: 10px 12px; }
.tv-banner .auto-text { flex: 1; min-width: 0; font-size: 15px; }
.tv-banner .auto-btns { flex: 0 0 auto; }
.tv-banner .btn { padding: 9px 16px; }
/* Hinweis „Fernseher läuft“: doppelt so groß */
.tv-banner { min-height: 120px; padding: 22px 22px; gap: 16px; border-radius: 22px; max-width: 560px; }
.tv-banner .auto-text { font-size: 21px; line-height: 1.35; }
.tv-banner .auto-text b { font-size: 24px; }
.tv-banner .btn { padding: 18px 28px; font-size: 20px; border-radius: 16px; }
/* App-Tasten mit Logo: Platz für Logo und Namen darunter */
.remote-apps .rk { height: 62px; padding: 5px 3px; }
.remote-apps .rk-logo { width: 30px; height: 30px; margin-bottom: 2px; }
.remote-apps .rk-name { font-size: 11px; }
.remote-apps .rk-cap.no-logo .rk-name { font-size: 14px; }

/* IPTV (Sat-TV der VU+): Senderliste mit Jetzt/Danach, Programmführer, Aufnahmen, Live-Player */
.iptv-seg { display: flex; width: 70%; max-width: 320px; margin: 0 auto 10px; padding: 3px; border-radius: 16px; background: var(--panel); }
.iptv-seg button { flex: 1; padding: 7px 8px; border: 0; border-radius: 13px; background: transparent; color: var(--text); font-size: 14px; cursor: pointer; }
.iptv-seg button.cur { background: var(--accent); color: #fff; }
.iptv-list { display: flex; flex-direction: column; gap: 6px; }
.iptv-ch { border-radius: 14px; background: var(--panel); overflow: hidden; }
.iptv-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.iptv-name { width: 96px; flex: 0 0 96px; font-weight: 600; font-size: 14px; line-height: 1.2; }
.iptv-now { flex: 1; min-width: 0; font-size: 14px; }
.iptv-now b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.iptv-now span { color: var(--muted); font-size: 12px; }
.iptv-now small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iptv-bar { display: block; height: 3px; margin: 4px 0 3px; border-radius: 2px; background: var(--line); }
.iptv-bar i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.iptv-live { flex: 0 0 auto; }
.iptv-epg { padding: 0 12px 10px; max-height: 360px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.iptv-day { margin: 10px 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.iptv-ev { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.iptv-ev .t { flex: 0 0 auto; min-width: 46px; color: var(--muted); font-size: 13px; }
.iptv-ev div { flex: 1; min-width: 0; }
.iptv-ev b { display: block; font-weight: 500; font-size: 14px; }
.iptv-ev small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iptv-hint { margin-top: 12px; font-size: 12px; }
.iptv-player { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: #000; padding-top: env(safe-area-inset-top); }
.iptv-player-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; color: #fff; }
.iptv-player-head b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iptv-player video { flex: 1; width: 100%; min-height: 0; background: #000; }
.iptv-wait { position: absolute; left: 0; right: 0; top: 50%; text-align: center; color: #ccc; pointer-events: none; }
/* Raum-Auswahl mit vier Knöpfen: Symbol über dem Namen, damit nichts abgeschnitten wird */
.remote-acts.remote-pick .btn { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 2px; font-size: 12.5px; }
.remote-pick .rp-ico { font-size: 19px; line-height: 1.15; }
.iptv-ev [data-iptv-rec] { color: #ff4d4d; font-size: 16px; }
.iptv-vlc { text-decoration: none; color: inherit; }
.iptv-m3u { margin-top: 14px; padding: 12px; border-radius: 14px; background: var(--panel); }
.iptv-m3u b { display: block; margin-bottom: 4px; }
.iptv-m3u span { display: block; font-size: 12px; margin-bottom: 8px; }
.iptv-m3u .inline { display: flex; flex-wrap: wrap; gap: 6px; }
.iptv-m3u .btn { text-decoration: none; color: inherit; }

/* IPTV: Speicherplatz für Aufnahmen (belegt · geplant · Reserve · frei) */
.iptv-storage { margin: 4px 0 12px; padding: 10px 12px; background: var(--panel); border-radius: 12px; }
.iptv-storage b { font-size: 18px; }
.iptv-storage.low b { color: #e5534b; }
.iptv-storage-bar { display: flex; height: 8px; margin: 8px 0 6px; border-radius: 4px; overflow: hidden; background: #3fb950; }
.iptv-storage-bar i { display: block; height: 100%; }
.iptv-storage-bar .used { background: #6e7681; }
.iptv-storage-bar .planned { background: #d29922; }
.iptv-storage-bar .reserve { background: repeating-linear-gradient(45deg, #444c56 0 4px, #2d333b 4px 8px); }
.iptv-rec-tools { display: flex; gap: 8px; margin: 0 0 10px; }
.iptv-rec-tools input, .iptv-rec-tools select { padding: 10px 12px; font-size: 16px; font-family: inherit; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; box-sizing: border-box; -webkit-appearance: none; }
.iptv-rec-tools input { flex: 1; min-width: 0; }
.iptv-rec-tools select { flex-shrink: 0; max-width: 46%; }
.iptv-sure { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 10px; padding: 10px 12px;
  background: rgba(229, 83, 75, .12); border: 1px solid rgba(229, 83, 75, .45); border-radius: 10px; }
.iptv-sure span { flex: 1 1 100%; }
.btn.danger { background: #e5534b; color: #fff; }

/* Sicherheitsabfrage (statt System-Dialog) */
.ask-sheet { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(0, 0, 0, .55); }
.ask-card { width: 100%; max-width: 420px; padding: 18px; background: var(--panel); border-radius: 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, .4); }
.ask-card p { margin: 0 0 16px; font-size: 17px; line-height: 1.4; }
.ask-btns { display: flex; justify-content: flex-end; gap: 10px; }

/* Termine: Ansichten Tag / Woche / Monat */
.cal-seg { display: flex; flex: 1 1 260px; max-width: 360px; padding: 3px; border-radius: 16px; background: var(--panel); }
.cal-seg button { flex: 1; padding: 7px 8px; border: 0; border-radius: 13px; background: transparent; color: var(--text); font-size: 14px; cursor: pointer; }
.cal-seg button.cur { background: var(--accent); color: #fff; }
.cal-note { margin: 0 0 10px; font-size: 13px; }
.cal-nav { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; }
.cal-nav b { margin-left: 8px; font-size: 17px; font-weight: 500; }
.cal-chip { margin: 0 0 4px; padding: 4px 8px; font-size: 13px; line-height: 1.3; border-left: 4px solid; border-radius: 6px; background: var(--panel-2);
  cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-allday { margin: 0 0 8px 52px; }
.cal-grid { position: relative; margin: 0 0 20px; }
.cal-lane { position: absolute; top: 0; bottom: 0; left: 52px; right: 0; }
.cal-hour { position: absolute; left: -52px; right: 0; height: 0; border-top: 1px solid var(--line); }
.cal-hour span { position: absolute; left: 0; top: -8px; width: 44px; font-size: 11px; color: var(--muted); text-align: right; }
.cal-block { position: absolute; padding: 3px 6px; overflow: hidden; border-radius: 6px; color: #fff; font-size: 12px; line-height: 1.3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3); cursor: pointer; }
.cal-block b { font-weight: 600; }
.cal-block small { display: block; opacity: .85; }
.cal-now { position: absolute; left: -6px; right: 0; height: 2px; background: #e5534b; }
.cal-now::before { content: ''; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #e5534b; }
.cal-week { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 900px) { .cal-week { grid-template-columns: repeat(7, 1fr); } }
.cal-wday { padding: 8px; background: var(--panel); border-radius: 10px; min-height: 60px; }
.cal-wday.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-wday-head { margin: 0 0 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.cal-wday.today .cal-wday-head { color: var(--accent); }
.cal-free { font-size: 12px; color: var(--muted); }
.unloaded { opacity: .5; }
.cal-month { display: grid; grid-template-columns: 26px repeat(7, 1fr); gap: 3px; }
.cal-kw { display: flex; align-items: flex-start; justify-content: center; padding-top: 6px; font-size: 11px; color: var(--muted); cursor: pointer; }
.cal-mhead { padding: 2px 0 4px; font-size: 12px; color: var(--muted); text-align: center; }
.cal-mday { min-height: 64px; padding: 3px; overflow: hidden; background: var(--panel); border-radius: 8px; cursor: pointer; }
.cal-mday.other { opacity: .4; }
.cal-mday.today .n { background: var(--accent); color: #fff; }
.cal-mday .n { display: inline-block; min-width: 20px; padding: 1px 4px; margin: 0 0 2px; border-radius: 10px; font-size: 12px; text-align: center; }
.cal-mday i { display: block; margin: 0 0 2px; padding: 0 3px; border-radius: 3px; color: #fff; font-size: 10px; font-style: normal; line-height: 15px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-mday em { font-size: 10px; font-style: normal; color: var(--muted); }
@media (min-width: 760px) { .cal-mday { min-height: 92px; } .cal-mday i { font-size: 12px; line-height: 17px; } }
.cal-sticky { position: -webkit-sticky; position: sticky; top: 0; z-index: 5; margin: 0 -18px; padding: 0 18px 2px; background: var(--bg); }
.cal-loading { display: flex; align-items: center; gap: 8px; margin: -4px 0 8px; font-size: 13px; color: var(--muted); }
.cal-loading .spinner { width: 14px; height: 14px; }
/* Sleeptimer */
.sleep-opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 14px; }
.sleep-opts .btn { padding: 12px 4px; font-size: 16px; }
.sleep-banner .auto-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.sleep-btn { white-space: nowrap; }
.battery-banner { border: 1px solid rgba(229, 83, 75, .55); }
/* Text über die volle Breite, Knöpfe darunter (sonst drückt die Knopfzeile den Text auf dem Handy zur Spalte) */
.auto-banner.battery-banner { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 12px; min-height: 0; padding: 14px 16px; }
.battery-banner .auto-text { font-size: 15px; line-height: 1.4; }
/* unten über dem Menü – oben steht ggf. gleichzeitig der Hinweis „Fernseher läuft“ */
.tv-banner.battery-banner { top: auto; bottom: calc(env(safe-area-inset-bottom) + 96px); }
body.has-subbar .tv-banner.battery-banner { bottom: calc(env(safe-area-inset-bottom) + 150px); }
.battery-banner .auto-text b { font-size: 17px; }
.battery-banner .auto-btns { display: flex; gap: 8px; }
.battery-banner .auto-btns .btn { flex: 1; padding: 11px 12px; }
.batt-bar { position: relative; height: 4px; margin: 0 0 16px; border-radius: 2px; background: rgba(127, 127, 127, .25); overflow: hidden; }
.batt-bar i { position: absolute; top: 0; left: -40%; width: 40%; height: 100%; border-radius: 2px; background: var(--accent);
  -webkit-animation: slide 1.4s ease-in-out infinite; animation: slide 1.4s ease-in-out infinite; }
.battery-banner .auto-text small { font-size: 13px; }
.batt-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.batt-actions .batt-fault { margin-right: auto; color: #e5534b; font-size: 13px; }
