/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --brand: #2563eb;
  --brand-dark: #1e40af;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --tab-h: 68px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 17px;
  --text-xl: 21px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.12);

  --focus-ring: 0 0 0 3px rgba(37,99,235,.15);

  --accent: #f59e0b;
  --accent-dark: #ea580c;
}

/* ── Reset / base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
p { margin: 8px 0; line-height: 1.5; }
h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 600; margin: 20px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: 12px; }

/* ── Top bar ───────────────────────────────────────────────── */
.topbar {
  background: var(--brand);
  color: white;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.topbar .brand {
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.01em;
}

/* ── Main content area ────────────────────────────────────── */
main { padding: 16px; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  display: block;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  border-left: 4px solid var(--brand);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s;
}
a.card:hover, a.card:active { box-shadow: var(--shadow-md); transform: translateY(-1px); }

/* Data-entry variant: no accent bar, roomier padding — for CRUD edit forms */
.card-form {
  border-left: none;
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.section-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  margin: var(--space-5) 0 var(--space-2);
  text-transform: none;
  letter-spacing: normal;
}
.card strong { display: block; margin-bottom: 4px; font-size: 15px; }
.card span, .card-meta { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.card p { margin: 6px 0 0; font-size: 14px; color: #334155; }

/* ── Tab bar ───────────────────────────────────────────────── */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
  box-shadow: 0 -1px 6px rgba(0,0,0,.06);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 0;
  text-decoration: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  transition: color .1s;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--brand); }
.tab.active svg { color: var(--brand); }

/* ── Gate / login screen ──────────────────────────────────── */
.gate-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px 16px;
}
.gate-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: 20px;
  padding: 32px 28px 28px;
  box-shadow: 0 4px 24px rgba(0,0,0,.10);
  text-align: center;
}
.gate-card-wide { max-width: 520px; }
.gate-back-link {
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 12px;
}
.gate-back-link:hover { color: var(--brand); text-decoration: underline; }
.form-section-title {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  text-align: left;
  margin: 24px 0 4px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.form-section-title:first-of-type { margin-top: 12px; padding-top: 0; border-top: none; }
.gate-logo {
  max-width: 200px;
  width: 70%;
  height: auto;
  margin-bottom: 16px;
  border-radius: 8px;
}
.gate-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text);
}
.gate-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 20px;
}
.gate-instructions {
  font-size: 14px;
  color: #475569;
  margin: 0 0 16px;
  line-height: 1.5;
}
.field-error {
  color: #dc2626;
  font-size: 13px;
  margin: -6px 0 8px;
}
.gate-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 12px;
}
.gate-form input[type=text] {
  width: 100%;
  padding: 14px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .15em;
  text-align: center;
  text-transform: uppercase;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 12px;
  outline: none;
  transition: border-color .15s;
}
.gate-form input[type=text]:focus { border-color: var(--brand); }
.gate-form button {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
}
.gate-form button:active { background: var(--brand-dark); }

.gate-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 18px;
  padding: 18px;
  font-size: 17px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border: none;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(234,88,12,.35);
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  animation: gate-cta-pulse 2.4s ease-in-out infinite;
}
.gate-cta svg { width: 22px; height: 22px; flex-shrink: 0; }
.gate-cta:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(234,88,12,.45); }
.gate-cta:active { transform: translateY(0); box-shadow: 0 4px 14px rgba(234,88,12,.35); }
@keyframes gate-cta-pulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(234,88,12,.35); }
  50% { box-shadow: 0 6px 26px rgba(234,88,12,.55); }
}

.gate-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.gate-links a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}
.gate-links a:hover { color: var(--brand); text-decoration: underline; }

/* ── Push notification banner ─────────────────────────────── */
.push-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.push-banner div { flex: 1; }
.push-banner strong { display: block; font-size: 14px; }
.push-banner span { font-size: 13px; color: var(--muted); }
.push-banner button {
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.sms-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.sms-form input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
  font-size: 13px;
}
.sms-form button {
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.sms-status {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Session detail ───────────────────────────────────────── */
.session-header { margin-bottom: 16px; }
.session-meta { font-size: 14px; color: var(--muted); margin: 4px 0; }
.session-body { font-size: 15px; line-height: 1.65; background: var(--surface); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.ce-hours { display: inline-block; background: #dcfce7; color: #166534; border-radius: 6px; padding: 2px 10px; font-size: 13px; font-weight: 600; }
.presenter-photo { width: 96px; height: 96px; object-fit: cover; border-radius: 50%; margin: 8px 0; }

.track-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: white;
  margin-bottom: 8px;
  letter-spacing: .03em;
}

.review-section { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.review-section h2 { margin-top: 0; }
.already-reviewed { font-size: 13px; color: var(--muted); margin-bottom: 12px; }

.star-select { display: flex; gap: 8px; margin: 8px 0 16px; flex-wrap: wrap; }
.star-label input[type=radio] { display: none; }
.star-label span {
  display: inline-block;
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all .1s;
}
.star-label input[type=radio]:checked + span {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

/* ── General form elements ────────────────────────────────── */
label { display: block; font-size: 14px; font-weight: 500; margin-top: 12px; color: #334155; }
form select, form textarea {
  width: 100%;
  padding: 10px 12px;
  margin-top: 6px;
  font-size: 15px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
form select:focus, form textarea:focus { border-color: var(--brand); box-shadow: var(--focus-ring); }
form input[type=text], form input[type=email], form input[type=tel], form input[type=password] {
  width: 100%;
  padding: 10px 12px;
  margin-top: 6px;
  font-size: 15px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
form input[type=text]:focus, form input[type=email]:focus,
form input[type=tel]:focus, form input[type=password]:focus { border-color: var(--brand); box-shadow: var(--focus-ring); }
form button {
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  font-size: 16px;
  font-weight: 600;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

/* ── Schedule speaker label ───────────────────────────────── */
.speaker { font-size: 13px; color: #475569; font-style: italic; }

/* ── Schedule time blocks ──────────────────────────────────── */
.time-head {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 4px;
  margin: 18px 0 8px;
  border-bottom: 2px solid var(--brand);
}
.session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 4px;
}
.session-grid .card { margin-bottom: 0; }
.pause-row {
  text-align: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  padding: 10px 0;
  margin: 4px 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
}
.pause-row-lunch {
  color: var(--brand-dark);
  font-weight: 700;
  border-color: var(--brand);
}

/* ── Vendors page ─────────────────────────────────────────── */
.vendor-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border-left-color: #7c3aed;
}
.vendor-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--bg);
  padding: 4px;
  flex-shrink: 0;
}
.vendor-info { flex: 1; min-width: 0; }
.vendor-name { display: block; font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.vendor-desc { font-size: 14px; color: #334155; margin: 4px 0; line-height: 1.5; }
.vendor-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
}
.vendor-link:hover { text-decoration: underline; }

/* ── Presenters page ───────────────────────────────────────── */
.presenter-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border-left-color: #0891b2;
}
.presenter-card .presenter-photo { width: 72px; height: 72px; margin: 0; flex-shrink: 0; }
.presenter-info { flex: 1; min-width: 0; }
.presenter-name { display: block; font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.presenter-bio { font-size: 14px; color: #334155; margin: 4px 0; line-height: 1.5; }

/* ── Messages ──────────────────────────────────────────────── */
.messages { list-style: none; padding: 0; margin: 0 0 12px; }
.message {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}
.message-success { background: #dcfce7; border-color: #bbf7d0; color: #166534; }

/* ── Empty states ─────────────────────────────────────────── */
.empty-state { color: var(--muted); font-size: 15px; text-align: center; padding: 32px 0; }

/* ── Camera-based QR scanning ──────────────────────────────── */
.scan-camera {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 60vh;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}
.scan-camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scan-frame {
  position: absolute;
  top: 15%;
  left: 15%;
  right: 15%;
  bottom: 15%;
  border: 3px solid rgba(255,255,255,.8);
  border-radius: 12px;
  pointer-events: none;
  box-shadow: 0 0 0 999px rgba(0,0,0,.25);
}

/* ── Printable badges ──────────────────────────────────────── */
.badge-card {
  width: 3.5in;
  height: 2in;
  margin: 0 auto 16px;
  padding: 0.2in;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  break-inside: avoid;
  page-break-inside: avoid;
}
.badge-name { font-size: 18px; font-weight: 700; }
.badge-agency, .badge-license { font-size: 12px; color: var(--muted); }
.badge-qr-img { width: 60%; max-width: 1.6in; margin-top: 8px; }
.badge-code { font-size: 13px; font-weight: 600; letter-spacing: .08em; margin-top: 2px; }

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(3.5in, 1fr));
  gap: 0.2in;
}

@media print {
  .no-print { display: none !important; }
  .topbar, .tabbar { display: none !important; }
  .staff-sidebar, .staff-topbar, .staff-menu-toggle, .staff-sidebar-overlay { display: none !important; }
  .staff-layout { display: block; }
  body { padding-bottom: 0; background: white; }
  main { padding: 0; }
  .badge-card { box-shadow: none; }
}

/* ── Staff portal ──────────────────────────────────────────── */
.staff-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 13px;
}
.staff-table th, .staff-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.staff-table th {
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .04em;
  position: sticky;
  top: 0;
}
.staff-table select, .staff-table input {
  font-size: 12px;
  padding: 4px 6px;
  margin-top: 0;
}
.staff-table tbody tr:nth-child(even) { background: rgba(15,23,42,.015); }
.staff-table tbody tr:hover { background: rgba(37,99,235,.05); }

.staff-toolbar {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.staff-inline-form {
  display: flex;
  gap: var(--space-1);
  align-items: center;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-block;
  width: auto;
  padding: 10px 18px;
  font-size: var(--text-sm);
  font-weight: 600;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background .15s, box-shadow .15s;
}
.btn:hover { background: var(--brand-dark); }
.btn-sm { padding: 6px 12px; font-size: var(--text-xs); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }

/* ── Staff portal layout — sidebar ────────────────────────── */
main:has(> .staff-layout) { padding: 0; }
.staff-layout {
  display: flex;
  min-height: 100dvh;
  align-items: stretch;
}
.staff-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
}
.staff-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.staff-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.staff-topbar .brand { font-size: var(--text-lg); font-weight: 700; color: var(--text); }
.staff-logout-btn {
  width: auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: var(--text-sm);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  margin-top: 0;
}
.staff-content { padding: var(--space-4); flex: 1; }

.staff-menu-toggle {
  display: none;
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 30;
  width: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}
.staff-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.4);
  z-index: 19;
}

@media (max-width: 860px) {
  .staff-menu-toggle { display: block; }
  .staff-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
  }
  .staff-sidebar.open { transform: translateX(0); }
  .staff-sidebar-overlay.open { display: block; }
  .staff-topbar { padding-left: calc(var(--space-4) + 48px); }
}

/* ── Staff nav (inside the sidebar) ───────────────────────── */
.staff-nav-group {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: var(--space-4) 0 var(--space-1);
}
.staff-nav-group:first-child { margin-top: 0; }
.staff-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.staff-nav a {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background .15s, color .15s;
}
.staff-nav a:hover { background: var(--bg); }
.staff-nav a.active { background: var(--brand); color: white; }
