/* ============================================
   CyberCore Console v4.0 - Sidebar Dark
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

:root {
    --primary: #22d3ee;
    --primary-hover: #67e8f9;
    --primary-dim: rgba(34, 211, 238, 0.06);
    --primary-glow: rgba(34, 211, 238, 0.2);

    --accent-red: #f43f5e;
    --accent-orange: #fb923c;
    --accent-green: #34d399;
    --accent-purple: #a78bfa;
    --accent-blue: #60a5fa;

    --bg-base: #020617;
    --bg-sidebar: #0b1120;
    --bg-surface: #0f172a;
    --bg-elevated: #1e293b;
    --bg-input: #0b1221;

    --text-heading: #f8fafc;
    --text-body: #cbd5e1;
    --text-muted: #64748b;
    --text-faint: #334155;

    --border-subtle: rgba(148, 163, 184, 0.06);
    --border-soft: rgba(148, 163, 184, 0.1);
    --border-focus: rgba(34, 211, 238, 0.35);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 24px rgba(34, 211, 238, 0.08);

    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-base);
    color: var(--text-body);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ============================================
   App Shell
   ============================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   Sidebar Hover Trigger
   ============================================ */
.sidebar-trigger {
    position: fixed;
    top: 0;
    left: 0;
    width: 8px;
    height: 100vh;
    z-index: 99;
    cursor: pointer;
}

.sidebar-trigger::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 2px;
    transform: translateY(-50%);
    width: 3px;
    height: 40px;
    border-radius: 3px;
    background: rgba(34, 211, 238, 0.15);
    transition: background 0.2s ease;
}

.sidebar-trigger:hover::before {
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-trigger:hover ~ .sidebar,
.sidebar:hover {
    transform: translateX(0);
}

.sidebar-brand {
    padding: 1.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    border-bottom: 1px solid var(--border-subtle);
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-base);
    font-size: 1.1rem;
    flex-shrink: 0;
    overflow: hidden;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-xs);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-heading);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.brand-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 0.1rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1.25rem 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: right;
}

.sidebar-link:hover {
    background: rgba(148, 163, 184, 0.05);
    color: var(--text-body);
}

.sidebar-link.active {
    background: var(--primary-dim);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.1);
}

.link-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(148, 163, 184, 0.06);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-link.active .link-icon {
    background: rgba(34, 211, 238, 0.1);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.5rem;
    background: var(--bg-surface);
    border-radius: var(--radius-xs);
}

.sidebar-user i {
    color: var(--primary);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--accent-red);
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem;
    border-radius: var(--radius-xs);
    transition: all 0.2s ease;
}

.sidebar-logout:hover {
    background: rgba(244, 63, 94, 0.06);
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    flex: 1;
    margin-left: 0;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Top Bar
   ============================================ */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-base);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    font-size: 0.85rem;
    min-width: 220px;
}

.topbar-search i {
    font-size: 0.8rem;
    opacity: 0.5;
}

.topbar-stats {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.topbar-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.4);
}

.stat-dot.offline {
    background: var(--accent-red);
    box-shadow: 0 0 6px rgba(244, 63, 94, 0.4);
}

/* ============================================
   Page Sections
   ============================================ */
.page-section {
    display: none;
    flex: 1;
    padding: 2rem;
}

.page-section.active {
    display: flex;
    flex-direction: column;
    animation: reveal 0.3s ease;
}

/* Home page: map background + stat cards layout */
#page-home {
    position: relative;
    padding: 0;
    height: calc(100vh - 61px);
    min-height: calc(100vh - 61px);
}

#page-home .home-map-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#homeMap {
    width: 100%;
    height: 100%;
    min-height: 500px;
}

@keyframes reveal {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Hero
   ============================================ */
.hero {
    margin-bottom: 2rem;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.875rem;
    background: var(--primary-dim);
    border: 1px solid rgba(34, 211, 238, 0.12);
    border-radius: 100px;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.hero-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-heading);
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}

.hero-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 480px;
}

/* ============================================
   Quick Stats
   ============================================ */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.qstat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.qstat-card:hover {
    border-color: var(--border-soft);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.qstat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.qstat-icon.blue {
    background: rgba(96, 165, 250, 0.1);
    color: var(--accent-blue);
}

.qstat-icon.purple {
    background: rgba(167, 139, 250, 0.1);
    color: var(--accent-purple);
}

.qstat-icon.green {
    background: rgba(52, 211, 153, 0.1);
    color: var(--accent-green);
}

.qstat-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-heading);
    font-family: 'DM Mono', monospace;
    line-height: 1.2;
}

.qstat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.15rem;
}

/* ============================================
   Panels
   ============================================ */
.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.25rem;
    transition: all 0.3s ease;
}

.panel:hover {
    border-color: var(--border-soft);
    box-shadow: var(--shadow-sm);
}

.panel.wide {
    grid-column: 1 / -1;
}

.panel-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.125rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.panel-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-xs);
    background: var(--primary-dim);
    border: 1px solid rgba(34, 211, 238, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 0.9rem;
}

.panel-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-heading);
    flex: 1;
}

.panel-action {
    margin-right: auto;
}

.panel-body {
    padding: 1.5rem;
}

.panel-body.no-pad {
    padding: 0;
}

/* ============================================
   Forms
   ============================================ */
.form-row {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.form-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-field label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.form-field label i {
    color: var(--primary);
    font-size: 0.7rem;
}

.form-field input {
    padding: 0.65rem 0.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
    color: var(--text-body);
    font-size: 0.9rem;
    font-family: 'DM Mono', monospace;
    transition: all 0.2s ease;
    width: 100%;
}

.form-field input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.05);
}

.form-field small {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.form-field small i {
    color: var(--primary);
    opacity: 0.6;
}

.text-danger {
    color: var(--accent-red) !important;
}

.text-danger i {
    color: var(--accent-red) !important;
}

/* ============================================
   Buttons
   ============================================ */
.btn-submit {
    padding: 0.65rem 1.25rem;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.12), rgba(34, 211, 238, 0.04));
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: var(--radius-xs);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.btn-submit:hover {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(34, 211, 238, 0.08));
    border-color: rgba(34, 211, 238, 0.35);
    box-shadow: var(--shadow-glow);
    color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-submit:active {
    transform: translateY(0);
}

/* User action buttons */
.user-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.user-actions .btn-submit {
    flex: 1;
    justify-content: center;
    font-size: 0.78rem;
    padding: 0.5rem;
}

/* ============================================
   Input Group
   ============================================ */
.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input {
    flex: 1;
    padding: 0.65rem 0.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
    color: var(--text-body);
    font-size: 0.9rem;
    font-family: 'DM Mono', monospace;
}

.input-group input:focus {
    outline: none;
    border-color: var(--border-focus);
}

/* ============================================
   Users List
   ============================================ */
.users-list {
    display: flex;
    flex-direction: column;
}

.user-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    transition: all 0.2s ease;
}

.user-row:last-child {
    border-bottom: none;
}

.user-row:hover {
    background: rgba(148, 163, 184, 0.02);
}

.user-row-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(34, 211, 238, 0.15);
    object-fit: cover;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.user-row:hover .user-row-avatar {
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

.user-row-info {
    flex: 1;
    min-width: 0;
}

.user-row-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 0.15rem;
}

.user-row-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: 'DM Mono', monospace;
}

.user-row-actions {
    display: flex;
    gap: 0.4rem;
}

.user-row-actions .btn-submit {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
}

/* ============================================
   Admin Grid
   ============================================ */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.info-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
}

.chip-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chip-value {
    font-size: 0.85rem;
    color: var(--text-body);
    font-family: 'DM Mono', monospace;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
    font-family: 'DM Mono', monospace;
    font-size: 0.82rem;
    color: var(--text-body);
}

.file-item button {
    background: transparent;
    border: 1px solid rgba(244, 63, 94, 0.15);
    color: var(--accent-red);
    padding: 0.25rem 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.2s ease;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.file-item button:hover {
    background: rgba(244, 63, 94, 0.08);
    border-color: rgba(244, 63, 94, 0.25);
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-faint);
}

.empty-state h3 {
    font-size: 1.15rem;
    margin-bottom: 0.4rem;
    color: var(--text-body);
    font-weight: 700;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================
   Spinner
   ============================================ */
.spinner-modern {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-modern.d-none {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Toast
   ============================================ */
#toastContainer {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 1050;
    display: none;
}

.toast {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    min-width: 300px;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary), transparent);
}

.toast-head {
    background: transparent;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.875rem 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.toast-head i {
    font-size: 1rem;
    color: var(--primary);
}

.toast-head strong {
    color: var(--text-heading);
    flex: 1;
    font-weight: 700;
    font-size: 0.85rem;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 5px;
}

.toast-close:hover {
    color: var(--text-heading);
    background: rgba(148, 163, 184, 0.08);
}

.toast-close::before {
    content: '\00d7';
    line-height: 1;
}

.toast-body {
    padding: 0.75rem 1.125rem 1.125rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================
   Utility
   ============================================ */
.d-none {
    display: none !important;
}

.text-center {
    text-align: center;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        border-left: none;
        border-bottom: 1px solid var(--border-subtle);
    }

    .app-shell {
        flex-direction: column;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 0.75rem;
    }

    .sidebar-link {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .sidebar-footer {
        flex-direction: row;
        justify-content: space-between;
    }

    .topbar {
        padding: 0.75rem 1rem;
    }

    .page-section {
        padding: 1rem;
    }

    #page-home {
        min-height: auto;
    }

    .stats-cards-column {
        position: static;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-bottom: 1rem;
        max-height: none;
    }

    .stat-card {
        flex: 1;
        min-width: 140px;
        padding: 0.625rem 0.75rem;
    }

    .home-map-bg {
        height: 300px;
        position: relative;
    }

    .quick-stats {
        grid-template-columns: 1fr;
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .user-row {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .user-row-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .compact-add-form {
        flex-direction: column;
        align-items: stretch;
    }

    .compact-add-form .btn-submit {
        width: 100%;
    }
}

/* ============================================
   Homepage Map & Stats
   ============================================ */
.home-map-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.home-map-bg.active {
    opacity: 1;
}

.home-map-bg .leaflet-container {
    background: var(--bg-base);
}

/* Stat cards column on the right */
.stats-cards-column {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 220px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    pointer-events: auto;
}

.stats-cards-column::-webkit-scrollbar {
    width: 4px;
}

.stats-cards-column::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.15);
    border-radius: 4px;
}

.stat-card {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.25s ease;
    cursor: default;
}

.stat-card:hover {
    border-color: var(--border-soft);
    transform: translateX(-4px);
    box-shadow: var(--shadow-sm);
}

.stat-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.stat-card-icon.blue { background: rgba(96, 165, 250, 0.1); color: var(--accent-blue); }
.stat-card-icon.green { background: rgba(52, 211, 153, 0.1); color: var(--accent-green); }
.stat-card-icon.purple { background: rgba(167, 139, 250, 0.1); color: var(--accent-purple); }
.stat-card-icon.orange { background: rgba(251, 146, 60, 0.1); color: var(--accent-orange); }
.stat-card-icon.red { background: rgba(244, 63, 94, 0.1); color: var(--accent-red); }
.stat-card-icon.cyan { background: rgba(34, 211, 238, 0.1); color: var(--primary); }

.stat-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.stat-card-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-heading);
    font-family: 'DM Mono', monospace;
    line-height: 1.2;
}

.stat-card-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Intel-archive style map markers */
.ia-marker-wrap {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ia-marker-avatar {
    position: absolute;
    top: 18px;
    left: 18px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--primary);
    box-shadow: 0 0 16px var(--primary-glow);
    z-index: 4;
    background: var(--bg-surface);
}

.ia-marker-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ia-marker-ring {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1.5px solid var(--primary);
    opacity: 0.25;
    animation: iaMarkerPulse 2.5s ease-in-out infinite;
    z-index: 1;
}

.ia-marker-crosshair {
    position: absolute;
    top: 0;
    left: 0;
    width: 80px;
    height: 80px;
    z-index: 2;
    pointer-events: none;
}

.ia-marker-crosshair::before,
.ia-marker-crosshair::after {
    content: '';
    position: absolute;
    background: rgba(34, 211, 238, 0.15);
}

.ia-marker-crosshair::before {
    top: 39px;
    left: 10px;
    width: 60px;
    height: 2px;
}

.ia-marker-crosshair::after {
    top: 10px;
    left: 39px;
    width: 2px;
    height: 60px;
}

.ia-marker-radar {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1px solid transparent;
    z-index: 3;
    animation: iaRadarSweep 3s linear infinite;
}

.ia-marker-radar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    border-radius: 64px 64px 0 0;
    background: linear-gradient(180deg, rgba(34, 211, 238, 0.08), transparent);
    transform-origin: bottom center;
    animation: iaRadarSpin 3s linear infinite;
}

@keyframes iaMarkerPulse {
    0%, 100% { transform: scale(1); opacity: 0.25; }
    50% { transform: scale(1.15); opacity: 0.05; }
}

@keyframes iaRadarSweep {
    0% { border-color: rgba(34, 211, 238, 0.1); }
    50% { border-color: rgba(34, 211, 238, 0.3); }
    100% { border-color: rgba(34, 211, 238, 0.1); }
}

@keyframes iaRadarSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Leaflet popup dark theme */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-body);
    border-radius: var(--radius-sm);
}

.leaflet-popup-content-wrapper {
    box-shadow: var(--shadow-md);
}

.leaflet-container a.leaflet-popup-close-button {
    color: var(--text-muted);
}

.leaflet-container a.leaflet-popup-close-button:hover {
    color: var(--text-heading);
}

/* ============================================
   Compact Add User Form (Users Page)
   ============================================ */
.compact-add-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.compact-add-form .form-field {
    flex: 1;
    margin: 0;
}

.compact-add-form .form-field input {
    margin: 0;
    min-height: 42px;
}

.compact-add-form .btn-submit {
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
    min-height: 42px;
    white-space: nowrap;
}

/* ============================================
   User Options Panel
   ============================================ */
.user-row-wrap {
    border-bottom: 1px solid var(--border-subtle);
    transition: all 0.2s ease;
}

.user-row-wrap:last-child {
    border-bottom: none;
}

.user-row {
    cursor: pointer;
}

.user-row-actions {
    pointer-events: auto;
}

.user-row-actions button {
    pointer-events: auto;
}

.user-options-panel {
    display: none;
    padding: 0.75rem 1.25rem 1rem;
    background: rgba(148, 163, 184, 0.02);
    border-top: 1px solid var(--border-subtle);
}

.user-options-panel.active {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Modern Options Grid (User Options Panel)
   ============================================ */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
    padding: 0.75rem 1rem;
}

.opt-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.opt-card:hover {
    border-color: rgba(34, 211, 238, 0.25);
    background: rgba(34, 211, 238, 0.04);
}

.opt-card.on {
    border-color: rgba(34, 211, 238, 0.35);
    background: rgba(34, 211, 238, 0.06);
}

.opt-card.on .opt-icon {
    color: var(--primary);
    background: rgba(34, 211, 238, 0.12);
}

.opt-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.opt-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.opt-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-heading);
}

.opt-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.opt-switch {
    appearance: none;
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: var(--border-subtle);
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.25s ease;
    outline: none;
    border: none;
}

.opt-switch::after {
    content: '';
    position: absolute;
    top: 2.5px;
    left: 2.5px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: var(--bg-void);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.opt-switch:checked {
    background: var(--primary);
}

.opt-switch:checked::after {
    left: 20.5px;
    background: #fff;
}

/* ============================================
   Leaflet Popup Dark Theme (fixed)
   ============================================ */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: #0f172a !important;
    border: 1px solid rgba(148, 163, 184, 0.12) !important;
    color: #e2e8f0 !important;
    border-radius: 12px !important;
}

.leaflet-popup-content-wrapper {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45) !important;
}

.leaflet-popup-content {
    margin: 10px 14px !important;
    color: #e2e8f0 !important;
}

.leaflet-container a.leaflet-popup-close-button {
    color: #64748b !important;
    top: 6px !important;
    right: 6px !important;
}

.leaflet-container a.leaflet-popup-close-button:hover {
    color: #f8fafc !important;
}

.user-row-chevron {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: 0.5rem;
    transition: transform 0.2s ease;
    pointer-events: none;
}

.user-row-wrap.expanded .user-row-chevron {
    transform: rotate(180deg);
}

/* ============================================
   Legacy
   ============================================ */
.voice-channels-list,
.voice-history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.discord-voice-channel {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.3s ease;
}

.discord-voice-channel:hover {
    border-color: var(--border-soft);
    box-shadow: var(--shadow-glow);
}

.discord-voice-channel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.discord-voice-channel-icon {
    color: var(--primary);
    opacity: 0.8;
}

.discord-voice-channel-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-heading);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.discord-voice-channel-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 0.125rem 0.5rem;
    border-radius: 6px;
    font-family: 'DM Mono', monospace;
}

.discord-voice-members {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.discord-voice-member {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--radius-xs);
    transition: background-color 0.2s;
}

.discord-voice-member:hover {
    background: var(--bg-elevated);
}

.discord-voice-member.monitored {
    background: var(--primary-dim);
    border-right: 2px solid var(--primary);
}

.discord-voice-member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-subtle);
}

.discord-voice-member-nickname {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-body);
    line-height: 1.375rem;
}

.message-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.message-card:hover {
    border-color: var(--border-soft);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-subtle);
    transition: all 0.3s ease;
}

.message-card:hover .message-avatar {
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

.message-content {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-input);
    border-radius: var(--radius-xs);
    color: var(--text-body);
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
    border: 1px solid var(--border-subtle);
    font-size: 0.9rem;
}
