/* ============================================================
   DVS Admin — Stylesheet
   Three themes: dark (default), light, glass
   ============================================================ */

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

:root {
    /* Base tokens (dark theme defaults) */
    --bg:           #0a0a10;
    --surface:      #14141c;
    --surface-2:    #1a1a25;
    --surface-3:    #22222f;
    --border:       rgba(255,255,255,0.08);
    --border-2:     rgba(255,255,255,0.04);
    --text:         #f1f1f4;
    --text-muted:   rgba(255,255,255,0.55);
    --text-dim:     rgba(255,255,255,0.3);

    --primary:      #e63b2e;
    --primary-2:    #ff5544;
    --accent:       #00d4ff;
    --success:      #22c55e;
    --warning:      #f59e0b;
    --danger:       #ef4444;
    --purple:       #a855f7;

    --radius:       10px;
    --radius-sm:    6px;
    --shadow:       0 4px 20px rgba(0,0,0,0.25);
    --shadow-lg:    0 12px 40px rgba(0,0,0,0.5);
    --transition:   0.25s cubic-bezier(0.4, 0, 0.2, 1);

    --font-display: 'Orbitron', system-ui, sans-serif;
    --font-body:    'Inter', system-ui, sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, monospace;
}

/* ────────────────────────────────────────────────────────────
   LIGHT THEME
   ──────────────────────────────────────────────────────────── */
[data-theme="light"] {
    --bg:           #f5f6f8;
    --surface:      #ffffff;
    --surface-2:    #f8f9fb;
    --surface-3:    #eff1f4;
    --border:       rgba(0,0,0,0.1);
    --border-2:     rgba(0,0,0,0.06);
    --text:         #1a1a2e;
    --text-muted:   rgba(0,0,0,0.6);
    --text-dim:     rgba(0,0,0,0.4);
    --shadow:       0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg:    0 8px 30px rgba(0,0,0,0.12);
}

/* ────────────────────────────────────────────────────────────
   GLASS THEME — electric cobalt, AMOLED neon
   ──────────────────────────────────────────────────────────── */
[data-theme="glass"] {
    --bg:           #03050d;
    --surface:      rgba(10, 24, 58, 0.5);
    --surface-2:    rgba(8, 20, 48, 0.4);
    --surface-3:    rgba(6, 16, 38, 0.3);
    --border:       rgba(0, 200, 255, 0.35);
    --border-2:     rgba(0, 200, 255, 0.15);
    --text:         #e0f4ff;
    --text-muted:   rgba(180, 220, 255, 0.65);
    --text-dim:     rgba(180, 220, 255, 0.4);
    --primary:      #00d4ff;
    --primary-2:    #4dd9ff;
    --accent:       #b060ff;
    --success:      #00ff9d;
    --shadow:       0 4px 30px rgba(0, 100, 255, 0.25);
    --shadow-lg:    0 12px 50px rgba(0, 150, 255, 0.35);
}
[data-theme="glass"] body {
    background:
        radial-gradient(ellipse at 20% 0%, rgba(0, 80, 200, 0.25), transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(150, 0, 255, 0.15), transparent 50%),
        linear-gradient(135deg, #03050d, #06102a 50%, #02050f);
}
[data-theme="glass"] .sidebar,
[data-theme="glass"] .topbar,
[data-theme="glass"] .panel,
[data-theme="glass"] .stat-card,
[data-theme="glass"] .modal-box {
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    background: rgba(8, 20, 48, 0.55);
    border: 1px solid rgba(0, 200, 255, 0.35);
    box-shadow:
        0 0 0 1px rgba(0, 200, 255, 0.05) inset,
        0 0 30px rgba(0, 150, 255, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.6);
}
[data-theme="glass"] .stat-value {
    color: #00d4ff;
    text-shadow: 0 0 20px rgba(0, 200, 255, 0.6), 0 0 40px rgba(0, 200, 255, 0.3);
}
[data-theme="glass"] .panel-title,
[data-theme="glass"] .sb-brand-name {
    color: #00d4ff;
    text-shadow: 0 0 12px rgba(0, 200, 255, 0.5);
}

/* ────────────────────────────────────────────────────────────
   BASE
   ──────────────────────────────────────────────────────────── */
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; cursor: pointer; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ────────────────────────────────────────────────────────────
   LOGIN PAGE
   ──────────────────────────────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(230, 59, 46, 0.08), transparent 60%),
        radial-gradient(ellipse at 70% 70%, rgba(0, 100, 255, 0.05), transparent 60%),
        #050509;
}
.login-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 0;
}
.login-card {
    position: relative;
    z-index: 1;
    background: #0c0c14;
    border: 1px solid rgba(230, 59, 46, 0.25);
    border-radius: 12px;
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 60px rgba(230, 59, 46, 0.1);
    text-align: center;
}
.login-logo {
    width: 60px; height: 60px;
    border-radius: 50%;
    border: 2px solid rgba(230, 59, 46, 0.6);
    background: rgba(230, 59, 46, 0.08);
    color: #e63b2e;
    font-family: var(--font-display);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(230, 59, 46, 0.35); }
    50%      { box-shadow: 0 0 0 14px rgba(230, 59, 46, 0); }
}
.login-card h1 {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 4px;
    color: #e63b2e;
    margin-bottom: 4px;
}
.login-sub { font-size: 12px; color: rgba(255,255,255,0.35); margin-bottom: 24px; }
.login-card label {
    display: block;
    text-align: left;
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.4);
    margin: 14px 0 6px;
}
.login-card input {
    width: 100%;
    background: #0a0a12;
    border: 1px solid rgba(230, 59, 46, 0.2);
    border-radius: 6px;
    padding: 12px 14px;
    color: #fff;
    transition: border var(--transition);
}
.login-card input:focus { outline: none; border-color: #e63b2e; }
.login-card button[type="submit"] {
    width: 100%;
    background: linear-gradient(135deg, #e63b2e, #ff5544);
    color: #fff;
    padding: 13px;
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 12px;
    letter-spacing: 3px;
    font-weight: 700;
    margin-top: 18px;
    transition: transform var(--transition), box-shadow var(--transition);
}
.login-card button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 30px rgba(230, 59, 46, 0.4);
}
.login-hint {
    margin-top: 18px;
    font-size: 11px;
    color: rgba(255,255,255,0.3);
}
.login-hint code {
    font-family: var(--font-mono);
    background: rgba(255,255,255,0.05);
    padding: 2px 6px;
    border-radius: 3px;
    color: #00d4ff;
}
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 14px;
    text-align: left;
}
.alert-err  { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-warn { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }
.alert-ok   { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }

/* ────────────────────────────────────────────────────────────
   LAYOUT (Sidebar + Main)
   ──────────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 22px 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: background var(--transition), border-color var(--transition);
}
.sb-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 22px 22px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}
.sb-logo {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: rgba(230, 59, 46, 0.1);
    color: var(--primary);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition), box-shadow var(--transition);
}
.sb-logo:hover {
    transform: rotate(10deg) scale(1.05);
    box-shadow: 0 0 24px rgba(230, 59, 46, 0.5);
}
.sb-brand-name {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
}
.sb-brand-sub {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-top: 2px;
}

.sb-nav {
    flex: 1;
    padding: 0 12px;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all var(--transition);
    user-select: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
    background: linear-gradient(90deg, rgba(230, 59, 46, 0.18), rgba(230, 59, 46, 0.03));
    color: var(--text);
    box-shadow: inset 3px 0 0 var(--primary);
}
.nav-ico {
    font-size: 14px;
    color: var(--primary);
    width: 16px;
    text-align: center;
}

.sb-user {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
}
.sb-user-name { font-size: 13px; font-weight: 600; }
.sb-user-role {
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--primary);
    margin: 2px 0 8px;
}
.sb-logout {
    display: inline-block;
    font-size: 11px;
    color: var(--text-muted);
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: all var(--transition);
}
.sb-logout:hover { border-color: var(--primary); color: var(--primary); }

/* ────────────────────────────────────────────────────────────
   MAIN AREA
   ──────────────────────────────────────────────────────────── */
.main {
    margin-left: 240px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.topbar-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}
.live-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: live 1.5s ease-in-out infinite;
}
@keyframes live { 0%,100%{opacity:1} 50%{opacity:0.4} }
.clock {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 10px;
    background: var(--surface-2);
    border-radius: 4px;
}
.theme-switch {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface-2);
    border-radius: 20px;
}
.th-btn {
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all var(--transition);
}
.th-btn.th-dark  { background: #0a0a10; border-color: rgba(230,59,46,0.4); }
.th-btn.th-light { background: #f5f6f8; border-color: rgba(0,0,0,0.1); }
.th-btn.th-glass { background: linear-gradient(135deg, #00d4ff, #4d9fff); border-color: rgba(0,200,255,0.5); box-shadow: 0 0 8px rgba(0,200,255,0.4); }
.th-btn:hover { transform: scale(1.2); }
.th-btn.is-active { transform: scale(1.3); border-color: var(--text); }

.content {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
}

/* ────────────────────────────────────────────────────────────
   LOADER & TOAST
   ──────────────────────────────────────────────────────────── */
.loader {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}
.loader-spin {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 30px;
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    z-index: 200;
    animation: toastIn 0.3s ease;
}
.toast.is-success { border-color: var(--success); color: var(--success); }
.toast.is-error   { border-color: var(--danger);  color: var(--danger); }
@keyframes toastIn {
    from { transform: translate(-50%, 20px); opacity: 0; }
    to   { transform: translate(-50%, 0); opacity: 1; }
}

/* ────────────────────────────────────────────────────────────
   PANELS, CARDS, STATS
   ──────────────────────────────────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: all var(--transition);
}
.panel:hover { border-color: var(--border); }

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-2);
}
.panel-title {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--primary);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
    cursor: pointer;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}
.stat-card:hover::before { opacity: 1; }
.stat-label {
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}
.stat-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}
.stat-value.is-green  { color: var(--success); }
.stat-value.is-amber  { color: var(--warning); }
.stat-value.is-blue   { color: var(--accent); }
.stat-value.is-purple { color: var(--purple); }
.stat-sub {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 6px;
}

/* ────────────────────────────────────────────────────────────
   GRID LAYOUTS
   ──────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.chart-wrap { height: 220px; position: relative; }
.chart-wrap.is-small { height: 170px; }

/* ────────────────────────────────────────────────────────────
   TABLES
   ──────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th {
    text-align: left;
    padding: 12px 14px;
    background: var(--surface-2);
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-2);
    color: var(--text);
}
tr:hover td { background: var(--surface-2); }

/* ────────────────────────────────────────────────────────────
   FORMS, BUTTONS
   ──────────────────────────────────────────────────────────── */
.form-row { margin-bottom: 14px; }
.form-row label {
    display: block;
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
}
.form-row input,
.form-row select,
.form-row textarea {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--text);
    transition: border var(--transition);
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus { outline: none; border-color: var(--primary); }
.form-row textarea { min-height: 90px; resize: vertical; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: all var(--transition);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    border-color: transparent;
    color: #fff;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(230,59,46,0.35);
    color: #fff;
}
.btn-ghost {
    background: transparent;
    border-color: var(--border);
}
.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
}
.btn-sm { padding: 5px 10px; font-size: 11px; }

/* ────────────────────────────────────────────────────────────
   BADGES
   ──────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 1px;
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid;
}
.badge-success { background: rgba(34,197,94,0.1); color: var(--success); border-color: rgba(34,197,94,0.3); }
.badge-warn    { background: rgba(245,158,11,0.1); color: var(--warning); border-color: rgba(245,158,11,0.3); }
.badge-danger  { background: rgba(239,68,68,0.1); color: var(--danger); border-color: rgba(239,68,68,0.3); }
.badge-info    { background: rgba(0,212,255,0.1); color: var(--accent); border-color: rgba(0,212,255,0.3); }

/* ────────────────────────────────────────────────────────────
   MODAL
   ──────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}
.modal-overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    width: 90%; max-width: 720px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalIn {
    from { transform: scale(0.94) translateY(10px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px; height: 32px;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 16px;
    transition: all var(--transition);
}
.modal-close:hover { background: var(--surface-2); color: var(--primary); }
.modal-box h2 {
    font-family: var(--font-display);
    font-size: 16px;
    letter-spacing: 2px;
    color: var(--primary);
    margin-bottom: 6px;
}
.modal-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-2);
}

/* ────────────────────────────────────────────────────────────
   VISITOR ROW (used in day-click modal)
   ──────────────────────────────────────────────────────────── */
.v-row {
    display: grid;
    grid-template-columns: 30px 1fr auto;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-2);
}
.v-num {
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--text-dim);
}
.v-device { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.v-sub    { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.v-time   { font-family: var(--font-mono); font-size: 11px; color: var(--accent); }
.v-dur    { font-size: 10px; color: var(--text-dim); display: block; margin-top: 2px; text-align: right; }

/* ────────────────────────────────────────────────────────────
   LOCATIONS LIST
   ──────────────────────────────────────────────────────────── */
.loc-list {
    max-height: 360px;
    overflow-y: auto;
}
.loc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border-2);
}
.loc-row:hover { background: var(--surface-2); }
.loc-row.is-active {
    background: rgba(0, 212, 255, 0.08);
    border-left: 3px solid var(--accent);
}
.loc-city {
    padding-left: 28px;
    font-size: 12px;
}
.loc-count {
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
}

/* ────────────────────────────────────────────────────────────
   GEOMAP
   ──────────────────────────────────────────────────────────── */
#geomap {
    height: 460px;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}
.leaflet-popup-content-wrapper {
    background: rgba(8, 20, 48, 0.95) !important;
    color: #fff !important;
    border: 1px solid rgba(0, 200, 255, 0.4) !important;
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.2) !important;
}
.leaflet-popup-tip { background: rgba(8, 20, 48, 0.95) !important; }

/* ────────────────────────────────────────────────────────────
   UTILITIES
   ──────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.mt-1 { margin-top: 6px; }  .mt-2 { margin-top: 12px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 14px; }

/* ────────────────────────────────────────────────────────────
   RESPONSIVE
   ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.is-open { transform: translateX(0); }
    .main { margin-left: 0; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .content { padding: 16px; }
}

/* ────────────────────────────────────────────────────────────
   NOTIFICATION BELL + PANEL
   ──────────────────────────────────────────────────────────── */
.notif-btn {
    position: relative;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    width: 38px; height: 38px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--t);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.notif-btn:hover {
    background: var(--surface-3);
    border-color: var(--primary);
    transform: translateY(-1px);
}
.notif-btn .notif-ico {
    display: inline-block;
    transition: transform 0.3s;
}
.notif-btn:hover .notif-ico { transform: rotate(15deg) scale(1.1); }
.notif-count {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    background: var(--primary);
    color: #fff;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(230,59,46,0.6);
    animation: pulseBadge 2s ease-in-out infinite;
}
@keyframes pulseBadge {
    0%, 100% { box-shadow: 0 0 12px rgba(230,59,46,0.6); }
    50% { box-shadow: 0 0 18px rgba(230,59,46,0.9); }
}
.notif-panel {
    position: fixed;
    top: 64px; right: 16px;
    width: 380px;
    max-height: 520px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    z-index: 500;
    overflow: hidden;
    animation: slideDown 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.notif-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-2);
}
.notif-item {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-2);
    cursor: pointer;
    transition: var(--t);
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.is-unread { border-left: 3px solid var(--primary); }
.notif-item-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.notif-item-body  { font-size: 12px; color: var(--text-muted); }
.notif-item-time  { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* ────────────────────────────────────────────────────────────
   SCRAPER — animated scan UI
   ──────────────────────────────────────────────────────────── */
.scraper-hero {
    background: linear-gradient(135deg, var(--surface), var(--surface-2));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 18px;
}
.scraper-hero::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(0,212,255,0.08),
        rgba(230,59,46,0.08),
        transparent);
    animation: heroSweep 4s ease-in-out infinite;
}
@keyframes heroSweep {
    0% { left: -100%; }
    100% { left: 200%; }
}
.scan-btn {
    position: relative;
    background: linear-gradient(135deg, var(--primary), #ff6644);
    color: #fff;
    border: 0;
    padding: 16px 40px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 2px;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-display);
    text-transform: uppercase;
    box-shadow: 0 4px 20px rgba(230,59,46,0.4);
    transition: var(--t);
    overflow: hidden;
}
.scan-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(230,59,46,0.6);
}
.scan-btn:disabled {
    cursor: not-allowed;
    opacity: 0.85;
}
.scan-btn.is-scanning {
    background: linear-gradient(135deg, #00d4ff, #0094d4);
    box-shadow: 0 4px 20px rgba(0,212,255,0.5);
}
.scan-btn.is-scanning::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
    animation: scanSweep 1.5s linear infinite;
}
@keyframes scanSweep {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.scan-progress {
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 18px;
}
.scan-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d4ff, var(--primary));
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(0,212,255,0.6);
}

/* Scraper search + filters bar */
.search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 18px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-2);
    align-items: center;
}
.search-bar input,
.search-bar select {
    background: var(--surface);
    border: 1px solid var(--border-2);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
}
.search-bar input { flex: 1; min-width: 180px; }
.search-bar input:focus,
.search-bar select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230,59,46,0.12);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 14px;
    border-top: 1px solid var(--border-2);
}
.pagination button {
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    transition: var(--t);
    min-width: 32px;
}
.pagination button:hover:not(:disabled) {
    background: var(--surface-3);
    border-color: var(--primary);
}
.pagination button.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.pagination button:disabled { opacity: 0.35; cursor: not-allowed; }
.pagination-info { font-size: 12px; color: var(--text-muted); margin: 0 12px; }

/* Clickable table rows */
table.is-clickable tbody tr {
    cursor: pointer;
    transition: var(--t);
}
table.is-clickable tbody tr:hover {
    background: rgba(0,212,255,0.05);
}
[data-theme="light"] table.is-clickable tbody tr:hover {
    background: rgba(230,59,46,0.04);
}
[data-theme="glass"] table.is-clickable tbody tr:hover {
    background: rgba(0,200,255,0.08);
}

/* Forex tab visuals */
.forex-card {
    background: linear-gradient(135deg, var(--surface), var(--surface-2));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    position: relative;
    overflow: hidden;
}
.forex-pair-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.forex-pair {
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    transition: var(--t);
    position: relative;
}
.forex-pair:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.forex-pair.is-selected {
    border-color: var(--cyan);
    background: linear-gradient(135deg, var(--surface-2), rgba(0,212,255,0.05));
}
.forex-pair-name {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 1px;
}
.forex-pair-value {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}
.forex-pair-change {
    font-size: 12px;
    font-family: var(--font-mono);
}
.forex-pair-change.is-up { color: #22c55e; }
.forex-pair-change.is-down { color: #ef4444; }

/* Lead detail modal — refined card layout */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 16px 0;
}
.detail-cell {
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: 10px;
    padding: 12px 14px;
    transition: var(--t);
}
.detail-cell:hover {
    border-color: var(--primary);
    background: var(--surface-3);
}
.detail-cell-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 6px;
    font-weight: 600;
}
.detail-cell-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
    line-height: 1.4;
}
.detail-cell-value a {
    color: var(--cyan);
    text-decoration: none;
}
.detail-cell-value a:hover { text-decoration: underline; }

/* ────────────────────────────────────────────────────────────
   MAP — RADAR / PULSE MARKERS
   ──────────────────────────────────────────────────────────── */
.map-marker-wrap { background: transparent !important; border: 0 !important; }
.map-marker {
    position: relative;
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.map-marker-pulse {
    position: absolute;
    top: 50%; left: 50%;
    width: var(--ms);
    height: var(--ms);
    margin-top: calc(var(--ms) / -2);
    margin-left: calc(var(--ms) / -2);
    border-radius: 50%;
    border: 2px solid var(--mc);
    opacity: 0;
    animation: mapPulse 2.4s ease-out infinite;
}
@keyframes mapPulse {
    0%   { transform: scale(0.4); opacity: 0.9; }
    100% { transform: scale(3.5); opacity: 0; }
}
.map-marker-dot {
    position: relative;
    width: var(--ms); height: var(--ms);
    background: var(--mc);
    border: 2px solid rgba(255,255,255,0.85);
    border-radius: 50%;
    box-shadow: 0 0 calc(var(--ms) * 1.5) var(--mc), inset 0 0 8px rgba(255,255,255,0.3);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    z-index: 2;
}
.map-marker.is-hot .map-marker-dot {
    animation: hotShimmer 1.8s ease-in-out infinite;
}
@keyframes hotShimmer {
    0%, 100% { box-shadow: 0 0 14px var(--mc), inset 0 0 6px rgba(255,255,255,0.3); }
    50%      { box-shadow: 0 0 28px var(--mc), 0 0 50px var(--mc), inset 0 0 12px rgba(255,255,255,0.5); }
}

.map-popup { min-width: 200px; font-family: var(--font-body); }
.map-popup-title {
    font-family: var(--font-display);
    font-size: 13px;
    color: #00d4ff;
    font-weight: 700;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0,200,255,0.2);
}
.map-popup-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 3px 0;
    font-size: 12px;
}
.map-popup-stat span { color: rgba(255,255,255,0.6); }
.map-popup-stat strong { color: #fff; font-weight: 600; }
.map-popup-coord {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    text-align: center;
    letter-spacing: 1px;
}

/* ────────────────────────────────────────────────────────────
   NOTIFICATION PANEL — refined layout
   ──────────────────────────────────────────────────────────── */
.notif-panel {
    width: 400px;
    max-width: calc(100vw - 32px);
    padding: 0;
}
.notif-head {
    background: var(--surface-2);
    padding: 16px 20px;
}
.notif-head strong {
    font-family: var(--font-display);
    font-size: 13px;
    letter-spacing: 1.5px;
    color: var(--primary);
    text-transform: uppercase;
}
#notifList {
    max-height: 480px;
    overflow-y: auto;
}
.notif-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-2);
    cursor: pointer;
    transition: var(--t);
    position: relative;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); padding-left: 24px; }
.notif-item.is-unread { background: rgba(0, 212, 255, 0.04); }
.notif-item.is-unread::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    width: 3px;
    height: 60%;
    transform: translateY(-50%);
    background: var(--cyan);
    border-radius: 0 2px 2px 0;
}
.notif-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.notif-item-body {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}
.notif-item-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
}
.notif-empty {
    padding: 40px 24px;
    text-align: center;
    color: var(--text-muted);
}
.notif-empty .notif-empty-ico {
    font-size: 28px;
    opacity: 0.4;
    margin-bottom: 8px;
}

/* ────────────────────────────────────────────────────────────
   FOREX — polished cards
   ──────────────────────────────────────────────────────────── */
.forex-pair-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.forex-pair {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    cursor: pointer;
    transition: var(--t);
    position: relative;
    overflow: hidden;
}
.forex-pair::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--cyan);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.3s ease;
}
.forex-pair:hover {
    border-color: var(--cyan);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.forex-pair:hover::before { transform: scaleY(1); }
.forex-pair.is-selected {
    border-color: var(--cyan);
    background: linear-gradient(135deg, var(--surface), rgba(0, 212, 255, 0.06));
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.15);
}
.forex-pair.is-selected::before { transform: scaleY(1); }
.forex-pair-name {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.forex-pair-value {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}
.forex-pair-change {
    font-size: 12px;
    font-family: var(--font-mono);
    font-weight: 600;
}
.forex-pair-change.is-up   { color: #22c55e; }
.forex-pair-change.is-down { color: #ef4444; }
.forex-pair-change.is-flat { color: var(--text-muted); }

/* ────────────────────────────────────────────────────────────
   SCRAPER — table polish + clickable rows
   ──────────────────────────────────────────────────────────── */
.search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 20px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-2);
    align-items: center;
}
.search-bar input,
.search-bar select {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    transition: var(--t);
}
.search-bar input { flex: 1; min-width: 220px; }
.search-bar select { min-width: 140px; }
.search-bar input:focus,
.search-bar select:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
}
.search-bar input::placeholder { color: var(--text-muted); }

/* Scraper avatar */
.lead-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #ff6644);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    vertical-align: middle;
    box-shadow: 0 2px 8px rgba(230, 59, 46, 0.25);
    flex-shrink: 0;
}

/* Table row hover */
table.is-clickable tbody tr {
    cursor: pointer;
    transition: var(--t);
}
table.is-clickable tbody tr:hover {
    background: var(--surface-2);
}
table.is-clickable tbody tr:hover td:first-child {
    border-left: 3px solid var(--primary);
    padding-left: 13px;
}
[data-theme="glass"] table.is-clickable tbody tr:hover {
    background: rgba(0, 200, 255, 0.06);
}

/* Pagination polish */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 16px;
    border-top: 1px solid var(--border-2);
    background: var(--surface-2);
    flex-wrap: wrap;
}
.pagination button {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 7px 13px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    transition: var(--t);
    min-width: 34px;
}
.pagination button:hover:not(:disabled) {
    background: var(--surface-3);
    border-color: var(--cyan);
    color: var(--cyan);
}
.pagination button.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(230, 59, 46, 0.3);
}
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }
.pagination-info {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 10px;
    font-family: var(--font-mono);
}
