:root {
  --bg: #f5f6f8; --card: #fff; --ink: #14181f; --muted: #5b6472; --line: #dfe3e9;
  --accent: #4338ca; --ok: #15803d; --bad: #b91c1c;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); padding-bottom: 76px; }
main { max-width: 640px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 8px 0 16px; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
.muted { color: var(--muted); }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.top .who { flex: 1; color: var(--muted); text-align: right; font-size: .9rem; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: 8px; padding: 8px; background: var(--card); border-top: 1px solid var(--line); }
.tabs a { flex: 1; text-align: center; padding: 16px 8px; border-radius: 12px; font-weight: 600; font-size: 1.05rem; color: var(--ink); text-decoration: none; background: var(--bg); }
.tabs a.active { background: var(--accent); color: #fff; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input, select { width: 100%; min-height: 52px; padding: 10px 14px; font: inherit; border: 1px solid #b8bfca; border-radius: 10px; background: #fff; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid #a5b4fc; outline-offset: 1px; }
button { font: inherit; font-weight: 600; min-height: 52px; padding: 10px 18px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; cursor: pointer; }
button.secondary { background: #e7e9ee; color: var(--ink); }
button.danger { background: var(--bad); }
button.link { min-height: 0; padding: 4px 8px; background: none; color: var(--accent); }
button:disabled { opacity: .55; cursor: wait; }.block { width: 100%; margin-top: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.error { color: var(--bad); font-weight: 600; min-height: 1.4em; }
#reader { width: 100%; min-height: 260px; background: #111; border-radius: 14px; overflow: hidden; }
.result { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; color: #fff; z-index: 10; }
.result.ok { background: var(--ok); } .result.bad { background: var(--bad); }
.result .icon { font-size: 5rem; line-height: 1; }
.result .title { font-size: 2.2rem; font-weight: 800; }
.result .name { font-size: 1.6rem; font-weight: 700; }
.result .detail { font-size: 1.1rem; opacity: .95; }
.result button { background: #fff; color: var(--ink); width: 100%; max-width: 420px; min-height: 64px; font-size: 1.2rem; margin-top: 16px; }
.qr { display: block; margin: 12px auto; width: 260px; max-width: 100%; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.stat b { display: block; font-size: 2rem; }
.admin main { max-width: 1000px; }
.sections { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.sections button { background: #e7e9ee; color: var(--ink); min-height: 44px; }
.sections button.active { background: var(--accent); color: #fff; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .95rem; }
th { color: var(--muted); font-weight: 600; }
td button { min-height: 36px; padding: 4px 10px; margin: 2px 4px 2px 0; font-size: .9rem; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .85rem; font-weight: 600; background: #e7e9ee; }
.tag.ok { background: #dcfce7; color: var(--ok); } .tag.bad { background: #fee2e2; color: var(--bad); }
dialog { border: 0; border-radius: 14px; padding: 20px; width: min(420px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 20; max-width: 90vw; }
.toast.bad { background: var(--bad); }
.login { max-width: 400px; margin: 10vh auto 0; padding: 16px; }
@media (min-width: 800px) {
  body { padding-bottom: 0; }
  .tabs { position: static; border-top: 0; border-bottom: 1px solid var(--line); justify-content: center; }
  .tabs a { flex: 0 0 auto; padding: 10px 20px; }
  .toast { bottom: 24px; }
}
