/* ── FONTS (self-hosted) ── */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/nunito-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/nunito-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 400 600;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/nunito-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 400 600;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/nunito-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── RESET & DESIGN TOKENS ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:   #0ea5e9;
  --primary-d: #0284c7;
  --green:     #0ea5e9;
  --green-d:   #0284c7;
  --orange:    #F39C12;
  --orange-d:  #D68910;
  --blue:      #3498DB;
  --blue-d:    #2980B9;
  --red:       #E74C3C;
  --bg:        #F4F6FA;
  --surface:   #FFFFFF;
  --border:    #E2E8F0;
  --text:      #1A202C;
  --muted:     #718096;
  --radius:    16px;
  --radius-sm: 10px;
}

html, body {
  height: 100%;
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

/* ── APP SHELL ── */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-img {
  height: 40px;
  width: auto;
  display: block;
}

.header-mode-toggle {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.mode-indicator {
  padding: 8px 16px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  user-select: none;
  transition: all .2s;
}
.mode-indicator.active { background: var(--primary); color: #fff; border-radius: 8px; }
.mode-indicator.out.active { background: var(--orange); color: #fff; border-radius: 8px; }

/* ── STEPS BAR ── */
.steps-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px 12px;
}
.steps-track {
  display: flex;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
}
.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  position: relative;
}
.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: calc(50% + 18px);
  right: calc(-50% + 18px);
  height: 2px;
  background: var(--border);
  transition: background .3s;
  z-index: 0;
}
.step-item.done:not(:last-child)::after { background: var(--green); }

.step-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 15px;
  transition: all .3s;
  position: relative;
  z-index: 1;
  border: 2px solid transparent;
}
.step-item.done .step-dot  { background: var(--green); color: #fff; border-color: var(--green); }
.step-item.active .step-dot {
  background: #fff;
  color: var(--green-d);
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(14,165,233,.15);
}
.step-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}
.step-item.active .step-label,
.step-item.done  .step-label { color: var(--green-d); }

/* ── MAIN / PANELS ── */
.main {
  flex: 1;
  padding: 20px;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
}

.panel { display: none; animation: fadeIn .25s ease; }
.panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ── STEP 1: LOGIN ── */
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 28px 24px;
}
.step-heading {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}
.step-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
  font-family: 'Nunito Sans', sans-serif;
}
.login-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.tab-btn {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--bg);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.tab-btn.active { border-color: var(--green); background: #f0f9ff; color: var(--green-d); }
.tab-btn svg { width: 18px; height: 18px; }

.login-form { display: none; }
.login-form.active { display: block; }

.field-group { margin-bottom: 16px; }
.field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  display: block;
}
.field-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  transition: border-color .2s;
  outline: none;
  letter-spacing: 4px;
}
.field-input:focus { border-color: var(--green); background: #fff; }
.field-input::placeholder { letter-spacing: 0; font-weight: 400; color: #CBD5E0; }

.teacher-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 10px 14px;
  background: #FFF8E7;
  border-radius: var(--radius-sm);
  border: 1px solid #F6D860;
}
.teacher-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--orange); cursor: pointer; }
.teacher-row label { font-size: 13px; font-weight: 700; color: var(--orange-d); cursor: pointer; }

.qr-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 2px dashed var(--border);
}

/* ── SIBLING GRID (multi-child check-in) ── */
.sibling-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.sibling-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, opacity .15s;
}
.sibling-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, .15);
}
.sibling-card.disabled {
  opacity: .55;
  cursor: not-allowed;
  background: var(--bg);
}
.sibling-card-checkbox {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
  cursor: pointer;
}
.sibling-card-photo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  background-size: cover;
  background-position: center;
}
.sibling-card-photo.has-photo { color: transparent; }
.sibling-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 6px;
  line-height: 1.2;
}
.sibling-card-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.status-dot.checkin  { background: #22c55e; }
.status-dot.checkout { background: #0ea5e9; }
.status-dot.special  { background: #f59e0b; }
.sibling-counter {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  margin-bottom: 8px;
}
.sibling-counter .selected-count { color: var(--primary); font-weight: 700; }

/* ── SIGNATURE STEP ── */
.signature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}
.signature-disclaimer {
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
}
.signature-canvas-wrap {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.signature-canvas {
  display: block;
  width: 100%;
  height: 220px;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}
.signature-canvas-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
  user-select: none;
}
.signature-canvas-hint.hidden { display: none; }
.signature-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.signature-clear-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
}
.signature-clear-btn:hover { background: var(--bg); color: var(--text); }
@media (max-width: 380px) {
  .signature-canvas { height: 180px; }
}

/* ── ERROR MODAL ── */
.error-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: errorModalFadeIn .18s ease-out;
}
.error-modal-dialog {
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, .35);
  padding: 28px 28px 24px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: errorModalSlideUp .22s ease-out;
}
.error-modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fef3c7;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: #d97706;
}
.error-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.error-modal-message {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 20px;
}
.error-modal-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-d, #0369a1));
  color: #fff;
  border: none;
  padding: 12px 32px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  min-width: 140px;
  transition: transform .12s, box-shadow .12s;
  box-shadow: 0 4px 12px -2px rgba(14, 165, 233, .35);
}
.error-modal-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -2px rgba(14, 165, 233, .45); }
.error-modal-btn:active { transform: translateY(0); }
@keyframes errorModalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes errorModalSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Multi success — line-by-line */
.multi-result-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  text-align: left;
}
.multi-result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.multi-result-row.ok   { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.multi-result-row.fail { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.multi-result-icon { font-weight: 700; font-size: 15px; }
.qr-image {
  width: 240px;
  height: 240px;
  max-width: 100%;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  box-sizing: border-box;
}
.qr-label { font-size: 13px; font-weight: 700; color: var(--muted); text-align: center; }
.scan-code-hint {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 20px; background: var(--surface); border-radius: 8px; border: 1px solid var(--border);
}
.scan-code-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.scan-code-value { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: 2px; font-family: 'Nunito', sans-serif; }
.qr-id-badge {
  background: var(--text);
  color: #fff;
  padding: 8px 20px;
  border-radius: 30px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 3px;
}

/* ── STEP 2: CENTRO ── */
.student-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 16px;
}
.student-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  font-weight: 800;
  flex-shrink: 0;
}
.student-info { flex: 1; }
.student-name { font-size: 18px; font-weight: 800; color: var(--text); letter-spacing: -0.3px; }
.student-meta { font-size: 13px; color: var(--muted); font-family: 'Nunito Sans', sans-serif; margin-top: 2px; }
.student-meta.teacher-punch { font-size: 18px; font-weight: 800; color: var(--primary-d); margin-top: 6px; }
.checkin-badge {
  background: #e0f2fe;
  color: #0c4a6e;
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid #bae6fd;
  flex-shrink: 0;
}
.checkin-badge.out { background: #FFF7ED; color: #92400E; border-color: #FDE68A; }

.notice-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  padding: 16px 20px;
  margin-bottom: 12px;
}
.notice-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.notice-header svg { width: 16px; height: 16px; }
.notice-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--blue-d); }
.notice-text { font-size: 14px; color: var(--text); font-family: 'Nunito Sans', sans-serif; line-height: 1.6; }
.notice-card.alert { border-left-color: var(--orange); }
.notice-card.alert .notice-title { color: var(--orange-d); }

/* ── STEP 3: FOTO ── */
.camera-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.camera-viewport {
  background: #0A0A0A;
  aspect-ratio: 4/3;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.camera-viewfinder {
  width: 180px; height: 180px;
  border: 2px solid rgba(255,255,255,.4);
  border-radius: 50%;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.camera-viewfinder::before,
.camera-viewfinder::after {
  content: '';
  position: absolute;
  width: 24px; height: 24px;
  border-color: var(--green);
  border-style: solid;
}
.camera-viewfinder::before { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-radius: 6px 0 0 0; }
.camera-viewfinder::after  { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; border-radius: 0 0 6px 0; }
.camera-placeholder-icon { opacity: .3; }

.camera-controls {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cam-pill {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg);
  padding: 8px 14px;
  border-radius: 30px;
  border: 1px solid var(--border);
}
.cam-shutter {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--green);
  border: 4px solid #fff;
  outline: 3px solid var(--green);
  cursor: pointer;
  transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}
.cam-shutter:hover  { background: var(--green-d); transform: scale(1.05); }
.cam-shutter:active { transform: scale(.95); }
.cam-shutter svg { width: 24px; height: 24px; color: #fff; }

.captured-preview { display: none; text-align: center; padding: 20px; }
.captured-preview.show { display: block; }
.captured-img {
  width: 140px; height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
  margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 56px;
  border: 4px solid var(--green);
  box-shadow: 0 0 0 6px rgba(14,165,233,.15);
}
.captured-ok {
  font-size: 15px;
  font-weight: 700;
  color: var(--green-d);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.retake-btn {
  display: inline-block;
  margin-top: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--orange, #f59e0b);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  transition: all .2s;
}
.retake-btn:hover { background: #d97706; }

/* ── STEP 4: MEDICAMENTOS ── */
.meds-header {
  font-size: 14px;
  color: var(--muted);
  font-family: 'Nunito Sans', sans-serif;
  margin-bottom: 16px;
  line-height: 1.5;
  background: #F0F9FF;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid #BAE6FD;
}
.med-entry {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 12px;
}
.med-entry-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.med-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.med-field-hora { grid-column: 1 / -1; }

.field-input-sm {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .2s;
}
.field-input-sm:focus { border-color: var(--blue); background: #fff; }
.field-select {
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.field-textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Nunito Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
  outline: none;
  transition: border-color .2s;
  line-height: 1.5;
}
.field-textarea:focus { border-color: var(--blue); background: #fff; }

.date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.date-label { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }

.skip-link {
  text-align: center;
  margin: 8px 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  display: block;
  padding: 6px;
}
.skip-link:hover { color: var(--blue); }

/* ── FOOTER NAV ── */
.footer-nav {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.btn {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 15px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn:active { transform: scale(.97); }
.btn-ghost  { background: #e2e8f0; color: #475569; border: 1px solid #cbd5e1; font-weight: 700; }
.btn-ghost:hover { background: #cbd5e1; }
.btn-primary {
  background: var(--green);
  color: #fff;
  flex: 1;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(14,165,233,.3);
}
.btn-primary:hover { background: var(--green-d); }
.btn-finish {
  background: var(--blue);
  color: #fff;
  flex: 1;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(52,152,219,.3);
}
.btn-finish:hover { background: var(--blue-d); }
.btn-ext { background: #1A202C; color: #fff; font-size: 13px; padding: 12px 16px; white-space: nowrap; }

/* ── SUCCESS ── */
.success-panel { text-align: center; padding: 48px 24px; }
.success-icon {
  width: 96px; height: 96px;
  background: #e0f2fe;
  border-radius: 50%;
  margin: 0 auto 24px;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid #bae6fd;
}
.success-icon svg { width: 48px; height: 48px; color: #0284c7; }
.success-title { font-size: 28px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; margin-bottom: 8px; }
.success-sub { font-size: 15px; color: var(--muted); font-family: 'Nunito Sans', sans-serif; margin-bottom: 32px; line-height: 1.6; }
.success-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 20px;
  text-align: left;
}
.success-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.success-row:last-child { border-bottom: none; }
.success-row-key { color: var(--muted); font-family: 'Nunito Sans', sans-serif; }
.success-row-val { font-weight: 700; color: var(--text); }
.btn-new {
  background: var(--green);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 16px;
  padding: 16px 32px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 4px 16px rgba(14,165,233,.3);
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-new:hover { background: var(--green-d); }

/* ── STUDENT AVATAR WITH PHOTO ── */
.student-avatar {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.student-avatar.has-photo {
  background-color: transparent;
  font-size: 0;   /* hide initials text when photo is set */
}

/* ── CAMERA SIDE-BY-SIDE LAYOUT ── */
.camera-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.camera-card-compact { overflow: hidden; }
.camera-viewport-compact { aspect-ratio: 1/1; }
.camera-viewfinder-compact { width: 160px; height: 160px; }
.camera-preview-panel {
  display: none;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  text-align: center;
}
.camera-preview-panel.show { display: block; }
.captured-ok { font-size: 13px; }
@media (max-width: 480px) {
  .camera-layout { grid-template-columns: 1fr; }
  .camera-viewport-compact { aspect-ratio: 4/3; }
  .camera-viewfinder-compact { width: 140px; height: 140px; }
}

/* ── AVISOS ── */
.aviso-line { padding: 3px 0; line-height: 1.5; }
.aviso-line + .aviso-line { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 4px; }

/* ── EVENTS ── */
.event-row {
  padding: 4px 0;
  font-size: 14px;
  line-height: 1.6;
}
.event-row + .event-row { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 4px; }

/* ── CAMERA VIDEO ── */
#cameraVideo {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: none;
  transform: scaleX(-1);          /* mirror for front camera */
}
.captured-photo {
  width: 200px; height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary);
  box-shadow: 0 0 0 6px rgba(14,165,233,.15);
  display: block;
  margin: 0 auto 12px;
}
.captured-img-wrap { text-align: center; }

/* ── ERROR MESSAGE ── */
.error-message {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 12px;
  text-align: center;
}

/* ── LOADING OVERLAY ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-spinner {
  width: 48px; height: 48px;
  border: 4px solid rgba(255,255,255,.3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ── CHECKIN BADGE COLORS (primary-based) ── */
.checkin-badge {
  background: #e0f2fe;
  color: #0c4a6e;
  border-color: #7dd3fc;
}

/* ── SUCCESS ICON (primary-based) ── */
.success-icon {
  border-color: #7dd3fc;
  background: #e0f2fe;
}
.success-icon svg { color: var(--primary-d); }

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .main { padding: 16px; }
  .step-label { display: none; }
  .med-fields { grid-template-columns: 1fr; }
  .med-field-hora { grid-column: 1; }
  .btn { padding: 14px 16px; }
  .header-logo .logo-img { height: 32px; }
}
