:root {
  --bg: #f5f6f8; --panel: #ffffff; --text: #1d2330; --muted: #6b7280; --line: #dfe3ea;
  --accent: #3157d5; --ok: #1f8a4c; --warn: #b7791f; --bad: #c53030;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15181f; --panel: #1d222b; --text: #e6e9ef; --muted: #9aa3b2; --line: #2c3340;
    --accent: #7c9cff; --ok: #4cc485; --warn: #e0b052; --bad: #ff7a7a; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
main { max-width: 1150px; margin: 0 auto; padding: 16px; }
nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
nav button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
section, form.card, .card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px; margin-bottom: 14px; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 14px 0 8px; }
label { display: block; margin: 6px 0; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea { width: 100%; max-width: 320px; }
textarea { max-width: 100%; width: 100%; min-height: 70px; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 6px 12px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--bad); border-color: var(--bad); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 14px; }
.table { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; border: 1px solid currentColor; }
.active { color: var(--ok); } .suspended { color: var(--warn); } .disabled, .revoked { color: var(--bad); }
.secret { font-family: Consolas, monospace; font-size: 15px; padding: 8px; background: var(--bg);
  border: 1px dashed var(--line); border-radius: 6px; word-break: break-all; user-select: all; }
.error { color: var(--bad); margin-top: 8px; }
#toast { position: fixed; right: 16px; bottom: 16px; max-width: 360px; padding: 10px 14px; border-radius: 8px;
  background: var(--text); color: var(--bg); opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: .95; }
.narrow { max-width: 420px; margin: 40px auto; }
.qr { display: block; margin: 8px auto; background: #fff; padding: 6px; border-radius: 6px; }
