:root {
  --bg: #f3f1ec;
  --surface: #ffffff;
  --surface-2: #eae6dc;
  --ink: #1e2422;
  --muted: #5e6864;
  --border: #dad5c8;
  --accent: #1f6f6b;
  --accent-ink: #f3f1ec;
  --ok: #2f8f5b;
  --ok-bg: #e4f0e7;
  --warn: #a3701a;
  --warn-bg: #f4ead2;
  --alarm: #b23a34;
  --alarm-bg: #f5e2df;
  --shadow: 0 1px 2px rgba(30, 36, 34, 0.06), 0 6px 20px -8px rgba(30, 36, 34, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12181a;
    --surface: #1b2324;
    --surface-2: #222b2c;
    --ink: #e7eeec;
    --muted: #8fa09c;
    --border: #2c3738;
    --accent: #4fb3ac;
    --accent-ink: #0e1516;
    --ok: #4cae7d;
    --ok-bg: #17281f;
    --warn: #d9a23e;
    --warn-bg: #2c2412;
    --alarm: #e2665f;
    --alarm-bg: #2c1918;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -10px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; color: inherit; }
.brand .mark {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700;
}
.brand .name { font-size: 1.02rem; font-weight: 650; letter-spacing: -0.01em; }
.brand .sub { font-size: 0.72rem; color: var(--muted); }

main { max-width: 1080px; margin: 0 auto; padding: 1.75rem 1.5rem 4rem; }
/* Die Zentralen-Ansicht braucht mehr Breite, weil die Seitenleiste eine Spalte belegt. */
main.wide { max-width: 1300px; }

.eyebrow {
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); font-weight: 650; margin: 0 0 0.3rem;
}
h1 { font-size: 1.5rem; margin: 0 0 0.15rem; letter-spacing: -0.015em; text-wrap: balance; }
.lede { color: var(--muted); font-size: 0.92rem; margin: 0 0 1.5rem; }

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem;
}
.hub-card { cursor: pointer; transition: transform 0.12s ease, border-color 0.12s ease; text-decoration: none; color: inherit; display: block; }
.hub-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.hub-card .row1 { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.hub-name { font-weight: 650; font-size: 1rem; letter-spacing: -0.01em; }
.hub-loc { color: var(--muted); font-size: 0.8rem; margin-top: 0.15rem; }
.role {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 0.18rem 0.45rem; border-radius: 5px;
  background: var(--surface-2); color: var(--muted);
}
.role.master { background: var(--accent); color: var(--accent-ink); }

.demo-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  background: var(--warn-bg);
  color: var(--warn);
  vertical-align: middle;
  margin-left: 0.3rem;
}
.hub-card.demo-card { border-style: dashed; }

.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.72rem; font-weight: 650; padding: 0.24rem 0.55rem 0.24rem 0.45rem;
  border-radius: 999px;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.ok .dot { background: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.warn .dot { background: var(--warn); }
.pill.alarm { background: var(--alarm-bg); color: var(--alarm); }
.pill.alarm .dot { background: var(--alarm); }
.pill.neutral { background: var(--surface-2); color: var(--muted); }
.pill.neutral .dot { background: var(--muted); }

.hub-stats {
  display: flex; gap: 1.1rem; margin-top: 0.9rem; padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}
.stat .n { font-size: 0.98rem; font-weight: 650; }
.stat .l { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.hub-meta { margin-top: 0.7rem; font-size: 0.72rem; color: var(--muted); }

.back {
  background: none; border: none; color: var(--muted); font-size: 0.82rem;
  cursor: pointer; padding: 0; margin-bottom: 0.6rem; display: inline-flex; align-items: center; gap: 0.3rem;
  text-decoration: none;
}
.back:hover { color: var(--ink); }

.detail-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem;
  margin-bottom: 1.4rem; flex-wrap: wrap;
}

.group-strip { display: flex; gap: 0.7rem; overflow-x: auto; padding-bottom: 0.3rem; margin-bottom: 1.6rem; }
.group-card {
  flex: 0 0 auto; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 0.85rem 0.95rem; box-shadow: var(--shadow);
}
.group-card .gname { font-weight: 600; font-size: 0.88rem; margin-bottom: 0.4rem; }

.rooms { display: flex; flex-direction: column; gap: 1rem; }
.room-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.room-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.room-head .rname { font-weight: 650; font-size: 0.92rem; }
.room-head .rcount { font-size: 0.74rem; color: var(--muted); }
.device-list { display: flex; flex-direction: column; }
.device-row {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.65rem 1.1rem; border-bottom: 1px solid var(--border);
}
.device-row:last-child { border-bottom: none; }
.dev-badge {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
  background: var(--surface-2); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 700;
}
.dev-info { flex: 1; min-width: 0; }
.dev-name { font-size: 0.86rem; font-weight: 550; }
.dev-type { font-size: 0.74rem; color: var(--muted); }
.dev-right { display: flex; align-items: center; gap: 0.7rem; flex: 0 0 auto; }
.signal { display: flex; align-items: center; gap: 2px; }
.signal i { display: block; width: 3px; border-radius: 1px; background: var(--border); }
.signal i.on { background: var(--muted); }
.signal i:nth-child(1) { height: 5px; } .signal i:nth-child(2) { height: 8px; }
.signal i:nth-child(3) { height: 11px; } .signal i:nth-child(4) { height: 14px; }
.battery { font-size: 0.72rem; color: var(--muted); }
.battery.low { color: var(--warn); font-weight: 650; }
.id-tag { font-size: 0.68rem; color: var(--muted); opacity: 0.8; }

.btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface);
  color: var(--ink); padding: 0.42rem 0.8rem; border-radius: 8px;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { background: var(--alarm-bg); color: var(--alarm); border-color: transparent; }
.btn.small { padding: 0.28rem 0.6rem; font-size: 0.72rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }

.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.confirm-strip {
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--warn-bg); color: var(--warn);
  border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.78rem; font-weight: 600;
}
.confirm-strip .btn { font-size: 0.72rem; padding: 0.28rem 0.6rem; }

.actions-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.7rem; }

.group-card .actions { display: flex; gap: 0.4rem; margin-top: 0.7rem; }

.dev-edit-toggle {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0.4rem; border-radius: 6px;
}
.dev-edit-toggle:hover { color: var(--accent); background: var(--surface-2); }

.device-row.editing { flex-direction: column; align-items: stretch; gap: 0.5rem; background: var(--surface-2); }
.edit-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.edit-form input, .edit-form select {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  border-radius: 6px; padding: 0.35rem 0.5rem; font-size: 0.8rem; font-family: inherit;
}
.edit-form input[type="text"] { flex: 1; min-width: 140px; }

.dialog-backdrop {
  position: fixed; inset: 0; background: rgba(10, 14, 13, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 20;
}
.dialog {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 1.2rem 1.3rem; width: 100%; max-width: 380px;
}
.dialog h2 { font-size: 1rem; margin: 0 0 0.9rem; }
.dialog .field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.8rem; }
.dialog .field label { font-size: 0.74rem; color: var(--muted); font-weight: 600; }
.dialog .field input, .dialog .field select {
  border: 1px solid var(--border); background: var(--bg); color: var(--ink);
  border-radius: 8px; padding: 0.5rem 0.6rem; font-size: 0.86rem; font-family: inherit;
}
.dialog .field .hint { font-size: 0.7rem; color: var(--muted); }
.dialog .field-row { display: flex; gap: 0.5rem; }
.dialog .field-row input { flex: 1; }
.dialog .scan-box {
  position: relative; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); background: #000;
}
.dialog .scan-box video { width: 100%; max-height: 220px; object-fit: cover; display: block; }
.dialog .scan-box .btn { position: absolute; bottom: 0.5rem; right: 0.5rem; }
.dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }

.event-list { display: flex; flex-direction: column; }
.event-row {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.6rem 1.1rem; border-bottom: 1px solid var(--border);
}
.event-row:last-child { border-bottom: none; }
.event-time { flex: 0 0 auto; width: 120px; font-size: 0.74rem; color: var(--muted); }
.event-body { flex: 1; min-width: 0; }
.event-desc { font-size: 0.86rem; }
.event-source { font-size: 0.74rem; color: var(--muted); }
.event-empty { padding: 1rem 1.1rem; color: var(--muted); font-size: 0.86rem; }

/* Aufnahmen von Meldern mit eingebauter Kamera */
.event-row.has-photos { align-items: flex-start; }
.photo-badge {
  display: inline-block; margin-left: 0.4rem;
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.03em;
  padding: 0.14rem 0.4rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); vertical-align: middle;
}
.event-photos { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.45rem; }
.event-photo {
  padding: 0; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); cursor: zoom-in; overflow: hidden; line-height: 0;
}
.event-photo:hover { border-color: var(--accent); }
.event-photo img { width: 128px; height: 72px; object-fit: cover; display: block; }
.event-photo.failed { cursor: default; border-style: dashed; }
.event-photo.failed img { display: none; }
.event-photo.failed::after {
  content: 'nicht mehr abrufbar';
  display: flex; align-items: center; justify-content: center;
  width: 128px; height: 72px; font-size: 0.62rem; color: var(--muted); line-height: 1.3; text-align: center; padding: 0 0.3rem;
}
.event-photos-note { flex-basis: 100%; font-size: 0.7rem; color: var(--muted); }

.photo-viewer {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(8, 12, 11, 0.88);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.photo-viewer-inner { max-width: min(1100px, 96vw); display: flex; flex-direction: column; gap: 0.6rem; }
.photo-viewer img {
  max-width: 100%; max-height: 82vh; object-fit: contain;
  border-radius: 12px; background: #000;
}
.photo-viewer-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  color: var(--bg); font-size: 0.8rem;
}
@media (prefers-color-scheme: dark) { .photo-viewer-bar { color: var(--ink); } }
.load-more-row { display: flex; justify-content: center; padding: 1rem 0; }

/* Registerkarten-Leiste (Verwaltung, Konto). Bewusst kantig statt rund —
   runde Marken lesen sich wie Schlagworte, nicht wie eine Navigation. */
.cat-nav {
  display: flex; gap: 1.4rem; flex-wrap: wrap;
  margin-top: 1.3rem; margin-bottom: 1.6rem; border-bottom: 1px solid var(--border);
}
.cat-btn {
  appearance: none; border: none; background: none; color: var(--muted);
  padding: 0.5rem 0; font-size: 0.86rem; font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.cat-btn:hover { color: var(--ink); }
.cat-btn.active { color: var(--ink); border-bottom-color: var(--accent); }

/* ── Zentralen-Ansicht: Schaltgruppe oben rechts ──────────────────── */
.arm-switch {
  display: inline-flex; border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; background: var(--surface);
}
.arm-switch button {
  appearance: none; border: none; border-right: 1px solid var(--border); background: none;
  color: var(--ink); font: inherit; font-size: 0.78rem; font-weight: 600;
  padding: 0.42rem 0.8rem; cursor: pointer; white-space: nowrap;
}
.arm-switch button:last-child { border-right: none; }
.arm-switch button:hover:not(:disabled) { background: var(--surface-2); }
.arm-switch button:disabled { opacity: 0.5; cursor: default; }
/* Der aktuelle Zustand wird in derselben Farbe markiert wie die Zustandsmarke daneben. */
.arm-switch button.now-ok { background: var(--ok-bg); color: var(--ok); }
.arm-switch button.now-alarm { background: var(--alarm-bg); color: var(--alarm); }
.arm-switch button.now-warn { background: var(--warn-bg); color: var(--warn); }
.arm-switch button.arm-on:hover:not(:disabled) { background: var(--alarm-bg); color: var(--alarm); }

.detail-head .head-actions {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; justify-content: flex-end;
}

/* ── Zentralen-Ansicht: Seitenleiste ──────────────────────────────── */
.hub-layout { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 1.9rem; }
/* Die Spalte wird vom Grid auf volle Höhe gestreckt (durchgehende Trennlinie),
   die Liste darin bleibt beim Scrollen oben stehen. Dafür braucht der Kasten
   um das klebende Element echte Höhe — sonst hat es keinen Spielraum. */
.side-nav {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border); padding-right: 1rem;
}
.side-nav-list { flex: 1; }
.side-nav-inner { position: sticky; top: 1.2rem; }
.side-group + .side-group { margin-top: 1.1rem; }
.side-group-title {
  display: block; font-size: 0.64rem; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-bottom: 0.35rem;
}
.side-link {
  appearance: none; border: none; background: none; font: inherit;
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 0.32rem 0.6rem; border-radius: 7px;
  font-size: 0.84rem; color: var(--muted);
}
.side-link:hover { background: var(--surface-2); color: var(--ink); }
.side-link.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.side-nav-toggle { display: none; }

/* Auf schmalen Anzeigen klappt die Leiste zu einem Menü zusammen. */
@media (max-width: 860px) {
  .hub-layout { grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
  .side-nav { border-right: none; padding-right: 0; }
  .side-nav-inner { position: static; }
  .side-nav-toggle {
    display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
    width: 100%; appearance: none; font: inherit; font-size: 0.84rem; font-weight: 600;
    background: var(--surface); color: var(--ink); cursor: pointer;
    border: 1px solid var(--border); border-radius: 10px; padding: 0.55rem 0.8rem;
  }
  .side-nav-toggle .chev { color: var(--muted); font-size: 0.7rem; }
  .side-nav[data-open="false"] .side-nav-list { display: none; }
  .side-nav-list {
    margin-top: 0.6rem; padding: 0.7rem 0.8rem;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  }
}

.section-block { margin-bottom: 1.6rem; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.6rem; }
.section-title h3 { font-size: 0.95rem; margin: 0; }

.kv-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  padding: 0.65rem 1.1rem; border-bottom: 1px solid var(--border);
}
.kv-row:last-child { border-bottom: none; }
.kv-main { flex: 1; min-width: 0; font-size: 0.86rem; }
.kv-sub { font-size: 0.74rem; color: var(--muted); margin-top: 0.15rem; }

.inline-form { display: flex; gap: 0.7rem; align-items: flex-end; flex-wrap: wrap; padding: 0.9rem 1.1rem; }
.inline-form .field { display: flex; flex-direction: column; gap: 0.25rem; }
.inline-form .field label { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.inline-form select, .inline-form input {
  border: 1px solid var(--border); background: var(--bg); color: var(--ink);
  border-radius: 8px; padding: 0.4rem 0.55rem; font-size: 0.82rem; font-family: inherit;
}

.hint { font-size: 0.72rem; color: var(--muted); }

.sparkline { display: block; margin: 0.3rem 0 0.2rem; }

.camera-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.camera-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; box-shadow: var(--shadow);
}
.camera-preview {
  aspect-ratio: 16 / 9; position: relative; overflow: hidden;
  background: repeating-linear-gradient(135deg, #1a1f1e 0 2px, #14181a 2px 4px);
}
.camera-preview::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(79, 179, 172, 0.18), transparent 60%);
}
.camera-preview .cam-live {
  position: absolute; top: 0.5rem; left: 0.6rem; display: flex; align-items: center; gap: 0.3rem;
  font-size: 0.64rem; font-weight: 700; color: var(--alarm); text-transform: uppercase; letter-spacing: 0.05em;
}
.camera-preview .cam-live .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--alarm); animation: cam-pulse 1.6s infinite; }
@media (prefers-reduced-motion: reduce) { .camera-preview .cam-live .dot { animation: none; } }
@keyframes cam-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.camera-preview .cam-label {
  position: absolute; bottom: 0.5rem; left: 0.6rem; font-size: 0.66rem; color: var(--muted);
  background: rgba(0, 0, 0, 0.4); padding: 0.15rem 0.4rem; border-radius: 4px; letter-spacing: 0.04em;
}
.camera-body { padding: 0.75rem 0.9rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.camera-body-stacked { flex-direction: column; align-items: stretch; gap: 0.4rem; }

/* ── Zeitplan-Kalender (planner.js) ─────────────────────────────── */

.planner-host { --hpx: 30px; --axis-w: 56px; --grid-hour: var(--border); --grid-half: var(--surface-2); }
@media (prefers-color-scheme: dark) { .planner-host { --grid-half: #232c2d; } }

.planner-toolbar-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.planner-toolbar-spacer { flex: 1; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 2px; gap: 2px; }
.seg-btn {
  appearance: none; border: none; background: none; color: var(--muted);
  font: inherit; font-size: 0.78rem; font-weight: 650;
  padding: 0.3rem 0.8rem; border-radius: 7px; cursor: pointer;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.planner-frame {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
}
.planner-scroll { max-height: 58vh; overflow: auto; overscroll-behavior: contain; }
.planner-inner { display: grid; grid-template-columns: var(--axis-w) repeat(var(--cols), minmax(84px, 1fr)); }

.planner-inner .col-head {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface-2); border-bottom: 1px solid var(--border); border-left: 1px solid var(--border);
  padding: 0.45rem 0.35rem; text-align: center; font-size: 0.76rem; font-weight: 650;
  display: flex; flex-direction: column; align-items: center; gap: 0.1rem;
}
.planner-inner .col-head.corner { border-left: none; z-index: 4; left: 0; position: sticky; }
.planner-inner .col-head .sub { font-size: 0.62rem; font-weight: 600; color: var(--muted); }
.planner-inner .col-head.holiday { background: var(--warn-bg); color: var(--warn); }
.planner-inner .col-head.holiday .sub { color: var(--warn); opacity: 0.8; }

.planner-inner .timeaxis {
  position: sticky; left: 0; z-index: 2; background: var(--surface);
  border-right: 1px solid var(--border); height: calc(24 * var(--hpx));
}
.planner-inner .timeaxis span {
  position: absolute; right: 0.4rem; font-size: 0.64rem; color: var(--muted);
  font-variant-numeric: tabular-nums; transform: translateY(-50%);
}

.planner-inner .daycol {
  position: relative; height: calc(24 * var(--hpx));
  border-left: 1px solid var(--border); touch-action: none; cursor: crosshair;
  background-image:
    repeating-linear-gradient(to bottom, transparent 0 calc(var(--hpx) / 2 - 1px),
      var(--grid-half) calc(var(--hpx) / 2 - 1px) calc(var(--hpx) / 2)),
    repeating-linear-gradient(to bottom, var(--grid-hour) 0 1px, transparent 1px var(--hpx));
}
.planner-inner .daycol.weekend { background-color: rgba(31, 111, 107, 0.05); }
.planner-inner .daycol.locked { cursor: not-allowed; opacity: 0.6; }
.planner-inner .daycol.locked::after {
  content: '🔒 wie Sonntag'; position: absolute; inset-inline: 0; top: 0.4rem;
  text-align: center; font-size: 0.6rem; color: var(--muted); pointer-events: none;
}

.planner-inner .block {
  position: absolute; left: 3px; right: 3px;
  background: var(--alarm-bg); border: 1px solid var(--alarm); border-left: 3px solid var(--alarm);
  border-radius: 6px; cursor: grab; overflow: hidden; user-select: none;
  display: flex; flex-direction: column; justify-content: center; padding: 0.1rem 0.28rem;
}
.planner-inner .block.selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.planner-inner .block.dragging { cursor: grabbing; z-index: 5; }
.planner-inner .block .btime {
  font-size: 0.66rem; font-weight: 650; color: var(--alarm);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.planner-inner .block .bmeta { font-size: 0.6rem; color: var(--muted); white-space: nowrap; }
.planner-inner .block.tiny .bmeta { display: none; }
.planner-inner .block.tiny .btime { font-size: 0.58rem; }
.planner-inner .block .handle { position: absolute; left: 0; right: 0; height: 7px; cursor: ns-resize; }
.planner-inner .block .handle.top { top: -1px; }
.planner-inner .block .handle.bottom { bottom: -1px; }
.planner-inner .block .handle:hover { background: var(--alarm); opacity: 0.35; }
.planner-inner .block .del {
  position: absolute; top: 2px; right: 2px; width: 15px; height: 15px;
  border: none; border-radius: 4px; background: var(--alarm); color: #fff;
  font-size: 0.68rem; line-height: 1; cursor: pointer; padding: 0;
  display: none; align-items: center; justify-content: center;
}
.planner-inner .block.selected .del { display: flex; }

.planner-tip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--ink); color: var(--bg);
  font-size: 0.7rem; font-weight: 650; font-variant-numeric: tabular-nums;
  padding: 0.24rem 0.5rem; border-radius: 6px; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.planner-tip .copy { color: var(--ok); }
body.planner-copying, body.planner-copying * { cursor: copy !important; }

.planner-preview { margin-top: 1rem; }
.planner-preview-head { font-size: 0.8rem; font-weight: 650; margin-bottom: 0.5rem; }
.planner-preview-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.45rem; }
.planner-preview-body .sw-row {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; padding: 0.42rem 0.65rem; font-size: 0.76rem;
}
.planner-preview-body .sw-row .t { font-variant-numeric: tabular-nums; }
.planner-preview-body .sw-row .on { color: var(--alarm); font-weight: 650; }
.planner-preview-body .sw-row .off { color: var(--ok); font-weight: 650; }
.planner-preview-body .sw-row .arrow { color: var(--muted); }
.planner-empty { color: var(--muted); font-size: 0.8rem; margin: 0; }

.dirty-badge {
  display: inline-block; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 0.16rem 0.45rem; border-radius: 999px;
  background: var(--warn-bg); color: var(--warn); vertical-align: middle;
}

/* Formularfeld auch außerhalb von Dialogen. Die spezifischere Regel
   „.dialog .field“ weiter oben bleibt davon unberührt. */
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field > label { font-size: 0.74rem; color: var(--muted); font-weight: 600; }
.field > input, .field > select {
  border: 1px solid var(--border); background: var(--bg); color: var(--ink);
  border-radius: 8px; padding: 0.5rem 0.6rem; font-size: 0.86rem; font-family: inherit;
}
.field > input:focus, .field > select:focus { outline: none; border-color: var(--accent); }

.check-list { display: flex; flex-direction: column; gap: 0.3rem; max-height: 220px; overflow-y: auto; }
.check-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.84rem; cursor: pointer; }
.check-row input { margin: 0; }

.btn.danger:hover { border-color: var(--alarm); }

.date-input {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: 0.26rem 0.5rem; font-size: 0.78rem;
  font-family: inherit; font-variant-numeric: tabular-nums;
}
.date-input:hover { border-color: var(--accent); }

.state-note {
  font-size: 0.78rem; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.9rem; margin-bottom: 1.4rem;
}
.state-note.error { color: var(--alarm); background: var(--alarm-bg); border-color: transparent; }

footer.note {
  max-width: 1080px; margin: 2rem auto 0; padding: 1rem 1.5rem;
  color: var(--muted); font-size: 0.78rem; border-top: 1px solid var(--border);
}
