:root {
  --bg: #0f1220;
  --panel: #171a2b;
  --panel-2: #1e2238;
  --border: #2a2f4a;
  --text: #e6e8f2;
  --muted: #8b91b0;
  --accent: #6a8bff;
  --accent-2: #4fd1a1;
  --danger: #ff6a7c;
  --warn: #ffb86b;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }
.narrow { max-width: 480px; }

header.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--border);
}
header.topbar .brand { font-weight: 700; letter-spacing: 0.4px; }
header.topbar nav a { margin-left: 16px; color: var(--muted); }
header.topbar nav a.active { color: var(--text); }

h1, h2, h3 { margin-top: 0; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
.card h2 { margin-bottom: 12px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input, textarea, select {
  width: 100%; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font: inherit;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
.field { margin-bottom: 12px; }

button, .btn {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 10px 16px; font-weight: 600; cursor: pointer;
}
button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
button.danger { background: var(--danger); }
button.ghost { background: transparent; color: var(--accent); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 500; }
tr:hover { background: rgba(255,255,255,0.02); }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.pill.present { background: rgba(79,209,161,0.15); color: var(--accent-2); }
.pill.absent  { background: rgba(139,145,176,0.15); color: var(--muted); }
.pill.onspot  { background: rgba(255,184,107,0.15); color: var(--warn); }
.pill.pre     { background: rgba(106,139,255,0.15); color: var(--accent); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--panel-2); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat .n { font-size: 32px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; margin-top: 4px; }

.muted { color: var(--muted); }
.mono  { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.right { text-align: right; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* Scan feedback — full-screen overlay so it's always visible on phones */
#result-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(0,0,0,0.75);
  animation: fadeIn 120ms ease;
}
#result-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.scan-result {
  text-align: center; padding: 32px 24px; border-radius: var(--radius);
  background: var(--panel); border: 2px solid var(--border);
  width: min(420px, 100%); max-height: 90vh; overflow-y: auto;
}
.scan-result.ok  { border-color: var(--accent-2); box-shadow: 0 0 40px rgba(79,209,161,0.3); }
.scan-result.bad { border-color: var(--danger);  box-shadow: 0 0 40px rgba(255,106,124,0.3); }
.scan-result .icon { font-size: 80px; line-height: 1; }
.scan-result.ok  .icon { color: var(--accent-2); }
.scan-result.bad .icon { color: var(--danger); }
.scan-result .who { font-size: 22px; font-weight: 700; margin-top: 12px; word-break: break-word; }
.scan-result .dismiss {
  margin-top: 20px; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); padding: 10px 24px; border-radius: 8px; cursor: pointer;
}

/* Search results list */
.search-list { display: flex; flex-direction: column; gap: 8px; }
.search-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; background: var(--panel-2); border-radius: 8px;
}
.search-item .who    { flex: 1; min-width: 0; }
.search-item .who .n { font-weight: 600; }
.search-item .who .p { font-size: 12px; color: var(--muted); font-family: ui-monospace, monospace; }
.search-item button  { flex-shrink: 0; padding: 8px 14px; font-size: 13px; }
.search-empty { color: var(--muted); font-size: 13px; padding: 8px 0; }

#qr-reader { width: 100%; max-width: 480px; margin: 0 auto; }
#qr-reader video { border-radius: var(--radius); }

.toast {
  position: fixed; bottom: 20px; right: 20px; padding: 12px 16px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); z-index: 1000; max-width: 380px;
}
.toast.err { border-color: var(--danger); }

/* Progress bar */
.progress-bar { width: 100%; height: 14px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%); width: 0%; transition: width 400ms ease; }

/* Event status pill on dashboard */
.status-pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; }
.status-pill.upcoming { background: rgba(106,139,255,0.15); color: var(--accent); }
.status-pill.live     { background: rgba(79,209,161,0.15); color: var(--accent-2); animation: pulse 2s infinite; }
.status-pill.ended    { background: rgba(139,145,176,0.15); color: var(--muted); }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.5 } }

/* Hero header (registrant page) */
.hero {
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px 24px; margin-bottom: 16px;
}
.hero h1 { font-size: 28px; margin: 0 0 8px 0; }
.hero .meta { color: var(--muted); font-size: 14px; margin: 4px 0; }
.hero .meta strong { color: var(--text); }

/* Big success block */
.success-block { text-align: center; padding: 32px; }
.success-block .check { font-size: 64px; line-height: 1; color: var(--accent-2); }
.success-block h2 { margin: 16px 0 8px 0; }
.success-block .rid { display: inline-block; margin-top: 12px; padding: 6px 14px; border-radius: 999px;
  background: var(--panel-2); font-family: ui-monospace, monospace; font-size: 13px; }

/* QR grid printout */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.qr-cell { background: #fff; padding: 12px; text-align: center; border-radius: 8px; color: #000; }
.qr-cell img { width: 100%; height: auto; }
.qr-cell .name { margin-top: 8px; font-weight: 600; font-size: 14px; }

@media print {
  header, .no-print, button { display: none !important; }
  body { background: white; color: black; }
  .qr-grid { grid-template-columns: repeat(3, 1fr); }
  .qr-cell { border: 1px solid #ccc; }
}
