:root {
  --bg: #f6f7f9; --surface: #fff; --text: #1d2330; --muted: #5d6778; --border: #dde1e7;
  --accent: #1f4e78; --accent-text: #fff; --link: #1d5fa6;
  --ok: #d8f0de; --ok-text: #1e5b2e; --exempt: #e9f1e1; --exempt-text: #3f5a26;
  --pending: #dde9f7; --pending-text: #1d4a7a; --warn: #fff0c2; --warn-text: #6b4e00;
  --bad: #fbdada; --bad-text: #8a1f1f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c; --surface: #1c2027; --text: #e4e7ec; --muted: #9aa3b2; --border: #313743;
    --accent: #3a6ea5; --link: #8cb8ec;
    --ok: #1f3b27; --ok-text: #a8e0b5; --exempt: #2a3520; --exempt-text: #c3dba4;
    --pending: #1f3048; --pending-text: #a9c8f0; --warn: #40361a; --warn-text: #f0d68a;
    --bad: #4a2224; --bad-text: #f3b0b0;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--link); }
header.top { background: var(--accent); color: var(--accent-text); padding: 0 16px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
header.top .brand { font-weight: 600; padding: 12px 0; }
header.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
header.top nav a { color: var(--accent-text); text-decoration: none; padding: 12px 10px; opacity: .85; }
header.top nav a.on, header.top nav a:hover { opacity: 1; box-shadow: inset 0 -3px 0 currentColor; }
header.top .user { font-size: 13px; opacity: .9; }
header.top .user a { color: var(--accent-text); }
main { max-width: 1400px; margin: 0 auto; padding: 20px 16px 60px; }
main.narrow { max-width: 760px; }
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.stat .n { font-size: 24px; font-weight: 600; }
.stat .bar { height: 6px; background: var(--bad); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.stat .bar span { display: block; height: 100%; background: var(--ok-text); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--surface); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.c, th.c { text-align: center; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; text-decoration: none; }
.s-ok { background: var(--ok); color: var(--ok-text); }
.s-exempt { background: var(--exempt); color: var(--exempt-text); }
.s-pending { background: var(--pending); color: var(--pending-text); }
.s-partial, .s-outdated, .s-expired, .s-vacant, .s-not_found { background: var(--warn); color: var(--warn-text); }
.s-missing { background: var(--bad); color: var(--bad-text); }
.s-confirmed { background: var(--ok); color: var(--ok-text); }
.s-filled, .s-on_staff { background: var(--pending); color: var(--pending-text); }
.s-approved { background: var(--ok); color: var(--ok-text); }
.s-rejected, .s-superseded { background: var(--border); color: var(--muted); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
/* Segmented button groups: a group never breaks inside; whole groups wrap. */
.seg { display: inline-flex; flex-wrap: nowrap; flex: none; max-width: 100%; }
.toolbar.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg a { display: inline-block; white-space: nowrap; line-height: 1.3; padding: 6px 12px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: var(--text); margin-right: -1px; }
.toolbar.seg a { border-radius: 6px; margin-right: 0; }
.toolbar select, .toolbar input[type=search] { min-width: 0; }
.seg a:first-child { border-radius: 6px 0 0 6px; } .seg a:last-child { border-radius: 0 6px 6px 0; }
.seg a.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=date], select, textarea {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); max-width: 100%; }
button, .btn { padding: 7px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); cursor: pointer; text-decoration: none; display: inline-block; }
button.secondary, .btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
button.danger { background: var(--bad); color: var(--bad-text); border-color: var(--bad); }
form.inline { display: inline; }
.email-cell { white-space: nowrap; }
.icon-btn { background: none; border: 0; color: var(--muted); padding: 2px 4px; line-height: 0; vertical-align: middle; margin-left: 4px; }
.icon-btn:hover, .icon-btn:focus-visible { color: var(--link); }
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 20px; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog h2 { margin: 0 0 4px; }
dialog input[type=email] { width: 100%; }
dialog .formerrors { margin: 10px 0 0; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 10px 14px; border-radius: 6px; margin-bottom: 6px; background: var(--pending); color: var(--pending-text); }
.messages li.success { background: var(--ok); color: var(--ok-text); }
.devbanner { background: #b45309; color: #fff; text-align: center; font-weight: 600; font-size: 13px; padding: 4px 8px; }
.formerrors { background: var(--bad); color: var(--bad-text); border-radius: 6px; padding: 10px 14px; margin-bottom: 12px; }
.formerrors ul { margin: 6px 0 0; padding-left: 20px; }
.messages li.error { background: var(--bad); color: var(--bad-text); }
.fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); align-items: end; }
.fields label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.doclist { list-style: none; padding: 0; margin: 0; }
.doclist li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.doclist li:last-child { border-bottom: 0; }
.doclist .name { flex: 1; min-width: 180px; }
code { font-size: 13px; }
@media (max-width: 700px) { header.top .user { width: 100%; padding-bottom: 8px; } }
.filters { gap: 12px; font-size: 13px; color: var(--muted); }
.filters label { display: inline-flex; align-items: center; gap: 5px; }
.filters select { padding: 4px 6px; }
a.sortlink { color: inherit; text-decoration: none; white-space: nowrap; }
a.sortlink:hover { color: var(--link); }
