:root {
    --bg: #f5f6f8;
    --panel: #fff;
    --text: #1d2330;
    --muted: #6b7280;
    --line: #e2e5ea;
    --accent: #2457c5;
    --ok: #1e7f4f;
    --ok-bg: #e3f4ea;
    --warn: #8a5a00;
    --warn-bg: #fdf1d8;
    --bad: #b42318;
    --bad-bg: #fde7e5;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14171c;
        --panel: #1c2027;
        --text: #e6e8eb;
        --muted: #9aa1ab;
        --line: #2e343d;
        --accent: #7aa2ff;
        --ok: #6fd49b;
        --ok-bg: #173325;
        --warn: #f2c46d;
        --warn-bg: #3a2e14;
        --bad: #ff8d84;
        --bad-bg: #3d1c1a;
    }
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
small, .muted { color: var(--muted); }
.small { font-size: 13px; font-weight: normal; }
.nowrap { white-space: nowrap; }

.top {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.top .brand { font-weight: 600; color: var(--text); text-decoration: none; }
.top nav { display: flex; gap: 16px; flex: 1; }
.top nav a { text-decoration: none; }
.logout { display: flex; gap: 8px; align-items: center; margin: 0; }

main { padding: 16px 24px 48px; max-width: 1400px; }
h1 { font-size: 22px; display: flex; align-items: center; gap: 12px; }
h2 { font-size: 16px; margin-top: 28px; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--line);
}
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; font-size: 13px; color: var(--muted); }
tr.disabled td { opacity: .55; }
td.value { max-width: 420px; word-break: break-all; }
td.note { max-width: 260px; color: var(--muted); }
td.actions { white-space: nowrap; }
td.actions form { display: inline; margin-left: 8px; }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 20px;
    max-width: 760px;
}
.card.narrow { max-width: 360px; margin: 60px auto; }

label { display: block; margin-bottom: 14px; font-weight: 600; }
label.check { font-weight: normal; }
label small { font-weight: normal; }
input, select, textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}
input[type=checkbox] { display: inline; width: auto; margin-right: 6px; }
input.key { font-size: 15px; margin: 12px 0; }
.help { color: var(--muted); font-size: 13px; margin-top: -6px; }
details { margin: 14px 0; }
summary { cursor: pointer; margin-bottom: 10px; }

button, .button {
    display: inline-block;
    padding: 7px 14px;
    border: 0;
    border-radius: 4px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}
.button.small { padding: 4px 10px; font-size: 13px; font-weight: normal; }
button.secondary { background: var(--muted); }
button.link { background: none; color: var(--accent); padding: 0; }
button.link.danger { color: var(--bad); }
.buttons { display: flex; gap: 14px; align-items: center; margin-top: 8px; }

.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; margin: 0; }

.flash { padding: 9px 12px; border-radius: 4px; margin-bottom: 14px; background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--bad-bg); color: var(--bad); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }

.badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 12px;
    background: var(--line);
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.muted { color: var(--muted); }

.tiles { display: flex; gap: 12px; flex-wrap: wrap; }
.tile {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px 16px;
    min-width: 140px;
    color: var(--text);
    text-decoration: none;
}
.tile b { display: block; font-size: 24px; }
.tile.ok b { color: var(--ok); }
.tile.warn b { color: var(--warn); }
.tile.bad b { color: var(--bad); }
.pager { display: flex; gap: 16px; }

@media (max-width: 800px) {
    main, .top { padding-left: 16px; padding-right: 16px; }
    table { display: block; overflow-x: auto; }
}
