@font-face { font-family: "Outfit"; src: url("../fonts/outfit-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Outfit"; src: url("../fonts/outfit-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Outfit"; src: url("../fonts/outfit-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --bg: #0b0b0f; --surface: #14141a; --surface-2: #1c1c24; --surface-3: #262631; --line: #2c2c38;
  --text: #f4f4f6; --muted: #a9a9b8; --faint: #7c7c8c;
  --red: #e5243b; --red-hi: #ff4a5c; --red-ink: #ff6b7a;
  --ok: #2bd576; --ok-bg: #0d3b24; --warn: #ffb020; --warn-bg: #3d2a05; --wrong: #ff8a3d; --wrong-bg: #3b1d08;
  --bad: #ff4a5c; --bad-bg: #3d0b13; --group: #5cb3ff; --group-bg: #0b2a47; --na: #b9a6ff; --na-bg: #251b47;
  --radius: 14px; --radius-sm: 10px; --shadow: 0 10px 30px rgba(0,0,0,.45);
  --font: "Outfit", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.5 var(--font); min-height: 100vh; overflow-x: hidden; }
a { color: var(--red-ink); }
a:hover { color: #fff; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 5vw, 3rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.8rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--mono); font-size: .92em; }
:focus-visible { outline: 3px solid var(--red-hi); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; color: #000; padding: 8px 12px; z-index: 100; border-radius: 8px; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.grid > * { min-width: 0; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.hidden { display: none !important; }

/* ---------- header ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(11,11,15,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 14px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; flex-shrink: 0; }
.brand svg { width: 34px; height: 34px; }
.brand .pass, .pass { color: var(--red-hi); }
.nav { display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); text-decoration: none; padding: 9px 12px; border-radius: 999px; font-weight: 600; font-size: .95rem; white-space: nowrap; }
.nav a:hover { color: #fff; background: var(--surface-2); }
.nav a[aria-current="page"] { color: #fff; background: var(--surface-3); }
.acct { margin-left: auto; flex-shrink: 0; }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .topbar .wrap { flex-wrap: wrap; gap: 8px; padding-top: 8px; padding-bottom: 6px; }
  .nav { order: 3; flex-basis: 100%; }
  .brand { font-size: 1.15rem; }
}

/* ---------- status bar (staff) ---------- */
.statusbar { background: var(--surface); border-bottom: 1px solid var(--line); font-size: .85rem; }
.statusbar .wrap { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding-top: 7px; padding-bottom: 7px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; border: 1px solid transparent; white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }
.pill.on { color: var(--ok); background: var(--ok-bg); }
.pill.off { color: #fff; background: var(--red); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.emer { color: #111; background: var(--warn); }
.pill.info { color: var(--group); background: var(--group-bg); }
.pill.gray { color: var(--muted); background: var(--surface-2); }
.statusbar .item { color: var(--muted); white-space: nowrap; }
.statusbar .item b { color: var(--text); font-weight: 600; }
.statusbar.offline { background: #2a0a10; border-color: #5a1422; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: 600 1rem var(--font); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-3); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-hi); }
.btn.ok { background: #129a52; border-color: #129a52; color: #fff; }
.btn.ok:hover { background: #17b863; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: #7a1a28; color: var(--red-ink); background: transparent; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn.big { min-height: 64px; font-size: 1.25rem; padding: 14px 26px; border-radius: 16px; }
.btn.block { width: 100%; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 4px; }
input, select, textarea { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 400 1rem var(--font); }
textarea { min-height: 90px; font-family: var(--mono); font-size: .85rem; }
input:focus, select:focus, textarea:focus { border-color: var(--red-hi); outline: none; box-shadow: 0 0 0 3px rgba(229,36,59,.3); }
.error-text { color: var(--red-ink); font-weight: 600; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stepper button { width: 48px; height: 48px; background: var(--surface-2); color: #fff; border: 0; font-size: 1.4rem; cursor: pointer; }
.stepper button:hover { background: var(--surface-3); }
.stepper button[disabled] { opacity: .35; cursor: not-allowed; }
.stepper output { min-width: 44px; text-align: center; font-weight: 800; font-size: 1.2rem; }

/* ---------- cards & tables ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card.pad-lg { padding: 26px; }
.card h3 { margin-bottom: 8px; }
.kpi { font-size: 2rem; font-weight: 800; line-height: 1; }
.kpi-label { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; background: var(--surface); position: sticky; top: 0; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: .78rem; font-weight: 700; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.info { background: var(--group-bg); color: var(--group); }
.tag.na { background: var(--na-bg); color: var(--na); }
.notice { border-radius: 12px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); }
.notice.warn { border-color: #6a4a0a; background: var(--warn-bg); }
.notice.bad { border-color: #6a1422; background: var(--bad-bg); }
.notice.info { border-color: #174a78; background: var(--group-bg); }
.notice.ok { border-color: #13643b; background: var(--ok-bg); }

/* ---------- toast & dialog ---------- */
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(92vw, 460px); }
.toast { background: var(--surface-3); border: 1px solid var(--line); border-left: 4px solid var(--red); padding: 12px 14px; border-radius: 10px; box-shadow: var(--shadow); }
.toast.ok { border-left-color: var(--ok); }
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 22px; max-width: min(94vw, 520px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.7); }

/* ---------- public site ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line);
  background: radial-gradient(1200px 500px at 70% -10%, rgba(229,36,59,.28), transparent 60%),
              radial-gradient(600px 300px at 10% 110%, rgba(120,120,160,.18), transparent 70%), #07070a; }
.hero .wrap { position: relative; z-index: 2; padding-top: clamp(48px, 9vw, 110px); padding-bottom: clamp(48px, 9vw, 110px); }
.hero h1 { font-size: clamp(2.4rem, 7vw, 4.6rem); max-width: 14ch; }
.hero p.lead { font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: #cfcfdb; max-width: 44ch; }
.moon { position: absolute; right: 8%; top: 12%; width: clamp(120px, 20vw, 260px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff6ee, #e9d6c8 45%, #b79d8e 70%, #6b5a52); box-shadow: 0 0 80px 20px rgba(255,235,220,.18); opacity: .9; z-index: 1; }
.treeline { position: absolute; left: 0; right: 0; bottom: -2px; height: 38%; z-index: 1; color: #050507; }
.fog { position: absolute; inset: auto -20% 0 -20%; height: 45%; z-index: 1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(200,200,220,.14), transparent) 0 100%/50% 80% repeat-x; animation: drift 40s linear infinite; }
@keyframes drift { to { background-position: 100% 100%; } }
.eyebrow { text-transform: uppercase; letter-spacing: .28em; font-size: .78rem; color: var(--red-ink); font-weight: 700; margin-bottom: 14px; }
.section { padding: clamp(36px, 6vw, 70px) 0; }
.attr-card { position: relative; overflow: hidden; min-height: 220px; display: flex; flex-direction: column; justify-content: flex-end; }
.attr-card .art { position: absolute; inset: 0; opacity: .55; }
.attr-card > * { position: relative; }
.price { font-size: 1.6rem; font-weight: 800; }
.product-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.product-row:last-child { border-bottom: 0; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar .dow { text-align: center; color: var(--faint); font-size: .8rem; font-weight: 600; padding: 4px 0; }
.calendar button { min-height: 52px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: 600 1rem var(--font); cursor: pointer; padding: 4px; }
.calendar button:hover:not([disabled]) { border-color: var(--red-hi); }
.calendar button[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.calendar button[disabled] { opacity: .28; cursor: not-allowed; background: transparent; }
.calendar .today { box-shadow: inset 0 -3px 0 var(--red-hi); }
.summary-line { display: flex; justify-content: space-between; padding: 6px 0; }
.footer { border-top: 1px solid var(--line); padding: 28px 0 60px; color: var(--faint); font-size: .9rem; }

/* ---------- tickets ---------- */
.tickets-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.ticket { background: #fff; color: #111114; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; break-inside: avoid; page-break-inside: avoid; }
.ticket-head { background: #0b0b0f; color: #fff; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ticket-head .brand { font-size: 1.05rem; }
.ticket-head .brand svg { width: 26px; height: 26px; }
.ticket-body { padding: 14px 16px 16px; display: grid; gap: 10px; }
.ticket .qr { display: grid; place-items: center; }
.ticket .qr canvas { width: 100%; max-width: 280px; height: auto; image-rendering: pixelated; }
.ticket .code { font-family: var(--mono); font-weight: 800; font-size: 1.35rem; letter-spacing: .12em; text-align: center; }
.ticket .meta { display: flex; justify-content: space-between; gap: 8px; font-size: .88rem; color: #3b3b46; flex-wrap: wrap; }
.ticket .ents { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.ent { font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #eef0f3; color: #25252e; border: 1px solid #d6d8de; }
.ent.used { background: #fff1d6; color: #7a4a00; border-color: #f0c77a; text-decoration: line-through; }
.ent.revoked { background: #ffe0e4; color: #9b0f22; border-color: #f2a3ae; }
.ticket.group .ticket-head { background: var(--red); }
.ticket-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 16px; }
.ticket-actions .btn { min-height: 40px; font-size: .88rem; padding: 6px 12px; background: #f1f2f5; color: #111; border-color: #d9dbe1; }
.ticket-actions .btn:hover { background: #e2e4ea; }
.demo-label { font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #9b0f22; background: #ffe0e4; padding: 3px 8px; border-radius: 6px; }

/* ---------- staff: chooser ---------- */
.chooser { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.acct-card { display: flex; gap: 14px; align-items: center; text-align: left; padding: 18px; min-height: 88px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.acct-card:hover { border-color: var(--red-hi); background: var(--surface-2); }
.avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-3); flex-shrink: 0; }
.avatar.admin { background: var(--red); }
.avatar.cashier { background: #2b5fd9; }
.avatar.staff { background: #1c8f55; }

/* ---------- scanner ---------- */
.scanner-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .scanner-layout { grid-template-columns: 1fr; } }
.station-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.station-banner .big { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.camera { position: relative; background: #000; border-radius: 16px; overflow: hidden; aspect-ratio: 4/3; border: 1px solid var(--line); }
.camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera .reticle { position: absolute; inset: 14%; border-radius: 12px; pointer-events: none;
  background: linear-gradient(var(--red-hi),var(--red-hi)) 0 0/34px 5px no-repeat, linear-gradient(var(--red-hi),var(--red-hi)) 0 0/5px 34px no-repeat,
  linear-gradient(var(--red-hi),var(--red-hi)) 100% 0/34px 5px no-repeat, linear-gradient(var(--red-hi),var(--red-hi)) 100% 0/5px 34px no-repeat,
  linear-gradient(var(--red-hi),var(--red-hi)) 0 100%/34px 5px no-repeat, linear-gradient(var(--red-hi),var(--red-hi)) 0 100%/5px 34px no-repeat,
  linear-gradient(var(--red-hi),var(--red-hi)) 100% 100%/34px 5px no-repeat, linear-gradient(var(--red-hi),var(--red-hi)) 100% 100%/5px 34px no-repeat; }
.camera .cam-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--muted); }
.result { border-radius: 18px; padding: 20px; border: 2px solid var(--line); background: var(--surface); }
.result .state { font-size: clamp(1.9rem, 6vw, 2.8rem); font-weight: 800; line-height: 1.05; letter-spacing: -.01em; margin-bottom: 6px; }
.result .icon { font-size: 2.6rem; line-height: 1; }
.result.VALID, .result.REDEEMED { border-color: var(--ok); background: var(--ok-bg); } .result.VALID .state, .result.REDEEMED .state { color: var(--ok); }
.result.ALREADY_USED { border-color: var(--warn); background: var(--warn-bg); } .result.ALREADY_USED .state { color: var(--warn); }
.result.WRONG_ATTRACTION, .result.WRONG_EVENT { border-color: var(--wrong); background: var(--wrong-bg); } .result.WRONG_ATTRACTION .state, .result.WRONG_EVENT .state { color: var(--wrong); }
.result.REVOKED, .result.INVALID { border-color: var(--bad); background: var(--bad-bg); } .result.REVOKED .state, .result.INVALID .state { color: var(--bad); }
.result.GROUP { border-color: var(--group); background: var(--group-bg); } .result.GROUP .state { color: var(--group); }
.result.NOT_OFFLINE { border-color: var(--na); background: var(--na-bg); } .result.NOT_OFFLINE .state { color: var(--na); }
.result.idle { border-style: dashed; }
.counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.counts div { background: rgba(0,0,0,.28); border-radius: 10px; padding: 8px; text-align: center; }
.counts b { display: block; font-size: 1.6rem; line-height: 1.1; }
.counts span { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.adm-list { display: grid; gap: 6px; margin: 10px 0; font-size: .9rem; }
.adm-list div { display: flex; justify-content: space-between; gap: 8px; background: rgba(0,0,0,.25); padding: 6px 10px; border-radius: 8px; }
@media (prefers-reduced-motion: no-preference) { .result.flash { animation: pop .25s ease-out; } }
@keyframes pop { from { transform: scale(.97); opacity: .6; } to { transform: none; opacity: 1; } }

/* ---------- gate ---------- */
.gate { max-width: 640px; margin: 30px auto; }
.gate .big-time { font-size: 1.4rem; font-weight: 800; }

/* ---------- admin ---------- */
.admin-layout { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 20px; align-items: start; }
.side-nav { display: grid; gap: 2px; position: sticky; top: 130px; }
.side-nav a { color: var(--muted); text-decoration: none; padding: 9px 12px; border-radius: 10px; font-weight: 600; }
.side-nav a:hover { background: var(--surface-2); color: #fff; }
.side-nav a[aria-current="page"] { background: var(--surface-3); color: #fff; box-shadow: inset 3px 0 0 var(--red); }
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .admin-layout .card table { display: block; overflow-x: auto; }
  .side-nav { position: static; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .side-nav a { white-space: nowrap; background: var(--surface); }
}
.ent-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.ent-cell { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: .85rem; }
main { min-height: 70vh; padding-bottom: 60px; }
.page-title { padding-top: 24px; padding-bottom: 8px; }
.ticket.group .ticket-head .pass { color: #111114; }

/* ---------- print ---------- */
@media print {
  @page { margin: 12mm; }
  body { background: #fff; color: #000; }
  .topbar, .statusbar, .no-print, .footer, .toasts, .ticket-actions, .skip { display: none !important; }
  main { padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .tickets-grid { grid-template-columns: repeat(2, 1fr); gap: 10mm; }
  .ticket { box-shadow: none; border: 1px solid #999; }
  .ticket-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
