/* ============================================================
   style.css – Haussteuerung Dark Mode PWA
   Design: Deep Space Dark, Akzent Indigo-Violett (#6c63ff)
   Mobile-first, großzügige Touch-Targets
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
    --bg:           #0f1117;
    --bg-card:      #1a1d27;
    --bg-elevated:  #22263a;
    --border:       #2a2e42;
    --accent:       #6c63ff;
    --accent-glow:  rgba(108, 99, 255, 0.25);
    --accent-dim:   rgba(108, 99, 255, 0.12);
    --on:           #4ade80;   /* aktiv / eingeschaltet */
    --on-glow:      rgba(74, 222, 128, 0.18);
    --text:         #e8e9f0;
    --text-dim:     #8b8fa8;
    --danger:       #f87171;
    --radius:       16px;
    --radius-sm:    10px;
    --shadow:       0 4px 24px rgba(0,0,0,0.4);
    --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

/* ── Header ─────────────────────────────────────────────── */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    padding-top: max(16px, env(safe-area-inset-top));
    background: rgba(15,17,23,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}

.avatar-initials {
    background: var(--accent);
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon {
    color: var(--text-dim);
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 6px;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
    background: none;
    border: none;
    cursor: pointer;
}
.btn-icon:hover { color: var(--text); background: var(--bg-elevated); }

/* ── Filterleiste ───────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: 8px;
    padding: 14px 20px;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border);
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-btn {
    flex-shrink: 0;
    padding: 7px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
}
.filter-btn:hover  { border-color: var(--accent); color: var(--text); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

/* Zweite Filterleiste für Räume – etwas dezenter */
.filter-bar-raum {
    padding-top: 10px;
    padding-bottom: 10px;
}
.filter-bar-raum .raum-btn {
    font-size: 0.82rem;
}
.filter-bar-raum .raum-btn.active {
    background: var(--bg-elevated);
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Hauptbereich ───────────────────────────────────────── */
.main-content {
    padding: 20px;
    position: relative;
    min-height: 60vh;
}

/* ── Geräte-Grid ────────────────────────────────────────── */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

/* ── Geräte-Karte ───────────────────────────────────────── */
.device-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.device-card:active { transform: scale(0.97); }

.device-card.on {
    border-color: var(--on);
    box-shadow: 0 0 0 1px var(--on), 0 4px 20px var(--on-glow);
    background: linear-gradient(145deg, var(--bg-card) 60%, rgba(74,222,128,0.06));
}

.device-card .card-icon {
    position: absolute;
    top: -12px;
    right: -8px;
    font-size: 3.4rem;
    line-height: 1;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

/* Titel/Ort/Badges über das Wasserzeichen-Icon legen */
.card-top > div:not(.card-icon) {
    position: relative;
    z-index: 1;
}

/* Aktions-Buttons rechts oben über dem Wasserzeichen halten */
.card-delete, .card-edit, .card-share, .card-shared-badge {
    z-index: 2;
}

.device-card .card-name {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
}

.device-card .card-room {
    font-size: 0.78rem;
    color: var(--text-dim);
}

.device-card .card-wert {
    font-size: 0.82rem;
    color: var(--accent);
    font-weight: 600;
}

.device-card .card-toggle {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Toggle-Switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 26px;
    flex-shrink: 0;
}
.toggle-switch input { display: none; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-elevated);
    border-radius: 999px;
    transition: background 0.2s;
    border: 1px solid var(--border);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: var(--text-dim);
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.2s, background 0.2s;
}
input:checked + .toggle-slider { background: var(--on); border-color: var(--on); }
input:checked + .toggle-slider::before { transform: translateX(18px); background: white; }

/* Löschen-Button auf Karte */
.card-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    font-size: 0.85rem;
}
.device-card:hover .card-delete { opacity: 1; }
.card-delete:hover { color: var(--danger); }

.card-edit {
    position: absolute;
    top: 10px;
    right: 34px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    font-size: 0.85rem;
}
.device-card:hover .card-edit { opacity: 1; }
.card-edit:hover { color: var(--accent); }

/* Auf Touch-Geräten Buttons dauerhaft zeigen (kein Hover vorhanden) */
@media (hover: none) {
    .card-delete, .card-edit { opacity: 0.5; }
}

/* ── FAB (Floating Action Button) ───────────────────────── */
.fab {
    position: fixed;
    bottom: 28px;
    right: 24px;
    bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s;
    z-index: 50;
}
.fab:hover  { transform: scale(1.08); box-shadow: 0 6px 28px var(--accent-glow); }
.fab:active { transform: scale(0.95); }

/* ── Log-Sektion ─────────────────────────────────────────── */
.log-section {
    padding: 0 20px 40px;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.log-list { display: flex; flex-direction: column; gap: 6px; }

.log-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
}

.log-entry .log-time { color: var(--text-dim); font-size: 0.75rem; min-width: 80px; }
.log-entry .log-user { color: var(--accent); font-weight: 600; }
.log-entry .log-action { color: var(--text-dim); flex: 1; }

/* ── Loading Spinner ─────────────────────────────────────── */
.loading-spinner {
    grid-column: 1/-1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-dim);
}
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.12s;
}
.btn:active { transform: scale(0.97); }
.btn-full   { width: 100%; }

.btn-primary   { background: var(--accent); color: white; }
.btn-primary:hover { opacity: 0.88; }
.btn-secondary { background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger    { background: var(--danger); color: white; }

.btn-google {
    background: white;
    color: #1f1f1f;
    font-weight: 600;
    border: 1px solid #e0e0e0;
}
.btn-google:hover { background: #f5f5f5; }

/* ── Modals ──────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
/* Mobil: Modal oben andocken + das BACKDROP scrollt (zuverlässig auf iOS).
   Das Modal nimmt seine natürliche Höhe ein, kein internes Scrollen. */
@media (max-width: 600px) {
    .modal-backdrop {
        align-items: flex-start;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: calc(env(safe-area-inset-top) + 48px) 0 calc(env(safe-area-inset-bottom) + 24px);
        scrollbar-width: none;
    }
    .modal-backdrop::-webkit-scrollbar { display: none; }
    /* Login-Karte auf dem Handy oben verankern statt vertikal zentrieren,
       damit sie nicht hinter die Browser-/Statusleiste rutscht. */
    body.login-page {
        align-items: flex-start;
        padding-top: clamp(28px, 7vh, 72px);
    }
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 28px 24px 32px;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* Größenverstellbar per Anfasser unten rechts */
    resize: both;
    overflow: auto;
    min-width: 300px;
    max-height: 92vh;
    position: relative;
}
@media (min-width: 500px) {
    .modal {
        border-radius: var(--radius);
        /* Größere Standard-Breite, breiter ziehbar */
        width: 560px;
        max-width: min(96vw, 1200px);
    }
}
/* Resize-Anfasser sichtbar machen */
.modal::-webkit-resizer {
    border-color: transparent var(--accent) transparent transparent;
}
.modal::after {
    content: "⤡";
    position: absolute;
    bottom: 4px;
    right: 6px;
    color: var(--text-dim);
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0.45;
}

.modal h3 { font-size: 1.1rem; font-weight: 700; }

.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions .btn { flex: 1; }

/* ── Formulare ───────────────────────────────────────────── */
label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
}
label small { font-weight: 400; }

input[type="text"],
input[type="email"],
input[type="password"],
select {
    padding: 12px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.15s;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-dim); }
select option { background: var(--bg-card); }

/* ── Login-Seite ─────────────────────────────────────────── */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px;
    background: radial-gradient(ellipse at 50% 0%, rgba(108,99,255,0.15) 0%, var(--bg) 65%);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: var(--shadow);
}

.login-logo { display: flex; justify-content: center; }

.login-card h1 {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}
.login-sub { text-align: center; color: var(--text-dim); font-size: 0.9rem; }

.tab-bar {
    display: flex;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 4px;
    gap: 4px;
}
.tab-btn {
    flex: 1;
    padding: 9px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
}
.tab-btn.active { background: var(--bg-card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.3); }

.tab-content { display: none; flex-direction: column; gap: 14px; }
.tab-content.active { display: flex; }

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-dim);
    font-size: 0.8rem;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
}
.alert-error { background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.3); color: var(--danger); }

/* ── Hilfsstil ───────────────────────────────────────────── */
.muted { color: var(--text-dim); font-size: 0.875rem; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 400px) {
    .device-grid { grid-template-columns: repeat(2, 1fr); }
    .main-content { padding: 16px; }
}

@media (min-width: 700px) {
    .device-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

/* ── Shelly-Karte ────────────────────────────────────────────── */
.shelly-card { cursor: default; }
.shelly-card .card-top { cursor: pointer; }

/* Klima-Karten (SmartThings) – nutzen dieselben Badges wie Shelly */
.klima-card .card-top { cursor: pointer; }
.klima-card.on { border-color: rgba(56,189,248,0.5); }
.klima-card .badge-watt {
    background: rgba(56,189,248,0.12);
    color: #38bdf8;
    border: 1px solid rgba(56,189,248,0.4);
}

.shelly-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.badge-online  { background: var(--on-glow);         color: var(--on);     border: 1px solid var(--on); }
.badge-offline { background: rgba(248,113,113,0.12); color: var(--danger); border: 1px solid rgba(248,113,113,0.3); }
.badge-watt    { background: var(--accent-dim);       color: var(--accent); border: 1px solid var(--accent); }
.badge-temp    { background: rgba(251,146,60,0.13);   color: #fb923c;       border: 1px solid rgba(251,146,60,0.4); }
.badge-verbindung { background: rgba(255,255,255,0.05); color: var(--text-dim); border: 1px solid var(--border); font-size: 0.68rem; }

/* Mini Sparkline auf Karte */
.shelly-mini-chart {
    cursor: pointer;
    padding: 6px 0 2px;
    position: relative;
    border-top: 1px solid var(--border);
}
.shelly-mini-chart svg { display: block; }
.mini-chart-hint {
    position: absolute;
    top: 8px;
    right: 0;
    font-size: 0.68rem;
    color: var(--text-dim);
}
.shelly-mini-chart:hover .mini-chart-hint { color: var(--accent); }

/* Card-Top clickable area */
.card-top {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    position: relative;
}

/* ── Chart-Modal ────────────────────────────────────────────── */
/* ── Gemeinsame Größe für große Modals (Shelly-Diagramm + Klima) ──
   Beide Modals teilen sich diese Klasse, damit sie IMMER gleich groß
   sind und sich gleich verhalten. Änderungen hier wirken auf beide. */
.modal-gross {
    width: 1024px;
    height: 1024px;
    max-width: min(96vw, 1400px);
    max-height: 92vh;
}

.modal-chart {
    padding: 24px 20px 28px;
}
.chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.chart-header h3 { font-size: 1.1rem; }

.chart-range-bar { display: flex; gap: 6px; }
.range-btn {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.15s;
}
.range-btn:hover  { border-color: var(--accent); color: var(--text); }
.range-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

/* Live-Statistiken */
.shelly-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
@media (max-width: 420px) { .shelly-stats { grid-template-columns: repeat(2, 1fr); } }

.stat-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.stat-val   { font-size: 1rem; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; }
.stat-label { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }

/* Chart Canvas */
.chart-wrapper { position: relative; height: 200px; flex: 1 1 auto; min-height: 160px; }
@media (min-width: 500px) { .chart-wrapper { height: 240px; } }
.chart-wrapper canvas { width: 100% !important; height: 100% !important; }

.chart-empty {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.875rem;
    padding: 40px 20px;
    line-height: 1.6;
}

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 500;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    white-space: nowrap;
    pointer-events: none;
}
.toast.toast-show  { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-error { border-color: rgba(248,113,113,0.4); color: var(--danger); }
/* ── Klima-Steuerung Modal ──────────────────────────────────── */
/* Größe kommt aus .modal-gross (geteilt mit dem Shelly-Diagramm-Modal) */
.modal-klima-inner {
    /* Höhe an den Inhalt anpassen statt fixe 1024px (sonst viel Leerraum
       bzw. überlaufende Diagramme). Breite bleibt aus .modal-gross. */
    height: auto !important;
    resize: horizontal;
}

.klima-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
/* Titel + Online-Badge nebeneinander (linke Gruppe) */
.klima-header-titel {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.klima-modal-header h3 { font-size: 1.1rem; }
.klima-status-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
}
.klima-status-badge.klima-on  { background: var(--on-glow); color: var(--on); }
.klima-status-badge.klima-off { background: rgba(248,113,113,0.12); color: var(--danger); }

.klima-ist-temp {
    text-align: center;
    padding: 14px 0 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.klima-ist-temp span {
    font-size: 2.6rem;
    font-weight: 800;
    color: #38bdf8;
    line-height: 1;
}
.klima-ist-temp small { color: var(--text-dim); font-size: 0.75rem; }

.klima-section { margin-top: 18px; }
.klima-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.klima-temp-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.klima-temp-btn {
    width: 48px; height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 1.6rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.klima-temp-btn:hover { border-color: #38bdf8; color: #38bdf8; }
.klima-temp-control > span:not(.klima-temp-unit) {
    font-size: 2rem;
    font-weight: 800;
    min-width: 50px;
    text-align: center;
}
.klima-temp-unit { font-size: 1.1rem; color: var(--text-dim); }

.klima-btn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
}
.klima-opt-btn {
    padding: 10px 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-dim);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.klima-opt-btn:hover  { border-color: #38bdf8; color: var(--text); }
.klima-opt-btn.active {
    background: rgba(56,189,248,0.15);
    border-color: #38bdf8;
    color: #38bdf8;
}

/* ── Nachlüften im Klima-Modal ──────────────────────────────── */
.klima-nachlueften {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 20px;
}
.klima-nachlueft-info {
    background: rgba(56,189,248,0.12);
    color: #38bdf8;
    border: 1px solid rgba(56,189,248,0.3);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 10px;
}
.klima-nachlueft-dauer {
    display: flex;
    align-items: center;
    gap: 8px;
}
.klima-nachlueft-dauer input {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
}

/* ── Settings-Toggle ────────────────────────────────────────── */
.settings-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
}
.settings-toggle input { cursor: pointer; width: 18px; height: 18px; }

/* ── Klima-Diagramme im Modal ───────────────────────────────── */
.klima-charts {
    margin: 16px 0;
    padding: 14px;
    background: var(--bg-elevated);
    border-radius: 10px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}
.klima-chart-box {
    position: relative;
    width: 100%;
}
/* Feste Höhen, damit die drei Diagramme sauber im Container bleiben
   (Chart.js mit maintainAspectRatio:false braucht einen höhenbegrenzten Container) */
.klima-chart-temp {
    height: 180px;
    margin-bottom: 12px;
}
.klima-chart-onoff {
    height: 90px;
    margin-bottom: 12px;
}
.klima-chart-online {
    height: 90px;
}
.klima-chart-range {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    justify-content: center;
}
.range-btn-k {
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.range-btn-k:hover  { border-color: #38bdf8; color: var(--text); }
.range-btn-k.active { background: rgba(56,189,248,0.15); border-color: #38bdf8; color: #38bdf8; }

/* Mini-Chart auf Klima-Karte */
.klima-mini canvas { width: 100% !important; }

/* ── "Nur Anzeige"-Badge (nicht schaltbare Geräte) ──────────── */
.nur-anzeige-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dim);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
}

/* ── Orte-Filter: Trenner, Drag & Drop ──────────────────────── */
.raum-trenner {
    color: var(--text-dim);
    font-size: 1.1rem;
    opacity: 0.5;
    padding: 0 4px;
    user-select: none;
    align-self: center;
}
.raum-ziehbar {
    cursor: grab;
    position: relative;
}
.raum-ziehbar:active { cursor: grabbing; }
.raum-ziehbar.dragging {
    opacity: 0.4;
}
.raum-ziehbar.drag-over {
    border-color: var(--accent);
    box-shadow: -2px 0 0 var(--accent);
}

/* Einstellungen: Select-Dropdown */
.settings-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
}
.settings-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── Gruppierte Ansicht (nach Orten) ────────────────────────── */
.device-grid.gruppiert {
    display: block;
}
.ort-gruppe-titel {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin: 22px 2px 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}
.ort-gruppe-titel:first-child { margin-top: 0; }
.ort-gruppe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}
@media (min-width: 700px) {
    .ort-gruppe-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

/* ── Mobil: Modals an kleinen Bildschirm anpassen ───────────── */
/* Hebt feste Großgrößen auf, damit genug Rand zum Wegtippen bleibt */
@media (max-width: 600px) {
    .modal,
    .modal-gross {
        width: 100% !important;
        max-width: 94vw !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;    /* keine Begrenzung – das Backdrop scrollt */
        overflow: visible !important;   /* kein internes Scrollen */
        /* Touch-Resize ist hakelig → deaktivieren */
        resize: none !important;
    }
    /* Anfasser-Symbol auf Mobil ausblenden */
    .modal::after { display: none !important; }

    /* Einheitlicher Innenabstand oben bei allen großen Modals */
    .modal-gross { padding-top: 20px !important; }

    /* Diagramme auf Mobil: FESTE Höhen statt Flex-Layout,
       damit die Charts nicht über ihre Container in die
       Steuerelemente hineinwachsen. */
    .chart-wrapper { height: 200px !important; flex: 0 0 auto !important; }

    .klima-charts {
        display: block !important;   /* kein Flex-Layout auf Mobil */
        flex: 0 0 auto !important;
        min-height: 0 !important;
    }
    .klima-chart-box {
        overflow: hidden;            /* Canvas nicht überlaufen lassen */
    }
    .klima-chart-temp {
        flex: none !important;
        height: 160px !important;
        min-height: 0 !important;
        margin-bottom: 12px;
    }
    .klima-chart-onoff {
        flex: none !important;
        height: 85px !important;
        min-height: 0 !important;
        margin-bottom: 12px;
    }
    .klima-chart-online {
        flex: none !important;
        height: 85px !important;
        min-height: 0 !important;
    }
}

/* ── Schließen-Button (✕) oben rechts in großen Modals ──────── */
.modal-close-x {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: background 0.15s;
}
.modal-close-x:hover { background: var(--border); }
/* Auf Mobil etwas größer für bessere Erreichbarkeit */
@media (max-width: 600px) {
    .modal-close-x { width: 40px; height: 40px; font-size: 1.25rem; top: 8px; right: 8px; }
}

/* ── X-Button in den großen Modal-Headern sichtbarer machen ──── */
.chart-header .btn-icon,
.klima-modal-header .btn-icon {
    background: var(--bg-elevated);
    color: var(--text);
    border-radius: 50%;
    padding: 8px;
    flex-shrink: 0;
}
.chart-header .btn-icon:hover,
.klima-modal-header .btn-icon:hover {
    background: var(--border);
}
@media (max-width: 600px) {
    .chart-header .btn-icon,
    .klima-modal-header .btn-icon {
        padding: 10px;
    }
    .chart-header .btn-icon svg,
    .klima-modal-header .btn-icon svg {
        width: 22px;
        height: 22px;
    }
}

/* ── Archiv: Verlauf wiederherstellen ───────────────────────── */
.modal-archiv-inner {
    width: 560px;
    max-width: min(96vw, 700px);
}
.archiv-liste {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}
.archiv-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
}
.archiv-item-kopf {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}
.archiv-item-name {
    font-weight: 700;
    font-size: 0.95rem;
}
.archiv-typ {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-left: 4px;
}
.archiv-item-meta {
    font-size: 0.76rem;
    color: var(--text-dim);
    margin-top: 4px;
    line-height: 1.5;
}
.archiv-del-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.6;
    flex-shrink: 0;
    padding: 4px;
    border-radius: 6px;
    transition: opacity 0.15s, background 0.15s;
}
.archiv-del-btn:hover { opacity: 1; background: rgba(248,113,113,0.12); }
.archiv-item-aktion {
    display: flex;
    gap: 8px;
    align-items: center;
}
.archiv-select { flex: 1; min-width: 0; }
.archiv-restore-btn { flex-shrink: 0; padding: 9px 16px; }

/* ── Mehrbenutzer: Freigaben & Karten-Badges ────────────────── */
.freigabe-section-titel {
    font-size: 0.92rem;
    font-weight: 700;
    margin: 4px 0 6px;
}
.freigabe-liste {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.freigabe-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.freigabe-name { font-weight: 600; font-size: 0.9rem; }
.freigabe-meta { font-size: 0.76rem; color: var(--text-dim); margin-top: 2px; }
.freigabe-aktion { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.freigabe-recht-sel { padding: 6px 8px; font-size: 0.8rem; width: auto; }

.btn-mini {
    border: none;
    border-radius: 7px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.btn-mini:hover { opacity: 0.85; }
.btn-mini-view    { background: rgba(56,189,248,0.15); color: #38bdf8; }
.btn-mini-control { background: var(--on-glow); color: var(--on); }
.btn-mini-deny    { background: rgba(248,113,113,0.12); color: var(--danger); }

/* "geteilt"-Badge auf fremden Geräten (oben rechts statt Edit/Delete) */
.card-shared-badge {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-dim);
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 999px;
}

/* ── Gruppen-Verwaltung ─────────────────────────────────────── */
.gruppe-neu-zeile {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.gruppe-neu-zeile .settings-input { flex: 1; }
.gruppen-liste { display: flex; flex-direction: column; gap: 12px; }
.gruppe-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
}
.gruppe-kopf {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}
.gruppe-name { font-weight: 700; font-size: 0.95rem; }
.gruppe-rolle {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(108,99,255,0.12);
    padding: 1px 7px;
    border-radius: 999px;
    margin-left: 6px;
}
.gruppe-rolle-mit { color: var(--text-dim); background: rgba(255,255,255,0.05); }
.gruppe-meta { font-size: 0.76rem; color: var(--text-dim); margin-top: 3px; }

.gruppe-link-zeile { display: flex; gap: 6px; margin: 10px 0; }
.gruppe-link-input { flex: 1; font-size: 0.72rem; font-family: monospace; }

.gruppe-mitglieder, .gruppe-anfragen { margin-top: 10px; }
.gmit-titel {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim);
    margin: 8px 0 4px;
    font-weight: 700;
}
.gmit-zeile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 0.86rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.gmit-del {
    background: none; border: none; color: var(--danger);
    cursor: pointer; font-size: 0.9rem; opacity: 0.6; padding: 2px 6px;
    border-radius: 5px;
}
.gmit-del:hover { opacity: 1; background: rgba(248,113,113,0.12); }

/* ── Share-Dialog ───────────────────────────────────────────── */
.share-section-titel {
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}
.share-add-zeile {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}
.share-add-zeile .settings-select:first-child { flex: 1; min-width: 0; }
.share-recht-sel { width: auto; padding: 6px 8px; font-size: 0.8rem; }
.share-zeile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.88rem;
}

/* Share-Button auf der Karte */
.card-share {
    position: absolute;
    top: 10px;
    right: 58px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px;
    border-radius: 6px;
    opacity: 0;
    transition: color 0.15s, background 0.15s, opacity 0.15s;
}
.device-card:hover .card-share { opacity: 1; }
.card-share:hover { color: var(--accent); background: rgba(108,99,255,0.1); }
@media (hover: none) {
    .card-share { opacity: 0.5; }
}

/* ── Archiv: Mehrfachauswahl & Bulk-Aktionen ────────────────── */
.archiv-bulk {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.archiv-bulk-zeile {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
}
.archiv-checkall {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.archiv-checkall input { width: 17px; height: 17px; cursor: pointer; accent-color: var(--accent); }

.archiv-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}
.archiv-check input {
    width: 17px; height: 17px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}

/* ── Zugangsdaten in Einstellungen ──────────────────────────── */
.cred-block {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
}
.cred-titel {
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cred-status { font-size: 0.72rem; font-weight: 600; }
.cred-status.cred-ok   { color: var(--on); }
.cred-status.cred-none { color: var(--text-dim); }
.cred-input {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
    font-size: 0.85rem;
}
.cred-aktion { display: flex; gap: 6px; }

/* ── Profil-Modal ───────────────────────────────────────────── */
.avatar-klick { cursor: pointer; transition: opacity 0.15s; }
.avatar-klick:hover { opacity: 0.8; }

.profil-avatar-bereich {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 8px 0 18px;
}
#profil-avatar-vorschau .profil-avatar-img,
#profil-avatar-vorschau .profil-avatar-init {
    width: 64px; height: 64px;
    border-radius: 50%;
    object-fit: cover;
}
.profil-avatar-init {
    display: flex; align-items: center; justify-content: center;
    background: var(--accent);
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
}
.profil-avatar-aktion { display: flex; flex-direction: column; gap: 6px; }

.profil-feld { margin-bottom: 10px; }
.profil-feld .settings-input { width: 100%; box-sizing: border-box; }
.profil-trenner {
    border-top: 1px solid var(--border);
    margin: 18px 0 12px;
    padding-top: 14px;
    font-weight: 700;
    font-size: 0.9rem;
}

/* ── Backup & Import Modal ──────────────────────────────────── */
.backup-block {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
}
.backup-titel {
    font-weight: 700;
    font-size: 0.92rem;
}

/* ── Header-Icon-Badges (Anzahl offener Anfragen / Papierkorb) ── */
.icon-badge-wrap {
    position: relative;
    overflow: visible;
}
.icon-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    box-sizing: border-box;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    pointer-events: none;
    box-shadow: 0 0 0 2px rgba(15,17,23,0.92);
}

/* ── Gruppen: Direkt-Beitritt-Toggle ────────────────────────── */
.gruppe-direkt-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.82rem;
    color: var(--text-dim);
    cursor: pointer;
}
.gruppe-direkt-toggle input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}

/* ── Sensor-Karten (DS18B20 am Add-On) ──────────────────────── */
.badge-addon   { background: rgba(56,189,248,0.13); color: #38bdf8; border: 1px solid rgba(56,189,248,0.4); }
.badge-anzeige { background: rgba(255,255,255,0.05); color: var(--text-dim); border: 1px solid var(--border); font-size: 0.66rem; }

.sensor-card .card-icon { color: #fb923c; }
.sensor-temp-big {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fb923c;
    line-height: 1;
    margin-top: 2px;
}
.sensor-mini {
    height: 38px;
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 4px 6px;
    position: relative;
}
/* Diagramm-Box mit Hintergrund + runden Ecken (Shelly + Klima, wie Sensor) */
.mini-chart-box {
    height: 38px;
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 4px 6px;
    position: relative;
    cursor: pointer;
}
.klima-temp-inline {
    font-size: 1.5rem;
    font-weight: 700;
    color: #38bdf8;
    line-height: 1;
}
.range-btn-s {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 0.74rem;
    cursor: pointer;
    transition: all 0.15s;
}
.range-btn-s.active {
    background: rgba(251,146,60,0.15);
    border-color: #fb923c;
    color: #fb923c;
}

/* ── Add-On Sensoren im Plug-Modal ──────────────────────────── */
.plug-sensor-zeile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
}
.plug-sensor-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plug-sensor-name { font-size: 0.86rem; font-weight: 600; color: var(--text); }
.plug-sensor-temp { font-size: 0.74rem; color: #fb923c; }
.sensor-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.sensor-switch input { opacity: 0; width: 0; height: 0; }
.sensor-switch-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--border); border-radius: 999px; transition: 0.2s;
}
.sensor-switch-slider::before {
    content: ""; position: absolute; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.2s;
}
.sensor-switch input:checked + .sensor-switch-slider { background: var(--on); }
.sensor-switch input:checked + .sensor-switch-slider::before { transform: translateX(20px); }

/* ── Sensor: Offline & Fehler ───────────────────────────────── */
.sensor-temp-offline { color: var(--text-dim) !important; opacity: 0.6; }
.sensor-fehler-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: rgba(248,113,113,0.1);
    border: 1px solid rgba(248,113,113,0.4);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 4px 0 14px;
    font-size: 0.82rem;
    color: #fca5a5;
}
.sensor-fehler-icon { flex-shrink: 0; }
.plug-sensor-temp.offline { color: var(--danger); }

/* ── Drag & Drop der Karten ──────────────────────────────────── */
.device-card { touch-action: manipulation; }
.karte-ghost {
    opacity: 0.4;
    background: var(--accent-dim) !important;
    border: 2px dashed var(--accent) !important;
}
.karte-chosen {
    cursor: grabbing;
}
.karte-drag {
    box-shadow: 0 12px 32px rgba(0,0,0,0.5);
    transform: scale(1.03);
    opacity: 0.95;
}
/* Leere Orts-Gruppe als Drop-Ziel sichtbar halten */
.ort-gruppe-grid.karten-sortable:empty {
    min-height: 70px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.02);
}
.ort-gruppe-grid.karten-sortable:empty::after {
    content: "Karten hierher ziehen";
    display: flex;
    align-items: center;
    justify-content: center;
    height: 70px;
    color: var(--text-dim);
    font-size: 0.8rem;
}

/* ── Benutzerverwaltung (Admin) ─────────────────────────────── */
.admin-user-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
}
.admin-user-kopf { display: flex; gap: 12px; align-items: flex-start; }
.admin-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
}
.admin-avatar-initials {
    display: flex; align-items: center; justify-content: center;
    background: var(--accent); color: #fff; font-weight: 700; font-size: 1.05rem;
}
.admin-user-info { min-width: 0; flex: 1; }
.admin-user-name { font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.admin-user-mail { font-size: 0.82rem; color: var(--text-dim); word-break: break-all; }
.admin-user-meta { font-size: 0.74rem; color: var(--text-dim); margin-top: 2px; }
.admin-badge {
    font-size: 0.66rem; padding: 1px 7px; border-radius: 999px; font-weight: 600;
}
.admin-badge-admin  { background: rgba(108,99,255,0.18); color: #a39dff; border: 1px solid rgba(108,99,255,0.4); }
.admin-badge-selbst { background: rgba(74,222,128,0.15); color: #4ade80; border: 1px solid rgba(74,222,128,0.4); }
.admin-user-aktionen {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.admin-user-aktionen:empty { display: none; }

/* ── Ausklappbares Seitenmenü (Header-Aktionen) ─────────────── */
.seitenmenu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
    z-index: 200;
}
.seitenmenu-overlay.offen { opacity: 1; visibility: visible; }
.seitenmenu {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 280px;
    max-width: 82vw;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 30px rgba(0,0,0,0.45);
    transform: translateX(100%);
    transition: transform 0.28s ease;
    z-index: 201;
    display: flex;
    flex-direction: column;
}
.seitenmenu.offen { transform: translateX(0); }
.seitenmenu-kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.seitenmenu-liste {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 2px;
    overflow-y: auto;
}
.seitenmenu-eintrag {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 0.92rem;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    width: 100%;
    position: relative;
    transition: background 0.15s;
}
.seitenmenu-eintrag:hover { background: var(--bg-elevated); }
.seitenmenu-eintrag svg { flex-shrink: 0; color: var(--text-dim); }
.seitenmenu-logout { color: var(--danger); margin-top: 4px; }
.seitenmenu-logout svg { color: var(--danger); }
.seitenmenu-badge {
    position: static;
    margin-left: auto;
    flex-shrink: 0;
}

/* ── Alle Klima ausschalten (Auswahl-Liste) ─────────────────── */
.klima-aus-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
}
.klima-aus-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    flex-shrink: 0;
    cursor: pointer;
}
.klima-aus-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.klima-aus-name { font-weight: 600; color: var(--text); }
.klima-aus-ort { font-size: 0.78rem; color: var(--text-dim); }
.klima-aus-temp { font-size: 1rem; font-weight: 700; color: #38bdf8; flex-shrink: 0; }

/* ── Bewässerung (Gardena-Ventile) ──────────────────────────── */
.bewaesserung-card { cursor: default; }
.bewaesserung-card .card-top { cursor: pointer; }
.bewaesserung-card.on { border-color: rgba(56,189,248,0.5); }

.bew-switch-zeile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border-radius: 10px;
    font-weight: 600;
}
.bew-label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-dim);
    margin-bottom: 6px;
    font-weight: 600;
}
.bew-dauer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.bew-dauer-btn {
    padding: 10px 6px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-dim);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.bew-dauer-btn.aktiv {
    background: #38bdf8;
    color: #08222f;
    border-color: #38bdf8;
}
.bew-dauer-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.bew-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 0.95rem;
}
.bew-ok { color: var(--on); font-size: 0.88rem; margin: 0; }
.bew-fehler { color: var(--danger); font-size: 0.88rem; margin: 0; }

/* ── Bewässerung: Verlauf-Charts im Modal ───────────────────── */
.bew-zeit-leiste {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.bew-zeit-btn {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-dim);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.bew-zeit-btn.aktiv {
    background: #38bdf8;
    color: #08222f;
    border-color: #38bdf8;
}
.bew-chart-titel {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin: 10px 0 6px;
    font-weight: 600;
}

/* Gardena-Rate-Limit-Sperre (24 h) */
.badge-gesperrt { background: rgba(251,191,36,0.14); color: #fbbf24; border: 1px solid rgba(251,191,36,0.35); }
