:root {
    --bg: #0f1420;
    --surface: #161d2e;
    --surface-alt: #1c2438;
    --border: #29334a;
    --text: #e6e9f0;
    --text-muted: #8993ab;
    --accent: #4f7cff;
    --accent-2: #22c58b;
    --danger: #ef4444;
    --warn: #f59e0b;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Login ---------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, #1a2338, #0b0f19 70%);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.login-brand { text-align: center; margin-bottom: 28px; }
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px; height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}
.brand-mark.small { width: 30px; height: 30px; border-radius: 8px; font-size: 12px; margin-bottom: 0; }

.login-brand h1 { font-size: 18px; margin: 0 0 4px; }
.subtitle { color: var(--text-muted); font-size: 13px; margin: 0; }

form label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin: 16px 0 6px;
}
form input {
    width: 100%;
    padding: 11px 12px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
}
form input:focus { outline: none; border-color: var(--accent); }

form button {
    width: 100%;
    margin-top: 24px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
form button:hover { background: #3f68e0; }

.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 8px;
}
.alert-error { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }

/* ---------- Dashboard ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text-muted); }
.user-chip { background: var(--surface-alt); padding: 6px 10px; border-radius: 20px; }
.btn-logout {
    color: var(--text);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

.container { max-width: 1160px; margin: 0 auto; padding: 24px; }

.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 800px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
}
.card h2 { margin: 0 0 14px; font-size: 15px; color: var(--text); }

.metric-card { text-align: left; }
.metric-label { color: var(--text-muted); font-size: 13px; margin-bottom: 6px; }
.metric-value { font-size: 30px; font-weight: 700; line-height: 1; }
.metric-sub { color: var(--text-muted); font-size: 12px; margin-top: 6px; min-height: 16px; }

.progress {
    margin-top: 12px;
    height: 6px;
    background: var(--surface-alt);
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width 0.4s ease;
}

.info-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.info-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    padding: 8px 10px 8px 0;
    width: 40%;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}
.info-table td {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    word-break: break-word;
}
.info-table tr:last-child th, .info-table tr:last-child td { border-bottom: none; }

.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.small { font-size: 12px; }
.text-muted { color: var(--text-muted); }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-ok { background: rgba(34,197,139,0.15); color: var(--accent-2); }
.badge-bad { background: rgba(239,68,68,0.15); color: #f87171; }

.footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 20px 0 40px;
}
