:root {
  --bg: #f6f5fb; --surface: #ffffff; --ink: #17132e; --muted: #625d7c; --line: #e3e0f0;
  --brand: #5a3df0; --brand-ink: #ffffff; --brand-soft: #ece8ff; --accent: #ffb224;
  --ok: #17803d; --ok-soft: #dff5e6; --warn: #9a5b00; --warn-soft: #fff0cf; --bad: #b3261e; --bad-soft: #fde4e1;
  --radius: 14px; --shadow: 0 1px 2px rgb(23 19 46 / 6%), 0 8px 24px rgb(23 19 46 / 7%);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #100e1f; --surface: #1a1730; --ink: #f1effa; --muted: #a39fbd; --line: #2e2a4a;
    --brand: #8e78ff; --brand-ink: #100e1f; --brand-soft: #2a2350;
    --ok: #6fdc95; --ok-soft: #14351f; --warn: #ffcf70; --warn-soft: #3b2c0b; --bad: #ff9a92; --bad-soft: #43191a;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 30%);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; }
a { color: var(--brand); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
[hidden] { display: none !important; }

/* Top bar */
.top { display: flex; align-items: center; gap: 12px; padding: 14px 0; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.2rem; color: var(--ink); text-decoration: none; letter-spacing: -0.03em; }
.logo svg { width: 28px; height: 28px; }
.top .spacer { flex: 1; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.8rem; font-weight: 700; padding: 6px 11px; cursor: pointer; }
.lang button[aria-pressed='true'] { background: var(--ink); color: var(--bg); }

/* Buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: 0.875rem; }
.btn.big { min-height: 52px; padding: 0 24px; font-size: 1.05rem; border-radius: 12px; }
.btn:disabled { opacity: 0.55; cursor: default; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
label { display: grid; gap: 5px; font-size: 0.875rem; font-weight: 650; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit;
}
input[type='color'] { padding: 4px; height: 42px; cursor: pointer; }
textarea { min-height: 110px; resize: vertical; }
.form { display: grid; gap: 14px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.notice { border-radius: 10px; padding: 12px 14px; background: var(--warn-soft); color: var(--warn); font-size: 0.925rem; }
.error { border-radius: 10px; padding: 10px 14px; background: var(--bad-soft); color: var(--bad); font-size: 0.925rem; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 650; box-shadow: var(--shadow); z-index: 20; }

/* Landing */
.hero { display: grid; gap: 40px; align-items: center; padding: 40px 0 56px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .hero { grid-template-columns: 1.1fr 0.9fr; padding: 64px 0 80px; } }
.hero h1 { font-size: clamp(2.1rem, 5.2vw, 3.5rem); font-weight: 800; }
.hero p.sub { font-size: 1.15rem; color: var(--muted); margin: 18px 0 26px; max-width: 34em; }
.hero-card { justify-self: center; transform: rotate(-3deg); width: min(100%, 340px); }
.features { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); padding-bottom: 56px; }
.feature h3 { font-size: 1.05rem; margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: 0.95rem; }
.feature .badge { margin-bottom: 8px; }
.price { text-align: center; padding: 36px 20px; margin-bottom: 56px; }
.price .amount { font-size: clamp(2.6rem, 8vw, 4rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin: 14px 0 4px; }
.price p { max-width: 34em; margin: 10px auto 0; }
.price .btn { margin-top: 22px; }
footer.foot { padding: 24px 0 40px; color: var(--muted); font-size: 0.875rem; text-align: center; }

/* App */
.auth { max-width: 420px; margin: 32px auto; }
.auth h1 { font-size: 1.6rem; margin-bottom: 16px; }
.auth .switch { margin-top: 14px; font-size: 0.925rem; color: var(--muted); }
.auth .switch button { border: 0; background: none; color: var(--brand); font: inherit; font-weight: 650; cursor: pointer; padding: 0; }
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 18px 0; }
.head h1 { font-size: 1.7rem; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.events { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.event-card { display: grid; gap: 8px; text-decoration: none; color: inherit; }
.event-card:hover { border-color: var(--brand); }
.event-card h3 { font-size: 1.15rem; overflow-wrap: anywhere; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 650; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--brand); }
.split { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 820px) { .split { grid-template-columns: 1fr 340px; } }
.stack { display: grid; gap: 16px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.925rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.acts { white-space: nowrap; text-align: right; }
td.acts .btn { margin-left: 4px; }
.mail { border-top: 1px solid var(--line); padding: 12px 0; }
.mail:first-child { border-top: 0; }
.mail pre { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 0.9rem; color: var(--muted); }
.result { border-radius: var(--radius); padding: 18px; font-size: 1.15rem; font-weight: 700; }
.result.ok { background: var(--ok-soft); color: var(--ok); }
.result.already { background: var(--warn-soft); color: var(--warn); }
.result.unknown { background: var(--bad-soft); color: var(--bad); }
.result small { display: block; font-weight: 500; font-size: 0.9rem; }
video.scanner { width: 100%; max-width: 420px; border-radius: var(--radius); background: #000; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 20px; width: min(92vw, 440px); }
dialog::backdrop { background: rgb(10 8 25 / 55%); }

/* Ticket card */
.tcard {
  --tc-bg: #1d1554; --tc-accent: #ffb224; --tc-fg: #fff; --tc-accent-fg: #17132e;
  background: var(--tc-bg); color: var(--tc-fg); border-radius: 22px; overflow: hidden;
  box-shadow: 0 2px 4px rgb(23 19 46 / 12%), 0 18px 40px rgb(23 19 46 / 22%); width: 100%; max-width: 380px;
}
.tcard-gradient { background: linear-gradient(150deg, var(--tc-bg) 35%, color-mix(in srgb, var(--tc-bg) 55%, var(--tc-accent)) 130%); }
.tcard-stripes { background: repeating-linear-gradient(135deg, var(--tc-bg) 0 22px, color-mix(in srgb, var(--tc-bg) 90%, var(--tc-fg)) 22px 44px); }
.tcard-main { padding: 22px 22px 18px; }
.tcard-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 22px; }
.tcard-kind { background: var(--tc-accent); color: var(--tc-accent-fg); font-weight: 800; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }
.tcard-brand { font-weight: 800; font-size: 0.8rem; opacity: 0.7; letter-spacing: -0.02em; }
.tcard-title { font-size: 1.7rem; font-weight: 800; overflow-wrap: anywhere; }
.tcard-tagline { margin-top: 6px; opacity: 0.85; overflow-wrap: anywhere; }
.tcard-meta { margin-top: 18px; display: grid; gap: 2px; font-size: 0.95rem; font-weight: 600; }
.tcard-meta div:first-child { color: var(--tc-accent); }
.tcard-cut { position: relative; border-top: 2px dashed color-mix(in srgb, var(--tc-fg) 40%, transparent); margin: 0 18px; }
.tcard-cut::before, .tcard-cut::after { content: ''; position: absolute; top: -13px; width: 24px; height: 24px; border-radius: 50%; background: var(--bg); }
.tcard-cut::before { left: -30px; }
.tcard-cut::after { right: -30px; }
.tcard-stub { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px 22px; }
.tcard-guest { min-width: 0; }
.tcard-label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.7; }
.tcard-guest strong { display: block; font-size: 1.15rem; overflow-wrap: anywhere; }
.tcard-footer { margin-top: 8px; font-size: 0.75rem; opacity: 0.75; overflow-wrap: anywhere; }
.tcard-qr { flex: none; width: 118px; height: 118px; border-radius: 12px; background: #fff; }
.tcard-qr-sample { background: #fff conic-gradient(#17132e 25%, #fff 0 50%, #17132e 0 75%, #fff 0) 0 0 / 22px 22px; border: 8px solid #fff; }

/* Public ticket page */
.ticket-page { min-height: 100dvh; display: grid; place-items: center; padding: 20px 16px 40px; }
.ticket-page .inner { display: grid; gap: 16px; justify-items: center; width: 100%; max-width: 380px; }
.ticket-page .tcard-qr { width: 150px; height: 150px; }
.ticket-page .top { width: 100%; padding: 0; }
