/* Flowmatic – rooms and tiles (Phase 3). Big touch targets, works from 320 px. */
.room-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.room-card { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.9rem 1rem; min-height: 6.5rem;
  background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow); color: var(--app-text); text-decoration: none; }
.room-card:hover, .room-card:focus-visible { border-color: var(--app-accent); color: var(--app-text); }
.room-name { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 1.05rem; }
.room-icon { font-size: 1.25rem; color: var(--app-accent); }
.room-facts { display: flex; flex-wrap: wrap; gap: 0.25rem 0.8rem; font-size: 0.875rem; color: var(--app-text-2); }
.room-facts i { margin-right: 0.25rem; }
.room-facts .hl { color: var(--app-accent-strong, var(--app-accent)); }
.room-facts .warn { color: #b25e09; }
.room-count { margin-top: auto; font-size: 0.75rem; color: var(--app-text-3); }

/* wide enough for names of ~36 characters in one line (title row below icon and buttons) */
.tile-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.ftile { position: relative; display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem;
  background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow); min-height: 6.5rem; transition: border-color .15s, background .15s; }
.ftile.busy { opacity: 0.6; }
/* State shows in the colour of the symbol; only an alarm tints the whole tile */
.ftile.is-alarm { background: var(--tile-alarm-bg); border-color: #e24b4a; }
.ftile.is-unreach { opacity: 0.7; }
.tile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.tile-icon { flex: none; display: inline-flex; align-items: center; justify-content: flex-start; width: 2rem; height: 2rem;
  font-size: 1.6rem; line-height: 1; color: var(--app-text-3); transition: color .15s; }
.tone-amber .tile-icon { color: var(--tone-amber); }
.tone-green .tile-icon { color: var(--tone-green); }
.tone-blue .tile-icon { color: var(--tone-blue); }
.tone-red .tile-icon { color: var(--tone-red); }
.tone-orange .tile-icon { color: var(--tone-orange); }
.tile-room { flex: 1; min-width: 0; padding-top: 0.15rem; font-size: 0.75rem; color: var(--app-text-2); text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tiles-in-room .tile-room { visibility: hidden; }
.tile-fav { flex: none; border: 0; background: none; padding: 0.25rem; margin: -0.25rem -0.25rem 0 0; color: var(--app-text-3);
  min-width: 2rem; min-height: 2rem; }
.tile-fav.on { color: #e0a200; }
.tile-flags { display: flex; flex-wrap: wrap; gap: 0.25rem; font-size: 0.7rem; }
.tile-main { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; border: 0; background: none;
  padding: 0; text-align: left; color: inherit; flex: 1; min-height: 2.75rem; }
button.tile-main { cursor: pointer; }
button.tile-main:disabled { cursor: default; }
.tile-state { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.tile-name { max-width: 100%; font-size: 0.85rem; font-weight: 500; color: var(--app-text-2); line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blind-text { display: flex; flex-direction: column; min-width: 0; }
.tile-sub { font-size: 0.8rem; color: var(--app-text-2); }
.tile-range { margin: 0.25rem 0; }
.tile-buttons, .tile-setpoint { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.tile-buttons .btn, .tile-setpoint .btn { min-width: 2.75rem; min-height: 2.5rem; }
.tile-setpoint span { flex: 1; text-align: center; font-weight: 600; white-space: nowrap; font-size: 0.9rem; }
.tile-setpoint small { font-weight: 400; color: var(--app-text-2); margin-right: 0.2rem; }
.tile-error { font-size: 0.75rem; color: #b42318; }
.home-section + .home-section { margin-top: 1.5rem; }
.home-section h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }

/* History (Phase 4) */
.range-pills { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.25rem; }
.range-pills .btn { min-height: 2.25rem; }
.chart-box { position: relative; height: 16rem; }
.chart-box.chart-step { height: 8rem; }
@media (max-width: 576px) { .chart-box { height: 13rem; } }
.chart-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; }
.hist-links { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.hist-link { display: flex; align-items: center; gap: 0.6rem; padding: 0.65rem 0.8rem; border: 1px solid var(--app-border);
  border-radius: var(--app-radius); color: var(--app-text); text-decoration: none; min-height: 2.75rem; }
.hist-link:hover, .hist-link:focus-visible { border-color: var(--app-accent); color: var(--app-text); }
.tile-hist { flex: none; padding: 0.25rem; min-width: 2rem; min-height: 2rem; color: var(--app-text-3);
  display: inline-flex; align-items: center; justify-content: center; margin-top: -0.25rem; }
.tile-hist:hover { color: var(--app-accent); }

/* Automation (Phase 5) */
.fs-form { position: relative; border: 1px solid var(--app-border); border-radius: var(--app-radius); padding: 0.75rem; margin-bottom: 0.6rem; }
.fs-tools { display: flex; justify-content: flex-end; margin-bottom: 0.25rem; }
.fs-del { cursor: pointer; }
.day-checks { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.day-check { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.35rem 0.6rem; border: 1px solid var(--app-border); border-radius: 999px; cursor: pointer; min-height: 2.25rem; }
.day-check .form-check-input { margin: 0; }
.rule-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.rule-list { margin: 0; padding-left: 1.1rem; }
.rule-list li + li { margin-top: 0.35rem; }
.pre-line { white-space: pre-line; }
.scene-card { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.9rem 1rem; background: var(--app-surface);
  border: 1px solid var(--app-border); border-radius: var(--app-radius-lg); box-shadow: var(--app-shadow); min-height: 9rem; }
.scene-lines { margin: 0 0 0.5rem; padding-left: 1rem; font-size: 0.8rem; color: var(--app-text-2); }
.scene-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.scene-buttons .btn { min-height: 2.75rem; }

/* --- alerts (Phase 6) --- */
.alert-box { display: flex; flex-direction: column; gap: .4rem; }
.alert-line { display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem; border-radius: 10px;
  background: #fff8e6; color: inherit; text-decoration: none; border-left: 4px solid #e0a100; }
.alert-line.level-alarm { background: #fdecec; border-left-color: #d13438; }
.alert-line.level-alarm i { color: #d13438; }
.alert-line.level-info { background: #eef4ff; border-left-color: #2f6fde; }
.alert-level { display: inline-block; font-size: .72rem; font-weight: 600; padding: .05rem .45rem;
  border-radius: 999px; background: #fff3cd; color: #7a5600; margin-right: .3rem; }
.alert-level.level-alarm { background: #f8d7da; color: #8a1c22; }
.alert-level.level-info { background: #e7efff; color: #234f9e; }
.side-nav a .badge { font-size: .7rem; }

/* --- energy (Phase 8) --- */
.home-section .energy-grid + * { margin-top: 0; }
.energy-grid { margin-bottom: 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .6rem; }
.energy-card { display: flex; flex-direction: column; gap: .1rem; padding: .7rem .85rem; border-radius: 12px;
  background: var(--app-surface); color: inherit; text-decoration: none; box-shadow: 0 1px 2px rgba(0,0,0,.06);
  border-top: 3px solid #2f6fde; }
.energy-card.src-sungrow { border-top-color: #e0a100; }
.energy-card .label { font-size: .78rem; color: #6e6e73; }
.energy-card strong { font-size: 1.25rem; font-weight: 600; }
.energy-card .when { font-size: .72rem; color: #8e8e93; }
.price-facts { display: flex; flex-wrap: wrap; gap: .5rem 1.6rem; margin-bottom: .6rem; font-size: .9rem; }
.price-facts .label { display: block; font-size: .75rem; color: #6e6e73; }
.price-chart { height: 220px; }
.price-level { font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: #eee; }
.price-level.level-0 { background: #d7efe0; color: #1d5e3a; }
.price-level.level-1 { background: #e6f2d5; color: #46661c; }
.price-level.level-3 { background: #fde7cf; color: #8a4b05; }
.price-level.level-4 { background: #f8d7da; color: #8a1c22; }
.cheap-list li { padding: .15rem 0; }

/* --- cameras (Phase 9) --- */
.cam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: .8rem; }
.cam-grid-small { grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); }
.cam-card { display: flex; flex-direction: column; gap: .35rem; color: inherit; text-decoration: none; }
.cam-frame { position: relative; aspect-ratio: 16 / 9; background: #1c1c1e; border-radius: 12px;
  overflow: hidden; display: flex; align-items: center; justify-content: center; color: #8e8e93; }
.cam-frame img, .cam-frame video { width: 100%; height: 100%; object-fit: contain; display: block; }
.cam-name { font-weight: 500; font-size: .92rem; }
.cam-live { max-width: 64rem; }
.cam-paused, .cam-error { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .5rem; background: rgba(0,0,0,.6); color: #fff;
  text-align: center; padding: 1rem; }
.cam-paused.d-none, .cam-error.d-none { display: none !important; }
.cam-frame-live:fullscreen { border-radius: 0; }

/* Alarmanlage (Phase 7) */
.alarm-grid { margin-bottom: 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .6rem; }
.alarm-card { display: flex; flex-direction: column; gap: .6rem; padding: .8rem .9rem; border-radius: 12px;
  background: var(--app-surface); border-top: 3px solid #8e8e93; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.alarm-card .label { font-size: .78rem; color: #6e6e73; }
.alarm-card strong { font-size: 1.2rem; font-weight: 600; }
.alarm-card .when { font-size: .72rem; color: #8e8e93; }
.alarm-card.state-unset { border-top-color: #34a853; }
.alarm-card.state-unset i { color: #34a853; }
.alarm-card.state-set, .alarm-card.state-partset { border-top-color: #2f6fde; }
.alarm-card.state-set i, .alarm-card.state-partset i { color: #2f6fde; }
.alarm-card.state-set-alarm, .alarm-card.state-acknowledged { border-top-color: #d13438; background: #fdecec; }
.alarm-card.state-set-alarm i, .alarm-card.state-acknowledged i { color: #d13438; }
.alarm-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.alarm-actions form { display: flex; gap: .4rem; }
.alarm-disarm input { width: 6.5rem; }

/* Räume verwalten */
.room-card-muted { border-style: dashed; color: var(--app-text-secondary, #6e6e73); }
.room-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: .35rem .9rem;
  max-height: 60vh; overflow-y: auto; padding: .25rem; border: 1px solid rgba(0,0,0,.08); border-radius: 10px; }
.room-item { display: flex; gap: .55rem; align-items: flex-start; padding: .35rem .4rem; border-radius: 8px; cursor: pointer; }
.room-item:hover { background: rgba(0,0,0,.03); }
.room-item[hidden] { display: none; }
.room-item .form-check-input { margin-top: .2rem; flex: none; }
.area-head { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--app-text-2); margin: 1.25rem 0 0.5rem; }
.area-head:first-child { margin-top: 0; }
.door-count { font-size: 3rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.door-count small { font-size: 1.25rem; font-weight: 600; }
.door-progress { height: 0.5rem; }
.door-progress .progress-bar { transition: width 0.2s linear; }

/* Blind tile: window with shutter (height from Tile.shutter_height) */
.tile-main.blind-view { flex-direction: row; align-items: center; gap: 0.75rem; }
.blind-svg { flex: none; width: 3rem; height: 3.2rem; }
.blind-svg .bw-frame { fill: var(--app-surface); stroke: var(--app-text-2); stroke-width: 2; }
.blind-svg .bw-glass { fill: #d8ebf7; }
.blind-svg .bw-bar { stroke: var(--app-text-2); stroke-width: 1.5; fill: none; }
.blind-svg .bw-slat { fill: #9aa39d; }
.blind-svg .bw-gap { fill: #6f7972; }
.blind-svg .bw-rail { fill: var(--app-text); }
.blind-svg .bw-box { fill: var(--app-text-2); }
.ftile.is-on .blind-svg .bw-frame { fill: var(--app-surface); }

/* Own blind symbol (like a Bootstrap icon, drawn with a mask) */
.bi.fm-blind::before { content: ""; display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1 1h14v2.5H1zM2.5 4h11v1.6h-11zm0 2.4h11V8h-11zm0 2.4h11v1.6h-11zm0 2.4h11v1.6h-11zM2 14h12v1H2z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1 1h14v2.5H1zM2.5 4h11v1.6h-11zm0 2.4h11V8h-11zm0 2.4h11v1.6h-11zm0 2.4h11v1.6h-11zM2 14h12v1H2z'/%3E%3C/svg%3E") center / contain no-repeat; }

/* Symbol picker on the device page */
.icon-pick summary { cursor: pointer; color: var(--app-text-2); }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr)); gap: 0.35rem; border: 0; padding: 0; margin: 0; }
.icon-opt { position: relative; cursor: pointer; }
.icon-opt input { position: absolute; opacity: 0; pointer-events: none; }
.icon-opt span { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; padding: 0.4rem 0.25rem; border: 1px solid var(--app-border); border-radius: var(--app-radius); text-align: center; }
.icon-opt i { font-size: 1.25rem; }
.icon-opt small { font-size: 0.7rem; line-height: 1.15; color: var(--app-text-2); }
.icon-opt input:checked + span { border-color: var(--app-accent); background: var(--app-accent-soft); box-shadow: 0 0 0 1px var(--app-accent); }
.icon-opt input:focus-visible + span { outline: 2px solid var(--app-accent); outline-offset: 2px; }

/* View toggle and compact list (html[data-view=list], chosen per browser) */
.view-toggle .btn { min-height: 2.25rem; min-width: 2.5rem; }
.view-toggle [data-view-set="tiles"] { background: var(--app-accent-soft); }
html[data-view="list"] .view-toggle [data-view-set="tiles"] { background: none; }
html[data-view="list"] .view-toggle [data-view-set="list"] { background: var(--app-accent-soft); }
.tile-pill { display: none; }
html[data-view="list"] [data-tiles] { grid-template-columns: minmax(0, 1fr); gap: 0.4rem; }
html[data-view="list"] [data-tiles] .ftile { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto;
  align-items: center; column-gap: 0.75rem; row-gap: 0.2rem; min-height: 3.5rem; padding: 0.5rem 0.75rem; }
html[data-view="list"] [data-tiles] .tile-head { grid-column: 1; grid-row: 1; }
html[data-view="list"] [data-tiles] .tile-head > :not(.tile-icon) { display: none; }
html[data-view="list"] [data-tiles] .tile-icon { font-size: 1.35rem; height: auto; }
html[data-view="list"] [data-tiles] .tile-main { grid-column: 2; grid-row: 1; min-height: 2.5rem; justify-content: center; gap: 0; }
html[data-view="list"] [data-tiles] button.tile-main { grid-column: 2 / 4; position: relative; padding-right: 3.5rem; }
html[data-view="list"] [data-tiles] .tile-name { order: -1; font-size: 0.95rem; color: var(--app-text); }
html[data-view="list"] [data-tiles] .tile-state { font-size: 0.85rem; font-weight: 600; color: var(--app-text-2); }
html[data-view="list"] [data-tiles] .tile-sub { font-size: 0.75rem; }
html[data-view="list"] [data-tiles] .tile-flags, html[data-view="list"] [data-tiles] .tile-error { grid-column: 2 / 4; grid-row: 2; }
html[data-view="list"] [data-tiles] .tile-range,
html[data-view="list"] [data-tiles] .blind-svg,
html[data-view="list"] [data-tiles] .tile-thermostat .tile-buttons { display: none; }
html[data-view="list"] [data-tiles] .tile-buttons, html[data-view="list"] [data-tiles] .tile-setpoint { grid-column: 3; grid-row: 1; flex-wrap: nowrap; }
html[data-view="list"] [data-tiles] .tile-setpoint span { font-size: 0.85rem; }
html[data-view="list"] [data-tiles] .tile-pill { display: block; position: absolute; right: 0; top: 50%; width: 2.75rem; height: 1.6rem;
  margin-top: -0.8rem; border-radius: 999px; background: var(--app-border); transition: background .15s; }
html[data-view="list"] [data-tiles] .tile-pill::after { content: ""; position: absolute; left: 0.2rem; top: 0.2rem; width: 1.2rem; height: 1.2rem;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
html[data-view="list"] [data-tiles] .is-on .tile-pill { background: var(--app-accent); }
html[data-view="list"] [data-tiles] .is-on .tile-pill::after { left: 1.35rem; }
.area-head a { color: inherit; text-decoration: none; }
.area-head a:hover { color: var(--app-accent); }
html[data-view="list"] [data-tiles] .tile-main.blind-view { justify-content: flex-start; }
html[data-view="list"] [data-tiles] .tile-buttons { gap: 0.25rem; }
html[data-view="list"] [data-tiles] .tile-buttons .btn, html[data-view="list"] [data-tiles] .tile-setpoint .btn { min-width: 2.4rem; min-height: 2.4rem; padding: 0.25rem; }
.form-range::-webkit-slider-thumb { background: var(--app-accent); }
.form-range::-moz-range-thumb { background: var(--app-accent); }
.form-range:focus::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(var(--app-mark-rgb), 0.3); }
/* List view: windows and doors as a dot – green closed, red open */
.state-dot { display: none; }
html[data-view="list"] [data-tiles] .state-dot { display: block; grid-column: 3; grid-row: 1; justify-self: end; width: 0.9rem; height: 0.9rem;
  margin-right: 0.35rem; border-radius: 50%; }
html[data-view="list"] [data-tiles] .state-dot.closed { background: #2e9e4f; box-shadow: 0 0 0 3px rgba(46, 158, 79, 0.18); }
html[data-view="list"] [data-tiles] .state-dot.open { background: #d93a3a; box-shadow: 0 0 0 3px rgba(217, 58, 58, 0.2); }
html[data-view="list"] [data-tiles] .tile-zone .tile-sub { display: none; }
/* List view outside a room (favourites): room name small above the device name */
html[data-view="list"] [data-tiles]:not(.tiles-in-room) .tile-head { display: contents; }
html[data-view="list"] [data-tiles]:not(.tiles-in-room) .tile-icon { grid-column: 1; grid-row: 1 / span 2; }
html[data-view="list"] [data-tiles]:not(.tiles-in-room) .tile-head > .tile-room { display: block; grid-column: 2 / 4; grid-row: 1;
  padding: 0; text-align: left; font-size: 0.72rem; line-height: 1.1; color: var(--app-text-3); }
html[data-view="list"] [data-tiles]:not(.tiles-in-room) .tile-head > .tile-room:empty { display: none; }
html[data-view="list"] [data-tiles]:not(.tiles-in-room) .tile-main,
html[data-view="list"] [data-tiles]:not(.tiles-in-room) .tile-buttons,
html[data-view="list"] [data-tiles]:not(.tiles-in-room) .tile-setpoint,
html[data-view="list"] [data-tiles]:not(.tiles-in-room) .state-dot { grid-row: 2; }
html[data-view="list"] [data-tiles]:not(.tiles-in-room) .tile-flags,
html[data-view="list"] [data-tiles]:not(.tiles-in-room) .tile-error { grid-row: 3; }
html[data-view="list"] [data-tiles]:not(.tiles-in-room) .ftile { row-gap: 0; }

/* Own window and door symbols (masks, coloured like icon fonts); bi-window is redrawn – the
   Bootstrap glyph is a browser window */
.bi.bi-window::before { content: ""; display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 1.5h11v12h-11z' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M8 1.5v12M2.5 7.5h11' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M1 14.6h14' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 1.5h11v12h-11z' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M8 1.5v12M2.5 7.5h11' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M1 14.6h14' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.bi.fm-window-open::before { content: ""; display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 1.5h11v12h-11z' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M2.5 1.5l6 1.6v8.8l-6 1.6z' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M1 14.6h14' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 1.5h11v12h-11z' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M2.5 1.5l6 1.6v8.8l-6 1.6z' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M1 14.6h14' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.bi.fm-window-double::before { content: ""; display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 1.5h11v12h-11z' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M8 1.5v12' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M6.3 6.5v2M9.7 6.5v2' stroke-width='1.2' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M1 14.6h14' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 1.5h11v12h-11z' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M8 1.5v12' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M6.3 6.5v2M9.7 6.5v2' stroke-width='1.2' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M1 14.6h14' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.bi.fm-window-double-open::before { content: ""; display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 1.5h11v12h-11z' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M2.5 1.5l3.3 1.4v9.2l-3.3 1.4zM13.5 1.5l-3.3 1.4v9.2l3.3 1.4z' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M1 14.6h14' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 1.5h11v12h-11z' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M2.5 1.5l3.3 1.4v9.2l-3.3 1.4zM13.5 1.5l-3.3 1.4v9.2l3.3 1.4z' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M1 14.6h14' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.bi.fm-skylight::before { content: ""; display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 13.5l2.5-11h9l-2.5 11z' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M3.8 8h9M9.5 2.5l-2.5 11' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 13.5l2.5-11h9l-2.5 11z' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M3.8 8h9M9.5 2.5l-2.5 11' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.bi.fm-skylight-open::before { content: ""; display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 13.5l2.5-11h9l-2.5 11z' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M5 2.5l2.8-2h7.2l-1 2' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 13.5l2.5-11h9l-2.5 11z' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M5 2.5l2.8-2h7.2l-1 2' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.bi.fm-terrace-door::before { content: ""; display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 .8h9v14.4h-9z' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M8 .8v14.4M3.5 11h9' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M9.5 7v1.6' stroke-width='1.2' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 .8h9v14.4h-9z' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M8 .8v14.4M3.5 11h9' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M9.5 7v1.6' stroke-width='1.2' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.bi.fm-terrace-door-open::before { content: ""; display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 .8h9v14.4h-9z' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M8 .8v14.4' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M12.5 .8l-3 1.6v11.2l3 1.6z' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 .8h9v14.4h-9z' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M8 .8v14.4' stroke-width='1.1' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M12.5 .8l-3 1.6v11.2l3 1.6z' stroke-width='1.3' stroke='%23000' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
/* Windows and doors on the room cards: symbol with a dot – green closed, red open */
.room-openings { display: flex; flex-wrap: wrap; gap: 0.35rem 0.6rem; }
.opening { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 1.1rem; color: var(--app-text-2); }
.opening.is-open { color: var(--app-text); }
.room-openings .state-dot { display: block; width: 0.6rem; height: 0.6rem; border-radius: 50%; }
.state-dot.closed { background: #2e9e4f; }
.state-dot.open { background: #d93a3a; }
/* Weather on the overview */
.weather-strip { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1.25rem; padding: 0.8rem 1rem;
  background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow); color: var(--app-text); text-decoration: none; }
.weather-strip:hover { border-color: var(--app-accent); color: var(--app-text); }
.weather-icon { font-size: 2.2rem; line-height: 1; color: var(--tone-amber); }
.weather-temp { font-size: 1.8rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.weather-text { display: flex; flex-direction: column; min-width: 0; font-size: 0.9rem; }
.weather-sub { font-size: 0.78rem; color: var(--app-text-2); }
.zone-dot.state-dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%; margin-right: 0.4rem; vertical-align: 0.05rem; }
/* Scene buttons in their own colour */
.btn-scene { --scene-bg: #4f8a10; --scene-fg: #fff; background: var(--scene-bg); border-color: var(--scene-bg); color: var(--scene-fg);
  font-weight: 600; }
.btn-scene:hover, .btn-scene:focus-visible, .btn-scene:active { background: var(--scene-bg); border-color: var(--scene-bg); color: var(--scene-fg);
  filter: brightness(1.08); }
.btn-scene:disabled { background: var(--scene-bg); border-color: var(--scene-bg); color: var(--scene-fg); opacity: .55; }
.scene-c-green { --scene-bg: #4f8a10; } .scene-c-blue { --scene-bg: #2f74c0; } .scene-c-teal { --scene-bg: #158a7c; }
.scene-c-purple { --scene-bg: #7651c2; } .scene-c-amber { --scene-bg: #f0b400; --scene-fg: #1f1a05; }
.scene-c-orange { --scene-bg: #e0731a; } .scene-c-red { --scene-bg: #cf3f3f; } .scene-c-gray { --scene-bg: #5f6b66; }
.scene-icon { font-size: 1.25rem; }
.scene-t-green { color: #4f8a10; } .scene-t-blue { color: #2f74c0; } .scene-t-teal { color: #158a7c; } .scene-t-purple { color: #7651c2; }
.scene-t-amber { color: #d29e00; } .scene-t-orange { color: #e0731a; } .scene-t-red { color: #cf3f3f; } .scene-t-gray { color: #5f6b66; }
.color-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem; }
.color-opt { position: relative; cursor: pointer; }
.color-opt input { position: absolute; opacity: 0; pointer-events: none; }
.color-opt .btn { width: 100%; pointer-events: none; }
.color-opt input:checked + .btn { box-shadow: 0 0 0 2px var(--app-surface), 0 0 0 4px var(--app-text); }
.color-opt input:focus-visible + .btn { outline: 2px solid var(--app-accent); outline-offset: 3px; }
/* Lights and sockets on the room cards: own symbol, coloured when on, grey when off */
.room-switches { display: flex; flex-wrap: wrap; gap: 0.3rem 0.65rem; }
.room-switch { display: inline-flex; font-size: 1.2rem; line-height: 1; color: var(--app-text-3); opacity: 0.7; }
.room-switch.is-on { opacity: 1; }
.room-switch.tone-amber { color: var(--tone-amber); } .room-switch.tone-green { color: var(--tone-green); }
.room-switch.tone-blue { color: var(--tone-blue); } .room-switch.tone-red { color: var(--tone-red); }
.room-switch.tone-orange { color: var(--tone-orange); }
/* Symbols next to dots: drop Bootstrap's baseline shift so symbol and dot share the same middle */
.opening .bi, .room-switch .bi { display: inline-flex; line-height: 1; }
.opening .bi::before, .room-switch .bi::before { display: block; vertical-align: 0; }
/* List view: dot centred in the column of the switches (width 2.75rem) */
html[data-view="list"] [data-tiles] .state-dot { align-self: center; margin-right: calc((2.75rem - 0.9rem) / 2); }

/* Raumseite: Kameras und Schlösser oben nebeneinander, alle Kacheln gleich groß */
.room-media { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; }
.room-media > * { flex: 0 0 15rem; max-width: 100%; }
@media (max-width: 575.98px) { .room-media > * { flex-basis: 100%; } }
.room-media > .cam-card, .room-media > .alarm-card { min-height: 100%; padding: .6rem; border-radius: 12px;
  background: var(--app-surface); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.room-media > .cam-card { border-top: 3px solid #2f6fde; }
.room-media > .cam-card .cam-frame { border-radius: 8px; }
.room-media > .alarm-card { padding: .8rem .9rem; }
.room-media > .alarm-card .alarm-actions { margin-top: auto; }

/* Übersicht, Listenansicht: Bereiche der Alarmanlage als Zeile (Symbol, Name/Zustand, Knöpfe rechts) */
html[data-view="list"] .alarm-grid[data-listable] { grid-template-columns: minmax(0, 1fr); gap: 0.4rem; }
html[data-view="list"] .alarm-grid[data-listable] .alarm-card { flex-direction: row; flex-wrap: wrap; align-items: center;
  gap: 0.4rem 0.75rem; min-height: 3.5rem; padding: 0.5rem 0.75rem; border-top: 0; border-left: 3px solid #8e8e93; }
html[data-view="list"] .alarm-grid[data-listable] .alarm-card > .d-flex { flex: 1 1 12rem; align-items: center !important; gap: 0.75rem !important; }
html[data-view="list"] .alarm-grid[data-listable] .alarm-card > .d-flex > .bi { width: 2rem; text-align: center; font-size: 1.35rem !important; }
html[data-view="list"] .alarm-grid[data-listable] .alarm-card strong { font-size: 0.95rem; }
html[data-view="list"] .alarm-grid[data-listable] .alarm-card .label { font-size: 0.75rem; }
html[data-view="list"] .alarm-grid[data-listable] .alarm-card .when { display: none; }
html[data-view="list"] .alarm-grid[data-listable] .alarm-actions { margin-left: auto; justify-content: flex-end; }
html[data-view="list"] .alarm-grid[data-listable] .state-unset { border-left-color: #34a853; }
html[data-view="list"] .alarm-grid[data-listable] .state-set, html[data-view="list"] .alarm-grid[data-listable] .state-partset { border-left-color: #2f6fde; }
html[data-view="list"] .alarm-grid[data-listable] .state-set-alarm, html[data-view="list"] .alarm-grid[data-listable] .state-acknowledged { border-left-color: #d13438; }
