/* ==========================================================================
   ShwariTicket — design system
   Public app · Gate (guichet) · Back-office
   ========================================================================== */

:root {
  --brand: #D3121B;
  --brand-600: #B30E16;
  --brand-700: #8F0B12;
  --brand-50: #FDECEC;
  --brand-glow: rgba(211, 18, 27, .35);

  --night: #090C12;
  --night-2: #121823;
  --night-3: #1B2330;
  --gold: #E6AE3E;
  --gold-50: #FBF3E2;

  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #F8F9FB;
  --ink: #0D1117;
  --ink-2: #374151;
  --muted: #6B7280;
  --faint: #9CA3AF;
  --line: #E5E7EB;
  --line-2: #EEF0F3;

  --success: #059669;
  --success-50: #E7F7F0;
  --warning: #B45309;
  --warning-50: #FEF5E6;
  --danger: #DC2626;
  --danger-50: #FDECEC;
  --info: #2563EB;
  --info-50: #EAF1FE;

  --radius-lg: 24px;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 30px -12px rgba(16, 24, 40, .14);
  --shadow-lg: 0 24px 60px -20px rgba(9, 12, 18, .35);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Sora', 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --topbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0D12;
    --surface: #121720;
    --surface-2: #171D28;
    --ink: #F3F4F6;
    --ink-2: #D1D5DB;
    --muted: #9AA3B2;
    --faint: #6B7280;
    --line: #252D3A;
    --line-2: #1E2531;
    --brand-50: rgba(211, 18, 27, .16);
    --gold-50: rgba(230, 174, 62, .14);
    --success-50: rgba(5, 150, 105, .16);
    --warning-50: rgba(180, 83, 9, .2);
    --danger-50: rgba(220, 38, 38, .16);
    --info-50: rgba(37, 99, 235, .16);
    --success: #34D399;
    --warning: #FBBF24;
    --danger: #F87171;
    --info: #60A5FA;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

/* ── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; margin: 0; letter-spacing: -.02em; }
h1 { font-size: clamp(28px, 5vw, 44px); font-weight: 800; }
h2 { font-size: clamp(20px, 3vw, 26px); font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
::selection { background: var(--brand); color: #fff; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.container-sm { max-width: 720px; }
.container-xs { max-width: 480px; }
@media (min-width: 768px) { .container { padding: 0 24px; } }

.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); }
.row { display: flex; align-items: center; gap: var(--gap, 12px); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: var(--gap, 16px); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; } .mt-5 { margin-top: 40px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; } .mb-4 { margin-bottom: 24px; }
.text-right { text-align: right; } .text-center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  --b-bg: var(--surface); --b-fg: var(--ink); --b-bd: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  font: 600 14.5px/1 var(--font);
  color: var(--b-fg); background: var(--b-bg);
  border: 1px solid var(--b-bd); border-radius: 12px;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease, border-color .15s;
}
.btn:hover { border-color: var(--faint); }
.btn:active { transform: scale(.98); }
.btn:focus-visible, .field input:focus-visible, .field select:focus-visible { outline: 3px solid var(--brand-glow); outline-offset: 2px; }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn .bi { font-size: 1.1em; }
.btn-primary { --b-bg: var(--brand); --b-fg: #fff; --b-bd: var(--brand); box-shadow: 0 8px 20px -8px var(--brand-glow); }
.btn-primary:hover { --b-bg: var(--brand-600); border-color: var(--brand-600); }
.btn-dark { --b-bg: var(--night); --b-fg: #fff; --b-bd: var(--night); }
.btn-dark:hover { --b-bg: var(--night-3); }
.btn-ghost { --b-bg: transparent; --b-bd: transparent; }
.btn-ghost:hover { --b-bg: var(--surface-2); border-color: transparent; }
.btn-soft { --b-bg: var(--brand-50); --b-fg: var(--brand); --b-bd: transparent; }
.btn-success { --b-bg: var(--success); --b-fg: #fff; --b-bd: var(--success); }
.btn-danger-soft { --b-bg: var(--danger-50); --b-fg: var(--danger); --b-bd: transparent; }
.btn-white { --b-bg: #fff; --b-fg: var(--night); --b-bd: #fff; }
.btn-glass { --b-bg: rgba(255,255,255,.1); --b-fg: #fff; --b-bd: rgba(255,255,255,.18); backdrop-filter: blur(8px); }
.btn-glass:hover { --b-bg: rgba(255,255,255,.18); border-color: rgba(255,255,255,.3); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { height: 54px; padding: 0 24px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.link { color: var(--brand); font-weight: 600; }
.link:hover { text-decoration: underline; }

/* ── Badges & chips ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge-success { background: var(--success-50); color: var(--success); }
.badge-warning { background: var(--warning-50); color: var(--warning); }
.badge-danger { background: var(--danger-50); color: var(--danger); }
.badge-info { background: var(--info-50); color: var(--info); }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.badge-gold { background: var(--gold-50); color: #9A6A0B; }
.badge-plain::before { display: none; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tag-live { color: var(--brand); }
.tag-live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--brand-glow); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ── Cards ────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
@media (min-width: 768px) { .card-pad { padding: 24px; } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h3 { font-size: 16px; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line-2); }
.card-link { transition: transform .15s ease, box-shadow .15s ease; }
.card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.section { padding: 40px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-head p { margin-top: 6px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); }

/* ── Forms ────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea, .input {
  width: 100%; height: 48px; padding: 0 14px;
  font: 500 15px var(--font); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
}
.field textarea { height: auto; min-height: 90px; padding: 12px 14px; resize: vertical; }
.field select, select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); outline: none; }
.field input[type="file"] { padding: 10px; height: auto; }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .bi, .input-group > .prefix { position: absolute; left: 14px; color: var(--faint); pointer-events: none; font-size: 15px; }
.input-group > .prefix { font-weight: 600; color: var(--muted); font-size: 14px; }
.input-group input { padding-left: 42px; }
.input-group .suffix { position: absolute; right: 8px; }
.input-lg input { height: 56px; font-size: 18px; font-weight: 600; }
.form-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-grid-2 { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: span 2; } }
.checkbox { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--brand); }

/* Option tiles (radio cards) */
.options { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.option { position: relative; cursor: pointer; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option-box {
  display: flex; flex-direction: column; gap: 4px; height: 100%;
  padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.option:hover .option-box { border-color: var(--faint); }
.option input:checked + .option-box { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 3px var(--brand-50); }
.option input:focus-visible + .option-box { outline: 3px solid var(--brand-glow); }
.option input:disabled + .option-box { opacity: .45; cursor: not-allowed; }
.option-title { font-weight: 700; font-size: 15px; }
.option-sub { font-size: 12.5px; color: var(--muted); }
.option-price { font-family: var(--display); font-weight: 700; font-size: 18px; margin-top: 4px; }
.option-row .option-box { flex-direction: row; align-items: center; gap: 12px; }

/* Segmented control */
.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 14px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span, .seg button, .seg a {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  font: 600 13.5px var(--font); color: var(--muted); border-radius: 10px; cursor: pointer; border: 0; background: none; white-space: nowrap;
}
.seg input:checked + span, .seg .is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg-block { display: flex; } .seg-block > * { flex: 1; } .seg-block span, .seg-block button, .seg-block a { width: 100%; justify-content: center; }

/* Mobile money operators */
.operators { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.operator { position: relative; cursor: pointer; }
.operator input { position: absolute; opacity: 0; }
.operator span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  height: 64px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface);
  font-size: 12.5px; font-weight: 700; transition: all .15s;
}
.operator span i { width: 26px; height: 26px; border-radius: 8px; background: var(--op); color: #fff; font-style: normal; font-size: 11px; display: grid; place-items: center; font-weight: 800; }
.operator input:checked + span { border-color: var(--op); box-shadow: 0 0 0 3px color-mix(in srgb, var(--op) 18%, transparent); }

/* Quantity stepper */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.stepper button { width: 46px; height: 46px; border: 0; background: none; font-size: 20px; color: var(--ink); cursor: pointer; }
.stepper button:hover { background: var(--surface-2); }
.stepper input { width: 52px; height: 46px; border: 0; text-align: center; font: 700 17px var(--display); color: var(--ink); background: transparent; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── Alerts & toasts ──────────────────────────────────────────────────── */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; font-size: 14px; background: var(--surface-2); border: 1px solid var(--line-2); }
.alert > .bi { font-size: 18px; line-height: 1.2; }
.alert-info { background: var(--info-50); border-color: transparent; color: var(--ink); } .alert-info > .bi { color: var(--info); }
.alert-warning { background: var(--warning-50); border-color: transparent; } .alert-warning > .bi { color: var(--warning); }
.alert-danger { background: var(--danger-50); border-color: transparent; } .alert-danger > .bi { color: var(--danger); }
.alert-success { background: var(--success-50); border-color: transparent; } .alert-success > .bi { color: var(--success); }

.toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); top: calc(12px + var(--safe-top)); width: min(440px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 14px 14px 16px; border-radius: 14px; background: var(--night); color: #fff;
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500;
  animation: toastIn .35s cubic-bezier(.2, .9, .3, 1.2);
}
.toast > .bi { font-size: 18px; line-height: 1.2; }
.toast > span { flex: 1; }
.toast-success > .bi { color: #34D399; }
.toast-error > .bi { color: #F87171; }
.toast-info > .bi { color: #60A5FA; }
.toast-x { background: none; border: 0; color: rgba(255,255,255,.6); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
.toast.is-leaving { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ── Dialogs (native <dialog>) ────────────────────────────────────────── */
dialog.sheet {
  border: 0; padding: 0; margin: auto; width: min(560px, 100%); max-height: min(92vh, 900px);
  border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
  overflow: auto;
}
dialog.sheet-lg { width: min(760px, 100%); }
dialog.sheet::backdrop { background: rgba(9, 12, 18, .55); backdrop-filter: blur(4px); }
dialog.sheet[open] { animation: sheetIn .3s cubic-bezier(.2, .9, .3, 1); }
@keyframes sheetIn { from { opacity: 0; transform: translateY(24px); } }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 14px; background: var(--surface); }
.sheet-head h3 { font-size: 19px; }
.sheet-body { padding: 4px 22px 22px; }
.sheet-foot { position: sticky; bottom: 0; padding: 14px 22px calc(18px + var(--safe-bottom)); background: var(--surface); border-top: 1px solid var(--line-2); display: flex; gap: 10px; }
@media (max-width: 640px) {
  dialog.sheet { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 24px 24px 0 0; max-height: 94vh; }
  dialog.sheet[open] { animation: sheetUp .32s cubic-bezier(.2, .9, .3, 1); }
  .sheet-head::before { content: ''; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line); }
}
@keyframes sheetUp { from { transform: translateY(100%); } }

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a { position: relative; flex: none; display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px; border: 0; background: none; font: 600 14px var(--font); color: var(--muted); cursor: pointer; }
.tabs .count { font-size: 12px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.tabs .is-active { color: var(--ink); }
.tabs .is-active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }
[data-panel]:not(.is-active) { display: none; }

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .t-strong { font-weight: 600; }
.table .t-sub { font-size: 12.5px; color: var(--muted); }
@media (max-width: 760px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
  .table-cards td { padding: 4px 0; border: 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table-cards td::before { content: attr(data-label); font-size: 12px; color: var(--muted); font-weight: 600; text-align: left; }
  .table-cards td[data-label=""]::before { display: none; }
  .table-cards td.td-main { display: block; text-align: left; padding-bottom: 6px; }
  .table-cards td.td-main::before { display: none; }
}

/* ── Media: crests, avatars ───────────────────────────────────────────── */
.crest, .avatar { flex: none; display: inline-grid; place-items: center; overflow: hidden; background: var(--surface-2); color: #fff; font-family: var(--display); font-weight: 800; }
.crest { border-radius: 30%; }
.crest img, .avatar img { width: 100%; height: 100%; object-fit: cover; }
.crest-mono, .avatar-mono { background: linear-gradient(140deg, hsl(var(--h) 62% 46%), hsl(calc(var(--h) + 40) 70% 30%)); }
.crest-sm, .avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.crest-md, .avatar-md { width: 44px; height: 44px; font-size: 15px; }
.crest-lg, .avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.crest-xl, .avatar-xl { width: 88px; height: 88px; font-size: 30px; }
.avatar { border-radius: 50%; }

/* ── Stats ────────────────────────────────────────────────────────────── */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.stat { padding: 18px 20px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); }
.stat-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-label .bi { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); color: var(--ink-2); font-size: 14px; }
.stat-value { font-family: var(--display); font-size: 26px; font-weight: 700; margin-top: 10px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 14px; font-weight: 600; color: var(--muted); }
.stat-foot { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.stat-dark { background: linear-gradient(150deg, var(--night-2), var(--night)); color: #fff; border: 0; }
.stat-dark .stat-label, .stat-dark .stat-foot { color: rgba(255,255,255,.65); }
.stat-dark .stat-label .bi { background: rgba(255,255,255,.08); color: #fff; }
.stat-brand { background: linear-gradient(150deg, var(--brand), var(--brand-700)); color: #fff; border: 0; }
.stat-brand .stat-label, .stat-brand .stat-foot { color: rgba(255,255,255,.75); }
.stat-brand .stat-label .bi { background: rgba(255,255,255,.14); color: #fff; }

/* ── Empty states ─────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 40px 20px; }
.empty-icon { width: 64px; height: 64px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 20px; background: var(--surface-2); color: var(--faint); font-size: 28px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 340px; margin: 0 auto; }

/* ==========================================================================
   Public app
   ========================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  padding-top: var(--safe-top);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line-2);
}
.topbar-in { height: var(--topbar-h); display: flex; align-items: center; gap: 16px; }
.topbar-dark { background: rgba(9, 12, 18, .72); border-color: rgba(255,255,255,.06); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.brand b { color: var(--brand); font-weight: 800; }
.nav { display: none; gap: 4px; margin-left: 12px; }
.nav a { height: 38px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a.is-active { color: var(--ink); background: var(--surface-2); }
.topbar-dark .nav a { color: rgba(255,255,255,.7); }
.topbar-dark .nav a:hover, .topbar-dark .nav a.is-active { color: #fff; background: rgba(255,255,255,.08); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.wallet-pill { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px 0 6px; border-radius: 99px; background: var(--surface-2); font-weight: 700; font-size: 13.5px; border: 1px solid var(--line-2); }
.wallet-pill i { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: #fff; font-size: 13px; }
@media (min-width: 900px) { .nav { display: flex; } }

.page { padding: 24px 0 120px; min-height: 60vh; }
@media (min-width: 900px) { .page { padding: 36px 0 80px; } }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: clamp(26px, 4vw, 34px); }
.page-head p { color: var(--muted); margin-top: 6px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.back:hover { color: var(--ink); }

/* Bottom navigation (mobile app feel) */
.tabbar {
  position: fixed; z-index: 60; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + var(--safe-bottom));
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--line-2);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--faint); border-radius: 12px; }
.tabbar a .bi { font-size: 21px; line-height: 1; }
.tabbar a.is-active { color: var(--brand); }
.tabbar .tabbar-cta { position: relative; top: -16px; }
.tabbar .tabbar-cta span { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px; background: var(--brand); color: #fff; box-shadow: 0 10px 24px -6px var(--brand-glow); }
.tabbar .tabbar-cta .bi { font-size: 24px; }
@media (min-width: 900px) { .tabbar { display: none; } }

/* Hero */
.hero { position: relative; overflow: hidden; color: #fff; background: var(--night); margin-top: calc(-1 * (var(--topbar-h) + var(--safe-top))); padding: calc(var(--topbar-h) + var(--safe-top) + 40px) 0 56px; isolation: isolate; }
.hero-bg { position: absolute; inset: 0; z-index: -2; background-size: cover; background-position: center 30%; opacity: .45; transform: scale(1.03); }
.hero::before { content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(211, 18, 27, .55), transparent 60%),
    radial-gradient(600px 400px at -10% 110%, rgba(211, 18, 27, .25), transparent 60%),
    linear-gradient(180deg, rgba(9,12,18,.35) 0%, rgba(9,12,18,.85) 70%, var(--night) 100%);
}
.hero-grid { display: grid; gap: 32px; align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1.1fr .9fr; } .hero { padding-bottom: 80px; } }
.hero h1 { font-size: clamp(34px, 7vw, 60px); line-height: 1.02; letter-spacing: -.035em; }
.hero h1 em { font-style: normal; color: transparent; background: linear-gradient(90deg, #fff, #ffb4b8 60%, var(--brand)); -webkit-background-clip: text; background-clip: text; }
.hero-lead { font-size: 17px; color: rgba(255,255,255,.75); max-width: 520px; margin-top: 16px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero-stats { display: flex; gap: 28px; margin-top: 36px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.1); }
.hero-stats b { display: block; font-family: var(--display); font-size: 24px; }
.hero-stats span { font-size: 13px; color: rgba(255,255,255,.6); }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px 0 6px; border-radius: 99px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); font-size: 13px; font-weight: 600; margin-bottom: 18px; }
.pill b { height: 22px; padding: 0 8px; border-radius: 99px; background: var(--brand); display: inline-flex; align-items: center; font-size: 11px; letter-spacing: .04em; }

/* Match card */
.match {
  position: relative; overflow: hidden; display: block;
  padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-2);
  transition: transform .18s ease, box-shadow .18s ease;
}
.match:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.match-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.match-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 18px 0; }
.match-team { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-weight: 700; font-size: 14px; line-height: 1.2; }
.match-mid { text-align: center; }
.match-mid b { display: block; font-family: var(--display); font-size: 22px; letter-spacing: -.02em; }
.match-mid small { color: var(--muted); font-weight: 600; }
.match-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; border-top: 1px dashed var(--line); }
.match-price small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.match-price b { font-family: var(--display); font-size: 17px; }
.match-dark { background: linear-gradient(160deg, var(--night-2), var(--night)); color: #fff; border-color: rgba(255,255,255,.06); }
.match-dark .match-top, .match-dark .match-mid small, .match-dark .match-price small { color: rgba(255,255,255,.6); }
.match-dark .match-foot { border-color: rgba(255,255,255,.12); }
.hero .match { box-shadow: var(--shadow-lg); }

/* Ticket (the product) */
.ticket { position: relative; display: flex; border-radius: 22px; overflow: hidden; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s; }
a.ticket:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.ticket-main { flex: 1; min-width: 0; padding: 18px 18px 18px 20px; }
.ticket-stub {
  position: relative; flex: none; width: 112px; display: grid; place-items: center; padding: 14px;
  background: var(--night); color: #fff;
  border-left: 2px dashed rgba(255,255,255,.25);
}
.ticket-stub::before, .ticket-stub::after { content: ''; position: absolute; left: -12px; width: 22px; height: 22px; border-radius: 50%; background: var(--bg); }
.ticket-stub::before { top: -11px; } .ticket-stub::after { bottom: -11px; }
.ticket-stub .qr-mini { width: 76px; height: 76px; padding: 5px; border-radius: 10px; background: #fff; }
.ticket-stub .qr-mini canvas, .ticket-stub .qr-mini img { width: 100% !important; height: 100% !important; }
.ticket-league { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.ticket-title { font-family: var(--display); font-weight: 700; font-size: 17px; margin-top: 6px; line-height: 1.25; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.ticket-meta span { display: inline-flex; align-items: center; gap: 5px; }
.ticket-num { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .08em; }
.ticket.is-vip .ticket-stub { background: linear-gradient(160deg, #2A2112, #120E07); }
.ticket.is-vip .ticket-league { color: var(--gold); }
.ticket.is-used { opacity: .62; }
.ticket.is-used .ticket-stub { background: var(--night-3); }

/* Full ticket page */
.eticket { max-width: 420px; margin: 0 auto; border-radius: 28px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-lg); }
.eticket-head { position: relative; padding: 26px 24px 30px; color: #fff; background: radial-gradient(500px 200px at 100% 0%, rgba(211, 18, 27, .7), transparent 70%), linear-gradient(160deg, var(--night-2), var(--night)); }
.eticket.is-vip .eticket-head { background: radial-gradient(500px 200px at 100% 0%, rgba(230, 174, 62, .55), transparent 70%), linear-gradient(160deg, #2A2112, #0E0B06); }
.eticket-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-top: 22px; text-align: center; }
.eticket-vs .match-team { color: #fff; }
.eticket-cut { position: relative; height: 0; border-top: 2px dashed var(--line); margin: 0 18px; }
.eticket-cut::before, .eticket-cut::after { content: ''; position: absolute; top: -14px; width: 28px; height: 28px; border-radius: 50%; background: var(--bg); }
.eticket-cut::before { left: -32px; } .eticket-cut::after { right: -32px; }
.eticket-body { padding: 22px 24px 26px; }
.eticket-qr { width: 220px; height: 220px; margin: 0 auto; padding: 12px; background: #fff; border-radius: 18px; border: 1px solid var(--line-2); }
.eticket-qr canvas, .eticket-qr img { width: 100% !important; height: 100% !important; }
.eticket-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin-top: 22px; }
.eticket-grid dt { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.eticket-grid dd { margin: 2px 0 0; font-weight: 700; }
.eticket-state { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.88); border-radius: 18px; font-family: var(--display); font-weight: 800; font-size: 22px; color: var(--muted); transform: rotate(-8deg); }
.brightness-note { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 12px; }

/* Wallet card */
.wallet-card {
  position: relative; overflow: hidden; padding: 22px; border-radius: var(--radius-lg); color: #fff;
  background:
    radial-gradient(420px 220px at 110% -20%, rgba(211, 18, 27, .75), transparent 60%),
    radial-gradient(300px 200px at -20% 120%, rgba(211, 18, 27, .35), transparent 60%),
    linear-gradient(150deg, var(--night-2), var(--night));
  box-shadow: var(--shadow-lg);
}
.wallet-card::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-radial-gradient(circle at 105% 120%, rgba(255,255,255,.06) 0 1px, transparent 1px 26px); }
.wallet-card > * { position: relative; z-index: 1; }
.wallet-card .label { color: rgba(255,255,255,.65); font-weight: 600; font-size: 13px; }
.wallet-amount { font-family: var(--display); font-weight: 800; font-size: clamp(30px, 6vw, 40px); letter-spacing: -.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.wallet-amount small { font-size: 16px; color: rgba(255,255,255,.6); font-weight: 600; }
.wallet-actions { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }

/* Quick actions */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-2); font-size: 12.5px; font-weight: 600; text-align: center; transition: transform .15s; }
.quick a:hover { transform: translateY(-2px); }
.quick a i { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; font-size: 19px; background: var(--brand-50); color: var(--brand); }

/* Lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: 0; }
.list-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: 17px; }
.list-icon.in { background: var(--success-50); color: var(--success); }
.list-icon.out { background: var(--brand-50); color: var(--brand); }
.amount-in { color: var(--success); font-weight: 700; }
.amount-out { font-weight: 700; }

/* Checkout */
.checkout { display: grid; gap: 20px; align-items: start; }
@media (min-width: 960px) { .checkout { grid-template-columns: 1fr 380px; } .checkout-aside { position: sticky; top: calc(var(--topbar-h) + 20px); } }
.step { display: flex; gap: 14px; }
.step-n { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: var(--night); color: #fff; font: 700 14px var(--display); }
.step-body { flex: 1; min-width: 0; }
.step-body > h3 { margin: 4px 0 14px; }
.summary-line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 14px; }
.summary-line.total { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 14px; font-size: 16px; font-weight: 700; }
.summary-line.total b { font-family: var(--display); font-size: 24px; }
.mobile-paybar { position: fixed; z-index: 55; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + var(--safe-bottom)); background: var(--surface); border-top: 1px solid var(--line-2); box-shadow: 0 -10px 30px -10px rgba(0,0,0,.15); display: flex; align-items: center; gap: 12px; }
.mobile-paybar .total small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.mobile-paybar .total b { font-family: var(--display); font-size: 20px; }
@media (min-width: 960px) { .mobile-paybar { display: none; } }
body.has-paybar .tabbar { display: none; }

/* Payment waiting */
.paywait { max-width: 440px; margin: 0 auto; text-align: center; }
.paywait-ring { position: relative; width: 132px; height: 132px; margin: 8px auto 26px; display: grid; place-items: center; }
.paywait-ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 4px solid var(--line-2); border-top-color: var(--brand); animation: spin 1.1s linear infinite; }
.paywait-ring i { width: 92px; height: 92px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-50); color: var(--brand); font-size: 38px; }
.paywait.is-success .paywait-ring::before { animation: none; border-color: var(--success); }
.paywait.is-success .paywait-ring i { background: var(--success-50); color: var(--success); animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.paywait.is-failed .paywait-ring::before { animation: none; border-color: var(--danger); }
.paywait.is-failed .paywait-ring i { background: var(--danger-50); color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(.5); } }
.paywait-steps { text-align: left; margin-top: 24px; }
.paywait-steps li { display: flex; gap: 12px; padding: 10px 0; color: var(--ink-2); font-size: 14px; }
.paywait-steps li b { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-size: 12px; }

/* Voting */
.leader { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 10px; margin-bottom: 24px; }
.leader-card { text-align: center; padding: 18px 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-2); }
.leader-card.first { padding-top: 26px; background: linear-gradient(170deg, var(--gold-50), var(--surface) 70%); border-color: color-mix(in srgb, var(--gold) 35%, transparent); }
.leader-rank { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font: 800 12px var(--display); background: var(--night); color: #fff; margin-bottom: 10px; }
.leader-card.first .leader-rank { background: var(--gold); color: #3A2A06; }
.leader-card .avatar { margin: 0 auto 10px; }
.leader-name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.leader-votes { font-family: var(--display); font-weight: 800; font-size: 20px; margin-top: 6px; }
.candidate { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-2); }
.candidate-rank { width: 26px; text-align: center; font: 800 14px var(--display); color: var(--faint); }
.candidate-bar { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.candidate-bar span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand), #FF5A60); }

/* Footer */
.footer { padding: 40px 0 120px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 14px; }
@media (min-width: 900px) { .footer { padding-bottom: 40px; } }
.footer-grid { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; }
.footer a:hover { color: var(--ink); }

/* Auth */
.auth { min-height: 100vh; display: grid; }
@media (min-width: 960px) { .auth { grid-template-columns: 1fr 1fr; } }
.auth-side { position: relative; display: none; overflow: hidden; color: #fff; background: var(--night); padding: 48px; isolation: isolate; }
.auth-side::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(700px 400px at 100% 0%, rgba(211, 18, 27, .6), transparent 60%), linear-gradient(180deg, rgba(9,12,18,.3), rgba(9,12,18,.95)); }
.auth-side img.bg { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; opacity: .5; }
@media (min-width: 960px) { .auth-side { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-main { display: flex; flex-direction: column; justify-content: center; padding: calc(32px + var(--safe-top)) 20px 40px; }
.auth-card { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-card h1 { font-size: 30px; margin-top: 28px; }
.auth-card .lead { color: var(--muted); margin: 8px 0 28px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 13px; margin: 20px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.pw-toggle { position: absolute; right: 6px; height: 36px; width: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 10px; }

/* Install banner (browsers only) */
.install { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 18px; background: var(--night); color: #fff; }
.install img { width: 46px; height: 46px; border-radius: 12px; }
.install p { color: rgba(255,255,255,.65); font-size: 13px; }
body.is-webview .install, body.is-webview .web-only { display: none !important; }
body.is-webview { --safe-top: 34px; }

/* ==========================================================================
   Gate (guichet) — dark, glanceable, big touch targets
   ========================================================================== */
body.gate { background: var(--night); color: #fff; --surface: #121823; --surface-2: #1A2230; --line: #263043; --line-2: #1E2736; --ink: #F3F4F6; --ink-2: #CBD2DC; --muted: #93A0B4; --faint: #64748B; --brand-50: rgba(211, 18, 27, .18); color-scheme: dark; }
.gate-bar { position: sticky; top: 0; z-index: 40; padding-top: var(--safe-top); background: rgba(9,12,18,.85); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(255,255,255,.06); }
.gate-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px; border-radius: 16px; background: #121823; }
.gate-switch a { height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; font-weight: 700; color: var(--muted); }
.gate-switch a.is-active { background: var(--brand); color: #fff; }
.gate-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gate-kpis div { padding: 12px; border-radius: 14px; background: #121823; }
.gate-kpis b { display: block; font-family: var(--display); font-size: 20px; }
.gate-kpis span { font-size: 11.5px; color: var(--muted); font-weight: 600; }

.scanner { position: relative; aspect-ratio: 1; max-height: 62vh; margin: 0 auto; border-radius: 28px; overflow: hidden; background: #000; }
.scanner #reader { width: 100%; height: 100%; }
.scanner #reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
.scanner-frame { position: absolute; inset: 14%; pointer-events: none; border-radius: 24px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); }
.scanner-frame::before { content: ''; position: absolute; inset: 0; border-radius: 24px; padding: 3px; background: linear-gradient(var(--brand), var(--brand)) top left / 40px 40px no-repeat, linear-gradient(var(--brand), var(--brand)) top right / 40px 40px no-repeat, linear-gradient(var(--brand), var(--brand)) bottom left / 40px 40px no-repeat, linear-gradient(var(--brand), var(--brand)) bottom right / 40px 40px no-repeat; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.scanner-line { position: absolute; left: 16%; right: 16%; height: 2px; background: linear-gradient(90deg, transparent, var(--brand), transparent); box-shadow: 0 0 18px var(--brand); animation: scan 2.2s ease-in-out infinite; pointer-events: none; }
@keyframes scan { 0%, 100% { top: 18%; } 50% { top: 80%; } }
.scan-result { position: fixed; z-index: 120; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; color: #fff; animation: fadeIn .2s ease; }
.scan-result.ok { background: radial-gradient(circle at 50% 35%, #10B981, #065F46); }
.scan-result.used { background: radial-gradient(circle at 50% 35%, #F59E0B, #92400E); }
.scan-result.invalid { background: radial-gradient(circle at 50% 35%, #EF4444, #7F1D1D); }
.scan-result .big { font-size: 96px; line-height: 1; animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }
.scan-result h2 { font-size: 34px; font-weight: 800; }
.scan-result dl { display: grid; grid-template-columns: auto auto; gap: 6px 14px; margin: 14px 0 0; text-align: left; font-size: 15px; background: rgba(0,0,0,.18); padding: 14px 18px; border-radius: 16px; }
.scan-result dt { opacity: .75; } .scan-result dd { margin: 0; font-weight: 700; }
@keyframes fadeIn { from { opacity: 0; } }

/* ==========================================================================
   Back-office
   ========================================================================== */
body.admin { background: var(--bg); }
.shell { display: grid; min-height: 100vh; }
@media (min-width: 1080px) { .shell { grid-template-columns: 264px 1fr; } }
.sidebar {
  position: fixed; z-index: 90; inset: 0 auto 0 0; width: 280px; transform: translateX(-100%); transition: transform .25s ease;
  display: flex; flex-direction: column; background: var(--night); color: #fff; padding: calc(18px + var(--safe-top)) 14px 18px;
}
.sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
@media (min-width: 1080px) { .sidebar { position: sticky; top: 0; height: 100vh; width: auto; transform: none; } }
.sidebar .brand { padding: 4px 8px 18px; color: #fff; }
.sidebar-role { margin: 0 8px 14px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.05); font-size: 12.5px; color: rgba(255,255,255,.6); }
.sidebar-role b { display: block; color: #fff; font-size: 14px; }
.side-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; scrollbar-width: none; }
.side-nav .group { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.35); padding: 16px 12px 6px; }
.side-nav a { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px; font-size: 14px; font-weight: 500; color: rgba(255,255,255,.7); }
.side-nav a .bi { font-size: 16px; width: 18px; }
.side-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.side-nav a.is-active { background: rgba(211, 18, 27, .16); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.side-nav a .count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; }
.sidebar-foot { padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(9,12,18,.5); display: none; }
.scrim.is-open { display: block; }
.main { min-width: 0; display: flex; flex-direction: column; }
.main-top { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; height: 64px; padding: var(--safe-top) 16px 0; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-2); }
@media (min-width: 1080px) { .main-top { padding: 0 32px; } .menu-btn { display: none; } }
.main-top h2 { font-size: 18px; }
.main-content { padding: 24px 16px 60px; max-width: 1400px; width: 100%; }
@media (min-width: 1080px) { .main-content { padding: 32px; } }
.page-title { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-title h1 { font-size: clamp(24px, 3vw, 30px); }
.page-title p { color: var(--muted); margin-top: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filters .input { height: 40px; width: auto; min-width: 150px; font-size: 14px; }
.filters .input-group input { height: 40px; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.inline { display: inline; }

/* Bar chart (pure CSS) — stacked: online (brand) on top of gate (gold), validated palette */
:root { --chart-online: #D3121B; --chart-gate: #C68A1E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --chart-gate: #B87A14; } }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding-top: 10px; border-bottom: 1px solid var(--line); }
.bars .bar { position: relative; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; cursor: default; }
.bars .bar::before { content: ''; position: absolute; inset: 0 -3px; }
.bars .bar span { display: block; }
.bars .bar span:first-child { border-radius: 4px 4px 0 0; }
.bars .bar span + span { margin-top: 2px; }
.bars .bar .seg-online { background: var(--chart-online); }
.bars .bar .seg-gate { background: var(--chart-gate); }
.bars .bar:hover span { filter: brightness(1.1); }
.bars .bar:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: pre; padding: 7px 10px; border-radius: 8px; background: var(--night); color: #fff; font-size: 12px; font-weight: 600; line-height: 1.4; pointer-events: none; z-index: 3; box-shadow: var(--shadow); }
.bars-x { display: flex; gap: 6px; margin-top: 8px; }
.bars-x span { flex: 1; text-align: center; font-size: 11px; color: var(--faint); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .l-online { background: var(--chart-online); } .legend .l-gate { background: var(--chart-gate); }
.progress { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 8px; background: var(--brand); }

/* Login (admin) */
.admin-login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(900px 500px at 100% 0%, rgba(211, 18, 27, .35), transparent 60%), var(--night); }
.admin-login .card { width: 100%; max-width: 420px; padding: 32px; }

/* Print */
@media print {
  .topbar, .tabbar, .footer, .no-print, .toasts { display: none !important; }
  body { background: #fff; }
  .eticket { box-shadow: none; border: 1px solid #ddd; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin .7s linear infinite; }
.dash-grid { display: grid; gap: 20px; align-items: start; }
@media (min-width: 960px) { .dash-grid { grid-template-columns: 360px minmax(0, 1fr); } }
.grid-fit { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.hero-grid > * { min-width: 0; }
.pill { max-width: 100%; height: auto; min-height: 32px; padding: 4px 14px 4px 5px; white-space: normal; line-height: 1.3; }
@media (max-width: 520px) { .hide-xs { display: none !important; } }
.sidebar-foot.side-nav { flex: none; overflow: visible; }
