/* ===================================================================
   NGNet v3 — Design System (Full Overhaul)
   =================================================================== */

:root {
    --primary: #0066cc;
    --primary-hover: #0052a3;
    --primary-light: #e8f0fe;
    --sidebar-bg: #1a1f2e;
    --sidebar-hover: #252b3b;
    --sidebar-text: #8892a0;
    --sidebar-active: #ffffff;
    --sidebar-width: 270px;
    --sidebar-compact-width: 60px;
    --topbar-height: 56px;
    --impersonation-height: 40px;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --tooltip-bg: var(--text);   /* dunkler Tooltip-Grund (= --text) */
    --success: #10b981;
    --success-hover: #0da472;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-hover: var(--pal-red-bg);   /* #dc2626 — identisch zur Palette */
    --danger-light: #fef2f2;
    --info: #3b82f6;
    --info-light: #eff6ff;

    /* --- Unified status palette (solid fills, AA-readable on the given text) ---
       Single source of truth for badges, alert accents, toast bars UND Buttons
       (.btn-<farbe>). *-on = readable text/foreground on top of the solid *-bg,
       *-hover = abgedunkelte Füllung für den Button-Hover-Zustand. */
    --pal-red-bg:    #dc2626; --pal-red-on:    #ffffff; --pal-red-hover:    #bb2020;   /* danger / kritisch */
    --pal-orange-bg: #ea580c; --pal-orange-on: #ffffff; --pal-orange-hover: #c64a0a;   /* warning / hoch */
    --pal-amber-bg:  #d97706; --pal-amber-on:  #ffffff; --pal-amber-hover:  #b86505;   /* mittel */
    --pal-blue-bg:   var(--primary); --pal-blue-on: #ffffff; --pal-blue-hover: var(--primary-hover);   /* info(severity niedrig) / primary — referenziert die Markenfarbe, damit btn-blue/badge-blue/Primär identisch sind */
    --pal-green-bg:  #15803d; --pal-green-on:  #ffffff; --pal-green-hover:  #116c33;   /* success */
    --pal-gray-bg:   #6b7280; --pal-gray-on:   #ffffff; --pal-gray-hover:   #5a606c;   /* muted / info-status */
    --pal-purple-bg: #7c3aed; --pal-purple-on: #ffffff; --pal-purple-hover: #6931c9;   /* review */

    --border: #e5e7eb;
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.07), 0 10px 15px rgba(0,0,0,0.1);
    --transition: 0.2s ease;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --debugbar-height: 0px;
    --font-mono: 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
    --code-bg: #1f2937;   /* dunkler Quelltext-/Pre-Hintergrund (eine Quelle) */
    --code-fg: #e5e7eb;   /* Vordergrund auf --code-bg */
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
table { border-collapse: collapse; width: 100%; }

/* --- App Layout --- */
.app-wrapper { display: flex; min-height: 100vh; }
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; margin-left: var(--sidebar-width); transition: margin-left var(--transition); padding-bottom: var(--debugbar-height); }
/* Hauptinhalt fluid über die GESAMTE verfügbare Breite (rechts neben der
   Sidebar) — keine fixe max-width / Zentrierung mehr, damit auf großen
   Auflösungen kein Platz verschenkt wird. Innen-Padding bleibt bei 24px. */
.app-content { flex: 1; padding: 24px; width: 100%; min-width: 0; }
.app-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; color: var(--text-muted); font-size: 0.85rem; }

/* Compact sidebar mode */
.sidebar-compact .sidebar { width: var(--sidebar-compact-width); }
.sidebar-compact .sidebar .sidebar-brand,
.sidebar-compact .sidebar .nav-label,
.sidebar-compact .sidebar .nav-chevron { display: none; }
.sidebar-compact .sidebar .sidebar-logo { display: none; }
.sidebar-compact .sidebar .sidebar-toggle-compact { margin: 0 auto; padding: 8px; }
.sidebar-compact .sidebar .nav-submenu { display: none !important; }
.sidebar-compact .sidebar .sidebar-header { justify-content: center; padding: 16px 8px; flex-wrap: wrap; gap: 0; }
.sidebar-compact .sidebar .nav-link,
.sidebar-compact .sidebar .nav-category-header { justify-content: center; padding: 10px 0; position: relative; }
.sidebar-compact .sidebar .nav-icon { margin: 0; }
/* Compact-Mode: Badge nicht ausblenden, sondern als kleiner Eck-Indikator am Icon
   anzeigen (z.B. Gesamtzähler/Eskalations-Alarm auch im minimierten Menü sichtbar). */
.sidebar-compact .sidebar .badge {
    position: absolute; top: 4px; right: 6px;
    min-width: 15px; height: 15px; padding: 0 3px;
    font-size: 0.6rem; line-height: 15px; border-radius: 999px;
}
.sidebar-compact .app-main { margin-left: var(--sidebar-compact-width); }

/* Toggle button icon switching: collapse (<<) visible by default, expand (>>) in compact mode */
.sidebar-toggle-compact .icon-expand { display: none; }
.sidebar-compact .sidebar .sidebar-toggle-compact .icon-collapse { display: none; }
.sidebar-compact .sidebar .sidebar-toggle-compact .icon-expand { display: inline-flex; }

/* --- Impersonation Banner --- */
.impersonation-banner {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--impersonation-height);
    background: linear-gradient(90deg, #e63946, #c5303c);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; z-index: 200; gap: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.has-impersonation .sidebar { top: var(--impersonation-height); }
.has-impersonation .app-main { padding-top: var(--impersonation-height); }

/* --- Sidebar --- */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: var(--debugbar-height);
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex; flex-direction: column;
    z-index: 100;
    transition: width var(--transition), transform var(--transition);
    /* Kein horizontales Clipping auf .sidebar selbst: sonst werden nach rechts
       zeigende Header-Tooltips (z.B. sidebar-toggle-compact) abgeschnitten.
       Das Clipping für den Breiten-Übergang übernehmen die Kinder, die tatsächlich
       überlaufen könnten: .sidebar-nav (overflow-x:hidden) und .sidebar-footer
       (overflow:hidden). Die Logos/Brands schrumpfen via flex und sind im
       Kompaktmodus display:none. */
    overflow: visible;
}
.sidebar-header {
    padding: 20px; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.sidebar-logo { max-width: 170px; width: 100%; height: auto; max-height: 48px; object-fit: contain; flex-shrink: 1; }
.sidebar-brand { font-size: 1.1rem; font-weight: 600; color: #fff; white-space: nowrap; }
.sidebar-close { display: none; background: none; border: none; color: var(--sidebar-text); font-size: 1.5rem; cursor: pointer; margin-left: auto; }
.sidebar-toggle-compact {
    background: none; border: none; color: var(--sidebar-text); cursor: pointer;
    margin-left: auto; padding: 4px; border-radius: var(--radius-sm);
    display: inline-flex; align-items: center;
    transition: color var(--transition);
}
.sidebar-toggle-compact:hover { color: #fff; }
.sidebar-toggle-compact svg { width: 16px; height: 16px; }

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; overflow-x: hidden; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-list { list-style: none; }

/* --- Menu Items --- */
.nav-item { margin: 1px 8px; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius);
    color: var(--sidebar-text); transition: all var(--transition);
    font-size: 0.9rem; white-space: nowrap; text-decoration: none;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.active > .nav-link { background: var(--primary); color: #fff; }
.nav-link.disabled { opacity: 0.5; cursor: default; }
.nav-link.disabled:hover { background: transparent; color: var(--sidebar-text); }

.nav-icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; align-items: center; }
.nav-icon svg { width: 18px; height: 18px; }
.nav-label { flex: 1; }

/* --- Menu Categories --- */
.nav-category { margin: 1px 8px; }
.nav-category-header {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius);
    color: var(--sidebar-text); transition: all var(--transition);
    font-size: 0.9rem; cursor: pointer; user-select: none; white-space: nowrap;
}
.nav-category-header:hover { background: var(--sidebar-hover); color: #fff; }
.nav-category.active > .nav-category-header,
.nav-category.active > .nav-link { color: var(--sidebar-active, #fff); font-weight: 600; background: transparent; }

.nav-chevron { margin-left: auto; display: inline-flex; transition: transform var(--transition); }
.nav-chevron svg { width: 14px; height: 14px; }
.nav-category.collapsed .nav-chevron { transform: rotate(-90deg); }

.nav-submenu {
    list-style: none;
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.3s ease;
}
.nav-category.collapsed .nav-submenu { max-height: 0; }

.nav-submenu .nav-item { margin-left: 12px; }
.nav-submenu .nav-link { font-size: 0.85rem; padding: 7px 12px; }
.nav-submenu .nav-icon { width: 16px; height: 16px; }
.nav-submenu .nav-icon svg { width: 16px; height: 16px; opacity: 0.7; }

/* --- Topbar --- */
.topbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    /* Normal niedrig (unter der Sidebar z=100), damit nach rechts zeigende
       Sidebar-Tooltips (z.B. „«" minimieren) NICHT hinter der Topbar verschwinden.
       NUR wenn ein Modal offen ist, wird die Topbar über alle Modal-Ebenen gehoben
       (Overlay 1000 / Header-Modal 2000 / Confirm 2200) — siehe body.has-modal-overlay —
       damit Header-Zeile + Tooltips dann über dem Overlay liegen. */
    position: sticky; top: 0; z-index: 50;
}
.has-impersonation .topbar { top: var(--impersonation-height); }
body.has-modal-overlay .topbar { z-index: 2300; }
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 1.1rem; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 4px; }
.hamburger svg { width: 24px; height: 24px; color: var(--text); }

.topbar-user { position: relative; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px 8px; border-radius: var(--radius); transition: background var(--transition); }
.topbar-user:hover { background: var(--bg); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.9rem; flex-shrink: 0; }
.user-name { font-weight: 500; }
.dropdown-arrow { width: 16px; height: 16px; color: var(--text-muted); transition: transform var(--transition); }

/* Dropdown */
.dropdown-menu {
    position: absolute; top: 100%; right: 0;
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    min-width: 200px; padding: 4px 0;
    display: none; z-index: 200;
}
.dropdown-menu.open { display: block; }
.dropdown-item { display: block; padding: 8px 16px; color: var(--text); transition: background var(--transition); }
.dropdown-item:hover { background: var(--bg); text-decoration: none; }
.dropdown-item.disabled { opacity: 0.5; pointer-events: none; }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.dropdown-info { padding: 8px 16px; }

/* --- Cards --- */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); }

/* --- Stats ---
   GENAU EINE Kachel-Struktur, app-weit:
       .stats-grid > .stat-card > .stat-icon (optional) + .stat-value + .stat-label
   Layout via Grid: das optionale Icon steht links und überspannt beide Textzeilen,
   Wert und Label stapeln rechts. Fehlt das Icon, kollabiert die erste Spalte (auto)
   auf 0 — dieselbe Struktur trägt also Kacheln mit und ohne Icon ohne Wrapper.
   Das Icon ist ein Inline-SVG in der Schriftfarbe (currentColor), ohne Kasten.
   Farb-Akzente am Wert laufen über die Text-Utilities (.text-danger usw.) — es
   gibt keine .stat-<farbe>-Kachelvarianten mehr. */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-card {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow);
    display: grid; grid-template-columns: auto 1fr; align-items: center;
}
/* Abstand Icon->Text als Margin am Icon (nicht als column-gap), damit Kacheln
   OHNE Icon bündig links beginnen — die leere erste Spalte erzeugt dann keinen
   Phantom-Abstand. */
.stat-icon { grid-row: 1 / span 2; width: 32px; height: 32px; margin-right: 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }
.stat-icon svg { width: 28px; height: 28px; }
.stat-value { grid-column: 2; display: block; font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-label { grid-column: 2; display: block; color: var(--text-muted); font-size: 0.85rem; }

/* Verlinkte Kachel (<a class="stat-card">): unterdrückt die globale Link-Optik
   (blaue Schrift/Unterstreichung) und ergänzt einen dezenten Hover, analog zu
   .quick-link. Früher Notify-spezifisch (a.stat-card in notify.css), jetzt global. */
a.stat-card { color: inherit; transition: border-color var(--transition), box-shadow var(--transition); }
a.stat-card:hover { text-decoration: none; border-color: var(--primary); box-shadow: var(--shadow-lg); }

/* --- Grids --- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* --- Page Header --- */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-header .text-muted { margin-top: 4px; }

/* --- Quick Links --- */
.quick-links { display: flex; flex-direction: column; gap: 8px; }
.quick-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); transition: background var(--transition); color: var(--text); }
.quick-link:hover { background: var(--bg); text-decoration: none; }
.quick-link.disabled { opacity: 0.5; pointer-events: none; }
.quick-link-icon { width: 32px; height: 32px; border-radius: var(--radius); background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 8px 16px; border: 1px solid transparent; border-radius: var(--radius);
    font-size: 0.85rem; font-weight: 500; cursor: pointer;
    transition: all var(--transition); text-decoration: none; line-height: 1.4;
    font-family: var(--font);
}
.btn:hover { text-decoration: none; }

/* Solide Farb-Buttons — EIN Klassenname pro Farbe (Farbname), aus DERSELBEN
   Palette wie die Badges (--pal-*). Text = --pal-*-on (i.d.R. weiß),
   Hover = abgedunkelte --pal-*-hover-Füllung. */
.btn-red    { background: var(--pal-red-bg);    color: var(--pal-red-on); }
.btn-red:hover    { background: var(--pal-red-hover);    color: var(--pal-red-on); }
.btn-orange { background: var(--pal-orange-bg); color: var(--pal-orange-on); }
.btn-orange:hover { background: var(--pal-orange-hover); color: var(--pal-orange-on); }
.btn-amber  { background: var(--pal-amber-bg);  color: var(--pal-amber-on); }
.btn-amber:hover  { background: var(--pal-amber-hover);  color: var(--pal-amber-on); }
.btn-blue   { background: var(--pal-blue-bg);   color: var(--pal-blue-on); }
.btn-blue:hover   { background: var(--pal-blue-hover);   color: var(--pal-blue-on); }
.btn-green  { background: var(--pal-green-bg);  color: var(--pal-green-on); }
.btn-green:hover  { background: var(--pal-green-hover);  color: var(--pal-green-on); }
.btn-gray   { background: var(--pal-gray-bg);   color: var(--pal-gray-on); }
.btn-gray:hover   { background: var(--pal-gray-hover);   color: var(--pal-gray-on); }
.btn-purple { background: var(--pal-purple-bg); color: var(--pal-purple-on); }
.btn-purple:hover { background: var(--pal-purple-hover); color: var(--pal-purple-on); }

/* Neutraler Sekundär-Button: weißer Grund + Rahmen + dunkler Text, dezenter
   Hover. EINZIGER nicht-gefüllter Button — es gibt keine Outline-×-Farbe-Kombis
   mehr; für farbige Aktionen die gefüllten .btn-<farbe>-Klassen verwenden. */
.btn-white { background: var(--card-bg); border-color: var(--border); color: var(--text); }
.btn-white:hover { background: var(--bg); border-color: var(--text-muted); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; }

/* --- Forms ---
   Einheitliche Feld-Höhe (38px), konsistenter Innenabstand, Radius und ein
   klarer Fokus-Ring. Vertikaler Rhythmus über --form-gap, damit Gruppen und
   Zeilen denselben Abstand teilen. */
:root { --form-gap: 18px; --field-h: 38px; }
.form-group { margin-bottom: var(--form-gap); }
.form-group:last-child { margin-bottom: 0; }
/* Pflichtfeld-Marker — automatisches Sternchen via Klasse statt manuell im Label-Text */
.form-group label.required::after { content: " *"; color: var(--danger); font-weight: 700; }

.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.85rem; color: var(--text); }
.form-control {
    width: 100%; min-height: var(--field-h); padding: 8px 12px;
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 0.9rem; line-height: 1.4; font-family: var(--font);
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--card-bg); color: var(--text);
}
.form-control::placeholder { color: var(--text-muted); opacity: 0.8; }
.form-control:hover { border-color: #cbd2db; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.form-control:disabled { background: var(--bg); color: var(--text-muted); cursor: not-allowed; }
.form-control.error { border-color: var(--danger); }
.form-control.error:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 15%, transparent); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%236b7280'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; cursor: pointer; }
textarea.form-control { min-height: 92px; padding: 10px 12px; resize: vertical; }
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; }
/* Passwort-Sichtbar-Toggle (Auge); JS wrappt jedes input[type=password] in .pw-wrap */
.pw-wrap { position: relative; display: block; }
.pw-wrap > .form-control { padding-right: 2.6rem; }
.pw-toggle { position: absolute; top: 0; right: 0; height: 100%; width: 2.6rem; display: flex; align-items: center; justify-content: center; padding: 0; background: none; border: 0; cursor: pointer; color: var(--text-muted); }
.pw-toggle:hover { color: var(--text); }
.pw-toggle svg { width: 18px; height: 18px; }
.form-error { font-size: 0.8rem; color: var(--danger); margin-top: 5px; font-weight: 500; }
.form-row { display: flex; gap: 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
/* hidden-Attribut durchsetzen (sonst überschreibt z.B. .alert{display:flex} es) */
[hidden] { display: none !important; }
.form-row .form-group { flex: 1; }

/* --- Tables --- */
.table-wrapper { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); background: var(--bg); position: sticky; top: 0; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--bg); }

/* --- Responsive Tabellen als Karten (≤ 768px) ---
   Generischer Mechanismus für JEDE Listen-Tabelle: app.js (initResponsiveTables)
   markiert Tabellen MIT einem <thead> per .table--cards und befüllt jede <td>
   mit einem data-label (Spaltentitel aus dem zugehörigen <th>). Unter dem
   Breakpoint wird der thead ausgeblendet und jede Zeile als eigenständige Karte
   gestapelt; jede Zelle zeigt links ihr Label, rechts den Wert. Sortier-/Filter-/
   Pagination-/Klick-Logik bleibt unberührt, da nur die Darstellung (display)
   umgebaut wird — die DOM-Struktur (tr/td) bleibt erhalten.
   Key/Value-Tabellen (.table-keyvalue) und headerlose Tabellen erhalten KEIN
   .table--cards und bleiben daher klassisch (mit horizontalem Scroll). */
@media (max-width: 768px) {
    .table--cards thead { display: none; }
    .table--cards,
    .table--cards tbody { display: block; width: 100%; }
    .table--cards tbody tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        background: var(--card-bg);
        padding: 4px 0;
        margin-bottom: 12px;
    }
    .table--cards tbody tr:last-child { margin-bottom: 0; }
    .table--cards tbody tr:hover { background: var(--card-bg); }   /* kein Hover-Tönung im Karten-Modus */
    .table--cards tbody td {
        display: flex;
        align-items: baseline;
        gap: 12px;
        padding: 7px 14px;
        border: none;
        text-align: right;
    }
    .table--cards tbody td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        text-align: left;
        font-weight: 600;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        color: var(--text-muted);
        white-space: normal;
        word-break: break-word;
    }
    /* Zellen ohne Label (leeres oder fehlendes data-label — z.B. reine
       Aktions-/Checkbox-Spalte oder die colspan-„Keine Einträge"-Zeile):
       kein Label-Pseudo, kein Phantom-Abstand. */
    .table--cards tbody td[data-label=""]::before,
    .table--cards tbody td:not([data-label])::before { content: none; }
    /* Aktions-/leere Spalten rechtsbündig … */
    .table--cards tbody td[data-label=""] { justify-content: flex-end; }
    /* … die colspan-Zeile ohne data-label (z.B. „Keine Einträge") zentriert über die volle Breite. */
    .table--cards tbody td:not([data-label]) { justify-content: center; text-align: center; }
    /* Checkbox-Spalte links ausrichten und volle Breite */
    .table--cards tbody td.cb-cell,
    .table--cards tbody td.nh-cb-cell { justify-content: flex-start; text-align: left; }
    /* row-Tönungen (Status) übersetzen sich auf die ganze Karte */
    .table--cards tbody tr.row-error { border-left: 4px solid var(--danger); }
    .table--cards tbody tr.row-warn  { border-left: 4px solid var(--warning); }
    .table--cards tbody tr.row-ok    { border-left: 4px solid var(--success); }
}

/* --- Badges ---
   EINE solide Vollfarb-Palette mit GENAU EINEM Klassennamen pro Farbe (Farbname).
   Keine semantischen Aliase, keine Severity-Stufen — Severity wird in PHP über
   den zentralen Helper sev_badge() auf eine dieser Farben gemappt
   (siehe core/View.php). Mapping-Referenz: Styleguide. */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; white-space: nowrap; line-height: 1.3; }
/* Versteckte Badges (z.B. Menü-Badge bei Zähler 0) wirklich ausblenden — .badge
   setzt display:inline-flex und würde das [hidden]-Attribut sonst überstimmen. */
.badge[hidden] { display: none !important; }

.badge-red    { background: var(--pal-red-bg);    color: var(--pal-red-on); }
.badge-orange { background: var(--pal-orange-bg); color: var(--pal-orange-on); }
.badge-amber  { background: var(--pal-amber-bg);  color: var(--pal-amber-on); }
.badge-blue   { background: var(--pal-blue-bg);   color: var(--pal-blue-on); }
.badge-green  { background: var(--pal-green-bg);  color: var(--pal-green-on); }
.badge-gray   { background: var(--pal-gray-bg);   color: var(--pal-gray-on); }
.badge-purple { background: var(--pal-purple-bg); color: var(--pal-purple-on); }

/* Mehrere Badges (ggf. mit Text) nebeneinander: einheitlicher Abstand und sauberer
   Umbruch, statt sich auf HTML-Whitespace zu verlassen. Generisch — z.B. in dl-grid-
   dd-Zellen (Zwei-Faktor: TOTP + Geräteschlüssel), Rollen, Namens-Badges, Tabellen. */
.badge-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* --- Alerts ---
   Eine Basis + Typ-Akzent aus der gemeinsamen Palette: getönter Hintergrund,
   farbiger LINKER Akzentrand und ein führendes Typ-Icon (SVG in Typfarbe).
   Text bleibt dunkel und gut lesbar — Alerts tragen ganze Sätze.
   --alert-accent steuert Rand + Icon, --alert-tint den Hintergrund. */
.alert {
    position: relative;
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px 12px 14px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--alert-accent, var(--text-muted));
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem; line-height: 1.5;
    color: var(--text);
    background: var(--alert-tint, var(--bg));
}
.alert::before {
    content: '';
    flex-shrink: 0;
    width: 18px; height: 18px; margin-top: 1px;
    background-color: var(--alert-accent, var(--text-muted));
    -webkit-mask: var(--alert-icon) center / contain no-repeat;
    mask: var(--alert-icon) center / contain no-repeat;
}
/* Farbnamen-Varianten (analog zu Badges/Buttons): green/red/orange/blue.
   Semantik-Mapping success→green, error→red, warning→orange, info→blue
   passiert beim Rendern (Flash-Partial / Styleguide). */
.alert-green, .alert-success {
    --alert-accent: var(--pal-green-bg);
    --alert-tint: #f0fdf4;
    --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
}
.alert-red, .alert-error, .alert-danger {
    --alert-accent: var(--pal-red-bg);
    --alert-tint: var(--danger-light);
    --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M15 9l-6 6M9 9l6 6'/%3E%3C/svg%3E");
}
.alert-orange, .alert-warning {
    --alert-accent: var(--pal-orange-bg);
    --alert-tint: #fff7ed;
    --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E");
}
.alert-blue, .alert-info {
    --alert-accent: var(--pal-blue-bg);
    --alert-tint: var(--info-light);
    --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E");
}

/* --- Strukturierte Alert-Ansicht (Alertmanager-Mails u.ä.) ---
   Eigenständige Komponente (NICHT die getönte .alert-Notice oben): rendert
   eine Gruppe gleichartiger Alerts als gestapelte, umrandete Karten.
       .alert-summary  — Kopfzeile (Status-Badge + Alertname + Anzahl)
       .alert-block    — eine Karte pro Einzel-Alert
       .alert-block-head — Flex-Zeile mit Severity-/Status-Badge + .alert-instance
       .alert-instance — <code> mit Instance/Host-URL (monospace, umbruchsicher)
   Labels/Annotations stehen in einer .table.table-keyvalue darin. */
.alert-summary {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    margin-bottom: 14px;
    font-size: 0.95rem;
}
.alert-block {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    background: var(--card-bg);
    margin-bottom: 12px;
}
.alert-block:last-of-type { margin-bottom: 0; }
.alert-block-head {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    margin-bottom: 10px;
}
.alert-instance {
    font-family: var(--font-mono); font-size: 0.8rem;
    background: var(--bg); color: var(--text); border: none;
    padding: 2px 8px; border-radius: var(--radius-sm);
    word-break: break-all; overflow-wrap: anywhere;
}

/* --- Key/Value-Tabelle ---
   Zweispaltige Label/Wert-Tabelle (<tr><th>Label</th><td>Wert</td>), ohne
   <thead>. Wird von initResponsiveTables() bewusst NICHT zur Karten-Tabelle
   umgebaut. Label-Spalte schmal, oben ausgerichtet, gedämpft; Werte
   umbruchsicher (lange URLs/Fingerprints). */
.table-keyvalue { font-size: 0.85rem; }
.table-keyvalue th,
.table-keyvalue td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    text-align: left;
}
.table-keyvalue th {
    width: 1%; white-space: nowrap;
    font-weight: 600; color: var(--text-muted);
    text-transform: none; letter-spacing: 0; background: transparent;
    position: static;
}
.table-keyvalue td { color: var(--text); word-break: break-word; overflow-wrap: anywhere; }
.table-keyvalue tr:last-child th,
.table-keyvalue tr:last-child td { border-bottom: none; }
.table-keyvalue tr:hover { background: transparent; }   /* keine Zeilen-Tönung wie in Listen */

/* Innerhalb einer Alert-Karte: Tabelle bündig, Werte dürfen umbrechen */
.alert-block .table-keyvalue { margin-top: 4px; }

/* Mobile: Key/Value-Tabelle als gestapelte Label-über-Wert-Paare, damit lange
   Werte nicht in einer zu schmalen Spalte zerlaufen (kein horizontaler Scroll). */
@media (max-width: 768px) {
    .table-keyvalue,
    .table-keyvalue tbody,
    .table-keyvalue tr,
    .table-keyvalue th,
    .table-keyvalue td { display: block; width: 100%; }
    .table-keyvalue tr {
        padding: 8px 0;
        border-bottom: 1px solid var(--border);
    }
    .table-keyvalue tr:last-child { border-bottom: none; }
    .table-keyvalue th {
        padding: 0 0 2px; white-space: normal;
        font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.4px;
    }
    .table-keyvalue td { padding: 0; border-bottom: none; }
    .alert-block { padding: 12px 14px; }
}

/* --- Toast ---
   Jeder Toast hat einen Fortschrittsbalken (.toast-progress) in der Typfarbe,
   der über --toast-duration von voll auf leer läuft. Bei Hover (oder gesetzter
   .paused-Klasse) pausieren Balken UND der echte Auto-Close-Timer; der JS-Timer
   in app.js trackt die verstrichene Zeit und läuft mit der Restzeit weiter. */
.toast-container { position: fixed; top: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
    pointer-events: auto; position: relative; overflow: hidden;
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px; border-radius: var(--radius);
    background: var(--card-bg); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg); min-width: 300px; max-width: 480px;
    animation: toast-in 0.3s ease;
}
/* Farbnamen-Varianten (analog zu Badges/Buttons/Alerts). Semantik-Mapping
   success→green, error→red, warning→orange, info→blue passiert beim Rendern
   (showToast/armToast in app.js bzw. toast.php). --toast-accent färbt zugleich
   den Fortschrittsbalken. */
.toast-green  { border-left: 4px solid var(--pal-green-bg);  --toast-accent: var(--pal-green-bg); }
.toast-red    { border-left: 4px solid var(--pal-red-bg);    --toast-accent: var(--pal-red-bg); }
.toast-orange { border-left: 4px solid var(--pal-orange-bg); --toast-accent: var(--pal-orange-bg); }
.toast-blue   { border-left: 4px solid var(--pal-blue-bg);   --toast-accent: var(--pal-blue-bg); }
.toast-content { flex: 1; }
.toast-message { font-size: 0.9rem; }
.toast-close { background: none; border: none; cursor: pointer; font-size: 1.2rem; color: var(--text-muted); padding: 0 4px; }
.toast.removing { animation: toast-out 0.3s ease forwards; }

/* Fortschrittsbalken unten am Toast */
.toast-progress {
    position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
    transform-origin: left center;
    background: var(--toast-accent, var(--primary));
    animation: toast-progress var(--toast-duration, 5000ms) linear forwards;
}
.toast:hover .toast-progress,
.toast.paused .toast-progress { animation-play-state: paused; }
@keyframes toast-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@keyframes toast-in { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }

/* --- Modal --- */
.modal-overlay {
    /* Beginnt erst UNTER der Topbar, damit die Header-Zeile sichtbar + klickbar bleibt
       und Klicks darauf nicht als Backdrop-Klick (Schließen) zählen. */
    position: fixed; top: var(--topbar-height); left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none; align-items: center; justify-content: center;
    z-index: 1000; padding: 24px;
}
.has-impersonation .modal-overlay { top: calc(var(--impersonation-height) + var(--topbar-height)); }
.modal-overlay.open { display: flex; }
/* Modal-Stapelung: aus dem Header geöffnete Modals (Hilfe, Fehler melden, …)
   liegen IMMER über normalen Seiten-Modals. Confirm-Dialoge wiederum über allem. */
.modal-overlay--top { z-index: 2000; }
#confirm-overlay { z-index: 2200; }
.modal {
    background: var(--card-bg); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 100%;
    display: flex; flex-direction: column; animation: modal-in 0.2s ease;
}
/* Modal am Header per Drag & Drop verschiebbar (JS: initModalDrag). */
.modal-header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; cursor: move; user-select: none; touch-action: none; }
.modal-header.is-dragging { cursor: grabbing; }
.modal-header h3 { font-size: 1.1rem; font-weight: 600; margin: 0; }
.modal-header .modal-close { background: none; border: none; cursor: pointer; font-size: 1.5rem; color: var(--text-muted); padding: 0 4px; line-height: 1; }
.modal-header .modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }
/* Sticky-Footer für Buttons in (AJAX-)Modals, deren Inhalt im scrollenden .modal-body
   liegt: bleibt beim Scrollen unten sichtbar, bündig an den Modal-Rändern.
   REGEL: Buttons in Modals gehören immer in einen .modal-sticky-footer. */
.modal-sticky-footer {
    flex-shrink: 0;
    padding: 14px 24px;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
@keyframes modal-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* --- Login --- */
.login-body { background: var(--bg); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-container { width: 100%; max-width: 400px; padding: 24px; }
.login-card { background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 40px 32px; }
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { max-width: 280px; width: 100%; height: auto; max-height: 80px; margin-bottom: 20px; object-fit: contain; }
.login-header h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.login-form { margin-top: 24px; }
.login-alt { text-align: center; margin-top: 16px; }
.login-footer { text-align: center; margin-top: 24px; font-size: 0.8rem; }

/* --- Error pages --- */
.error-page { text-align: center; padding: 80px 24px; }
.error-page h1 { font-size: 5rem; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.error-page p { color: var(--text-muted); margin-bottom: 24px; font-size: 1.1rem; }
.error-page-title { font-size: 4rem; margin: 0; color: var(--primary); font-weight: 800; }

/* --- Pagination --- */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 14px 16px; }
.pagination-btn, a.pagination-btn {
    padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--card-bg); cursor: pointer; transition: all var(--transition);
    font-family: var(--font); font-size: 0.85rem; color: var(--text); text-decoration: none;
}
.pagination-btn:hover { background: var(--bg); }
.pagination-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Filter bar ---
   Standard-Aufbau einer Filterzeile (für alle Listen-Seiten gleich):
   [ 🔍 Suchfeld (links, wächst) ] [ Dropdown-Filter … ] [ Eintrags-Zähler (ganz rechts) ]
   - Suche: .search-field mit Lupen-Icon (links), erstes/linkes Element, global.
   - Zähler: .filter-info (margin-left:auto) rechts — die Pagination-Logik (app.js)
     rendert "X–Y von Z" dorthin, wenn ein Slot data-pagination-info-for="<tableId>"
     existiert (sonst Fallback unter die Tabelle). */
.filter-bar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-bar .form-control { width: auto; min-width: 180px; padding: 7px 12px; font-size: 0.85rem; }
.filter-bar .form-control:first-child { flex: 2; min-width: 360px; }
/* Buttons in der Filter-Leiste teilen die Feld-Höhe (--field-h), damit alles
   – auch ein btn-sm – exakt auf einer Linie mit den Inputs/Selects sitzt. */
.filter-bar .btn { min-height: var(--field-h); }

/* Filterzeile direkt als Card-Header: füllt die Breite, kein doppelter Abstand. */
.card-header > .filter-bar { margin-bottom: 0; flex: 1 1 auto; }

/* Suchfeld mit Lupen-Icon (links innen). Wiederverwendbares linkes Element der
   Filterzeile — wächst, Text mit Einzug hinter dem Icon. */
.search-field { position: relative; display: inline-flex; align-items: center; flex: 1 1 320px; min-width: 220px; }
.search-field .search-icon { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.search-field .form-control { width: 100%; min-width: 0; padding-left: 36px; }

/* Eintrags-Zähler ("X–Y von Z") rechts in der Filterzeile statt unter der Tabelle.
   margin-left:auto schiebt den Zähler an den rechten Rand, unabhängig davon ob
   die .search-field davor wächst (flex) — der freie Raum landet immer links vom
   Zähler. flex-shrink:0 verhindert ein Umbrechen des Textes selbst. */
.filter-info { margin-left: auto; font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* Filterzeile auf schmalen Screens: alle Controls werden volle Breite und stapeln
   sauber untereinander (flex-wrap greift bereits). Damit der Zähler nicht
   rechtsbündig allein in einer eigenen Zeile "hängt", verliert er hier sein
   margin-left:auto und reiht sich linksbündig unter die Filter ein. */
@media (max-width: 540px) {
    .filter-bar .search-field,
    .filter-bar .form-control,
    .filter-bar .form-control:first-child { flex: 1 1 100%; min-width: 0; }
    .filter-info { margin-left: 0; }
}

/* --- Favorites --- */
.nav-favorite-star { color: var(--warning); font-size: 0.75rem; margin-left: auto; padding-right: 4px; flex-shrink: 0; line-height: 1; }

.topbar-favorite {
    background: none; border: none; cursor: pointer; padding: 4px;
    display: inline-flex; align-items: center; border-radius: var(--radius-sm);
    transition: all var(--transition); position: relative;
}
.topbar-favorite svg { width: 20px; height: 20px; }
.topbar-favorite .star-filled { display: none; }
.topbar-favorite .star-outline { display: inline-flex; color: var(--text-muted); }
.topbar-favorite:hover .star-outline { color: var(--warning); }
.topbar-favorite.is-favorite .star-filled { display: inline-flex; }
.topbar-favorite.is-favorite .star-outline { display: none; }
.topbar-favorite:hover { transform: scale(1.15); }
/* --- Topbar Action Buttons (Help, Bug Report) --- */
.topbar-action-btn {
    background: none; border: none; cursor: pointer; padding: 4px;
    display: inline-flex; align-items: center; border-radius: var(--radius-sm);
    transition: all var(--transition); color: var(--text-muted);
}
.topbar-action-btn svg { width: 18px; height: 18px; }
.topbar-action-btn:hover { color: var(--text); transform: scale(1.15); }
#topbar-help-btn:hover { color: var(--primary); }
#topbar-bug-btn:hover { color: var(--danger); }

/* === Debug Bar === */
.debugbar {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #1e1e2e; color: #cdd6f4;
    font-family: var(--font-mono); font-size: 12px;
    z-index: 10000; box-shadow: 0 -4px 12px rgba(0,0,0,0.3);
    height: 300px; display: flex; flex-direction: column;
}
.debugbar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 12px; background: #181825;
    border-bottom: 1px solid #313244; flex-shrink: 0;
}
.debugbar-tabs { display: flex; gap: 2px; }
.debugbar-tab {
    background: transparent; border: none; color: #6c7086;
    padding: 4px 10px; cursor: pointer; font-family: var(--font-mono);
    font-size: 11px; border-radius: 4px; transition: all 0.15s;
}
.debugbar-tab:hover { color: #cdd6f4; background: #313244; }
.debugbar-tab.active { color: #89b4fa; background: #313244; }
.debugbar-summary { display: flex; gap: 16px; color: #6c7086; font-size: 11px; }
.debugbar-summary span { display: inline-flex; align-items: center; }
.debugbar-close {
    background: none; border: none; color: #6c7086; cursor: pointer;
    font-size: 18px; padding: 0 6px; transition: color 0.15s;
}
.debugbar-close:hover { color: #f38ba8; }
.debugbar-body { overflow-y: auto; flex: 1; }
.debugbar-panel { display: none; padding: 10px 14px; }
.debugbar-panel.active { display: block; }
.debugbar-table { width: 100%; border-collapse: collapse; }
.debugbar-table th, .debugbar-table td {
    padding: 4px 10px; text-align: left; border-bottom: 1px solid #313244;
    font-size: 11px; vertical-align: top;
}
.debugbar-table th { color: #6c7086; font-weight: 600; }
.debugbar-table td:first-child { color: #89b4fa; white-space: nowrap; font-weight: 500; }
.debugbar-sql { word-break: break-all; color: #a6e3a1; }
.debugbar-pre {
    background: #11111b; padding: 10px; border-radius: 4px;
    overflow-x: auto; color: #cdd6f4; font-size: 11px;
    max-height: 300px; white-space: pre-wrap;
}
.debugbar h4 { color: #89b4fa; margin: 10px 0 6px; font-size: 12px; }

/* --- Utilities --- */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.85rem; }
.text-nowrap { white-space: nowrap; }
.font-mono { font-family: var(--font-mono); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.ms-auto { margin-left: auto; }   /* schiebt ein Flex-Kind nach rechts (z.B. Löschen-Button im modal-sticky-footer) */
.p-1 { padding: 8px; } .p-2 { padding: 16px; } .p-3 { padding: 24px; }
.d-flex { display: flex; } .align-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Additional Utilities --- */
.card-body-flush { padding: 0; }
.d-inline { display: inline; }
.icon-sm { width: 16px; height: 16px; }
.columns-3 { columns: 3; gap: 20px; }
.truncate-inline { max-width: 200px; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-140 { width: 140px; }
/* Impersonation-„Zurück"-Button: heller Outline-Button auf rotem Banner.
   Hover füllt mit einem leicht durchscheinenden Weiß (statt --bg, das den
   weißen Text unlesbar machte). Text bleibt in beiden Zuständen weiß und
   kontrastreich. */
.btn-impersonation-stop { color: #fff; background: transparent; border-color: rgba(255,255,255,.55); margin-left: 12px; }
.btn-impersonation-stop:hover { color: #fff; background: rgba(255,255,255,.18); border-color: #fff; }
/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .sidebar-toggle-compact { display: none !important; }
    .hamburger { display: flex; }
    .app-main { margin-left: 0 !important; }
    .app-content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 1.2rem; }
    .form-row { flex-direction: column; gap: 0; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .toast-container { left: 16px; right: 16px; top: 16px; }
    .toast { min-width: unset; }
    .user-name { display: none; }
    .debugbar { font-size: 10px; }
    .sidebar-compact .app-main { margin-left: 0 !important; }
}

@media (max-width: 480px) {
    .login-card { padding: 28px 20px; }
}

/* --- Compact Sidebar Flyout --- */
.sidebar-compact .nav-category,
.sidebar-compact .nav-item { position: relative; }

.sidebar-compact .nav-category:hover > .nav-flyout,
.sidebar-compact .nav-item:hover > .nav-flyout { display: block; }

/* Extend hover zone to bridge gap between icon and flyout */
.sidebar-compact .nav-category > .nav-flyout::before,
.sidebar-compact .nav-item > .nav-flyout::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 0;
    width: 20px;
    height: 100%;
}

.nav-flyout {
    display: none;
    position: fixed;
    left: var(--sidebar-compact-width);
    top: auto;
    min-width: 220px;
    background: var(--sidebar-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0 var(--radius) var(--radius) 0;
    box-shadow: var(--shadow-lg);
    padding: 8px 0;
    z-index: 150;
}
.nav-flyout-title {
    padding: 8px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.4);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 4px;
    white-space: nowrap;
}
.nav-flyout .nav-link {
    justify-content: flex-start;
    padding: 8px 16px;
    gap: 10px;
    white-space: nowrap;
}
.nav-flyout .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}
.nav-flyout .nav-label { display: inline !important; }
.nav-flyout .nav-icon { display: inline-flex; width: 16px; height: 16px; }
.nav-flyout .nav-icon svg { width: 16px; height: 16px; opacity: 0.7; }
.nav-flyout .nav-favorite-star { display: inline !important; }
/* Badges im Flyout normal/inline (rechtsbündig) statt als Compact-Eck-Indikator. */
.sidebar-compact .sidebar .nav-flyout .badge {
    position: static; margin-left: auto;
    min-width: 0; height: auto; padding: 3px 9px;
    font-size: 0.72rem; line-height: 1.3; border-radius: 999px;
}

/* Sidebar footer with version */
.sidebar-footer {
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.75rem;
    color: rgba(255,255,255,0.25);
    flex-shrink: 0;
}

/* Form labels (alias) */
.form-label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 0.9rem; }

/* Modal footer button spacing */
.modal-footer .btn { min-width: 100px; }

/* Buttons in Modal-Footern haben IMMER die Standardgröße (.btn = 8px 16px / .85rem)
   — durchgängig konsistent über alle Modals; ein versehentliches .btn-sm wird hier
   neutralisiert. (Konvention, siehe ngnet-modal-conventions Memory.) */
.modal-sticky-footer .btn,
.modal-footer .btn { padding: 8px 16px; font-size: 0.85rem; }

/* --- Tooltip (lightweight, CSS-only) --- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--tooltip-bg);
    color: #fff;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: pre-wrap;
    max-width: 420px;
    text-align: left;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 9999;
}
[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--tooltip-bg);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 9999;
}
[data-tooltip]:hover::after,
[data-tooltip]:hover::before { opacity: 1; }

/* Tooltip position variants */
[data-tooltip-pos=right]::after { bottom: auto; left: calc(100% + 6px); top: 50%; transform: translateY(-50%); }
[data-tooltip-pos=right]::before { bottom: auto; left: calc(100% + 2px); top: 50%; transform: translateY(-50%); border: 4px solid transparent; border-right-color: var(--tooltip-bg); }
[data-tooltip-pos=bottom]::after { bottom: auto; top: calc(100% + 6px); }
[data-tooltip-pos=bottom]::before { bottom: auto; top: calc(100% + 2px); border: 4px solid transparent; border-bottom-color: var(--tooltip-bg); }
[data-tooltip-pos=left]::after { bottom: auto; left: auto; right: calc(100% + 6px); top: 50%; transform: translateY(-50%); }
[data-tooltip-pos=left]::before { bottom: auto; left: auto; right: calc(100% + 2px); top: 50%; transform: translateY(-50%); border: 4px solid transparent; border-left-color: var(--tooltip-bg); }

/* Sort indicators */
.table-sortable th[data-sort] { cursor: pointer; user-select: none; position: relative; padding-right: 24px; }
.table-sortable th[data-sort]:hover { color: var(--text); }
.table-sortable th[data-sort]::after { content: '⇅'; position: absolute; right: 8px; color: var(--border); font-size: 0.7rem; }
.table-sortable th.sort-asc::after { content: '↑'; color: var(--primary); }
.table-sortable th.sort-desc::after { content: '↓'; color: var(--primary); }

/* Pagination info */
.pagination-info { text-align: center; font-size: 0.8rem; color: var(--text-muted); margin-top: 12px; }


/* --- Profile / Account page + shared utilities --- */
.card-stack > .card + .card { margin-top: 20px; }
.card--narrow { max-width: 640px; }
.card--padded { padding: 20px; }

/* Masonry-Card-Layout (CSS-Columns): Cards füllen Spalten vertikal auf, die nächste
   Card beginnt direkt unter der vorigen statt erst nach der höchsten Card der Zeile.
   Spaltenanzahl ergibt sich aus der Breite (>= ~320px je Spalte), responsiv. */
.card-masonry { columns: 320px; column-gap: 20px; }
.card-masonry > .card { break-inside: avoid; -webkit-column-break-inside: avoid; margin: 0 0 20px; }
/* Card über die volle Masonry-Breite spannen (für Cards mit breiten Tabellen,
   die in eine schmale 320px-Spalte nicht passen — sonst werden Aktions-Buttons
   abgeschnitten). column-span: all unterbricht den Spaltenfluss; die Cards davor
   und danach füllen die Spalten normal weiter. Auf Mobile greift zusätzlich die
   .table--cards-Stapelung (≤768px), sodass Buttons umbrechen statt zu überlaufen. */
.card-masonry > .card--span { column-span: all; -webkit-column-span: all; }
.card--padded > h2:first-child,
.card--padded > h3:first-child { margin-top: 0; }

/* Karten-Raster (z.B. Profil): vorhersehbare Spalten + sauberes Full-Width-Spannen
   einzelner Cards — anders als CSS-columns kein zerrissenes Layout. */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 20px;
    align-items: start;
}
.card-grid > .card { margin: 0; }
.card-grid > .card--span { grid-column: 1 / -1; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; max-width: 1080px; }
.profile-grid > .card { margin: 0; }
.profile-grid > .card--span { grid-column: 1 / -1; }
@media (max-width: 900px) { .profile-grid { grid-template-columns: 1fr; } }

/* Definition list: compact key/value grid */
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.dl-grid dt { font-weight: 600; color: var(--text-muted); font-size: 0.85rem; }
.dl-grid dd { margin: 0; color: var(--text); word-break: break-word; }

/* Inline form: label above control, button next to it, wraps on mobile */
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin: 0; flex: 0 0 180px; }
.form-inline .btn { white-space: nowrap; }
@media (max-width: 480px) {
    .form-inline { flex-direction: column; align-items: stretch; }
    .form-inline .form-group { flex: 1 1 auto; }
    .form-inline .btn { width: 100%; }
}

/* One-time-password / TOTP input — large, spaced, centered digits */
.form-control--otp {
    font-size: 1.4rem;
    letter-spacing: 4px;
    text-align: center;
    font-family: var(--font-mono);
}

/* QR-Code embed (white background with soft border) */
.qr-embed {
    text-align: center;
    margin: 24px 0;
    padding: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.qr-embed img {
    max-width: 240px;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
}

/* Manual secret fallback block */
.totp-manual { margin-top: 16px; }
.totp-manual > summary { font-weight: 600; padding: 4px 0; }
.totp-manual-body { margin-top: 12px; padding: 12px; background: var(--bg); border-radius: var(--radius); border: 1px solid var(--border); }
.totp-manual-body p { margin: 0 0 8px 0; }
.totp-manual-body p + p { margin-top: 12px; font-size: 0.85rem; color: var(--text-muted); }
.totp-manual-body ul { margin: 0; padding-left: 20px; font-size: 0.85rem; color: var(--text-muted); }
.totp-manual-body code {
    display: inline-block;
    padding: 8px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    letter-spacing: 1px;
    user-select: all;
    word-break: break-all;
}

/* Vertikaler Rhythmus innerhalb der gepolsterten Cards (Profil, Account u. ä.):
   Das globale Reset (* { margin:0 }) entfernt jeden Default-Abstand, daher hier
   EINMAL zentral den Fluss zwischen Überschriften, Absätzen, Formularen, Tabellen
   und Aktions-Buttons setzen — statt margin-top je Element inline zu wiederholen.
   Greift NUR direkte Kinder, damit verschachtelte Komponenten (Tabelle, dl-grid,
   collapse-box …) ihren eigenen Innenabstand behalten. Selektor in :where()
   gehalten (Spezifität 0) — explizite .mt-*-Utilities am Element gewinnen immer. */
.card--padded > :where(* + *) { margin-top: 14px; }
.card--padded > :where(h2 + *, h3 + *) { margin-top: 10px; }
.card--padded > :where(h3) { margin-top: 20px; font-size: 1rem; }

/* Aktions-Zelle in Tabellen: Buttons rechtsbündig, ohne Umbruch, mit Abstand.
   Auf Mobile (Karten-Modus) dürfen die Buttons umbrechen und füllen die Breite,
   damit sie nicht über die Karte hinauslaufen. */
.cell-actions { white-space: nowrap; text-align: right; }
.cell-actions .btn + .btn,
.cell-actions .btn + form,
.cell-actions form + .btn { margin-left: 6px; }
@media (max-width: 768px) {
    .table--cards .cell-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; white-space: normal; }
    .table--cards .cell-actions .btn { margin-left: 0; }
    .table--cards .cell-actions form { display: inline-flex; }
}

/* Dezenter Hinweis-/Anforderungs-Block (z. B. Passwort-Richtlinie). Getönter
   Grund aus --bg, kompakte Typografie — kein Alert (trägt keine Status-Semantik). */
.note-box {
    background: var(--bg);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: var(--text);
}
.note-box ul, .note-box ol { margin: 6px 0 0; padding-left: 20px; }
.note-box li + li { margin-top: 2px; }

/* Live-Passwort-Anforderungen: monochrome Status-Indikatoren (kein Emoji). */
ul.pw-reqs { list-style: none; margin: 8px 0 0; padding: 0; }
.pw-reqs li { display: flex; align-items: baseline; gap: 8px; margin: 0; padding: 1px 0; color: var(--text-muted); }
.pw-reqs li::before { content: '\25CB'; flex: 0 0 1em; text-align: center; font-weight: 700; color: var(--text-muted); }
.pw-reqs li.req--ok { color: var(--text); }
.pw-reqs li.req--ok::before { content: '\2713'; color: var(--pal-green-bg, #16a34a); }
.pw-reqs li.req--bad::before { content: '\2717'; color: var(--pal-red-bg, #dc2626); }
.pw-reqs li.req--info::before { content: '\00B7'; }

/* Schritt-für-Schritt-Anleitung im aufklappbaren Block (z. B. CA-Installation).
   Lebt typischerweise in einer .collapse-box; reine Lesetypografie. */
.install-guide { font-size: 0.9rem; line-height: 1.6; }
.install-guide > * + * { margin-top: 10px; }
.install-guide ol, .install-guide ul { margin: 0; padding-left: 20px; }
.install-guide li + li { margin-top: 4px; }

/* Inline-Code (Klassen, Hostnamen, Fingerprints, IBAN/BIC, Versionsstrings …).
   Eine zentrale Definition für das bisher ungestylte <code>-Element. Spezifischere
   Regeln (#help-modal-body code, .totp-manual-body code, code.alert-instance,
   code.settings-key) gewinnen darüber; in <pre>-Blöcken bleibt <code> transparent. */
code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border);
    word-break: break-word;
}
pre code { padding: 0; background: none; border: none; font-size: inherit; }

/* Page header with trailing action button */
.page-header--with-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.nav-flyout-subtitle {
    padding: 10px 16px 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.35);
    margin-top: 4px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* ==============================================================
   Shared utilities for list/detail pages (DMARC, Mails, etc.)
   ============================================================== */

/* Clickable table rows that open a modal */
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: var(--bg); }

/* Highlighted rows (status indicator) — Tönung aus den Status-Tokens
   abgeleitet (color-mix), damit kein Farbwert doppelt hartkodiert wird. */
.row-error td { background: color-mix(in srgb, var(--danger) 5%, transparent); }
.row-warn  td { background: color-mix(in srgb, var(--warning) 5%, transparent); }
.row-ok    td { background: color-mix(in srgb, var(--success) 5%, transparent); }

/* Compact dl-grid variant for modal/detail headers */
.dl-grid--compact { grid-template-columns: 120px 1fr; gap: 6px 16px; font-size: 13px; }
.dl-grid--wide    { grid-template-columns: 140px 1fr; gap: 6px 16px; font-size: 13px; }
.dl-grid--compact dt,
.dl-grid--wide   dt { font-weight: normal; color: var(--text-muted); font-size: inherit; }

/* Rollen-Checkliste im Benutzer-Anlege-/Bearbeiten-Formular */
.role-checklist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px 16px;
    max-height: 220px;
    overflow: auto;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}
.role-check { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-weight: 400; font-size: 0.88rem; cursor: pointer; }
.role-check input { margin-top: 2px; flex: 0 0 auto; }

/* Suchbares Auswahlfeld (Autocomplete) — z.B. Partner im Benutzer-Formular */
.ac-wrapper { position: relative; }
.ac-results {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--card-bg); border: 1px solid var(--border); border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 250px; overflow-y: auto; z-index: 100; display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.ac-results.active { display: block; }
.ac-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 0.9rem; color: var(--text); }
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.selected { background: var(--bg); }
.ac-empty { padding: 12px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* Benutzer-Formular: Namens-Reihe (schmale Anrede + Vorname + Nachname) */
.user-form-names { grid-template-columns: 130px 1fr 1fr; }
@media (max-width: 768px) { .user-form-names { grid-template-columns: 1fr; } }

/* Dark code/source viewer (used for raw XML/JSON/source) */
.code-block--dark {
    margin: 0;
    padding: 12px;
    background: var(--code-bg);
    color: var(--code-fg);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 11px;
    max-height: 400px;
    overflow: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.code-block--light {
    margin: 0;
    padding: 8px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 11px;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 200px;
    overflow: auto;
}

/* AJAX-Modal size variants — set via data-modal-size on the overlay by JS.
   Klassenbasiert (.ajax-modal-overlay), damit gestapelte Overlays ihre Groesse
   behalten, auch wenn die #ajax-modal-overlay-ID ans oberste Modal wandert. */
.ajax-modal-overlay[data-modal-size="wide"] { align-items: flex-start; padding-top: 32px; }
.ajax-modal-overlay[data-modal-size="wide"] .modal { max-width: 1100px; max-height: 100%; }
.ajax-modal-overlay[data-modal-size="full"] { align-items: flex-start; padding-top: 24px; }
.ajax-modal-overlay[data-modal-size="full"] .modal { max-width: 95vw; max-height: 100%; }

/* Tab buttons (used in mail detail modal) */
.tab-btn {
    padding: 6px 14px; border: none; background: none; cursor: pointer;
    border-bottom: 2px solid transparent; font-size: 13px; color: var(--text-muted);
    font-family: var(--font);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-bar {
    display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 12px;
}

/* Mail-body viewers (iframe/plain/source panes) */
.mail-view {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    display: block;
}
.mail-view--iframe { min-height: 500px; }
.mail-view--plain {
    padding: 16px; margin: 0;
    background: var(--bg); font-family: var(--font);
    font-size: 13px; max-height: 500px; overflow: auto;
    white-space: pre-wrap; word-wrap: break-word;
}

/* Detail/footer separator (above action buttons in modals) */
.modal-actions {
    margin-top: 20px; padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 8px;
}
.modal-actions--inline { display: flex; gap: 8px; align-items: flex-start; }

/* Responsive: Modals auf Mobile als Vollbild (Confirm bleibt kompakt zentriert) */
@media (max-width: 768px) {
    .modal-overlay:not(#confirm-overlay) { padding: 0; align-items: stretch; }
    .ajax-modal-overlay[data-modal-size="wide"],
    .ajax-modal-overlay[data-modal-size="full"] { padding-top: 0; align-items: stretch; }
    .modal-overlay:not(#confirm-overlay) .modal,
    .ajax-modal-overlay[data-modal-size="wide"] .modal,
    .ajax-modal-overlay[data-modal-size="full"] .modal {
        max-width: 100%; width: 100%; max-height: 100%; height: 100%; border-radius: 0;
    }
    #confirm-overlay .modal { max-width: 100%; }
    .dl-grid--compact,
    .dl-grid--wide { grid-template-columns: 100px 1fr; }

    /* Card-Modus: lange Text-Zellen (Betreff/Beschreibung/Regex/JSON) untereinander
       statt rechts gequetscht; lange Strings ohne Leerzeichen umbrechen. */
    .table--cards tbody td.cell-wide { flex-direction: column; align-items: stretch; text-align: left; gap: 2px; overflow-wrap: anywhere; word-break: break-word; }
    .table--cards tbody td.cell-wide::before { flex: none; }

    /* Card-Modus: Checkbox-Zelle als normale, beschriftete Zeile statt leerer Zeile */
    .table--cards tbody td.cb-cell { justify-content: space-between; text-align: right; }
    .table--cards tbody td.cb-cell::before { content: "Auswählen"; }
    .table--cards tbody td.cb-cell input[type=checkbox] { width: 18px; height: 18px; }
}

/* --- Hilfe-Modal: Typografie fuer durch page_help geliefertes HTML --- */
#help-modal .modal { max-width: 760px; }
#help-modal-body { line-height: 1.55; font-size: 13.5px; }
#help-modal-body h1,
#help-modal-body h2,
#help-modal-body h3,
#help-modal-body h4 {
    margin: 20px 0 8px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}
#help-modal-body h1 { font-size: 1.15rem; }
#help-modal-body h2 { font-size: 1.05rem; }
#help-modal-body h3 { font-size: 0.98rem; }
#help-modal-body h4 { font-size: 0.92rem; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-muted); }
#help-modal-body h1:first-child,
#help-modal-body h2:first-child,
#help-modal-body h3:first-child,
#help-modal-body h4:first-child,
#help-modal-body .help-section:first-child h1,
#help-modal-body .help-section:first-child h2,
#help-modal-body .help-section:first-child h3,
#help-modal-body .help-section:first-child h4 { margin-top: 0; }

#help-modal-body p { margin: 0 0 10px; }
#help-modal-body ul,
#help-modal-body ol { margin: 0 0 12px; padding-left: 22px; }
#help-modal-body li { margin-bottom: 4px; }
#help-modal-body li > ul,
#help-modal-body li > ol { margin-top: 4px; margin-bottom: 6px; }

#help-modal-body code {
    background: var(--bg);
    color: var(--primary);
    padding: 1px 6px;
    border: none;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: nowrap;
}
#help-modal-body pre {
    background: var(--code-bg); color: #d1d5db;
    padding: 10px 12px; border-radius: 6px;
    font-size: 12px; overflow: auto;
    margin: 0 0 12px;
}
#help-modal-body pre code { background: transparent; color: inherit; padding: 0; }

#help-modal-body table {
    width: 100%; border-collapse: collapse; margin: 6px 0 14px;
    font-size: 0.88em;
}
#help-modal-body th,
#help-modal-body td {
    padding: 6px 10px; border-bottom: 1px solid var(--border);
    text-align: left; vertical-align: top;
}
#help-modal-body th { background: var(--bg); font-weight: 600; }
#help-modal-body tr:last-child td { border-bottom: none; }

#help-modal-body blockquote {
    border-left: 3px solid var(--primary);
    padding: 4px 12px; margin: 10px 0;
    color: var(--text-muted);
    background: var(--bg);
    border-radius: 0 4px 4px 0;
}

#help-modal-body .help-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
#help-modal-body .help-section:last-child { border-bottom: none; padding-bottom: 0; }
#help-modal-body strong { color: var(--text); }


/* Definition-Listen im Help-Modal: schoenes Key-Value-Layout */
#help-modal-body dl { margin: 0 0 12px; display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 8px 16px; }
#help-modal-body dt { font-weight: 600; color: var(--text); padding: 6px 10px; background: var(--bg); border-radius: 4px; align-self: start; }
#help-modal-body dd { margin: 0; padding: 6px 0; align-self: start; line-height: 1.5; }
#help-modal-body dd em { font-style: italic; color: var(--primary); }
@media (max-width: 540px) {
    #help-modal-body dl { grid-template-columns: 1fr; gap: 4px 0; }
    #help-modal-body dd { padding: 0 0 6px 8px; border-left: 2px solid var(--border); margin-bottom: 6px; }
}

/* ===== Loading-Overlay (für Page-Navigation) ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 25, 40, 0.65);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease-out;
}
.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.loading-spinner {
    width: 64px;
    height: 64px;
    position: relative;
}
.loading-spinner::before,
.loading-spinner::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 4px solid transparent;
}
.loading-spinner::before {
    border-top-color: var(--primary);
    border-right-color: var(--primary);
    animation: ngn-spin 0.9s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}
.loading-spinner::after {
    border-bottom-color: rgba(255, 255, 255, 0.25);
    border-left-color: rgba(255, 255, 255, 0.25);
    animation: ngn-spin 1.4s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite reverse;
}
@keyframes ngn-spin {
    to { transform: rotate(360deg); }
}
.loading-message {
    margin-top: 28px;
    color: rgba(255, 255, 255, 0.92);
    font-size: 1.05rem;
    font-weight: 500;
    text-align: center;
    max-width: 480px;
    padding: 0 24px;
    transition: opacity 0.32s ease-in-out;
    opacity: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.loading-message.fade {
    opacity: 0;
}


/* ==============================================================
   Shared utilities used by Customer views (and others)
   ============================================================== */

/* --- Checkboxen & Radios ---
   Einheitliche Größe und Markenfarbe (accent-color) für alle nativen
   Checkboxen/Radios; korrekte vertikale Ausrichtung zum Label und ein
   konsistenter Fokus-Ring (analog zu .form-control). Global, kein Custom-SVG
   nötig — accent-color liefert die Markenfarbe samt nativem Haken. */
input[type="checkbox"], input[type="radio"] {
    width: 17px; height: 17px;
    accent-color: var(--primary);
    cursor: pointer;
    vertical-align: middle;
    flex-shrink: 0;
}
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
    border-radius: 3px;
}
input[type="checkbox"]:disabled,
input[type="radio"]:disabled { cursor: not-allowed; opacity: 0.55; }

/* Inline checkbox label: checkbox + text on one line, mittig ausgerichtet */
.checkbox-inline { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; line-height: 1.3; }
.checkbox-inline input[type="checkbox"],
.checkbox-inline input[type="radio"] { margin: 0; }

/* Sub-section heading inside a card-body (replaces inline h4 styling) */
.section-subhead { font-size: 0.95rem; font-weight: 600; margin: 20px 0 8px; color: var(--text); }
.section-subhead--first { margin-top: 0; }

/* Horizontal divider inside a card-body (replaces inline <hr> styling) */
.section-divider { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }

/* Compact toolbar card (e.g. show-deleted toggle above a list) */
.card--toolbar { padding: 0; }
.card-body--compact { padding: 10px 16px; }

/* Notes / free-text pre — pre-wrap, regular font */
.notes-pre { white-space: pre-wrap; font-family: inherit; font-size: 0.95rem; color: var(--text); margin: 0; }

/* Soft-deleted table row (visually de-emphasized but still readable) */
.row-deleted td { opacity: 0.55; }
.row-deleted:hover td { opacity: 0.8; }

/* Aktuell ausgewählte/bearbeitete Tabellenzeile (Token-Tint + linker Akzent). */
.row-active td { background: color-mix(in srgb, var(--primary) 9%, transparent); }
.row-active td:first-child { box-shadow: inset 3px 0 0 var(--primary); }

/* Unified form action footer (Save/Cancel buttons aligned right) */
.form-actions { margin-top: 24px; display: flex !important; gap: 12px; justify-content: flex-end !important; flex-wrap: wrap; width: 100%; }
@media (max-width: 480px) {
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; }
}

/* Tighter grid gap (used in form sub-rows) */
.grid--tight { gap: 12px; }

/* ==============================================================
   Wiederverwendbare Detail-/Listen-Komponenten (global)
   Ursprünglich notify-spezifisch (nh-*), jetzt generisch und auf
   jeder Seite verwendbar. Die nh-*-Namen bleiben als Aliase auf
   dieselben Regeln (Sicherheitsnetz gegen übersehene Stellen).
   ============================================================== */

/* Inhalt + feste Aktionsspalte nebeneinander (stapelt auf schmal).
   minmax(0,1fr) statt 1fr: verhindert Grid-Blowout durch lange, nicht
   umbrechbare Inhalte (z.B. Tracking-URLs), die sonst die Spalte sprengen. */
.detail-cols, .nh-detail-cols { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }

/* Kompakte Schlüssel/Wert-Meta-Liste (Detail-/Modal-Kopf): Badge + gestapelte
   "Label Wert"-Zeilen. Label gedimmt (.text-muted), Wert fett (<b>). Generisch
   verwendbar; Alias .nh-msg-meta für den Notify-Meldungskopf. */
.meta-list, .nh-msg-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; font-size: 0.85rem; }
.meta-list > span, .nh-msg-meta > span { white-space: nowrap; }

/* Verlaufs-/Aktivitäts-Timeline */
.timeline, .nh-timeline { list-style: none; padding: 0; margin: 0; font-size: 0.85rem; }
.timeline li, .nh-timeline li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child, .nh-timeline li:last-child { border-bottom: none; }
.timeline .t, .nh-timeline .t { color: var(--text-muted); margin-right: 12px; white-space: nowrap; }

/* Disclosure (<details>): Zusammenklappbarer Inhalt. Ein <summary> ist immer
   klickbar — die Basisregel erspart das wiederholte style="cursor:pointer" in den
   Views (.collapse-box/.totp-manual/.bug-debug verfeinern darüber nur Gewicht/Farbe). */
details > summary { cursor: pointer; }

/* Aufklappbarer Block / Disclosure (<details>) */
.collapse-box, .nh-rulebox { margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.collapse-box > summary, .nh-rulebox > summary { font-weight: 600; }
.collapse-box > form, .nh-rulebox > form { margin-top: 12px; }

/* Mehrfachauswahl-Leiste über einer Liste */
.bulk-bar, .nh-bulkbar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px;
    background: var(--primary-light);
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.bulk-bar[hidden], .nh-bulkbar[hidden] { display: none; }   /* gewinnt gegen display:flex */
.bulk-bar .bulk-actions, .nh-bulkbar .nh-bulk-actions { margin-left: auto; display: flex; gap: 8px; }

/* Checkbox-Spalte in Listen */
.cb-cell, .nh-cb-cell { text-align: center; }
.cb-cell input, .nh-cb-cell input { cursor: pointer; vertical-align: middle; }
tr.clickable-row .cb-cell, tr.clickable-row .nh-cb-cell { cursor: default; }

/* Sandboxed Content-/Mail-iframe */
.content-frame, .nh-mail-frame {
    width: 100%; height: 55vh; min-height: 320px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--card-bg);
}

/* Stapeln, wenn der Platz für die feste Aktionsspalte nicht reicht */
@media (max-width: 900px) {
    .detail-cols, .nh-detail-cols { grid-template-columns: 1fr; }
}

/* ============================================================
   Fehler & Vorschläge (Bug-Reports): Melden-Modal + Bearbeiten
   ============================================================ */

/* Aktive Stat-Card (Filter) */
.stat-card.is-active { border-color: var(--primary); box-shadow: var(--shadow); }

/* Typ-Switch (Fehler / Vorschlag) im Melden-Modal */
.bug-type-switch { display: flex; gap: 8px; }
.bug-type-btn {
    flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--card-bg); color: var(--text-muted); cursor: pointer; font-family: var(--font);
    font-size: 0.9rem; font-weight: 500; transition: all var(--transition);
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.bug-type-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.bug-type-btn:hover { border-color: var(--primary); }
.bug-type-btn.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* monochromes Anhang-/Paperclip-Icon (Liste) */
.ic-clip { width: 14px; height: 14px; vertical-align: -2px; color: var(--text-muted); }

/* Kontext-Hinweis (offenes Modal) */
.bug-context-notice {
    margin: 10px 0; padding: 8px 12px; border-radius: var(--radius);
    background: var(--bg); border: 1px dashed var(--border); font-size: 0.82rem; color: var(--text-muted);
}

/* Bestehende Meldungen für die Seite */
.bug-existing-toggle {
    background: none; border: none; color: var(--primary); cursor: pointer; font-family: var(--font);
    font-size: 0.82rem; padding: 4px 0; margin: 4px 0;
}
.bug-existing-list { margin: 4px 0 8px; max-height: 180px; overflow-y: auto; }
.bug-existing-item {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 6px;
    font-size: 0.8rem; background: var(--bg);
}
.bug-existing-item span { color: var(--text-muted); }

/* Screenshot-Dropzone */
.bug-dropzone {
    border: 2px dashed var(--border); border-radius: var(--radius); padding: 18px; text-align: center;
    color: var(--text-muted); font-size: 0.85rem; transition: border-color var(--transition), background var(--transition);
}
.bug-dropzone.is-over { border-color: var(--primary); background: var(--bg); }
.bug-dropzone-link { background: none; border: none; color: var(--primary); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
.bug-attach-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.bug-attach-item {
    position: relative; width: 72px; height: 72px; border-radius: var(--radius); border: 1px solid var(--border);
    background-size: cover; background-position: center; background-color: var(--bg);
}
.bug-attach-rm {
    position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
    border: none; background: var(--danger, #dc2626); color: #fff; cursor: pointer; line-height: 1; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
}

/* Detail-Ansicht (Bearbeiten) */
.bug-meta-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px;
    margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.bug-meta-grid > div { display: flex; flex-direction: column; gap: 3px; font-size: 0.9rem; }
.bug-meta-k { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.bug-desc-box {
    padding: 12px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
    line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.bug-attachments-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.bug-attach-thumb {
    display: block; width: 120px; height: 90px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.bug-attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bug-debug { margin-top: 14px; }
.bug-debug summary { color: var(--text-muted); font-size: 0.85rem; }
.bug-debug-pre {
    margin-top: 8px; max-height: 280px; overflow: auto; background: #1e1e2e; color: #cdd6f4;
    padding: 12px; border-radius: var(--radius); font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
}
