/*
  Copyright (c) 2026 Konstantin Pache. All rights reserved.
  This software is proprietary and developed as an independent private project.
  Unauthorized use, reproduction, or distribution is strictly prohibited.
  See LICENSE for details.
*/

/* ═══════════════════════════════════════════════
   SHELL – Design Tokens & Layout
   Alle Module erben diese Variablen.
   Neue Module brauchen keine eigenen Farben.
═══════════════════════════════════════════════ */
:root {
  /* Farben */
  --bg:         #001c2f;
  --bg2:        #002540;
  --bg3:        #002e4d;
  --bg4:        #003560;
  --border:     rgba(255,255,255,0.07);
  --border2:    rgba(255,255,255,0.13);
  --text:       #dedad3;
  --muted:      #7a9ab5;
  --muted2:     #5a7a90;
  --green:      #34c98a;
  --green-bg:   rgba(52,201,138,0.09);
  --red:        #e85555;
  --red-bg:     rgba(232,85,85,0.09);
  --amber:      #e8963a;
  --amber-bg:   rgba(232,150,58,0.09);
  --blue:       #4f8ef7;
  --blue-bg:    rgba(79,142,247,0.09);
  --purple:     #a78bfa;
  --purple-bg:  rgba(167,139,250,0.09);
  --overlay-1:  rgba(255,255,255,0.03);
  --overlay-2:  rgba(255,255,255,0.07);
  --logo-filter: brightness(0) invert(1);
  /* Layout */
  --sidebar:    220px;
  --topbar:     56px;
  --r:          8px;
  --r-lg:       12px;
  /* Typografie */
  --font:       'DM Sans', sans-serif;
  --mono:       'DM Mono', monospace;
  /* Schriftgrößen-Skala (override in theme.js) */
  --fs-2xs: 9px;  --fs-xs: 10px; --fs-sm: 11px; --fs-base: 12px; --fs-md: 13px;
  --fs-lg:  14px; --fs-xl: 15px; --fs-2xl: 16px; --fs-3xl: 17px; --fs-4xl: 18px;
  --fs-5xl: 19px; --fs-6xl: 22px; --fs-7xl: 26px; --fs-8xl: 32px; --fs-9xl: 42px;
  /* Login background (override in theme.js) */
  --login-bg:   url('/assets/background.jpg');
  --login-tint: rgba(0, 20, 45, 0.40);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: var(--fs-xl); line-height: 1.5; display: flex; flex-direction: column; }

/* ── Global font-size scale ──
   Utility classes for one-off/inline text sizing. Prefer these over a
   hardcoded font-size so the whole app resizes from theme.js. ── */
.text-2xs { font-size: var(--fs-2xs); }
.text-xs  { font-size: var(--fs-xs);  }
.text-sm  { font-size: var(--fs-sm);  }
.text-base{ font-size: var(--fs-base);}
.text-md  { font-size: var(--fs-md);  }
.text-lg  { font-size: var(--fs-lg);  }
.text-xl  { font-size: var(--fs-xl);  }
.text-2xl { font-size: var(--fs-2xl); }
.text-3xl { font-size: var(--fs-3xl); }
.text-4xl { font-size: var(--fs-4xl); }
.text-5xl { font-size: var(--fs-5xl); }
.text-6xl { font-size: var(--fs-6xl); }
.text-7xl { font-size: var(--fs-7xl); }
.text-8xl { font-size: var(--fs-8xl); }
.text-9xl { font-size: var(--fs-9xl); }

/* ═══════════════════════════════════════════════
   SHELL – App-Rahmen (Sidebar + Main)
   Wird nie von Modulen verändert.
═══════════════════════════════════════════════ */
.shell { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar); flex-shrink: 0;
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.sidebar-logo {
  height: var(--topbar); display: flex; align-items: center;
  padding: 0 1.25rem; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sidebar-logo img { filter: var(--logo-filter); opacity: .9; }
.sidebar-nav { padding: .625rem .625rem; flex: 1; overflow-y: auto; }
.nav-group-label {
  font-size: var(--fs-xs); font-weight: 500; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted2); padding: .625rem .5rem .3rem; margin-top: .25rem;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: .45rem .625rem; border-radius: var(--r);
  font-size: var(--fs-base); color: var(--muted);
  cursor: pointer; transition: all .12s; margin-bottom: 1px;
  border: 1px solid transparent; user-select: none;
}
.nav-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.nav-item:hover { color: var(--text); background: var(--bg3); }
.nav-item.active { color: var(--text); background: var(--bg4); border-color: var(--border2); }
.nav-badge { margin-left: auto; font-size: var(--fs-xs); font-weight: 500; padding: 1px 6px; border-radius: 99px; }
.nav-badge-red    { background: var(--red-bg);    color: var(--red); }
.nav-badge-green  { background: var(--green-bg);  color: var(--green); }
.sidebar-footer {
  padding: .625rem; border-top: 1px solid var(--border); flex-shrink: 0;
}
.sf-stat {
  background: var(--bg3); border-radius: var(--r); padding: .5rem .875rem;
  margin-bottom: 5px; border: 1px solid var(--border);
}
.sf-label { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 2px; }

/* ── Profile card ── */
.sidebar-profile {
  padding: .625rem; border-top: 1px solid var(--border); flex-shrink: 0;
}
.profile-card {
  display: flex; align-items: center; gap: 9px;
  padding: .5rem .625rem; border-radius: var(--r);
  cursor: pointer; transition: background .12s;
  border: 1px solid transparent;
}
.profile-card:hover { background: var(--bg3); border-color: var(--border); }
.profile-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--purple) 0%, #3b82f6 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm); font-weight: 700; color: #fff; letter-spacing: .02em;
}
.profile-info { flex: 1; min-width: 0; }
.profile-name  { font-size: var(--fs-base); font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-role  { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-chevron svg { width: 12px; height: 12px; stroke: var(--muted); }

/* ── About entry ── */
.sidebar-about {
  padding: .3rem .625rem .625rem;
}
.about-item {
  display: flex; align-items: center; gap: 7px;
  padding: .35rem .5rem; border-radius: var(--r);
  font-size: var(--fs-sm); color: var(--muted);
  cursor: pointer; transition: color .12s, background .12s;
}
.about-item:hover { color: var(--text); background: var(--bg3); }
.about-item svg { width: 13px; height: 13px; flex-shrink: 0; }
.about-item .about-version { margin-left: auto; font-size: var(--fs-xs); color: var(--muted2); font-family: var(--mono); }

/* ── About modal ── */
.about-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none;
  transition: opacity .18s;
}
.about-modal-backdrop.open { opacity: 1; pointer-events: all; }
.about-modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 12px; padding: 1.5rem; width: 380px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  transform: translateY(10px); transition: transform .18s;
}
.about-modal-backdrop.open .about-modal { transform: none; }
.about-modal-logo { margin-bottom: 1rem; }
.about-modal-logo img { height: 22px; filter: var(--logo-filter); opacity: .9; }
.about-modal h2 { font-size: var(--fs-lg); font-weight: 600; color: var(--text); margin-bottom: 4px; }
.about-modal-desc { font-size: var(--fs-base); color: var(--muted); line-height: 1.6; margin-bottom: 1.25rem; }
.about-modal-rows { display: flex; flex-direction: column; gap: 5px; margin-bottom: 1.25rem; }
.about-modal-row { display: flex; justify-content: space-between; font-size: var(--fs-sm); padding: 5px 0; border-bottom: 1px solid var(--border); }
.about-modal-row:last-child { border-bottom: none; }
.about-modal-row span:first-child { color: var(--muted); }
.about-modal-row span:last-child  { color: var(--text); font-weight: 500; font-family: var(--mono); font-size: var(--fs-sm); }
.about-modal-close {
  width: 100%; padding: .5rem; border-radius: 7px;
  background: var(--bg4); border: 1px solid var(--border);
  color: var(--text); font-size: var(--fs-base); cursor: pointer;
  transition: background .12s;
}
.about-modal-close:hover { background: var(--bg3); }
.sf-val   { font-size: var(--fs-4xl); font-weight: 300; }

/* ── Main ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ── Topbar ── */
.topbar {
  height: var(--topbar); flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 0 1.5rem; border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.topbar-title { font-size: var(--fs-lg); font-weight: 500; flex: 1; }
.topbar-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-base); color: var(--muted); cursor: pointer;
  padding: 4px 10px; border-radius: var(--r);
  border: 1px solid var(--border2); background: none;
  transition: all .12s; font-family: var(--font);
}
.topbar-back:hover { color: var(--text); background: var(--bg3); }
.topbar-back svg { width: 13px; height: 13px; }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 rgba(52,201,138,.4);
  animation: livepulse 2.5s ease-out infinite;
}
@keyframes livepulse { 70%{box-shadow:0 0 0 8px rgba(52,201,138,0)} 100%{box-shadow:0 0 0 0 rgba(52,201,138,0)} }
.ts { font-size: var(--fs-sm); color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font); font-size: var(--fs-base); color: var(--muted);
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--r); padding: 5px 11px; cursor: pointer; transition: all .12s;
}
.btn:hover { color: var(--text); }
.btn svg { width: 13px; height: 13px; }

/* ═══════════════════════════════════════════════
   SHARED COMPONENTS – Wiederverwendbar in allen Modulen
═══════════════════════════════════════════════ */
/* Views */
.view { flex: 1; overflow: hidden; display: none; flex-direction: column; }
.view.active { display: flex; }
.view-scroll { flex: 1; overflow: auto; padding: 1.25rem 1.5rem; }
#view-overview .view-scroll { padding: 1.25rem 1.5rem; overflow: auto; }
#view-ladestationen .view-scroll { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
#view-ems-standorte .view-scroll { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
#view-ems-detail .view-scroll { padding: 1.25rem 1.5rem; overflow: auto; }
#view-incidents .view-scroll { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

/* Vorfälle view: vertical 2/3 - 1/3 split (Aktive / Archivierte) */
.inc-split { flex: 1; min-height: 0; margin: 1rem 1.25rem; display: flex; flex-direction: column; gap: 10px; }
.inc-split-active   { flex: 2; min-height: 0; }
.inc-split-archived { flex: 1; min-height: 0; }

/* Panel */
.panel {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r-lg); display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: .7rem 1rem; border-bottom: 1px solid var(--border);
  background: var(--bg3); flex-shrink: 0;
}
.panel-icon { width: 26px; height: 26px; border-radius: 6px; display: flex; align-items: center; justify-content: center; background: var(--overlay-1); }
.panel-icon svg { width: 13px; height: 13px; }
.panel-title { font-size: var(--fs-base); font-weight: 500; flex: 1; }

/* Badges */
.badge { font-size: var(--fs-xs); font-weight: 500; padding: 2px 8px; border-radius: 99px; }
.badge-gray   { background: var(--overlay-2); color: var(--muted); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }

/* KPI Cards */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1rem 1.25rem;
  position: relative; overflow: hidden;
}
.kpi-accent { position: absolute; top: 0; left: 0; right: 0; height: 2px; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.kpi-label { font-size: var(--fs-xs); font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.kpi-val   { font-size: var(--fs-8xl); font-weight: 300; line-height: 1; margin-bottom: 3px; }
.kpi-sub   { font-size: var(--fs-sm); color: var(--muted); }

/* Table */
.table-wrap { flex: 1; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
thead th {
  position: sticky; top: 0; z-index: 1;
  padding: .5rem 1rem; text-align: left;
  font-size: var(--fs-xs); font-weight: 500; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  background: var(--bg3); border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--overlay-1); }
.table-link { color: var(--blue); cursor: pointer; font-size: var(--fs-base); }
.table-link:hover { text-decoration: underline; }
tbody tr.err-row { border-left: 2px solid var(--red); }
tbody td { padding: .55rem 1rem; vertical-align: middle; }
.td-clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Slim table variant (denser rows, e.g. Vorfälle) */
.table-slim thead th { padding: .4rem .85rem; }
.table-slim tbody td { padding: .5rem .85rem; }

/* Pagination bar below a table-wrap - slot keeps its height reserved even
   when empty (single page) so the table body size doesn't jump around. */
.pag-slot { min-height: 34px; flex-shrink: 0; }
.pag-bar { display: flex; align-items: center; justify-content: space-between; padding: .35rem 1rem; border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--muted); flex-shrink: 0; }
/* Single-page fallback for a paginated table (paginationBar() returns '' when
   totalPages <= 1) - same framing as .pag-bar so it doesn't look disconnected. */
.pag-summary { display: flex; align-items: center; padding: .35rem 1rem; border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--muted); flex-shrink: 0; }
.content-table-card.fill-parent {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 500; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.pill-dot { width: 5px; height: 5px; border-radius: 50%; }
.pill-online  { background: var(--green-bg); color: var(--green); }
.pill-online .pill-dot  { background: var(--green); }
.pill-offline { background: var(--amber-bg); color: var(--amber); }
.pill-offline .pill-dot { background: var(--amber); }
.pill-warn          { background: rgba(156,163,175,.1); color: var(--muted); border-color: rgba(156,163,175,.25); }
.pill-warn .pill-dot { background: var(--muted2); }
.pill-error   { background: var(--red-bg); color: var(--red); }
.pill-error .pill-dot   { background: var(--red); animation: blink 1.1s infinite; }
@keyframes blink { 0%,100%{opacity:1}50%{opacity:.25} }

/* LunAI Badge */
.lunai-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em;
  padding: 3px 9px; border-radius: 99px;
  background: var(--purple-bg); color: var(--purple);
  border: 1px solid rgba(167,139,250,.35);
  white-space: nowrap; flex-shrink: 0;
  box-shadow: 0 0 8px rgba(167,139,250,.15);
}
.lunai-badge svg { width: 10px; height: 10px; }

/* LunAI Deep Analysis */
.lunai-deep-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 1rem; padding: 7px 14px; border-radius: 8px;
  background: var(--purple-bg); color: var(--purple);
  border: 1px solid rgba(167,139,250,.4);
  font-size: var(--fs-base); font-weight: 600; letter-spacing: .04em;
  cursor: pointer; transition: background .15s, box-shadow .15s;
  box-shadow: 0 0 10px rgba(167,139,250,.15);
  width: 100%;
  justify-content: center;
}
.lunai-deep-btn:hover { background: rgba(167,139,250,.18); box-shadow: 0 0 16px rgba(167,139,250,.25); }
.lunai-deep-btn svg { width: 14px; height: 14px; }
.servicefall-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  flex: 1; margin-top: 1rem; padding: 7px 14px; border-radius: 8px;
  background: var(--blue-bg, rgba(59,130,246,.1)); color: var(--blue, #60a5fa);
  border: 1px solid rgba(96,165,250,.4);
  font-size: var(--fs-base); font-weight: 600; letter-spacing: .04em;
  cursor: pointer; transition: background .15s, box-shadow .15s;
  box-shadow: 0 0 10px rgba(96,165,250,.15);
  text-decoration: none;
}
.servicefall-btn:hover { background: rgba(96,165,250,.18); box-shadow: 0 0 16px rgba(96,165,250,.25); }
.servicefall-btn svg { width: 14px; height: 14px; }
.lunai-deep-btn .btn-spinner {
  width: 13px; height: 13px;
  border: 1.5px solid rgba(167,139,250,.3);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
/* ── LunAI Deep Analysis – full-width section ───────────────────────── */
#lunai-section {
  display: none;
  margin-bottom: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(167,139,250,.35);
  background: var(--sidebar-bg);
  overflow: hidden;
  animation: ldr-in .25s ease;
}
#lunai-section.visible { display: block; }
@keyframes ldr-in { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }

.ldr-header {
  display: flex; align-items: center; gap: 10px;
  padding: .8rem 1.1rem;
  border-bottom: 1px solid rgba(167,139,250,.2);
  background: rgba(167,139,250,.06);
}
.ldr-header-icon { display:flex; align-items:center; }
.ldr-header-icon svg { width:16px; height:16px; stroke: var(--purple); }
.ldr-header-title { font-size: var(--fs-md); font-weight:600; color:var(--purple); flex:1; }
.ldr-header-ts { font-size: var(--fs-sm); color:var(--muted); margin-right:4px; }
.ldr-header-actions { display:flex; gap:6px; }
.ldr-action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 6px; font-size: var(--fs-sm); font-weight: 500;
  cursor: pointer; border: 1px solid var(--border);
  background: var(--overlay-1);
  color: var(--muted); transition: color .15s, background .15s, border-color .15s;
}
.ldr-action-btn:hover { color: var(--text); border-color: var(--muted); background: var(--overlay-2); }
.ldr-action-btn svg { width:12px; height:12px; }

.ldr-body { padding: 1rem 1.1rem; display:flex; flex-direction:column; gap:.85rem; }

.ldr-summary-block {
  font-size: var(--fs-base); line-height: 1.7; color: var(--text);
  padding: .8rem 1rem;
  background: rgba(167,139,250,.05);
  border-left: 3px solid var(--purple);
  border-radius: 0 7px 7px 0;
}
.ldr-block-label {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
  display: flex; align-items: center; gap: 5px;
}
.ldr-block-label svg { width: 11px; height: 11px; }

.ldr-analysis-grid {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 8px;
}
@media (max-width:700px) { .ldr-analysis-grid { grid-template-columns: 1fr; } }
.ldr-analysis-card {
  padding: .7rem .85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--overlay-1);
}
.ldr-analysis-card-key {
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 5px;
  margin-bottom: 5px;
}
.ldr-analysis-card-key svg { width: 11px; height: 11px; opacity:.75; }
.ldr-analysis-card-val { font-size: var(--fs-base); color: var(--text); line-height: 1.55; }

.ldr-recommendation {
  padding: .75rem 1rem; border-radius: 8px;
  font-size: var(--fs-base); line-height: 1.6;
  display: flex; gap: 10px; align-items: flex-start;
}
.ldr-recommendation.sev-ok     { background: rgba(16,185,129,.07); border: 1px solid rgba(16,185,129,.25); }
.ldr-recommendation.sev-warn   { background: rgba(245,158,11,.07);  border: 1px solid rgba(245,158,11,.25); }
.ldr-recommendation.sev-error  { background: rgba(239,68,68,.07);   border: 1px solid rgba(239,68,68,.25); }
.ldr-recommendation.sev-manual { background: rgba(167,139,250,.07); border: 1px solid rgba(167,139,250,.25); }
.ldr-rec-icon { flex-shrink:0; margin-top:1px; }
.ldr-rec-icon svg { width:15px; height:15px; }
.sev-ok     .ldr-rec-icon svg { stroke: var(--green); }
.sev-warn   .ldr-rec-icon svg { stroke: var(--amber); }
.sev-error  .ldr-rec-icon svg { stroke: var(--red); }
.sev-manual .ldr-rec-icon svg { stroke: var(--purple); }
.ldr-rec-label {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; margin-bottom: 3px;
}
.sev-ok     .ldr-rec-label { color: var(--green); }
.sev-warn   .ldr-rec-label { color: var(--amber); }
.sev-error  .ldr-rec-label { color: var(--red); }
.sev-manual .ldr-rec-label { color: var(--purple); }
.ldr-rec-text { color: var(--text); }

/* Print styles */
@media print {
  .sidebar, .topbar, .ldr-header-actions, .lunai-deep-btn, .servicefall-btn { display:none !important; }
  #lunai-section { border: 1px solid #ccc !important; background: #fff !important; }
  .ldr-summary-block { border-left: 3px solid #7c3aed !important; background: #f5f3ff !important; }
  .ldr-analysis-card { border: 1px solid #e5e7eb !important; background: #fafafa !important; }
  body, .ldr-analysis-card-val, .ldr-rec-text, .ldr-summary-block { color: #111 !important; }
  .ldr-block-label, .ldr-analysis-card-key, .ldr-header-ts { color: #666 !important; }
}

/* Loading & Empty */
.loading-cell { padding: 1.5rem; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.spinner { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--border2); border-top-color: var(--green); animation: spin .75s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { padding: 2rem; text-align: center; color: var(--muted); font-size: var(--fs-base); }

/* Detail Cards */
.detail-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.detail-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.detail-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.25rem 1.5rem;
}
.detail-card.full        { grid-column: 1/-1; }
.detail-card.accent-red    { border-left: 3px solid var(--red); }
.detail-card.accent-green  { border-left: 3px solid var(--green); }
.detail-card.accent-blue   { border-left: 3px solid var(--blue); }
.detail-card.accent-purple { border-left: 3px solid var(--purple); }
.dc-label { font-size: var(--fs-xs); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .875rem; display: flex; align-items: center; gap: 6px; }
.dc-label svg { width: 12px; height: 12px; }
.dc-text  { font-size: var(--fs-md); color: var(--text); line-height: 1.6; }
.dc-val   { font-size: var(--fs-6xl); font-weight: 300; }
.dc-sub   { font-size: var(--fs-sm); color: var(--muted); margin-top: 3px; }

/* Card blueprints (Cards.* in modules/ui-templates.js) - shared between
   charger-detail and incident-detail so the top-row cards stay identical. */
/* align-items: flex-start pins the label+heading to the same spot on every
   card regardless of how many (if any) lines/action follow - only the
   action button opts back into vertical centering via align-self. */
.top-info-card    { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.top-info-body    { flex: 1; min-width: 0; }
.top-info-heading { font-size: var(--fs-6xl); font-weight: 700; line-height: 1.15; margin-bottom: 6px; word-break: break-word; }
.top-info-sub     { font-size: var(--fs-base); color: var(--muted); margin-bottom: 3px; }
.top-info-action  { flex-shrink: 0; align-self: center; }

.sub-card       { background: var(--overlay-1); border: 1px solid var(--border); border-radius: var(--r); padding: .625rem .75rem; display: flex; flex-direction: column; }
.sub-card-label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; }
.sub-card-label svg { width: 11px; height: 11px; flex-shrink: 0; }

.icon-btn-row { display: flex; align-items: center; gap: 10px; }
.icon-btn { background: none; border: none; cursor: not-allowed; color: var(--muted2); padding: 4px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 14px; height: 14px; }

.content-history-timeline { position: relative; }
.content-history-card { position: relative; display: flex; gap: .75rem; padding-bottom: 1rem; }
.content-history-card:last-child { padding-bottom: 0; }
.content-history-card:not(:last-child)::before {
  content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; width: 1px; background: var(--border2);
}
.chc-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--bg2); border: 2px solid var(--border2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; position: relative; z-index: 1; }
.chc-icon svg { width: 14px; height: 14px; }
.chc-body { flex: 1; min-width: 0; }
.chc-title { font-size: var(--fs-md); font-weight: 600; color: var(--text); margin-bottom: 2px; }
.chc-subheading { font-size: var(--fs-xs); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.chc-text { font-size: var(--fs-base); color: var(--muted); line-height: 1.5; }
.meta-table { width: 100%; }
.meta-table tr td { padding: 5px 0; vertical-align: top; }
.meta-table tr td:first-child { font-size: var(--fs-sm); color: var(--muted); width: 130px; padding-right: 12px; white-space: nowrap; }
.meta-table tr td:last-child  { font-size: var(--fs-base); color: var(--text); }
.meta-table tr { border-bottom: 1px solid var(--border); }
.meta-table tr:last-child { border-bottom: none; }
.source-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r); background: var(--blue-bg); border: 1px solid rgba(79,142,247,.18); font-size: var(--fs-sm); color: var(--blue); }
.source-chip svg { width: 11px; height: 11px; }
.similar-card { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r); padding: .875rem 1rem; margin-bottom: 8px; }
.similar-card:last-child { margin-bottom: 0; }
.similar-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.similar-desc { font-size: var(--fs-base); color: var(--muted); }
.similar-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.avatar { width: 20px; height: 20px; border-radius: 50%; background: var(--bg4); border: 1px solid var(--border2); display: flex; align-items: center; justify-content: center; font-size: var(--fs-2xs); font-weight: 500; color: var(--muted); flex-shrink: 0; }
.timeline { position: relative; padding-left: 1.25rem; }
.timeline::before { content:''; position:absolute; left:5px; top:6px; bottom:6px; width:1px; background: var(--border2); }
.tl-item { position: relative; margin-bottom: 1rem; }
.tl-item:last-child { margin-bottom: 0; }
.tl-dot { position: absolute; left: -1.25rem; top: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--muted2); border: 1px solid var(--border2); }
.tl-dot.active { background: var(--red); border-color: var(--red); }
.tl-time { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 2px; }
.tl-text { font-size: var(--fs-base); color: var(--text); }

/* ═══════════════════════════════════════════════
   MODULE: overview – spezifische Styles
═══════════════════════════════════════════════ */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: 1; min-height: 0; }
.split-right { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.pag-btn { background:var(--bg3);border:1px solid var(--border2);border-radius:var(--r);padding:2px 9px;font-family:var(--font);font-size: var(--fs-sm);color:var(--muted);cursor:pointer;transition:all .12s; }
/* Health Score */
.health-ring-wrap { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.health-ring-wrap svg { transform: rotate(-90deg); }
.health-ring-val { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: var(--fs-sm); font-weight: 600; }
.hs-bar { height: 6px; border-radius: 99px; background: var(--bg4); overflow: hidden; margin-top: 4px; }
.hs-fill { height: 100%; border-radius: 99px; transition: width .6s cubic-bezier(.4,0,.2,1); }

/* ── Länder-Scope ── */
.country-scope {
  padding: .5rem .625rem .375rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.country-scope-label {
  font-size: var(--fs-xs); font-weight: 500; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted2); padding: .25rem .5rem .4rem; display: flex; align-items: center; gap: 6px;
}
.country-scope-label svg { width: 11px; height: 11px; flex-shrink: 0; }
.country-scope-select {
  width: 100%; background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--r); padding: 5px 8px;
  font-family: var(--font); font-size: var(--fs-base); color: var(--text);
  outline: none; cursor: pointer; transition: border-color .15s;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a9ab5' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  padding-right: 26px;
}
.country-scope-select:focus { border-color: var(--blue); }
.country-scope-select option { background: var(--bg3); color: var(--text); }
.country-scope-flag { font-size: var(--fs-md); }

/* Column sort header */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable .sort-icon { display: inline-block; margin-left: 3px; opacity: .4; font-size: var(--fs-2xs); }
th.sortable.asc .sort-icon::after  { content: '▲'; opacity: 1; }
th.sortable.desc .sort-icon::after { content: '▼'; opacity: 1; }
th.sortable:not(.asc):not(.desc) .sort-icon::after { content: '⬍'; }

.pag-btn:hover { color:var(--text); }
.pag-btn:disabled { opacity:.35;cursor:not-allowed; }
.split-col { display: flex; flex-direction: column; min-height: 0; gap: 10px; }
.err-list { flex: 1; overflow: auto; }
.err-item { padding: .875rem 1rem; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; border-left: 2px solid transparent; }
.err-item:hover { background: var(--overlay-1); }
.err-item-top { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.err-serial { font-family: var(--mono); font-size: var(--fs-sm); font-weight: 500; }
.err-code-tag { font-family: var(--mono); font-size: var(--fs-xs); color: var(--red); background: var(--red-bg); padding: 1px 6px; border-radius: 4px; }
.err-time { font-size: var(--fs-xs); color: var(--muted); margin-left: auto; }
.err-loc  { font-size: var(--fs-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.err-diag-preview { font-size: var(--fs-sm); color: var(--muted2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }

/* ═══════════════════════════════════════════════
   MODULE: statistics – spezifische Styles
═══════════════════════════════════════════════ */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 1.25rem; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.25rem 1.5rem; }
.stat-card-title { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 1rem; display: flex; align-items: center; gap: 7px; }
.stat-card-title svg { width: 13px; height: 13px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-label { font-size: var(--fs-base); color: var(--text); width: 90px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 6px; background: var(--bg4); border-radius: 99px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 99px; transition: width .6s cubic-bezier(.4,0,.2,1); }
.bar-val   { font-size: var(--fs-sm); color: var(--muted); width: 28px; text-align: right; flex-shrink: 0; }
.donut-wrap { display: flex; align-items: center; gap: 1.25rem; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: var(--fs-base); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.legend-val { margin-left: auto; font-weight: 500; }
.firmware-list { display: flex; flex-direction: column; gap: 6px; }
.fw-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--bg3); border-radius: var(--r); border: 1px solid var(--border); }
.fw-ver { font-family: var(--mono); font-size: var(--fs-base); color: var(--text); flex: 1; }
.fw-count { font-size: var(--fs-sm); color: var(--muted); }
.trend-row { display: flex; align-items: flex-end; gap: 4px; height: 48px; }
.trend-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.trend-bar { width: 100%; border-radius: 3px 3px 0 0; transition: height .5s; }
.trend-label { font-size: var(--fs-2xs); color: var(--muted); }
.avail-ring-wrap { display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.avail-big { font-size: var(--fs-9xl); font-weight: 300; line-height: 1; }
.avail-sub { font-size: var(--fs-sm); color: var(--muted); }

/* ═══════════════════════════════════════════════
   MODULE: knowledge base – spezifische Styles
═══════════════════════════════════════════════ */
.kb-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 1.25rem; }
.kb-search {
  flex: 1; background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--r); padding: 7px 12px 7px 34px;
  font-family: var(--font); font-size: var(--fs-md); color: var(--text);
  outline: none; transition: border-color .15s; position: relative;
}
.kb-search:focus { border-color: var(--blue); }
.kb-search::placeholder { color: var(--muted); }
.kb-search-wrap { position: relative; flex: 1; }
.kb-search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.kb-filter {
  background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--r);
  padding: 6px 10px; font-family: var(--font); font-size: var(--fs-base); color: var(--muted);
  outline: none; cursor: pointer;
}
.kb-filter:focus { border-color: var(--blue); color: var(--text); }
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.kb-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.125rem 1.25rem;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s;
}
.kb-card:hover { border-color: var(--border2); }
.kb-card-top { display: flex; align-items: flex-start; gap: 10px; }
.kb-cat-badge { font-size: var(--fs-xs); font-weight: 500; padding: 2px 8px; border-radius: 4px; white-space: nowrap; flex-shrink: 0; margin-top: 1px; }
.kb-title { font-size: var(--fs-md); font-weight: 500; color: var(--text); line-height: 1.4; flex: 1; }
.kb-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kb-meta-chip { font-size: var(--fs-sm); color: var(--muted); display: flex; align-items: center; gap: 4px; }
.kb-meta-chip svg { width: 11px; height: 11px; }
.kb-divider { height: 1px; background: var(--border); }
.kb-section-label { font-size: var(--fs-xs); font-weight: 500; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.kb-section-text { font-size: var(--fs-base); color: var(--text); line-height: 1.55; }
.kb-card-footer { display: flex; align-items: center; gap: 8px; }
.kb-solved-by { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.kb-date { font-size: var(--fs-sm); color: var(--muted2); margin-left: auto; }
.kb-edit-btn { font-size: var(--fs-sm); padding: 3px 9px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,10,20,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 1.5rem; backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--r-lg); width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(12px); transition: transform .2s;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg2); z-index: 1;
}
.modal-title { font-size: var(--fs-lg); font-weight: 500; flex: 1; }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; transition: color .12s; }
.modal-close:hover { color: var(--text); }
.modal-close svg { width: 16px; height: 16px; display: block; }
.modal-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.full { grid-column: 1/-1; }
.form-label { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.form-input, .form-select, .form-textarea {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--r); padding: 8px 10px;
  font-family: var(--font); font-size: var(--fs-md); color: var(--text);
  outline: none; transition: border-color .15s; width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--blue); }
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.form-select option { background: var(--bg3); }
.modal-footer {
  display: flex; align-items: center; gap: 8px; justify-content: flex-end;
  padding: 1rem 1.25rem; border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: var(--bg2);
}
.btn-primary {
  background: var(--blue); border: 1px solid var(--blue); color: #fff;
  border-radius: var(--r); padding: 6px 16px;
  font-family: var(--font); font-size: var(--fs-md); font-weight: 500;
  cursor: pointer; transition: opacity .12s;
}
.btn-primary:hover { opacity: .85; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  font-size: var(--fs-xs);
  line-height: 1;
}
.save-status { font-size: var(--fs-base); margin-right: auto; }
.save-ok  { color: var(--green); }
.save-err { color: var(--red); }


/* ══════════════════════════════════════════════════════════════
   MODULE: overview – Two-Column Dashboard (Ladestationen + EMS)
══════════════════════════════════════════════════════════════ */
.ov-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem 1.5rem;
  min-height: 0;
  flex: 1;
}
.ov-col {
  display: flex;
  flex-direction: column;
  gap: .875rem;
  min-width: 0;
  min-height: 0;
}
.ov-col-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border2);
  font-size: var(--fs-md); font-weight: 600; color: var(--text);
  letter-spacing: -.01em; flex-shrink: 0;
}
.ov-col-header svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.ov-col-header-right { color: var(--muted); }
.ov-col-header-right svg { opacity: .6; }
.ov-kpi-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex-shrink: 0;
}
/* Status widget – replaces single big value with 3 mini rows */
.top-kpi-single-card { min-height: 100%; }
.top-kpi-multi-card,
.ov-status-card { padding: .875rem 1.125rem !important; }
.top-kpi-multi-card .kpi-label,
.ov-status-card .kpi-label { margin-bottom: 10px; }
.ov-status-rows { display: flex; flex-direction: column; gap: 7px; }
.ov-status-row {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-base);
}
.ov-status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.ov-status-lbl { flex: 1; color: var(--muted); font-size: var(--fs-sm); }
.ov-status-num { font-weight: 500; font-variant-numeric: tabular-nums; font-size: var(--fs-lg); }
/* Placeholder / no-data state */
.ov-placeholder { opacity: .45; pointer-events: none; user-select: none; }
.ov-no-data {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2.5rem 1.5rem; text-align: center; gap: .5rem;
}
.ov-no-data svg { width: 32px; height: 32px; opacity: .2; }
.ov-no-data-title { font-size: var(--fs-base); color: var(--muted); font-weight: 500; }
.ov-no-data-sub { font-size: var(--fs-sm); color: var(--muted2); line-height: 1.5; }
/* Alert table panel – fills remaining height */
.ov-alert-panel { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }



/* ── Shared main topbar extras ── */
.sub-topbar {
  height: 42px; flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.ar-picker-divider { height: 1px; background: var(--border); margin: 3px 0; }
.ar-refresh-now {
  color: var(--blue) !important;
  display: flex; align-items: center; gap: 7px;
}
.ar-refresh-now svg { width: 12px; height: 12px; flex-shrink: 0; }


/* ── Sub-nav items (indented children) ── */
.nav-sub-item {
  display: flex; align-items: center; gap: 9px;
  padding: .35rem .625rem .35rem 1.75rem;
  border-radius: var(--r);
  font-size: var(--fs-sm); color: var(--muted2);
  cursor: pointer; transition: all .12s; margin-bottom: 1px;
  border: 1px solid transparent; user-select: none;
}
.nav-sub-item svg { width: 13px; height: 13px; flex-shrink: 0; }
.nav-sub-item:hover { color: var(--text); background: var(--bg3); }
.nav-sub-item.active { color: var(--text); background: var(--bg4); border-color: var(--border2); }
.nav-sub-item.soon { opacity: .38; cursor: not-allowed; pointer-events: none; }
.nav-item.soon { opacity: .38; cursor: not-allowed; pointer-events: none; }
/* Connector line between parent and sub-items */
.nav-sub-group { position: relative; }
.nav-sub-group::before {
  content: '';
  position: absolute;
  left: 18px; top: 0; bottom: 8px;
  width: 1px;
  background: var(--border2);
}

/* ── Greeting Hero ── */
.greeting-hero {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to right, var(--bg2), var(--bg3) 60%, var(--bg2));
  flex-shrink: 0;
}
.greeting-hero-left {}
.greeting-main {
  font-size: var(--fs-5xl); font-weight: 400; color: var(--text);
  letter-spacing: -.015em; line-height: 1.2;
}
.greeting-main strong { font-weight: 600; }
.greeting-detail {
  font-size: var(--fs-base); color: var(--muted); display: flex; align-items: center; gap: 6px;
}
.greeting-detail-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted2); }
.greeting-date-badge {
  font-size: var(--fs-sm); font-weight: 500;
  background: var(--bg4); border: 1px solid var(--border2);
  border-radius: 6px; padding: 3px 10px;
  color: var(--muted); white-space: nowrap; flex-shrink: 0;
  display: flex; align-items: center; gap: 6px;
}
.greeting-date-badge svg { width: 12px; height: 12px; opacity: .6; }

/* ── Topbar User Chip ── */
.topbar-user {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 6px; border-radius: var(--r);
  cursor: pointer; border: 1px solid var(--border2);
  background: var(--bg3); transition: background .12s, border-color .12s;
  position: relative; flex-shrink: 0;
}
.topbar-user:hover { background: var(--bg4); border-color: var(--border2); }
.topbar-user-avatar {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--purple) 0%, #3b82f6 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-2xs); font-weight: 700; color: #fff; letter-spacing: .02em;
}
.topbar-user-name { font-size: var(--fs-base); font-weight: 500; color: var(--text); }
.topbar-user-chevron svg { width: 11px; height: 11px; stroke: var(--muted); transition: transform .15s; }
.topbar-user.open .topbar-user-chevron svg { transform: rotate(180deg); }

/* ── User Popup (drops down from topbar) ── */
.user-popup {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 180px;
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: 0 12px 32px rgba(0,0,0,.4);
  opacity: 0; pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .15s, transform .15s;
  z-index: 200;
}
.user-popup.open { opacity: 1; pointer-events: all; transform: none; }
.user-popup-header {
  padding: .65rem .875rem; border-bottom: 1px solid var(--border);
}
.user-popup-name  { font-size: var(--fs-base); font-weight: 500; color: var(--text); }
.user-popup-role  { font-size: var(--fs-xs); color: var(--muted); margin-top: 1px; }
.user-popup-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: .5rem .875rem;
  background: none; border: none; font-family: var(--font);
  font-size: var(--fs-base); color: var(--red); cursor: pointer;
  transition: background .1s; text-align: left;
}
.user-popup-btn:hover { background: var(--red-bg); }
.user-popup-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.user-popup-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: .5rem .875rem;
  background: none; border: none; font-family: var(--font);
  font-size: var(--fs-base); color: var(--text); cursor: pointer;
  transition: background .1s; text-align: left;
}
.user-popup-item:hover { background: var(--bg4); }
.user-popup-item svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ── Profile Settings Modal ── */
.ps-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 1.25rem; }
.ps-tab {
  padding: .625rem .875rem; background: none; border: none;
  font-family: var(--font); font-size: var(--fs-base); color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color .12s, border-color .12s;
}
.ps-tab.active { color: var(--text); border-bottom-color: var(--purple); }
.ps-tab:hover:not(.active) { color: var(--text); }
.ps-section { display: none; }
.ps-section.active { display: flex; flex-direction: column; gap: 1rem; }
.ps-status { font-size: var(--fs-sm); min-height: 16px; flex: 1; }
.ps-status-ok  { color: var(--green); }
.ps-status-err { color: var(--red); }
.ps-2fa-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; background: var(--bg3); border-radius: var(--r);
  border: 1px solid var(--border);
}
.ps-policy { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.ps-policy span {
  font-size: var(--fs-xs); padding: 2px 7px; border-radius: 4px;
  background: var(--bg4); color: var(--muted);
  border: 1px solid var(--border); transition: background .15s, color .15s, border-color .15s;
}
.ps-policy span.ok { background: var(--green-bg); color: var(--green); border-color: transparent; }

.ps-badge-soon {
  font-size: var(--fs-xs); padding: 2px 7px; border-radius: 4px;
  background: var(--purple-bg); color: var(--purple); font-weight: 500; white-space: nowrap;
}

/* ── Appearance tab ── */
.ps-theme-row { display: flex; gap: 8px; }
.ps-theme-option {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px; border-radius: var(--r-lg); border: 1px solid var(--border2);
  background: var(--bg3); color: var(--muted); cursor: pointer;
  font-family: var(--font); font-size: var(--fs-base); transition: all .12s;
}
.ps-theme-option svg { width: 18px; height: 18px; }
.ps-theme-option:hover:not(.active) { color: var(--text); }
.ps-theme-option.active { color: var(--purple); border-color: var(--purple); background: var(--purple-bg); }

/* ── Auto-Refresh ── */
.autorefresh-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font); font-size: var(--fs-base); color: var(--muted);
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--r); padding: 5px 11px; cursor: pointer;
  transition: all .12s; flex-shrink: 0; position: relative;
}
.autorefresh-btn:hover { color: var(--text); }
.autorefresh-btn.active { color: var(--green); border-color: rgba(52,201,138,.35); background: var(--green-bg); }
.ar-ring {
  width: 13px; height: 13px; flex-shrink: 0;
  transform: rotate(-90deg);
}
.ar-ring-track { fill: none; stroke: var(--border2); stroke-width: 2.5; }
.ar-ring-fill  { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round;
  stroke-dasharray: 31.4; stroke-dashoffset: 31.4; transition: stroke-dashoffset .5s linear; }
.ar-label { font-variant-numeric: tabular-nums; }

/* Auto-Refresh interval picker */
.ar-picker {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 140px;
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  opacity: 0; pointer-events: none; transform: translateY(-4px);
  transition: opacity .15s, transform .15s; z-index: 200;
}
.ar-picker.open { opacity: 1; pointer-events: all; transform: none; }
.ar-picker-label { font-size: var(--fs-xs); color: var(--muted); padding: .45rem .75rem .3rem; text-transform: uppercase; letter-spacing: .06em; }
.ar-option {
  display: flex; align-items: center; justify-content: space-between;
  padding: .4rem .75rem; font-size: var(--fs-base); color: var(--text);
  cursor: pointer; transition: background .1s;
}
.ar-option:hover { background: var(--bg4); }
.ar-option.selected { color: var(--green); }
.ar-option.selected::after { content: '✓'; font-size: var(--fs-sm); }
.ar-option-off { color: var(--muted); }

/* Profile card in sidebar – HIDDEN (moved to topbar) */
.sidebar-profile { display: none; }

/* ═══════════════════════════════════════════════
   RESPONSIVE – Mobile (≤ 768px)
═══════════════════════════════════════════════ */

/* ── Mobile Bottom Nav (hidden on desktop) ── */
.mobile-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 58px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg2); border-top: 1px solid var(--border);
  z-index: 300;
}
.mbn-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  cursor: pointer; color: var(--muted);
  font-size: var(--fs-xs); font-weight: 500;
  transition: color .12s; position: relative;
  padding: 6px 0;
  -webkit-tap-highlight-color: transparent;
}
.mbn-item svg { width: 20px; height: 20px; flex-shrink: 0; transition: transform .15s; }
.mbn-item.active { color: var(--text); }
.mbn-item.active svg { transform: translateY(-1px); }
.mbn-item.active::before {
  content: ''; position: absolute; top: 0; left: 25%; right: 25%;
  height: 2px; background: var(--blue); border-radius: 0 0 3px 3px;
}
.mbn-badge {
  position: absolute; top: 5px; left: calc(50% + 6px);
  min-width: 16px; height: 16px; border-radius: 99px;
  background: var(--red); color: #fff; font-size: var(--fs-2xs); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1;
}

@media (max-width: 768px) {
  /* Allow page-level scroll on mobile */
  html, body { overflow: auto; height: auto; }
  body { display: block; min-height: 100%; }

  /* Shell fills viewport, no internal scroll */
  .shell { display: block; overflow: visible; min-height: 100svh; }

  /* Sidebar → hidden */
  .sidebar { display: none; }

  /* Main fills full width */
  .main { overflow: visible; padding-bottom: 58px; }

  /* Views: block flow, visible overflow */
  .view { display: none; flex-direction: column; overflow: visible; }
  .view.active { display: flex; min-height: calc(100svh - 48px - 58px); }
  .view-scroll { overflow: visible; padding: .875rem 1rem; }
  #view-overview .view-scroll { overflow: visible; display: block; padding: 0; }

  /* Topbar */
  --topbar: 48px;
  .topbar { height: 48px; padding: 0 .875rem; gap: 8px; }
  .topbar-title { font-size: var(--fs-md); }
  .ts { display: none; }
  .ar-label { display: none; }
  .topbar-user-name, .topbar-user-chevron { display: none; }
  .topbar-user { padding: 4px 6px; gap: 0; }

  /* Greeting hero */
  .greeting-hero { padding: .875rem 1rem; flex-direction: column; align-items: flex-start; gap: .5rem; }
  .greeting-main { font-size: var(--fs-3xl); }
  .greeting-detail { font-size: var(--fs-sm); }
  .greeting-date-badge { align-self: flex-start; font-size: var(--fs-xs); }

  /* KPI row: 2×2 */
  .kpi-row { grid-template-columns: 1fr 1fr !important; margin: .75rem 1rem .625rem !important; gap: 8px; }
  .kpi-val { font-size: var(--fs-7xl); }

  /* Overview split panels: stack vertically */
  .split { grid-template-columns: 1fr !important; overflow: visible; height: auto !important;
           margin: 0 1rem 1rem !important; gap: 10px; }
  .split-col, .split-right { min-height: 0; height: auto; }
  .split-col .panel { min-height: 280px; max-height: 55vmax; }
  .split-right { flex-direction: column; gap: 10px; }
  .split-right .panel { min-height: 200px; max-height: 50vmax; }

  /* Vorfälle view: stack instead of a fixed 2/3 - 1/3 split */
  .inc-split { overflow: visible; height: auto !important; margin: 0 1rem 1rem !important; }
  .inc-split-active   { flex: none; min-height: 280px; max-height: 55vmax; }
  .inc-split-archived { flex: none; min-height: 200px; max-height: 50vmax; }

  /* Tables: horizontal scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 440px; }
  #sessions-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #sessions-table-wrap table { min-width: 560px; }
  thead th, tbody td { white-space: nowrap; }

  /* Detail grids: single column */
  .detail-grid, .detail-grid-3 { grid-template-columns: 1fr !important; }

  /* Detail view scroll */
  #view-detail .view-scroll { padding: .875rem 1rem; }

  /* LunAI analysis grid */
  .ldr-analysis-grid { grid-template-columns: 1fr !important; }

  /* About modal */
  .about-modal { width: calc(100vw - 2rem); }

  /* Bottom nav visible */
  .mobile-bottom-nav { display: flex; }

  /* User popup anchoring on mobile */
  .user-popup { right: 0; left: auto; }
  .ar-picker  { right: 0; left: auto; }

  /* Detail card padding */
  .detail-card { padding: .875rem; }

  /* Topbar back button: icon only */
  .topbar-back span { display: none; }

  /* Health card priority/cause row: wrap on very narrow */
  .hc-meta-row { flex-wrap: wrap; }

  /* Customer dashboard: tighter panel margins, collapsed grids */
  .cust-scroll .panel { margin-left: .75rem !important; margin-right: .75rem !important; }
  .cust-grid-3   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cust-grid-2   { grid-template-columns: minmax(0, 1fr); }
  .cust-grid-211 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .cust-grid-3 { grid-template-columns: minmax(0, 1fr); }
}

/* ── Login ── */
.login-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(var(--login-tint), var(--login-tint)), var(--login-bg) center/cover no-repeat;
}
.login-overlay::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(0,10,22,.88) 0%, rgba(0,18,38,.82) 100%);
  backdrop-filter: blur(2px);
}
.login-box {
  position: relative; z-index: 1;
  width: 380px; max-width: calc(100vw - 2rem);
  background: rgba(0,28,55,.72);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 2.5rem 2.25rem;
  display: flex; flex-direction: column; gap: 1.25rem;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.login-brand {
  display: flex; align-items: center; gap: 9px;
  font-size: var(--fs-2xl); font-weight: 700; color: var(--text);
  letter-spacing: -.01em;
}
.login-brand svg { color: var(--blue); }
.login-divider { height: 1px; background: var(--border); margin: .25rem 0; }
.login-form-header { display: flex; flex-direction: column; gap: 4px; }
.login-form-title { font-size: var(--fs-4xl); font-weight: 600; color: var(--text); letter-spacing: -.02em; }
.login-form-sub { font-size: var(--fs-base); color: var(--muted); }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-label { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.login-input { width: 100%; background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--r); padding: 10px 12px; font-family: var(--font); font-size: var(--fs-md); color: var(--text); outline: none; box-sizing: border-box; transition: border-color .15s, background .15s; }
.login-input:focus { border-color: var(--blue); background: var(--bg4); }
.login-btn { width: 100%; background: var(--blue); border: none; border-radius: var(--r); padding: 10px; font-family: var(--font); font-size: var(--fs-md); font-weight: 500; color: #fff; cursor: pointer; transition: opacity .15s; margin-top: .125rem; }
.login-btn:hover { opacity: .85; }
.login-btn:disabled { opacity: .45; cursor: not-allowed; }
.login-err { font-size: var(--fs-base); color: var(--red); text-align: center; min-height: 16px; }
.login-hint { font-size: var(--fs-sm); color: var(--muted2); text-align: center; }

/* ── Customer Dashboard ─────────────────────────────────────── */
.cust-scroll { display: flex; flex-direction: column; gap: 0; padding: 0; overflow: auto; }
.cust-cards-wrap { display: flex; flex-direction: column; gap: .75rem; padding: 0 1.25rem 1.25rem; }
.cust-location-card { padding: 0; overflow: hidden; flex-shrink: 0; }
.cust-card-header { display: flex; align-items: center; gap: 1rem; padding: .875rem 1rem; cursor: pointer; transition: background .12s; user-select: none; }
.cust-card-header:hover { background: var(--bg3); }
.cust-card-title-row { display: flex; align-items: center; gap: .625rem; flex: 1; min-width: 0; }
.cust-lid-badge { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .07em; background: var(--purple-bg); color: var(--purple); padding: 3px 9px; border-radius: 99px; white-space: nowrap; flex-shrink: 0; }
.cust-loc-name { font-size: var(--fs-lg); font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-card-meta-row { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }
.cust-ems-uid { font-family: var(--mono); font-size: var(--fs-sm); color: var(--muted); }
.cust-dev-count { display: flex; align-items: center; gap: 4px; font-size: var(--fs-base); color: var(--muted); white-space: nowrap; }
.cust-card-chevron { width: 20px; height: 20px; color: var(--muted2); flex-shrink: 0; transition: transform .2s; display: flex; align-items: center; justify-content: center; }
.cust-card-chevron svg { width: 16px; height: 16px; }
.cust-dev-section { border-top: 1px solid var(--border); }
.cust-dir-badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 99px; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.cust-dir-gen  { background: var(--green-bg); color: var(--green); }
.cust-dir-cons { background: var(--red-bg);   color: var(--red);   }

/* Customer dashboard responsive sub-grids */
.cust-grid-3   { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; padding: .875rem 1rem 1rem; }
.cust-grid-2   { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: .75rem; padding: .875rem 1rem 1rem; flex: 1; min-height: 0; }
.cust-grid-211 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: .75rem; padding: .875rem 1rem 1rem; flex: 1; min-height: 0; }
.cust-grid-lunai { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; padding: .875rem 1rem 1rem; width: 100%; box-sizing: border-box; }
/* min-width:0 + overflow:hidden let chart canvases shrink with their grid cell */
.cust-grid-3 > *, .cust-grid-2 > *, .cust-grid-211 > * { min-width: 0; overflow: hidden; }
.cust-grid-lunai > * { min-width: 0; overflow: hidden; }
/* KPI sub-cards: flex column so the chart fill can grow to remaining height */
.cust-grid-2 > *, .cust-grid-211 > * { display: flex; flex-direction: column; min-height: 0; }
.cust-grid-lunai > * { display: flex; flex-direction: column; min-height: 0; }
/* Chart wrapper fills all remaining vertical space after the card title */
.cust-chart-fill { flex: 1; position: relative; min-height: 0; overflow: hidden; padding: 4px 2px 6px; }

.cust-lunai-card { background: var(--overlay-1); border: 1px solid var(--border); border-radius: var(--r); padding: .625rem .75rem; display: flex; flex-direction: column; min-height: 118px; min-width: 0; }
.cust-lunai-head { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; margin-bottom: .45rem; }
.cust-lunai-status { flex: 1; display: flex; align-items: center; justify-content: center; gap: .45rem; color: var(--muted2); }
.cust-lunai-text { font-size: 11px; line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; word-break: break-word; }
.cust-lunai-placeholder { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 11px; line-height: 1.4; text-align: center; color: var(--muted2); }

@media (max-width: 1200px) {
  .cust-grid-lunai { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cust-grid-lunai > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .cust-grid-lunai { grid-template-columns: minmax(0, 1fr); }
  .cust-grid-lunai > :last-child { grid-column: auto; }
}

/* ── Multi-Select Component ─────────────────────────────────── */
.ms-wrap { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg2); }
.ms-tags { display: flex; flex-wrap: wrap; gap: 4px; padding: .5rem .75rem; height: 60px; overflow-y: auto; align-items: flex-start; align-content: flex-start; }
.ms-tag { display: inline-flex; align-items: center; gap: 4px; background: var(--purple-bg); color: var(--purple); border: 1px solid rgba(124,58,237,.25); border-radius: 99px; font-size: var(--fs-sm); font-weight: 500; padding: 2px 8px 2px 10px; }
.ms-tag-rm { cursor: pointer; opacity: .6; font-size: var(--fs-lg); line-height: 1; }
.ms-tag-rm:hover { opacity: 1; }
.ms-search-wrap { padding: .4rem .75rem; border-top: 1px solid var(--border); }
.ms-list-head { display: flex; align-items: center; gap: 8px; padding: .3rem .75rem; background: var(--bg2); border-top: 1px solid var(--border); }
.ms-head-cell { display: inline-flex; align-items: center; gap: 3px; flex: 1; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted2); cursor: pointer; user-select: none; white-space: nowrap; transition: color .1s; }
.ms-head-cell:hover { color: var(--muted); }
.ms-head-active { color: var(--text) !important; }
.ms-sort-icon { font-size: var(--fs-2xs); opacity: .45; }
.ms-head-active .ms-sort-icon { opacity: 1; }
.ms-list { max-height: 180px; overflow-y: auto; border-top: 1px solid var(--border); }
.ms-item { display: flex; align-items: center; padding: .4rem .75rem; cursor: pointer; font-size: var(--fs-base); border-bottom: 1px solid var(--border); transition: background .1s; }
.ms-item:last-child { border-bottom: none; }
.ms-item:hover { background: var(--overlay-1); }
.ms-item-id { font-family: var(--mono); font-size: var(--fs-sm); font-weight: 500; flex-shrink: 0; margin-right: 8px; color: var(--text); }
.ms-item-label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-empty { padding: .5rem .75rem; font-size: var(--fs-base); color: var(--muted2); text-align: center; }
