:root {
  --ink: #14212B;
  --muted: #4A5A66;
  --ground: #F4F5F2;
  --card: #FFFFFF;
  --line: #D5DBDE;
  --green: #0E7A3E;
  --green-dark: #0A6633;
  --green-soft: #E3F4EA;
  --green-text: #0B5E30;
  --red: #A3190F;
  --red-dark: #861208;
  --red-soft: #FBE4E2;
  --red-text: #9A1C12;
  --amber: #FFC233;
  --amber-ink: #1F1600;
  --amber-soft: #FFF1D1;
  --blue-soft: #E2ECF8;
  --blue-text: #1D4F8C;
  --display: 'Space Grotesk', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--body); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .55; cursor: not-allowed; }
button:active:not(:disabled) { transform: scale(.98); }
input, select { font-family: inherit; color: var(--ink); }
h1, h2 { font-family: var(--display); margin: 0; }
.hidden { display: none !important; }

/* ---------- counter app ---------- */
.app { max-width: 640px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; background: var(--ink); color: #fff; }
.topbar .small { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #B7C3CC; }
.topbar .big { font-family: var(--display); font-size: 22px; font-weight: 700; }
.pill-online, .pill-offline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; padding: 8px 12px; border-radius: 999px; white-space: nowrap; }
.pill-online { background: #1E3B2B; color: #8BE6AE; }
.pill-offline { background: #4A1712; color: #FFB4AB; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }

.screen { flex: 1; display: flex; flex-direction: column; }
.pad { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.grow { flex: 1; }
.label { font-size: 16px; font-weight: 600; }
.hint { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.45; }
.lead { font-size: 17px; line-height: 1.45; color: #3B4A55; margin: 0; }

.field { height: 64px; border: 2px solid var(--ink); border-radius: 14px; padding: 0 18px; font-size: 24px; background: #fff; width: 100%; }
.searchbox { display: flex; align-items: center; gap: 12px; height: 68px; border: 3px solid var(--ink); border-radius: 16px; background: #fff; padding: 0 12px 0 16px; }
.searchbox input { flex: 1; border: 0; outline: none; font-size: 24px; background: transparent; min-width: 0; height: 100%; }
.clear { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #E6E9E7; color: var(--ink); font-size: 24px; line-height: 1; }

.results { display: flex; flex-direction: column; gap: 12px; padding: 0 20px 24px; }
.result { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 84px; padding: 14px 18px; border: 2px solid var(--line); border-radius: 16px; background: #fff; text-align: left; color: var(--ink); width: 100%; }
.result .n { font-size: 21px; font-weight: 700; display: block; }
.result .i { font-size: 15px; color: var(--muted); display: block; margin-top: 4px; }
.tag { font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.tag.ok { background: var(--green-soft); color: var(--green-text); }
.tag.no { background: var(--red-soft); color: var(--red-text); }
.tag.undo { background: var(--amber-soft); color: #7A5300; }
.tag.blue { background: var(--blue-soft); color: var(--blue-text); }

.btn { height: 64px; border-radius: 16px; font-size: 18px; font-weight: 700; padding: 0 20px; border: 2px solid var(--ink); background: #fff; color: var(--ink); }
.btn-dark { border: 0; background: var(--ink); color: #fff; font-family: var(--display); font-size: 24px; height: 80px; border-radius: 18px; }
.btn-back { align-self: flex-start; height: 48px; padding: 0 16px; border: 0; border-radius: 12px; background: #E6E9E7; color: var(--ink); font-size: 16px; font-weight: 600; }
.btn-give { width: 100%; height: 112px; border: 0; border-radius: 22px; background: var(--green); color: #fff; font-family: var(--display); font-size: 34px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 14px; }
.btn-white { height: 80px; border: 0; border-radius: 20px; background: #fff; font-family: var(--display); font-size: 26px; font-weight: 700; width: 100%; }
.btn-ghost-white { height: 56px; border: 2px solid rgba(255,255,255,.6); border-radius: 16px; background: transparent; color: #fff; font-size: 17px; font-weight: 700; width: 100%; }

.guestcard { display: flex; flex-direction: column; gap: 14px; padding: 26px 22px; background: #fff; border: 2px solid var(--line); border-radius: 20px; }
.guestcard h1 { font-size: 36px; line-height: 1.1; word-break: break-word; }
.cap { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.idbig { font-size: 28px; font-weight: 700; letter-spacing: .02em; word-break: break-all; }

.full { flex: 1; display: flex; flex-direction: column; gap: 24px; padding: 56px 24px 28px; color: #fff; }
.full.green { background: var(--green); }
.full.red { background: var(--red); }
.full .icon { width: 116px; height: 116px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; align-self: center; flex-shrink: 0; }
.full h1 { text-align: center; font-size: 44px; line-height: 1; }
.full .sub { text-align: center; font-size: 20px; font-weight: 600; margin-top: -10px; }
.full .box { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; padding: 22px; border-radius: 20px; }
.full.green .box { background: var(--green-dark); }
.full.red .box { background: var(--red-dark); }
.full .box .bn { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1.15; word-break: break-word; }
.full .box .bi { font-size: 18px; color: rgba(255,255,255,.85); }
.full .box .bw { font-size: 22px; font-weight: 700; margin-top: 8px; }
.full .note { text-align: center; font-size: 15px; color: rgba(255,255,255,.88); margin: 0; }

/* offline banner */
.offline { display: flex; flex-direction: column; gap: 14px; padding: 22px 22px 24px; background: var(--amber); color: var(--amber-ink); border-bottom: 4px solid var(--amber-ink); }
.offline h2 { font-size: 34px; line-height: 1; display: flex; align-items: center; gap: 12px; }
.offline .strong { font-size: 20px; font-weight: 700; margin: 0; }
.offline p { margin: 0; font-size: 17px; line-height: 1.45; }
.offline button { height: 68px; border: 0; border-radius: 18px; background: var(--amber-ink); color: var(--amber); font-family: var(--display); font-size: 24px; font-weight: 700; }
.errorbar { padding: 14px 20px; background: var(--red-soft); color: var(--red-text); font-weight: 600; font-size: 16px; }

/* undo sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(20,33,43,.75); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet { width: 100%; max-width: 640px; display: flex; flex-direction: column; gap: 16px; padding: 26px 22px 30px; background: #fff; border-radius: 28px 28px 0 0; max-height: 100dvh; overflow-y: auto; }
.sheet h2 { font-size: 30px; line-height: 1.1; }
.sheet .who { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--ground); border-radius: 16px; }
.reason { height: 56px; border: 2px solid #C9D0D4; border-radius: 14px; background: #fff; color: var(--ink); font-size: 18px; font-weight: 600; text-align: left; padding: 0 18px; }
.reason.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.btn-red { height: 72px; border: 0; border-radius: 18px; background: var(--red); color: #fff; font-size: 20px; font-weight: 700; }
.btn-plain { height: 72px; border: 2px solid #C9D0D4; border-radius: 18px; background: #fff; color: var(--ink); font-size: 20px; font-weight: 700; }

/* ---------- admin ---------- */
.admin-top { background: var(--ink); color: #fff; padding: 18px 24px; }
.wrap { max-width: 1180px; margin: 0 auto; }
.admin-top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.admin-top .btns { display: flex; flex-wrap: wrap; gap: 10px; }
.abtn { height: 46px; padding: 0 16px; border-radius: 12px; font-size: 15px; font-weight: 700; border: 2px solid #5A6B77; background: transparent; color: #fff; }
.abtn.solid { border-color: #fff; background: #fff; color: var(--ink); }
.abtn.danger { border-color: #FF8A7D; color: #FFB4AB; }
main.wrap { padding: 22px 24px 48px; display: flex; flex-direction: column; gap: 22px; }
.cardbox { background: #fff; border: 1px solid #DDE2E4; border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cardbox h2 { font-size: 21px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpis .wide { grid-column: span 2; }
@media (max-width: 520px) { .kpis .wide { grid-column: span 1; } }
.kv { font-family: var(--display); font-size: 48px; line-height: 1; font-weight: 700; }
.kv.xl { font-size: 60px; }
.klabel { font-size: 15px; font-weight: 600; color: var(--muted); }
.bar { height: 16px; border-radius: 8px; background: #E6E9E7; overflow: hidden; }
.bar > div { height: 100%; background: var(--green); width: 0; transition: width .4s; }
.cols { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.cols > .side { flex: 1 1 320px; }
.cols > .main { flex: 999 1 540px; }
.tscroll { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 15px; }
table.t th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; padding: 8px 8px 8px 0; }
table.t td { border-top: 1px solid #E6E9E7; padding: 11px 8px 11px 0; vertical-align: middle; }
.minor { font-size: 14px; color: var(--muted); }
.green-t { color: var(--green-text); font-weight: 600; }
.red-t { color: var(--red-text); font-weight: 600; }
.sbtn { height: 36px; padding: 0 12px; border-radius: 10px; border: 2px solid #C9D0D4; background: #fff; font-size: 14px; font-weight: 700; color: var(--ink); }
.ainput { height: 48px; border: 2px solid #C9D0D4; border-radius: 12px; padding: 0 12px; font-size: 16px; background: #fff; width: 100%; }
.ainput:focus, .field:focus { outline: 3px solid #8FB3D9; outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.lbl { display: flex; flex-direction: column; gap: 8px; font-size: 15px; font-weight: 600; }
.warnbox { background: var(--amber-soft); color: #3D2A00; border-radius: 16px; padding: 18px 22px; }
.warnbox ul { margin: 8px 0 0; padding-left: 20px; line-height: 1.5; }
.okbox { background: var(--green-soft); color: var(--green-text); border-radius: 16px; padding: 18px 22px; font-weight: 600; }
.errbox { background: var(--red-soft); color: var(--red-text); border-radius: 16px; padding: 18px 22px; font-weight: 600; }
.bigbtn { height: 60px; padding: 0 28px; border: 0; border-radius: 16px; background: var(--green); color: #fff; font-family: var(--display); font-size: 21px; font-weight: 700; }
.login-wrap { max-width: 440px; margin: 0 auto; padding: 56px 24px; display: flex; flex-direction: column; gap: 24px; }
input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration { -webkit-appearance: none; display: none; }
