:root {
  --bg: #05070b; --bg-1: #070a11; --bg-2: #0a0f19; --bg-3: #101826;
  --surface: rgba(255,255,255,.035); --line: rgba(255,255,255,.09);
  --ink: #eef3f8; --muted: #93a0b4; --faint: #5b6675;
  --blue: #3d7bff; --emerald: #17d9a3; --cyan: #37e0ff; --amber: #f4c542; --red: #ff5d6c;
  --grad: linear-gradient(120deg, var(--blue), var(--emerald) 55%, var(--cyan));
  --font-d: "Space Grotesk", Inter, system-ui, sans-serif;
  --font: Inter, system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 0.84, 0.44, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); min-height: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1,h2,h3 { font-family: var(--font-d); letter-spacing: -.02em; margin: 0; }
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100dvh; }
.side { background: var(--bg-2); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; height: 100dvh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 6px 8px 18px; font-family: var(--font-d); font-weight: 700; }
.brand b { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--grad); color: #05070b; }
.nav a { display: flex; gap: 10px; align-items: center; min-height: 42px; padding: 0 10px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.nav a:hover, .nav a.active { background: var(--bg-3); color: var(--ink); }
.main { min-width: 0; }
.top { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 24px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(10px); }
.top input { flex: 1; min-width: 160px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; }
.top-actions, .side-create { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.side-create { padding: 8px; }
.side-create .btn { width: 100%; }
.side-user { margin-top: auto; padding: 8px; color: var(--muted); font-size: 12px; }
.filters .btn, .top-actions .btn { flex: 0 0 auto; white-space: nowrap; }
.mob-bar, .bottom-nav, .nav-scrim { display: none; }
.btn.compact { min-height: 40px; padding: 0 14px; font-size: 14px; }
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--bg-3); display: grid; place-content: center; gap: 5px; padding: 0; }
.icon-btn i { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; }
.content { padding: 24px; display: grid; gap: 20px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.card .k { color: var(--muted); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.card .n { font-family: var(--font-d); font-size: 28px; margin-top: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 12px; border: 0; background: var(--grad); color: #05070b; font-weight: 700; text-decoration: none; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn.danger { background: transparent; border: 1px solid color-mix(in srgb, var(--red) 50%, transparent); color: var(--red); }
.btn:disabled { opacity: .5; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.page-create { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input, .filters select, label.f input, label.f select, label.f textarea { background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
label.f { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.toast { position: fixed; right: 16px; bottom: 16px; background: var(--bg-3); border: 1px solid var(--line); padding: 12px 16px; border-radius: 12px; z-index: 50; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); background: var(--bg-2); border: 1px solid var(--line); border-radius: 24px; padding: 32px; display: grid; gap: 12px; }
.login-card h1 { font-size: 28px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg-3); padding: 4px; border-radius: 12px; }
.tabs .tab { min-height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 700; }
.tabs .tab.active { background: var(--bg-2); color: var(--ink); }
.err { color: var(--red); font-size: 13px; }
.ok { color: var(--emerald); }
.badge { display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--bg-3); }
.badge.active, .badge.ok { color: var(--emerald); }
.badge.used { color: var(--amber); background: color-mix(in srgb, var(--amber) 16%, transparent); }
.badge.cancelled, .badge.invalidated, .badge.invalid { color: var(--red); }
.preview { border-radius: 18px; border: 1px solid var(--line); padding: 20px; min-height: 360px; background: #070a11; }
.validate { display: grid; gap: 16px; }
.validate .result { min-height: 220px; border-radius: 24px; display: grid; place-items: center; text-align: center; padding: 24px; font-size: 28px; font-weight: 800; }
.validate .result.ok { background: #0b3d2e; }
.validate .result.used { background: #4a3208; }
.validate .result.bad { background: #3d1014; }
#cam { width: 100%; max-height: 280px; background: #000; border-radius: 16px; object-fit: cover; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; }
.chart i { flex: 1; background: var(--grad); border-radius: 6px 6px 0 0; min-height: 4px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal .box { background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 20px; width: min(640px, 100%); max-height: 90dvh; overflow: auto; display: grid; gap: 12px; }
.public-wrap { width: min(720px, 92vw); margin: 32px auto 80px; display: grid; gap: 16px; }
.hero-img { width: 100%; border-radius: 20px; max-height: 280px; object-fit: cover; }
.type-grid { display: grid; gap: 10px; }
.type-card { text-align: left; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; }
.type-card[disabled] { opacity: .5; }
.signup { display: grid; gap: 10px; }
.qr-box { background: #fff; padding: 12px; border-radius: 16px; width: max-content; }
.wiz { display: grid; gap: 16px; }
.wiz-hero { display: flex; gap: 14px; align-items: center; }
.wiz-orb { width: 56px; height: 56px; border-radius: 18px; background: radial-gradient(circle at 30% 30%, #37e0ff, #3d7bff 45%, #17d9a3); box-shadow: 0 10px 30px rgba(61,123,255,.35); flex-shrink: 0; }
.wiz-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 6px; background: var(--bg-3); padding: 4px; border-radius: 14px; }
.wiz-tabs button { min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px; }
.wiz-tabs button.active { background: var(--bg-2); color: var(--ink); }
.wiz section { display: grid; gap: 12px; }
.wiz-nav { display: flex; gap: 8px; flex-wrap: wrap; position: sticky; bottom: 8px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-3); color: var(--ink); font-weight: 700; font-size: 13px; }
.ticket-card { min-height: 180px; }
.ticket-face { border-radius: 20px; padding: 20px; background: linear-gradient(160deg, #0a0f19, #101826); border: 1px solid var(--p, var(--blue)); display: grid; gap: 8px; position: relative; overflow: hidden; }
.ticket-face i { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--p, var(--blue)), var(--s, var(--emerald))); }
.ticket-face small { letter-spacing: .28em; color: var(--s, var(--emerald)); font-size: 11px; }
.ticket-face em { width: 72px; height: 72px; background: #fff; border-radius: 10px; display: grid; place-items: center; color: #05070b; font-style: normal; font-weight: 800; }
.ticket-png { width: min(420px, 100%); border-radius: 20px; display: block; }
#imgprev img { max-width: 220px; border-radius: 12px; }
@media (max-width: 860px) {
  html, body { min-height: 100dvh; }
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100dvh;
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  .desk-only { display: none !important; }
  .mob-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    position: sticky;
    top: 0;
    z-index: 8;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
  }
  .mob-bar .brand { padding: 0; flex: 1; min-width: 0; font-size: 16px; }
  .mob-bar .mob-create { display: flex; gap: 6px; flex-shrink: 0; }
  .mob-bar .btn.compact { padding: 0 10px; font-size: 12px; min-height: 36px; }
  .page-create { display: flex; gap: 8px; flex-wrap: wrap; }
  .nav-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 20;
  }
  .layout.nav-open .nav-scrim { display: block; }
  .side {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(300px, 86vw);
    height: 100dvh;
    z-index: 30;
    transform: translateX(-105%);
    transition: transform .22s var(--ease);
    flex-direction: column;
    flex-wrap: nowrap;
    padding: 18px 12px;
    padding-top: max(18px, env(safe-area-inset-top, 0px));
    box-shadow: none;
  }
  .layout.nav-open .side { transform: none; box-shadow: 12px 0 40px rgba(0,0,0,.4); }
  .side .nav a { min-height: 48px; }
  .top {
    padding: 10px 12px;
    position: static;
  }
  .top input { min-width: 0; width: 100%; }
  #gresults { width: 100%; display: grid; gap: 4px; }
  #gresults a { padding: 8px 4px; color: var(--cyan); }
  .content { padding: 14px 14px 20px; gap: 14px; }
  .content h1 { font-size: 22px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card { padding: 12px; border-radius: 14px; }
  .card .k { font-size: 10px; letter-spacing: .08em; }
  .card .n { font-size: 18px; margin-top: 4px; }
  .form-grid { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .filters { align-items: center; }
  .filters h1 { flex: 1 1 100%; }
  .filters select, .filters input { flex: 1 1 100%; }
  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    background: var(--bg-2);
    border-top: 1px solid var(--line);
    padding: 4px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .bottom-nav a, .bottom-nav button {
    min-height: 52px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    display: grid;
    place-items: center;
    border-radius: 10px;
  }
  .bottom-nav a.active, .bottom-nav button:focus-visible { color: var(--ink); background: var(--bg-3); }
  .toast { left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .login { padding: 20px 16px; align-items: start; }
  .login-card { padding: 22px 18px; border-radius: 18px; }
  .login-card h1 { font-size: 24px; }
  .preview { min-height: 220px; padding: 14px; }
  .validate .result { min-height: 160px; font-size: 22px; padding: 16px; }
}
