/* ==================================================================
   Event Registration & QR Attendance — one stylesheet for all three
   portals. White page, one navy accent, large touch targets.
   ================================================================== */

:root {
  --navy:      #0E1B33;
  --navy-soft: #1B2C4D;
  --ink:       #111827;
  --muted:     #6B7280;
  --line:      #E5E7EB;
  --grey:      #F6F7F9;
  --ok:        #0F7B55;
  --ok-bg:     #E8F6F0;
  --warn:      #9A5B00;
  --warn-bg:   #FDF4E3;
  --err:       #B42318;
  --err-bg:    #FDF0EF;
  --radius:    14px;
  --shadow:    0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
}

* { -webkit-tap-highlight-color: transparent; }

body {
  background: #fff;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap      { max-width: 560px; margin: 0 auto; padding: 28px 18px 64px; }
.wrap-wide { max-width: 1180px; }
.wrap-slim { max-width: 440px; }

/* ---------- Brand ------------------------------------------------ */
.brand           { text-align: center; margin-bottom: 26px; }
.brand img       { height: 54px; width: auto; max-width: 240px; object-fit: contain; }
.brand .wordmark { font-size: 19px; font-weight: 700; letter-spacing: -.01em; color: var(--navy); }
.brand .school   { margin-top: 10px; font-size: 13px; font-weight: 600;
                   color: var(--muted); letter-spacing: .02em; }

.page-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em;
              color: var(--navy); margin: 0 0 6px; }
.page-sub   { color: var(--muted); font-size: 15px; margin: 0; }

/* ---------- Cards ------------------------------------------------ */
.card-min {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.card-min + .card-min { margin-top: 16px; }
.soft { background: var(--grey); border-radius: var(--radius); padding: 16px; }

/* ---------- Event strip ------------------------------------------ */
.event-strip {
  background: var(--grey); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 18px;
}
.event-strip .name { font-weight: 700; color: var(--navy); font-size: 16px; }
.event-strip .meta { color: var(--muted); font-size: 13.5px; margin-top: 2px; }

/* ---------- Form ------------------------------------------------- */
.field       { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600;
               color: var(--ink); margin-bottom: 7px; }
.hint        { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.form-control, .form-select {
  border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px;
  font-size: 16px;                   /* 16px keeps iOS from zooming on focus */
  color: var(--ink); background: #fff; box-shadow: none;
}
.form-control:focus, .form-select:focus {
  border-color: var(--navy); box-shadow: 0 0 0 3px rgba(14,27,51,.10);
}
.form-control::placeholder { color: #9CA3AF; }
.form-control[readonly]    { background: var(--grey); }

.input-group-text {
  background: var(--grey); border: 1px solid var(--line); border-right: 0;
  border-radius: 12px 0 0 12px; color: var(--muted); font-size: 15px; padding: 13px 12px;
}
.input-group .form-control { border-radius: 0 12px 12px 0; }

/* ---------- Buttons --------------------------------------------- */
.btn { border-radius: 12px; font-weight: 600; padding: 12px 18px; font-size: 15px; }
.btn-navy  { background: var(--navy); border: 1px solid var(--navy); color: #fff; }
.btn-navy:hover, .btn-navy:focus { background: var(--navy-soft); color: #fff; }
.btn-navy:disabled { opacity: .55; }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--grey); color: var(--ink); }
.btn-go    { background: var(--ok); border: 1px solid var(--ok); color: #fff; }
.btn-go:hover, .btn-go:focus { background: #0c6646; color: #fff; }
.btn-xl    { width: 100%; padding: 16px; font-size: 17px; }

/* ---------- Staff home: three big choices ----------------------- */
.bigbtn {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); color: var(--ink);
  text-decoration: none; margin-bottom: 14px;
}
.bigbtn:hover, .bigbtn:focus { border-color: var(--navy); color: var(--ink); }
.bigbtn .ico {
  flex: 0 0 52px; height: 52px; border-radius: 14px; background: var(--grey);
  display: flex; align-items: center; justify-content: center;
}
.bigbtn .ico svg { width: 26px; height: 26px; stroke: var(--navy); fill: none;
                   stroke-width: 1.8; }
.bigbtn.primary .ico { background: var(--navy); }
.bigbtn.primary .ico svg { stroke: #fff; }
.bigbtn .t  { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.bigbtn .s  { font-size: 13.5px; color: var(--muted); margin-top: 1px; }

/* ---------- QR scanner ------------------------------------------ */
#reader {
  width: 100%; border-radius: var(--radius); overflow: hidden;
  background: #000; min-height: 260px;
}
#reader video { width: 100% !important; height: auto !important; display: block; }
.scan-frame { position: relative; }
.scan-hint  { text-align: center; color: var(--muted); font-size: 13.5px; margin-top: 12px; }

/* ---------- QR display ------------------------------------------ */
.qr-box {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: inline-block; line-height: 0;
}
.qr-box svg, .qr-box img { width: 100%; max-width: 260px; height: auto; display: block; }
.regcode {
  font-size: 15px; font-weight: 700; letter-spacing: .08em; color: var(--navy);
  font-variant-numeric: tabular-nums;
}

/* ---------- Search dropdown ------------------------------------- */
.search-wrap { position: relative; }
.search-results {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(16,24,40,.14);
  max-height: 340px; overflow-y: auto; display: none;
}
.search-results.open { display: block; }
.sr-item { padding: 13px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.sr-item:last-child { border-bottom: 0; }
.sr-item:hover, .sr-item.active { background: var(--grey); }
.sr-name { font-weight: 600; font-size: 15px; display: flex; align-items: center;
           gap: 8px; flex-wrap: wrap; }
.sr-meta { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.sr-empty { padding: 16px 14px; color: var(--muted); font-size: 14px; }
.sr-item mark { background: #FFF3BF; padding: 0 1px; border-radius: 3px; }

/* ---------- Pills ----------------------------------------------- */
.pill { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .03em;
        text-transform: uppercase; padding: 2px 7px; border-radius: 999px; }
.pill-in     { background: var(--ok-bg);   color: var(--ok); }
.pill-out    { background: var(--grey);    color: var(--muted); }
.pill-walkin { background: var(--warn-bg); color: var(--warn); }
.pill-off    { background: var(--err-bg);  color: var(--err); }

/* ---------- Notes ----------------------------------------------- */
.note { border-radius: 12px; padding: 13px 15px; font-size: 14.5px;
        display: flex; gap: 10px; align-items: flex-start; }
.note-err  { background: var(--err-bg);  color: var(--err); }
.note-warn { background: var(--warn-bg); color: var(--warn); }
.note-ok   { background: var(--ok-bg);   color: var(--ok); }

/* ---------- Result screens -------------------------------------- */
.result-icon {
  width: 68px; height: 68px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; margin: 0 auto 16px;
  font-size: 34px; font-weight: 700;
}
.result-ok   { background: var(--ok-bg);   color: var(--ok); }
.result-warn { background: var(--warn-bg); color: var(--warn); }
.result-err  { background: var(--err-bg);  color: var(--err); }
.result-title { text-align: center; font-size: 23px; font-weight: 700;
                letter-spacing: -.02em; margin-bottom: 4px; }
.result-sub   { text-align: center; color: var(--muted); font-size: 14.5px;
                margin-bottom: 20px; }

.kv { border-top: 1px solid var(--line); }
.kv-row { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0;
          border-bottom: 1px solid var(--line); font-size: 15px; }
.kv-row span:first-child { color: var(--muted); flex: 0 0 auto; }
.kv-row span:last-child  { font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* ---------- Stat tiles ------------------------------------------ */
.statbar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 18px;
}
.statbar > div { background: #fff; padding: 14px 10px; text-align: center; }
.statbar .n { font-size: 22px; font-weight: 700; color: var(--navy);
              letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.statbar .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase;
              letter-spacing: .04em; margin-top: 2px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
        gap: 12px; margin-bottom: 18px; }
.kpi  { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
        padding: 16px 18px; }
.kpi .n { font-size: 28px; font-weight: 700; color: var(--navy);
          letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12px; color: var(--muted); text-transform: uppercase;
          letter-spacing: .04em; margin-top: 4px; }
.kpi .sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.kpi.accent { background: var(--navy); border-color: var(--navy); }
.kpi.accent .n { color: #fff; }
.kpi.accent .l, .kpi.accent .sub { color: rgba(255,255,255,.72); }

.bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden;
       margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 999px; }

/* ---------- Top bar --------------------------------------------- */
.topbar { border-bottom: 1px solid var(--line); background: #fff; padding: 12px 0;
          margin-bottom: 26px; }
.topbar .inner { max-width: 1180px; margin: 0 auto; padding: 0 18px;
                 display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar img { height: 34px; width: auto; }
.topbar .name { font-weight: 700; color: var(--navy); font-size: 15px; }
.navlinks { display: flex; gap: 4px; flex-wrap: wrap; }
.navlinks a { color: var(--muted); text-decoration: none; font-size: 14px;
              font-weight: 500; padding: 7px 11px; border-radius: 9px; }
.navlinks a:hover  { background: var(--grey); color: var(--ink); }
.navlinks a.active { background: var(--navy); color: #fff; }

/* staff bar is slimmer and sticks to the top on a phone */
.staffbar { position: sticky; top: 0; z-index: 30; background: #fff;
            border-bottom: 1px solid var(--line); padding: 10px 0; margin-bottom: 18px; }
.staffbar .inner { max-width: 560px; margin: 0 auto; padding: 0 18px;
                   display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.staffbar a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
.staffbar .who { font-size: 13px; color: var(--muted); }

/* ---------- Tables ---------------------------------------------- */
.table { font-size: 14.5px; }
.table > :not(caption) > * > * { padding: 11px 12px; }
.table thead th { background: var(--grey); color: var(--muted); font-size: 12px;
                  text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
                  border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { vertical-align: middle; border-color: var(--line); }
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.table-wrap .table { margin: 0; }

.section-head { display: flex; align-items: center; justify-content: space-between;
                gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h2 { font-size: 18px; font-weight: 700; margin: 0; color: var(--navy);
                   letter-spacing: -.01em; }

/* ---------- Misc ------------------------------------------------ */
.spin { display: inline-block; width: 15px; height: 15px; vertical-align: -2px;
        border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
        border-radius: 50%; animation: sp .6s linear infinite; }
.spin-dark { border-color: var(--line); border-top-color: var(--navy); }
@keyframes sp { to { transform: rotate(360deg); } }

.muted  { color: var(--muted); }
.small2 { font-size: 13px; }
.mono   { font-variant-numeric: tabular-nums; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
            background: var(--ok); margin-right: 6px; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

@media (max-width: 575px) {
  .wrap       { padding: 20px 14px 56px; }
  .card-min   { padding: 18px; }
  .statbar    { grid-template-columns: repeat(2, 1fr); }
  .page-title { font-size: 21px; }
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .card-min { border: 0; box-shadow: none; padding: 0; }
  .table-wrap { border: 0; }
  .wrap { padding: 0; max-width: 100%; }
}
