/* ============================================================
   MyTracker – Bold Light Dashboard v4.0
   Design: Light & Clean · Bold Grid · Strong Typography
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    /* Palette */
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --brand-light: #3b82f6;
    --brand-grad: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    --brand-glow: rgba(37, 99, 235, .25);

    --success: #059669;
    --success-dark: #047857;
    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --warning: #d97706;
    --warning-dark: #b45309;
    --info: #0284c7;
    --info-dark: #0369a1;

    /* Backgrounds */
    --bg-page: #f8fafc;
    --bg-sidebar: #1e293b;
    --bg-card: #ffffff;
    --bg-card-hov: #f1f5f9;
    --bg-input: #ffffff;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-white: #ffffff;
    --text-sidebar: #e2e8f0;

    /* Borders */
    --border: #e2e8f0;
    --border-bold: #cbd5e1;
    --border-sidebar: rgba(255, 255, 255, .15);

    /* Sidebar */
    --sidebar-w: 260px;
    --topbar-h: 66px;

    /* Corners - Sharper for bold design */
    --r-none: 0;
    --r-sm: 4px;
    --r-md: 6px;
    --r-lg: 8px;
    --r-xl: 10px;
    --r-2xl: 12px;
    --r-full: 9999px;

    /* Shadows */
    --shadow-none: none;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, .08);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, .10);
    --shadow-xl: 0 16px 32px rgba(0, 0, 0, .12);
    --glow-brand: 0 0 0 3px rgba(37, 99, 235, .10);

    /* Typography */
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

    /* Transitions */
    --ease: cubic-bezier(.4, 0, .2, 1);
    --t-fast: .14s;
    --t-med: .22s;
    --t-slow: .35s;
}

/* ── Reset ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand-light);
    text-decoration: none;
    transition: color var(--t-fast) var(--ease);
}

a:hover {
    color: #fff;
}

code {
    background: rgba(99, 102, 241, .15);
    color: var(--brand-light);
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Consolas', 'Fira Code', monospace;
    letter-spacing: .2px;
    border: 1px solid rgba(99, 102, 241, .20);
}

/* ── Layout ─────────────────────────────────────────────────── */
.layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ═══════════════════ SIDEBAR ═══════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 200;
    border-right: 3px solid var(--border-bold);
    transition: transform var(--t-slow) var(--ease);
}

.sidebar::-webkit-scrollbar {
    width: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 2px solid var(--border-sidebar);
    position: relative;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: var(--brand-grad);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}

.sidebar-brand span {
    color: var(--text-white);
    font-weight: 900;
    font-size: 18px;
    letter-spacing: -.4px;
}

.sidebar-brand .brand-sub {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: .8px;
    text-transform: uppercase;
    display: block;
    line-height: 1;
    margin-top: 3px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 14px 10px;
    flex: 1;
    gap: 1px;
}

.nav-section-label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 16px 10px 6px;
    opacity: .8;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 14px;
    color: var(--text-sidebar);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--r-sm);
    transition: all var(--t-fast) var(--ease);
    white-space: nowrap;
    position: relative;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, .10);
    color: var(--text-white);
    border-left-color: rgba(255, 255, 255, .3);
}

.nav-item.active {
    background: rgba(37, 99, 235, .15);
    color: var(--text-white);
    font-weight: 700;
    border-left-color: var(--brand);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.nav-item.nav-logout,
.nav-item.nav-logout i {
    color: rgba(239, 68, 68, .65) !important;
}

.nav-item.nav-logout {
    margin-top: auto;
}

.nav-item.nav-logout:hover {
    background: rgba(239, 68, 68, .10) !important;
    color: #ef4444 !important;
}

.nav-item.nav-logout:hover i {
    color: #ef4444 !important;
    opacity: 1 !important;
}

.sidebar-footer {
    padding: 12px;
    border-top: 2px solid var(--border-sidebar);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, .08);
    border-radius: var(--r-sm);
    padding: 10px 12px;
    cursor: default;
    border: 1px solid rgba(255, 255, 255, .12);
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    background: var(--brand-grad);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1.2;
}

.sidebar-user-role {
    font-size: 10.5px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ═══════════════════ TOPBAR ═══════════════════ */
.main-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.topbar {
    height: var(--topbar-h);
    background: var(--bg-card);
    border-bottom: 3px solid var(--border-bold);
    display: flex;
    align-items: center;
    padding: 0 26px;
    gap: 16px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
    background: var(--bg-page);
    border: 2px solid var(--border-bold);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: none;
    padding: 8px 11px;
    border-radius: var(--r-sm);
    transition: all var(--t-fast) var(--ease);
    font-weight: 700;
}

.sidebar-toggle:hover {
    background: var(--brand);
    color: var(--text-white);
    border-color: var(--brand);
}

.page-title {
    flex: 1;
    font-size: 20px;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -.6px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-btn {
    width: 38px;
    height: 38px;
    background: var(--bg-page);
    border: 2px solid var(--border-bold);
    color: var(--text-secondary);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    transition: all var(--t-fast) var(--ease);
    text-decoration: none;
    position: relative;
    font-weight: 700;
}

.topbar-btn:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--text-white);
    transform: translateY(-1px);
}

.topbar-notif-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    background: var(--danger);
    border-radius: 50%;
    border: 1.5px solid var(--bg-card);
}

.topbar-divider {
    width: 2px;
    height: 28px;
    background: var(--border-bold);
}

.admin-badge {
    background: var(--brand-grad);
    color: var(--text-white);
    border-radius: var(--r-sm);
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 700;
    border: none;
    display: flex;
    align-items: center;
    gap: 7px;
    letter-spacing: .2px;
}

/* ═══════════════════ CONTENT ═══════════════════ */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 28px 40px;
}

.content::-webkit-scrollbar {
    width: 5px;
}

.content::-webkit-scrollbar-track {
    background: transparent;
}

.content::-webkit-scrollbar-thumb {
    background: var(--border-bold);
    border-radius: 3px;
}

.content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ═══════════════════ CARDS ═══════════════════ */
.card {
    background: var(--bg-card);
    border: 3px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--t-med) var(--ease);
}

.card:hover {
    border-color: var(--border-bold);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 22px;
    font-weight: 800;
    font-size: 15px;
    border-bottom: 3px solid var(--border);
    color: var(--text-primary);
    background: var(--bg-page);
}

.card-header i {
    color: var(--brand);
    font-size: 16px;
    font-weight: 900;
}

.card-body {
    padding: 24px;
}

.card-body.p-0 {
    padding: 0;
}

.mt-2 {
    margin-top: 10px;
}

.mt-3 {
    margin-top: 16px;
}

.mt-4 {
    margin-top: 24px;
}

.mb-2 {
    margin-bottom: 10px;
}

.mb-3 {
    margin-bottom: 16px;
}

.mb-4 {
    margin-bottom: 24px;
}

/* ═══════════════════ STAT GRID ═══════════════════ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
}

.stat-card {
    background: var(--bg-card);
    border: 3px solid var(--border);
    border-radius: var(--r-lg);
    padding: 24px 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-md);
    transition: all var(--t-med) var(--ease);
    position: relative;
    overflow: visible;
    cursor: default;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-bold);
}

.stat-total::after {
    background: var(--brand-grad);
}

.stat-online::after {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.stat-offline::after {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.stat-location::after {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    font-weight: 900;
    margin-bottom: 4px;
}

.stat-total .stat-icon {
    background: #dbeafe;
    color: var(--brand);
    border: 2px solid var(--brand);
}

.stat-online .stat-icon {
    background: #d1fae5;
    color: var(--success);
    border: 2px solid var(--success);
}

.stat-offline .stat-icon {
    background: #fee2e2;
    color: var(--danger);
    border: 2px solid var(--danger);
}

.stat-location .stat-icon {
    background: #fed7aa;
    color: var(--warning);
    border: 2px solid var(--warning);
}

.stat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.stat-label {
    font-size: 11.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 800;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 32px;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -2px;
}

.stat-value-sm {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -.2px;
    color: var(--text-secondary);
}

/* ═══════════════════ TABLES ═══════════════════ */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead tr {
    background: var(--bg-page);
    border-bottom: 3px solid var(--border-bold);
}

.data-table th {
    padding: 13px 18px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-secondary);
    font-weight: 900;
    white-space: nowrap;
}

.data-table td {
    padding: 14px 18px;
    border-bottom: 2px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
    font-size: 14px;
    font-weight: 600;
    transition: background var(--t-fast) var(--ease);
}

.data-table tbody tr:hover td {
    background: var(--bg-card-hov);
    color: var(--text-primary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-success {
    color: var(--success) !important;
}

.action-cell {
    white-space: nowrap;
}

/* ═══════════════════ BADGES ═══════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--r-sm);
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: .6px;
    white-space: nowrap;
    border: 2px solid transparent;
}

.badge::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-success {
    background: #d1fae5;
    color: var(--success-dark);
    border-color: var(--success);
}

.badge-success::before {
    background: #10b981;
    animation: pulse-dot 2s infinite;
}

.badge-danger {
    background: #fee2e2;
    color: var(--danger-dark);
    border-color: var(--danger);
}

.badge-danger::before {
    background: #ef4444;
}

.badge-info {
    background: #dbeafe;
    color: var(--info-dark);
    border-color: var(--info);
}

.badge-info::before {
    background: #06b6d4;
}

.badge-warning {
    background: #fed7aa;
    color: var(--warning-dark);
    border-color: var(--warning);
}

.badge-warning::before {
    background: #f59e0b;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .5;
        transform: scale(.7);
    }
}

.badge-refresh {
    margin-left: auto;
    font-size: 10.5px;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 700;
}

/* ═══════════════════ BUTTONS ═══════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border: 2px solid transparent;
    border-radius: var(--r-md);
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--t-fast) var(--ease);
    text-decoration: none;
    font-family: var(--font);
    white-space: nowrap;
    letter-spacing: .3px;
    text-transform: uppercase;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: scale(.97) translateY(0);
    filter: brightness(.95);
}

.btn-primary {
    background: var(--brand-grad);
    color: #fff;
    box-shadow: 0 2px 10px rgba(99, 102, 241, .35);
}

.btn-secondary {
    background: var(--bg-page);
    color: var(--text-primary);
    border-color: var(--border-bold);
}

.btn-secondary:hover {
    background: var(--text-primary);
    color: var(--text-white);
    border-color: var(--text-primary);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 2px 10px rgba(16, 185, 129, .30);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 2px 10px rgba(239, 68, 68, .30);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 2px 10px rgba(245, 158, 11, .30);
}

.btn-info {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: #fff;
    box-shadow: 0 2px 10px rgba(6, 182, 212, .30);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-lg {
    padding: 14px 30px;
    font-size: 15px;
    border-radius: var(--r-lg);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: var(--r-sm);
    gap: 5px;
    font-weight: 700;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ═══════════════════ FORMS ═══════════════════ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: .3px;
    text-transform: uppercase;
}

.form-group label i {
    color: var(--brand-light);
    margin-right: 5px;
    font-size: 12px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-bold);
    border-radius: var(--r-md);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--glow-brand);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: var(--brand-light);
}

.form-group select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.form-control-inline {
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    color: var(--text-primary);
    padding: 9px 13px;
    border-radius: var(--r-md);
    font-size: 13px;
    font-family: var(--font);
    min-width: 240px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.form-control-inline:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .18);
}

.form-control-inline option {
    background: var(--bg-card);
}

.input-with-btn {
    display: flex;
    gap: 8px;
}

.input-with-btn input {
    flex: 1;
}

.field-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 5px;
    line-height: 1.5;
}

/* ═══════════════════ ALERTS ═══════════════════ */
.alert {
    padding: 16px 20px;
    border-radius: var(--r-md);
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1.5;
    letter-spacing: .2px;
}

.alert i {
    margin-top: 2px;
    flex-shrink: 0;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 2px solid #3b82f6;
}

.alert-warning {
    background: #fed7aa;
    color: #92400e;
    border: 2px solid #f59e0b;
}

/* ═══════════════════ INFO LIST ═══════════════════ */
.info-list {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 14px 12px;
}

.info-list dt {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .6px;
    font-weight: 700;
    align-self: center;
}

.info-list dd {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 13.5px;
}

.device-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

/* ═══════════════════ MINI MAP ═══════════════════ */
.mini-map {
    height: 240px;
    border-radius: var(--r-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

/* ═══════════════════ LIVE MAP PAGE ═══════════════════ */
#live-map {
    height: calc(100vh - 240px);
    min-height: 400px;
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.map-toolbar-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.map-toolbar-inner label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.map-toolbar-inner label i {
    color: var(--brand-light);
}

.map-coords {
    font-size: 11.5px;
    color: var(--text-muted);
    font-family: 'Consolas', monospace;
    font-weight: 700;
    background: var(--bg-page);
    padding: 4px 10px;
    border-radius: var(--r-sm);
    border: 2px solid var(--border-bold);
}

.map-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 13px;
    border-radius: var(--r-full);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .2px;
    white-space: nowrap;
}

.pill-online {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

.pill-offline {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

.pill-nodata {
    background: #fed7aa;
    color: #92400e;
    border: 2px solid #f59e0b;
}

.pill-error {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

.pill-waiting {
    background: #e2e8f0;
    color: #475569;
    border: 2px solid #94a3b8;
}

/* Google Maps info window styling */
.gmap-infowindow {
    font-family: var(--font);
    font-size: 13px;
    color: #1a1d40;
    min-width: 160px;
}

.gmap-infowindow strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.gmap-infowindow .iw-coords {
    color: #555;
    font-size: 12px;
}

.gmap-infowindow .iw-time {
    color: #888;
    font-size: 11px;
    margin-top: 4px;
}

/* ═══════════════════ AUDIO PAGE ═══════════════════ */
.audio-card .audio-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 28px;
}

.audio-canvas {
    width: 100%;
    max-width: 720px;
    height: 140px;
    background: rgba(255, 255, 255, .03);
    border-radius: var(--r-lg);
    border: 1.5px solid var(--border);
    display: block;
}

.audio-status {
    margin-top: 16px;
    font-size: 14px;
    font-weight: 600;
}

.audio-volume {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.audio-volume label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.audio-volume label i {
    color: var(--brand-light);
}

.audio-volume input[type="range"] {
    accent-color: var(--brand);
    width: 180px;
    cursor: pointer;
}

.audio-log {
    width: 100%;
    max-width: 720px;
    max-height: 160px;
    overflow-y: auto;
    background: var(--bg-page);
    border: 2px solid var(--border-bold);
    border-radius: var(--r-md);
    padding: 10px 14px;
    font-family: 'Consolas', monospace;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.9;
    font-weight: 600;
}

.audio-log::-webkit-scrollbar {
    width: 4px;
}

.audio-log::-webkit-scrollbar-thumb {
    background: var(--border-bold);
    border-radius: 2px;
}

/* ═══════════════════ LOGIN PAGE ═══════════════════ */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-page);
    position: relative;
    overflow: hidden;
}

.login-body::before {
    content: '';
    position: absolute;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(99, 102, 241, .08) 0%, transparent 65%);
    top: -200px;
    right: -150px;
    animation: blob-drift 12s ease-in-out infinite alternate;
    pointer-events: none;
}

.login-body::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, .06) 0%, transparent 65%);
    bottom: -100px;
    left: -80px;
    animation: blob-drift 10s ease-in-out infinite alternate-reverse;
    pointer-events: none;
}

@keyframes blob-drift {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(30px, 20px) scale(1.05);
    }
}

.login-container {
    width: 100%;
    max-width: 430px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--r-xl);
    padding: 44px 40px;
    box-shadow: var(--shadow-xl);
    border: 3px solid var(--border-bold);
}

.login-logo {
    width: 68px;
    height: 68px;
    background: var(--brand-grad);
    border-radius: var(--r-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
    color: white;
    box-shadow: 0 8px 32px rgba(99, 102, 241, .40);
}

.login-card h2 {
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -.6px;
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 32px;
    font-weight: 500;
}

/* ═══════════════════ MISC / UTILITIES ═══════════════════ */
.how-to-list {
    padding-left: 20px;
    color: var(--text-secondary);
    line-height: 2.2;
    font-size: 13px;
}

.page-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
}

.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    opacity: .25;
    display: block;
    margin-bottom: 14px;
}

.empty-state p {
    font-size: 13px;
    font-weight: 500;
}

/* ═══════════════════ SCROLLBAR (global) ═══════════════════ */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-bold);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ═══════════════════ RESPONSIVE ═══════════════════ */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 40px rgba(0, 0, 0, .60);
    }

    .sidebar-toggle {
        display: flex;
    }

    .content {
        padding: 16px 16px 32px;
    }
}

@media (max-width: 768px) {
    .stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    #live-map {
        height: 55vh;
    }

    .device-detail-grid {
        grid-template-columns: 1fr;
    }

    .info-list {
        grid-template-columns: 90px 1fr;
    }

    .page-title {
        font-size: 15px;
    }

    .login-card {
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 0 16px;
    }

    .content {
        padding: 14px 14px 28px;
    }
}