/* =========================================================================
   HESP 2026 — event registration & check-in
   Palette: navy #0D2062 · green #097333 · lime #99BB28 · blue #01539C · grey #D4D7E0
   Mobile-first. No build step, no dependencies.
   ====================================================================== */

:root {
  --navy:  #0D2062;
  --green: #097333;
  --lime:  #99BB28;
  --blue:  #01539C;
  --grey:  #D4D7E0;

  --ink:        #10142B;
  --ink-soft:   #5A6079;
  --ink-faint:  #878DA3;
  --surface:    #FFFFFF;
  --canvas:     #F5F6FA;
  --danger:     #B3261E;
  --danger-bg:  #FDECEA;
  --success-bg: #ECF6EF;

  --radius:    14px;
  --radius-sm: 10px;
  --shadow:    0 1px 2px rgba(13, 32, 98, .05), 0 8px 24px rgba(13, 32, 98, .06);
  --focus:     0 0 0 3px rgba(1, 83, 156, .35);
}

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

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

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

.wrap {
  width: 100%;
  max-width: 1170px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ------------------------------------------------------------------ header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--grey);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.logo {
  height: 46px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  display: block;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: .9rem;
  font-weight: 600;
}
.header-nav a {
  color: var(--blue);
  text-decoration: none;
  padding: 6px 2px;
  border-radius: 6px;
}
.header-nav a:hover { text-decoration: underline; }
.header-nav .logout { color: var(--ink-soft); }

/* -------------------------------------------------------------------- main */
main.wrap {
  padding-top: 28px;
  padding-bottom: 56px;
}

h1 {
  font-size: 1.6rem;
  line-height: 1.25;
  letter-spacing: -.015em;
  color: var(--navy);
  margin: 0 0 8px;
}
h2 {
  font-size: 1.15rem;
  color: var(--navy);
  margin: 28px 0 6px;
}
h2:first-of-type { margin-top: 0; }
h3 { font-size: 1.05rem; margin: 0; }

.lede   { color: var(--ink-soft); margin: 0 0 24px; }
.hint   { color: var(--ink-faint); font-size: .9rem; margin: 8px 0 0; }
.muted  { color: var(--ink-faint); }
.mono   { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.req    { color: var(--green); font-weight: 700; }
.rule   { border: 0; border-top: 1px solid var(--grey); margin: 32px 0; }

code {
  background: var(--canvas);
  border: 1px solid var(--grey);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: .875em;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid var(--grey);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  margin-bottom: 20px;
}
.card-narrow { max-width: 420px; margin-left: auto; margin-right: auto; }

/* Data (the participant table) earns the full 1170px. Forms do not — inputs
   stretched that wide are harder to scan, so they stay at a readable measure. */
.card-form { max-width: 660px; margin-left: auto; margin-right: auto; }

.card-success { text-align: center; padding: 44px 24px; }
.success-mark {
  width: 66px; height: 66px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--green);
  font-size: 2rem;
  line-height: 66px;
  border: 2px solid var(--green);
}

.empty { text-align: center; color: var(--ink-soft); }
.empty h2 { margin-top: 0; }

/* ------------------------------------------------------------------ fields */
.field { margin-bottom: 18px; }

label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

input[type="text"], input[type="tel"], input[type="email"],
input[type="password"], input[type="search"] {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  padding: 12px 14px;
  border: 1.5px solid var(--grey);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
input::placeholder { color: var(--ink-faint); }
input:hover { border-color: #BCC1D0; }
input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--focus);
}
input[aria-invalid="true"] { border-color: var(--danger); }
input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(179, 38, 30, .28); }

.field-error {
  color: var(--danger);
  font-size: .85rem;
  margin: 6px 0 0;
}

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  padding: 12px 20px;
  min-height: 46px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, transform .05s;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; margin-top: 8px; }

.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: #162C7C; }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #0A8A3D; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #96201A; }

.btn-ghost {
  background: transparent;
  color: var(--navy);
  border-color: var(--grey);
}
.btn-ghost:hover { background: var(--canvas); border-color: #BCC1D0; }

.btn-checkin {
  background: var(--green);
  color: #fff;
  min-width: 128px;
}
.btn-checkin:hover { background: #0A8A3D; }

.btn-done {
  background: var(--canvas);
  color: var(--ink-faint);
  border-color: var(--grey);
  min-width: 128px;
  cursor: not-allowed;
}

/* ----------------------------------------------------------------- alerts */
.alert {
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  margin: 0 0 20px;
  font-size: .93rem;
  border: 1px solid transparent;
}
.alert-ok {
  background: var(--success-bg);
  border-color: rgba(9, 115, 51, .3);
  color: #0A5B2A;
}
.alert-error {
  background: var(--danger-bg);
  border-color: rgba(179, 38, 30, .28);
  color: #8C1D18;
}

.hash-out {
  background: var(--navy);
  color: #E8ECF7;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---------------------------------------------------------------- statbar */
.statbar {
  display: flex;
  align-items: center;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 10px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.stat { flex: 1; text-align: center; padding: 0 6px; }
.stat-value {
  display: block;
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat:first-child .stat-value { color: var(--lime); }
.stat-label {
  display: block;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(255, 255, 255, .72);
  margin-top: 3px;
}
.stat-divider {
  width: 1px;
  align-self: stretch;
  background: rgba(255, 255, 255, .18);
}

/* -------------------------------------------------------------- searchbar */
.searchbar { display: flex; flex-wrap: wrap; gap: 10px; }
.searchbar input[type="search"] { flex: 1 1 220px; font-size: 1.05rem; padding: 14px 16px; }
.searchbar .btn { flex: 0 0 auto; }

.result-count {
  color: var(--ink-soft);
  font-size: .88rem;
  margin: 0 0 12px;
  padding-left: 4px;
}

/* ---------------------------------------------------------------- results */
.results { list-style: none; margin: 0 0 20px; padding: 0; }

.result {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--grey);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 12px;
}
.result.is-in { border-left-color: var(--green); background: #FCFDFC; }

.result-main { min-width: 0; }
.result-name {
  color: var(--navy);
  font-size: 1.1rem;
  letter-spacing: -.01em;
  margin-bottom: 3px;
  overflow-wrap: anywhere;
}
.result-meta {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: .9rem;
  overflow-wrap: anywhere;
}
.result-meta .dot { margin: 0 7px; color: var(--grey); }

.tag {
  display: inline-block;
  margin-left: 8px;
  background: rgba(153, 187, 40, .18);
  color: #55701A;
  border: 1px solid rgba(153, 187, 40, .5);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 7px;
  border-radius: 5px;
}

.result-action {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.result-action form { margin: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-reg { background: var(--canvas); color: var(--ink-soft); border: 1px solid var(--grey); }
.badge-in  { background: var(--success-bg); color: var(--green); border: 1px solid rgba(9, 115, 51, .35); }

/* ------------------------------------------------------- participant table */
.table-card { padding: 0; overflow: hidden; }

.table-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--grey);
}
.table-head h2 { margin: 0; font-size: 1.05rem; }
.table-empty { padding: 28px 22px; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 7px 13px;
  border: 1px solid var(--grey);
  border-radius: 999px;
  white-space: nowrap;
}
.filter:hover { background: var(--canvas); color: var(--navy); }
.filter:focus-visible { outline: none; box-shadow: var(--focus); }
.filter.is-on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* The constrained, scrollable viewport — roughly 25 rows tall. */
.table-scroll {
  max-height: 68vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll:focus-visible { outline: none; box-shadow: inset var(--focus); }

.ptable {
  width: 100%;
  border-collapse: collapse;
  font-size: .89rem;
  white-space: nowrap;
}
.ptable thead th {
  position: sticky;               /* header stays put while the body scrolls */
  top: 0;
  z-index: 2;
  background: var(--canvas);
  color: var(--navy);
  text-align: left;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 11px 14px;
  border-right: 1px solid var(--grey);
  border-bottom: 1px solid var(--grey);
}
.ptable tbody td {
  padding: 11px 14px;
  border-right: 1px solid var(--grey);
  border-bottom: 1px solid var(--grey);
  color: var(--ink-soft);
  vertical-align: middle;
}
/* No trailing edge on the last column — the card border closes the grid. */
.ptable thead th:last-child,
.ptable tbody td:last-child { border-right: 0; }
.ptable tbody tr:hover td { background: #FAFBFD; }
.ptable tbody tr:last-child td { border-bottom: 0; }
.ptable tbody tr.row-in td { background: #FBFDFB; }
.ptable tbody tr.row-in:hover td { background: #F5FAF6; }

.cell-name {
  color: var(--navy) !important;
  font-weight: 600;
  position: sticky;               /* name column stays visible when scrolled sideways */
  left: 0;
  background: var(--surface);
  z-index: 1;
}
.ptable tbody tr.row-in .cell-name { background: #FBFDFB; }
.cell-action { text-align: right; }
.cell-action form { margin: 0; }

.btn-sm {
  min-height: 34px;
  padding: 6px 14px;
  font-size: .82rem;
  min-width: 0;
}
.is-disabled { opacity: .45; pointer-events: none; }

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-top: 1px solid var(--grey);
  background: var(--canvas);
}
.pager-info { margin: 0; font-size: .84rem; color: var(--ink-soft); }
.pager-links { display: flex; align-items: center; gap: 10px; }
.pager-count { font-size: .84rem; color: var(--ink-soft); white-space: nowrap; }

/* ----------------------------------------------------------------- onspot */
.onspot { padding: 0; }
.onspot-toggle {
  list-style: none;
  cursor: pointer;
  padding: 20px 24px;
  font-weight: 600;
  color: var(--navy);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
}
.onspot-toggle::-webkit-details-marker { display: none; }
.onspot-toggle:hover { background: var(--canvas); }
.onspot-toggle:focus-visible { outline: none; box-shadow: var(--focus); }
.onspot-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 1.05rem;
  line-height: 1;
}
.onspot[open] .onspot-toggle {
  border-bottom: 1px solid var(--grey);
  border-radius: var(--radius) var(--radius) 0 0;
}
.onspot[open] .onspot-plus { transform: rotate(45deg); }
.onspot-body { padding: 24px; max-width: 660px; }

/* ------------------------------------------------------------------ footer */
.site-footer {
  border-top: 1px solid var(--grey);
  background: var(--surface);
  padding: 26px 0;
}
.tagline {
  margin: 0;
  text-align: center;
  color: var(--navy);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .18em;
}

/* ---------------------------------------------------------------- ≥ 620px */
@media (min-width: 620px) {
  .wrap { padding: 0 28px; }
  main.wrap { padding-top: 40px; }
  h1 { font-size: 1.9rem; }
  .card { padding: 34px 32px; }
  .logo { height: 54px; }

  .result {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
  }
  .result-action { flex-direction: column; align-items: flex-end; gap: 8px; }
  .stat-value { font-size: 2.1rem; }
  .onspot-body { padding: 28px 32px; }
}

/* -------------------------------------------------- reduced motion / print */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media print {
  .site-header, .site-footer, .searchbar, .onspot, .result-action { display: none; }
  .card, .result { box-shadow: none; }
  body { background: #fff; }
}
