:root, [data-theme="light"] {
    --bg: #f1f5f9; --surface: #ffffff; --surface2: #f8fafc;
    --text: #0f172a; --muted: #64748b; --border: #e2e8f0;
    --primary: #2563eb; --primary-glow: rgba(37,99,235,.25);
    --danger: #ef4444; --success: #10b981; --warning: #f59e0b; --purple: #7c3aed;
    --sidebar: #0f172a; --sidebar-text: #cbd5e1; --sidebar-active: #1e293b;
    --radius: 14px; --shadow: 0 10px 40px rgba(15,23,42,.08);
}
[data-theme="dark"] {
    --bg: #0b1220; --surface: #111827; --surface2: #0f172a;
    --text: #f8fafc; --muted: #94a3b8; --border: #1f2937;
    --primary: #3b82f6; --primary-glow: rgba(59,130,246,.3);
    --sidebar: #070d18; --sidebar-text: #94a3b8; --sidebar-active: #111827;
    --shadow: 0 10px 40px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.55; }

/* ——— Login ——— */
.login-body { min-height: 100vh; position: relative; overflow: hidden; }
.login-bg { position: fixed; inset: 0; background: radial-gradient(circle at 20% 20%, #1d4ed8 0%, transparent 40%), radial-gradient(circle at 80% 70%, #7c3aed 0%, transparent 35%), linear-gradient(135deg, #0b1220, #111827); z-index: 0; }
.login-wrap { position: relative; z-index: 1; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card.modern { width: 100%; max-width: 480px; background: rgba(17,24,39,.92); border: 1px solid rgba(255,255,255,.08); border-radius: 20px; padding: 1.75rem; backdrop-filter: blur(16px); box-shadow: 0 25px 60px rgba(0,0,0,.45); color: #f8fafc; }
.login-brand { text-align: center; margin-bottom: 1rem; }
.login-logo { font-size: 2.5rem; margin-bottom: .25rem; }
.login-card h1 { margin: 0; font-size: 1.5rem; }
.subtitle { color: #94a3b8; margin: .35rem 0 0; font-size: .9rem; }
.security-banner { border-radius: 12px; padding: .85rem 1rem; margin: 1rem 0; font-size: .82rem; line-height: 1.45; }
.security-banner.warn { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.35); color: #fde68a; }
.security-banner p { margin: .35rem 0 0; }
.ip-panel { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: .75rem 1rem; margin-bottom: 1rem; font-size: .82rem; }
.ip-row { display: flex; justify-content: space-between; gap: .75rem; padding: .25rem 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.ip-row:last-child { border-bottom: none; }
.ip-row code { color: #93c5fd; font-weight: 700; }
.vpn-flag { margin-top: .5rem; color: #fca5a5; font-size: .78rem; }
.text-danger { color: #f87171; }
.login-form label { display: block; font-size: .78rem; color: #94a3b8; margin: .5rem 0 .25rem; }
.login-footer { text-align: center; font-size: .72rem; color: #64748b; margin-top: 1rem; }

/* ——— App shell ——— */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; border-right: 1px solid rgba(255,255,255,.06); flex-shrink: 0; }
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-icon { font-size: 1.5rem; }
.sidebar-brand strong { display: block; color: #fff; }
.sidebar-brand small { color: #64748b; font-size: .72rem; }
.sidebar-nav { flex: 1; padding: .75rem .5rem; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: .65rem; padding: .65rem .85rem; margin-bottom: .2rem; border-radius: 10px; color: var(--sidebar-text); text-decoration: none; font-size: .88rem; transition: .15s; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--primary); }
.nav-icon { width: 1.25rem; text-align: center; }
.sidebar-foot { padding: 1rem; border-top: 1px solid rgba(255,255,255,.06); }
.staff-chip { display: flex; gap: .65rem; align-items: center; }
.avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar-title { display: flex; align-items: center; gap: .65rem; }
.topbar-title h1 { margin: 0; font-size: 1.15rem; }
.page-icon { font-size: 1.35rem; }
.topbar-actions { display: flex; gap: .5rem; align-items: center; }
.content { padding: 1.25rem 1.5rem 2rem; max-width: 1400px; width: 100%; }

/* ——— Components ——— */
.page-header { margin-bottom: 1rem; }
.page-header.flex-between { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card.highlight { border-color: var(--primary); background: linear-gradient(135deg, var(--surface), var(--surface2)); }
.form-card { max-width: 640px; }
.stats-grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.stats-grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stats-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat-card { border-radius: var(--radius); padding: 1.1rem 1.2rem; color: #fff; position: relative; overflow: hidden; }
.stat-card.gradient-blue { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.stat-card.gradient-green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-card.gradient-purple { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.stat-card.gradient-slate { background: linear-gradient(135deg, #475569, #334155); }
.stat-card.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-card.red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: .82rem; opacity: .92; margin-top: .25rem; }
.mini-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .85rem 1rem; display: flex; align-items: center; gap: .75rem; }
.mini-icon { font-size: 1.35rem; }
.mini-card strong { display: block; font-size: 1.15rem; }
.mini-card small { color: var(--muted); font-size: .75rem; }
.revenue-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .75rem; }
.revenue-grid strong { display: block; font-size: 1.1rem; color: var(--primary); }
.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li { padding: .45rem 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .5rem; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .5rem; }
.feature-item { background: var(--surface2); border-radius: 8px; padding: .55rem .75rem; font-size: .85rem; }
.big-num { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.input, .textarea, select.input { width: 100%; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface2); color: var(--text); margin-bottom: .65rem; font-size: .92rem; }
.input:focus { outline: 2px solid var(--primary-glow); border-color: var(--primary); }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: .55rem 1rem; border: none; border-radius: 10px; cursor: pointer; font-weight: 600; background: var(--border); color: var(--text); text-decoration: none; font-size: .88rem; transition: .15s; }
.btn:hover { filter: brightness(1.05); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-glow { box-shadow: 0 8px 24px var(--primary-glow); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--border); }
.btn-sm { padding: .35rem .65rem; font-size: .78rem; }
.full { width: 100%; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.table-wrap.scroll-x { overflow-x: scroll; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--surface2); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tr:hover td { background: rgba(37,99,235,.03); }
.badge { padding: .2rem .5rem; border-radius: 999px; font-size: .7rem; font-weight: 700; text-transform: capitalize; white-space: nowrap; }
.badge-premiumplus { background: #ede9fe; color: #5b21b6; }
.badge-free { background: #f1f5f9; color: #475569; }
.badge-active, .badge-approved { background: #d1fae5; color: #065f46; }
.badge-inactive, .badge-pending { background: #fef3c7; color: #92400e; }
.badge-banned, .badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-deleted { background: #fecaca; color: #7f1d1d; }
.alert { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: .88rem; }
.alert.ok { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert.err { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.hint, .muted { color: var(--muted); font-size: .88rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.search-form { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search-form .input { margin: 0; flex: 1; }
.stack-form { margin-bottom: .75rem; }
.bar-chart { display: flex; align-items: flex-end; gap: .5rem; height: 120px; padding-top: 1rem; }
.bar-chart.tall { height: 180px; }
.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .25rem; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 44px; background: var(--primary); border-radius: 6px 6px 0 0; min-height: 4px; }
.bar.green { background: var(--success); }
.bar-item small { font-size: .65rem; color: var(--muted); }
.perm-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--border); }
.perm-row strong { min-width: 140px; }
table.matrix td.yes { color: var(--success); text-align: center; }
table.matrix td.no { color: var(--muted); text-align: center; }
.filter-tabs { display: flex; gap: .35rem; flex-wrap: wrap; }
.filter-tabs a { padding: .35rem .75rem; border-radius: 999px; text-decoration: none; font-size: .78rem; background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.filter-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.code-pill { background: var(--surface2); padding: .2rem .55rem; border-radius: 6px; font-weight: 700; letter-spacing: .08em; }
.inline-form { display: inline-flex; gap: .25rem; }
label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .25rem; font-weight: 600; }

@media (max-width: 900px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; }
    .sidebar-nav { display: flex; flex-wrap: wrap; gap: .25rem; padding: .5rem; }
    .nav-item { padding: .45rem .65rem; font-size: .78rem; }
    .sidebar-foot { display: none; }
}
