:root {
  --bg: #f4f6f9; --card: #fff; --text: #1b2430; --muted: #6b7686; --line: #dde2ea;
  --accent: #2563eb; --accent-text: #fff; --ok: #15803d; --err: #b91c1c;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1520; --card: #182131; --text: #e8edf5; --muted: #8b97aa; --line: #2a3447; --accent: #3b82f6; --ok: #4ade80; --err: #f87171; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, sans-serif; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.top nav { display: flex; gap: 12px; align-items: center; }
.top nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.top nav a.on { color: var(--accent); }
.top form { margin: 0; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
main { max-width: 900px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }
h1 { margin: 0 0 12px; font-size: 1.5rem; }
h2 { margin: 20px 0 8px; font-size: 1.1rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.inline { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin-top: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; margin-top: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
input, select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.btn { display: inline-block; font: inherit; font-weight: 600; padding: 10px 18px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-text); cursor: pointer; text-decoration: none; text-align: center; }
.btn.alt { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.big { padding: 16px 22px; font-size: 1.1rem; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.link.danger { color: var(--err); }
.flash { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); }
.flash.saved { color: var(--ok); } .flash.error { color: var(--err); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td form { margin: 0; }
tr.off td { opacity: .5; }
.list { padding-left: 20px; }
.ticket-num { font-size: 4rem; font-weight: 800; letter-spacing: 2px; line-height: 1.1; }
.status { font-size: 1.3rem; font-weight: 600; }
.status.called { color: var(--ok); }
.win { font-size: 3rem; font-weight: 800; color: var(--ok); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.chip { display: inline-block; padding: 4px 10px; margin: 2px; border: 1px solid var(--line); border-radius: 999px; }
.qr { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.win-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.check { display: inline-flex; flex-direction: row; align-items: center; gap: 4px; margin: 0 10px 6px 0; color: var(--text); font-size: .95rem; }
/* табло: на весь экран, 10 строк вызовов слева, очередь справа */
body:has(.board) .top { display: none; }
body:has(.board) main { max-width: none; padding: 0; }
.board { height: 100vh; padding: 2vh 2vw; display: flex; flex-direction: column; gap: 1.5vh; overflow: hidden; }
.board-head { display: flex; justify-content: space-between; align-items: center; }
.board-head h1 { margin: 0; font-size: 4vh; }
.board-tools { display: flex; gap: 1.2vw; align-items: center; font-size: 2vh; }
.board-tools a { color: var(--muted); text-decoration: none; font-weight: 600; }
.board-tools form { margin: 0; }
#board { flex: 1; min-height: 0; }
.board-grid { height: 100%; display: grid; grid-template-columns: 2fr 1fr; gap: 2vw; }
.board-called, .board-wait { background: var(--card); border: 1px solid var(--line); border-radius: 1.5vh; padding: 1.5vh 2vw; min-height: 0; display: flex; flex-direction: column; }
.board-cols, .board-row { display: grid; grid-template-columns: 1fr auto 1fr; column-gap: 3vw; align-items: center; }
.board-cols { color: var(--muted); text-transform: uppercase; font-size: 2.2vh; padding-bottom: 1vh; border-bottom: 1px solid var(--line); }
.board-cols span:first-child, .board-row .num { justify-self: end; }
.board-cols span:last-child, .board-row .win { justify-self: start; }
.board-rows { flex: 1; min-height: 0; display: grid; grid-template-rows: repeat(10, 1fr); }
.board-row { font-size: 5.6vh; font-weight: 800; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.board-row:last-child { border-bottom: 0; }
.board-row .arrow { color: var(--muted); font-weight: 400; }
.board-row.first { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); border-radius: 1vh; }
.board-row.first .arrow { color: inherit; }
.board-empty { grid-row: 1 / -1; align-self: center; text-align: center; font-size: 3vh; }
.board-wait h2 { margin: 0 0 1.5vh; font-size: 3vh; }
.board-queue { display: flex; flex-wrap: wrap; gap: 1vh 1vw; align-content: flex-start; overflow: hidden; }
.board-queue .chip { font-size: 3.6vh; font-weight: 700; padding: .4vh 1.2vw; margin: 0; }
