/* ============================================================
   PNHS GRAND ALUMNI HOMECOMING 2027 — Registration System
   Stylesheet (iOS-inspired, Poppins, dark blue + orange)
   ============================================================ */

:root {
  --primary: #1b2a4a;
  --primary-600: #22345c;
  --primary-700: #16213a;
  --accent: #f97316;
  --accent-600: #ea580c;
  --green: #16a34a;
  --green-bg: #f0fdf4;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-700: #334155;
  --text: #1e293b;
  --bg: #f4f6fb;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .18);
  --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }
ul { list-style: none; }
code {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12.5px;
}

.muted { color: var(--gray-500); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; }
.mb0 { margin-bottom: 0; }
.hidden { display: none !important; }
.inline { display: inline-block; }
.ta-r { text-align: right; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s ease;
  background: var(--gray-100);
  color: var(--text);
  line-height: 1.2;
  user-select: none;
}
.btn:hover { filter: brightness(.96); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(27, 42, 74, .28); }
.btn-primary:hover { background: var(--primary-600); }

.btn-green { background: var(--green); color: #fff; box-shadow: 0 4px 14px rgba(22, 163, 74, .28); }
.btn-danger { background: var(--red); color: #fff; box-shadow: 0 4px 14px rgba(220, 38, 38, .25); }
.btn-outline { background: #fff; border-color: var(--gray-200); color: var(--primary); }
.btn-outline:hover { border-color: var(--primary); background: var(--gray-50); }
.btn-ghost { background: transparent; color: var(--gray-500); }
.btn-ghost:hover { background: var(--gray-100); color: var(--text); }
.btn-link {
  background: none; color: var(--blue); padding: 2px 0; font-weight: 500;
  border-radius: 4px; box-shadow: none;
}
.btn-link:hover { text-decoration: underline; filter: none; transform: none; }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 24px; font-size: 15px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 7px;
}
.input {
  width: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: 12px;
  padding: 11px 14px;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.input::placeholder { color: var(--gray-400); }
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 42, 74, .12);
}
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

/* Icon inputs (login) */
.input-wrap { position: relative; }
.input-wrap .input { padding-left: 44px; }
.input-wrap .input.has-toggle { padding-right: 46px; }
.input-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  display: flex;
  pointer-events: none;
}
.input-icon svg { display: block; }
.input-wrap:focus-within .input-icon { color: var(--primary); }
.input-toggle {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  border: none; background: none;
  border-radius: 10px;
  color: var(--gray-400);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.input-toggle:hover { color: var(--gray-700); background: var(--gray-100); }
.input-toggle svg { display: block; }
.input-toggle .eye-closed { display: none; }
.input-toggle.is-shown .eye-open { display: none; }
.input-toggle.is-shown .eye-closed { display: block; }

/* Reference number field (receipt upload) */
.ref-input-wrap { position: relative; }
.ref-input-wrap .ref-input-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 30px; height: 30px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #3b5b9b);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  box-shadow: 0 4px 10px rgba(27, 42, 74, .22);
  z-index: 1;
}
.ref-input {
  border-radius: 16px;
  padding: 13px 16px 13px 54px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .4px;
  background: #f8fafc;
  border-width: 1.5px;
}
.ref-input:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, .16);
}
.ref-input::placeholder { font-family: var(--font); font-weight: 400; letter-spacing: 0; color: var(--gray-400); }

/* ---------- Alerts ---------- */
.alert {
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-success { background: var(--green-bg); color: #14532d; border-color: #bbf7d0; }
.alert-danger { background: var(--red-bg); color: #7f1d1d; border-color: #fecaca; }
.alert-info { background: var(--blue-bg); color: #1e3a8a; border-color: #bfdbfe; }

.notice { border-radius: 12px; padding: 12px 14px; font-size: 13.5px; margin: 8px 0 14px; }
.notice-blue { background: var(--blue-bg); color: #1e3a8a; }
.notice-red { background: var(--red-bg); color: #7f1d1d; }
.notice-green { background: var(--green-bg); color: #14532d; }

/* ---------- Auth layout ---------- */
.auth-wrap { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; padding: 26px; gap: 26px; }
.auth-center {
  grid-template-columns: 1fr; align-items: center; justify-items: center;
  padding: 40px 20px;
  background:
    radial-gradient(60% 55% at 85% 10%, rgba(249, 115, 22, .22), transparent 60%),
    radial-gradient(55% 50% at 8% 88%, rgba(59, 130, 246, .22), transparent 60%),
    linear-gradient(160deg, var(--primary) 0%, var(--primary-700) 100%);
  position: relative;
  overflow: hidden;
}
.auth-center::before,
.auth-center::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
}
.auth-center::before {
  width: 380px; height: 380px;
  background: rgba(249, 115, 22, .28);
  top: -130px; right: -110px;
}
.auth-center::after {
  width: 340px; height: 340px;
  background: rgba(37, 99, 235, .3);
  bottom: -140px; left: -110px;
}

.auth-hero {
  background: linear-gradient(155deg, #16213a 0%, #1b2a4a 45%, #2c3e6b 100%);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 56px;
  position: relative;
  overflow: hidden;
  border-radius: 30px;
  box-shadow: 0 28px 64px rgba(22, 33, 58, .28);
}
.auth-hero::after {
  content: '';
  position: absolute;
  width: 420px; height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(249, 115, 22, .22), transparent 65%);
  right: -120px; bottom: -120px;
}
.auth-hero::before {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .07), transparent 65%);
  left: -80px; top: -80px;
}
.auth-hero-inner { position: relative; z-index: 1; max-width: 460px; }
.logo-badge {
  width: 62px; height: 62px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), #fbbf24);
  color: #fff;
  font-weight: 800;
  font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 22px;
  box-shadow: 0 10px 24px rgba(249, 115, 22, .4);
  letter-spacing: .5px;
}
.logo-sm { width: 38px; height: 38px; font-size: 15px; border-radius: 11px; margin: 0; box-shadow: 0 4px 12px rgba(249, 115, 22, .35); }

/* Uploaded brand logo (replaces the text badge) */
.brand-logo { height: 44px; width: auto; max-width: 160px; object-fit: contain; display: inline-block; border-radius: 8px; }
.auth-hero .brand-logo { height: 84px; max-width: 300px; }

/* Settings brand previews */
.brand-preview {
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-50); border: 1px dashed var(--gray-300);
  border-radius: 14px; padding: 18px; margin-bottom: 10px; min-height: 110px;
}
.brand-preview-sm { min-height: 90px; }
.brand-preview-img { max-height: 80px; max-width: 100%; object-fit: contain; }
.brand-preview-fav { width: 48px; height: 48px; object-fit: contain; border-radius: 8px; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-600); cursor: pointer; margin-top: 6px; }
.form-group-end { align-self: end; }
.log-view {
  background: #0f172a; color: #cbd5e1; border: 1px solid #1e293b; border-radius: 10px;
  padding: 12px 14px; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  max-height: 220px; overflow-y: auto; margin: 0;
}
.auth-hero h1 { font-size: 34px; font-weight: 700; line-height: 1.25; margin-bottom: 8px; letter-spacing: .2px; }
.hero-sub { font-size: 16px; color: #cbd5e1; margin-bottom: 22px; }
.hero-meta { display: flex; gap: 10px; margin-bottom: 26px; flex-wrap: wrap; }
.hero-chip {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .18);
  backdrop-filter: blur(6px);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: #fde68a;
}
.hero-list { display: grid; gap: 10px; }
.hero-list li {
  position: relative;
  padding-left: 30px;
  color: #e2e8f0;
  font-size: 14px;
}
.hero-list li::before {
  content: '✓';
  position: absolute; left: 0; top: 0;
  width: 20px; height: 20px;
  background: rgba(249, 115, 22, .22);
  color: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 0; }
.auth-card {
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 34px;
  width: 100%;
  max-width: 480px;
}
.auth-card-narrow {
  max-width: 420px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, .45);
  box-shadow: 0 30px 70px rgba(10, 18, 40, .38);
  position: relative;
  z-index: 1;
}
.auth-card-head { margin-bottom: 22px; }
.auth-card-head h2 { font-size: 23px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.auth-card-head p { color: var(--gray-500); font-size: 13.5px; }
.auth-card-head.center { text-align: center; }
.auth-card-head.center .logo-badge { margin: 0 auto 14px; }
.auth-alt { text-align: center; font-size: 13.5px; color: var(--gray-500); margin-top: 18px; }
.auth-alt a { font-weight: 600; color: var(--accent-600); }

/* ---------- Topbar ---------- */
.topbar { background: #fff; border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 40; }
.topbar-dark { background: var(--primary); border-bottom: none; color: #fff; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-text { font-weight: 700; color: var(--primary); font-size: 15px; line-height: 1.15; }
.brand-text small { display: block; font-weight: 500; font-size: 11px; color: var(--gray-400); }
.topbar-dark .brand-text { color: #fff; }
.topbar-dark .brand-text small { color: #94a3b8; }
.topnav { display: flex; gap: 6px; align-items: center; }
.topnav-link {
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--gray-700);
  transition: all .15s;
}
.topnav-link:hover { background: var(--gray-100); }
.topbar-dark .topnav-link { color: #cbd5e1; }
.topbar-dark .topnav-link:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.topnav-link.active { background: var(--primary); color: #fff; }
.topbar-dark .topnav-link.active { background: var(--accent); color: #fff; }

/* ---------- Menu button (hamburger, mobile) ---------- */
.menu-btn {
  display: none;
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  background: #fff;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .15s;
}
.menu-btn:hover { border-color: var(--gray-300); }
.menu-btn span { width: 20px; height: 2.5px; background: var(--primary); border-radius: 3px; }
.topbar-dark .menu-btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); }
.topbar-dark .menu-btn span { background: #fff; }

/* ---------- Mobile sidebar drawer ---------- */
.sidebar { display: none; }
.sidebar-backdrop { display: none; }

/* ---------- Dashboard ---------- */
.dashboard { padding: 28px 20px 60px; }
.page-title { font-size: 24px; font-weight: 700; color: var(--primary); }
.page-sub { color: var(--gray-500); font-size: 14px; margin-top: 2px; margin-bottom: 20px; }

.welcome-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.reg-id {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  background: #fff; border: 1px solid var(--gray-200);
  padding: 2px 9px; border-radius: 8px; font-size: 13px; color: var(--primary); font-weight: 600;
}

.dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.two-col { grid-template-columns: repeat(2, 1fr); }

/* Grid/flex children must be allowed to shrink below their content's
   min width, otherwise wide content (e.g. a 720px table) forces the
   card — and the whole page — to overflow horizontally on mobile. */
.dash-grid > *, .scanner-grid > *, .detail-grid > *, .form-row > * { min-width: 0; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  border: 1px solid rgba(226, 232, 240, .6);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h2 { font-size: 16px; font-weight: 700; color: var(--primary); }

.profile-avatar {
  width: 58px; height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #3b5b9b);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
  margin-bottom: 16px;
}

.info-list { display: grid; gap: 0; }
.info-item { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--gray-200); }
.info-item:last-child { border-bottom: none; }
.info-item dt { color: var(--gray-500); font-size: 13px; }
.info-item dd { font-weight: 600; font-size: 13.5px; text-align: right; word-break: break-word; }

.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 8px 16px;
  font-size: 13px; font-weight: 600;
}
.status-pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.badge { display: inline-block; border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; }
.badge-gray { background: var(--gray-100); color: var(--gray-700); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }

/* Steps */
.steps { display: flex; flex-direction: column; gap: 0; margin: 4px 0 14px; }
.step { display: flex; gap: 13px; align-items: flex-start; position: relative; padding-bottom: 18px; }
.step:not(:last-child)::before {
  content: ''; position: absolute; left: 10px; top: 22px; bottom: 2px; width: 2px;
  background: var(--gray-200);
}
.step-dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--gray-200); border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--gray-200);
  position: relative; z-index: 1; flex-shrink: 0;
}
.step.is-done .step-dot { background: var(--green); box-shadow: 0 0 0 2px var(--green); }
.step-label { font-weight: 600; font-size: 13.5px; padding-top: 1px; }
.step-label small { display: block; color: var(--gray-500); font-weight: 400; font-size: 12px; }

/* GCash box */
.gcash-box {
  display: flex; gap: 14px; align-items: center;
  background: linear-gradient(135deg, #0c2a5c, #14438f);
  border-radius: 14px; padding: 16px; color: #fff; margin-bottom: 16px;
}
.gcash-logo {
  width: 44px; height: 44px; border-radius: 12px; background: #fff;
  color: #0c2a5c; font-size: 24px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.gcash-info { display: grid; gap: 1px; }
.gcash-info .muted { color: #b7c9e8; font-size: 12px; }
.gcash-number { font-size: 17px; letter-spacing: .5px; }
.amount-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 2px; border-bottom: 1px dashed var(--gray-200); margin-bottom: 12px;
}
.amount-row span { color: var(--gray-500); font-size: 13.5px; }
.amount-row strong { font-size: 18px; color: var(--accent-600); }
.gcash-qr { display: grid; justify-items: center; gap: 6px; margin: 0 0 14px; }
.gcash-qr-img {
  width: 168px; height: 168px; object-fit: contain;
  border: 1px solid var(--gray-200); border-radius: 16px;
  background: #fff; padding: 8px; box-shadow: var(--shadow-sm);
}
.guide-list { display: grid; gap: 7px; margin-bottom: 16px; counter-reset: g; }
.guide-list li { counter-increment: g; display: flex; gap: 10px; font-size: 13.5px; color: var(--gray-700); }
.guide-list li::before {
  content: counter(g);
  width: 20px; height: 20px; flex-shrink: 0;
  background: var(--blue-bg); color: var(--blue);
  border-radius: 50%; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* QR card */
.qr-card .card-head { margin-bottom: 14px; }
.qr-box {
  display: flex; gap: 18px; align-items: center;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 16px; padding: 16px;
  margin-bottom: 14px;
}
.qr-img {
  width: 150px; height: 150px;
  border-radius: 12px;
  background: #fff;
  flex-shrink: 0;
  border: 1px solid var(--gray-200);
  padding: 6px;
}
.qr-details { display: grid; gap: 2px; font-size: 13.5px; }
.qr-details .muted { font-size: 11.5px; }
.qr-placeholder { text-align: center; padding: 26px 12px; color: var(--gray-500); }
.qr-lock { font-size: 40px; margin-bottom: 10px; }
.qr-placeholder p { font-size: 13.5px; margin-bottom: 4px; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid rgba(226, 232, 240, .6);
  padding: 18px; display: flex; gap: 13px; align-items: center;
}
.stat-icon {
  width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 21px;
}
.stat-meta { display: grid; line-height: 1.3; }
.stat-meta strong { font-size: 21px; color: var(--primary); }
.stat-meta span { font-size: 12px; color: var(--gray-500); }
.stat-sub { font-size: 11px; color: var(--gray-400); font-weight: 500; }

/* ---------- Chart ---------- */
.chart { display: grid; gap: 12px; }
.chart-row { display: grid; grid-template-columns: 120px 1fr 62px; align-items: center; gap: 10px; }
.chart-label { font-size: 12.5px; font-weight: 600; color: var(--gray-700); }
.chart-value { font-size: 12.5px; color: var(--gray-500); text-align: right; }
.chart-bar { height: 12px; background: var(--gray-100); border-radius: 999px; overflow: hidden; }
.chart-fill { height: 100%; border-radius: 999px; min-width: 3px; transition: width .6s ease; }
.chart-fill.accent { background: linear-gradient(90deg, var(--accent), #fbbf24); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; min-width: 720px; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--gray-500); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.table td { padding: 13px 12px; border-bottom: 1px solid var(--gray-100); font-size: 13.5px; vertical-align: middle; }
.table tr:hover td { background: var(--gray-50); }
.action-group { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 180px; }
.filter-bar .form-group:first-child { flex: 2; }

.pagination { display: flex; gap: 6px; justify-content: center; padding: 18px 0 6px; }
.page-link {
  min-width: 34px; height: 34px; padding: 0 6px;
  border-radius: 10px; background: #fff; border: 1px solid var(--gray-200);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: var(--gray-700);
}
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.is-open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); }
.modal-card {
  position: relative; background: #fff; border-radius: 20px;
  box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; padding: 24px;
  animation: modalIn .2s ease;
  max-height: 90vh; overflow-y: auto;
}
.modal-card-wide { max-width: 620px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { font-size: 17px; color: var(--primary); font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 24px; color: var(--gray-400);
  cursor: pointer; line-height: 1; padding: 2px 6px; border-radius: 8px;
}
.modal-close:hover { background: var(--gray-100); color: var(--text); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.receipt-img {
  display: block; max-width: 100%; max-height: 70vh;
  margin: 0 auto; border-radius: 12px; object-fit: contain;
}

/* Upload drop */
.upload-drop {
  border: 2px dashed var(--gray-300);
  border-radius: 14px;
  padding: 30px 18px;
  text-align: center;
  cursor: pointer;
  transition: all .18s;
  background: var(--gray-50);
  margin-bottom: 14px;
}
.upload-drop:hover, .upload-drop.is-drag { border-color: var(--accent); background: #fff7ed; }
.upload-drop p { font-size: 13.5px; }
.upload-icon { font-size: 34px; margin-bottom: 6px; }
.upload-preview {
  margin: 12px auto 0; max-height: 260px; border-radius: 12px;
  border: 1px solid var(--gray-200);
}

/* ---------- Scanner ---------- */
.scanner-page { background: #0f172a; }
.scanner-page .page-title { color: #fff; }
.scanner-page .page-sub { color: #94a3b8; }
.scanner-page .card { background: #1e293b; border-color: #334155; color: #e2e8f0; }
.scanner-page .card-head h2 { color: #fff; }
.scanner-wrap { padding-top: 26px; padding-bottom: 60px; }
.scanner-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
#qr-reader { border-radius: 14px; overflow: hidden; background: #000; margin-bottom: 14px; min-height: 220px; }
#qr-reader video { border-radius: 14px !important; }
#qr-reader .qr-reader__scan-region-highlight { border-radius: 14px; }
.manual-form { display: flex; gap: 10px; }
.scanner-card .input { background: #0f172a; border-color: #334155; color: #fff; }
.scanner-card .input::placeholder { color: #64748b; }

.scan-result { border-radius: 14px; padding: 34px 22px; text-align: center; transition: all .25s; min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.scan-result-idle { background: #0f172a; color: #e2e8f0; border: 1px dashed #334155; }
.scan-result-granted { background: linear-gradient(150deg, #14532d, #16a34a); color: #fff; }
.scan-result-invalid { background: linear-gradient(150deg, #7f1d1d, #dc2626); color: #fff; }
.scan-result-used { background: linear-gradient(150deg, #78350f, #f59e0b); color: #fff; }
.scan-icon { font-size: 54px; margin-bottom: 8px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.25)); }
.scan-result h2 { font-size: 22px; font-weight: 700; }
.scan-result p { font-size: 14px; opacity: .9; }
.scan-meta { margin-top: 12px; display: grid; gap: 4px; font-size: 14px; }
.scan-meta strong { font-size: 16px; }

/* Scanner result modal */
.scanner-page .modal .modal-card { background: #0f172a; padding: 0; max-width: 420px; overflow: hidden; border: 1px solid #334155; }
.scanner-page .modal .scan-result { border-radius: 0; min-height: 340px; }
.scan-modal-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.16); color: #fff; border-radius: 50%; font-size: 20px; line-height: 1;
}
.scan-modal-close:hover { background: rgba(255,255,255,.3); color: #fff; }

/* PWA install button */
#pwaInstallBtn {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  background: #1b2a4a; color: #fff; border: 1px solid #334155;
  border-radius: 999px; padding: 10px 18px; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .35); cursor: pointer;
  touch-action: manipulation;
}
#pwaInstallBtn:hover { background: #22345f; }
#pwaInstallBtn svg { width: 16px; height: 16px; }
#pwaInstallBtn.hidden { display: none; }
.scanner-page #pwaInstallBtn { display: none; }


/* ---------- Payments / staff / masterlist extras ---------- */
.admin-who { font-size: 13px; color: var(--gray-500); margin-bottom: 18px; }
.row-urgent td { background: #fffbeb; }
.row-urgent:hover td { background: #fef3c7 !important; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.detail-h { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-400); margin-bottom: 6px; font-weight: 700; }
.text-danger { color: #dc2626; }
.ta-c { text-align: center; }
.table-masterlist th, .table-masterlist td { padding-top: 11px; padding-bottom: 11px; }
.masterlist-head { display: none; }
.print-only { display: none !important; }

/* ---------- Print (masterlist) ---------- */
@media print {
  body { background: #fff; }
  .topbar, .admin-who, .print-hide, .pagination, footer { display: none !important; }
  .dashboard { padding: 0; }
  .card { box-shadow: none; border: none; padding: 0; }
  .print-only { display: block !important; }
  .print-only h2 { font-size: 18px; color: #1b2a4a; margin-bottom: 4px; }
  .print-only p { font-size: 12px; color: #64748b; margin-bottom: 14px; }
  .table { border: 1px solid #ddd; }
  .table th { background: #1b2a4a !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table td { border-bottom: 1px solid #eee; }
}

/* ---------- Responsive ---------- */

/* Kill the 300ms tap delay / iOS highlight on touch */
.btn, .topnav-link, a, button, input, select, .upload-drop, .modal-close { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* Tablets / small laptops */
@media (max-width: 1024px) {
  .container { padding: 0 16px; }
  .auth-hero { padding: 44px 32px; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile landscape / tablets portrait */
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 40px 28px; }
  .dash-grid, .two-col, .scanner-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .filter-bar .form-group { flex: 1 1 100%; }
}

/* Phones & small tablets */
@media (max-width: 768px) {
  /* Topbar: keep single row, show hamburger, hide inline nav */
  .topbar-inner { height: 62px; padding: 0; flex-wrap: nowrap; gap: 12px; }
  .topnav { display: none; }
  .menu-btn { display: flex; }

  /* Sidebar drawer */
  .sidebar-backdrop {
    position: fixed; inset: 0; z-index: 110;
    background: rgba(15, 23, 42, .55);
    display: none; opacity: 0;
    transition: opacity .25s ease;
  }
  .sidebar-backdrop.is-open { display: block; opacity: 1; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 120;
    width: 288px; max-width: 86vw;
    background: #fff;
    display: flex; flex-direction: column;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 14px 0 44px rgba(15, 23, 42, .3);
  }
  .sidebar.is-open { transform: none; }
  .sidebar-dark { background: #1b2a4a; }
  .sidebar-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 18px 20px;
    border-bottom: 1px solid var(--gray-100);
  }
  .sidebar-head .brand { min-width: 0; }
  .sidebar-head .brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar-dark .sidebar-head { border-color: rgba(255, 255, 255, .12); }
  .sidebar-dark .sidebar-head .brand-text { color: #fff; }
  .sidebar-dark .sidebar-head .brand-text small { color: #94a3b8; }
  .sidebar-nav { padding: 14px; display: grid; gap: 4px; overflow-y: auto; flex: 1 1 auto; align-content: start; }
  .sidebar-link {
    display: block;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--gray-700);
    transition: all .15s;
  }
  .sidebar-link:hover { background: var(--gray-100); }
  .sidebar-link.active { background: var(--primary); color: #fff; }
  .sidebar-dark .sidebar-link { color: #cbd5e1; }
  .sidebar-dark .sidebar-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .sidebar-dark .sidebar-link.active { background: var(--accent); color: #fff; }
  .menu-close {
    width: 38px; height: 38px; flex-shrink: 0;
    border-radius: 11px; border: none;
    background: var(--gray-100); color: var(--gray-600);
    font-size: 22px; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
  }
  .sidebar-dark .menu-close { background: rgba(255, 255, 255, .1); color: #fff; }

  .sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--gray-100);
  }
  .sidebar-dark .sidebar-user { border-color: rgba(255, 255, 255, .12); }
  .sidebar-user-avatar {
    width: 40px; height: 40px; flex-shrink: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-600));
    color: #fff; font-size: 16px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
  }
  .sidebar-dark .sidebar-user-avatar { background: linear-gradient(135deg, var(--accent), var(--blue)); }
  .sidebar-user-meta { min-width: 0; display: grid; gap: 3px; }
  .sidebar-user-name {
    font-size: 13.5px; font-weight: 600; color: var(--gray-800);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .sidebar-dark .sidebar-user-name { color: #fff; }
  .sidebar-user .badge { justify-self: start; }
  .sidebar-user-del {
    margin-left: auto; width: 36px; height: 36px; flex-shrink: 0;
    border: none; border-radius: 10px;
    background: var(--gray-100); color: var(--red);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
  }
  .sidebar-user-del:hover { background: #fee2e2; color: var(--red); }
  .sidebar-dark .sidebar-user-del { background: rgba(255, 255, 255, .1); color: #fca5a5; }
  .sidebar-dark .sidebar-user-del:hover { background: rgba(220, 38, 38, .25); color: #fff; }

  /* Prevent iOS auto-zoom when focusing inputs */
  input.input, select.input, .scanner-card input.input { font-size: 16px; }

  .dashboard { padding: 20px 16px 46px; }
  .dash-grid { gap: 14px; }
  .card { padding: 18px; }
  .card-head { gap: 10px; }
  .card-head h2 { font-size: 15px; }

  .stat-grid { gap: 10px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-icon { width: 40px; height: 40px; font-size: 18px; border-radius: 11px; }
  .stat-meta strong { font-size: 19px; }
  .stat-meta span { font-size: 11.5px; }

  .auth-wrap { padding: 14px; gap: 14px; }
  .auth-center { padding: 32px 16px; }
  .auth-hero { padding: 30px 22px; border-radius: 24px; }
  .auth-hero h1 { font-size: 26px; }
  .auth-card { padding: 26px 20px; }

  /* Modals become bottom sheets */
  .modal { padding: 0; align-items: flex-end; }
  .modal-card {
    max-width: 100%;
    max-height: 88vh;
    border-radius: 22px 22px 0 0;
    padding: 22px 18px calc(24px + env(safe-area-inset-bottom));
    animation: sheetIn .25s ease;
  }
  @keyframes sheetIn { from { transform: translateY(48px); opacity: .5; } to { transform: none; opacity: 1; } }
  .modal-backdrop { background: rgba(15, 23, 42, .6); }
  .modal-close { padding: 6px 10px; }

  .qr-box { flex-direction: column; text-align: center; }
  .qr-details { justify-items: center; }
  .info-item { flex-direction: column; gap: 2px; }
  .info-item dd { text-align: left; }

  .scan-result { min-height: 260px; padding: 26px 16px; }
  .scan-icon { font-size: 44px; }
  .scan-result h2 { font-size: 19px; }

  .table th, .table td { padding: 11px 10px; }
  .action-group { justify-content: flex-start; }

  .detail-grid { gap: 12px; }
  .admin-who { margin-bottom: 14px; }
}

/* Phones */
@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .brand-text { font-size: 13.5px; }
  .brand-text small { font-size: 10.5px; }
  .page-title { font-size: 20px; }
  .page-sub { font-size: 13px; margin-bottom: 16px; }

  .auth-hero h1 { font-size: 23px; }
  .hero-sub { font-size: 14.5px; }
  .auth-card { padding: 22px 16px; }
  .auth-card-head h2 { font-size: 20px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar .form-group { min-width: 0; }

  .btn { padding: 10px 16px; font-size: 13.5px; }
  .btn-sm { padding: 7px 12px; font-size: 12.5px; }
  .btn-lg { padding: 12px 18px; font-size: 14.5px; }
  .input { padding-top: 13px; padding-bottom: 13px; }

  .welcome-row { gap: 10px; }
  .qr-img { width: 130px; height: 130px; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 auto; }
  .chart-row { grid-template-columns: 68px 1fr 46px; gap: 8px; }

  .scan-result { min-height: 230px; }
  .scan-meta strong { font-size: 14.5px; }
  .manual-form { flex-direction: column; }
  .manual-form .btn { width: 100%; }
}
