:root {
    --bg: #0b1220;
    --panel: #111a2e;
    --panel-2: #16213a;
    --border: #24304d;
    --text: #e8eefc;
    --muted: #9fb0d0;
    --primary: #4f8cff;
    --primary-2: #3d73db;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    --radius: 14px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: linear-gradient(180deg, #08101d 0%, #0b1220 100%);
    color: var(--text);
    min-height: 100vh;
}

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

.layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
    background: rgba(17, 26, 46, 0.96);
    border-right: 1px solid var(--border);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 12px;
    display: grid; place-items: center; font-weight: 800;
    background: linear-gradient(135deg, #4f8cff, #7c5cff);
}
.brand span, .sidebar-footer { color: var(--muted); font-size: 12px; display: block; }
.sidebar nav { display: flex; flex-direction: column; gap: 8px; }
.sidebar nav a {
    padding: 12px 14px; border-radius: 10px; color: var(--text);
    text-decoration: none; border: 1px solid transparent;
}
.sidebar nav a.active, .sidebar nav a:hover {
    background: var(--panel-2); border-color: var(--border);
}
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }

.content { padding: 28px; }
.page-header h1 { margin: 0 0 20px; font-size: 28px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.card {
    background: rgba(17, 26, 46, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.card h2, .card h3 { margin-top: 0; }
.stat { font-size: 32px; font-weight: 800; margin: 8px 0; }
.muted { color: var(--muted); }

label { display: block; margin-bottom: 8px; font-size: 14px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], textarea, select {
    width: 100%; padding: 12px 14px; border-radius: 10px;
    border: 1px solid var(--border); background: #0d1528; color: var(--text);
    margin-bottom: 14px;
}
textarea { min-height: 120px; resize: vertical; }

.btn {
    display: inline-block; padding: 11px 16px; border-radius: 10px;
    border: none; cursor: pointer; font-weight: 600; text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-2); text-decoration: none; }
.btn-secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 7px 10px; font-size: 13px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 13px; font-weight: 600; }
.badge {
    display: inline-block; padding: 4px 8px; border-radius: 999px;
    font-size: 12px; font-weight: 700;
}
.badge-free { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.badge-premium { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.badge-inactive { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

.alert {
    padding: 12px 14px; border-radius: 10px; margin-bottom: 16px;
    border: 1px solid var(--border);
}
.alert-success { background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.35); }
.alert-error { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.35); }
.alert-info { background: rgba(79, 140, 255, 0.12); border-color: rgba(79, 140, 255, 0.35); }

.auth-wrap {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.auth-card { width: min(460px, 100%); }

.checkbox-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px;
}
.checkbox-item {
    display: flex; gap: 10px; align-items: center;
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
    background: #0d1528;
}
.checkbox-item input[type=checkbox] { margin: 0; flex-shrink: 0; }
.checkbox-item-body { flex: 1; cursor: pointer; margin: 0; }
.checkbox-item-body strong { display: block; }

.pro-switch {
    display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0;
    cursor: pointer; user-select: none;
}
.pro-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.pro-switch-track {
    width: 42px; height: 24px; border-radius: 999px; background: #24304d;
    position: relative; transition: background 0.2s ease;
}
.pro-switch-thumb {
    position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
    border-radius: 50%; background: #9fb0d0; transition: transform 0.2s ease, background 0.2s ease;
}
.pro-switch input:checked + .pro-switch-track { background: rgba(245, 158, 11, 0.35); }
.pro-switch input:checked + .pro-switch-track .pro-switch-thumb {
    transform: translateX(18px); background: #fcd34d;
}
.pro-switch-label {
    font-size: 12px; font-weight: 700; color: var(--muted); min-width: 28px;
}
.pro-switch input:checked ~ .pro-switch-label { color: #fcd34d; }
.free-switch input:checked + .pro-switch-track { background: rgba(34, 197, 94, 0.35); }
.free-switch input:checked + .pro-switch-track .pro-switch-thumb { background: #86efac; }
.free-switch input:checked ~ .pro-switch-label { color: #86efac; }
.code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: #0d1528; border: 1px solid var(--border); border-radius: 10px;
    padding: 14px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.inline-form { display: inline; }
