/* ── Brand tokens ────────────────────────────────────────────────────────────── */
:root {
  --primary:      #0f0f0f;
  --primary-soft: #1c1c1e;
  --accent:       #c8a96e;        /* gold */
  --accent-dark:  #a8893e;
  --success:      #34d399;
  --warning:      #fbbf24;
  --error:        #f87171;
  --bg:           #f5f5f7;
  --surface:      #ffffff;
  --border:       #e5e5ea;
  --text:         #1c1c1e;
  --muted:        #8e8e93;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --radius:       10px;
  --radius-lg:    16px;
  --radius-xl:    24px;
  --shadow-sm:    0 1px 4px rgba(0,0,0,0.06);
  --shadow:       0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:    0 12px 40px rgba(0,0,0,0.14);
}

/* ── Reset ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ──────────────────────────────────────────────────────────────────── */
.page      { min-height: 100dvh; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* ── Header ──────────────────────────────────────────────────────────────────── */
.app-header {
  background: var(--primary);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.header-inner {
  display: flex;
  align-items: center;
  height: 60px;
  gap: 16px;
}
.brand { display: flex; flex-direction: column; gap: 1px; }
.brand-name { color: #fff; font-size: 15px; font-weight: 700; letter-spacing: 0.2px; line-height: 1; }
.brand-sub  { color: var(--accent); font-size: 10px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; }
.logo-img   { height: 32px; border-radius: 6px; }

.header-nav { margin-left: auto; display: flex; gap: 4px; }
.header-nav a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.15s;
}
.header-nav a:hover  { color: #fff; background: rgba(255,255,255,0.08); }
.header-nav a.active { color: #fff; background: rgba(200,169,110,0.18); }

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* ── Stat tiles ──────────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-tile::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-tile.t-total::before   { background: var(--primary); }
.stat-tile.t-in::before      { background: var(--success); }
.stat-tile.t-remain::before  { background: var(--accent); }

.stat-num { font-size: 38px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.stat-lbl { font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.8px; }
.t-total  .stat-num { color: var(--primary); }
.t-in     .stat-num { color: #059669; }
.t-remain .stat-num { color: var(--accent-dark); }

/* ── Progress bar ────────────────────────────────────────────────────────────── */
.progress-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.progress-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.progress-label  { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.7px; }
.progress-pct    { font-size: 22px; font-weight: 800; color: var(--primary); }
.progress-bar    { height: 8px; background: #e5e5ea; border-radius: 99px; overflow: hidden; }
.progress-fill   { height: 100%; background: linear-gradient(90deg, #059669, #34d399); border-radius: 99px; transition: width 0.6s cubic-bezier(0.4,0,0.2,1); }

/* ── Toolbar ─────────────────────────────────────────────────────────────────── */
.toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.toolbar-left  { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1; }
.toolbar-right { display: flex; gap: 8px; align-items: center; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:active    { transform: scale(0.97); }
.btn:disabled  { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-dark    { background: var(--primary); color: #fff; }
.btn-dark:hover:not(:disabled) { background: #2c2c2e; }

.btn-gold    { background: var(--accent); color: var(--primary); }
.btn-gold:hover:not(:disabled) { background: var(--accent-dark); color: #fff; }

.btn-outline { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); background: var(--bg); }

.btn-ghost   { background: transparent; color: var(--muted); border: 1.5px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-full { width: 100%; }

/* ── Search ──────────────────────────────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-wrap input {
  width: 220px;
  padding: 8px 14px 8px 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s, width 0.2s;
  color: var(--text);
}
.search-wrap input:focus { border-color: var(--primary); background: #fff; width: 260px; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

/* ── Badges ──────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-pending { background: #f3f4f6; color: #6b7280; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-noid    { background: #fee2e2; color: #991b1b; }
.badge-rsvp-yes { background: #dbeafe; color: #1e40af; }
.badge-rsvp-no  { background: #f3f4f6; color: #6b7280; }

/* ── Table ───────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: var(--primary); }
thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  white-space: nowrap;
}
thead th:first-child { border-radius: var(--radius-lg) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-lg) 0 0; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:last-child  { border-bottom: none; }
tbody tr:hover       { background: #fafafa; }
tbody td { padding: 11px 16px; vertical-align: middle; }

/* ── QR modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 32px;
  text-align: center;
  width: 320px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes slideUp { from { opacity:0; transform:translateY(20px) scale(0.95); } to { opacity:1; transform:none; } }
.modal h3    { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.modal .sub  { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.modal img   { width: 220px; height: 220px; border-radius: var(--radius); border: 1px solid var(--border); }
.modal-close { margin-top: 20px; }

/* ── Toast ───────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: 72px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  max-width: 300px;
  animation: toastIn 0.25s ease forwards;
}
.toast-success { background: #059669; color: #fff; }
.toast-error   { background: #dc2626; color: #fff; }
.toast-info    { background: var(--primary); color: #fff; }
@keyframes toastIn  { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:none; } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform:translateX(20px); } }

/* ── Spinner ─────────────────────────────────────────────────────────────────── */
.spinner {
  width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
.spinner-dark {
  border-color: rgba(0,0,0,0.15);
  border-top-color: var(--primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scanner page ────────────────────────────────────────────────────────────── */
.scanner-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--primary);
}
.scanner-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.scanner-header .brand-name { font-size: 16px; }
.live-count {
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 99px;
}
.scanner-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px;
  gap: 16px;
}
#reader {
  width: 100%;
  max-width: 360px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 4px rgba(200,169,110,0.25), var(--shadow-lg);
}
.scan-hint {
  color: rgba(255,255,255,0.45);
  font-size: 13px;
  text-align: center;
}
.result-card {
  width: 100%; max-width: 360px;
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  text-align: center;
  animation: popIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.result-card.r-success { background: #fff; border: 2px solid var(--success); }
.result-card.r-warn    { background: #fff; border: 2px solid var(--warning); }
.result-card.r-error   { background: #fff; border: 2px solid var(--error); }
@keyframes popIn { from { opacity:0; transform:scale(0.88); } to { opacity:1; transform:scale(1); } }
.result-icon { font-size: 56px; line-height: 1; margin-bottom: 12px; }
.result-name { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.result-sub  { font-size: 14px; color: var(--muted); }
.btn-continue {
  width: 100%; max-width: 360px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-lg);
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-continue:hover { background: rgba(255,255,255,0.16); }

/* ── Check-in deep-link ──────────────────────────────────────────────────────── */
.checkin-page {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 20px;
  text-align: center;
  background: var(--bg);
}
.checkin-icon { font-size: 72px; margin-bottom: 16px; line-height: 1; }
.checkin-page h1 { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.checkin-page p  { font-size: 15px; color: var(--muted); max-width: 280px; }

/* ── Home page ───────────────────────────────────────────────────────────────── */
.home-page {
  min-height: 100dvh;
  background: var(--primary);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 20px; text-align: center; gap: 12px;
}
.home-event { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 4px; }
.home-title { color: #fff; font-size: 32px; font-weight: 800; margin-bottom: 8px; }
.home-sub   { color: rgba(255,255,255,0.45); font-size: 15px; margin-bottom: 32px; }
.home-btns  { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 260px; }

/* ── Utilities ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--muted); }
.text-sm    { font-size: 12px; }
.font-bold  { font-weight: 700; }
.mono       { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 11px; }
.flex       { display: flex; }
.items-center { align-items: center; }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stats-row .stat-tile:last-child { grid-column: span 2; }
  .hide-mobile { display: none !important; }
  .search-wrap input { width: 160px; }
  .search-wrap input:focus { width: 180px; }
}
