/* ============================================================
   Hojas de Respuestas — ProfeAcademī
   Rediseño limpio / editorial. Acento slate-blue, sin glassmorphism.
   Temas vía body.theme-*  ·  Mobile first.
   ============================================================ */

/* ---------- Tokens (claro por defecto) ---------- */
:root,
body.theme-light,
body.theme-rosa {
  --accent:        #3B5BA5;
  --accent-strong: #2F4A87;
  --accent-soft:   #EDF1F9;
  --accent-softer: #F5F8FC;
  --accent-on:     #FFFFFF;

  --bg:        #F7F8FA;
  --surface:   #FFFFFF;
  --surface-2: #FBFBFC;
  --border:    #E9EBEF;
  --border-2:  #E0E3E9;

  --text-1: #1A1D23;
  --text-2: #5B626D;
  --text-3: #8B919C;

  --success: #1F8A5B;
  --success-soft: #E7F3EC;
  --danger:  #C8453B;
  --danger-soft: #FBECEA;
  --warning: #B8791B;

  --shadow-xs: 0 1px 2px rgba(16,20,30,.06);
  --shadow-sm: 0 1px 3px rgba(16,20,30,.08);
  --shadow-md: 0 2px 4px rgba(16,20,30,.05), 0 8px 24px -12px rgba(16,20,30,.18);
  --shadow-lg: 0 4px 8px rgba(16,20,30,.04), 0 18px 40px -16px rgba(16,20,30,.22);

  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --maxw: 1080px;
  --formw: 620px;
}

/* ---------- Tokens (oscuro: cualquier tema que no sea claro/rosa) ---------- */
body:not(.theme-light):not(.theme-rosa) {
  --accent:        #7D9BE0;
  --accent-strong: #95AEE8;
  --accent-soft:   #20283A;
  --accent-softer: #191F2C;
  --accent-on:     #0F141C;

  --bg:        #0E1014;
  --surface:   #181B21;
  --surface-2: #1E222A;
  --border:    #2A2F39;
  --border-2:  #333944;

  --text-1: #ECEEF2;
  --text-2: #A2A9B5;
  --text-3: #727A87;

  --success: #4FB585;
  --success-soft: #16271F;
  --danger:  #E0746A;
  --danger-soft: #2A1A18;
  --warning: #D5A14E;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.45);
  --shadow-md: 0 2px 4px rgba(0,0,0,.3), 0 10px 28px -14px rgba(0,0,0,.7);
  --shadow-lg: 0 4px 10px rgba(0,0,0,.3), 0 20px 44px -16px rgba(0,0,0,.7);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg) !important;
  color: var(--text-1);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
svg { display: block; }
::selection { background: var(--accent-soft); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Header propio (oculto por el launcher; visible standalone) ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  padding: 12px 20px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
}
.hr-home-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  box-shadow: var(--shadow-xs);
  transition: all .2s var(--ease);
}
.hr-home-btn:hover { color: var(--accent); border-color: var(--border-2); }
.hr-home-btn:active { transform: scale(.94); }

/* ---------- App frame ---------- */
.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Screens / SPA transitions ---------- */
.screen { display: none; }
.screen.active {
  display: block;
  animation: screenIn .42s var(--ease-out);
}
@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px) scale(.994); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .screen.active { animation: none; }
}

/* ============================================================
   Home header
   ============================================================ */
.home-header { padding: 14px 0 6px; }
.home-header-row { display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo {
  width: 42px; height: 42px;
  border-radius: 11px;
  object-fit: cover;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
  background: var(--surface);
}
.brand-text { min-width: 0; }
.brand-app { font-size: 17px; font-weight: 650; letter-spacing: -.012em; line-height: 1.2; white-space: nowrap; }
.brand-sub { font-size: 12.5px; color: var(--text-3); letter-spacing: .01em; }
.header-spacer { flex: 1; }

.icon-btn {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all .2s var(--ease);
}
.icon-btn:hover { color: var(--text-1); border-color: var(--border-2); box-shadow: var(--shadow-xs); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 19px; height: 19px; }

.profe {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 5px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 650; letter-spacing: .02em;
}
.profe-name { font-size: 13.5px; font-weight: 550; white-space: nowrap; max-width: 28vw; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .profe-name { display: none; } }

.greeting { padding: 24px 0 18px; }
.greeting h1 { margin: 0; font-size: clamp(26px, 6vw, 34px); font-weight: 700; letter-spacing: -.025em; line-height: 1.08; }
.greeting p { margin: 7px 0 0; color: var(--text-2); font-size: 15px; max-width: 48ch; }

/* ============================================================
   Home cards
   ============================================================ */
.cards-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.cards-label { font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }

.cards {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  padding-bottom: 44px;
}
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; gap: 16px; } }
@media (min-width: 1024px){ .cards { grid-template-columns: repeat(3, 1fr); gap: 18px; } }

.card {
  position: relative;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  transition: transform .3s var(--ease-out), box-shadow .3s var(--ease), border-color .2s var(--ease);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px 22px 22px;
  min-height: 190px;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card:active { transform: translateY(-1px) scale(.992); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card-ico {
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 14px;
  width: 52px; height: 52px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 18px;
}
.card-ico svg { width: 26px; height: 26px; stroke-width: 1.9; }
.card-title { font-weight: 650; letter-spacing: -.012em; font-size: 18px; }
.card-desc { color: var(--text-2); font-size: 13.5px; line-height: 1.45; margin-top: 6px; flex: 1; }
.card-foot { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 16px; }
.card-arrow { color: var(--text-3); transition: transform .3s var(--ease-out), color .2s; }
.card:hover .card-arrow { transform: translateX(3px); color: var(--accent); }
.card-arrow svg { width: 20px; height: 20px; }
.card-kbd {
  font-size: 11px; color: var(--text-3);
  border: 1px solid var(--border-2); border-radius: 6px;
  padding: 1px 6px; font-weight: 500;
}

/* primaria */
.card.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.card.primary .card-desc { color: rgba(255,255,255,.82); }
.card.primary .card-ico { background: rgba(255,255,255,.16); color: #fff; }
.card.primary .card-kbd { color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.35); }
.card.primary .card-arrow { color: rgba(255,255,255,.7); }
.card.primary:hover .card-arrow { color: #fff; }
body:not(.theme-light):not(.theme-rosa) .card.primary { color: var(--accent-on); }
body:not(.theme-light):not(.theme-rosa) .card.primary .card-desc { color: rgba(15,20,28,.72); }
body:not(.theme-light):not(.theme-rosa) .card.primary .card-ico { background: rgba(15,20,28,.14); color: var(--accent-on); }
body:not(.theme-light):not(.theme-rosa) .card.primary .card-kbd { color: rgba(15,20,28,.8); border-color: rgba(15,20,28,.25); }
body:not(.theme-light):not(.theme-rosa) .card.primary .card-arrow,
body:not(.theme-light):not(.theme-rosa) .card.primary:hover .card-arrow { color: rgba(15,20,28,.7); }

/* ============================================================
   Subview bar (back)
   ============================================================ */
.subview-bar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, background .2s;
}
.subview-bar.stuck { border-color: var(--border); background: var(--bg); }
/* Solo padding vertical: el gutter horizontal lo aporta .wrap (no usar
   shorthand, que anularía el padding lateral de 20px). */
.subview-bar-inner { display: flex; align-items: center; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 14px 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13.5px; font-weight: 550; color: var(--text-2);
  transition: all .2s var(--ease);
}
.back-btn:hover { color: var(--text-1); border-color: var(--border-2); box-shadow: var(--shadow-xs); }
.back-btn:active { transform: scale(.96); }
.back-btn svg { width: 17px; height: 17px; }
.subview-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }

/* Solo padding vertical: el gutter horizontal lo aporta .wrap. */
.subview-body { padding-top: 8px; padding-bottom: 60px; }
.subview-narrow { max-width: var(--formw); margin: 0 auto; }

.page-head { margin: 10px 0 26px; }
.page-head h2 { margin: 0; font-size: clamp(23px, 5.4vw, 28px); font-weight: 700; letter-spacing: -.025em; line-height: 1.1; }
.page-head p { margin: 7px 0 0; color: var(--text-2); font-size: 14.5px; }

/* ============================================================
   Forms
   ============================================================ */
.field { margin-bottom: 20px; }
.field > label {
  display: block;
  font-size: 13px; font-weight: 600; color: var(--text-1);
  margin-bottom: 8px;
}
.field-help { display: block; margin-top: 7px; font-size: 12px; color: var(--text-3); }

.input {
  width: 100%;
  height: 48px;
  padding: 0 15px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  font-size: 15px; color: var(--text-1);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.input::placeholder { color: var(--text-3); }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--accent-soft);
}
input[type="number"].input::-webkit-outer-spin-button,
input[type="number"].input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"].input { -moz-appearance: textfield; }

.field-row { display: flex; gap: 18px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 160px; margin-bottom: 20px; }

/* select con chevron */
.select-wrap { position: relative; }
.select-wrap > [data-ico] { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.select-wrap > [data-ico] svg { width: 18px; height: 18px; }
select.input { -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 42px; }
select.input option { color: #111; }
body:not(.theme-light):not(.theme-rosa) select.input option { color: #eee; background: #181B21; }

/* segmented (alternativas) */
.segmented {
  display: inline-flex;
  background: var(--accent-softer);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px;
  gap: 3px;
}
.segmented button {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--text-2);
  transition: all .2s var(--ease);
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
}
.segmented button .sub { font-size: 10.5px; font-weight: 500; color: var(--text-3); letter-spacing: .02em; }
.segmented button.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-xs); }
.segmented button.on .sub { color: var(--text-2); }

/* ============================================================
   Pauta de corrección
   ============================================================ */
.pauta-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  padding: 18px 18px 20px;
  margin-bottom: 22px;
}
.pauta-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.pauta-head h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.pauta-hint { margin: 4px 0 14px; font-size: 12.5px; color: var(--text-3); }
.omr-pauta-count {
  font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.omr-pauta-count.completa { background: var(--success-soft); color: var(--success); }

.omr-pauta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 10px;
}
.omr-pauta-row { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 8px; }
.omr-pauta-num {
  width: 1.7rem; text-align: right;
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text-3);
}
.omr-alt-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--border-2);
  background: transparent;
  color: var(--text-2);
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  transition: all .15s var(--ease);
}
.omr-alt-btn:hover { border-color: var(--accent); color: var(--accent); }
.omr-alt-btn.sel { background: var(--accent); border-color: var(--accent); color: #fff; }
body:not(.theme-light):not(.theme-rosa) .omr-alt-btn.sel { color: var(--accent-on); }

/* ============================================================
   Botones
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 50px; padding: 0 22px;
  border-radius: var(--r-md);
  font-size: 15px; font-weight: 600;
  transition: transform .15s var(--ease), box-shadow .25s var(--ease), background .2s, border-color .2s;
}
.btn svg { width: 18px; height: 18px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none; }

.btn-primary {
  background: var(--accent); color: var(--accent-on);
  box-shadow: 0 1px 2px rgba(16,20,30,.12), 0 6px 16px -8px color-mix(in srgb, var(--accent) 60%, transparent);
}
.btn-primary:not(:disabled):hover { background: var(--accent-strong); transform: translateY(-1px); }
.btn-primary:not(:disabled):active { transform: translateY(0) scale(.985); }

.btn-ghost { background: var(--surface); color: var(--text-1); border: 1px solid var(--border-2); }
.btn-ghost:not(:disabled):hover { border-color: var(--text-3); box-shadow: var(--shadow-xs); }
.btn-ghost:not(:disabled):active { transform: scale(.985); }

.form-actions { margin-top: 28px; display: flex; gap: 12px; }
.scan-cta { margin-top: 26px; }
.scan-cta .btn-block + .btn-block { margin-top: 10px; }
.scan-live-help { display: block; margin-top: 10px; text-align: center; }

/* ============================================================
   Mis Evaluaciones — lista
   ============================================================ */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.search {
  flex: 1; min-width: 180px;
  display: flex; align-items: center; gap: 9px;
  height: 44px; padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
}
.search [data-ico] { color: var(--text-3); flex-shrink: 0; }
.search [data-ico] svg { width: 17px; height: 17px; }
.search input { flex: 1; border: none; outline: none; background: none; font-size: 14px; color: var(--text-1); }
.search input::placeholder { color: var(--text-3); }
.count-pill {
  font-size: 12.5px; font-weight: 550; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  padding: 8px 13px; border-radius: var(--r-pill); white-space: nowrap;
}
.count-pill b { color: var(--text-1); }

.eval-list { display: flex; flex-direction: column; gap: 11px; }
.eval-item {
  display: flex; align-items: center; gap: 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 15px 16px;
  box-shadow: var(--shadow-xs);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.eval-item:hover { border-color: var(--border-2); box-shadow: var(--shadow-sm); }
.eval-mark {
  flex-shrink: 0;
  width: 44px; height: 52px;
  border-radius: 8px;
  background: var(--accent-softer);
  border: 1px solid var(--border);
  position: relative;
  display: grid; place-items: center;
  overflow: hidden;
}
.eval-mark::before { content: ""; position: absolute; left: 7px; right: 7px; top: 12px; height: 2px; border-radius: 2px;
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--accent) 30%, transparent), 0 12px 0 color-mix(in srgb, var(--accent) 18%, transparent); }
.eval-mark span {
  position: relative; z-index: 1;
  font-size: 11px; font-weight: 700; color: var(--accent);
  background: var(--surface); padding: 1px 5px; border-radius: 4px;
  font-variant-numeric: tabular-nums; margin-top: 22px;
}
.eval-body { flex: 1; min-width: 0; }
.eval-title { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eval-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 12.5px; color: var(--text-3); }
.eval-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }
.eval-meta .tag { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: var(--r-pill); }
.eval-meta .tag-warn { color: #b45309; background: color-mix(in srgb, #f59e0b 18%, transparent); }
.pauta-warn { display: block; margin-top: 10px; text-align: center; color: #b45309; font-weight: 550; }
.eval-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.btn-reprint {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-2);
  background: var(--surface);
  font-size: 13px; font-weight: 550; color: var(--text-1);
  transition: all .2s var(--ease); white-space: nowrap;
}
.btn-reprint svg { width: 16px; height: 16px; color: var(--text-2); }
.btn-reprint:hover { border-color: var(--accent); color: var(--accent); box-shadow: var(--shadow-xs); }
.btn-reprint:hover svg { color: var(--accent); }
.btn-reprint:active { transform: scale(.96); }
.btn-reprint .lbl-sm { display: none; }
@media (max-width: 560px) {
  .btn-reprint { padding: 0 11px; }
  .btn-reprint .lbl-full { display: none; }
  .btn-reprint .lbl-sm { display: inline; }
}

/* skeleton */
.skel-item { display: flex; align-items: center; gap: 15px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 15px 16px; }
.skel { background: var(--border); border-radius: 6px; position: relative; overflow: hidden; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-mark { width: 44px; height: 52px; border-radius: 8px; flex-shrink: 0; }
.skel-line { height: 12px; }

/* ============================================================
   Estado vacío
   ============================================================ */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 44px 24px 50px; }
.empty .illu { margin-bottom: 20px; color: var(--accent); }
.empty h3 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.015em; }
.empty p { margin: 8px 0 0; color: var(--text-2); font-size: 14.5px; max-width: 36ch; }
.empty .btn { margin-top: 22px; }

/* ============================================================
   FASE 2/3 · Escáner en vivo
   ============================================================ */
/* flex:1 hace que la pantalla del escáner llene el alto de .app (100dvh).
   Sin esto la cadena de alturas se colapsa y la columna de la cámara queda
   con ~2px de alto: el <video> existe (la cámara enciende) pero no se ve. */
#screen-scanner.active { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#omr-view-scanner { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px 16px 16px; max-width: 1280px; width: 100%; margin: 0 auto; }

.omr-scan-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 14px;
  flex: 1;
  min-height: 0;
  height: calc(100dvh - 56px);
}

/* Columna izquierda: estudiantes */
.omr-students {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.omr-students-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.omr-students-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.omr-students-meta strong { font-size: 14px; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.omr-students-meta span { font-size: 12px; color: var(--text-3); }
.omr-collapse-arrow { display: none; }

.omr-student-list {
  list-style: none; margin: 0; padding: 8px;
  overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 4px;
}
.omr-student-list::-webkit-scrollbar { width: 8px; }
.omr-student-list::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 8px; }

.omr-student {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: background .25s var(--ease), border-color .25s var(--ease), opacity .25s var(--ease);
}
.omr-st-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--text-3), var(--text-2));
}
.omr-st-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 550; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.omr-st-nota { font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.omr-st-nota.aprobado  { color: var(--success); }
.omr-st-nota.reprobado { color: var(--danger); }
.omr-st-check { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; display: none; align-items: center; justify-content: center; background: var(--success); color: #fff; }
.omr-st-check svg { width: 12px; height: 12px; }

.omr-student.scanned { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.omr-student.scanned .omr-st-check { display: flex; }
.omr-student.scanned .omr-st-avatar { background: linear-gradient(135deg, var(--success), color-mix(in srgb, var(--success) 70%, #fff)); }

@keyframes omr-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.03); background: color-mix(in srgb, var(--success) 25%, var(--surface)); }
  100% { transform: scale(1); }
}
.omr-student.just-scanned { animation: omr-pop .6s ease; }

.omr-students-foot { padding: 10px 12px; border-top: 1px solid var(--border); }

/* Columna derecha: cámara */
.omr-camera {
  position: relative; overflow: hidden;
  background: #0c0e12;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
/* contain (no cover): muestra el cuadro COMPLETO de la cámara sin recortar.
   Recortar podría dejar fuera los marcadores/QR de la hoja y romper la lectura. */
.omr-camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.omr-camera canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* Modo "Ver en vivo": receptor sin cámara (el teléfono escanea, el desktop recibe) */
.live-mode .omr-camera { display: none; }
.omr-live {
  /* Oculto por defecto: solo se muestra cuando el layout entra en .live-mode.
     (Sin esto el panel ocuparía la 2ª columna de la grilla en modo cámara y
     desplazaría el visor a una segunda fila.) */
  display: none;
  overflow: hidden; text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 28px; gap: 4px;
}
.live-mode .omr-live { display: flex; }
.omr-live-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: var(--r-pill);
  background: var(--success-soft); color: var(--success);
  font-size: 13px; font-weight: 700; letter-spacing: .02em; margin-bottom: 10px;
}
.omr-live-badge.off { background: var(--border); color: var(--text-3); }
.omr-live-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--success);
  animation: omr-live-pulse 1.6s infinite;
}
.omr-live-badge.off .omr-live-dot { background: var(--text-3); animation: none; }
@keyframes omr-live-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); }
  70%  { box-shadow: 0 0 0 11px color-mix(in srgb, var(--success) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 0%, transparent); }
}
.omr-live-icon { color: var(--accent); opacity: .9; line-height: 0; }
.omr-live-icon svg { width: 54px; height: 54px; }
.omr-live-title { margin: 10px 0 0; font-size: 19px; color: var(--text-1); font-weight: 700; }
.omr-live-text { margin: 0; max-width: 360px; font-size: 14px; line-height: 1.5; color: var(--text-3); }
.omr-live-count { margin-top: 16px; font-size: 15px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }

.omr-chip {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  padding: 7px 16px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600; color: #fff;
  background: rgba(15,18,24,.82);
  border: 1px solid rgba(255,255,255,.12);
  white-space: nowrap; z-index: 5;
  transition: background .25s var(--ease), border-color .25s var(--ease);
  max-width: 92%; overflow: hidden; text-overflow: ellipsis;
}
.omr-chip-found  { background: rgba(184,121,27,.92);  border-color: rgba(245,196,109,.6); }
.omr-chip-locked { background: rgba(31,138,91,.92);   border-color: rgba(79,181,133,.7); }
.omr-chip-busy   { background: rgba(59,91,165,.92);   border-color: rgba(125,155,224,.7); }
.omr-chip-error  { background: rgba(200,69,59,.92);   border-color: rgba(224,116,106,.7); }

#omr-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 6; }
#omr-flash.go { animation: omr-flash .35s ease; }
@keyframes omr-flash { 0% { opacity: 0; } 25% { opacity: .85; } 100% { opacity: 0; } }

.omr-result-toast {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  max-width: 92%; padding: 11px 18px;
  border-radius: var(--r-md);
  background: rgba(31,138,91,.95); color: #fff;
  font-weight: 600; font-size: 14px; text-align: center;
  z-index: 7; box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.omr-result-toast.error { background: rgba(200,69,59,.95); }

.omr-btn-icon {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-1);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .15s var(--ease);
}
.omr-btn-icon:hover { border-color: var(--border-2); box-shadow: var(--shadow-xs); }
.omr-btn-icon:active { transform: scale(.94); }

.omr-btn-torch, .omr-btn-feed {
  position: absolute; right: 14px; z-index: 5;
  background: rgba(15,18,24,.6); color: #fff; border-color: rgba(255,255,255,.22);
}
.omr-btn-torch { top: 14px; }
.omr-btn-torch.on { background: rgba(184,121,27,.92); }
.omr-btn-feed { top: 62px; }
.omr-btn-torch[hidden] + .omr-btn-feed { top: 14px; }

/* Botón de orientación (vertical / horizontal) — esquina superior izquierda */
.omr-btn-orient {
  position: absolute; top: 14px; left: 14px; z-index: 5;
  background: rgba(15,18,24,.6); color: #fff; border-color: rgba(255,255,255,.22);
}
/* Botón de debug — debajo del de orientación */
.omr-btn-debug {
  position: absolute; top: 62px; left: 14px; z-index: 5;
  background: rgba(15,18,24,.6); color: #fff; border-color: rgba(255,255,255,.22);
}
.omr-btn-debug.on { background: rgba(168,85,247,.92); border-color: rgba(196,140,255,.7); }

/* Panel de diagnóstico (modo debug) */
.omr-debug-panel {
  position: absolute; inset: 0; z-index: 8;
  display: flex; flex-direction: column;
  background: rgba(8,10,14,.96); color: #e5e7eb;
  padding: 12px; overflow-y: auto;
}
.omr-debug-panel[hidden] { display: none; }
.omr-debug-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.omr-debug-title { font-size: 14px; font-weight: 650; }
.omr-debug-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff; border: 0; font-size: 14px; cursor: pointer;
}
.omr-debug-meta { font-size: 12px; color: #cbd5e1; margin-bottom: 8px; line-height: 1.4; }
.omr-debug-meta b { color: #fff; }
/* Selector específico para ganarle a `.omr-camera canvas` (overlay, position:absolute) */
.omr-debug-panel .omr-debug-canvas {
  position: static; inset: auto; width: auto; height: auto;
  display: block; margin: 0 auto 8px; max-width: 100%;
  image-rendering: -webkit-optimize-contrast;
  background: #fff; border-radius: 6px; border: 1px solid rgba(255,255,255,.15);
}
.omr-debug-sub { font-size: 11px; color: #94a3b8; margin: 2px 0 6px; line-height: 1.4; }
.omr-debug-legend { font-size: 11px; color: #94a3b8; margin: 0 0 10px; line-height: 1.4; }
.omr-debug-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.omr-debug-table th { text-align: left; color: #94a3b8; font-weight: 600; padding: 4px 6px; border-bottom: 1px solid rgba(255,255,255,.12); }
.omr-debug-table td { padding: 3px 6px; border-bottom: 1px solid rgba(255,255,255,.06); vertical-align: top; }
.omr-debug-table tr.ok td:nth-child(2) { color: #4ade80; font-weight: 700; }
.omr-debug-table tr.bad td:nth-child(2) { color: #f87171; font-weight: 700; }
.omr-debug-table .dbg-vals { font-family: monospace; color: #94a3b8; }
.omr-debug-table .dbg-vals .dbg-pick { color: #fde68a; font-weight: 700; }

/* Modal de alimentación con impresora */
.omr-feed-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 75%, rgba(0,0,0,.5));
}
.omr-feed-overlay[hidden] { display: none; }
.omr-feed-modal {
  max-width: 440px; width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px 22px 20px;
  max-height: 90dvh; overflow-y: auto;
}
.omr-feed-title { margin: 0 0 14px; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.omr-feed-steps {
  margin: 0 0 16px; padding-left: 1.1rem;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 13.5px; line-height: 1.45; color: var(--text-2);
}
.omr-feed-note { margin-top: 4px; }
.omr-feed-actions { margin-top: 18px; }
.omr-feed-actions .btn { flex: 1; }

/* ============================================================
   Responsive · escáner móvil
   ============================================================ */
@media (max-width: 860px) {
  .omr-scan-layout { display: flex; flex-direction: column; height: calc(100dvh - 56px); }
  .omr-camera { order: 1; flex: 1; min-height: 0; }
  .omr-students { order: 2; flex: 0 0 auto; max-height: 44dvh; transition: max-height .3s ease; }
  .omr-students-head { cursor: pointer; user-select: none; }
  .omr-collapse-arrow { display: block; color: var(--text-3); transition: transform .3s ease; }
  .omr-students.collapsed { max-height: 56px; }
  .omr-students.collapsed .omr-collapse-arrow { transform: rotate(180deg); }
  /* En "Ver en vivo" no hay cámara: el receptor y la lista comparten el alto */
  .omr-live { order: 1; flex: 1; min-height: 0; }
  .live-mode .omr-students { max-height: 52dvh; }
}

/* ============================================================
   Notificación (toast inferior)
   ============================================================ */
.notification {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 16px);
  z-index: 90; max-width: min(92vw, 460px);
  padding: 12px 18px; border-radius: var(--r-md);
  background: var(--text-1); color: var(--bg);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease-out);
}
body:not(.theme-light):not(.theme-rosa) .notification { background: var(--surface-2); color: var(--text-1); border: 1px solid var(--border-2); }
.notification.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.notification.success { box-shadow: var(--shadow-lg), 0 0 0 1px var(--success) inset; }
.notification.error   { box-shadow: var(--shadow-lg), 0 0 0 1px var(--danger) inset; }
.notification.warning { box-shadow: var(--shadow-lg), 0 0 0 1px var(--warning) inset; }
.notification-text { line-height: 1.4; }
