:root {
    --bg: #0a0e17;
    --bg-card: #111827;
    --bg-input: #1a2233;
    --border: #1e2d3d;
    --border-focus: #3b82f6;
    --text: #e2e8f0;
    --text-muted: #64748b;
    --text-heading: #f1f5f9;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --green: #10b981;
    --green-hover: #059669;
    --red: #ef4444;
    --red-hover: #dc2626;
    --yellow: #f59e0b;
    --radius: 4px;
    --radius-lg: 6px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    line-height: 1.6;
}

/* Layout */
.container { width: 100%; max-width: 1100px; }
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow);
}
.center-card {
    width: min(560px, 100%);
    margin: 8vh auto 0;
}

/* Typography */
h1 { font-size: 1.65rem; color: var(--text-heading); font-weight: 600; }
h2 { font-size: 1.15rem; color: var(--text-heading); font-weight: 600; margin: 28px 0 12px; }
.subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; margin-bottom: 24px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.brand-icon {
    width: 40px; height: 40px; background: var(--accent);
    border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.1rem; color: #fff;
}

/* Forms */
.field { margin-bottom: 22px; }
label { display: block; font-size: 0.88rem; color: var(--text-muted); margin-bottom: 8px; font-weight: 500; }

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
input::placeholder { color: var(--text-muted); opacity: 0.6; }

/* Buttons */
button, .btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 6px 16px;
    background: rgba(59, 130, 246, 0.15); color: var(--accent);
    border: 1px solid rgba(59, 130, 246, 0.3); border-radius: var(--radius);
    font-size: 0.85rem; font-weight: 500;
    cursor: pointer; transition: background 0.15s, transform 0.1s;
    text-decoration: none; width: auto;
}
button:hover, .btn:hover { background: rgba(59, 130, 246, 0.25); }
button:active, .btn:active { transform: scale(0.98); }

/* Full-width submit — only for standalone forms (login, register, etc.) */
.btn-primary { width: 100%; padding: 10px 20px; font-size: 0.95rem; background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-green { background: rgba(16, 185, 129, 0.15); color: var(--green); border-color: rgba(16, 185, 129, 0.3); }
.btn-green:hover { background: rgba(16, 185, 129, 0.25); }
.btn-danger { background: rgba(239, 68, 68, 0.15); color: var(--red); border-color: rgba(239, 68, 68, 0.3); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }
.btn-sm { padding: 4px 12px; font-size: 0.8rem; line-height: 1.4; }

/* Alerts */
.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 10px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 0.88rem;
}
.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
    padding: 10px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 0.88rem;
}

/* Header / Nav */
.header {
    display: flex; flex-direction: column; gap: 12px;
    margin-bottom: 28px; padding-bottom: 18px; border-bottom: 1px solid var(--border);
}
nav { display: flex; gap: 6px; flex-wrap: wrap; }
nav a {
    color: var(--text-muted); text-decoration: none;
    padding: 6px 14px; border-radius: var(--radius);
    font-size: 0.85rem; font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
nav a:hover { background: var(--bg-input); color: var(--text); }
nav a.active { background: rgba(59, 130, 246, 0.15); color: var(--accent); }

/* Table */
table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td { padding: 10px 14px; text-align: left; font-size: 0.88rem; }
th { color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid rgba(30, 45, 61, 0.5); }
tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* Badges */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: var(--radius);
    font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-admin { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.badge-mfa { background: rgba(16, 185, 129, 0.15); color: var(--green); }
.badge-no-mfa { background: rgba(245, 158, 11, 0.15); color: var(--yellow); }

/* Create user form */
.create-form .field-row {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.create-form input { flex: 1; min-width: 160px; }
.create-form button { width: auto; margin-top: 0; padding: 10px 18px; font-size: 0.85rem; white-space: nowrap; }
.checkbox {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.82rem; white-space: nowrap; color: var(--text-muted);
}
.checkbox input[type="checkbox"] {
    width: 16px; height: 16px; accent-color: var(--accent);
}

/* MFA Setup */
.mfa-setup { text-align: center; }
.mfa-setup p { margin-bottom: 16px; color: var(--text-muted); font-size: 0.9rem; }
.qr-container {
    display: inline-block; padding: 16px; background: #fff;
    border-radius: var(--radius-lg); margin-bottom: 16px;
}
.qr-container img { display: block; width: 200px; height: 200px; }
.secret-key { font-size: 0.82rem; }
.secret-key code {
    background: var(--bg-input); padding: 4px 10px;
    border-radius: var(--radius); font-size: 0.85rem; letter-spacing: 0.08em;
    user-select: all;
}
.mfa-setup .field { text-align: left; max-width: 280px; margin: 20px auto 0; }
.mfa-setup button { max-width: 280px; margin: 16px auto 0; }

.status-badge {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    font-size: 0.82rem; font-weight: 600;
}
.status-on { background: rgba(16, 185, 129, 0.15); color: var(--green); }
.status-off { background: rgba(245, 158, 11, 0.15); color: var(--yellow); }

/* Tabs — used on /settings to group Account/Profile/Security */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 16px 0 24px; flex-wrap: wrap; }
.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-size: 0.95rem;
    font-family: inherit;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Responsive */
@media (max-width: 600px) {
    body { padding: 16px 12px; }
    .card { padding: 24px 20px; }
    .center-card { margin-top: 4vh; }
    .create-form .field-row { flex-direction: column; }
    .create-form input { min-width: 100%; }
    .header { flex-direction: column; gap: 12px; align-items: flex-start; }
}
