/* ═══════════════════════════════════════════════════════════════════════════
   NetzCloud Analytics — Design-System
   Dunkles Standard-Theme, helles Theme über [data-theme="light"] am <html>.
   Alle Farben laufen über Tokens, damit der Themewechsel an EINER Stelle
   passiert und keine Komponente eigene Hex-Werte mitschleppt.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;

  /* ── Flächen ── */
  --bg: #0b0d12;
  --bg-grad: radial-gradient(1200px 600px at 15% -10%, rgba(88, 101, 242, 0.10), transparent 60%),
             radial-gradient(900px 500px at 100% 0%, rgba(25, 158, 112, 0.07), transparent 55%);
  --surface: #12151c;
  --surface-2: #171b24;
  --surface-3: #1d2230;
  --hover: rgba(255, 255, 255, 0.045);
  --border: #242a39;
  --border-strong: #313950;

  /* ── Text ── */
  --text: #e9ecf5;
  --text-2: #9aa2bd;
  --text-3: #646b8a;

  /* ── Marke / UI-Akzent (bewusst KEINE Datenfarbe) ── */
  --accent: #5865f2;
  --accent-hover: #6f7bf7;
  --accent-soft: rgba(88, 101, 242, 0.16);
  --on-accent: #ffffff;

  /* ── Status ── */
  --good: #16a374;
  --good-soft: rgba(22, 163, 116, 0.14);
  --bad: #ef5a56;
  --bad-soft: rgba(239, 90, 86, 0.14);
  --warn: #c98500;
  --warn-soft: rgba(201, 133, 0, 0.14);

  /* ── Datenfarben (validiert für diese Fläche, siehe README) ── */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-1-fill: rgba(57, 135, 229, 0.16);
  --series-3-fill: rgba(25, 158, 112, 0.16);
  --join: #16a374;
  --leave: #ef5a56;

  /* Sequentielle Rampe für die Heatmap (dunkle Fläche → hell) */
  --heat-0: #161b26;
  --heat-1: #10366b;
  --heat-2: #184f95;
  --heat-3: #256abf;
  --heat-4: #3987e5;
  --heat-5: #6da7ec;

  /* ── Diagramm-Chrome ── */
  --grid: rgba(255, 255, 255, 0.06);
  --axis: #646b8a;

  /* ── Form ── */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 16px 48px rgba(0, 0, 0, 0.5);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Courier New', monospace;
  --topbar-h: 60px;
  --sidebar-w: 236px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

html[data-theme='light'] {
  color-scheme: light;

  --bg: #f6f7fb;
  --bg-grad: radial-gradient(1100px 560px at 12% -12%, rgba(88, 101, 242, 0.10), transparent 60%),
             radial-gradient(900px 460px at 100% 0%, rgba(18, 136, 95, 0.07), transparent 55%);
  --surface: #ffffff;
  --surface-2: #fbfbfe;
  --surface-3: #f1f2f8;
  --hover: rgba(12, 16, 40, 0.04);
  --border: #e3e6f0;
  --border-strong: #ccd1e2;

  --text: #14172a;
  --text-2: #565d7c;
  --text-3: #838aa6;

  --accent: #4a56dd;
  --accent-hover: #3d49cc;
  --accent-soft: rgba(74, 86, 221, 0.10);

  --good: #12885f;
  --good-soft: rgba(18, 136, 95, 0.12);
  --bad: #d93a39;
  --bad-soft: rgba(217, 58, 57, 0.10);
  --warn: #9a6800;
  --warn-soft: rgba(154, 104, 0, 0.12);

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #12885f;
  --series-4: #9a6800;
  --series-1-fill: rgba(42, 120, 214, 0.14);
  --series-3-fill: rgba(18, 136, 95, 0.14);
  --join: #12885f;
  --leave: #d93a39;

  --heat-0: #eef0f7;
  --heat-1: #cde2fb;
  --heat-2: #9ec5f4;
  --heat-3: #5598e7;
  --heat-4: #2a78d6;
  --heat-5: #184f95;

  --grid: rgba(12, 16, 40, 0.07);
  --axis: #838aa6;

  --shadow-1: 0 1px 2px rgba(20, 23, 42, 0.06);
  --shadow-2: 0 6px 24px rgba(20, 23, 42, 0.07);
  --shadow-pop: 0 18px 50px rgba(20, 23, 42, 0.16);
}

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

/* Der Farbverlauf liegt in einer eigenen, fixierten Ebene statt als
   background-attachment am body – das ruckelt sonst beim Scrollen auf
   Mobilgeräten und bricht in manchen Browsern die Darstellung. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--bg);
  background-image: var(--bg-grad);
  pointer-events: none;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
canvas { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.muted { color: var(--text-2); }
.hidden { display: none !important; }

/* ═══ Ladebildschirm ═══════════════════════════════════════════════════════ */
.loader {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background: var(--bg); background-image: var(--bg-grad);
  transition: opacity 0.35s var(--ease);
}
.loader.out { opacity: 0; pointer-events: none; }
.loader-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.loader-bar { width: 160px; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.loader-bar span { display: block; height: 100%; width: 40%; border-radius: 3px; background: var(--accent); animation: slide 1.1s var(--ease) infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(320%); } }
.loader-word { font-family: var(--mono); font-size: 13px; letter-spacing: 0.22em; color: var(--text-2); text-transform: uppercase; }

/* ═══ Topbar ═══════════════════════════════════════════════════════════════ */
.topbar {
  position: sticky; top: 0; z-index: 90;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -0.02em; }
.brand svg { flex: none; }
.brand-name { white-space: nowrap; }
.brand-name small { display: block; font-size: 10px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); line-height: 1; }
.topbar-spacer { flex: 1; }

.icon-btn {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  transition: all 0.15s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-3); }
.icon-btn.only-mobile { display: none; }

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 10px 4px 4px;
  border-radius: 40px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  max-width: 210px;
}
.user-chip img { width: 26px; height: 26px; border-radius: 50%; flex: none; background: var(--surface-3); }
.user-chip span { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Server-Umschalter ── */
.switcher { position: relative; }
.switcher-btn {
  display: flex; align-items: center; gap: 9px;
  height: 36px; padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  max-width: 260px;
  transition: all 0.15s var(--ease);
}
.switcher-btn:hover { border-color: var(--border-strong); background: var(--surface-3); }
.switcher-btn .g-icon { width: 22px; height: 22px; border-radius: 7px; flex: none; }
.switcher-btn b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-btn .caret { color: var(--text-3); flex: none; }

.switcher-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 120;
  width: 290px; max-height: 380px; overflow-y: auto;
  padding: 6px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  animation: pop 0.16s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
.switcher-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: var(--r-sm); text-align: left;
  transition: background 0.12s var(--ease);
}
.switcher-item:hover { background: var(--hover); }
.switcher-item.active { background: var(--accent-soft); }
.switcher-item .g-icon { width: 26px; height: 26px; border-radius: 8px; flex: none; }
.switcher-item div { min-width: 0; flex: 1; }
.switcher-item b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-item small { color: var(--text-3); font-size: 11px; }
.switcher-sep { padding: 10px 10px 4px; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }

.g-icon { object-fit: cover; background: var(--surface-3); }
.g-fallback {
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), #8b5cf6);
  color: #fff; font-weight: 700; font-size: 12px;
}

/* ═══ Grundlayout ══════════════════════════════════════════════════════════ */
.shell { display: flex; min-height: calc(100vh - var(--topbar-h)); }

.sidebar {
  width: var(--sidebar-w); flex: none;
  padding: 20px 12px 40px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.nav-group + .nav-group { margin-top: 20px; }
.nav-label { padding: 0 10px 8px; font-size: 10px; font-weight: 650; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 11px; margin-bottom: 2px;
  border-radius: var(--r-sm);
  color: var(--text-2); font-size: 13.5px; font-weight: 550;
  text-align: left;
  transition: all 0.14s var(--ease);
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item.active .nav-ico { color: var(--accent); }
.nav-ico { width: 17px; height: 17px; flex: none; color: var(--text-3); transition: color 0.14s var(--ease); }
.nav-item:hover .nav-ico { color: var(--text-2); }
.nav-badge { margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 20px; background: var(--surface-3); color: var(--text-3); font-family: var(--mono); }

.content { flex: 1; min-width: 0; padding: 26px 28px 64px; }
.content-narrow { max-width: 1400px; margin: 0 auto; }

.scrim { display: none; }

/* ═══ Seitenkopf & Werkzeugleiste ══════════════════════════════════════════ */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-title { font-size: 24px; font-weight: 680; letter-spacing: -0.03em; line-height: 1.2; }
.page-sub { color: var(--text-2); font-size: 13.5px; margin-top: 3px; }
.page-head .grow { flex: 1; min-width: 200px; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
}
.segmented button {
  padding: 5px 11px; border-radius: 7px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  font-family: var(--mono);
  transition: all 0.14s var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-1); }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13px; font-weight: 570; color: var(--text-2);
  transition: all 0.15s var(--ease);
  white-space: nowrap;
}
.btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-3); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); border-color: transparent; }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.btn-danger:hover { background: var(--bad-soft); color: var(--bad); }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14px; border-radius: var(--r-md); }
.btn svg { flex: none; }

.field {
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  transition: border-color 0.15s var(--ease);
}
.field:focus-within { border-color: var(--accent); }
.field svg { color: var(--text-3); flex: none; }
.field input { border: none; background: none; outline: none; width: 150px; font-size: 13px; }
.field input::placeholder { color: var(--text-3); }

select.field { padding-right: 8px; cursor: pointer; }

/* ═══ Karten ═══════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head .grow { flex: 1; min-width: 120px; }
.card-title { font-size: 14px; font-weight: 620; letter-spacing: -0.01em; }
.card-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 10px 8px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.mb { margin-bottom: 16px; }

/* ═══ KPI-Kacheln ══════════════════════════════════════════════════════════ */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi {
  position: relative; overflow: hidden;
  padding: 16px 17px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.kpi::after {
  content: ''; position: absolute; inset: 0 auto auto 0; width: 100%; height: 2px;
  background: var(--kpi-color, var(--accent)); opacity: 0.85;
}
.kpi-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.kpi-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--kpi-color, var(--accent)); flex: none; }
.kpi-label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.kpi-value { font-family: var(--mono); font-size: 27px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; }
/* Rechts bleibt Platz für die Sparkline, damit sich Text und Kurve nicht
   überlagern. */
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; min-height: 20px; padding-right: 84px; flex-wrap: wrap; }
.kpi-sub { font-size: 11.5px; color: var(--text-3); }
.kpi-spark { position: absolute; right: 0; bottom: 0; width: 92px; height: 38px; opacity: 0.42; pointer-events: none; }

.delta {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: 20px;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
}
.delta-up { background: var(--good-soft); color: var(--good); }
.delta-down { background: var(--bad-soft); color: var(--bad); }
.delta-flat { background: var(--surface-3); color: var(--text-3); }

/* ═══ Diagramme ════════════════════════════════════════════════════════════ */
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 330px; }
.chart-box.short { height: 180px; }
.chart-empty {
  height: 100%; display: grid; place-items: center; text-align: center;
  color: var(--text-3); font-size: 13px; padding: 20px;
}

.legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.legend-swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }

/* ═══ Heatmap ══════════════════════════════════════════════════════════════ */
.heat { display: grid; grid-template-columns: 32px 1fr; gap: 6px; align-items: start; }
.heat-days { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; padding-top: 0; }
.heat-day { font-family: var(--mono); font-size: 10px; color: var(--text-3); height: 20px; display: flex; align-items: center; }
.heat-grid { display: grid; grid-template-rows: repeat(7, 20px); gap: 3px; min-width: 0; }
.heat-row { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
.heat-cell { border-radius: 4px; background: var(--heat-0); transition: transform 0.12s var(--ease); cursor: default; }
.heat-cell:hover { transform: scale(1.28); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--accent); z-index: 2; }
.heat-hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; margin-top: 7px; }
.heat-hour { font-family: var(--mono); font-size: 9.5px; color: var(--text-3); text-align: center; }
.heat-scale { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); margin-top: 14px; justify-content: flex-end; }
.heat-scale i { width: 13px; height: 13px; border-radius: 3px; display: block; }

/* ═══ Tabellen & Ranglisten ════════════════════════════════════════════════ */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 9px 12px;
  font-size: 10.5px; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3); white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
table.tbl th.sortable { cursor: pointer; user-select: none; }
table.tbl th.sortable:hover { color: var(--text-2); }
table.tbl th .arrow { opacity: 0; margin-left: 4px; }
table.tbl th.sorted .arrow { opacity: 1; color: var(--accent); }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--hover); }
td.right, th.right { text-align: right; }
td.num-cell { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.rank { font-family: var(--mono); font-size: 11px; color: var(--text-3); width: 34px; }
.rank-1 { color: var(--warn); font-weight: 700; }
.entity { display: flex; align-items: center; gap: 9px; min-width: 0; }
.entity img, .entity .g-fallback { width: 26px; height: 26px; border-radius: 50%; flex: none; }
.entity-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-sub { font-size: 11px; color: var(--text-3); font-family: var(--mono); }
.hash { color: var(--text-3); font-family: var(--mono); }

.meter { height: 5px; border-radius: 5px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.meter i { display: block; height: 100%; border-radius: 5px; background: var(--series-1); }
.meter.alt i { background: var(--series-3); }

/* ═══ Live-Events ══════════════════════════════════════════════════════════ */
.events { max-height: 560px; overflow-y: auto; }
.event {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  animation: fadein 0.25s var(--ease);
}
@keyframes fadein { from { opacity: 0; transform: translateY(-5px); } }
.event:last-child { border-bottom: none; }
.event-tag {
  font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em;
  padding: 2px 7px; border-radius: 5px; flex: none; min-width: 54px; text-align: center;
}
.tag-msg { background: var(--accent-soft); color: var(--accent); }
.tag-join { background: var(--good-soft); color: var(--good); }
.tag-leave { background: var(--bad-soft); color: var(--bad); }
.tag-voice { background: var(--series-3-fill); color: var(--series-3); }
.tag-mod { background: var(--warn-soft); color: var(--warn); }
.event-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-time { font-family: var(--mono); font-size: 11px; color: var(--text-3); flex: none; }

.pulse { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); }
.pulse i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 var(--good); animation: pulse 2s infinite; }
.pulse.off i { background: var(--text-3); animation: none; box-shadow: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ═══ Voice-Räume (Live) ═══════════════════════════════════════════════════ */
.vc { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; background: var(--surface-2); }
.vc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 600; font-size: 13px; }
.vc-head .count { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.vc-members { display: flex; flex-wrap: wrap; gap: 7px; }
.vc-member { display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 30px; background: var(--surface-3); font-size: 12px; }
.vc-member img, .vc-member .g-fallback { width: 20px; height: 20px; border-radius: 50%; }

/* ═══ Badges, Chips, Hinweise ══════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 30px;
  font-size: 11px; font-weight: 620;
  background: var(--surface-3); color: var(--text-2);
}
.badge-ok { background: var(--good-soft); color: var(--good); }
.badge-off { background: var(--surface-3); color: var(--text-3); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.note {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-2); line-height: 1.6;
}
.note svg { flex: none; margin-top: 2px; color: var(--text-3); }
.note b { color: var(--text); font-weight: 600; }
.note-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.note-warn svg { color: var(--warn); }

.stat-row { display: flex; flex-wrap: wrap; gap: 22px; }
.stat-row > div { min-width: 90px; }
.stat-row dt { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; margin-bottom: 3px; }
.stat-row dd { font-family: var(--mono); font-size: 17px; font-weight: 650; letter-spacing: -0.02em; }

/* ═══ Leerzustände & Skelette ══════════════════════════════════════════════ */
.empty { display: grid; place-items: center; text-align: center; padding: 54px 24px; gap: 6px; }
.empty-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); margin-bottom: 6px; }
.empty-title { font-size: 15px; font-weight: 620; }
.empty-text { font-size: 13px; color: var(--text-2); max-width: 400px; }

.skel { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-md); }
.skel::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--hover), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ═══ Fortschritt ══════════════════════════════════════════════════════════ */
.progress { height: 7px; border-radius: 7px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 7px; background: var(--accent); transition: width 0.4s var(--ease); }
.progress.indet i { width: 35% !important; animation: slide 1.2s var(--ease) infinite; }

/* ═══ Modal ════════════════════════════════════════════════════════════════ */
.modal-bg {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 20px;
  background: rgba(4, 6, 12, 0.62);
  backdrop-filter: blur(4px);
  animation: fade 0.18s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  animation: rise 0.22s var(--ease);
  max-height: 90vh; overflow-y: auto;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 0; }
.modal-head .grow { flex: 1; }
.modal-title { font-size: 17px; font-weight: 660; letter-spacing: -0.02em; }
.modal-sub { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 15px; }
.modal-foot { display: flex; gap: 9px; justify-content: flex-end; padding: 0 20px 18px; flex-wrap: wrap; }

.radio-list { display: flex; flex-direction: column; gap: 7px; }
.radio {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer; transition: all 0.14s var(--ease);
  text-align: left; /* Buttons zentrieren ihren Text sonst von selbst */
}
.radio:hover { border-color: var(--border-strong); }
.radio.on { border-color: var(--accent); background: var(--accent-soft); }
.radio-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; display: grid; place-items: center; }
.radio.on .radio-dot { border-color: var(--accent); }
.radio.on .radio-dot::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.radio div { flex: 1; }
.radio b { display: block; font-size: 13.5px; font-weight: 600; }
.radio small { color: var(--text-3); font-size: 11.5px; }

/* ═══ Toasts ═══════════════════════════════════════════════════════════════ */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex; flex-direction: column; gap: 9px; max-width: min(380px, calc(100vw - 36px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop); font-size: 13px;
  animation: toastin 0.24s var(--ease);
}
@keyframes toastin { from { opacity: 0; transform: translateX(24px); } }
.toast.out { opacity: 0; transform: translateX(24px); transition: all 0.24s var(--ease); }
.toast svg { flex: none; margin-top: 1px; }
.toast-ok svg { color: var(--good); }
.toast-err svg { color: var(--bad); }
.toast-info svg { color: var(--accent); }
.toast b { display: block; font-weight: 620; margin-bottom: 1px; }
.toast p { color: var(--text-2); font-size: 12.5px; }

/* ═══ Login ════════════════════════════════════════════════════════════════ */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; }
.login-card {
  position: relative; z-index: 2;
  width: 100%; max-width: 430px;
  padding: 38px 34px 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-2);
  text-align: center;
}
.login-logo { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 20px; background: linear-gradient(150deg, var(--accent), #8b5cf6); box-shadow: 0 10px 30px var(--accent-soft); }
.login-title { font-size: 25px; font-weight: 700; letter-spacing: -0.035em; }
.login-sub { color: var(--text-2); font-size: 13.5px; margin: 8px 0 26px; line-height: 1.6; }
.login-features { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); display: grid; gap: 11px; text-align: left; }
.login-feature { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.login-feature svg { color: var(--accent); flex: none; }
.alert { padding: 11px 14px; border-radius: var(--r-md); background: var(--bad-soft); color: var(--bad); font-size: 13px; margin-bottom: 18px; text-align: left; }

/* ═══ Serverliste ══════════════════════════════════════════════════════════ */
.servers { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 16px; }
.server {
  display: block; width: 100%; text-align: left;
  padding: 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  transition: transform 0.16s var(--ease), border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.server:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.server.off { opacity: 0.66; cursor: default; }
.server.off:hover { transform: none; box-shadow: var(--shadow-1); border-color: var(--border); }
.server-top { display: flex; align-items: center; gap: 13px; margin-bottom: 15px; }
.server-top .g-icon, .server-top .g-fallback { width: 46px; height: 46px; border-radius: 15px; flex: none; font-size: 17px; }
.server-top div { min-width: 0; flex: 1; }
.server-name { font-size: 15px; font-weight: 640; letter-spacing: -0.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 5px; }
.server-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.server-stat b { display: block; font-family: var(--mono); font-size: 16px; font-weight: 650; letter-spacing: -0.03em; }
.server-stat span { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }

/* ═══ Responsiv ════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .grid-2-1, .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .content { padding: 20px 16px 60px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .brand-name { display: none; }
  .icon-btn.only-mobile { display: grid; }
  .user-chip span { display: none; }
  .user-chip { padding: 4px; }
  .switcher-btn { max-width: 170px; }

  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; z-index: 110;
    transform: translateX(-100%);
    transition: transform 0.26s var(--ease);
    background: var(--surface);
    box-shadow: var(--shadow-pop);
  }
  .sidebar.open { transform: translateX(0); }
  .scrim { display: block; position: fixed; inset: var(--topbar-h) 0 0; z-index: 105; background: rgba(4, 6, 12, 0.55); opacity: 0; pointer-events: none; transition: opacity 0.26s var(--ease); }
  .scrim.on { opacity: 1; pointer-events: auto; }

  .kpi-value { font-size: 23px; }
  .page-title { font-size: 20px; }
  .heat-grid { grid-template-rows: repeat(7, 16px); }
  .heat-day { height: 16px; }
  .heat-hour:nth-child(even) { display: none; }
  .toasts { right: 12px; left: 12px; bottom: 12px; max-width: none; }
}
@media (max-width: 520px) {
  /* Auf schmalen Displays passt die Topbar sonst nicht mehr in eine Zeile:
     Nutzerchip weg, Servername kürzer. */
  .user-chip { display: none; }
  .switcher-btn { max-width: 132px; }
  .switcher-menu { width: min(280px, calc(100vw - 24px)); }
  .topbar { gap: 7px; padding: 0 10px; }

  .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .kpi { padding: 13px 14px 11px; }
  /* Ohne Sparkline braucht die Fußzeile auch keinen Platz mehr dafür. */
  .kpi-spark { display: none; }
  .kpi-foot { padding-right: 0; }
  .servers { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
