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

                :root {
            --bg:        #030712;
            --surface:   #111827;
            --card:      rgba(17, 24, 39, 0.65);
            --card-hover:rgba(31, 41, 55, 0.75);
            --border:    rgba(255,255,255,0.08);
            --border2:   rgba(255,255,255,0.15);
            --text:      #f3f4f6;
            --muted:     #9ca3af;
            --primary:   #6366f1;
            --primary-g: linear-gradient(135deg, #4f46e5, #06b6d4);
            --green:     #10b981;
            --red:       #ef4444;
            --orange:    #f59e0b;
            --purple:    #8b5cf6;
        }

        html, body {
            background: var(--bg);
            background-image: radial-gradient(circle at top right, rgba(30, 27, 75, 0.6) 0%, transparent 40%), radial-gradient(circle at bottom left, rgba(8, 51, 68, 0.4) 0%, transparent 40%);
            background-attachment: fixed;
            color: var(--text);
            font-family: 'Inter', sans-serif;
            font-size: 14px;
            line-height: 1.5;
            min-height: 100vh;
        }
        h1, h2, h3, .stat-value, .user-name { font-family: 'Outfit', sans-serif; }
        
        .stat-card, .user-card, .login-card, .modal-box, .online-panel, .list-item, .search-wrap input, .form-control {
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
        }


        h1, h2, h3, .stat-value, .user-name { font-family: 'Outfit', sans-serif; }
        
        .stat-card, .user-card, .login-card, .modal-box, .online-panel, .list-item, .search-wrap input, .form-control {
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
        }


        /* ── Scrollbar ── */
        ::-webkit-scrollbar { width: 6px; }
        ::-webkit-scrollbar-track { background: var(--bg); }
        ::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 3px; }

        /* ── Layout ── */
        .layout { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

        /* ── Login Overlay ── */
        #loginOverlay {
            position: fixed; inset: 0; z-index: 200;
            display: flex; align-items: center; justify-content: center;
            background: var(--bg);
        }
        .login-card {
            background: var(--card);
            border: 1px solid var(--border2);
            border-radius: 20px;
            padding: 40px 36px;
            width: 100%; max-width: 380px;
            box-shadow: 0 25px 60px rgba(0,0,0,0.5);
        }
        .login-logo {
            text-align: center;
            margin-bottom: 28px;
        }
        .login-logo .icon {
            width: 56px; height: 56px;
            background: var(--primary-g);
            border-radius: 16px;
            display: inline-flex; align-items: center; justify-content: center;
            font-size: 26px;
            margin-bottom: 14px;
            box-shadow: 0 8px 24px rgba(59,130,246,0.35);
        }
        .login-logo h1 { font-size: 22px; font-weight: 700; }
        .login-logo p { color: var(--muted); font-size: 13px; margin-top: 4px; }

        .form-group { margin-bottom: 16px; }
        .form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
        .form-control {
            width: 100%;
            background: var(--surface);
            border: 1px solid var(--border2);
            border-radius: 10px;
            padding: 10px 14px;
            color: var(--text);
            font-size: 14px;
            font-family: inherit;
            transition: border-color 0.2s;
            outline: none;
        }
        .form-control:focus { border-color: var(--primary); }

        .btn {
            display: inline-flex; align-items: center; justify-content: center; gap: 6px;
            padding: 10px 18px;
            border-radius: 10px;
            font-size: 14px; font-weight: 600; font-family: inherit;
            cursor: pointer; border: none; transition: all 0.2s;
            text-decoration: none;
        }
        .btn-primary { background: var(--primary-g); color: #fff; box-shadow: 0 4px 14px rgba(59,130,246,0.35); }
        .btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(59,130,246,0.45); }
        .btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border2); }
        .btn-ghost:hover { background: var(--card-hover); border-color: var(--border2); }
        .btn-danger { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.25); }
        .btn-danger:hover { background: rgba(239,68,68,0.25); }
        .btn-full { width: 100%; }

        /* ── Header ── */
        .header {
            background: rgba(15,22,35,0.85);
            backdrop-filter: blur(12px);
            border-bottom: 1px solid var(--border);
            position: sticky; top: 0; z-index: 50;
            padding: 0 20px;
        }
        .header-inner {
            max-width: 1100px; margin: 0 auto;
            display: flex; align-items: center; justify-content: space-between;
            height: 62px; gap: 12px;
        }
        .header-brand { display: flex; align-items: center; gap: 10px; }
        .header-brand .dot {
            width: 34px; height: 34px;
            background: var(--primary-g);
            border-radius: 10px;
            display: flex; align-items: center; justify-content: center;
            font-size: 16px;
            box-shadow: 0 4px 12px rgba(59,130,246,0.3);
        }
        .header-brand h1 { font-size: 17px; font-weight: 700; }
        .header-actions { display: flex; align-items: center; gap: 8px; }

        /* ── Main ── */
        .main { padding: 28px 20px; max-width: 1100px; margin: 0 auto; }

        /* ── Stats ── */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 14px;
            margin-bottom: 28px;
        }
        .stat-card {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 18px 20px;
            display: flex; align-items: center; gap: 14px;
        }
        .stat-icon {
            width: 42px; height: 42px; border-radius: 12px;
            display: flex; align-items: center; justify-content: center;
            font-size: 20px; flex-shrink: 0;
        }
        .stat-icon.blue { background: rgba(59,130,246,0.12); }
        .stat-icon.green { background: rgba(16,185,129,0.12); }
        .stat-icon.red { background: rgba(239,68,68,0.12); }
        .stat-icon.purple { background: rgba(168,85,247,0.12); }
        .stat-label { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
        .stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; margin-top: 2px; }

        /* ── Toolbar ── */
        .toolbar {
            display: flex; align-items: center; justify-content: space-between; gap: 12px;
            margin-bottom: 18px;
            flex-wrap: wrap;
        }
        .toolbar-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 200px; }
        .search-wrap { position: relative; flex: 1; max-width: 300px; }
        .search-wrap input {
            width: 100%;
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 8px 12px 8px 36px;
            color: var(--text); font-size: 13px; font-family: inherit;
            outline: none; transition: border-color 0.2s;
        }
        .search-wrap input:focus { border-color: var(--primary); }
        .search-icon {
            position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
            color: var(--muted); font-size: 15px; pointer-events: none;
        }
        .user-count { color: var(--muted); font-size: 13px; }

        /* ── User Cards ── */
        .users-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
            gap: 14px;
        }
        .user-card {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 20px;
            transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
        }
        .user-card:hover {
            border-color: var(--border2);
            transform: translateY(-2px);
            box-shadow: 0 8px 24px rgba(0,0,0,0.3);
        }
        .user-card-top {
            display: flex; align-items: flex-start; justify-content: space-between;
            margin-bottom: 14px;
        }
        .user-info { flex: 1; min-width: 0; }
        .user-name {
            font-size: 15px; font-weight: 600;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
            margin-bottom: 3px;
        }
        .user-pass {
            font-size: 12px; color: var(--muted);
            font-family: 'Courier New', monospace;
            background: var(--surface);
            padding: 2px 7px; border-radius: 5px;
            display: inline-block;
        }

        .badge {
            display: inline-flex; align-items: center; gap: 4px;
            padding: 3px 10px; border-radius: 20px;
            font-size: 11px; font-weight: 600; flex-shrink: 0;
        }
        .badge-green { background: rgba(16,185,129,0.15); color: #10b981; border: 1px solid rgba(16,185,129,0.25); }
        .badge-red { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.25); }
        .badge-orange { background: rgba(245,158,11,0.15); color: #f59e0b; border: 1px solid rgba(245,158,11,0.25); }

        /* ── Data Usage ── */
        .data-row {
            display: flex; align-items: center; justify-content: space-between;
            font-size: 12px; margin-bottom: 6px;
        }
        .data-label { color: var(--muted); }
        .data-value { font-weight: 500; }
        .progress-bar {
            width: 100%; height: 5px;
            background: var(--surface);
            border-radius: 10px; overflow: hidden;
            margin-bottom: 14px;
        }
        .progress-fill {
            height: 100%; border-radius: 10px;
            background: var(--primary-g);
            transition: width 0.4s ease;
        }
        .progress-fill.danger { background: linear-gradient(90deg,#f59e0b,#ef4444); }

        /* ── Meta ── */
        .meta-row {
            display: flex; gap: 14px; margin-bottom: 16px;
            flex-wrap: wrap;
        }
        .meta-item {
            display: flex; align-items: center; gap: 5px;
            font-size: 12px; color: var(--muted);
        }
        .meta-item span { color: var(--text); font-weight: 500; }

        /* ── Card Actions ── */
        .card-actions {
            display: flex; gap: 8px;
            border-top: 1px solid var(--border);
            padding-top: 14px;
        }
        .action-btn {
            flex: 1;
            display: flex; align-items: center; justify-content: center; gap: 5px;
            padding: 8px 6px;
            border-radius: 9px;
            font-size: 12px; font-weight: 500; font-family: inherit;
            cursor: pointer; border: none; transition: all 0.18s;
        }
        .action-btn.copy   { background: rgba(168,85,247,0.12); color: #a855f7; }
        .action-btn.copy:hover { background: rgba(168,85,247,0.22); }
        .action-btn.reset  { background: rgba(16,185,129,0.10); color: #10b981; }
        .action-btn.reset:hover { background: rgba(16,185,129,0.2); }
        .action-btn.edit   { background: rgba(59,130,246,0.10); color: #60a5fa; }
        .action-btn.edit:hover { background: rgba(59,130,246,0.2); }
        .action-btn.del    { background: rgba(239,68,68,0.10); color: #ef4444; }
        .action-btn.del:hover { background: rgba(239,68,68,0.2); }

        /* ── Empty State ── */
        .empty-state {
            text-align: center; padding: 60px 20px;
            color: var(--muted);
            grid-column: 1/-1;
        }
        .empty-state .icon { font-size: 48px; margin-bottom: 14px; }
        .empty-state p { font-size: 15px; }

        /* ── Modal ── */
        .modal-overlay {
            display: none; position: fixed; inset: 0; z-index: 100;
            background: rgba(0,0,0,0.6);
            backdrop-filter: blur(6px);
            align-items: center; justify-content: center;
            padding: 20px;
        }
        .modal-overlay.active { display: flex; }
        .modal-box {
            background: var(--card);
            border: 1px solid var(--border2);
            border-radius: 20px;
            padding: 28px;
            width: 100%; max-width: 420px;
            box-shadow: 0 30px 70px rgba(0,0,0,0.5);
            animation: slideUp 0.2s ease;
        }
        @keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
        .modal-header {
            display: flex; align-items: center; justify-content: space-between;
            margin-bottom: 22px;
        }
        .modal-title { font-size: 18px; font-weight: 700; }
        .modal-close {
            width: 32px; height: 32px; border-radius: 8px;
            background: var(--surface); border: none; cursor: pointer;
            color: var(--muted); font-size: 18px;
            display: flex; align-items: center; justify-content: center;
            transition: background 0.2s;
        }
        .modal-close:hover { background: var(--card-hover); color: var(--text); }
        .modal-footer {
            display: flex; gap: 10px; justify-content: flex-end;
            margin-top: 24px;
        }

        .form-row { display: flex; gap: 12px; }
        .form-row .form-group { flex: 1; }
        .form-group label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
        .form-control { color-scheme: dark; }
        .checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
        .checkbox-row input { width: 16px; height: 16px; accent-color: var(--primary); }
        .checkbox-row label { font-size: 13px; color: var(--muted); text-transform: none; letter-spacing: normal; }

        /* ── Toast ── */
        #toast {
            position: fixed; bottom: 24px; right: 24px; z-index: 999;
            background: #1e293b; border: 1px solid var(--border2);
            color: var(--text); padding: 12px 18px; border-radius: 12px;
            font-size: 13px; font-weight: 500;
            display: flex; align-items: center; gap: 8px;
            box-shadow: 0 8px 24px rgba(0,0,0,0.4);
            transform: translateY(80px); opacity: 0;
            transition: all 0.3s ease;
            pointer-events: none;
        }
        #toast.show { transform: none; opacity: 1; }

        /* ── List View ── */
        .users-list { display: flex; flex-direction: column; gap: 8px; }
        .list-item {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 12px 16px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
            transition: border-color 0.2s, background 0.2s;
        }
        .list-item:hover { background: var(--card-hover); border-color: var(--border2); }
        .list-top-row {
            display: flex;
            align-items: center;
            gap: 12px;
            flex: 1;
            min-width: 0;
        }
        .list-avatar {
            width: 38px; height: 38px; border-radius: 10px;
            background: var(--primary-g);
            display: flex; align-items: center; justify-content: center;
            font-size: 15px; font-weight: 700; color: #fff;
            flex-shrink: 0;
        }
        .list-main { flex: 1; min-width: 0; }
        .list-name {
            font-size: 14px; font-weight: 600;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .list-pass {
            font-size: 11px; color: var(--muted);
            font-family: 'Courier New', monospace;
        }
        .list-meta {
            display: flex; align-items: center; gap: 24px;
            flex-shrink: 0;
        }
        .list-meta-item { text-align: center; min-width: 70px; }
        .list-meta-item.exp-item { min-width: 130px; text-align: center; }
        .list-meta-item.status-item { min-width: 75px; text-align: center; }
        .list-meta-item.devices-item { min-width: 60px; text-align: center; }
        .list-meta-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
        .list-meta-val { font-size: 13px; font-weight: 600; margin-top: 1px; }
        .exp-sub { font-size: 10px; font-weight: 500; margin-top: 1px; white-space: nowrap; }
        .exp-sub.sub-ok { color: #10b981; }
        .exp-sub.sub-warning { color: #f59e0b; }
        .exp-sub.sub-expired { color: #ef4444; }
        .list-progress {
            width: 80px;
        }
        .list-progress .progress-bar { margin-bottom: 3px; }
        .list-progress .pct-text { font-size: 10px; color: var(--muted); text-align: right; }
        .list-actions { display: flex; gap: 6px; flex-shrink: 0; }
        .icon-btn {
            width: 32px; height: 32px; border-radius: 8px;
            display: flex; align-items: center; justify-content: center;
            font-size: 15px; cursor: pointer; border: none;
            transition: background 0.18s;
        }
        .icon-btn.copy   { background: rgba(168,85,247,0.12); color: #a855f7; }
        .icon-btn.copy:hover   { background: rgba(168,85,247,0.25); }
        .icon-btn.reset  { background: rgba(16,185,129,0.10); color: #10b981; }
        .icon-btn.reset:hover  { background: rgba(16,185,129,0.22); }
        .icon-btn.edit   { background: rgba(59,130,246,0.10); color: #60a5fa; }
        .icon-btn.edit:hover   { background: rgba(59,130,246,0.22); }
        .icon-btn.del    { background: rgba(239,68,68,0.10); color: #ef4444; }
        .icon-btn.del:hover    { background: rgba(239,68,68,0.22); }

        /* ── View Toggle ── */
        .view-toggle { display: flex; background: var(--card); border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
        .view-btn {
            padding: 6px 12px; font-size: 15px; cursor: pointer;
            border: none; background: transparent; color: var(--muted);
            transition: background 0.18s, color 0.18s;
        }
        .view-btn.active { background: var(--primary-g); color: #fff; }

        /* ── Online Status ── */
        .online-dot {
            display: inline-block;
            width: 8px; height: 8px; border-radius: 50%;
            background: var(--green);
            box-shadow: 0 0 0 0 rgba(16,185,129,0.5);
            animation: pulse-green 2s infinite;
            flex-shrink: 0;
        }
        @keyframes pulse-green {
            0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.6); }
            70%  { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
            100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
        }
        .online-badge {
            display: inline-flex; align-items: center; gap: 5px;
            background: rgba(16,185,129,0.12);
            border: 1px solid rgba(16,185,129,0.3);
            color: #10b981;
            font-size: 11px; font-weight: 600;
            padding: 2px 8px; border-radius: 20px;
        }

        /* ── Online Row (prominent) ── */
        .list-item-online {
            border-left: 3px solid #10b981 !important;
            background: linear-gradient(90deg, rgba(16,185,129,0.06) 0%, var(--card) 40%) !important;
        }
        .online-status-badge {
            display: inline-flex; align-items: center; gap: 5px;
            background: rgba(16,185,129,0.15);
            border: 1px solid rgba(16,185,129,0.35);
            color: #10b981;
            font-size: 11px; font-weight: 700;
            padding: 3px 10px; border-radius: 20px;
            white-space: nowrap;
        }
        .online-status-badge .dot-anim {
            width: 7px; height: 7px; border-radius: 50%;
            background: #10b981;
            animation: pulse-green 1.5s infinite;
            display: inline-block;
        }
        .avatar-online {
            box-shadow: 0 0 0 2.5px #10b981, 0 0 0 4px rgba(16,185,129,0.25) !important;
        }
        .avatar-offline-dim { opacity: 0.7; }
        .card-online {
            border-color: rgba(16,185,129,0.4) !important;
            box-shadow: 0 0 0 1px rgba(16,185,129,0.15), 0 8px 24px rgba(0,0,0,0.3) !important;
        }
        .card-online .user-card-top::before {
            content: '';
            position: absolute; top: 0; left: 0; right: 0;
            height: 2px;
            background: linear-gradient(90deg,#10b981,#34d399);
            border-radius: 16px 16px 0 0;
        }
        .user-card { position: relative; overflow: hidden; }
        /* Online Users Panel */
        .online-panel {
            background: var(--card);
            border: 1px solid rgba(16,185,129,0.25);
            border-radius: 14px;
            margin-bottom: 20px;
            overflow: hidden;
        }
        .online-panel-header {
            display: flex; align-items: center; justify-content: space-between;
            padding: 12px 18px;
            border-bottom: 1px solid rgba(16,185,129,0.15);
            cursor: pointer;
            user-select: none;
        }
        .online-panel-header-left { display: flex; align-items: center; gap: 10px; }
        .online-panel-title { font-size: 14px; font-weight: 600; color: #10b981; }
        .online-live-badge {
            display: flex; align-items: center; gap: 5px;
            background: rgba(16,185,129,0.15);
            border: 1px solid rgba(16,185,129,0.3);
            color: #10b981; font-size: 10px; font-weight: 700;
            padding: 2px 8px; border-radius: 20px;
            text-transform: uppercase; letter-spacing: 0.05em;
        }
        .online-chevron { color: var(--muted); font-size: 12px; transition: transform 0.2s; }
        .online-panel.collapsed .online-chevron { transform: rotate(-90deg); }
        .online-panel-body { padding: 0 16px; transition: max-height 0.3s ease; max-height: 200px; overflow-y: auto; }
        .online-panel.collapsed .online-panel-body { max-height: 0; padding-bottom: 0; padding-top: 0; overflow: hidden; }

        .online-user-row {
            display: flex; align-items: center; gap: 10px;
            padding: 8px 0;
            border-bottom: 1px solid var(--border);
        }
        .online-user-row:last-child { border-bottom: none; }
        .online-user-name { flex: 1; font-size: 13px; font-weight: 500; }
        .online-conn-count {
            font-size: 12px; color: var(--muted);
        }
        .online-conn-count span { color: #10b981; font-weight: 600; }
        .online-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 12px 0; }

        /* Remove fadeInUp animation to prevent flashing on auto-refresh */

        /* ── Responsive ── */
        @media (max-width: 700px) {
            .header-brand h1 { font-size: 14px; }
            .header-brand .dot { width: 28px; height: 28px; }
            .btn { padding: 8px 10px; }
            .header-actions { gap: 4px; }
            .btn > span:last-child { display: none; }
            .stats-grid { grid-template-columns: 1fr 1fr; }
            .users-grid { grid-template-columns: 1fr; }
            
            /* Responsive Mobile List Item Layout - Show all Meta & Usage */
            .list-item { 
                flex-direction: column; 
                align-items: stretch; 
                gap: 12px; 
                padding: 14px; 
            }
            .list-top-row {
                display: flex;
                align-items: center;
                gap: 10px;
                width: 100%;
            }
            .list-main { flex: 1; min-width: 0; }
            .list-meta { 
                display: flex !important; 
                flex-direction: row; 
                justify-content: space-between; 
                align-items: center; 
                width: 100%; 
                background: rgba(255,255,255,0.03); 
                padding: 8px 12px; 
                border-radius: 8px;
                border: 1px solid var(--border);
            }
            .list-meta-item.exp-item,
            .list-meta-item.status-item,
            .list-meta-item.devices-item { 
                min-width: auto; 
                text-align: center; 
            }
            .list-progress { 
                display: block !important; 
                width: 100%; 
            }
            .list-actions { 
                width: 100%; 
                justify-content: space-between; 
                gap: 8px;
                padding-top: 8px; 
                border-top: 1px solid var(--border); 
            }
            .list-actions .icon-btn {
                flex: 1;
                height: 36px;
            }
        }
        /* Accessibility */
        button:focus-visible, input:focus-visible {
            outline: 2px solid var(--primary);
            outline-offset: 2px;
        }

/* Icon Utilities */
.lucide-icon { display: inline-block; vertical-align: middle; }
.icon-12 { width: 12px; height: 12px; }
.icon-14 { width: 14px; height: 14px; }
.icon-16 { width: 16px; height: 16px; }
.icon-18 { width: 18px; height: 18px; }
.icon-20 { width: 20px; height: 20px; }
.icon-22 { width: 22px; height: 22px; }
.icon-24 { width: 24px; height: 24px; }
.icon-28 { width: 28px; height: 28px; }
.icon-32 { width: 32px; height: 32px; }
