:root {
  --bg: #f6f7f9; --card: #fff; --text: #1c2330; --muted: #667085; --line: #e3e6eb;
  --primary: #1f5fbf; --green: #157f3d; --red: #b42318; --grey: #6b7280; --blue: #2563eb;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px; }
h1 { font-size: 22px; margin: 8px 0 16px; } h2 { font-size: 17px; margin: 0; }
a { color: var(--primary); }
code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
pre { background: #0f172a; color: #e2e8f0; padding: 10px; border-radius: 6px; overflow-x: auto;
      white-space: pre-wrap; word-break: break-all; font-size: 12px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .nowrap { white-space: nowrap; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 16px;
       background: #111827; }
.top .brand { color: #fff; font-weight: 700; text-decoration: none; margin-right: 12px; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.top nav a { color: #cbd5e1; text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.top nav a.on, .top nav a:hover { background: #374151; color: #fff; }
.top .logout button { color: #cbd5e1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px;
        margin-bottom: 16px; }
.card.paused { opacity: .65; }
.narrow { max-width: 380px; margin: 60px auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form label, .narrow label { display: block; margin-bottom: 12px; font-weight: 600; }
.form label.check { font-weight: 400; display: flex; gap: 8px; align-items: baseline; }
.form label.warn { color: var(--red); }
input, select, textarea, button, .button {
  font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
  color: var(--text); }
.form input:not([type=checkbox]):not([type=radio]), .form textarea, .narrow input {
  display: block; width: 100%; margin-top: 4px; font-weight: 400; }
button, .button { cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .button:hover { border-color: #b8c0cc; }
button.primary, .button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
button.danger { color: var(--red); border-color: #f1b8b3; }
button.link { background: none; border: none; padding: 0; text-decoration: underline; }
button[disabled] { opacity: .45; cursor: not-allowed; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; }
.scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .03em; }
table.compact td, table.compact th { padding: 5px 6px; }
tr.failed { background: #fef3f2; }
td.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
td.actions form { margin: 0; }
details summary { cursor: pointer; color: var(--muted); }
details.danger summary { color: var(--red); padding: 7px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 12px 0; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; background: #ecfdf3;
         border: 1px solid #abefc6; }
.flash.error { background: #fef3f2; border-color: #fecdca; }
.flash ul { margin: 0; padding-left: 18px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
         background: #eef1f5; color: var(--text); white-space: nowrap; }
.badge.green, .badge.s-used { background: #dcfae6; color: var(--green); }
.badge.red, .badge.s-rejected { background: #fee4e2; color: var(--red); }
.badge.grey, .badge.s-cleared, .badge.s-expired { background: #f2f4f7; color: var(--grey); }
.badge.blue, .badge.s-pending { background: #dbeafe; color: var(--blue); }
.bar { display: inline-block; width: 90px; height: 8px; background: #eef1f5; border-radius: 4px;
       overflow: hidden; vertical-align: middle; margin-right: 6px; }
.bar span { display: block; height: 100%; background: var(--primary); }
.bar .w0 { width: 0%; }
.bar .w10 { width: 10%; }
.bar .w20 { width: 20%; }
.bar .w30 { width: 30%; }
.bar .w40 { width: 40%; }
.bar .w50 { width: 50%; }
.bar .w60 { width: 60%; }
.bar .w70 { width: 70%; }
.bar .w80 { width: 80%; }
.bar .w90 { width: 90%; }
.bar .w100 { width: 100%; }
.ranges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.ranges a { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff;
            text-decoration: none; font-size: 13px; }
.ranges a.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.ranges span { margin-left: 6px; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-right: 6px; }
.chip { padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #f2f4f7; color: var(--grey);
        border: 1px dashed #cfd5dd; }
.chip.got { background: #dcfae6; color: var(--green); border: 1px solid #abefc6; }
.arrow { color: var(--muted); font-size: 12px; }
