/* ============================================================
   eco-nomo · чёрно-белая (монохромная) дизайн-система.
   Без внешних шрифтов — максимум скорости.
   ============================================================ */

:root {
  /* поверхности */
  --bg-0: #000000;
  --bg-1: #0b0b0b;
  --surface: rgba(255, 255, 255, .05);
  --surface-2: rgba(255, 255, 255, .09);
  --border: rgba(255, 255, 255, .12);
  --border-strong: rgba(255, 255, 255, .24);

  /* текст */
  --fg: #f4f4f4;
  --muted: #9a9a9a;
  --faint: #5e5e5e;

  /* акцент — белый */
  --ink: #ffffff;
  --danger: #d4d4d4;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, .9);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(900px 600px at 50% -10%, rgba(255, 255, 255, .07), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(255, 255, 255, .04), transparent 55%),
    linear-gradient(170deg, var(--bg-1), var(--bg-0));
  background-attachment: fixed;
}

/* ---------- Карточка ---------- */
.card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 26px 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  text-align: center;
  animation: rise .5s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ---------- Бренд ---------- */
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 auto 18px; padding: 6px 14px 6px 8px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface);
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.brand__dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 16px rgba(255, 255, 255, .35);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; filter: grayscale(1);
}

/* ---------- Типографика ---------- */
h1 {
  font-size: clamp(24px, 6vw, 30px); line-height: 1.15; letter-spacing: -.02em;
  margin: 0 0 8px; font-weight: 800;
}
.sub { color: var(--muted); margin: 0 0 26px; font-size: 15px; }
.hint { color: var(--faint); font-size: 13px; margin: 20px 0 0; }

/* ---------- Кнопки-ссылки (вход) ---------- */
.btns { display: grid; gap: 14px; }
.btn {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 17px 20px; border-radius: var(--radius-sm);
  font-size: 17px; font-weight: 700; text-decoration: none;
  transition: transform .12s var(--ease), box-shadow .2s var(--ease), filter .2s var(--ease), background .2s var(--ease);
}
.btn__ic { flex: 0 0 26px; height: 26px; display: grid; place-items: center; }
.btn__ic svg { width: 24px; height: 24px; }
.btn__tx { flex: 1; text-align: left; }
.btn__arrow { opacity: .55; transition: transform .2s var(--ease); }
.btn:hover .btn__arrow { transform: translateX(4px); }
.btn:active { transform: scale(.985); }
/* основная — белая заливка, чёрный текст */
.btn--restaurant { background: var(--ink); color: #000; box-shadow: 0 10px 26px -12px rgba(255, 255, 255, .35); }
.btn--restaurant:hover { filter: brightness(.92); }
/* вторичная — контур */
.btn--maps { background: transparent; color: var(--fg); border: 1.5px solid var(--border-strong); }
.btn--maps:hover { background: var(--surface-2); }

/* ---------- Визит / купон ---------- */
.visit-no {
  font-size: clamp(56px, 16vw, 76px); font-weight: 900; line-height: 1;
  margin: 14px 0 6px; letter-spacing: -.03em; color: var(--ink);
}
.meta { color: var(--muted); font-size: 15px; }
.meta b { color: var(--fg); }
.visit-time { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.visit-time b { color: var(--fg); }

.coupon-box {
  position: relative; margin: 22px 0 4px; padding: 20px 18px;
  background: var(--surface); border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm);
}
/* «надрезы» билета */
.coupon-box::before, .coupon-box::after {
  content: ""; position: absolute; top: 50%; width: 20px; height: 20px;
  background: var(--bg-0); border-radius: 50%; transform: translateY(-50%);
}
.coupon-box::before { left: -11px; }
.coupon-box::after  { right: -11px; }
.coupon-label { margin: 0 0 6px; color: var(--muted); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.coupon {
  font-size: clamp(28px, 9vw, 38px); font-weight: 900; letter-spacing: .1em;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--ink); text-shadow: 0 0 22px rgba(255, 255, 255, .25);
}

/* ---------- Киоск ----------
   Баннер виден целиком (contain). Кадр сохраняет пропорции картинки и масштабируется
   под вьюпорт при любой ориентации; QR позиционируется в % от кадра → всегда на месте.
   Поля по краям белые — сливаются с белым фоном баннера. */
.kiosk {
  position: fixed; inset: 0; background: #fff;
  display: grid; place-items: center; overflow: hidden;
}
.kiosk__frame {
  position: relative;
  aspect-ratio: 1093 / 2175;                          /* пропорции баннера (контент от края до края) */
  width: min(100vw, calc(100svh * 1093 / 2175));      /* самый большой кадр, влезающий целиком */
  max-width: 100vw; max-height: 100svh;
}
.kiosk__media { display: block; width: 100%; height: 100%; object-fit: contain; }
.kiosk__qr {
  position: absolute;
  left: 49.63%; top: 76.02%;         /* центр метки под QR на баннере */
  width: 30.28%;                     /* доля ширины кадра ≈ сторона квадрата-метки */
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  background: #fff;                  /* белый quiet-zone для сканируемости */
}
.kiosk__qr img, .kiosk__qr svg { display: block; width: 100%; height: 100%; }

/* ---------- QR-карточка (персонал) ---------- */
.qr-wrap {
  background: #fff; border-radius: 18px; padding: 16px; display: inline-block;
  margin: 6px 0 14px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.7);
}
.qr-wrap img, .qr-wrap svg { display: block; width: 256px; height: 256px; }

/* ---------- Статистика / кабинет ---------- */
.stats { max-width: 940px; text-align: left; }
.stats .brand { display: inline-flex; }
.stats h1 { text-align: left; }

.pin-form { display: flex; gap: 10px; justify-content: center; margin: 18px 0 6px; }
.pin-form input {
  font-size: 30px; letter-spacing: .5em; text-align: center; width: 180px; padding: 12px 12px 12px 22px;
  border-radius: 14px; border: 1px solid var(--border-strong); background: rgba(0,0,0,.4); color: var(--fg);
}
.pin-form input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255,255,255,.18); }
.pin-form button { padding: 0 20px; border: 0; border-radius: 14px; background: var(--ink); color: #000; font-size: 16px; font-weight: 800; cursor: pointer; }
.pin-err { color: var(--danger); font-size: 14px; min-height: 20px; text-align: center; }
#gate { text-align: center; }

.counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 18px; }
.counter { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 10px; }
.counter b { display: block; font-size: 26px; font-weight: 900; letter-spacing: -.02em; }
.counter span { color: var(--muted); font-size: 12px; }
.counter.kiosk b { color: var(--ink); }
.counter.organic b { color: var(--muted); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.visitors { width: 100%; border-collapse: collapse; font-size: 14px; }
table.visitors th, table.visitors td { padding: 11px 12px; text-align: left; white-space: nowrap; }
table.visitors thead th { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); position: sticky; top: 0; }
table.visitors tbody tr { border-top: 1px solid var(--border); }
table.visitors tbody tr:nth-child(even) { background: rgba(255,255,255,.025); }
table.visitors td:nth-child(2) { font-family: ui-monospace, Menlo, monospace; color: var(--fg); }
.src-kiosk { color: var(--fg); font-weight: 700; }
.src-organic { color: var(--muted); }
.section-h { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 10px; }
.mono { font-family: ui-monospace, Menlo, monospace; color: var(--muted); }

/* /me — раскрываемые строки гостей */
tr.g-head { cursor: pointer; }
tr.g-head:hover { background: var(--surface-2); }
tr.g-head .caret { color: var(--muted); font-size: 11px; transition: transform .15s var(--ease); display: inline-block; }
tr.g-head.open .caret { transform: rotate(180deg); }
tr.g-detail td { background: rgba(255,255,255,.04); font-size: 13px; color: var(--muted); white-space: normal; }
.detail-block { padding: 4px 0; }
.detail-block b { color: var(--fg); font-size: 12px; }

.refresh { margin-top: 16px; display: flex; gap: 10px; align-items: center; }
.refresh button, .links a, .ghost {
  background: var(--surface); color: var(--fg); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 9px 16px; font-size: 14px; font-weight: 600; text-decoration: none;
  display: inline-block; cursor: pointer; transition: background .15s var(--ease);
}
.refresh button:hover, .links a:hover { background: var(--surface-2); }

.tz-note { color: var(--faint); font-size: 12px; margin-top: 12px; }

@media (max-width: 480px) {
  .card { padding: 28px 18px 24px; }
  .counters { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .card, .kiosk__qr { animation: none; }
  .btn { transition: none; }
}
