:root {
    color-scheme: light dark;
    --bg: #f7f7f8;
    --surface: #ffffff;
    --surface-2: #f0f0f2;
    --text: #1a1a1a;
    --muted: #666;
    --border: #d0d0d4;
    --accent: #2c5fd9;
    --ok-bg: #dcf5e3;
    --ok-bd: #63c678;
    --err-bg: #f8dcdf;
    --err-bd: #d05560;
    --danger: #c0392b;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #16181c;
        --surface: #1e2026;
        --surface-2: #262931;
        --text: #e8e8ea;
        --muted: #9b9ba3;
        --border: #343843;
        --ok-bg: #1e3a2a;
        --ok-bd: #3c7c52;
        --err-bg: #3c1e25;
        --err-bd: #8c3849;
    }
}

* { box-sizing: border-box; }

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

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1em 1.5em;
}
header .title { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 1.5em; }
header nav { display: flex; gap: 1em; margin-left: auto; }
header nav a, header .link {
    color: var(--accent); text-decoration: none; background: none; border: 0;
    font: inherit; cursor: pointer; padding: 0;
}
header nav a:hover, header .link:hover { text-decoration: underline; }

main { max-width: 1100px; margin: 2em auto; padding: 0 1.5em; }
footer { text-align: center; color: var(--muted); padding: 2em 0; }

h1 { margin: 0 0 1em; font-size: 1.8em; }
h2 { margin: 0 0 0.8em; font-size: 1.3em; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.2em 1.5em;
    margin-bottom: 1.5em;
}

form { margin: 0; display: flex; flex-wrap: wrap; gap: 1em; align-items: flex-end; }
form.inline { display: inline; }
label { display: flex; flex-direction: column; font-size: 0.9em; color: var(--muted); }
label span { margin-bottom: 0.2em; }
label.check { flex-direction: row; align-items: center; gap: 0.4em; color: var(--text); margin-top: 1.2em; }
input[type="text"], input[type="password"], input[type="date"], input[name] {
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
    border-radius: 4px; padding: 0.5em 0.7em; font: inherit; min-width: 180px;
}
input[type="checkbox"] { margin: 0; }
button {
    background: var(--accent); color: white; border: 0; padding: 0.55em 1.2em;
    border-radius: 4px; cursor: pointer; font: inherit;
}
button:hover { filter: brightness(1.1); }
button.btn { padding: 0.3em 0.7em; font-size: 0.85em; }
button.danger, .btn.danger { background: var(--danger); }
a.btn {
    background: var(--accent); color: white; text-decoration: none; padding: 0.3em 0.7em;
    font-size: 0.85em; border-radius: 4px; display: inline-block;
}
a.btn:hover { filter: brightness(1.1); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6em 0.8em; border-bottom: 1px solid var(--border); }
th { font-size: 0.85em; color: var(--muted); font-weight: 600; }
tr.revoked td { color: var(--muted); }
td.actions { display: flex; gap: 0.4em; flex-wrap: wrap; }

.badge {
    display: inline-block; padding: 0.15em 0.6em; border-radius: 999px;
    font-size: 0.78em; font-weight: 500;
}
.badge.green { background: #2c7c3a; color: white; }
.badge.red   { background: #8c3641; color: white; }
.badge.orange { background: #a86527; color: white; }

.flash {
    padding: 0.9em 1.2em; margin-bottom: 1.5em; border-radius: 6px;
    border: 1px solid var(--ok-bd); background: var(--ok-bg);
    white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, monospace;
}
.flash.err { border-color: var(--err-bd); background: var(--err-bg); }
.error { padding: 0.7em 1em; background: var(--err-bg); border: 1px solid var(--err-bd); border-radius: 6px; margin-bottom: 1em; }
.hint { color: var(--muted); font-size: 0.9em; }
.muted { color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 0.92em;
       background: var(--surface-2); padding: 0.1em 0.4em; border-radius: 3px; }
