:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c1f24;
  --muted: #5d6673;
  --line: #e2e5ea;
  --primary: #2f5d8a;
  --primary-text: #ffffff;
  --danger: #b3261e;
  --ok: #1e7a43;
  --warn-bg: #fff4d6;
  --warn-line: #e8c15a;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1d2128;
    --text: #e7e9ec;
    --muted: #a1a9b5;
    --line: #2f3540;
    --primary: #8fb6e0;
    --primary-text: #0e1a26;
    --danger: #f2b8b5;
    --ok: #7fd6a2;
    --warn-bg: #3a3118;
    --warn-line: #8a6d1f;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 600; }
.who { display: flex; gap: 8px; align-items: center; color: var(--muted); }
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; margin-bottom: 16px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row label { margin-bottom: 0; }
.btn { font: inherit; border: 0; border-radius: 20px; padding: 8px 16px; background: var(--primary); color: var(--primary-text); cursor: pointer; }
.btn.text { background: transparent; color: var(--primary); padding: 8px 10px; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
h2.spaced { margin-top: 20px; }
label.check { flex-direction: row; align-items: center; gap: 6px; }
label.grow { flex: 1 1 320px; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.msg { min-height: 1.2em; color: var(--danger); margin: 8px 0 0; }
.msg.ok { color: var(--ok); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { font: inherit; background: none; border: 0; padding: 10px 14px; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; }
.tabs button.active { color: var(--text); border-bottom-color: var(--primary); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
td.actions { white-space: nowrap; }
td.details { color: var(--muted); font-size: 13px; max-width: 360px; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; border: 1px solid var(--line); }
.chip.ok, .chip.active { color: var(--ok); border-color: currentColor; }
.chip.denied, .chip.locked, .chip.revoked, .chip.rejected { color: var(--danger); border-color: currentColor; }
.chip.pending, .chip.invited { color: var(--text); background: var(--warn-bg); border-color: var(--warn-line); }
tr.pending td { background: var(--warn-bg); }
.banner { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 12px; padding: 10px 16px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 8px; max-width: 90vw; }
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; }
  .card { padding: 14px 16px; }
}
