@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700;800;900&display=swap');

:root {
  --primary: #1d5fc4;
  --primary-dark: #153f7a;
  --primary-hover: #1a55b0;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: rgba(255, 255, 255, 0.62);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 28px;
}

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

html { height: 100%; }

body {
  min-height: 100%;
  font-family: 'Archivo', system-ui, -apple-system, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(ellipse 900px 700px at -10% -15%, rgba(29, 95, 196, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 700px 500px at 110% 115%, rgba(29, 95, 196, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 500px 400px at 55% 60%, rgba(100, 160, 255, 0.08) 0%, transparent 70%),
    #eef2fb;
  background-attachment: fixed;
}

/* ─── Glass card ─── */
.card {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.5) inset,
    0 8px 32px rgba(29, 95, 196, 0.09),
    0 2px 8px rgba(29, 95, 196, 0.05);
  border-radius: var(--radius);
}

.card-strong {
  background: var(--glass-strong);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.65) inset,
    0 16px 48px rgba(29, 95, 196, 0.12),
    0 4px 16px rgba(29, 95, 196, 0.07);
  border-radius: var(--radius-lg);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.16s ease;
  letter-spacing: 0.01em;
  line-height: 1;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 16px rgba(29, 95, 196, 0.32), 0 1px 0 rgba(255,255,255,0.12) inset;
}
.btn-primary:hover  { background: var(--primary-hover); box-shadow: 0 6px 20px rgba(29, 95, 196, 0.42); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: rgba(255,255,255,0.5);
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.72);
}
.btn-ghost:hover { background: rgba(255,255,255,0.72); color: var(--text); }
.btn-ghost:active { transform: scale(0.97); }

/* ─── Input ─── */
.input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(29, 95, 196, 0.14);
  background: rgba(255, 255, 255, 0.8);
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
  -webkit-appearance: none;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 95, 196, 0.1);
}
.input::placeholder { color: var(--text-muted); }

/* ─── Search ─── */
.search-wrapper { position: relative; }
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 17px;
  pointer-events: none;
  line-height: 1;
}
.search-input { padding-left: 44px; }

/* ─── Stats ─── */
.stats-row {
  display: flex;
  gap: 10px;
}

.stat-card {
  flex: 1;
  padding: 14px 10px;
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(29,95,196,0.07), 0 0 0 1px rgba(255,255,255,0.4) inset;
  border-radius: var(--radius-sm);
  text-align: center;
}

.stat-number {
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  color: var(--primary);
}
.stat-number.success { color: var(--success); }
.stat-number.warning { color: var(--warning); }

.stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 5px;
}

/* ─── Filter tabs ─── */
.filter-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.5);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.7);
}

.filter-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.14s;
  text-align: center;
  line-height: 1;
}
.filter-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(29,95,196,0.1);
}

/* ─── Person list item ─── */
.person-list { display: flex; flex-direction: column; gap: 8px; }

.person-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.65);
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(29,95,196,0.06), 0 0 0 1px rgba(255,255,255,0.4) inset;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.person-item.checked-in {
  background: rgba(240, 253, 244, 0.88);
  border-color: rgba(22, 163, 74, 0.28);
  box-shadow: 0 2px 10px rgba(22, 163, 74, 0.09), 0 0 0 1px rgba(22, 163, 74, 0.08) inset;
}

.person-info { flex: 1; min-width: 0; }

.person-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.allergy-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--warning);
  background: rgba(217,119,6,0.09);
  padding: 2px 6px;
  border-radius: 6px;
  margin-top: 5px;
}

/* ─── Check-in button ─── */
.checkin-btn {
  flex-shrink: 0;
  width: 76px;
  height: 48px;
  border-radius: 12px;
  border: 2px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-family: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.16s ease;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  -webkit-tap-highlight-color: transparent;
}
.checkin-btn .ci-icon { font-size: 20px; line-height: 1; }
.checkin-btn .ci-label { font-size: 9px; line-height: 1; }

.checkin-btn.checked {
  background: var(--success);
  border-color: var(--success);
  color: white;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.28);
}
.checkin-btn:active { transform: scale(0.93); }

/* ─── Campus card (admin) ─── */
.campus-card {
  padding: 18px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 18px rgba(29,95,196,0.08), 0 0 0 1px rgba(255,255,255,0.5) inset;
  transition: box-shadow 0.2s ease;
}
.campus-card:hover { box-shadow: 0 6px 24px rgba(29,95,196,0.13), 0 0 0 1px rgba(255,255,255,0.5) inset; }

.campus-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.campus-stats { display: flex; gap: 8px; margin-bottom: 10px; }

.campus-stat { flex: 1; text-align: center; }

.campus-stat-number {
  font-size: 24px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}
.campus-stat-number.success { color: var(--success); }
.campus-stat-number.pending { color: var(--warning); }

.campus-stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.progress-bar {
  height: 5px;
  background: rgba(29,95,196,0.1);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #3d7fe4);
  border-radius: 3px;
  transition: width 0.7s ease;
}
.progress-fill.full { background: linear-gradient(90deg, var(--success), #22c55e); }

.campus-pct {
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ─── Header ─── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(238, 242, 251, 0.82);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.72);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.header-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

/* ─── Live badge ─── */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.live-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.45; transform: scale(0.75); }
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1e293b;
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 9999;
  max-width: 340px;
  text-align: center;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

/* ─── Loading ─── */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(29,95,196,0.14);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  margin: 36px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Empty state ─── */
.empty-state {
  text-align: center;
  padding: 52px 24px;
  color: var(--text-muted);
}
.empty-icon  { font-size: 48px; margin-bottom: 14px; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--text); }
.empty-sub   { font-size: 14px; margin-top: 6px; line-height: 1.5; }

/* ─── Layout ─── */
.page      { max-width: 520px;  margin: 0 auto; padding: 0 16px 40px; }
.page-wide { max-width: 920px;  margin: 0 auto; padding: 0 16px 40px; }
.section   { margin-top: 16px; }

.section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 10px;
}

.campus-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 600px)  { .campus-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 820px)  { .campus-grid { grid-template-columns: repeat(4, 1fr); } }

.export-row { display: flex; gap: 10px; flex-wrap: wrap; }
.export-row .btn { flex: 1; min-width: 140px; font-size: 14px; padding: 12px 16px; }

/* ─── Team badge (operator list) ─── */
.person-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.team-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
  white-space: nowrap;
  line-height: 1.6;
}

/* ─── Teams grid (admin) ─── */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 600px) { .teams-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 820px) { .teams-grid { grid-template-columns: repeat(6, 1fr); } }

.team-card {
  background: var(--card);
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
}
.team-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.team-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.team-counts {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 12px;
}
.team-count-total   { font-size: 22px; font-weight: 800; color: var(--text); }
.team-count-checked { font-size: 16px; font-weight: 700; }
.team-count-label   { font-size: 11px; color: var(--text-muted); }
.team-count-sep     { color: var(--text-muted); }
