:root {
  --bg: #f6f7f9; --card: #fff; --ink: #14171f; --muted: #6b7280; --line: #e5e7eb;
  --brand: #1f4fd8; --brand-ink: #fff; --ok: #0f7b4b; --err: #b42318; --warn: #9a5b00;
  --radius: 10px; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; } h2 { font-size: 1.15rem; margin: 0 0 .75rem; } h3 { font-size: 1rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; } .small { font-size: .8rem; }
.hidden { display: none !important; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.narrow { width: min(440px, 100%); } .wide-ish { width: min(620px, 100%); }
.top { display: flex; gap: 1rem; align-items: center; padding: .6rem 1.2rem; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; z-index: 2; }
.top nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.top nav button { background: none; border: 0; padding: .4rem .7rem; border-radius: 6px; color: var(--muted); }
.top nav button.active { background: #eef2ff; color: var(--brand); font-weight: 600; }
#view { max-width: 1100px; margin: 1.2rem auto; padding: 0 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; margin-bottom: 1rem; }
.card.ok { border-color: #a7e3c4; background: #f2fbf6; } .card.err { border-color: #f5c2bd; background: #fef4f3; }
label { display: block; margin: 0 0 .8rem; font-weight: 500; }
label small { font-weight: 400; color: var(--muted); }
label.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; }
label.check input { width: auto; margin-top: .25rem; }
input, select, textarea { width: 100%; font: inherit; padding: .5rem .6rem; border: 1px solid #cfd4dc; border-radius: 7px; background: #fff; margin-top: .25rem; color: inherit; }
textarea { resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d4fb; border-color: var(--brand); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem .2rem; margin: 0 0 1rem; }
legend { padding: 0 .4rem; color: var(--muted); font-size: .85rem; }
button { font: inherit; cursor: pointer; border: 1px solid #cfd4dc; background: #fff; border-radius: 7px; padding: .5rem .9rem; }
button:disabled { opacity: .55; cursor: progress; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
button.small { padding: .3rem .6rem; font-size: .8rem; white-space: nowrap; }
button.danger { color: var(--err); border-color: #f0b8b1; }
button.link { border: 0; background: none; color: var(--brand); }
.row { display: flex; gap: .4rem; align-items: center; } .row input, .row select, .row textarea { margin-top: 0; }
label .row { margin-top: .25rem; } .between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; }
.split { display: grid; grid-template-columns: 260px 1fr; gap: 1rem; align-items: start; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.list { list-style: none; padding: 0; margin: 0 0 1rem; }
.list button { width: 100%; text-align: left; border: 0; background: none; padding: .45rem .5rem; border-radius: 6px; }
.list button.active { background: #eef2ff; }
.list small { display: block; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; }
td.actions { white-space: nowrap; text-align: right; } td.actions button { margin-left: .25rem; }
.reveal { padding: .2rem 0; } .reveal b { min-width: 110px; font-weight: 500; }
.reveal code { flex: 1; background: #f3f4f6; padding: .25rem .5rem; border-radius: 5px; word-break: break-all; white-space: pre-wrap; }
.badge { font-size: .75rem; padding: .1rem .5rem; border-radius: 99px; background: #eef0f3; }
.badge.active { background: #e3f6ec; color: var(--ok); } .badge.consumed { background: #eef2ff; color: var(--brand); }
.badge.expired, .badge.revoked { background: #fdecea; color: var(--err); } .badge.uploading { background: #fff4e0; color: var(--warn); }
.warn { color: var(--warn); background: #fff8eb; border: 1px solid #f5dca8; padding: .5rem .7rem; border-radius: 7px; }
.msg { background: #f3f4f6; padding: .6rem .8rem; border-radius: 7px; }
progress { width: 100%; height: 10px; margin: .5rem 0 1rem; }
.foot { text-align: center; margin-top: 1rem; }
.toast { position: fixed; right: 1rem; bottom: 1rem; padding: .7rem 1rem; border-radius: 8px; background: var(--ink); color: #fff; z-index: 10; max-width: 380px; }
.toast.err { background: var(--err); }
