:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #6b7280;
    --border: #e3e6eb;
    --primary: #0b5cad;
    --primary-text: #ffffff;
    --ok-bg: #e3f4ea;
    --ok-text: #1d6b3a;
    --alert-bg: #fdecec;
    --alert-text: #9b1c1c;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151b;
        --surface: #1b2029;
        --text: #e6e8ec;
        --muted: #9aa3b2;
        --border: #2b313c;
        --primary: #4c9be8;
        --primary-text: #0b1220;
        --ok-bg: #173826;
        --ok-text: #8ad5a6;
        --alert-bg: #3a1a1a;
        --alert-text: #f3a5a5;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0 0 8px; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: .92em; }
.muted { color: var(--muted); }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 600; color: var(--text); }
.topbar-nav { display: flex; gap: 16px; align-items: center; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 24px;
}
.login-card { width: 100%; max-width: 380px; }
.login-card form { display: grid; gap: 6px; margin-top: 16px; }
.login-card label { font-weight: 500; margin-top: 8px; }

input, select {
    font: inherit; color: var(--text); background: var(--bg);
    border: 1px solid var(--border); border-radius: 6px; padding: 9px 12px;
}

.btn {
    display: inline-block; font: inherit; cursor: pointer; text-align: center;
    padding: 9px 16px; border-radius: 6px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text);
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-full { width: 100%; margin-top: 16px; }

.alert {
    background: var(--alert-bg); color: var(--alert-text);
    padding: 10px 12px; border-radius: 6px; margin-top: 12px;
}

.stats {
    display: grid; gap: 12px; margin-bottom: 20px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    padding: 14px 16px; display: grid;
}
.stat-value { font-size: 1.4rem; font-weight: 600; }
.stat-value-sm { font-size: 1.05rem; line-height: 2rem; overflow-wrap: anywhere; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters input { flex: 1 1 240px; }

.table-wrap {
    overflow-x: auto; background: var(--surface);
    border: 1px solid var(--border); border-radius: 10px;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-weight: 500; color: var(--muted); font-size: .85rem; }
tbody tr:last-child td { border-bottom: 0; }

.badge {
    display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8rem;
    background: var(--border); color: var(--muted);
}
.badge-ok { background: var(--ok-bg); color: var(--ok-text); }
