:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-soft: #eef2ff;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #e2e8f0;
    --bg: #f1f5f9;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --green: #16a34a;
    --green-bg: #f0fdf4;
    --red: #dc2626;
    --red-bg: #fef2f2;
    --amber: #d97706;
    --amber-bg: #fffbeb;
    --blue: #2563eb;
    --blue-bg: #eff6ff;
    --violet: #7c3aed;
    --violet-bg: #f5f3ff;
    --radius: 14px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 264px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0; bottom: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 22px;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand .logo {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 16px;
    flex-shrink: 0;
}
.sidebar-brand .brand-text { line-height: 1.2; }
.sidebar-brand .brand-text b { display: block; color: #fff; font-size: 15px; letter-spacing: .2px; }
.sidebar-brand .brand-text small { font-size: 11px; color: var(--sidebar-text); }
.sidebar-close {
    display: none; position: absolute; top: 14px; right: 14px; z-index: 10;
    background: none; border: none; color: var(--sidebar-text); cursor: pointer; padding: 4px;
    border-radius: 6px; transition: background .15s, color .15s;
}
.sidebar-close:hover { background: rgba(255,255,255,.1); color: #fff; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

.nav-group {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.1px;
    color: #475569; padding: 16px 12px 6px; font-weight: 700;
}

.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9.5px 12px;
    border-radius: 9px;
    color: var(--sidebar-text);
    font-weight: 500; font-size: 13.5px;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--sidebar-active); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .badge {
    margin-left: auto; background: var(--red); color: #fff;
    font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 20px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.07);
    font-size: 12px; color: #64748b;
}

/* ---------- Main ---------- */
.main { flex: 1; margin-left: 264px; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    height: 64px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 40;
}
.topbar .burger { display: none; cursor: pointer; background: none; border: none; color: var(--text); padding: 6px; }
.topbar h1 { font-size: 18px; font-weight: 700; }
.topbar .top-right { display: flex; align-items: center; gap: 14px; }

.page { padding: 26px 28px 40px; max-width: 1400px; width: 100%; }

/* ---------- Cards ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-header h2 { font-size: 15px; font-weight: 700; }
.card-header .sub { font-size: 12.5px; color: var(--muted); }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); }

/* ---------- Stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    position: relative; overflow: hidden;
}
.stat-card .stat-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}
.stat-card .stat-icon svg { width: 20px; height: 20px; }
.stat-card .stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-card .stat-value { font-size: 24px; font-weight: 800; margin-top: 2px; letter-spacing: -.5px; }
.stat-card .stat-foot { font-size: 12px; color: var(--muted); margin-top: 4px; }
.icon-indigo { background: var(--primary-soft); color: var(--primary); }
.icon-green { background: var(--green-bg); color: var(--green); }
.icon-red { background: var(--red-bg); color: var(--red); }
.icon-amber { background: var(--amber-bg); color: var(--amber); }
.icon-blue { background: var(--blue-bg); color: var(--blue); }
.icon-violet { background: var(--violet-bg); color: var(--violet); }

/* ---------- Period Pills ---------- */
.period-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
}
.period-pill:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.period-pill.active { border-color: var(--primary); color: #fff; background: var(--primary); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8.5px 16px;
    border-radius: 9px;
    border: 1px solid transparent;
    font-size: 13.5px; font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { background: #fff; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { background: #e0e7ff; }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: #fee2e2; }
.btn-success { background: var(--green-bg); color: var(--green); }
.btn-success:hover { background: #dcfce7; }
.btn-amber { background: var(--amber-bg); color: var(--amber); }
.btn-amber:hover { background: #fef3c7; }
.btn-sm { padding: 5.5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-group label .req { color: var(--red); }
.form-control {
    width: 100%;
    padding: 9.5px 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
textarea.form-control { min-height: 110px; resize: vertical; font-family: inherit; }
select.form-control { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 11px center; background-size: 15px; padding-right: 34px; }
.form-control::placeholder { color: #94a3b8; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.form-text { font-size: 12px; color: var(--muted); margin-top: 4px; }
.input-group { display: flex; gap: 8px; }
.input-group .form-control { flex: 1; }
.input-group .btn { flex-shrink: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
table.data thead th {
    text-align: left;
    padding: 11px 14px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--muted);
    white-space: nowrap;
}
table.data tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.data tbody tr:hover { background: #f8fafc; }
table.data tbody tr:last-child td { border-bottom: none; }
.td-num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

.table-tools {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}
.table-tools .filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.table-tools .filters .form-control { width: auto; min-width: 150px; padding: 8px 12px; }
.table-tools .search { position: relative; flex: 3; }
.table-tools .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: #94a3b8; }
.table-tools .search input { padding-left: 32px; }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; opacity: .35; margin-bottom: 10px; }

/* ---------- Pagination ---------- */
.pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; flex-wrap: wrap; gap: 10px;
}
.pg-info { font-size: 12.5px; color: var(--muted); }
.pg-links { display: flex; gap: 5px; }
.pg-btn {
    padding: 6px 12px; border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 12.5px; font-weight: 600; color: var(--text);
    background: #fff;
}
.pg-btn:hover { border-color: var(--primary); color: var(--primary); }
.pg-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pg-btn.disabled { opacity: .45; pointer-events: none; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--green-bg); color: var(--green); }
.badge-danger { background: var(--red-bg); color: var(--red); }
.badge-warning { background: var(--amber-bg); color: var(--amber); }
.badge-info { background: var(--blue-bg); color: var(--blue); }
.badge-violet { background: var(--violet-bg); color: var(--violet); }
.badge-muted { background: #f1f5f9; color: var(--muted); }

/* ---------- Alerts ---------- */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; border-radius: 10px;
    font-size: 13.5px; margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--green-bg); color: #166534; border-color: #bbf7d0; }
.alert-error { background: var(--red-bg); color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--amber-bg); color: #92400e; border-color: #fde68a; }
.alert-info { background: var(--blue-bg); color: #1e40af; border-color: #bfdbfe; }

.toast-wrap { position: fixed; top: 76px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    display: flex; align-items: center; gap: 10px;
    background: #fff; border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-lg);
    padding: 12px 16px; border-radius: 10px;
    font-size: 13.5px; font-weight: 600;
    animation: slideIn .25s ease;
    max-width: 360px;
}
.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }
.toast-warning { border-left-color: var(--amber); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab-link {
    padding: 10px 18px; font-size: 13.5px; font-weight: 600; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-link:hover { color: var(--text); }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }
.actions-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions-row > form { flex: 1; min-width: 200px; }

/* ---------- Avatar ---------- */
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--c, linear-gradient(135deg, var(--primary), #8b5cf6));
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell .u-name { font-weight: 600; font-size: 13.5px; }
.user-cell .u-sub { font-size: 12px; color: var(--muted); }

/* ---------- Detail rows ---------- */
.detail-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.detail-item { background: #fff; padding: 13px 16px; }
.detail-item dt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 3px; }
.detail-item dd { font-size: 13.5px; font-weight: 600; word-break: break-word; }

/* ---------- Login ---------- */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 55%, #4f46e5 130%);
    padding: 20px;
}
.auth-card {
    width: 100%; max-width: 400px;
    background: #fff; border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 36px 34px;
}
.auth-card .auth-logo {
    width: 54px; height: 54px; border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 24px; font-weight: 800; margin-bottom: 18px;
}
.auth-card h1 { font-size: 21px; font-weight: 800; margin-bottom: 4px; }
.auth-card .auth-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12px; color: var(--muted); }

.input-affix { position: relative; }
.input-affix .form-control { padding-right: 42px; }
.input-affix .affix-btn {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; border: none; background: none; border-radius: 8px;
    color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
}
.input-affix .affix-btn:hover { background: var(--border); color: var(--text); }
.input-affix .affix-btn svg { width: 17px; height: 17px; }

/* ---------- Misc ---------- */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.grid-2-eq { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1100px) {
    .grid-2, .grid-2-eq { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .stats-grid { grid-template-columns: 1fr; }
}
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 14px; } .mt-3 { margin-top: 22px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 14px; } .mb-3 { margin-bottom: 22px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.bold { font-weight: 700; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }

.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; }

code.raw { background: #0f172a; color: #a5b4fc; padding: 2px 8px; border-radius: 6px; font-size: 12px; word-break: break-all; }

/* Service toggle grid (network status page) */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.svc-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
}
.svc-name { font-weight: 600; font-size: 13.5px; }

/* Status switch (toggle) */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
    position: absolute; inset: 0; background: #cbd5e1; border-radius: 30px; transition: .2s; cursor: pointer;
}
.toggle .slider::before {
    content: ''; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px;
    background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .slider { background: var(--green); }
.toggle input:checked + .slider::before { transform: translateX(18px); }

/* Modal */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(15,23,42,.5);
    display: none; align-items: center; justify-content: center; z-index: 300; padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal {
    background: #fff; border-radius: 16px; width: 100%; max-width: 480px;
    box-shadow: var(--shadow-lg); max-height: 92vh; overflow-y: auto;
}
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-header .close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 22px; }
.modal-footer { padding: 15px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* Sidebar toggle for mobile */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .main { margin-left: 0; }
    .topbar .burger { display: block; }
}

/* Charts placeholder bars */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding: 10px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-col .bar { width: 100%; max-width: 44px; background: linear-gradient(180deg, #818cf8, var(--primary)); border-radius: 6px 6px 2px 2px; min-height: 2px; transition: height .4s ease; }
.bar-col .bar-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.bar-col .bar-val { font-size: 11px; font-weight: 700; color: var(--text); }

/* ---------- Confirm dialog ---------- */
.dialog-backdrop {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center;
    z-index: 500; padding: 20px;
    opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility .18s ease;
}
.dialog-backdrop.show { opacity: 1; visibility: visible; }
.dialog {
    background: #fff; border-radius: 18px; width: 100%; max-width: 400px;
    box-shadow: var(--shadow-lg);
    transform: translateY(12px) scale(.97); transition: transform .18s ease;
    overflow: hidden;
}
.dialog-backdrop.show .dialog { transform: none; }
.dialog-body { padding: 26px 26px 6px; text-align: center; }
.dialog-icon {
    width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--red-bg); color: var(--red);
}
.dialog-icon svg { width: 27px; height: 27px; }
.dialog-title { font-size: 16.5px; font-weight: 800; margin-bottom: 6px; }
.dialog-msg { color: var(--muted); font-size: 13.5px; line-height: 1.55; word-break: break-word; }
.dialog-footer { padding: 18px 26px 24px; display: flex; gap: 10px; justify-content: center; }
.dialog-footer .btn { min-width: 112px; }

/* ---------- Loading overlay ---------- */
.loading-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(2px);
    display: none; align-items: center; justify-content: center;
    z-index: 600;
}
.loading-overlay.show { display: flex; }
.loading-card {
    background: #fff; border-radius: 18px; padding: 28px 38px;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    box-shadow: var(--shadow-lg);
    animation: dialogPop .2s ease;
}
@keyframes dialogPop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.loading-spinner {
    width: 40px; height: 40px; border-radius: 50%;
    border: 4px solid var(--primary-soft);
    border-top-color: var(--primary);
    animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 14px; font-weight: 700; color: var(--text); }

/* ---------- Analytics ---------- */
.analytics-filter {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 16px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.analytics-filter .filter-label {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; font-weight: 800; color: var(--muted);
    text-transform: uppercase; letter-spacing: .5px;
}
.analytics-filter .filter-label svg { color: var(--primary); }
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-tab {
    padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
    background: #fff; color: var(--muted); font-size: 12.5px; font-weight: 700;
    cursor: pointer; transition: all .15s ease; font-family: inherit;
}
.filter-tab:hover { border-color: var(--primary); color: var(--primary); }
.filter-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.analytics-filter .filter-note { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.analytics-filter .filter-note b { color: var(--primary-dark); }
.analytics-chart { width: 100%; height: 190px; display: block; }
.chart-empty { display: flex; align-items: center; justify-content: center; height: 190px; color: var(--muted); font-size: 13px; }
.chart-legend { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.legend-item .dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.legend-peak { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--text); background: var(--primary-soft); color: var(--primary-dark); padding: 4px 10px; border-radius: 20px; }
.chart-xlabels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-weight: 600; padding-top: 4px; }
.hourly-chart { gap: 4px; }
.hourly-chart .bar-col .bar { max-width: 14px; background: linear-gradient(180deg, #38bdf8, var(--blue)); }
.kpi-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 20px; }
.kpi-delta.up { background: var(--green-bg); color: var(--green); }
.kpi-delta.down { background: var(--red-bg); color: var(--red); }
.avatar { --c: #6366f1; }
table.data .right { text-align: right; }
table.data td.center { text-align: center; }
table.data thead th.right { text-align: right; }

/* ---------- Responsive: hide table columns ---------- */
@media (max-width: 768px) {
    .hide-mobile, th.hide-mobile, td.hide-mobile { display: none; }

    .table-tools {
        flex-direction: column; align-items: stretch; padding: 12px 14px;
    }
    .table-tools .filters {
        flex-direction: column; gap: 8px;
    }
    .table-tools .filters .form-control {
        width: 100%; min-width: 0; padding: 10px 12px; font-size: 14px;
    }
    .table-tools .search { flex: none; width: 100%; }
    .table-tools .search input { font-size: 15px; padding: 10px 12px 10px 36px; }
    .table-tools .btn { width: 100%; justify-content: center; padding: 10px; }
    .table-tools .table-action { width: 100%; }
    .table-tools .table-action .btn { width: 100%; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stats-grid .stat-card { padding: 14px; }
    .stats-grid .stat-value { font-size: 18px; }

    .data { font-size: 13px; }
    .data th, .data td { padding: 8px 10px; }

    .card-header { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
    .pagination { flex-direction: column; align-items: center; gap: 8px; padding: 12px 14px; }
}
