* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: #060a14; color: #e2e8f0; min-height: 100vh; }
::selection { background: rgba(139, 92, 246, 0.3); }

/* ── Login ──────────────────────────────────────────── */
#loginScreen { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #060a14 0%, #12082e 50%, #060a14 100%); }
.login-box { background: rgba(12, 16, 32, 0.95); border: 1px solid rgba(139, 92, 246, 0.2); border-radius: 20px; padding: 48px; width: 420px; backdrop-filter: blur(20px); }
.login-icon { text-align: center; margin-bottom: 16px; }
.login-box h1 { text-align: center; font-size: 22px; font-weight: 900; background: linear-gradient(135deg, #a78bfa, #818cf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: 2px; }
.login-box > p { text-align: center; color: #475569; font-size: 12px; margin: 4px 0 28px; }

/* ── Forms ──────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 11px; font-weight: 700; color: #64748b; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 11px 14px; background: rgba(15, 23, 42, 0.8); border: 1px solid rgba(100, 116, 139, 0.2);
    border-radius: 8px; color: #e2e8f0; font-size: 13px; outline: none; transition: border-color 0.2s; font-family: 'Inter', sans-serif;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #7c3aed; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* ── Buttons ────────────────────────────────────────── */
.btn-primary { width: 100%; padding: 12px; background: linear-gradient(135deg, #7c3aed, #6366f1); border: none; border-radius: 8px; color: white; font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.2s; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-create { padding: 9px 18px; background: linear-gradient(135deg, #7c3aed, #6366f1); border: none; border-radius: 8px; color: white; font-size: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 4px; white-space: nowrap; transition: all 0.15s; }
.btn-create:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3); }
.btn-create .material-symbols-outlined { font-size: 16px; }
.btn-cancel { padding: 9px 18px; background: rgba(100, 116, 139, 0.1); border: 1px solid rgba(100, 116, 139, 0.2); border-radius: 8px; color: #94a3b8; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-secondary { padding: 9px 18px; background: rgba(96, 165, 250, 0.1); border: 1px solid rgba(96, 165, 250, 0.2); border-radius: 8px; color: #60a5fa; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-danger-solid { padding: 9px 18px; background: rgba(239, 68, 68, 0.8); border: none; border-radius: 8px; color: white; font-size: 12px; font-weight: 700; cursor: pointer; }
.btn-logout { padding: 6px 8px; background: none; border: 1px solid rgba(239, 68, 68, 0.2); border-radius: 6px; color: #f87171; cursor: pointer; display: flex; transition: all 0.15s; }
.btn-logout:hover { background: rgba(239, 68, 68, 0.1); }
.msg-error { color: #f87171; font-size: 12px; text-align: center; margin-top: 10px; min-height: 18px; }

.btn-sm { padding: 5px 10px; border-radius: 5px; font-size: 10px; font-weight: 700; cursor: pointer; border: 1px solid transparent; transition: all 0.12s; white-space: nowrap; }
.btn-sm:hover { opacity: 0.8; transform: translateY(-1px); }
.btn-edit { background: rgba(139, 92, 246, 0.12); color: #a78bfa; border-color: rgba(139, 92, 246, 0.2); }
.btn-extend { background: rgba(52, 211, 153, 0.12); color: #34d399; border-color: rgba(52, 211, 153, 0.2); }
.btn-revoke { background: rgba(251, 191, 36, 0.12); color: #fbbf24; border-color: rgba(251, 191, 36, 0.2); }
.btn-reset { background: rgba(96, 165, 250, 0.12); color: #60a5fa; border-color: rgba(96, 165, 250, 0.2); }
.btn-delete { background: rgba(239, 68, 68, 0.12); color: #f87171; border-color: rgba(239, 68, 68, 0.2); }
.btn-ban { background: rgba(239, 68, 68, 0.12); color: #f87171; border-color: rgba(239, 68, 68, 0.2); }
.btn-unban { background: rgba(52, 211, 153, 0.12); color: #34d399; border-color: rgba(52, 211, 153, 0.2); }
.btn-copy { background: rgba(96, 165, 250, 0.12); color: #60a5fa; border-color: rgba(96, 165, 250, 0.2); }
.btn-export { padding: 9px 18px; background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.2); border-radius: 8px; color: #34d399; font-size: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 4px; white-space: nowrap; }

/* ── Sidebar ────────────────────────────────────────── */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 230px; background: rgba(8, 12, 24, 0.98);
    border-right: 1px solid rgba(100, 116, 139, 0.06); display: flex; flex-direction: column; z-index: 50;
}
.sidebar-header { padding: 20px 18px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(100, 116, 139, 0.06); }
.sidebar-title { font-size: 13px; font-weight: 900; letter-spacing: 1px; background: linear-gradient(135deg, #a78bfa, #818cf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sidebar-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: none; background: none; color: #4a5568; font-size: 13px; font-weight: 500; cursor: pointer; border-radius: 8px; transition: all 0.15s; width: 100%; text-align: left; }
.nav-item:hover { background: rgba(139, 92, 246, 0.05); color: #94a3b8; }
.nav-item.active { background: rgba(139, 92, 246, 0.1); color: #a78bfa; font-weight: 600; }
.nav-item .material-symbols-outlined { font-size: 20px; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(100, 116, 139, 0.06); display: flex; align-items: center; justify-content: space-between; }
.admin-info { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #4a5568; }
.sidebar-version { padding: 0 18px 14px; font-size: 10px; color: #1e293b; }

/* ── Main Content ───────────────────────────────────── */
#dashboard { display: flex; }
.main-content { margin-left: 230px; padding: 28px 32px; min-height: 100vh; flex: 1; }
.tab-content { display: none; animation: fadeIn 0.2s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 20px; font-weight: 800; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Search ─────────────────────────────────────────── */
.search-box { position: relative; }
.search-box input { padding: 9px 14px 9px 36px; background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(100, 116, 139, 0.12); border-radius: 8px; color: #e2e8f0; font-size: 12px; width: 260px; outline: none; transition: all 0.2s; }
.search-box input:focus { border-color: #7c3aed; width: 300px; }
.search-box .material-symbols-outlined { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 18px; color: #334155; }

/* ── Filter ─────────────────────────────────────────── */
.filter-bar { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-btn { padding: 7px 14px; border: 1px solid transparent; background: rgba(15, 23, 42, 0.4); border-radius: 6px; color: #475569; font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.filter-btn:hover { color: #94a3b8; background: rgba(15, 23, 42, 0.7); }
.filter-btn.active { background: rgba(139, 92, 246, 0.1); border-color: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.filter-count { font-size: 9px; opacity: 0.6; margin-left: 4px; }

/* ── Stats Grid ─────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 10px; margin-bottom: 24px; }
.stat-card { background: rgba(12, 16, 32, 0.7); border: 1px solid rgba(100, 116, 139, 0.06); border-radius: 10px; padding: 16px; display: flex; align-items: center; gap: 14px; transition: all 0.15s; }
.stat-card:hover { border-color: rgba(100, 116, 139, 0.12); transform: translateY(-1px); }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon .material-symbols-outlined { font-size: 20px; }
.stat-icon.purple { background: rgba(139, 92, 246, 0.1); color: #a78bfa; }
.stat-icon.green { background: rgba(52, 211, 153, 0.1); color: #34d399; }
.stat-icon.blue { background: rgba(96, 165, 250, 0.1); color: #60a5fa; }
.stat-icon.amber { background: rgba(251, 191, 36, 0.1); color: #fbbf24; }
.stat-icon.red { background: rgba(239, 68, 68, 0.1); color: #f87171; }
.stat-icon.gray { background: rgba(100, 116, 139, 0.1); color: #94a3b8; }
.stat-label { font-size: 10px; font-weight: 700; color: #334155; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-value { font-size: 22px; font-weight: 800; color: #e2e8f0; margin-top: 1px; }

/* ── Panel / Table ──────────────────────────────────── */
.panel { background: rgba(12, 16, 32, 0.7); border: 1px solid rgba(100, 116, 139, 0.06); border-radius: 10px; overflow: hidden; }
.panel-header { padding: 14px 18px; border-bottom: 1px solid rgba(100, 116, 139, 0.04); display: flex; align-items: center; justify-content: space-between; }
.panel-header h3 { font-size: 13px; font-weight: 700; color: #94a3b8; }
.panel-body { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; padding: 10px 14px; font-size: 10px; font-weight: 800; color: #334155; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid rgba(100, 116, 139, 0.04); white-space: nowrap; cursor: pointer; user-select: none; transition: color 0.15s; }
thead th:hover { color: #64748b; }
thead th.sorted { color: #a78bfa; }
tbody td { padding: 11px 14px; font-size: 12px; border-bottom: 1px solid rgba(100, 116, 139, 0.03); white-space: nowrap; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: rgba(139, 92, 246, 0.03); }
.actions-cell { display: flex; gap: 3px; flex-wrap: wrap; }

/* ── Badges ─────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 5px; font-size: 10px; font-weight: 800; letter-spacing: 0.3px; }
.badge-active { background: rgba(52, 211, 153, 0.1); color: #34d399; }
.badge-unused { background: rgba(96, 165, 250, 0.1); color: #60a5fa; }
.badge-expired { background: rgba(239, 68, 68, 0.1); color: #f87171; }
.badge-revoked { background: rgba(251, 191, 36, 0.1); color: #fbbf24; }
.badge-admin { background: rgba(139, 92, 246, 0.1); color: #a78bfa; }
.badge-user { background: rgba(100, 116, 139, 0.08); color: #64748b; }
.badge-banned { background: rgba(239, 68, 68, 0.1); color: #f87171; }

/* ── Remaining days ─────────────────────────────────── */
.days-remaining { font-size: 10px; font-weight: 700; }
.days-ok { color: #34d399; }
.days-warn { color: #fbbf24; }
.days-critical { color: #f87171; }
.days-expired { color: #475569; text-decoration: line-through; }

/* ── Key Display ────────────────────────────────────── */
.key-display { background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(139, 92, 246, 0.12); border-radius: 6px; padding: 10px 14px; font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 13px; color: #a78bfa; cursor: pointer; word-break: break-all; transition: border-color 0.15s; margin-bottom: 4px; }
.key-display:hover { border-color: rgba(139, 92, 246, 0.35); }
.keys-label { font-size: 11px; font-weight: 700; color: #34d399; margin-bottom: 8px; display: block; }
code.key { font-family: 'JetBrains Mono', 'Courier New', monospace; color: #a78bfa; font-size: 11px; cursor: pointer; transition: color 0.15s; }
code.key:hover { color: #c4b5fd; text-decoration: underline; }

/* ── Checkbox ───────────────────────────────────────── */
.checkbox-cell { width: 32px; }
input[type="checkbox"] { accent-color: #7c3aed; width: 14px; height: 14px; cursor: pointer; }

/* ── Bulk Actions Bar ───────────────────────────────── */
.bulk-bar { display: none; padding: 10px 18px; background: rgba(139, 92, 246, 0.08); border-bottom: 1px solid rgba(139, 92, 246, 0.1); align-items: center; gap: 12px; font-size: 12px; }
.bulk-bar.show { display: flex; }
.bulk-bar .count { font-weight: 700; color: #a78bfa; }
.bulk-bar .bulk-actions { display: flex; gap: 6px; margin-left: auto; }

/* ── Modal ──────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.8); z-index: 200; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.show { display: flex; }
.modal { background: #0c1020; border: 1px solid rgba(139, 92, 246, 0.15); border-radius: 14px; padding: 28px; width: 540px; max-width: 92vw; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h3 { font-size: 16px; font-weight: 800; }
.modal-close { background: none; border: none; color: #475569; font-size: 22px; cursor: pointer; transition: color 0.15s; }
.modal-close:hover { color: #94a3b8; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal-actions .btn-primary { width: auto; padding: 9px 24px; }

/* ── Device list ────────────────────────────────────── */
.device-list { margin-top: 8px; }
.device-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: rgba(15, 23, 42, 0.4); border: 1px solid rgba(100, 116, 139, 0.06); border-radius: 6px; margin-bottom: 4px; font-size: 11px; transition: border-color 0.15s; }
.device-item:hover { border-color: rgba(100, 116, 139, 0.12); }
.device-info { display: flex; flex-direction: column; gap: 2px; }
.device-hwid { font-family: monospace; color: #94a3b8; font-size: 10px; }
.device-meta { color: #334155; font-size: 10px; }
.device-blocked { opacity: 0.4; border-color: rgba(239, 68, 68, 0.15); }

/* ── Toast Notifications ────────────────────────────── */
#toastContainer { position: fixed; top: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: all; padding: 12px 18px; border-radius: 8px; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 8px; animation: slideIn 0.25s ease; min-width: 280px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
.toast-success { background: rgba(5, 150, 105, 0.95); color: white; }
.toast-error { background: rgba(220, 38, 38, 0.95); color: white; }
.toast-info { background: rgba(79, 70, 229, 0.95); color: white; }
.toast .material-symbols-outlined { font-size: 18px; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ── User Detail Modal ──────────────────────────────── */
.user-detail-section { margin-top: 16px; }
.user-detail-section h4 { font-size: 12px; font-weight: 700; color: #64748b; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.user-detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
.detail-item { background: rgba(15, 23, 42, 0.4); border-radius: 6px; padding: 10px 12px; }
.detail-item .detail-label { font-size: 9px; font-weight: 700; color: #334155; text-transform: uppercase; }
.detail-item .detail-value { font-size: 13px; font-weight: 600; color: #e2e8f0; margin-top: 2px; }

/* ── Empty State ────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px; color: #1e293b; font-size: 13px; }

/* ── Auto Refresh Toggle ────────────────────────────── */
.auto-refresh { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #475569; }
.auto-refresh input[type="checkbox"] { width: 12px; height: 12px; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 900px) {
    .sidebar { width: 56px; }
    .sidebar-title, .nav-item span:not(.material-symbols-outlined), .admin-info span:not(.material-symbols-outlined), .sidebar-version { display: none; }
    .nav-item { justify-content: center; padding: 10px; }
    .sidebar-header { justify-content: center; }
    .main-content { margin-left: 56px; padding: 16px; }
    .search-box input { width: 160px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
