:root {
    --bg: #0f1419;
    --surface: #1a2332;
    --border: #2d3a4d;
    --text: #e7ecf3;
    --muted: #8b9cb3;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --radius: 10px;
}

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

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

.topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar .brand a { font-weight: 700; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.topbar nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); text-decoration: none; padding: 0.25rem 0; }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); }
.topbar .user { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; color: var(--muted); }

.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

h1, h2 { margin-top: 0; }
.subtitle { color: var(--muted); margin-top: -0.5rem; }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}
.card h3 { margin: 0 0 0.5rem; font-size: 0.9rem; color: var(--muted); font-weight: 500; }
.card p { margin: 0; font-size: 1.75rem; font-weight: 700; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.65rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }

.btn, button[type=submit] {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.55rem 1rem;
    cursor: pointer;
    font-size: 0.95rem;
}
.btn:hover, button[type=submit]:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--border); }
.btn-danger { background: var(--danger); }
.btn-link { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

label { display: block; margin-bottom: 0.75rem; font-size: 0.9rem; color: var(--muted); }
input, select, textarea {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }

.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-error { background: rgba(239,68,68,0.15); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.15); color: #86efac; }

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}
.login-card h1 { text-align: center; margin-bottom: 0.25rem; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: var(--border);
}
.badge-success { background: rgba(34,197,94,0.2); color: #86efac; }
.badge-danger { background: rgba(239,68,68,0.2); color: #fca5a5; }

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: none; align-items: center; justify-content: center; z-index: 100;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: min(560px, 92vw);
    max-height: 90vh;
    overflow: auto;
}
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1rem; }
