:root {
    --bg: #0b0f14;
    --surface: #141b24;
    --surface-2: #1a2332;
    --border: #2a3647;
    --text: #e8edf4;
    --muted: #8b9cb3;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --badge-dev: #f59e0b;
    --sidebar-w: 240px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ── Login page ── */
body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at top, #1a2744 0%, var(--bg) 60%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.login-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-brand h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.login-brand h1 span { color: var(--accent); }

.login-brand p {
    margin: 0.5rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.form-group { margin-bottom: 1.1rem; }

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted);
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-primary {
    width: 100%;
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* ── Admin shell (sidebar layout) ── */
.admin-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;
}

.sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand h1 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.sidebar-brand h1 span { color: var(--accent); }

.sidebar-brand small {
    display: block;
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.75rem;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.65rem;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 0.5rem;
}

.nav-label {
    padding: 0.4rem 0.75rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
}

.nav-link:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text);
}

.nav-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
}

.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.85;
}

.sidebar-footer {
    padding: 0.75rem 0.65rem 1rem;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    padding: 0.5rem 0.75rem 0.65rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.sidebar-user strong {
    display: block;
    color: var(--text);
    font-size: 0.875rem;
}

.nav-link.logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

.admin-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
}

.admin-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-topbar h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
}

.admin-content {
    padding: 1.75rem;
    max-width: 1280px;
}

/* ── Components ── */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
}

.stat-card .label {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
}

.stat-card .value {
    font-size: 1.85rem;
    font-weight: 700;
    margin-top: 0.2rem;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.panel-header {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.95rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(59, 130, 246, 0.04); }

.mono { font-family: ui-monospace, monospace; font-size: 0.82rem; }
.muted { color: var(--muted); }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-dev { background: rgba(245, 158, 11, 0.15); color: var(--badge-dev); }
.badge-google { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.badge-online { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-offline { background: rgba(139, 156, 179, 0.12); color: var(--muted); }

.empty {
    text-align: center;
    padding: 3rem;
    color: var(--muted);
}

@media (max-width: 768px) {
    .sidebar { width: 64px; }
    .sidebar-brand h1 span,
    .sidebar-brand small,
    .nav-label,
    .nav-link span,
    .sidebar-user { display: none; }
    .sidebar-brand h1 { font-size: 0; }
    .sidebar-brand h1::before { content: "FV"; font-size: 1rem; color: var(--accent); }
    .admin-main { margin-left: 64px; }
}
