/* ============================================================
   admin.css — Panel de administración
   Estilo minimalista, consistente con el resto del sitio.
   Incluye tablas nuevas: Estudiantes · Word Lists · Vocabulary
   Incluye pestañas en Crear Listas y tabla Ver Listas.
   ============================================================ */

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

:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --border: #E3E6EB;
  --border-strong: #CBD0D8;
  --text: #111827;
  --text-2: #4B5563;
  --text-3: #9CA3AF;
  --accent: #111827;
  --accent-hover: #1F2937;
  --danger: #B91C1C;
  --focus: rgba(17,24,39,.12);
  --hover: #F1F3F6;
  --row-hover: #F8F9FB;

  --success: #15803D;
  --success-bg: #ECFDF5;
  --warn: #92400E;
  --warn-bg: #FEF3C7;
  --info: #1E40AF;
  --info-bg: #EFF6FF;
  --purple: #6B21A8;
  --purple-bg: #F3E8FF;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.04);
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);

  --header-h: 56px;
  --nav-w: 240px;
  --nav-w-collapsed: 64px;
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── Marca (cuadro oscuro con icono) ── */
.mark {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; flex-shrink: 0;
}
.mark svg { width: 20px; height: 20px; }

/* ============================================================
   LOGIN
   ============================================================ */
#login {
  min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.card {
  width: 100%; max-width: 360px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 2rem; box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
}
.card .mark { margin-bottom: 1.25rem; }
h1 { font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; }
.sub { font-size: .85rem; color: var(--text-2); margin: .25rem 0 1.5rem; }
label { display: block; font-size: .78rem; font-weight: 500; color: var(--text-2); margin-bottom: .4rem; }
.field { position: relative; }
input[type=password], input[type=text] {
  width: 100%; height: 42px; padding: 0 2.6rem 0 .8rem;
  border: 1px solid var(--border-strong); border-radius: 8px;
  font-size: .95rem; color: var(--text); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
input:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px var(--focus); }
input.invalid { border-color: var(--danger); }
.reveal {
  position: absolute; right: 4px; top: 4px; width: 34px; height: 34px;
  border: none; background: none; border-radius: 6px; cursor: pointer; color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
}
.reveal:hover { color: var(--text); background: var(--bg); }
.reveal svg { width: 18px; height: 18px; }
.error { min-height: 1.3em; margin-top: .5rem; font-size: .8rem; color: var(--danger); }
.btn {
  width: 100%; height: 42px; margin-top: .5rem; border: none; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: .9rem; font-weight: 500; cursor: pointer;
  transition: background-color .15s;
}
.btn:hover { background: var(--accent-hover); }
.back { display: block; text-align: center; margin-top: 1.25rem; font-size: .8rem; color: var(--text-3); text-decoration: none; }
.back:hover { color: var(--text); }
.shake { animation: shake .35s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ============================================================
   PANEL
   ============================================================ */
#app { height: 100%; display: flex; flex-direction: column; }

/* ── Header ── */
.topbar {
  height: var(--header-h); flex-shrink: 0;
  display: flex; align-items: center; gap: .75rem; padding: 0 1rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: relative; z-index: 30;
}
.topbar .mark { width: 28px; height: 28px; border-radius: 7px; }
.topbar .mark svg { width: 15px; height: 15px; }
.topbar .title { flex: 1; font-size: .95rem; font-weight: 600; }

.icon-btn {
  width: 36px; height: 36px; border: none; background: none; border-radius: 8px;
  color: var(--text-2); cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }

.link-btn {
  height: 32px; padding: 0 .8rem; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text-2); font-size: .8rem; font-weight: 500;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
}
.link-btn:hover { background: var(--bg); color: var(--text); }

/* ── Estructura: sidebar + contenido ── */
.shell { flex: 1; min-height: 0; display: flex; position: relative; }

/* ── Sidebar ── */
.sidebar {
  width: var(--nav-w-collapsed); flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: .75rem .5rem; gap: .25rem;
  overflow: hidden; white-space: nowrap;
  transition: width .2s ease;
}
#app.nav-open .sidebar { width: var(--nav-w); }

.nav-label {
  padding: .25rem .75rem .5rem; font-size: .68rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text-3);
  height: 1.7rem; opacity: 0; transition: opacity .15s;
}
#app.nav-open .nav-label { opacity: 1; }

.nav-item {
  display: flex; align-items: center; gap: .85rem;
  width: 100%; height: 44px; padding: 0 .85rem;
  border: none; background: none; border-radius: 8px;
  color: var(--text-2); font-size: .9rem; font-weight: 500; text-align: left; cursor: pointer;
  transition: background-color .15s, color .15s;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item svg { width: 22px; height: 22px; flex-shrink: 0; }
.nav-item span { opacity: 0; transition: opacity .15s; }
#app.nav-open .nav-item span { opacity: 1; }
.nav-item.active { background: var(--hover); color: var(--text); }

/* ── Contenido ── */
.content { flex: 1; min-width: 0; overflow-y: auto; padding: 2rem 1.5rem; }
.content-inner { max-width: 1100px; margin: 0 auto; }

.empty {
  border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--surface);
  padding: 2.5rem 1rem; text-align: center; color: var(--text-2);
  margin-top: .5rem;
}
.empty strong { display: block; color: var(--text); font-weight: 600; margin-bottom: .35rem; font-size: .95rem; }
.empty span { font-size: .85rem; color: var(--text-3); }

/* ── Fondo oscuro para el menú en móvil ── */
.backdrop {
  position: fixed; inset: var(--header-h) 0 0 0; z-index: 19;
  background: rgba(17,24,39,.35); opacity: 0; pointer-events: none;
  transition: opacity .2s;
}

/* ============================================================
   VISTAS · BOTONES
   ============================================================ */
.view-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  margin-bottom: 1.25rem;
}
.view-head h2 { font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; }
.view-head .sub { margin-bottom: 0; }

.btn-inline {
  height: 38px; padding: 0 1rem; border: none; border-radius: 8px; flex-shrink: 0;
  background: var(--accent); color: #fff; font-size: .85rem; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: .4rem;
  transition: background-color .15s;
}
.btn-inline:hover { background: var(--accent-hover); }
.btn-inline svg { width: 16px; height: 16px; }

.welcome {
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  padding: 3rem 1rem; text-align: center;
  font-size: 1.5rem; font-weight: 600; letter-spacing: -.01em; color: var(--text);
}

/* ── Tarjetas (colegios y usuarios) ── */
.card-list {
  display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.card-list.wide { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.card-list:empty { display: none; }
.item-card {
  display: flex; align-items: flex-start; gap: .85rem; padding: .9rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.avatar {
  width: 48px; height: 48px; border-radius: 10px; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--hover); color: var(--text-2); font-weight: 600; font-size: 1.05rem;
}
.avatar.round { border-radius: 50%; font-size: .9rem; }
.avatar img { width: 100%; height: 100%; object-fit: contain; }
.item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.item-top { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.item-info strong { font-size: .92rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-sub { font-size: .8rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-actions { display: flex; flex-shrink: 0; margin: -.25rem -.25rem 0 0; }
.item-actions .icon-btn { width: 32px; height: 32px; }
.item-actions .icon-btn svg { width: 18px; height: 18px; }
.item-actions .icon-btn:hover { color: var(--text); }

.badge {
  flex-shrink: 0; padding: .05rem .45rem; border-radius: 6px;
  background: var(--hover); border: 1px solid var(--border);
  font-size: .7rem; font-weight: 600; color: var(--text-2); letter-spacing: .04em;
}
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
input.mono { text-transform: uppercase; letter-spacing: .06em; }

/* ── Etiquetas ── */
.tags { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.tag {
  display: inline-flex; align-items: center; gap: .25rem;
  height: 24px; padding: 0 .6rem; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: .72rem; font-weight: 500;
}
.tag.removable { padding-right: .25rem; }
.tag-x {
  width: 18px; height: 18px; border: none; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.18); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.tag-x:hover { background: rgba(255,255,255,.35); }
.tag-x svg { width: 10px; height: 10px; }

.tagfield {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  min-height: 42px; padding: .35rem .5rem;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.tagfield:focus-within { border-color: var(--text); box-shadow: 0 0 0 3px var(--focus); }
.tagfield .tags:empty { display: none; }
.tagfield select {
  flex: 1; min-width: 120px; height: 28px; border: none; outline: none; background: transparent;
  color: var(--text-3); font-size: .85rem; cursor: pointer; padding: 0;
}

/* ── Código de acceso ── */
.item-meta { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; margin-top: .5rem; }
.codebox {
  display: inline-flex; align-items: center; gap: .15rem;
  padding: 0 .2rem 0 .6rem; height: 30px;
  border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--bg);
}
.codebox code { font-size: .8rem; font-weight: 600; letter-spacing: .05em; color: var(--text); }
.codebox .icon-btn { width: 26px; height: 26px; }
.codebox .icon-btn svg { width: 15px; height: 15px; }
.codebox .icon-btn.ok { color: #15803D; }

/* ============================================================
   MODAL
   ============================================================ */
.dialog {
  border: 1px solid var(--border); border-radius: 12px; padding: 0;
  width: min(480px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); margin: auto;
  background: var(--surface); color: var(--text);
  box-shadow: 0 20px 50px rgba(16,24,40,.2);
  overflow-y: auto;
}
.dialog::backdrop { background: rgba(17,24,39,.4); }
.dialog form { padding: 1.5rem; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.dialog-head h2 { font-size: 1.05rem; font-weight: 600; }
.dialog-head .icon-btn { margin-right: -.5rem; }

.form-row { margin-bottom: 1rem; }
.form-row label em { font-style: normal; color: var(--text-3); font-weight: 400; }
.form-row input[type=text] { padding-right: .8rem; }
.form-grid { display: flex; gap: .75rem; }
.form-grid .form-row { flex: 0 0 110px; min-width: 0; }
.form-grid .form-row.grow { flex: 1; }
.form-grid.even .form-row { flex: 1; }

.hint { font-size: .75rem; color: var(--text-3); margin: -.35rem 0 1rem; }

select {
  width: 100%; height: 42px; padding: 0 .6rem;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
  font-size: .9rem; color: var(--text); cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
select:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px var(--focus); }

.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .75rem; }
.dialog-actions .link-btn, .dialog-actions .btn-inline { height: 38px; }

.dropzone {
  border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--bg);
  padding: 1.1rem; text-align: center; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--text); background: var(--hover); }
.dz-empty svg { width: 26px; height: 26px; color: var(--text-3); margin-bottom: .35rem; }
.dz-empty p { font-size: .85rem; color: var(--text-2); }
.dz-empty small { font-size: .72rem; color: var(--text-3); }
.dz-preview { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.dz-preview img { max-width: 96px; max-height: 64px; object-fit: contain; border-radius: 6px; background: var(--surface); }

/* ============================================================
   RESPONSIVE — en móvil el menú es un cajón superpuesto
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; top: var(--header-h); bottom: 0; left: 0; z-index: 20;
    width: var(--nav-w); transform: translateX(-100%);
    transition: transform .2s ease;
  }
  #app.nav-open .sidebar { transform: translateX(0); }
  #app.nav-open .backdrop { opacity: 1; pointer-events: auto; }
  .nav-label, .nav-item span { opacity: 1; }
  .content { padding: 1.25rem 1rem; }
}
@media (max-width: 520px) {
  .card { padding: 1.5rem; }
  .form-grid { flex-direction: column; gap: 0; }
  .form-grid .form-row, .form-grid.even .form-row { flex: 1 1 auto; }
  .card-list, .card-list.wide { grid-template-columns: 1fr; }
}

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

/* ============================================================
   TABLAS NUEVAS (Estudiantes · Word Lists · Vocabulary)
   ============================================================ */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
  min-width: 640px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 0.7rem 0.9rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  font-weight: 800;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 0.72rem 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background-color .12s; }
.data-table tbody tr:hover { background: var(--row-hover); }

.data-table .row-actions {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
  flex-wrap: nowrap;
}
.data-table .row-actions .link-btn {
  height: 30px;
  padding: 0 0.7rem;
  font-size: 0.76rem;
}
.data-table .row-actions .icon-btn { width: 32px; height: 32px; }
.data-table .row-actions .icon-btn svg { width: 17px; height: 17px; }

.data-table td.sample-cell {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
  font-size: 0.78rem;
}

.data-table .cell-muted {
  color: var(--text-3);
  font-size: 0.78rem;
}

/* ── Filtros de cada tabla ── */
.wl-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-sm);
}
.wl-filters .form-row { margin: 0; }
.wl-filters .link-btn {
  height: 42px;
  padding: 0 1rem;
  align-self: end;
  justify-self: start;
}
@media (max-width: 700px) {
  .wl-filters { grid-template-columns: 1fr 1fr; }
  .wl-filters .link-btn { grid-column: 1 / -1; justify-self: stretch; }
}
@media (max-width: 480px) {
  .wl-filters { grid-template-columns: 1fr; }
}

/* ── Pills (chips) usadas en las columnas Tipo / Colegio / Grado ── */
.pill {
  display: inline-block;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  background: var(--hover);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  line-height: 1.4;
}
.pill.mr     { background: var(--purple-bg); border-color: #D8B4FE; color: var(--purple); }
.pill.grade  { background: var(--warn-bg);   border-color: #FCD34D; color: var(--warn); }
.pill.school { background: var(--info-bg);   border-color: #BFDBFE; color: var(--info); }
.pill.success { background: var(--success-bg); border-color: #86EFAC; color: var(--success); }
.pill.danger  { background: #FEF2F2; border-color: #FCA5A5; color: var(--danger); }

/* ── Barra de progreso inline en la tabla de Vocabulary ── */
.data-table .ve-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--hover);
  overflow: hidden;
  margin-bottom: 0.3rem;
  min-width: 90px;
}
.data-table .ve-progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #22C55E, #16A34A);
  border-radius: 999px;
  transition: width .25s ease;
}

@media (max-width: 720px) {
  .table-wrap { border-radius: 8px; }
  .data-table { min-width: 720px; }
  .data-table thead th,
  .data-table tbody td { padding: 0.6rem 0.7rem; }
}

/* ============================================================
   DASHBOARD: KPI + Charts
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  display: flex; align-items: center; gap: 0.9rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.kpi-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.kpi-icon {
  width: 46px; height: 46px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kpi-icon svg { width: 22px; height: 22px; }
.kpi-info { display: flex; flex-direction: column; min-width: 0; }
.kpi-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 0.15rem;
}
.kpi-value {
  font-size: 1.55rem; font-weight: 800; color: var(--text);
  line-height: 1; letter-spacing: -0.02em;
}
.kpi-sub {
  font-size: 0.72rem; color: var(--text-3); margin-top: 0.3rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.dash-filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.85rem 1rem; margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.dash-filters .form-row { margin: 0; min-width: 200px; flex: 0 1 240px; }
.dash-filters .link-btn { height: 42px; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}
.dash-grid .chart-card { min-width: 0; display: flex; flex-direction: column; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
@media (max-width: 1000px) {
  .span-4, .span-5, .span-7, .span-8 { grid-column: span 12; }
}
@media (min-width: 1001px) and (max-width: 1180px) {
  .span-4 { grid-column: span 6; }
}

.chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.chart-card h3 { font-size: 0.92rem; font-weight: 700; color: var(--text); margin: 0; }
.chart-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.5rem; margin-bottom: 0.85rem;
}
.chart-sub { font-size: 0.72rem; color: var(--text-3); }
.chart-wrap { position: relative; height: 240px; width: 100%; }
@media (max-width: 520px) { .chart-wrap { height: 200px; } }
.chart-empty {
  flex: 1; min-height: 160px;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  color: var(--text-3); font-size: 0.82rem;
}

/* ============================================================
   AYUDA DE IMPORTACIÓN CSV
   ============================================================ */
.csv-help {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: .85rem 1rem; margin-bottom: .85rem; font-size: .78rem; color: var(--text-2); line-height: 1.5;
}
.csv-help-title {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-3); margin-bottom: .35rem;
}
.csv-help ol, .csv-help ul { padding-left: 1.1rem; margin: .25rem 0; }
.csv-help code {
  background: var(--hover); border: 1px solid var(--border); border-radius: 4px;
  padding: 0 .3rem; font-size: .74rem;
}
.csv-sample {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: .6rem .8rem; margin: .4rem 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .74rem; color: var(--text); overflow-x: auto; white-space: pre;
}

/* ============================================================
   MODALES HORIZONTALES
   ============================================================ */
.dialog.mid  { width: min(760px, calc(100vw - 2rem)); }
.dialog.wide { width: min(940px, calc(100vw - 2rem)); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.5rem; align-items: start; }
.cols-side { grid-template-columns: 250px 1fr; }
.cols-side-r { grid-template-columns: 1fr 1.25fr; }
.dialog input[type=number] { font-family: inherit; color: var(--text); }
.dialog input[type=number]:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px var(--focus); }
@media (max-width: 720px) {
  .cols, .cols-side, .cols-side-r { grid-template-columns: 1fr; }
}

/* ============================================================
   CAMPO DE ETIQUETAS PARA PALABRAS
   ============================================================ */
.taginput {
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: .4rem;
  min-height: 210px; max-height: 300px; overflow-y: auto; padding: .55rem;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
  cursor: text; transition: border-color .15s, box-shadow .15s;
}
.taginput:focus-within { border-color: var(--text); box-shadow: 0 0 0 3px var(--focus); }
.ti-tags { display: contents; }
.wtag {
  display: inline-flex; align-items: center; gap: .2rem;
  height: 28px; padding: 0 .3rem 0 .65rem; border-radius: 999px;
  background: var(--hover); border: 1px solid var(--border-strong);
  color: var(--text); font-size: .82rem; font-weight: 500;
}
.wtag-text { cursor: pointer; }
.wtag-x {
  width: 20px; height: 20px; border: none; border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
}
.wtag-x:hover { background: var(--border-strong); color: var(--text); }
.wtag-x svg { width: 10px; height: 10px; }
.ti-input {
  flex: 1; min-width: 140px; height: 28px; border: none !important; outline: none !important;
  box-shadow: none !important; background: transparent; padding: 0 .25rem !important;
  font-size: .9rem; color: var(--text); width: auto !important;
}
.ti-count { margin-top: .35rem; font-size: .72rem; color: var(--text-3); text-align: right; }

/* ============================================================
   CARGA MÚLTIPLE DE ESTUDIANTES
   ============================================================ */
.stu-head, .stu-row { display: grid; grid-template-columns: 1fr 1fr 90px 34px; gap: .4rem; align-items: center; }
.stu-head {
  font-size: .72rem; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .06em; padding: 0 .1rem .3rem;
}
.stu-rows { display: flex; flex-direction: column; gap: .4rem; max-height: 280px; overflow-y: auto; padding: .1rem; }
.stu-row input { height: 38px; padding: 0 .6rem !important; font-size: .88rem; min-width: 0; }
.stu-row .icon-btn { width: 34px; height: 34px; }
.stu-row .icon-btn svg { width: 17px; height: 17px; }
.stu-foot { display: flex; align-items: center; justify-content: space-between; margin-top: .6rem; }
.stu-foot .link-btn { height: 34px; }

/* ============================================================
   EDITOR DE VOCABULARY
   ============================================================ */
.ve-wrap { padding: 1.5rem; }
.ve-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.ve-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.25rem;
}
.ve-words { min-width: 0; }
.ve-progress { margin-bottom: .85rem; }
.ve-progress small { display: block; margin-top: .35rem; font-size: .72rem; color: var(--text-3); }
.ve-progress-bar {
  height: 7px; border-radius: 999px; background: var(--hover);
  overflow: hidden; margin-bottom: .3rem;
}
.ve-progress-bar span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #22C55E, #16A34A);
  border-radius: 999px; transition: width .25s ease;
}
.ve-word-list {
  display: flex; flex-direction: column; gap: .3rem;
  max-height: 480px; overflow-y: auto; padding-right: .2rem;
}
.ve-word {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  width: 100%; padding: .55rem .75rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-size: .85rem; cursor: pointer; text-align: left;
  transition: background-color .12s, border-color .12s;
}
.ve-word:hover { background: var(--hover); }
.ve-word.active { border-color: var(--text); background: var(--hover); font-weight: 600; }
.ve-word.done { border-color: #BBF7D0; background: var(--success-bg); }
.ve-word.done .ve-word-state { color: var(--success); font-weight: 700; }
.ve-word-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ve-word-state { font-size: .7rem; color: var(--text-3); flex-shrink: 0; }

.ve-editor {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  background: var(--surface);
}
.ve-editor-head { margin-bottom: .95rem; }
.ve-editor-head h3 { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }
.ve-editor-head small { color: var(--text-3); font-size: .78rem; }

.ve-slots {
  display: grid; grid-template-columns: 1fr 1fr; gap: .75rem;
  border-radius: var(--radius); padding: 2px;
}
.ve-slots.over { outline: 2px dashed var(--text); outline-offset: 4px; }
.ve-slot {
  position: relative; aspect-ratio: 4 / 3;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--bg); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, background-color .15s;
}
.ve-slot:hover { border-color: var(--text-3); }
.ve-slot.filled { border-style: solid; background: #fff; }
.ve-slot img {
  position: absolute; inset: 0;
  width: 100%; height: calc(100% - 38px);
  object-fit: contain; padding: .4rem;
}
.ve-slot-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 38px;
  padding: 0 .4rem 0 .7rem;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border-top: 1px solid var(--border);
}
.ve-correct {
  margin: 0; display: inline-flex; align-items: center; gap: .35rem;
  font-size: .8rem; color: var(--text); cursor: pointer; user-select: none;
}
.ve-correct input[type=radio] { accent-color: #16A34A; }
.ve-slot-bar .icon-btn { width: 30px; height: 30px; }
.ve-slot-bar .icon-btn svg { width: 17px; height: 17px; }
.ve-add {
  width: 100%; height: 100%;
  border: none; background: none; color: var(--text-3); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .3rem; font-size: .8rem;
  transition: background-color .12s, color .12s;
}
.ve-add:hover { color: var(--text); background: var(--hover); }
.ve-add svg { width: 24px; height: 24px; }
.ve-hint { margin-top: .65rem; font-size: .78rem; color: var(--text-3); }
.ve-nav { display: flex; justify-content: space-between; margin-top: 1rem; }
.ve-note { padding: 1rem; font-size: .85rem; color: var(--text-3); }

.ve-concept label { display: block; margin: .6rem 0 .3rem; }
.ve-textarea {
  width: 100%; padding: .65rem .8rem;
  border: 1px solid var(--border-strong); border-radius: 8px;
  font-family: inherit; font-size: .9rem; color: var(--text);
  background: var(--surface); resize: vertical; min-height: 80px;
  transition: border-color .15s, box-shadow .15s;
}
.ve-textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px var(--focus); }
.ve-opt { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.ve-opt input[type=text] { padding: 0 .7rem; }
.ve-opt input[type=radio] { accent-color: #16A34A; flex-shrink: 0; }
.ve-concept .btn-inline { margin-top: .6rem; }

@media (max-width: 720px) {
  .ve-body { grid-template-columns: 1fr; }
  .ve-word-list { max-height: 180px; }
  .ve-slots { grid-template-columns: 1fr; }
}

/* ============================================================
   CREAR PRE COMPETENCIA — colegios como botones
   ============================================================ */
button.item-card.school-pick {
  width: 100%; text-align: left; align-items: center;
  font: inherit; color: inherit; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
button.item-card.school-pick:hover {
  border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px);
}

/* ── Pre competencia: información del colegio ── */
.pc-school { display: flex; align-items: center; gap: .85rem; margin: 1rem 0 1.25rem; }
.pc-school .avatar { width: 56px; height: 56px; }
.pc-school strong { font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; }
.pc-school .item-info { gap: .15rem; }
.pc-block { margin-bottom: 1rem; }
.pc-scroll { max-height: 320px; overflow-y: auto; }
.pc-block .table-wrap[hidden] { display: none; }
.pc-hist-filter { width: auto; min-width: 150px; height: 34px; font-size: .8rem; }
.pc-hist-scroll { max-height: 460px; overflow-y: auto; }

/* ── Historial (mismo esquema que el historial del host) ── */
.hist-day {
  font-size: .8rem; font-weight: 700; text-transform: capitalize; color: var(--success);
  padding: .3rem .6rem; background: var(--success-bg); border-left: 3px solid #22C55E;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: .6rem 0 .5rem;
}
.hist-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .65rem .85rem; margin-bottom: .5rem; transition: border-color .15s;
}
.hist-card:hover { border-color: var(--border-strong); }
.hist-top { display: flex; align-items: center; gap: .5rem; }
.hist-student { flex: 1; min-width: 0; display: flex; align-items: center; gap: .45rem; font-weight: 700; font-size: .88rem; }
.hist-badge {
  min-width: 22px; height: 22px; padding: 0 .35rem; border-radius: 6px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--purple); color: #fff; font-size: .7rem; font-weight: 700;
}
.hist-meta { font-size: .72rem; color: var(--text-3); font-weight: 600; margin: .15rem 0 .3rem; }
.hist-word { font-size: 1.3rem; font-weight: 700; color: var(--success); line-height: 1.15; overflow-wrap: anywhere; }
.hist-spell { font-size: .75rem; font-weight: 600; color: var(--text-2); margin-top: .3rem; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.hist-letters { letter-spacing: .15em; color: var(--info); font-weight: 700; overflow-wrap: anywhere; }
.hist-chip { font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: .1rem .5rem; border-radius: 10px; color: #fff; }
.hist-chip.ok { background: var(--success); }
.hist-chip.bad { background: var(--danger); }

/* ── Códigos de Precompetencia ── */
.pc-codes { display: flex; flex-direction: column; gap: .5rem; }
.pc-code-row {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .5rem .65rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.pc-code-row .codebox { height: 32px; }
.pc-code-row .codebox code { font-size: .9rem; }
.pc-code-row .cell-muted { margin-left: auto; }
.pc-code-row .icon-btn { width: 32px; height: 32px; }
.pc-code-row .icon-btn svg { width: 18px; height: 18px; }
.chk { display: flex; align-items: center; gap: .5rem; margin: 0 0 .4rem; font-size: .9rem; color: var(--text); cursor: pointer; }
.chk input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ============================================================
   PESTAÑAS "CREAR LISTAS" + TABLA "VER LISTAS"
   ============================================================ */
#clTabs .tabs-inner-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(16,24,40,0.05);
}
/* Botón Pausar/Continuar dentro de la tarjeta Duración */
.kpi-btn { height: 28px; padding: 0 .65rem; margin-top: .4rem; font-size: .74rem; align-self: flex-start; }
.kpi-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   HORARIOS DE PRE COMPETENCIA + CALENDARIO
   ============================================================ */
.pc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; margin-bottom: 1rem; }
.pc-two .pc-block { margin-bottom: 0; min-width: 0; }
@media (max-width: 900px) { .pc-two { grid-template-columns: 1fr; } }

.pc-sched { display: flex; flex-direction: column; gap: .5rem; max-height: 340px; overflow-y: auto; }
.sch-grade {
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  padding: .6rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.sch-grade:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.sch-grade-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sch-grade-top strong { font-size: .92rem; }
.sch-grade-lines { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin-top: .35rem; }
.sch-line { font-size: .76rem; color: var(--text-3); }
.sch-line.set { color: var(--text-2); font-weight: 600; }

.sch-secs { display: flex; flex-direction: column; gap: .4rem; max-height: 300px; overflow-y: auto; }
.sch-sec {
  display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; width: 100%;
  padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  font: inherit; color: var(--text); cursor: pointer; text-align: left;
  transition: background-color .12s, border-color .12s;
}
.sch-sec:hover { background: var(--hover); }
.sch-sec.active { border-color: var(--text); background: var(--hover); }
.sch-sec strong { font-size: .86rem; }
.sch-date { font-size: .74rem; color: var(--success); font-weight: 600; text-transform: capitalize; }
.sch-date.none { color: var(--text-3); font-weight: 400; }
.sch-tools { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.sch-tools .link-btn { height: 32px; }

.cal { border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; background: var(--surface); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.cal-head strong { font-size: .95rem; }
.cal-head .icon-btn { width: 32px; height: 32px; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-week span { text-align: center; font-size: .68rem; font-weight: 700; color: var(--text-3); padding: .2rem 0; }
.cal-empty { aspect-ratio: 1; }
.cal-day {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  border: 1px solid transparent; border-radius: 8px; background: none; color: var(--text);
  font: inherit; font-size: .85rem; cursor: pointer; line-height: 1.1;
  transition: background-color .12s, border-color .12s;
}
.cal-day small { font-size: .58rem; font-weight: 700; opacity: .85; }
.cal-day:hover { background: var(--hover); border-color: var(--border); }
.cal-day.today { border-color: var(--border-strong); font-weight: 700; }
.cal-day.has { background: var(--info-bg); color: var(--info); border-color: #BFDBFE; }
.cal-day.sel { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }

/* ============================================================
   RONDAS
   ============================================================ */
.rd-note {
  background: var(--info-bg); border: 1px solid #BFDBFE; color: var(--info);
  border-radius: var(--radius); padding: .75rem 1rem; font-size: .84rem; line-height: 1.5; margin-bottom: 1rem;
}
.rd-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.rd-tab {
  height: 36px; padding: 0 .95rem; border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); color: var(--text-2); font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer;
  transition: background-color .12s, color .12s, border-color .12s;
}
.rd-tab:hover { background: var(--hover); color: var(--text); }
.rd-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.rd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .9rem; }
.rd-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1rem 1.1rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: .5rem; min-width: 0;
}
.rd-card.master { border-color: #D8B4FE; background: linear-gradient(180deg, var(--purple-bg), var(--surface) 55%); }
.rd-head { display: flex; align-items: center; gap: .6rem; }
.rd-head strong { flex: 1; font-size: .98rem; }
.rd-num {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .9rem;
}
.rd-card.master .rd-num { background: var(--purple); }
.rd-sub { font-size: .78rem; color: var(--text-3); margin: 0; }
.rd-card label { margin: .3rem 0 0; }
.rd-card .error { min-height: 0; margin: 0; }
.rd-cov { margin-top: .25rem; padding-top: .6rem; border-top: 1px dashed var(--border); }
.rd-cov-title { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: .35rem; }
.rd-cov-row { display: flex; flex-wrap: wrap; gap: .3rem; }