/* =========================================================
   BITÁCORA DE ACTIVIDADES — estilos
   Sistema de temas por variables CSS + escala tipográfica
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

/* ---------- Escala de puntuación: colores fijos, NO cambian con el tema ----------
   0 -> rojo · 1 -> naranja · 2 -> amarillo · 3 -> verde clarito · 4 -> azul
   (se reparten proporcionalmente cuando una actividad vale distinto de 4) */
:root{
  --score-rojo: #d1201f;
  --score-rojo-bg: #f6c3c1;
  --score-naranja: #e0722a;
  --score-naranja-bg: #f7d9c0;
  --score-amarillo: #eab000;
  --score-amarillo-bg: #fdf0c8;
  --score-amarillo-text: #4a3400;
  --score-verde: #4fae5e;
  --score-verde-bg: #d3f0d8;
  --score-azul: #2f5fd9;
  --score-azul-bg: #d7e0fa;
  --score-sinrevisar-bg: #e8e8e8;
  --score-sinrevisar-text: #8a8a8a;

  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-s: 6px;
  --radius-m: 12px;
  --radius-l: 18px;

  /* Valores de tema por defecto (Azul). Los otros 4 temas simples se
     aplican en tiempo de ejecución desde app.js, sobrescribiendo estas
     mismas variables. */
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #e4e9f5;
  --text: #1c2333;
  --muted: #647089;
  --primary: #2f5fd9;
  --primary-text: #ffffff;
  --border: #dde3f0;
  --accent-2: #6f8bec;
}

/* ---------- Escala de tamaño de letra (5 opciones) ---------- */
html[data-fontsize="xs"]{ font-size: 13px; }
html[data-fontsize="s"]{ font-size: 14.5px; }
html[data-fontsize="m"]{ font-size: 16px; }
html[data-fontsize="l"]{ font-size: 18px; }
html[data-fontsize="xl"]{ font-size: 20.5px; }

/* ---------- Reset básico ---------- */
*, *::before, *::after{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}
button{ font-family: inherit; }
h1,h2,h3,h4{ font-family: var(--font-display); margin: 0; }
p{ margin: 0; }
:focus-visible{
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
::selection{ background: var(--primary); color: var(--primary-text); }

/* ---------- Layout general ---------- */
.app-shell{
  display: none;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
body.auth-ok .app-shell{ display: grid; }

/* ---------- Pantalla de acceso (login) ---------- */
.login-screen{
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1.5rem;
}
.login-card{
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 1.8rem 1.6rem;
  box-shadow: 0 12px 32px rgba(0,0,0,.14);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.login-brand{
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: .2rem;
}
.login-brand-mark{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: var(--radius-m);
  background: var(--primary);
  color: #ffcf3f; /* la M siempre resaltada con este color fijo */
  -webkit-text-stroke: .3px #16241f;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.login-brand strong{ font-family: var(--font-display); display:block; font-size: .98rem; }
.login-brand small{ color: var(--muted); font-size: .78rem; }
.login-title{ font-size: 1.25rem; }
.login-sub{ color: var(--muted); font-size: .88rem; }
.login-users, .login-durations{
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.login-user-btn, .login-duration-btn{
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: .8rem 1rem;
  border-radius: var(--radius-s);
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background .15s ease, transform .08s ease;
}
.login-user-btn:hover, .login-duration-btn:hover{ background: var(--primary); color: var(--primary-text); }
.login-user-btn:active, .login-duration-btn:active{ transform: scale(.98); }
.login-input{
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: .7rem .8rem;
  border-radius: var(--radius-s);
  font-size: 1rem;
  letter-spacing: .1em;
}
.login-input:focus-visible{ outline: 2px solid var(--primary); }
.login-error{ color: var(--score-rojo); font-size: .82rem; min-height: 1.1em; margin: -.4rem 0 0; }
.login-actions{ display: flex; justify-content: space-between; gap: .6rem; }
.login-btn-primary, .login-btn-secondary{
  border-radius: var(--radius-s);
  padding: .6rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
}
.login-btn-primary{ background: var(--primary); color: var(--primary-text); border-color: transparent; flex: 1; }
.login-btn-secondary{ background: transparent; color: var(--muted); }

.back-top-btn{
  position: fixed;
  top: 1rem;
  right: 1.5rem;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: .5rem .9rem;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  transition: background .15s ease, opacity .15s ease;
}
.back-top-btn:hover:not(:disabled){ background: var(--surface-2); }
.back-top-btn:disabled{
  opacity: .4;
  cursor: not-allowed;
}

.sidebar{
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand{
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .25rem .25rem .75rem;
  border-bottom: 1px solid var(--border);
}
.brand-mark{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  width: 2.3rem;
  height: 2.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-m);
  background: var(--primary);
  color: #ffcf3f; /* la M siempre resaltada con este color fijo */
  -webkit-text-stroke: .3px #16241f;
}
.brand-text{ display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong{ font-family: var(--font-display); font-size: .98rem; }
.brand-text small{ color: var(--muted); font-size: .75rem; }

.side-nav{ display: flex; flex-direction: column; gap: .35rem; }
.nav-btn{
  display: flex;
  align-items: center;
  gap: .6rem;
  background: transparent;
  border: none;
  color: var(--text);
  padding: .6rem .7rem;
  border-radius: var(--radius-s);
  cursor: pointer;
  text-align: left;
  font-size: .92rem;
  font-weight: 500;
}
.nav-btn:hover{ background: var(--surface-2); }
.nav-btn.active{ background: var(--primary); color: var(--primary-text); }
.nav-ico{ font-size: 1rem; }

.sidebar-groups{
  display: flex;
  flex-direction: column;
  gap: .2rem;
  flex: 1;
  overflow-y: auto;
}
.sidebar-groups .side-label{
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .68rem;
  color: var(--muted);
  padding: .3rem .7rem;
  margin-top: .3rem;
}
.group-link{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  background: transparent;
  border: none;
  color: var(--text);
  padding: .5rem .7rem;
  border-radius: var(--radius-s);
  cursor: pointer;
  font-size: .88rem;
  text-align: left;
}
.group-link:hover{ background: var(--surface-2); }
.group-link.active{ background: var(--surface-2); font-weight: 600; box-shadow: inset 3px 0 0 var(--primary); }
.group-count{
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--muted);
}

.sidebar-footer{
  border-top: 1px solid var(--border);
  padding-top: .75rem;
  color: var(--muted);
  font-size: .72rem;
}

.main-view{
  padding: 2rem 2.5rem 4rem;
  max-width: 1100px;
}

/* ---------- Encabezados de vista ---------- */
.view-header{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.view-eyebrow{
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: .35rem;
  display: block;
}
.view-title{ font-size: 1.6rem; font-weight: 700; }
.inline-name-input{
  display: block;
  margin-top: .3rem;
  border: none;
  border-bottom: 1px dashed var(--border);
  background: transparent;
  color: var(--muted);
  font-size: .88rem;
  font-family: var(--font-body);
  padding: .1rem 0 .3rem;
  width: 100%;
  max-width: 380px;
}
.inline-name-input:focus-visible{ outline: none; border-bottom-color: var(--primary); color: var(--text); }
.inline-name-input::placeholder{ color: var(--muted); opacity: .8; }
.view-sub{ color: var(--muted); font-size: .9rem; margin-top: .3rem; }
.header-actions{ display: flex; gap: .6rem; flex-wrap: wrap; }

.crumbs{
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: .75rem;
}
.crumbs button{
  background: none; border: none; color: var(--muted); cursor: pointer; padding: 0;
  font-size: .8rem; text-decoration: underline; text-underline-offset: 2px;
}
.crumbs button:hover{ color: var(--primary); }

/* ---------- Botones ---------- */
.btn{
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: .55rem .95rem;
  border-radius: var(--radius-s);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  transition: transform .08s ease, background .15s ease;
}
.btn:hover{ background: var(--surface-2); }
.btn:active{ transform: scale(.97); }
.btn-primary{
  background: var(--primary);
  color: var(--primary-text);
  border-color: transparent;
}
.btn-primary:hover{ background: var(--primary); filter: brightness(1.06); }
.btn-ghost{ background: transparent; border-color: transparent; }
.btn-danger{ color: var(--score-rojo); }
.btn-sm{ padding: .38rem .7rem; font-size: .78rem; }
.btn:disabled{ opacity: .45; cursor: not-allowed; }

/* ---------- Tarjetas de grupo (home) ---------- */
.group-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.group-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 1.25rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  transition: border-color .15s ease, transform .1s ease;
}
.group-card:hover{ border-color: var(--primary); transform: translateY(-2px); }
.group-card-top{ display:flex; justify-content: space-between; align-items:center; }
.group-card h3{ font-size: 1.15rem; }
.group-card-actions{ display: flex; align-items: center; gap: .35rem; }
.icon-btn{
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: .9rem;
  padding: .2rem .3rem;
  border-radius: var(--radius-s);
  line-height: 1;
}
.icon-btn:hover{ background: var(--surface-2); }
.icon-btn-danger:hover{ background: var(--score-rojo-bg); }
.group-badge{
  font-family: var(--font-mono);
  font-size: .7rem;
  background: var(--surface-2);
  padding: .2rem .5rem;
  border-radius: 999px;
  color: var(--muted);
}
.group-card-meta{ color: var(--muted); font-size: .82rem; }
.group-card-stats{ display: flex; gap: 1rem; margin-top: .3rem; }
.stat{ display: flex; flex-direction: column; }
.stat b{ font-size: 1.05rem; font-family: var(--font-mono); }
.stat span{ font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Pestañas (dentro de un grupo) ---------- */
.view-tabs{
  display: flex;
  gap: .4rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
}
.view-tab-btn{
  border: none;
  background: transparent;
  color: var(--muted);
  padding: .6rem .9rem;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.view-tab-btn:hover{ color: var(--text); }
.view-tab-btn.active{ color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Lista de actividades ---------- */
.day-list{ display: flex; flex-direction: column; gap: .5rem; }
.day-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: .85rem 1.1rem;
  cursor: pointer;
  gap: 1rem;
  flex-wrap: wrap;
}
.day-row:hover{ border-color: var(--primary); }
.day-row-left{ display: flex; align-items: center; gap: .8rem; }
.day-date{ font-family: var(--font-mono); font-weight: 600; }
.day-date small{ display:block; color: var(--muted); font-weight: 400; font-size: .72rem; }
.day-tally{ display: flex; gap: .5rem; align-items: center; }
.act-value-badge{
  font-family: var(--font-mono);
  font-size: .74rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--surface-2);
  padding: .2rem .55rem;
  border-radius: 999px;
}
.act-progress-txt{ font-size: .74rem; color: var(--muted); }

.pill{
  font-size: .72rem;
  font-family: var(--font-mono);
  padding: .15rem .5rem;
  border-radius: 999px;
  font-weight: 600;
}

.empty-state{
  border: 1px dashed var(--border);
  border-radius: var(--radius-m);
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--muted);
}
.empty-state .btn{ margin-top: 1rem; }

/* ---------- Lista de alumnos (dentro de grupo) con botón revisar ---------- */
.student-review-list{ display: flex; flex-direction: column; gap: .5rem; }
.student-review-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: .7rem 1rem;
  flex-wrap: wrap;
}
.student-review-left{ display:flex; align-items:center; gap:.7rem; cursor:pointer; flex: 1; min-width: 160px; }
.student-review-left:hover .student-review-name{ color: var(--primary); }
.student-review-num{ font-family: var(--font-mono); color: var(--muted); font-size: .8rem; min-width: 1.6rem; }
.student-review-name{ font-weight: 600; font-size: .92rem; }
.student-review-progress{ font-size: .74rem; color: var(--muted); }
.student-review-right{ display:flex; align-items:center; gap:.8rem; }
.student-review-total{ font-family: var(--font-mono); font-weight: 700; }
.student-review-total small{ font-weight: 400; font-size: .68rem; color: var(--muted); }

/* ---------- Grilla de calificación de una actividad ---------- */
.grade-grid{ display: flex; flex-direction: column; gap: .5rem; }
.grade-row{
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: .7rem 1rem;
  flex-wrap: wrap;
}
.grade-row-name{ flex: 1; min-width: 160px; font-weight: 600; font-size: .9rem; display:flex; align-items:center; gap:.6rem;}
.grade-num-input{
  width: 5.2rem;
  padding: .5rem .6rem;
  border-radius: var(--radius-s);
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 700;
  text-align: center;
  font-size: .95rem;
}
.grade-num-input.score-rojo{ background: var(--score-rojo-bg); border-color: var(--score-rojo); color: var(--score-rojo); }
.grade-num-input.score-naranja{ background: var(--score-naranja-bg); border-color: var(--score-naranja); color: var(--score-naranja); }
.grade-num-input.score-amarillo{ background: var(--score-amarillo-bg); border-color: var(--score-amarillo); color: var(--score-amarillo-text); }
.grade-num-input.score-verde{ background: var(--score-verde-bg); border-color: var(--score-verde); color: var(--score-verde); }
.grade-num-input.score-azul{ background: var(--score-azul-bg); border-color: var(--score-azul); color: var(--score-azul); }
.grade-num-input.score-sinrevisar{ background: var(--score-sinrevisar-bg); border-color: var(--border); color: var(--score-sinrevisar-text); }
.grade-max-label{ font-size: .74rem; color: var(--muted); font-family: var(--font-mono); }

/* ---------- Legend (escala de colores) ---------- */
.legend{
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding: .9rem 1.1rem;
  background: var(--surface-2);
  border-radius: var(--radius-m);
  font-size: .78rem;
  color: var(--muted);
}
.legend-item{ display: flex; align-items: center; gap: .4rem; }
.legend-dot{ width: .8rem; height: .8rem; border-radius: 50%; }

/* ---------- Resumen de grupo (tabla) ---------- */
.table-wrap{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  overflow-x: auto;
}
table.summary{
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
table.summary th, table.summary td{
  padding: .7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.summary th{
  background: var(--surface-2);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
table.summary tbody tr{ cursor: pointer; }
table.summary tbody tr:hover{ background: var(--surface-2); }
table.summary tbody tr:last-child td{ border-bottom: none; }
.rank{ font-family: var(--font-mono); color: var(--muted); }
.avg-cell{ font-family: var(--font-mono); font-weight: 700; }
.bar-cell{ display:flex; align-items:center; gap:.6rem; }
.bar-track{ flex:1; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; min-width: 60px;}
.bar-fill{ height: 100%; background: var(--primary); }
.faltan-cell{ font-family: var(--font-mono); color: var(--muted); }

/* ---------- Resumen por alumno ---------- */
.student-header{
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.student-avatar{
  width: 3rem; height: 3rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-text);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
}
.student-header-stats{ display: flex; gap: 1.5rem; margin-left: auto; }

.incident-list{ display: flex; flex-direction: column; gap: .6rem; }
.incident-row{
  display: flex;
  gap: 1rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--border);
  border-radius: var(--radius-s);
  padding: .8rem 1rem;
  cursor: pointer;
  flex-wrap: wrap;
}
.incident-row.i-rojo{ border-left-color: var(--score-rojo); }
.incident-row.i-naranja{ border-left-color: var(--score-naranja); }
.incident-row.i-amarillo{ border-left-color: var(--score-amarillo); }
.incident-row.i-verde{ border-left-color: var(--score-verde); }
.incident-row.i-azul{ border-left-color: var(--score-azul); }
.incident-row.i-sinrevisar{ border-left-color: var(--border); opacity: .75; }
.incident-date{ font-family: var(--font-mono); font-size: .78rem; color: var(--muted); min-width: 92px; }
.incident-date small{ display: block; font-family: var(--font-body); font-size: .7rem; margin-top: .15rem; color: var(--muted); }
.incident-nota{
  margin-top: .35rem;
  font-size: .78rem;
  font-style: italic;
  color: var(--muted);
}
.itag{
  font-size: .74rem;
  padding: .18rem .55rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-weight: 700;
  font-family: var(--font-mono);
}
.itag.i-rojo{ background: var(--score-rojo-bg); color: var(--score-rojo); }
.itag.i-naranja{ background: var(--score-naranja-bg); color: var(--score-naranja); }
.itag.i-amarillo{ background: var(--score-amarillo-bg); color: var(--score-amarillo-text); }
.itag.i-verde{ background: var(--score-verde-bg); color: var(--score-verde); }
.itag.i-azul{ background: var(--score-azul-bg); color: var(--score-azul); }
.itag.i-sinrevisar{ background: var(--score-sinrevisar-bg); color: var(--score-sinrevisar-text); }

/* ---------- Configuración ---------- */
.config-section{
  margin-bottom: 2rem;
}
.config-section h3{ margin-bottom: .3rem; }
.config-section .view-sub{ margin-bottom: 1rem; }

.theme-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .9rem;
}
.theme-card{
  border: 2px solid var(--border);
  border-radius: var(--radius-m);
  padding: .8rem;
  cursor: pointer;
  background: var(--surface);
}
.theme-card.selected{ border-color: var(--primary); }
.theme-swatch{
  display: flex;
  height: 2.2rem;
  border-radius: var(--radius-s);
  overflow: hidden;
  margin-bottom: .6rem;
}
.theme-swatch span{ flex: 1; }
.theme-card b{ font-size: .82rem; }

.fontsize-grid{ display: flex; gap: .7rem; flex-wrap: wrap; }
.fontsize-card{
  border: 2px solid var(--border);
  border-radius: var(--radius-m);
  padding: .8rem 1.1rem;
  cursor: pointer;
  background: var(--surface);
  text-align: center;
}
.fontsize-card.selected{ border-color: var(--primary); }
.fontsize-card .fs-preview{ font-family: var(--font-display); font-weight: 700; }
.fontsize-card small{ display:block; color: var(--muted); margin-top:.2rem; font-size: .68rem; }

.config-text-input{
  width: 100%;
  max-width: 360px;
  padding: .6rem .8rem;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
}
.config-text-input:focus-visible{ outline: 2px solid var(--primary); outline-offset: 2px; }

.config-select{
  width: 100%;
  padding: .6rem .7rem;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  margin-bottom: 1.1rem;
  cursor: pointer;
}
.config-select:focus-visible{ outline: 2px solid var(--primary); outline-offset: 2px; }

.modal-wide{ max-width: 560px; }
.modal-wide .theme-grid{ max-height: 46vh; overflow-y: auto; padding-right: .2rem; margin-bottom: .5rem; }

/* ---------- Fecha con botón de calendario ---------- */
.date-field-row{ display: flex; gap: .5rem; align-items: stretch; }
.date-field-row input[type="date"]{ flex: 1; margin-bottom: 0; }
.date-field-row input[type="date"]::-webkit-calendar-picker-indicator{
  display: none;
  -webkit-appearance: none;
}
.date-cal-btn{ flex-shrink: 0; margin-bottom: 1rem; }

/* ---------- Nueva actividad: modo simple / varios grupos ---------- */
.modo-clase-row{
  display: flex;
  gap: 1.2rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.modo-clase-opt{
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  cursor: pointer;
}
.modo-clase-opt input[type="radio"]{ accent-color: var(--primary); cursor: pointer; }
.multi-clase-list{
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding: .6rem .7rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  margin-bottom: 1rem;
}
.multi-clase-row{
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
}
.multi-clase-row .date-field-row{ flex: 1; min-width: 180px; }
.multi-clase-row .date-field-row input[type="date"]{ margin-bottom: 0; }
.multi-clase-check{
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  min-width: 120px;
  cursor: pointer;
}
.multi-clase-check input[type="checkbox"]{ width: 1rem; height: 1rem; cursor: pointer; accent-color: var(--primary); }

.modal input[type="number"]{
  width: 100%;
  padding: .6rem .7rem;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: .9rem;
  margin-bottom: 1rem;
}
.modal textarea{
  width: 100%;
  padding: .6rem .7rem;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: .88rem;
  font-family: var(--font-body);
  margin-bottom: 1rem;
  resize: vertical;
}

/* ---------- Importar / Exportar Excel ---------- */
.excel-preview{ margin: .8rem 0 1rem; }
.excel-preview-list{ margin: .5rem 0 0; padding-left: 1.2rem; font-size: .82rem; color: var(--muted); }
.excel-preview-list li{ margin-bottom: .15rem; }
.excel-col-field{ margin-bottom: 1rem; }
.excel-col-field:last-child{ margin-bottom: 0; }

/* ---------- Botones de acciones destructivas ---------- */
.danger-btn-row{ display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---------- Orden del resumen de grupo ---------- */
.sort-row{
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.sort-label{ font-size: .78rem; color: var(--muted); margin-right: .2rem; }
.sort-btn{
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: .35rem .75rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
}
.sort-btn:hover{ background: var(--surface-2); }
.sort-btn.active{ background: var(--primary); color: var(--primary-text); border-color: transparent; }

/* ---------- Reporte PDF: selección de grupos ---------- */
.reporte-group-list{
  display: flex;
  flex-direction: column;
  gap: .4rem;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding: .6rem .8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
}
.reporte-group-item{
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .88rem;
  cursor: pointer;
}
.reporte-group-item input[type="checkbox"]{ width: 1rem; height: 1rem; cursor: pointer; accent-color: var(--primary); }

/* ---------- Administrar alumnos ---------- */
.alumnos-manage-list{
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: 1rem;
}
.alumno-manage-row{
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface);
}
.alumno-manage-num{ font-family: var(--font-mono); font-size: .78rem; color: var(--muted); min-width: 1.6rem; }
.alumno-manage-nombre{ flex: 1; font-size: .9rem; }

/* ---------- Modal de revisión secuencial ---------- */
.revisar-progress{
  font-family: var(--font-mono);
  font-size: .74rem;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: .3rem;
  display: block;
}
.revisar-progress-track{
  height: 5px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.revisar-progress-fill{ height: 100%; background: var(--primary); transition: width .18s ease; }
.revisar-act-nombre{ font-size: 1.05rem; font-weight: 700; margin-bottom: .2rem; }
.revisar-act-meta{ font-size: .78rem; color: var(--muted); margin-bottom: .2rem; }
.revisar-act-comentario{ font-size: .82rem; color: var(--muted); font-style: italic; margin-bottom: 1rem; }
.revisar-input-row{ display: flex; align-items: center; gap: .6rem; margin-bottom: .4rem; }
.revisar-input-row input[type="number"]{ margin-bottom: 0; font-size: 1.3rem; font-weight: 700; text-align: center; font-family: var(--font-mono); }
.revisar-quick-btns{ display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.revisar-quick-btn{
  flex: 1;
  min-width: 2.6rem;
  border: 2px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-s);
  padding: .45rem .3rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 700;
  text-align: center;
}
.revisar-quick-btn:hover{ border-color: var(--primary); }
.revisar-actions-row{ display:flex; justify-content: space-between; gap: .6rem; margin-top: .4rem; }

/* ---------- Modal ---------- */
.modal-overlay{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 1rem;
}
.modal{
  background: var(--surface);
  border-radius: var(--radius-l);
  padding: 1.5rem;
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--border);
}
.modal h3{ margin-bottom: .3rem; }
.modal .view-sub{ margin-bottom: 1rem; }
.modal-field-label{
  display: block;
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .3rem;
}
.modal input[type="date"], .modal input[type="text"]{
  width: 100%;
  padding: .6rem .7rem;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: .9rem;
  margin-bottom: 1rem;
}
.modal-actions{ display: flex; justify-content: flex-end; gap: .6rem; }

/* ---------- Toast ---------- */
.toast{
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  padding: .8rem 1.1rem;
  border-radius: var(--radius-s);
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  font-size: .85rem;
  z-index: 100;
  animation: toast-in .18s ease;
}
@keyframes toast-in{ from{ opacity:0; transform: translateY(8px);} to{opacity:1; transform:none;} }

/* ---------- Responsive ---------- */
@media (max-width: 900px){
  .back-top-btn{ top: .6rem; right: .6rem; padding: .4rem .6rem; font-size: 0; gap: 0; }
  .back-top-btn span{ font-size: 1rem; }
  .app-shell{ grid-template-columns: 1fr; }
  .sidebar{
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    max-height: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1rem;
    padding: .85rem 1rem;
  }
  .brand{ border-bottom: none; padding: 0; }
  .side-nav{ flex-direction: row; }
  .sidebar-groups{
    order: 3;
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    gap: .4rem;
    padding-top: .4rem;
    border-top: 1px solid var(--border);
  }
  .sidebar-groups .side-label{ display: none; }
  .group-link{ white-space: nowrap; }
  .group-link.active{ box-shadow: none; background: var(--primary); color: var(--primary-text); }
  .sidebar-footer{ display: none; }
  .main-view{ padding: 1.5rem 1.5rem 3rem; max-width: 100%; }
}

@media (max-width: 560px){
  .main-view{ padding: 1.1rem .9rem 3rem; }
  .view-title{ font-size: 1.3rem; }
  .view-header{ flex-direction: column; align-items: stretch; }
  .header-actions{ width: 100%; }
  .header-actions .btn{ flex: 1; justify-content: center; }
  .group-grid{ grid-template-columns: 1fr; }
  .day-row{ flex-direction: column; align-items: flex-start; gap: .6rem; }
  .student-header{ flex-direction: column; align-items: flex-start; }
  .student-header-stats{ margin-left: 0; width: 100%; justify-content: space-between; }
  table.summary{ font-size: .8rem; }
  table.summary th, table.summary td{ padding: .55rem .6rem; }
  .theme-grid{ grid-template-columns: repeat(2, 1fr); }
  .fontsize-grid{ justify-content: space-between; }
  .fontsize-card{ flex: 1; padding: .7rem .5rem; }
  .modal{ max-width: 100%; }
}

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