/* Session check-in in the officer hub: the check-in screen (/js/hub/checkin-screen.js), the Events
   section's Attendance view and the dashboard's Attendance card (/js/hub/attendance.js), and the
   Check-in buttons on events. Colors come from the tokens in app.css; the QR code is always black on
   white, in both themes, so every phone camera reads it. */

/* ---------- the check-in screen: the whole window ---------- */

.ci-screen {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; border-radius: 0;
  background: var(--bg); color: var(--text);
}
.ci-screen[open] { display: block; }
.ci-screen::backdrop { background: var(--bg); }
.ci-frame {
  box-sizing: border-box; height: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 28px 28px; display: grid; grid-template-rows: auto auto auto auto; align-content: start; gap: 14px;
}

.ci-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 20px; }
.ci-top-text { min-width: 0; }
.ci-top .kicker { display: flex; align-items: center; gap: 6px; }
.ci-title { margin: 0; font-size: clamp(22px, 2.8vw, 34px); letter-spacing: -0.015em; overflow-wrap: anywhere; }
.ci-title:focus { outline: none; }
.ci-when { margin: 4px 0 0; color: var(--muted); font-size: clamp(15px, 1.5vw, 18px); overflow-wrap: anywhere; }
.ci-top-actions { flex: none; display: flex; gap: 8px; }
.ci-trouble:empty { display: none; }
.ci-trouble { margin: 0; padding: 8px 12px; border-radius: 10px; border-left: 3px solid var(--warn); background: var(--surface-2); font-size: 14px; }

/* Open: the QR code as big as the window allows, the address beside it, the QR code lined up with the
   title above it. On a 1080p projector the QR code is about 780px and the address about 54px letters,
   so both read from the back of a room (since 2026-10-05 the address is the other way in; the typed
   code is gone). */
.ci-main.is-open {
  display: grid; grid-template-columns: auto minmax(0, 760px); gap: 24px 48px; align-items: center; justify-content: start;
  padding: 8px 0;
}
.ci-qr {
  width: min(72vh, 52vw, 900px); aspect-ratio: 1;
  border-radius: 18px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px var(--line), var(--shadow);
}
.ci-qr svg { display: block; width: 100%; height: 100%; }
.qr-light { fill: #fff; }
.qr-dark { fill: #000; }
.ci-side { display: grid; gap: 18px; align-content: center; min-width: 0; max-width: 760px; }
.ci-step { margin: 0; font-size: clamp(20px, 2.3vw, 30px); font-weight: 800; line-height: 1.2; }
.ci-alt { display: grid; gap: 2px; }
.ci-alt p { margin: 0; }
.ci-alt-line { color: var(--muted); font-size: clamp(15px, 1.5vw, 19px); }
.ci-url { font-size: clamp(26px, 2.8vw, 54px); font-weight: 850; line-height: 1.15; color: var(--accent); letter-spacing: -0.01em; }

/* How they heard: one short row per answer, under the count; names nobody. */
.ci-heard { display: grid; gap: 6px; }
.ci-heard-title { margin: 0; font-size: 13px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ci-heard-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ci-heard-list li {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: clamp(13px, 1.1vw, 16px);
}
.ci-heard-list strong { font-variant-numeric: tabular-nums; }
.ci-print { text-decoration: none; }

.ci-count { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ci-count-n { font-size: clamp(40px, 5vw, 80px); font-weight: 850; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ok); }
.ci-count-label { font-size: clamp(16px, 1.6vw, 20px); font-weight: 650; color: var(--muted); }

/* Before, after, cancelled: what and when, big and calm. */
.ci-main:not(.is-open) { display: grid; gap: 20px; justify-items: center; text-align: center; padding: 6vh 0 2vh; }
.ci-wait { display: grid; gap: 8px; justify-items: center; max-width: 640px; }
.ci-wait-icon { color: var(--accent); }
.ci-main.is-cancelled .ci-wait-icon { color: var(--danger); }
.ci-main.is-after .ci-wait-icon { color: var(--ok); }
.ci-wait-title { margin: 0; font-size: clamp(24px, 3.2vw, 40px); font-weight: 800; line-height: 1.2; }
.ci-wait-body { margin: 0; color: var(--muted); font-size: clamp(15px, 1.6vw, 19px); }
.ci-nowrap { white-space: nowrap; }
.ci-main:not(.is-open) .ci-count { justify-content: center; }

/* Who checked in. */
.ci-people { border-top: 1px solid var(--line); padding-top: 14px; }
.ci-people-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ci-people-title { margin: 0; font-size: 16px; }
.ci-people-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.ci-people-title:focus { outline: none; }
.ci-people-note, .ci-people-foot, .ci-empty { margin: 0; }
.ci-note-narrow { display: none; }
.ci-people-foot { margin-top: 12px; font-size: 13px; }
.ci-people-body { display: grid; gap: 12px; }
.ci-add-open { justify-self: start; }
.ci-add { padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.ci-add-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.ci-add .hub-field { margin-bottom: 10px; }
.ci-add .form-error { margin: 0 0 8px; }
.ci-add-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ci-add input[type="email"] {
  width: 100%; min-height: 46px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--field-line);
  background: var(--bg); color: var(--text); font: inherit; font-size: 16px;
}
.ci-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.ci-person {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0;
  padding: 8px 8px 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
}
.ci-person-text { display: grid; min-width: 0; }
.ci-person-name { font-weight: 700; overflow-wrap: anywhere; }
.ci-person-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; color: var(--muted); font-size: 13px; }
.ci-person-email { overflow-wrap: anywhere; }
.hub-badge.ci-roster { --c: var(--ok); padding: 0 7px; }
.ci-remove { flex: none; min-height: 36px; }

/* ---------- Check-in on events ---------- */

.ev-tags { align-items: center; }
.ev-checkin { min-height: 30px; padding: 0 10px; gap: 5px; }
.ev-ed-checkin-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; margin: 0 0 8px; }
.ev-ed-checkin-row p { margin: 0; }
.dash-checkin { margin-top: 6px; }

/* ---------- attendance: the Events section's view and the dashboard's card ---------- */

.att[aria-busy="true"] { opacity: 0.6; }
.att-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; margin: 0 0 14px; }
.att-term { display: flex; align-items: center; gap: 10px; }
.att-term label { margin: 0; }
/* The same width as the Budget's Term picker (hub-budget.css). */
.att-term select { width: auto; min-width: 160px; min-height: 42px; }
.att-csv-note { margin: 0; max-width: 360px; }

/* The hub's number tiles (.hub-tile in hub.css), three across. */
.att-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.att-note { margin: 10px 0 18px; font-size: 13px; }
/* How they heard, for the term: one bar per answer, scaled to the biggest; the number and its share. */
.att-heard { margin: 16px 0 0; }
.att-heard-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.att-heard-row { display: grid; grid-template-columns: minmax(0, 11em) minmax(0, 1fr) 5.5em; align-items: center; gap: 10px; font-size: 14px; }
.att-heard-label { overflow-wrap: anywhere; }
.att-heard-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.att-heard-bar { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.att-heard-bar.is-skipped { background: var(--muted); opacity: 0.5; }
.att-heard-n { text-align: right; font-weight: 750; font-variant-numeric: tabular-nums; }
.att-heard-pct { color: var(--muted); font-weight: 500; font-size: 12px; }
.att-heard-sum { margin: 8px 0 0; font-size: 13px; }
.att-row-heard { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.dash-att-term { margin: 0 0 8px; color: var(--muted); font-size: 13px; font-weight: 650; }

.att-events-title { margin: 0 0 10px; font-size: 12px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.att-none { margin: 0 0 10px; }
.att-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.att-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0 14px; align-items: center;
  padding: 10px 16px 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
}
.att-row .ev-date { min-height: 0; padding: 4px 0; }
.att-row-main { min-width: 0; }
.att-row-title { margin: 0; font-size: 15px; }
.att-open {
  display: inline; padding: 0; margin: 0; border: 0; background: none; color: var(--text);
  font: inherit; font-weight: 750; text-align: left; cursor: pointer; overflow-wrap: anywhere;
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
}
.att-open:hover { color: var(--accent); text-decoration-color: var(--accent); }
.att-row-when { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.att-row-count { display: grid; justify-items: end; margin: 0; text-align: right; }
.att-row-n { font-size: 22px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ok); }
.att-row-label { color: var(--muted); font-size: 12px; font-weight: 650; }
.att-row.is-zero .att-row-label { font-size: 13px; }
.att-row.is-cancelled .att-open { color: var(--muted); text-decoration: line-through; text-decoration-color: currentColor; }

/* ---------- phones ---------- */

@media (max-width: 759px) {
  .ci-frame { padding: 12px 16px 20px; gap: 12px; }
  .ci-top { flex-direction: column; }
  .ci-top-actions { width: 100%; }
  .ci-top-actions .btn { flex: 1 1 0; min-height: 44px; }
  .ci-full { display: none; }
  .ci-main.is-open { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 16px; padding: 0; }
  .ci-qr { width: min(100%, 420px); border-radius: 14px; }
  .ci-side { justify-items: center; text-align: center; gap: 12px; }
  .ci-count, .ci-heard-list { justify-content: center; }
  .ci-heard { justify-items: center; }
  .ci-url { font-size: clamp(22px, 7vw, 34px); }
  .ci-add-fields { grid-template-columns: minmax(0, 1fr); }
  .ci-add-actions .btn { flex: 1 1 0; min-height: 44px; }
  .ci-add-open, .ci-toggle { min-height: 44px; }
  .ci-list { grid-template-columns: minmax(0, 1fr); }
  .ci-note-wide { display: none; }
  .ci-note-narrow { display: inline; }
  .ci-remove { min-height: 44px; }
  .ev-checkin { min-height: 36px; }
  .att-head { align-items: stretch; }
  .att-term { width: 100%; }
  .att-term select { flex: 1 1 auto; }
  .att-head .btn { width: 100%; min-height: 44px; }
  .att-tile-sub { display: none; }
  .att-tile-label { white-space: nowrap; } /* "Check-ins" stays one word on a phone */
  .att-row { padding: 10px 12px 10px 10px; gap: 0 10px; }
}

@media (max-width: 359px) {
  .att-tiles .hub-tile, .att-tiles.is-small .hub-tile { padding: 9px 8px 10px; }
  .att-tiles .hub-tile-label { font-size: 12.5px; }
  /* An event's row: the count goes under its words, so the title keeps the width. */
  .att-row { grid-template-columns: auto minmax(0, 1fr); }
  .att-row-count { grid-column: 2; display: flex; align-items: baseline; gap: 6px; justify-items: start; text-align: left; margin-top: 4px; }
}
