:root {
            --bg: #090d16;
            --surface: #131b2e;
            --surface-hover: #1a253d;
            --border: #23314d;
            --text: #f1f5f9;
            --muted: #8493a8;
            --primary: #3b82f6;
            --primary-hover: #2563eb;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --accent: #06b6d4;
        }
        * { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; }
        body { background: var(--bg); color: var(--text); padding: 25px 20px; line-height: 1.5; min-height: 100vh; }
        .container { max-width: 1300px; margin: 0 auto; }
        .header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
        .title { font-size: 24px; font-weight: 800; color: #60a5fa; display: flex; align-items: center; gap: 8px; }
        .header-actions { display: flex; gap: 10px; align-items: center; }

        /* Stats Grid */
        .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
        .stat-card { background: var(--surface); padding: 18px 20px; border-radius: 12px; border: 1px solid var(--border); position: relative; overflow: hidden; transition: all 0.2s; cursor: pointer; user-select: none; }
        .stat-card:hover { transform: translateY(-2px); border-color: #3b82f6; box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
        .stat-card::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; }
        .stat-card.total::before { background: #60a5fa; }
        .stat-card.active::before { background: #34d399; }
        .stat-card.pending::before { background: #fbbf24; }
        .stat-card.expired::before { background: #f87171; }
        .stat-label { color: var(--muted); font-size: 13px; font-weight: 500; }
        .stat-val { font-size: 32px; font-weight: 800; margin-top: 4px; }

        /* Controls & Search Bar */
        .controls-bar {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 16px 20px;
            margin-bottom: 20px;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            align-items: center;
            gap: 15px;
        }
        .search-wrapper {
            position: relative;
            flex: 1;
            min-width: 280px;
            max-width: 460px;
        }
        .search-icon {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--muted);
            font-size: 14px;
            pointer-events: none;
        }
        .search-input {
            width: 100%;
            padding: 10px 38px 10px 40px;
            background: #090d16;
            border: 1px solid var(--border);
            border-radius: 8px;
            color: var(--text);
            font-size: 14px;
            outline: none;
            transition: all 0.2s;
        }
        .search-input:focus {
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
        }
        .search-clear {
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--muted);
            cursor: pointer;
            background: none;
            border: none;
            font-size: 14px;
            display: none;
            padding: 2px 4px;
        }
        .search-clear:hover { color: var(--text); }

        /* Filter Tabs */
        .filter-tabs {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            align-items: center;
        }
        .filter-tab {
            padding: 6px 14px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
            background: #090d16;
            border: 1px solid var(--border);
            color: var(--muted);
            cursor: pointer;
            transition: all 0.15s;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }
        .filter-tab:hover {
            border-color: #60a5fa;
            color: var(--text);
        }
        .filter-tab.active {
            background: #2563eb;
            border-color: #3b82f6;
            color: white;
        }
        .filter-badge {
            padding: 2px 7px;
            border-radius: 10px;
            font-size: 11px;
            background: rgba(255,255,255,0.15);
        }

        /* Page Size Selector */
        .page-size-wrapper {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 13px;
            color: var(--muted);
        }
        .page-size-select {
            background: #090d16;
            border: 1px solid var(--border);
            color: var(--text);
            padding: 6px 12px;
            border-radius: 6px;
            font-size: 13px;
            outline: none;
            cursor: pointer;
        }

        /* Table Card */
        .table-card {
            background: var(--surface);
            border-radius: 12px;
            border: 1px solid var(--border);
            overflow: hidden;
            box-shadow: 0 4px 20px rgba(0,0,0,0.2);
        }
        .table-responsive {
            overflow-x: auto;
        }
        table { width: 100%; border-collapse: collapse; text-align: left; }
        th {
            background: #0c1322;
            padding: 14px 18px;
            font-size: 12px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--muted);
            border-bottom: 1px solid var(--border);
            white-space: nowrap;
        }
        td {
            padding: 14px 18px;
            border-bottom: 1px solid var(--border);
            font-size: 14px;
            vertical-align: middle;
        }
        tr:hover { background: rgba(255,255,255,0.02); }

        /* Badges */
        .badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; text-transform: capitalize; }
        .badge-active { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
        .badge-pending { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
        .badge-expired { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
        .badge-suspended { background: rgba(148,163,184,0.15); color: #cbd5e1; border: 1px solid rgba(148,163,184,0.3); }
        .status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

        /* HWID Tag */
        .hwid-container { display: inline-flex; align-items: center; gap: 6px; }
        .hwid-tag { font-family: 'Consolas', 'Courier New', monospace; font-size: 12px; background: #090d16; padding: 4px 8px; border-radius: 6px; color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.2); }
        .copy-btn { background: transparent; border: none; color: var(--muted); cursor: pointer; padding: 3px 5px; font-size: 13px; border-radius: 4px; transition: 0.15s; }
        .copy-btn:hover { color: #38bdf8; background: rgba(56, 189, 248, 0.1); }

        /* Buttons */
        .btn { padding: 6px 12px; border: none; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; transition: 0.2s; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; margin-right: 4px; }
        .btn-success { background: #059669; color: white; }
        .btn-success:hover { background: #10b981; }
        .btn-warning { background: #d97706; color: white; }
        .btn-warning:hover { background: #f59e0b; }
        .btn-danger { background: #dc2626; color: white; }
        .btn-danger:hover { background: #ef4444; }
        .btn-secondary { background: #1e293b; color: var(--text); border: 1px solid var(--border); }
        .btn-secondary:hover { background: #2d3d57; color: white; }

        /* User Avatar */
        .user-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: linear-gradient(135deg, #1e3a8a, #3b82f6);
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 14px;
            flex-shrink: 0;
            border: 1px solid rgba(59, 130, 246, 0.4);
            user-select: none;
        }

        /* Date Pill */
        .date-pill {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            background: #090d16;
            border: 1px solid var(--border);
            padding: 4px 10px;
            border-radius: 6px;
            font-size: 12px;
            font-family: 'Consolas', monospace;
            color: #fbbf24;
            cursor: pointer;
            transition: all 0.15s;
        }
        .date-pill:hover {
            border-color: #fbbf24;
            background: rgba(251, 191, 36, 0.08);
        }

        /* Dropdown Menu */
        .action-dropdown {
            position: relative;
            display: inline-block;
        }
        .btn-icon {
            width: 30px;
            height: 30px;
            padding: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
            background: #1e293b;
            border: 1px solid var(--border);
            color: #cbd5e1;
            cursor: pointer;
            font-size: 16px;
            font-weight: bold;
            transition: all 0.15s;
        }
        .btn-icon:hover {
            background: #334155;
            color: #fff;
            border-color: #60a5fa;
        }
        .dropdown-menu, #floating-action-menu {
            display: none;
            position: absolute;
            right: 0;
            top: calc(100% + 4px);
            background: #131b2e;
            border: 1px solid #283959;
            border-radius: 10px;
            box-shadow: 0 15px 35px rgba(0,0,0,0.7);
            min-width: 230px;
            z-index: 99999;
            padding: 6px;
            text-align: left;
        }
        #floating-action-menu {
            position: fixed !important;
            right: auto;
            top: auto;
        }
        .dropdown-menu.show, #floating-action-menu.show {
            display: block;
            animation: fadeIn 0.12s ease-out;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-6px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .dropdown-menu button, .dropdown-menu a,
        #floating-action-menu button, #floating-action-menu a {
            width: 100%;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 12px;
            background: none;
            border: none;
            color: #cbd5e1;
            font-size: 12px;
            font-weight: 500;
            border-radius: 6px;
            cursor: pointer;
            text-decoration: none;
            transition: background 0.12s, color 0.12s;
            box-sizing: border-box;
        }
        .dropdown-menu button:hover, .dropdown-menu a:hover,
        #floating-action-menu button:hover, #floating-action-menu a:hover {
            background: #1e2b48;
            color: #fff;
        }
        .dropdown-divider {
            height: 1px;
            background: #23314d;
            margin: 4px 0;
        }
        .text-danger { color: #f87171 !important; }
        .text-danger:hover { background: rgba(239, 68, 68, 0.15) !important; color: #ef4444 !important; }
        .text-warning { color: #fbbf24 !important; }
        .text-success { color: #34d399 !important; }

        /* Quick buttons */
        .btn-quick-add {
            background: #065f46;
            color: #34d399;
            border: 1px solid #059669;
        }
        .btn-quick-add:hover {
            background: #059669;
            color: #fff;
        }
        .btn-primary-soft {
            background: rgba(59, 130, 246, 0.15);
            color: #60a5fa;
            border: 1px solid rgba(59, 130, 246, 0.3);
        }
        .btn-primary-soft:hover {
            background: #2563eb;
            color: #fff;
        }

        /* Pagination Footer */
        .pagination-container {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            background: #0c1322;
            border-top: 1px solid var(--border);
            flex-wrap: wrap;
            gap: 12px;
        }
        .pagination-info { font-size: 13px; color: var(--muted); }
        .pagination-nav { display: flex; gap: 4px; align-items: center; }
        .page-btn {
            min-width: 32px;
            height: 32px;
            padding: 0 6px;
            border-radius: 6px;
            background: #131b2e;
            border: 1px solid var(--border);
            color: var(--text);
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: 0.15s;
        }
        .page-btn:hover:not(:disabled) {
            background: #1e293b;
            border-color: #60a5fa;
            color: #60a5fa;
        }
        .page-btn.active {
            background: #2563eb;
            border-color: #3b82f6;
            color: white;
        }
        .page-btn:disabled {
            opacity: 0.35;
            cursor: not-allowed;
        }
        .page-ellipsis { padding: 0 4px; color: var(--muted); font-size: 12px; }

        /* Toast */
        .toast {
            position: fixed;
            bottom: 24px;
            right: 24px;
            padding: 12px 20px;
            border-radius: 8px;
            background: #131b2e;
            border: 1px solid #3b82f6;
            color: white;
            box-shadow: 0 10px 25px rgba(0,0,0,0.5);
            z-index: 9999;
            transform: translateY(100px);
            opacity: 0;
            transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 14px;
        }
        .toast.show { transform: translateY(0); opacity: 1; }
        .toast-success { border-color: #10b981; background: #064e3b; }
        .toast-error { border-color: #ef4444; background: #7f1d1d; }
        .mobile-only { display: none; }

        /* Mobile Responsive */
        @media (max-width: 900px) {
            body { padding: 16px 12px; }
            .header { flex-direction: column; align-items: stretch; gap: 16px; margin-bottom: 18px; padding-bottom: 16px; }
            .header-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
            .header-actions > .btn,
            .header-actions > .action-dropdown,
            .header-actions > .action-dropdown > .btn { width: 100%; margin: 0; justify-content: center; min-height: 42px; }
            .header-actions > a.btn { justify-content: center; }
            .stats-grid { grid-template-columns: repeat(2, 1fr); }
            .controls-bar { flex-direction: column; align-items: stretch; }
            .search-wrapper { max-width: 100%; min-width: 100%; }
            .filter-tabs {
                width: calc(100% + 8px);
                justify-content: flex-start;
                flex-wrap: nowrap;
                overflow-x: auto;
                overscroll-behavior-inline: contain;
                scrollbar-width: thin;
                padding: 2px 8px 8px 0;
            }
            .filter-tab { flex: 0 0 auto; min-height: 38px; }
            .page-size-wrapper { justify-content: space-between; width: 100%; }
            .page-size-select { min-height: 40px; }
            .pagination-container { align-items: stretch; }
            .pagination-info { width: 100%; text-align: center; }
            .pagination-nav { width: 100%; overflow-x: auto; justify-content: center; padding-bottom: 2px; }
        }
        @media (max-width: 768px) {
            body { padding: 10px 8px 18px; }
            .container { width: 100%; }
            .brand-block { align-items: flex-start !important; gap: 10px !important; }
            .brand-logo { width: 36px !important; height: 36px !important; font-size: 18px !important; }
            .title { font-size: 19px !important; gap: 5px !important; }
            .title-context { display: block; width: 100%; margin-left: 0 !important; font-size: 12px !important; }
            .header-subtitle { display: none; }
            .header-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
            .header-actions > .logout-btn { grid-column: 1 / -1; }
            .header-actions .btn { padding: 9px 8px; font-size: 11px; }

            #key-transition-banner { padding: 10px 12px !important; align-items: flex-start !important; }
            #key-transition-banner > div:last-child { width: 100%; justify-content: space-between; }
            #trans-desc { font-size: 10px !important; flex: 1; }

            .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
            .stat-card { padding: 12px 13px; min-height: 83px; }
            .stat-label { font-size: 11px; }
            .stat-val { font-size: 24px; }

            .controls-bar { padding: 12px; gap: 11px; margin-bottom: 12px; }
            .search-input { min-height: 44px; font-size: 16px; }
            .filter-tab { min-height: 40px; padding: 7px 13px; }

            .table-card { background: transparent; border: 0; box-shadow: none; overflow: visible; }
            .table-responsive { overflow: visible; }
            .table-card table,
            .table-card tbody { display: block; width: 100%; }
            .table-card thead { display: none; }
            .table-card tbody { display: grid; gap: 11px; }
            .table-card tr.user-row {
                display: block;
                background: var(--surface);
                border: 1px solid var(--border);
                border-radius: 12px;
                overflow: hidden;
                box-shadow: 0 5px 16px rgba(0,0,0,.22);
            }
            .table-card tr.user-row:hover { background: var(--surface); }
            .table-card tr.user-row td {
                display: flex;
                align-items: center;
                justify-content: space-between;
                gap: 14px;
                width: 100%;
                padding: 10px 13px;
                border: 0;
                border-bottom: 1px solid rgba(35,49,77,.72);
                text-align: right !important;
                white-space: normal !important;
                min-height: 43px;
            }
            .table-card tr.user-row td::before {
                content: attr(data-label);
                color: var(--muted);
                font-size: 10px;
                font-weight: 700;
                text-transform: uppercase;
                letter-spacing: .45px;
                text-align: left;
                flex: 0 0 78px;
            }
            .table-card tr.user-row td.user-cell {
                padding: 14px 13px;
                background: linear-gradient(135deg, rgba(37,99,235,.12), transparent 65%);
                text-align: left !important;
            }
            .table-card tr.user-row td.user-cell::before,
            .table-card tr.user-row td.actions-cell::before { display: none; }
            .table-card tr.user-row td.user-cell > div { width: 100%; }
            .table-card tr.user-row td.status-cell > div,
            .table-card tr.user-row td.contact-cell > div { overflow-wrap: anywhere; }
            .table-card tr.user-row td.actions-cell {
                display: grid;
                grid-template-columns: repeat(4, minmax(0, 1fr));
                gap: 7px;
                padding: 11px 12px;
                border-bottom: 0;
            }
            .table-card tr.user-row td.actions-cell .btn {
                width: 100%;
                min-width: 0;
                min-height: 40px;
                margin: 0;
                padding: 7px 4px;
                justify-content: center;
                font-size: 10px;
                white-space: nowrap;
            }
            .table-card tr.user-row td.actions-cell .btn-icon { font-weight: 600; }
            .mobile-only { display: inline; }
            .desktop-only { display: none; }
            .empty-state-row,
            .empty-state-row td { display: block !important; width: 100% !important; }
            .empty-state-row td::before { display: none !important; }

            .date-pill { white-space: normal; text-align: center; justify-content: center; }
            .pagination-container { margin-top: 2px; border: 1px solid var(--border); border-radius: 10px; padding: 12px 8px; }
            .pagination-nav { justify-content: flex-start; }
            .page-btn { min-width: 38px; height: 38px; flex: 0 0 auto; }

            #floating-action-menu {
                position: fixed !important;
                left: 8px !important;
                right: 8px !important;
                top: auto !important;
                bottom: max(8px, env(safe-area-inset-bottom)) !important;
                width: auto !important;
                min-width: 0 !important;
                max-height: min(76vh, 620px);
                overflow-y: auto;
                border-radius: 14px;
                padding: 8px;
            }
            #floating-action-menu button,
            #floating-action-menu a { min-height: 44px; font-size: 13px; padding: 10px 12px; }
            .header-actions .dropdown-menu.show {
                position: fixed !important;
                left: 8px !important;
                right: 8px !important;
                top: auto !important;
                bottom: max(8px, env(safe-area-inset-bottom)) !important;
                width: auto !important;
                min-width: 0 !important;
                max-height: 75vh;
                overflow-y: auto;
                border-radius: 14px;
            }
            .header-actions .dropdown-menu button,
            .header-actions .dropdown-menu a { min-height: 44px; font-size: 13px; }

            body > div[id$="-modal"] { padding: 8px !important; align-items: flex-end !important; }
            body > div[id$="-modal"] > div {
                width: 100% !important;
                max-width: none !important;
                max-height: 92dvh !important;
                border-radius: 16px 16px 8px 8px !important;
                padding: 17px !important;
                overflow-y: auto !important;
                overscroll-behavior: contain;
            }
            body > div[id$="-modal"] input,
            body > div[id$="-modal"] select,
            body > div[id$="-modal"] textarea { min-height: 44px; font-size: 16px !important; }
            body > div[id$="-modal"] button { min-height: 40px; touch-action: manipulation; }
            .mobile-stack-grid { grid-template-columns: 1fr !important; }
            .audit-table-scroll {
                overflow: auto !important;
                -webkit-overflow-scrolling: touch;
                overscroll-behavior: contain;
            }
            .audit-log-table { min-width: 820px; }
            .toast { left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); font-size: 13px; }
        }
        @media (max-width: 420px) {
            .table-card tr.user-row td.actions-cell { grid-template-columns: repeat(2, minmax(0, 1fr)); }
            .table-card tr.user-row td.actions-cell .btn { font-size: 11px; }
            .stat-card { padding: 11px; }
        }

        /* Auth Box */
        .auth-box { max-width: 400px; margin: 100px auto; background: var(--surface); padding: 30px; border-radius: 12px; border: 1px solid var(--border); }
        .input-group { margin-bottom: 15px; }
        .input-group label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
        .input-group input { width: 100%; padding: 10px; background: #090d16; border: 1px solid var(--border); border-radius: 6px; color: white; }
        .btn-block { width: 100%; padding: 12px; font-size: 14px; justify-content: center; }

        /* HWID Mismatch Badges */
        .badge-hwid-alert {
            background: #ef4444;
            color: #ffffff;
            border: none;
            padding: 2px 7px;
            border-radius: 10px;
            font-size: 10px;
            margin-left: 6px;
            font-weight: 700;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 3px;
            box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
            vertical-align: middle;
            transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
        }
        .badge-hwid-alert:hover {
            transform: scale(1.08);
            box-shadow: 0 0 14px rgba(239, 68, 68, 0.85);
            background: #dc2626;
        }
        .badge-hwid-history {
            background: rgba(148, 163, 184, 0.12);
            color: #94a3b8;
            border: 1px solid #334155;
            padding: 2px 6px;
            border-radius: 10px;
            font-size: 10px;
            margin-left: 6px;
            font-weight: 600;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 2px;
            vertical-align: middle;
            transition: all 0.15s ease;
        }
        .badge-hwid-history:hover {
            background: rgba(148, 163, 184, 0.25);
            color: #f1f5f9;
            border-color: #64748b;
        }
