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

:root {
  --bg:      #f8fafc;
  --surface: #ffffff;
  --primary: #2563eb;
  --danger:  #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --border:  #e2e8f0;
  --text:    #1e293b;
  --muted:   #64748b;
}

html.dark {
  --bg:      #0f172a;
  --surface: #1e293b;
  --border:  #334155;
  --text:    #e2e8f0;
  --muted:   #94a3b8;
}

/* ── Dark-Mode-Overrides für hardcodierte Farben ─────────────────────────── */
html.dark .data-table th                { background: #243044; }
html.dark .data-table tr:hover td      { background: #243044; }
html.dark .row-clickable:hover         { background: #243044; }
html.dark .day-separator td            { background: #1a2744; }
html.dark .sidebar-link.is-active,
html.dark .sidebar-group > summary.is-active { background: #1e3a5f; color: #60a5fa; }
html.dark .sidebar-submenu a.is-active { background: #1e3a5f; color: #60a5fa; }
html.dark input[type=text],
html.dark input[type=password],
html.dark input[type=number],
html.dark input[type=email],
html.dark input[type=date]             { background: #0f172a; color: var(--text); }
html.dark input[type=date]::-webkit-calendar-picker-indicator { filter: invert(1); }
html.dark select                       { background-color: #0f172a; color: var(--text); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); }
html.dark select option                { background: #1e293b; color: var(--text); }
html.dark .btn-secondary               { background: #334155; color: var(--text); }
html.dark .alert-error                 { background: #3b1212; color: #fca5a5; border-color: #7f1d1d; }
html.dark .status-demo    { background: #1e3a8a; color: #93c5fd; }
html.dark .status-success,
html.dark .status-synced  { background: #052e16; color: #86efac; }
html.dark .status-error,
html.dark .status-failed  { background: #2d0a0a; color: #fca5a5; }
html.dark .status-pending { background: #2d2006; color: #fde68a; }
html.dark .status-offline { background: #2d1a00; color: #fcd34d; }
html.dark .heatmap-chip--off { background: #243044; border-color: var(--border); }
html.dark .heatmap-chip--gap { background: #1e293b; border-color: var(--border); }
html.dark .ping-heatmap-cell--none { background: #334155; }
html.dark .ping-detail-row td     { background: #243044; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 15px;
  min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo {
  border-radius: 6px;
  display: block;
}

.topbar-right { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.nav-logout { color: rgba(255,255,255,.85); text-decoration: none; font-size: 14px; opacity: .7; }

.topbar .dropdown .nav-account {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 5px 14px 5px 5px;
  transition: background .15s ease;
}
.topbar .nav-account::after { font-size: 12px; opacity: .8; }
.topbar .dropdown:hover .nav-account,
.topbar .dropdown[open] .nav-account { background: rgba(255,255,255,.24); color: #fff; }

.nav-account-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.nav-account-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .nav-account-name { display: none; } .nav-account { padding-right: 10px; } }

.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 90;
}

.sidebar-nav { display: flex; flex-direction: column; padding: 12px; gap: 2px; }
.sidebar-bottom {
  position: sticky;
  bottom: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.dark-mode-btn {
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  color: var(--muted);
  text-align: left;
}
.dark-mode-btn:hover { background: var(--bg); color: var(--text); }

.sidebar-link, .sidebar-group > summary {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.sidebar-group > summary::-webkit-details-marker { display: none; }
.sidebar-group > summary::after { content: "▾"; float: right; color: var(--muted); font-size: 12px; transition: transform .15s ease; }
.sidebar-group[open] > summary::after { transform: rotate(180deg); }

.sidebar-link:hover, .sidebar-group > summary:hover { background: var(--bg); }
.sidebar-link.is-active, .sidebar-group > summary.is-active { background: #eff6ff; color: var(--primary); }

.sidebar-submenu { display: flex; flex-direction: column; padding: 2px 0 4px 14px; gap: 2px; }
.sidebar-submenu a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
}
.sidebar-submenu a:hover { background: var(--bg); color: var(--text); }
.sidebar-submenu a.is-active { background: #eff6ff; color: var(--primary); font-weight: 600; }

.sidebar-overlay { display: none; }

/* ── Dropdown (generic — used in navbar and table cells) ───────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown summary::after { content: " ▾"; font-size: 11px; }

.topbar .dropdown summary { color: rgba(255,255,255,.85); font-size: 14px; }
.topbar .dropdown:hover summary, .topbar .dropdown[open] summary { color: #fff; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,.15);
  padding: 6px;
  min-width: 170px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dropdown--right .dropdown-menu { left: auto; right: 0; }
.dropdown-menu a, .dropdown-menu .dropdown-btn {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 6px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  font-family: inherit;
  cursor: pointer;
  display: block;
}
.dropdown-menu a:hover, .dropdown-menu .dropdown-btn:hover { background: var(--bg); }
.dropdown-menu form { display: block; }

/* ── Main ────────────────────────────────────────────────────────────────── */
.main-content { padding: 32px 24px; margin-left: 220px; }
h2 { font-size: 22px; font-weight: 700; margin-bottom: 20px; }
h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }

/* ── Stats ───────────────────────────────────────────────────────────────── */
.stats-row { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 28px;
  width: 200px;
  flex: 0 0 200px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; margin-bottom: 12px; }
.stat-value--ok { color: var(--success); }
.stat-value--error { color: var(--danger); }

.stat-card--link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s ease, transform .15s ease;
}
.stat-card--link:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, .1); transform: translateY(-1px); }

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}

/* ── Collapsible card (details/summary) ─────────────────────────────────── */
.card.collapsible { padding: 0; }
.card.collapsible > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card.collapsible > summary::-webkit-details-marker { display: none; }
.card.collapsible > summary h3 { margin-bottom: 0; }
.card.collapsible > summary::after {
  content: "▾";
  color: var(--muted);
  font-size: 14px;
  transition: transform .15s ease;
}
.card.collapsible[open] > summary::after { transform: rotate(180deg); }
.card.collapsible .collapsible-body { padding: 0 24px 22px; }

/* ── Manuelle Buchung: Liste statt Tabelle, damit auf schmalen Screens
   nichts horizontal gescrollt werden muss ─────────────────────────────────── */
.booking-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.booking-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.booking-item__info { display: flex; flex-direction: column; min-width: 0; }
.booking-item__name { font-weight: 500; }
.booking-item__price { color: var(--muted); font-size: 13px; }

.booking-item__stepper { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.qty-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.qty-btn:hover { background: var(--border); }
.qty-btn:active { background: var(--primary); color: #fff; border-color: var(--primary); }
.booking-item__qty {
  width: 36px;
  flex-shrink: 0;
  text-align: center;
  -moz-appearance: textfield;
}
.booking-item__qty::-webkit-inner-spin-button,
.booking-item__qty::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ── Breitere Screens: Getränkeliste nutzt die Breite statt alles
   untereinander zu stapeln (das bleibt für Mobile so) ──────────────────────── */
@media (min-width: 700px) {
  .booking-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
  }
}

/* ── Batch-Buchungen: Zwischensumme-Spalte immer zentriert, unabhängig von
   der Namenslänge (Tabellenspalten statt Cards → keine Verschiebung) ──────── */
.booking-item__subtotal { color: var(--muted); }
.batch-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-weight: 500;
}
html.dark .batch-summary { background: #0f172a; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 14px;
}

.data-table th {
  background: #f1f5f9;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
/* Auf <tr> statt <td> gesetzt: Zellen haben von Haus aus keinen eigenen
   Hintergrund, die Zeilenfarbe scheint durch — :hover setzt seinen (auf td)
   trotzdem obendrüber, ganz ohne Spezifitäts-Wettrüsten zwischen den beiden. */
.data-table--striped tbody tr:nth-child(even) { background: rgba(100, 116, 139, .06); }
html.dark .data-table--striped tbody tr:nth-child(even) { background: rgba(148, 163, 184, .07); }
.data-table tr:hover td { background: #f8fafc; }
.row-inactive td { opacity: 0.45; }
.row-clickable { cursor: pointer; }
.row-clickable:hover { background: var(--surface-alt, #f5f5f5); }
.empty { color: var(--muted); text-align: center; padding: 24px; }
.mono { font-family: monospace; font-size: 13px; }

/* ── Ping-Heatmap (/status) ─────────────────────────────────────────────── */
.ping-heatmap-block { margin-bottom: 16px; }
.ping-heatmap-row { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.ping-heatmap-rowlabel { width: 80px; flex: none; font-size: 12px; color: var(--muted); text-align: right; }
.ping-heatmap-cells { display: flex; gap: 3px; }
.ping-heatmap-cell {
  width: 14px; height: 14px; border-radius: 3px; cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.ping-heatmap-cell--ok { background: #2e7d32; }
.ping-heatmap-cell--fail { background: #c62828; }
.ping-heatmap-cell--none { background: #e2e8f0; cursor: default; }
.ping-heatmap-cell.selected { outline: 2px solid #1d4ed8; outline-offset: 1px; }
.ping-heatmap-legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-top: 10px; font-size: 13px; }
.ping-heatmap-legend .ping-heatmap-cell { display: inline-block; vertical-align: middle; margin-right: 4px; cursor: default; }
.ping-detail-panel { margin-top: 10px; min-height: 20px; }
.data-table--compact th, .data-table--compact td { padding: 6px 10px; font-size: 13px; }

/* ── Getränke-Favoriten (/account) ──────────────────────────────────────── */
.fav-pinned td { background: rgba(37,99,235,.06); }
html.dark .fav-pinned td { background: rgba(37,99,235,.12); }
.fav-pin-icon { opacity: .7; }
.fav-move-btns { display: flex; gap: 4px; justify-content: center; }

/* ── Buchungs-Detailansicht ──────────────────────────────────────────────── */
.booking-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.booking-detail-header h2 { margin-bottom: 8px; }
.booking-detail-header .button-row { margin-bottom: 0; }

.booking-meta-grid { display: flex; flex-direction: column; gap: 0; }
.bm-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.bm-row:last-child { border-bottom: none; }
.bm-row--error .bm-value { color: var(--danger); }
.bm-label {
  width: 110px;
  flex: none;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.bm-value { font-size: 14px; flex: 1; min-width: 0; word-break: break-all; }
.bm-total { font-size: 16px; font-weight: 700; }
.bm-vfid { margin-left: 10px; color: var(--muted); font-size: 13px; }
.bm-ip { color: var(--muted); font-size: 13px; margin-left: 6px; }
.vf-debug-pre {
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  margin-bottom: 10px;
  max-height: 240px;
  overflow-y: auto;
}

/* ── Getränke-Zelle (Buchungsliste) ─────────────────────────────────────────
   Jedes Getränk in eigener Zeile (div), aber ohne Umbruch innerhalb einer
   Zeile — die Tabelle wird stattdessen breiter und scrollt via
   .table-responsive horizontal, statt Namen wie "Freiburger Radler 0,33l
   (alk)" mitten im Wort/Leerzeichen umzubrechen. */
.items-cell { white-space: nowrap; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
input[type=text], input[type=password], input[type=number], input[type=email], input[type=date], select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  font-family: inherit;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  appearance: none;
  cursor: pointer;
}

.select-lg {
  padding: 12px 40px 12px 14px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 8px;
  min-width: 280px;
}

input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,.15); }

label { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; font-size: 14px; font-weight: 500; }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.button-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }

/* ── VNC-Seite (alles ohne Scrollen sichtbar — der Frame füllt den Rest) ──── */
.vnc-page {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: calc(100vh - 56px - 64px); /* Navbar (56px) + .main-content-Padding (2x32px) */
}
.vnc-page h2, .vnc-page p, .vnc-page .button-row, .vnc-page #remoteAuthForm { flex: none; margin-bottom: 0; }
.vnc-page .vnc-frame {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.row-edit-form { display: flex; gap: 6px; align-items: center; }

.day-separator td { background: #f1f5f9; color: var(--muted); font-size: 12px; font-weight: 600; padding: 5px 14px; border-bottom: 1px solid var(--border); letter-spacing: .03em; cursor: pointer; user-select: none; }
.day-toggle-icon { display: inline-block; margin-right: 6px; transition: transform .15s ease; }
.day-group.collapsed .day-toggle-icon { transform: rotate(-90deg); }
.day-group.collapsed tr:not(.day-separator) { display: none; }
.day-total { float: right; font-weight: 700; color: var(--text); }
.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.result-count { color: var(--muted); font-size: 13px; margin-bottom: 12px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn-primary:hover { opacity: .88; }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* Volle Button-Box wie .btn-primary, nur mit eigener Farbe — für alleinstehende
   Aktionen (z.B. "Override beenden"). Kombiniert mit .btn-sm (das per
   Reihenfolge unten gewinnt) ergibt sich die kompakte Variante für
   Tabellenzeilen (Retry, Löschen, Start/Stop, ...). */
.btn-danger, .btn-success, .btn-warning {
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 13px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}

.btn-danger  { background: var(--danger);  color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-secondary { background: #e2e8f0; color: var(--text); }

.action-cell { display: flex; gap: 6px; }

.account-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* ── Modal (natives <dialog>) — pro Zeile eine Person-Verwaltung statt
   mehrerer unterschiedlich breiter Buttons/Badges direkt in der Tabelle ──── */
dialog.modal {
  /* Keine eigene position: der UA-Stylesheet zentriert <dialog> beim
     showModal() über position:fixed + margin:auto — das hier zu überschreiben
     bricht die Zentrierung. fixed ist trotzdem ein containing block, der
     absolut positionierte .modal-close-Button funktioniert also weiterhin.
     margin:auto muss trotzdem explizit wieder rein, weil der globale
     *{margin:0}-Reset ganz oben in dieser Datei sonst auch hier zuschlägt
     und die Zentrierung killt (Author-CSS schlägt immer die UA-Defaults). */
  margin: auto;
  border: none;
  border-radius: 12px;
  padding: 24px;
  width: calc(100% - 40px);
  max-width: 400px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
dialog.modal::backdrop { background: rgba(15, 23, 42, .55); }
dialog.modal h3 { padding-right: 24px; margin-bottom: 12px; }
.modal-close { position: absolute; top: 14px; right: 14px; font-size: 18px; }
/* Breiter Modal-Variante fürs Radar-Scope — der 400px-Default oben ist für
   die schmalen Personen-Verwaltungs-Dialoge gedacht. */
dialog.modal--wide { max-width: min(92vw, 820px); }
.modal-status-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; }
.modal-actions .btn-secondary { width: 100%; justify-content: center; padding: 8px; }
.modal-divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* ── Radar-Scope (Live-Sonar-Ansicht, siehe radar.html) ───────────────────
   Feste Anzeigegrösse kommt per Inline-style von setupCanvas() (JS) — hier
   nur max-width als Notbremse für schmale Viewports, height:auto hält dabei
   das Seitenverhältnis (aus den width/height-Attributen des Canvas). */
.radar-scope {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  cursor: pointer;
}
.radar-scope:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
dialog.modal--wide .radar-scope { cursor: default; }

/* ── Email-Zelle (Inline-Edit) ──────────────────────────────────────────── */
.email-cell { display: flex; align-items: center; gap: 6px; min-height: 32px; }
.email-cell__value { color: var(--text); }
.email-cell__form { display: none; gap: 6px; align-items: center; }
.email-cell.is-editing .email-cell__value,
.email-cell.is-editing .email-cell__edit-btn { display: none; }
.email-cell.is-editing .email-cell__form { display: flex; }
.email-cell__input { width: 180px; }

.icon-btn {
  background: transparent;
  border: none;
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.icon-btn:hover { background: var(--bg); color: var(--primary); }

.btn-save {
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-save:hover { opacity: .88; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ── Status badges ───────────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-demo    { background: #dbeafe; color: #1e40af; }
.status-success { background: #dcfce7; color: #166534; }
.status-error   { background: #fee2e2; color: #991b1b; }
.status-pending { background: #fef9c3; color: #854d0e; }
.status-synced  { background: #dcfce7; color: #166534; }
.status-failed  { background: #fee2e2; color: #991b1b; }
.status-offline { background: #fef3c7; color: #92400e; }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; margin-top: 16px; }
.pagination a {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
}
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Radar-Heatmap ───────────────────────────────────────────────────────── */
/* Canvas wird per JS auf die tatsächliche Breite dieses Wrappers gezeichnet
   (siehe drawRadarHeatmap() in radar.html) — daher keine overflow-x-Notlösung
   mehr nötig, die Heatmap passt immer ohne Scrollen auf 100% Breite. */
.heatmap-scroll { margin-bottom: 10px; }
#radarHeatmap { display: block; width: 100%; }
.heatmap-legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.heatmap-legend .heatmap-chip:not(:first-child) { margin-left: 14px; }
.heatmap-chip {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 4px;
}
.heatmap-chip--on  { background: var(--primary); }
.heatmap-chip--off { background: #eef2f7; border: 1px solid var(--border); }
.heatmap-chip--gap { background: #ffffff; border: 1px solid var(--border); }

/* ── Umsatz-Graph ────────────────────────────────────────────────────────── */
.revenue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.range-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.range-bar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.range-btn {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.range-btn:hover { border-color: var(--primary); }
.range-btn.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.range-bar input[type=date] { padding: 6px 8px; font-size: 13px; }

.revenue-summary { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.revenue-summary-value { font-size: 28px; font-weight: 700; }

.revenue-chart-wrap { position: relative; }
.revenue-chart { display: block; width: 100%; height: 220px; overflow: visible; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis-label { fill: var(--muted); font-size: 11px; }
.chart-x-label { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.chart-bar { fill: var(--primary); }
.chart-hit { fill: transparent; cursor: pointer; }
.chart-bar.is-hover { opacity: .75; }

.revenue-tooltip {
  position: absolute;
  transform: translate(-50%, -100%) translateY(-8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .12);
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
}
.revenue-tooltip-value { font-size: 15px; font-weight: 700; color: var(--text); }
.revenue-tooltip-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.stats-table-toggle { margin-top: 14px; }
.stats-table-toggle summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.stats-table-toggle summary:hover { color: var(--text); }
.stats-table-toggle .table-responsive { margin-top: 10px; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px;
  width: 360px;
}

.login-box h1 { font-size: 20px; font-weight: 700; margin-bottom: 24px; text-align: center; }
.login-box .btn-primary { width: 100%; justify-content: center; padding: 10px; font-size: 15px; margin-top: 4px; }

/* ── Tabellen auf schmalen Screens: Spalten behalten ihre Breite, der
   Container scrollt horizontal statt die Spalten zu zerquetschen ─────────── */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 24px;
}

/* ── Mobile (Smartphones, Tablets im Hochformat) ───────────────────────────── */
@media (max-width: 900px) {
  .nav-toggle { display: block; }

  .topbar { padding: 0 12px; }

  .sidebar {
    width: 260px;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 4px 0 16px rgba(0,0,0,.15);
  }
  .sidebar.is-open { transform: translateX(0); }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 56px 0 0 0;
    background: rgba(0,0,0,.35);
    z-index: 80;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .sidebar-overlay.is-open { opacity: 1; pointer-events: auto; }

  .topbar .dropdown--right .dropdown-menu { left: auto; right: 0; max-width: calc(100vw - 24px); }

  .main-content { padding: 20px 14px; margin-left: 0; }
  h2 { font-size: 19px; }

  .vnc-page { height: calc(100vh - 56px - 40px); }

  .data-table { min-width: 560px; }

  .login-box { width: 90vw; max-width: 360px; padding: 28px 20px; }

  .stat-card { min-width: 130px; padding: 16px 18px; flex: 1 1 130px; }

  .filter-bar, .inline-form { align-items: stretch; }
  .filter-bar input, .inline-form input[type=text] { width: auto; flex: 1 1 140px; }
}
