/* ==========================================================================
   Hamburg Roleplay - Anticheat & Admin Panel Theme
   Style: FiveM Midnight Glassmorphism & Space Grotesk UI
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@600;700;800&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
    /* Backgrounds: Deep Midnight Navy Glass */
    --bg: #060a14;
    --bg-elevated: rgba(10, 16, 30, 0.72);
    --bg-elevated-2: rgba(15, 23, 42, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.18);

    /* Text Colors */
    --text: #ffffff;
    --text-muted: #94a3b8;
    --text-faint: #64748b;
    --text-secondary: #cbd5e1;

    /* Hamburg Roleplay Accent Palette */
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-soft: rgba(59, 130, 246, 0.15);
    --discord-blurple: #5865F2;

    /* Danger / Bans (Red) */
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-soft: rgba(239, 68, 68, 0.15);

    /* Warning / Teamwarns (Amber) */
    --warn: #f59e0b;
    --warn-soft: rgba(245, 158, 11, 0.15);

    /* Success / Online (Emerald) */
    --ok: #10b981;
    --ok-soft: rgba(16, 185, 129, 0.15);

    /* Live Tracking (Cyan) */
    --cyan: #06b6d4;
    --cyan-soft: rgba(6, 182, 212, 0.16);

    /* Geometry & Radius */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;

    /* Glows & Shadows */
    --shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.3);

    --sidebar-w: 245px;

    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.09), transparent 45%),
        radial-gradient(circle at 85% 25%, rgba(88, 101, 242, 0.08), transparent 45%),
        radial-gradient(circle at 50% 85%, rgba(6, 182, 212, 0.06), transparent 50%);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 13.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.icon {
    display: inline-block;
    vertical-align: -2px;
    flex-shrink: 0;
}

code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 2px 6px;
    border-radius: 6px;
    color: #93c5fd;
    font-weight: 600;
}

/* ---------- Login & Auth Card ---------- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    position: relative;
}

.login-card {
    position: relative;
    width: 410px;
    max-width: 100%;
    background: var(--bg-elevated);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 38px 34px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #5865F2, #3b82f6, #06b6d4);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    color: #fff;
}

.login-brand .icon {
    color: var(--accent);
    font-size: 24px;
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5));
}

.login-card h1 {
    margin: 0 0 6px;
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.subtitle {
    margin: 0 0 24px;
    color: var(--text-muted);
    font-size: 13.5px;
}

.login-card form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.login-card label {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-top: 14px;
}

.login-card button[type="submit"] {
    margin-top: 24px;
    width: 100%;
    padding: 12px;
}

.switch-link {
    margin: 22px 0 0;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

.switch-link a {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 600;
}
.switch-link a:hover {
    text-decoration: underline;
    color: #93c5fd;
}

/* ---------- Form Controls ---------- */

input[type="text"],
input[type="password"],
input[type="number"],
select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 13.5px;
    width: 100%;
    font-family: inherit;
    transition: all 0.2s ease;
}

select option {
    background: #0f172a;
    color: #ffffff;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.28);
    background: rgba(255, 255, 255, 0.08);
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Hamburg RP Gradient Buttons */
button {
    cursor: pointer;
    border: none;
    border-radius: 10px;
    padding: 9px 16px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
}
.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.45);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #f87171, #ef4444);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.45);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 7px;
}

/* ---------- App Shell (Sidebar Layout) ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: rgba(8, 13, 24, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 22px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -0.01em;
    color: #fff;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.sidebar-brand .icon {
    color: var(--accent);
    font-size: 20px;
}

.sidebar-badge {
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.sidebar-section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 16px 10px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    background: transparent;
    border: 1px solid transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
    background: rgba(59, 130, 246, 0.16);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.nav-link:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.sidebar-spacer { flex: 1; }

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.sidebar-user strong {
    color: #fff;
    font-weight: 700;
}

/* ---------- Main Content Area ---------- */

.main-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(8, 13, 24, 0.65);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
}

.topbar-title-group h2 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
}

.content {
    padding: 28px 32px 60px;
    max-width: 1320px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel[hidden] { display: none !important; }

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 12px;
}

.panel-header h2 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    color: #fff;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.muted { color: var(--text-muted); font-size: 13px; }
.faint { color: var(--text-faint); font-size: 12px; }

/* ---------- Server Switcher ---------- */

.server-switcher {
    padding: 0 4px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.server-switcher select { font-size: 13px; }

.server-sync-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 2px 4px;
    font-size: 11.5px;
}
.server-sync-status .badge { font-size: 10.5px; padding: 2px 8px; }
.server-sync-status .faint { font-size: 11px; }

/* ---------- Alerts ---------- */

.alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
}
/* .alert uses display:flex above, which otherwise beats the [hidden] attribute at equal CSS
   specificity (author rules always win over the UA [hidden]{display:none} default) - this keeps
   hidden alerts actually hidden. Same class of fix already applied to .tab-panel/.load-more-wrap/
   .modal-overlay below. */
.alert[hidden] { display: none !important; }

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.28);
}
.alert-ok {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.28);
}

/* ---------- Toasts ---------- */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
    max-width: 380px;
}

.toast {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    padding: 14px 36px 14px 16px;
    font-size: 13.5px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
    position: relative;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.25s ease;
}

.toast-visible { opacity: 1; transform: translateY(0); }

.toast-success { border-left: 4px solid var(--ok); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--accent); }

.toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-faint);
    font-size: 16px;
    padding: 4px 6px;
    cursor: pointer;
}
.toast-close:hover { color: #fff; }

/* ---------- Stat Cards (Hamburg RP Glass Style) ---------- */

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    position: relative;
    background: var(--bg-elevated);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    display: flex;
    align-items: flex-start;
    gap: 18px;
    box-shadow: var(--shadow);
    transition: all 0.25s ease;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-hover);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.stat-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(59, 130, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

/* icons.js emits fixed-size inline SVGs (18px by default) - scale them up to actually fill this
   bigger 52px icon box instead of looking small/off-center inside it. */
.stat-card-icon svg {
    width: 24px;
    height: 24px;
}

.stat-card .stat-value {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---------- Charts ---------- */

.chart-card {
    position: relative;
    background: var(--bg-elevated);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chart-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #06b6d4, #3b82f6);
}

.chart-card h3 {
    margin: 0 0 6px;
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 130px;
    margin-top: 18px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
}

.chart-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 6px;
}

.chart-bar {
    width: 100%;
    background: linear-gradient(180deg, #3b82f6 0%, rgba(59, 130, 246, 0.3) 100%);
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    transition: all 0.2s ease;
}

.chart-bar-wrap:hover .chart-bar {
    background: linear-gradient(180deg, #60a5fa 0%, rgba(59, 130, 246, 0.6) 100%);
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
}

.chart-bar-label {
    font-size: 10.5px;
    color: var(--text-faint);
}

/* ---------- Cards & Content Sections ---------- */

.card {
    background: var(--bg-elevated);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

/* ---------- Config Grid (Electron-Anticheat-Style Dashboard Layout) ----------
   Reiner Layout-Umbau: #configForm wird von einer endlosen Liste zu einem
   responsiven Card-Grid, jede .config-section (= ein CONFIG_SCHEMA-Abschnitt)
   wird eine kompakte Card, jede .field-row eine kompakte horizontale Zeile.
   Farben/Variablen unverändert - identisches Hamburg-RP-Glassmorphism-Theme. */

#configForm {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
    align-items: start;
}

/* Vollbreite-Sections (Bypass-Gruppen, Blacklists, Allowlist etc. - alles was
   nur ein einziges .map-editor-Feld enthält) bleiben über die volle Breite,
   damit lange Key/Value-Listen nicht in eine 320px-Spalte gequetscht werden. */
#configForm .config-section:has(> .field-row:only-of-type > .map-editor) {
    grid-column: 1 / -1;
}

.config-section {
    background: var(--bg-elevated);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0;
    margin-bottom: 0;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.config-section:hover {
    border-color: var(--border-hover);
}

.config-section h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    font-family: var(--font-heading);
}

.config-section p.muted {
    margin: 0;
    padding: 10px 18px 0;
    font-size: 12px;
}

.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.field-row:last-child { border-bottom: none; }
.field-row label {
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.field-row.checkbox-row { flex-direction: row; }

/* Inputs/Selects innerhalb einer Zeile sollen kompakt bleiben statt die volle
   Feldbreite von input[type] { width: 100% } weiter oben zu übernehmen. */
.field-row > input,
.field-row > select {
    width: auto;
    min-width: 110px;
    max-width: 190px;
    flex-shrink: 0;
    padding: 7px 10px;
    font-size: 12.5px;
}

.field-row.checkbox-row > input[type="checkbox"] {
    width: 16px;
    min-width: 0;
}

/* Feld mit angehängtem Action-Button (z.B. Discord-Webhook "Testen") - dieser Wrapper ersetzt das
   direkte input/select als Kind von .field-row, daher hier erneut die kompakte Breite fürs Input. */
.field-row-input-with-action {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.field-row-input-with-action > input {
    width: auto;
    min-width: 160px;
    max-width: 220px;
    padding: 7px 10px;
    font-size: 12.5px;
}

/* Map-Editor-Zeilen (Bypass-Gruppen, Blacklists ...) sind eigene Listen-UIs -
   die brauchen die volle Zeilenbreite, nicht das kompakte Label+Input-Layout. */
.field-row:has(> .map-editor) {
    flex-direction: column;
    align-items: stretch;
}
.field-row:has(> .map-editor) > label {
    white-space: normal;
}
.map-editor { width: 100%; }

.map-editor { grid-column: 1 / -1; }

.map-row {
    display: grid;
    grid-template-columns: 1fr 140px auto;
    gap: 8px;
    margin-bottom: 8px;
}
.map-row.map-row-boolean { grid-template-columns: 1fr auto auto; }

/* ---------- Tables (Glass Table Wrap) ---------- */

.table-wrap {
    background: var(--bg-elevated);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow-x: auto; /* volle License-Identifier (code-Zellen) koennen breiter als die Karte sein */
    box-shadow: var(--shadow);
}
.table-wrap table code { white-space: nowrap; }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 13px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
}

th {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(10, 16, 30, 0.85);
    border-bottom: 1px solid var(--border);
}

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

tr:last-child td { border-bottom: none; }

/* Pill Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    border: 1px solid transparent;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-online {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}
.badge-offline {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Anticheat Cheat Risk Scores */
.score-low {
    color: #34d399;
    font-family: var(--font-mono);
    font-weight: 600;
}
.score-mid {
    color: #fbbf24;
    font-family: var(--font-mono);
    font-weight: 700;
}
.score-high {
    color: #f87171;
    font-family: var(--font-mono);
    font-weight: 800;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    max-width: 640px;
    flex-wrap: wrap;
}
.inline-form input, .inline-form select {
    width: auto;
    flex: 1;
    min-width: 140px;
}

.search-input-wrap { position: relative; }
.search-input-wrap .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
}
.search-input-wrap input { padding-left: 36px; }

.load-more-wrap {
    display: flex;
    justify-content: center;
    padding: 18px 0;
}
.load-more-wrap[hidden] { display: none !important; }

/* ---------- Empty & Loading States ---------- */

.empty-state {
    color: var(--text-muted);
    padding: 42px 24px;
    text-align: center;
    background: var(--bg-elevated);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
}

.empty-state .icon {
    color: var(--text-faint);
    font-size: 32px;
    margin-bottom: 12px;
}
.empty-state .btn-primary {
    display: inline-flex;
    margin-top: 16px;
}

.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 37%, rgba(255,255,255,0.03) 63%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

.skeleton-row { height: 44px; margin-bottom: 2px; }

/* ---------- Modals (Hamburg RP Blur Card) ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 6, 15, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-overlay[hidden] { display: none !important; }

.modal {
    width: 480px;
    max-width: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal h3 {
    margin: 0 0 6px;
    font-family: var(--font-heading);
    font-size: 19px;
    font-weight: 800;
    color: #fff;
}
.modal label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 14px 0 6px;
}
.modal p {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.6;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

.key-box {
    font-family: var(--font-mono);
    font-size: 13px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    padding: 12px 14px;
    word-break: break-all;
    white-space: pre-wrap;
    margin: 12px 0;
    color: #93c5fd;
}

/* ---------- Role Badges ---------- */

.role-badge {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 6px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.4px;
}
.role-admin {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}
.role-viewer {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ---------- Mobile Responsive ---------- */

@media (max-width: 860px) {
    .app-shell { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        padding: 10px 14px;
        gap: 6px;
    }
    .sidebar-brand { padding: 4px 8px; border-bottom: none; margin-bottom: 0; }
    .sidebar-section-label { display: none; }
    .sidebar-spacer { display: none; }
    .sidebar-footer {
        flex-direction: row;
        border-top: none;
        border-left: 1px solid var(--border);
        padding: 0 0 0 10px;
        margin-left: 6px;
    }
    .server-switcher { padding: 0 6px; flex-direction: row; }
    .content { padding: 18px 16px 40px; }
    .topbar { padding: 14px 16px; }
    .field-row { grid-template-columns: 1fr; }
    table { font-size: 12.5px; }
    th, td { padding: 10px 10px; }
}

/* ---------- Detections Tab (Electron-Style Grid) ----------
   Reines Layout, unser bestehendes Hamburg-RP-Glassmorphism-Farbschema (dieselben Variablen wie
   überall sonst: --bg, --bg-elevated, --border, --accent, --text, --text-muted, --border-hover). */

.ac-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
    align-items: start;
}

.ac-card {
    background: var(--bg-elevated);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.2s ease;
}
.ac-card:hover { border-color: var(--border-hover); }

.ac-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}
.ac-card-icon { font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.ac-card-title-group { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ac-card-title { font-family: var(--font-heading); font-weight: 700; font-size: 14px; color: var(--text); }
.ac-card-desc { font-size: 11.5px; color: var(--text-muted); }

.ac-card-body { display: flex; flex-direction: column; }

/* Modul-weite Einstellungen (einmal pro Karte, unter der Beschreibung) und Detection-spezifische
   Schwellenwerte (direkt unter der jeweiligen Zeile) - beide nutzen .field-row (gleiches Aussehen
   wie frueher im separaten Konfiguration-Tab), nur kompakter und farblich leicht abgesetzt. */
.ac-card-fields {
    padding: 4px 18px 8px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.015);
}
.ac-card-fields .field-row { padding: 8px 0; }
.ac-card-fields .field-row label { font-size: 12px; }

.ac-row-fields {
    padding: 2px 18px 10px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.015);
}
.ac-row-fields .field-row { padding: 6px 0; }
.ac-row-fields .field-row label { font-size: 11.5px; color: var(--text-muted); }
.ac-row-fields .map-editor { grid-column: auto; }

.ac-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.ac-row:last-child { border-bottom: none; }
.ac-row:hover { background: rgba(255, 255, 255, 0.03); }

.ac-row-left { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.ac-row-name { font-size: 12.5px; color: var(--text); white-space: nowrap; }
.ac-row-info {
    flex-shrink: 0;
    width: 15px; height: 15px;
    border-radius: 50%;
    border: 1px solid var(--border);
    color: var(--text-faint);
    font-size: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: help;
}
.ac-row-info:hover { border-color: var(--accent); color: var(--accent); }

.ac-row-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.ac-action-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text);
    font-size: 11.5px;
    padding: 5px 8px;
    border-radius: 7px;
    min-width: 70px;
    width: auto;
    cursor: pointer;
}

.ac-switch { position: relative; display: inline-block; width: 34px; height: 19px; flex-shrink: 0; }
.ac-switch input { opacity: 0; width: 0; height: 0; }
.ac-switch-slider {
    position: absolute; inset: 0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.ac-switch-slider::before {
    content: '';
    position: absolute;
    width: 13px; height: 13px;
    left: 2px; top: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.15s ease, background 0.15s ease;
}
.ac-switch input:checked + .ac-switch-slider { background: var(--accent-soft); border-color: var(--accent); }
.ac-switch input:checked + .ac-switch-slider::before { transform: translateX(15px); background: var(--accent); }

@media (max-width: 640px) {
    .ac-grid { grid-template-columns: 1fr; }
}
