:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #1d2330; --muted: #5d6677; --border: #dde1e8;
  --accent: #2f6fdf; --accent-text: #ffffff; --accent-soft: #e6eefc;
  --ok: #1f8a4c; --ok-soft: #e4f4ea; --warn: #a76100; --warn-soft: #fbf0dc; --bad: #c0362c; --bad-soft: #fbe7e5;
  --row-alt: #eef2f8; --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .05);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #12151b; --panel: #1b2029; --text: #e6e9ef; --muted: #9aa3b4; --border: #2e3542;
  --accent: #6b9cff; --accent-text: #0d1320; --accent-soft: #1f2d4a;
  --ok: #4cc38a; --ok-soft: #173326; --warn: #f0b45a; --warn-soft: #3a2c14; --bad: #ff7b72; --bad-soft: #3d1d1b;
  --row-alt: #232a35; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; }
button, input { font: inherit; color: inherit; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 32px; }
.wrap.wide { max-width: 860px; }
[hidden] { display: none !important; }

header { display: flex; align-items: center; gap: 8px; padding: 16px 0 20px; }
.wordmark { margin: 0; font-size: 28px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.wordmark a { color: inherit; text-decoration: none; }
.wordmark .z-mark { height: 1.06em; width: auto; vertical-align: -0.175em; margin-right: .02em; }
.spacer { flex: 1; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel); cursor: pointer; padding: 0; }
.icon-btn:hover { border-color: var(--accent); }
.icon-btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.flag { width: 24px; height: 16px; border-radius: 2px; display: block; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.icon-btn svg.theme { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.panel h2 { font-size: 19px; margin: 0 0 12px; }
.panel p { margin: 0 0 12px; }
.panel > :last-child { margin-bottom: 0; }
.muted { color: var(--muted); }

form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
label small { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="password"], input[type="number"] { width: 100%; border: 1px solid var(--border); background: var(--bg);
  border-radius: 10px; padding: 11px 12px; font-size: 17px; font-weight: 400; }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input.code { font-size: 26px; letter-spacing: .15em; text-align: center; font-variant-numeric: tabular-nums; }
.primary { background: var(--accent); color: var(--accent-text); border: 0; border-radius: 10px; padding: 12px 20px; font-weight: 600; cursor: pointer; }
.primary:disabled { opacity: .5; cursor: not-allowed; }
a.primary { display: inline-block; text-decoration: none; }
.secondary { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 9px 16px; cursor: pointer; }
.secondary:hover { border-color: var(--accent); }
.danger { color: var(--bad); }
.danger:hover { border-color: var(--bad); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.message { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; background: var(--bad-soft); border: 1px solid var(--bad); }
.note { border-radius: 12px; padding: 12px 14px; background: var(--warn-soft); border: 1px solid var(--warn); }

/* The role looks the same for everyone, so nobody can tell it from afar. */
.role { text-align: center; padding: 36px 20px; }
.role strong { display: block; font-size: 30px; line-height: 1.2; margin: 8px 0 16px; }

.stat { font-size: 15px; color: var(--muted); }

.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); min-height: 46px; }
.list li:first-child { border-top: 0; }
.list li:nth-child(even) { background: var(--row-alt); }
.list .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list .tag { font-size: 13px; padding: 1px 9px; border-radius: 99px; background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.list .seen { font-size: 13px; color: var(--muted); }
.list input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.list button.remove { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; color: var(--muted); }
.list button.remove:hover { color: var(--bad); border-color: var(--bad); }
.list a { color: inherit; }
.list .check-row { flex-direction: row; align-items: center; gap: 10px; flex: 1; font-weight: 400; font-size: inherit; cursor: pointer; }
.panel .empty { color: var(--muted); margin: 0; }

.wrap.show { max-width: 1100px; }
.show .panel { padding: 28px 32px; }
.show h2 { font-size: clamp(24px, 3.5vw, 40px); margin-bottom: 20px; }
.show .step { font-size: clamp(18px, 2.4vw, 28px); margin: 0 0 8px; }
/* Sized by its column, so the code never pushes the QR code out of the panel. */
.code-huge { font-size: clamp(40px, 19cqi, 150px); font-weight: 800; letter-spacing: .04em; line-height: 1.05;
  font-variant-numeric: tabular-nums; margin: 8px 0 0; white-space: nowrap; }
.big-text { font-size: clamp(36px, 6vw, 80px); font-weight: 800; line-height: 1.1; margin: 8px 0 24px; }
.show-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: center; }
.show-grid > div { container-type: inline-size; min-width: 0; }
.show .qr { margin: 0; text-align: center; }
.show .qr img { display: block; margin: 0 auto; width: min(32vw, 50vh, 400px); min-width: 200px; height: auto; border-radius: 12px; }
.show .qr figcaption { color: var(--muted); font-size: 16px; margin-top: 10px; }
.show .count { font-size: clamp(18px, 2.4vw, 28px); color: var(--muted); margin: 24px 0 0; }
@media (max-width: 760px) { .show-grid { grid-template-columns: 1fr; } }
.panel.narrow { max-width: 420px; margin: 24px auto; }
.account { justify-content: flex-end; margin-bottom: 12px; }
.new-password { margin-top: 16px; }
.new-password code { font-size: 22px; font-weight: 700; letter-spacing: .04em; user-select: all; }
.actions { margin-top: 16px; }
.actions > p:last-child { margin-bottom: 0; }
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 12px; }
#admin-link { overflow-wrap: anywhere; color: var(--accent); }
.draw { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.draw input { max-width: 120px; }
