/* ═══════════════════════════════════════════════════════════════════════
   RCG Seminar Check-In — stylesheet
   Drop-in replacement. Every selector app.js depends on is preserved.

   Design position: the chrome is achromatic (warm near-black, bone, warm
   greys). Colour is reserved ENTIRELY for the three verdict states, so
   nothing on screen competes with them. Verdicts are full-screen fills,
   not cards, because they are read at arm's length in poor light by
   someone who is looking at a person rather than at the tablet.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;

  /* Ink — warm near-black, taken off the Todo en Finanzas palette */
  --ink:        #14120f;
  --ink-2:      #211e1a;
  --ink-3:      #332f29;
  --on-ink:     #ffffff;
  --on-ink-dim: #a9a29a;

  /* Paper */
  --bone:       #f6f3ee;
  --surface:    #ffffff;
  --surface-2:  #faf8f5;
  --line:       #e4ddd3;
  --line-2:     #d2c9bc;

  /* Text on paper */
  --text:       #1a1712;
  --text-2:     #6c6459;

  /* State — the only colour in the interface */
  --ok:         #0d7c3f;
  --ok-deep:    #0a6634;
  --ok-tint:    #e7f3ea;
  --warn:       #b45309;
  --warn-deep:  #92400e;
  --warn-tint:  #fbf0e2;
  --bad:        #a81e17;
  --bad-deep:   #8a1712;
  --bad-tint:   #f9e9e7;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --font: "Libre Franklin", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

.screen {
  display: none;
  height: 100%;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  flex-direction: column;
}
.screen--active { display: flex; }

button { font-family: inherit; color: inherit; }
button:focus-visible, input:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
input { font-family: inherit; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ═══════════════════════════════════════════════════════════════════════
   SCREEN 1 — Session entry
   ═══════════════════════════════════════════════════════════════════════ */

#screen-login {
  position: relative;
  overflow: hidden;
  background: var(--ink);
}

.brand-bar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 20px 4px;
  flex-shrink: 0;
}
.brand-bar__mark {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--on-ink);
}
.brand-bar__status { display: flex; align-items: center; gap: 8px; }

.conn-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #2fbf6d;
  flex-shrink: 0;
}
.conn-dot--offline { background: #e8663c; }
.conn-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-ink-dim);
}

.login-wrap {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 40px;
  overflow-y: auto;
}

.login-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
}
.login-card__accent { height: 4px; background: var(--ink); }
.login-card__body { padding: 40px 32px 36px; text-align: center; }

.login-icon {
  width: 60px; height: 60px;
  margin: 0 auto 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bone);
  color: var(--ink);
  border: 1px solid var(--line);
}

.login-title {
  font-family: var(--font);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0 0 10px;
  color: var(--text);
}
.login-subtitle {
  color: var(--text-2);
  margin: 0 0 28px;
  font-size: 16px;
  line-height: 1.45;
}

.code-input {
  width: 100%;
  min-height: 68px;
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  text-align: center;
  text-transform: uppercase;
  padding: 14px 12px;
  border-radius: var(--r-md);
  border: 2px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  margin-bottom: 16px;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.code-input::placeholder { color: #b8b0a5; letter-spacing: 0.24em; }
.code-input:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--surface);
}

.btn {
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 16px 20px;
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease;
}
.btn--primary { background: var(--ink); color: var(--on-ink); }
.btn--primary:active { background: var(--ink-3); transform: scale(0.99); }
.btn--primary:disabled { opacity: 0.45; cursor: default; transform: none; }

.login-error {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--bad-tint);
  color: var(--bad-deep);
  border: 1px solid rgba(168, 30, 23, 0.22);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.login-footer {
  position: relative;
  z-index: 1;
  margin: 24px 0 0;
  color: var(--on-ink-dim);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════
   SCREEN 2 — Scanner
   ═══════════════════════════════════════════════════════════════════════ */

#screen-scan { position: relative; background: var(--ink); }

.scan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: var(--ink);
  flex-shrink: 0;
}
.scan-header__info { min-width: 0; flex: 1; }
.scan-header__title {
  font-family: var(--font);
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--on-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scan-header__meta {
  margin: 3px 0 0;
  font-size: 13.5px;
  color: var(--on-ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scan-header__right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

/* Count reads as a number first, ring second */
.progress-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 4px;
}
.progress-pill__ring { width: 32px; height: 32px; transform: rotate(-90deg); flex-shrink: 0; }
.progress-pill__track { fill: none; stroke: rgba(255,255,255,0.18); stroke-width: 3.5; }
.progress-pill__fill {
  fill: none;
  stroke: var(--on-ink);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 97.4;
  stroke-dashoffset: 97.4;
  transition: stroke-dashoffset 0.4s ease;
}
.progress-pill__text {
  position: static;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--on-ink);
  white-space: nowrap;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--on-ink);
  width: 48px;
  height: 48px;
  border-radius: var(--r-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s ease;
}
.icon-btn:active { background: rgba(255, 255, 255, 0.2); }

.camera-wrap { flex: 1; position: relative; background: #000; overflow: hidden; min-height: 0; }
.camera-view { width: 100%; height: 100%; object-fit: cover; display: block; }

.scan-frame {
  position: absolute;
  top: 50%; left: 50%;
  width: min(68vw, 52vh);
  max-width: 100%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.scan-frame__corner {
  position: absolute;
  width: 46px; height: 46px;
  border: 4px solid rgba(255, 255, 255, 0.92);
}
.scan-frame__corner--tl { top: 0; left: 0; border-right: none; border-bottom: none; border-top-left-radius: 6px; }
.scan-frame__corner--tr { top: 0; right: 0; border-left: none; border-bottom: none; border-top-right-radius: 6px; }
.scan-frame__corner--bl { bottom: 0; left: 0; border-right: none; border-top: none; border-bottom-left-radius: 6px; }
.scan-frame__corner--br { bottom: 0; right: 0; border-left: none; border-top: none; border-bottom-right-radius: 6px; }

.scan-hint {
  position: absolute;
  bottom: 22px; left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
}

.camera-frozen-notice {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 9, 8, 0.94);
  color: #fff;
  text-align: center;
  cursor: pointer;
}
.camera-frozen-notice[hidden] { display: none; }
.camera-frozen-notice span:first-child {
  font-size: 46px;
  line-height: 1;
}
.camera-frozen-notice span:last-child {
  font-family: var(--font);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  max-width: 340px;
  padding: 14px 24px;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-radius: var(--r-md);
}

/* ─── Verdict: full-screen saturated fill ──────────────────────────── */

.verdict-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: block;
  background: transparent;
}
.verdict-overlay[hidden] { display: none; }

.verdict-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 32px 24px calc(32px + var(--safe-bottom));
  text-align: center;
  background: var(--ink);
  color: #fff;
  animation: verdict-in 0.16s cubic-bezier(0.2, 0.9, 0.3, 1.05);
}
@keyframes verdict-in { from { opacity: 0; } to { opacity: 1; } }

.verdict-card--ok   { background: var(--ok); }
.verdict-card--warn { background: var(--warn); }
.verdict-card--bad  { background: var(--bad); }

.verdict-icon {
  width: clamp(88px, 22vw, 124px);
  height: clamp(88px, 22vw, 124px);
  margin: 0 0 clamp(16px, 4vw, 28px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(48px, 12vw, 68px);
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 3px solid rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}
.verdict-name {
  font-family: var(--font);
  font-size: clamp(30px, 7.5vw, 52px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  max-width: 16ch;
  color: #fff;
  margin-bottom: 10px;
}
.verdict-detail {
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 600;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.9);
  max-width: 28ch;
}

/* ─── Sync bar: the "safe to leave" signal ─────────────────────────── */

.sync-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 16px;
  background: var(--ink);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: #2fbf6d; flex-shrink: 0; }
.sync-status { color: var(--on-ink); }

.sync-bar--pending { background: var(--warn); border-top-color: rgba(0,0,0,0.18); }
.sync-bar--pending .sync-dot { background: #fff; animation: pulse 1.15s ease-in-out infinite; }
.sync-status--pending { color: #fff; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.sync-count {
  background: rgba(255, 255, 255, 0.95);
  color: var(--warn-deep);
  padding: 3px 12px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════════════
   SCREEN 3 — Roster
   ═══════════════════════════════════════════════════════════════════════ */

#screen-roster { position: relative; overflow: hidden; background: var(--bone); }

/* Decorative glows removed — they cost vertical space and read as noise */
.roster-bg-glow { display: none; }

.roster-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bone);
}
.roster-panel__accent { display: none; }

.roster-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--ink);
  flex-shrink: 0;
}
.roster-header__brand { flex: 1; min-width: 0; }
.roster-header__brand h2 {
  font-family: var(--font);
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--on-ink);
}
.roster-header__org {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-ink-dim);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-text-danger {
  min-height: 48px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.34);
  color: var(--on-ink);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: var(--r-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s ease;
}
.btn-text-danger:active { background: rgba(255, 255, 255, 0.16); }

.roster-toolbar {
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.roster-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  min-height: 54px;
  background: var(--surface-2);
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-md);
}
.roster-search-row:focus-within { border-color: var(--ink); background: var(--surface); }
.roster-search-icon { color: var(--text-2); flex-shrink: 0; }
.roster-search {
  flex: 1;
  min-width: 0;
  padding: 14px 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 17px;
}
.roster-search:focus { outline: none; }
.roster-search::placeholder { color: #a8a096; }

.filter-chips {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line-2);
  background: var(--surface);
  color: var(--text-2);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.filter-chip--active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
}

.roster-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px calc(24px + var(--safe-bottom));
  background: var(--bone);
}

.roster-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.roster-row > div:first-child { min-width: 0; }
.roster-row--actionable { cursor: pointer; }
.roster-row--actionable:active { background: var(--surface-2); border-color: var(--line-2); }

.roster-row__name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roster-row__id {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.roster-row__badge {
  font-size: 13px;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.2;
}
.badge--registered { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.badge--attended   { background: var(--ok-tint); color: var(--ok-deep); border: 1px solid rgba(13, 124, 63, 0.26); }
.badge--noshow     { background: var(--bad-tint); color: var(--bad-deep); border: 1px solid rgba(168, 30, 23, 0.24); }

.roster-row__action-btn {
  min-height: 46px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  background: var(--ink);
  color: var(--on-ink);
  transition: background 0.12s ease, transform 0.08s ease;
}
.roster-row__action-btn:active { background: var(--ink-3); transform: scale(0.97); }

.roster-empty {
  color: var(--text-2);
  text-align: center;
  margin-top: 64px;
  font-size: 16px;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════
   Modal
   ═══════════════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 9, 8, 0.72);
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
  padding: 28px 24px 24px;
  text-align: center;
  animation: modal-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes modal-in { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-title {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0 0 12px;
  color: var(--text);
}
.modal-message {
  font-size: 16px;
  color: var(--text-2);
  margin: 0 0 24px;
  line-height: 1.5;
}
.modal-actions { display: flex; flex-direction: column; gap: 10px; }

.btn-modal {
  width: 100%;
  min-height: 54px;
  padding: 15px 18px;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background 0.12s ease;
}
.btn-modal--secondary { background: var(--surface-2); color: var(--text); border: 1.5px solid var(--line-2); }
.btn-modal--secondary:active { background: var(--line); }
.btn-modal--danger { background: var(--bad); color: #fff; }
.btn-modal--danger:active { background: var(--bad-deep); }
.btn-modal--primary { background: var(--ink); color: var(--on-ink); }
.btn-modal--primary:active { background: var(--ink-3); }

/* ═══════════════════════════════════════════════════════════════════════
   Landscape — iPad on a stand at the door
   ═══════════════════════════════════════════════════════════════════════ */

@media (orientation: landscape) and (max-height: 600px) {
  .login-card__body { padding: 26px 28px 24px; }
  .login-icon { width: 46px; height: 46px; margin-bottom: 14px; }
  .login-title { font-size: 24px; }
  .login-subtitle { margin-bottom: 18px; font-size: 15px; }
  .code-input { min-height: 58px; font-size: 25px; margin-bottom: 12px; }
  .btn { min-height: 54px; }
  .login-footer { display: none; }
  .scan-frame { width: min(46vw, 62vh); }
}
