/* Общие стили служебных страниц: билет, сканер, админка, документы */
:root {
  --stone: #DAD8D3; --paper: #F2F1EE; --black: #000; --graphite: #4A4945; --ash: #A3A19C;
  --ok: #1E6B34; --warn: #8A5A00; --bad: #A11B1B; --line: rgba(0, 0, 0, .16);
  --font: "Jost", "Futura", "Century Gothic", system-ui, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--stone); color: var(--black); font: 17px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 4px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--black); outline-offset: 3px; }
[hidden] { display: none !important; }

.page { max-width: 1100px; margin: 0 auto; padding: 20px 16px 64px; }
.page--narrow { max-width: 560px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; margin-bottom: 16px; }
.brand { font-size: 20px; letter-spacing: .08em; text-decoration: none; }
.muted { color: var(--graphite); }
.h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.05; font-weight: 500; letter-spacing: -.02em; }
.h2 { font-size: 24px; font-weight: 500; line-height: 1.2; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border: 2px solid var(--black);
  background: var(--black); color: #fff; font-size: 17px; font-weight: 500; text-decoration: none; cursor: pointer;
}
.btn:hover { background: transparent; color: var(--black); }
.btn--ghost { background: transparent; color: var(--black); }
.btn--ghost:hover { background: var(--black); color: #fff; }
.btn--sm { min-height: 44px; padding: 0 14px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.linkbtn { min-height: 44px; padding: 0; border: 0; background: none; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }

.card { background: var(--paper); padding: 20px; }
.card--dark { background: var(--black); color: #fff; }
.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--ash); border-radius: 0;
  background: #fff; font-size: 17px;
}
.input:focus-visible { outline: 3px solid var(--black); outline-offset: 0; }
.error { color: var(--bad); min-height: 1.5em; }

.login { display: grid; gap: 12px; max-width: 380px; margin: 12vh auto 0; }

/* Билет */
.ticket { background: var(--black); color: #fff; }
.ticket__main { padding: 24px; }
.ticket__no { color: var(--ash); font-size: 16px; }
.ticket__name { font-size: clamp(26px, 6vw, 36px); line-height: 1.1; font-weight: 500; margin: 4px 0 20px; overflow-wrap: anywhere; }
.ticket__qr { background: #fff; padding: 14px; width: min(100%, 320px); margin: 0 auto; }
.ticket__qr img { width: 100%; height: auto; image-rendering: pixelated; }
.ticket__hint { text-align: center; color: var(--ash); font-size: 15px; margin-top: 12px; }
.ticket__stub { border-top: 2px dashed rgba(255, 255, 255, .35); padding: 20px 24px; display: grid; gap: 6px; }
.ticket__entries { font-size: 22px; font-weight: 500; }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 15px; background: #fff; color: var(--black); }
.badge--ok { background: #D7EAD9; color: var(--ok); }
.facts { display: grid; gap: 14px; margin-top: 24px; }
.facts dt { color: var(--graphite); font-size: 15px; }
.facts dd { font-size: 18px; }
.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.option { position: relative; }
.option input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.option span { display: grid; place-content: center; text-align: center; min-height: 64px; padding: 6px; background: #fff; border: 1px solid var(--ash); line-height: 1.2; }
.option small { display: block; color: var(--graphite); font-size: 14px; }
.option input:checked + span { background: var(--black); color: #fff; border-color: var(--black); }
.option input:checked + span small { color: var(--stone); }
.option input:focus-visible + span { outline: 3px solid var(--black); outline-offset: 2px; }

/* Сканер */
.scan { display: grid; gap: 16px; }
.scan__video { position: relative; background: #111; aspect-ratio: 1; width: 100%; max-height: 62vh; overflow: hidden; }
.scan__video video { width: 100%; height: 100%; object-fit: cover; }
.scan__frame { position: absolute; inset: 15%; border: 3px solid rgba(255, 255, 255, .85); pointer-events: none; }
.scan__off { position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; color: #fff; text-align: center; padding: 24px; }
.result { padding: 20px; color: #fff; min-height: 120px; }
.result--ok { background: var(--ok); }
.result--already { background: var(--warn); }
.result--bad { background: var(--bad); }
.result--idle { background: #2B2B2B; }
.result__title { font-size: 28px; font-weight: 500; line-height: 1.15; }
.result__name { font-size: 22px; margin-top: 6px; overflow-wrap: anywhere; }
.result__meta { margin-top: 4px; opacity: .9; }
.counter { font-size: 18px; }
.counter b { font-size: 26px; font-weight: 500; }
.rows { list-style: none; padding: 0; display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; background: var(--paper); padding: 12px 14px; }
.row__name { font-weight: 500; overflow-wrap: anywhere; }
.row__meta { color: var(--graphite); font-size: 15px; }
.row__state { grid-column: 1; font-size: 15px; }
.row__state--in { color: var(--ok); }
.row .btn { grid-column: 2; grid-row: 1 / span 3; }

/* Админка */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--paper); padding: 16px; }
.stat b { display: block; font-size: 30px; font-weight: 500; line-height: 1.1; }
.stat span { color: var(--graphite); font-size: 15px; }
.section { margin-top: 36px; display: grid; gap: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.winner { padding: 24px; background: var(--black); color: #fff; }
.winner__no { font-size: 56px; line-height: 1; font-weight: 500; letter-spacing: -.02em; }
.pool { display: flex; flex-wrap: wrap; gap: 6px; font-variant-numeric: tabular-nums; }
.pool span { background: var(--paper); padding: 2px 8px; font-size: 15px; }
.table-wrap { overflow-x: auto; background: var(--paper); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; color: var(--graphite); white-space: nowrap; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Документы */
.doc { background: var(--paper); padding: clamp(20px, 4vw, 40px); }
.doc h1 { font-size: clamp(28px, 4vw, 36px); line-height: 1.15; font-weight: 500; margin-bottom: 16px; }
.doc h2 { font-size: 20px; font-weight: 500; margin: 24px 0 8px; }
.doc p, .doc li { margin: 0 0 10px; max-width: 70ch; }
.doc .todo { background: #FFF0B3; padding: 0 4px; }
