:root {
  --bg: #eef4fb;
  --panel: #ffffff;
  --text: #243758;
  --muted: #6f7e97;
  --line: #dce4f1;
  --blue: #2f80ed;
  --blue-dark: #255fc2;
  --green: #29a36a;
  --green-bg: #e7f7ee;
  --orange: #ee9b32;
  --orange-bg: #fff3df;
  --red: #de6a64;
  --red-bg: #fdeaea;
  --purple: #7e68db;
  --shadow: 0 18px 40px rgba(35, 55, 88, .06);
  --radius: 22px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(180deg, #eef4fb 0%, #f7f9fd 100%);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 230px 1fr;
}
.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px 24px;
}
.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #ffcf56, #2f80ed 58%, #47c27c);
}
.brand-title { font-weight: 800; font-size: 20px; line-height: 1; }
.brand-subtitle { color: var(--blue); font-weight: 700; margin-top: 2px; }
.sidebar-nav { display: grid; gap: 2px; padding: 0 8px; }
.nav-link {
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  display: block;
  box-sizing: border-box;
}
.nav-link.active {
  background: #2563EB;
  color: #fff;
}
.nav-link:hover:not(.active) {
  background: rgba(37,99,235,0.08);
  color: #2563EB;
}
.main-layout { padding: 20px 22px 32px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0 0 16px;
}
.topbar-right { display: flex; gap: 12px; align-items: center; margin-left: auto; }
.menu-toggle {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  width: 42px;
  height: 42px;
  border-radius: 12px;
}
.user-pill {
  display: flex;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
}
.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #ffb870, #2f80ed);
}
.user-avatar.small { width: 34px; height: 34px; font-size: 14px; }
.tiny { font-size: 12px; }
.muted { color: var(--muted); }

.hero-bar, .page-heading, .student-top-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-bar {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 110px;
  margin-bottom: 18px;
}
.hero-title-wrap h1, .page-heading h1, .student-top-card h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); }
.hero-illustration { font-size: 60px; }
.breadcrumbs { color: var(--muted); margin-bottom: 8px; font-size: 14px; }
.bar-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-heading { padding: 18px 22px; margin-bottom: 18px; }

.stats-grid { display: grid; gap: 16px; margin-bottom: 18px; }
.stats-4 { grid-template-columns: repeat(4, 1fr); }
.students-mini-stats { grid-template-columns: repeat(3, 1fr); }
.stat-card, .mini-stat {
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-card { color: #fff; }
.stat-card span, .mini-stat span { display: block; opacity: .95; }
.stat-card strong, .mini-stat strong { display: block; margin-top: 8px; font-size: 34px; line-height: 1.1; white-space: pre-line; }
.blue { background: linear-gradient(135deg, #3490ff, #2d71d7); }
.orange { background: linear-gradient(135deg, #ffb14f, #ec8f1b); }
.green { background: linear-gradient(135deg, #39b978, #178956); }
.purple { background: linear-gradient(135deg, #8c79ee, #6b56db); }
.mini-stat { background: #fff; border: 1px solid var(--line); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.soft-card { min-height: 100%; }
.card-head, .panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h2, .panel-head h2 { margin: 0; font-size: 20px; }
.panel-head-spaced { margin-top: 22px; }
.dots { color: var(--muted); letter-spacing: 2px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.3fr 1.05fr .9fr;
  gap: 18px;
  align-items: start;
}
.right-column-stack, .aside-stack { display: grid; gap: 18px; }
.list-stack { display: grid; gap: 12px; }
.list-person-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 16px;
  background: #f8fbff;
  border: 1px solid var(--line);
}
.person-inline { display: flex; gap: 12px; align-items: center; min-width: 0; }
.avatar-photo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #dbe8fb, #f7fbff);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--blue);
  flex: 0 0 auto;
}
.avatar-photo.small { width: 38px; height: 38px; }
.avatar-photo.xl { width: 96px; height: 96px; font-size: 32px; }
.avatar-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.menu-day-list { display: grid; gap: 14px; margin-bottom: 18px; }
.menu-photo-placeholder {
  display: grid;
  place-items: center;
  min-height: 230px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: radial-gradient(circle at top, #fff 0%, #f3f7fd 100%);
  font-size: 90px;
}
.notice-list { display: grid; gap: 14px; }
.notice-item {
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
}
.notice-item:last-child { border-bottom: 0; padding-bottom: 0; }
.calendar-mini-actions { color: var(--muted); }
.calendar-title { text-align: center; font-weight: 700; margin-bottom: 12px; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.calendar-grid span {
  min-height: 34px;
  display: grid;
  place-items: center;
  color: var(--text);
}
.weekdays span { color: var(--muted); font-size: 12px; font-weight: 700; }
.day.current {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  margin: 0 auto;
}

.filters-panel { margin-bottom: 18px; }
.filters-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 14px;
  align-items: end;
}
.predictive-wrap { position: relative; }
.suggestions {
  position: absolute;
  inset: auto 0 auto 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 20;
  display: none;
  overflow: hidden;
}
.suggestions.show { display: block; }
.suggestion-item {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.suggestion-item:last-child { border-bottom: 0; }
.suggestion-item:hover { background: #f5f9ff; }

.table-scroll { width: 100%; overflow: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table th, .table td {
  padding: 14px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.table thead th { color: var(--muted); border-top: none; font-size: 13px; text-transform: uppercase; letter-spacing: .02em; }
.students-table strong { display: block; }
.table-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.students-cards-grid { display: none; }
.card-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }

.student-top-card {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 18px;
}
.student-top-main { display: flex; gap: 18px; align-items: center; }
.student-meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); margin-top: 10px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tab {
  padding: 12px 16px;
  border-radius: 14px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 600;
}
.tab.active { color: #fff; background: linear-gradient(135deg, var(--blue), var(--blue-dark)); border-color: transparent; }
.detail-grid {
  display: grid;
  grid-template-columns: 1.7fr .85fr;
  gap: 18px;
  align-items: start;
}
.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.kv-grid div {
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 6px;
}
.kv-grid .full { grid-column: 1 / -1; }
.doc-list { display: grid; gap: 10px; margin-top: 12px; }
.doc-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbff;
}
.summary-list { display: grid; gap: 14px; }
.summary-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.summary-list div:last-child { border-bottom: 0; padding-bottom: 0; }

.form-layout { display: grid; gap: 18px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.form-grid.single-col { grid-template-columns: 1fr; }
.form-grid .full { grid-column: 1 / -1; }
label { display: grid; gap: 8px; font-weight: 600; }
input[type=text], input[type=password], input[type=email], input[type=date], textarea, input[type=file], select {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #cdd8e7;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; }
.sticky-actions {
  position: sticky;
  bottom: 10px;
  padding: 14px 18px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.upload-form { display: grid; gap: 12px; }

.list-editor { display: grid; gap: 12px; margin-bottom: 16px; }
.list-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: center;
}
.row-label { font-weight: 700; }
.segmented { display: flex; flex-wrap: wrap; gap: 10px; }
.seg-btn {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.seg-btn.active[data-value='Bien'] { background: var(--green-bg); color: var(--green); border-color: #b5e3ca; }
.seg-btn.active[data-value='Regular'] { background: var(--orange-bg); color: var(--orange); border-color: #f2d18d; }
.seg-btn.active[data-value='Mal'] { background: var(--red-bg); color: var(--red); border-color: #f0b4b2; }
.day-list-card { margin-top: 14px; }
.day-head { font-weight: 800; font-size: 22px; margin-bottom: 12px; }
.day-list { display: grid; gap: 10px; }
.day-item { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.note-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 14px; }

/* .status, .btn-* — definiciones canónicas se encuentran más abajo (líneas ~580 y ~504) */
.flash-stack { display: grid; gap: 8px; margin-bottom: 12px; }
.flash { padding: 12px 14px; border-radius: 14px; font-weight: 600; }
.flash.success { background: var(--green-bg); color: var(--green); }
.flash.error { background: var(--red-bg); color: #a33434; }
.demo-box {
  margin-top: 16px;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}
.auth-card {
  width: min(520px, 100%);
  padding: 30px;
  background: #fff;
  border-radius: 28px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.auth-brand { justify-content: center; padding-top: 0; }

@media (max-width: 1180px) {
  .dashboard-grid, .detail-grid, .filters-grid, .form-grid, .stats-4 { grid-template-columns: 1fr; }
  .students-mini-stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    z-index: 30;
    width: 230px;
    transition: left .2s ease;
  }
  .sidebar.open { left: 0; }
  .main-layout { padding: 16px; }
  .menu-toggle { display: inline-grid; place-items: center; }
  .stats-4, .students-mini-stats, .kv-grid { grid-template-columns: 1fr; }
  .student-top-card, .student-top-main, .bar-between { flex-direction: column; align-items: flex-start; }
  .list-row { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .responsive-table-panel { display: none; }
  .students-cards-grid { display: grid; gap: 14px; }
  .card-meta-grid { grid-template-columns: 1fr; }
  .calendar-grid { gap: 4px; }
  .hero-bar { padding: 18px; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .tabs { overflow: auto; padding-bottom: 4px; }
  .tab { white-space: nowrap; }
  .note-footer, .form-actions { flex-direction: column; align-items: stretch; }
}

.btn { border: 0; border-radius: 14px; padding: 11px 16px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-sm { padding: 8px 12px; border-radius: 10px; font-size: 13px; }
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--blue-dark)); color: #fff; }
.btn-outline { background: #fff; border: 1px solid var(--line); color: var(--text); }
.btn-outline-success { background: #fff; border: 1px solid #C0DD97; color: #16A34A; font-weight: 700; }
.btn-outline-success:hover { background: #EAF3DE; border-color: #97C459; }
.btn-danger { background: linear-gradient(135deg, #ef7a73, #d85851); color: #fff; }
.btn-warning { background: linear-gradient(135deg, #ffd35d, #efb12a); color: #5f4300; }
.btn-block { width: 100%; }
.flash-stack { display: grid; gap: 12px; margin-bottom: 16px; }
.flash { padding: 14px 16px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.flash.success { background: #eaf8f0; border-color: #cdeedb; }
.flash.error { background: #fff0ef; border-color: #ffd8d4; }
label { display: grid; gap: 8px; color: var(--text); font-weight: 600; }
input, select, textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--text); }
textarea { resize: vertical; }
.form-layout { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.two-col-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.three-col-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tutor-stack { display: grid; gap: 16px; }

/* ── Bloque de tutor en el formulario ──
   Cada tutor se compone de 3 filas:
     1) Identidad: tipo (compacto) + nombre (toma todo el resto)
     2) Contacto: DNI · teléfono · email (3 columnas equilibradas)
     3) Flags: checkboxes de "tutor principal" y "autorizado para recoger"
   El borde inferior separa visualmente cada tutor del siguiente. */
.tutor-row { display: flex; flex-direction: column; gap: 12px; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.tutor-row:last-child { border-bottom: none; }
.tutor-row-line { display: grid; gap: 12px; align-items: end; }
.tutor-row-line label { margin: 0; }

/* Fila 1: Tipo (160px) + Nombre (lo que sobre). El nombre debe tener anchura cómoda. */
.tutor-row-identity { grid-template-columns: 160px 1fr; }

/* Fila 2: DNI · Teléfono · Email a partes iguales. El DNI no necesita más que los otros. */
.tutor-row-contact { grid-template-columns: 1fr 1fr 1fr; }

/* Fila 3: checkboxes en línea, alineados a la izquierda con separación generosa. */
.tutor-row-flags { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.tutor-row-flags > label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

/* Responsive: en pantallas medias (~1100px) la fila identidad sigue, contacto se apila a 2x. */
@media (max-width: 1100px) {
  .tutor-row-contact { grid-template-columns: 1fr 1fr; }
  .tutor-row-contact .tutor-field-email { grid-column: 1 / -1; }
}

/* Móvil: todo apilado en una columna. */
@media (max-width: 700px) {
  .tutor-row-identity,
  .tutor-row-contact { grid-template-columns: 1fr; }
}

.tutor-list-detail { display: grid; gap: 10px; }
.tutor-detail-item { display: grid; grid-template-columns: 140px 1fr 1fr 1fr; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #f9fbff; }

/* ── Tarjetas de tutor en la ficha del alumno ──
   Reemplaza la cuadrícula tutor-detail-item con una caja apilada que destaca
   el nombre y muestra DNI + datos de contacto en una segunda línea. */
.tutor-cards-detail { display: grid; gap: 10px; }
.tutor-card-detail { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.tutor-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.tutor-card-role { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #64748B; }
.tutor-pickup-badge { font-size: 10px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #EAF3DE; color: #27500A; white-space: nowrap; }
.tutor-pickup-badge.tutor-pickup-no { background: #FCEBEB; color: #A32D2D; }
.tutor-card-name { font-size: 14px; font-weight: 600; color: #1E293B; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tutor-primary-badge { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #E6F1FB; color: #0C447C; }
.tutor-card-data { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: #475569; margin-top: 5px; }
.tutor-card-sep { color: #CBD5E1; }
.tutor-card-dni { display: inline-flex; align-items: center; gap: 6px; }
.tutor-card-dni-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #94A3B8; }
.tutor-card-dni-val { font-family: ui-monospace, SFMono-Regular, Menon, Menlo, Consolas, monospace; font-size: 12px; color: #1E293B; letter-spacing: 0.02em; }
.tutor-card-dni-missing { font-size: 11px; color: #94A3B8; font-style: italic; }

/* Checkbox pickup en el form (alineado con el primary check). */
.tutor-pickup-check { font-size: 12px; color: #475569; }
.tutor-pickup-check input[type="checkbox"] { accent-color: #16A34A; }
.status { display: inline-flex; align-items: center; justify-content: center; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status.success { background: var(--green-bg); color: var(--green); }
.status.warning { background: var(--orange-bg); color: var(--orange); }
.status.danger { background: var(--red-bg); color: var(--red); }
.status.info { background: #e8f0ff; color: var(--blue); }
.kv-grid div { display: grid; gap: 6px; padding: 12px; background: #f9fbff; border: 1px solid var(--line); border-radius: 14px; }
.kv-grid div strong { font-size: 13px; }
.kv-grid div span { color: var(--muted); }
.kv-grid .full { grid-column: 1 / -1; }
.summary-list { display: grid; gap: 12px; }
.summary-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.summary-list > div:last-child { border-bottom: 0; }
.doc-list { display: grid; gap: 10px; margin-top: 14px; }
.doc-card { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #f8fbff; }
.detail-grid-wide { grid-template-columns: 1.45fr .7fr; }
.note-form { display: grid; gap: 14px; }
.list-editor { display: grid; gap: 14px; }
.list-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; }
.row-label { font-weight: 700; }
.segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 10px 16px; cursor: pointer; font-weight: 700; }
.seg-btn.active { background: linear-gradient(135deg, var(--blue), var(--blue-dark)); color: #fff; border-color: transparent; }
input[type='hidden'] { display: none; }
.day-list-card { display: grid; gap: 12px; }
.compact-head { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.record-summary-line { color: var(--text); line-height: 1.5; }
.compact-grid { margin-top: 6px; }
.day-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fafcff; }
.note-footer { display: grid; gap: 8px; color: var(--muted); }
.sticky-actions { position: sticky; bottom: 14px; background: rgba(247,249,253,.92); backdrop-filter: blur(8px); padding: 12px; border-radius: 18px; border: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 12px; }
.single-col { grid-template-columns: 1fr; }

@media (max-width: 1080px) {
  .dashboard-grid, .detail-grid, .detail-grid-wide { grid-template-columns: 1fr; }
  .tutor-row, .tutor-detail-item, .filters-grid, .form-grid, .two-col-grid, .three-col-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -280px; width: 260px; z-index: 40; transition: left .2s ease; }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-grid; place-items: center; }
  .main-layout { padding: 16px; }
  .stats-4, .students-mini-stats { grid-template-columns: 1fr 1fr; }
  .student-top-card, .bar-between { flex-direction: column; align-items: stretch; }
  .table { min-width: 680px; }
}

@media (max-width: 560px) {
  .stats-4, .students-mini-stats { grid-template-columns: 1fr; }
  .list-row { grid-template-columns: 1fr; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .user-pill strong { font-size: 14px; }
}

.error-panel { border-color: #ffd8d4; background: #fff7f6; }
.error-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; color: #a33434; }
.panel-head-wrap { flex-wrap: wrap; }
.tutor-dynamic-row.is-hidden { display: none; }
.student-mobile-card { display: grid; gap: 14px; }
.doc-card .table-actions form { margin: 0; }
@media (max-width: 760px) { .responsive-table-panel { display:none; } .students-cards-grid { display:grid; gap:14px; } .student-mobile-card { border:1px solid var(--line); } }

.sortable{user-select:none;white-space:nowrap;}
.sortable:hover{color:#1d4ed8;}
.compact-head .table-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}

.mass-register-shell {
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}
.mass-register-top {
  grid-template-columns: 1.6fr 1fr auto;
}
.mass-register-panel,
.mass-save-bar {
  box-shadow: 0 16px 32px rgba(31, 50, 91, 0.08);
}
.enhanced-mass-table th {
  white-space: nowrap;
}
.enhanced-mass-table td {
  min-width: 180px;
}
.mass-student-col {
  min-width: 240px !important;
}
.mass-detail-col {
  min-width: 190px !important;
}
.detail-summary {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.choice-group.compact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.choice-btn {
  border: 1px solid #cfdbeb;
  background: #ffffff;
  color: #26446f;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: .18s ease;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}
.choice-btn:hover {
  transform: translateY(-1px);
  border-color: #9eb9de;
}
.choice-btn.active.tone-good {
  background: var(--green-bg);
  color: var(--green);
  border-color: #b9e2c9;
}
.choice-btn.active.tone-warn {
  background: var(--orange-bg);
  color: var(--orange);
  border-color: #efd08f;
}
.choice-btn.active.tone-danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: #efbebd;
}
.choice-btn.active.tone-neutral {
  background: #edf2fb;
  color: #234778;
  border-color: #b8cbeb;
}
.mass-card-head {
  margin-bottom: 12px;
}
.mass-card-grid {
  display: grid;
  gap: 12px;
}
.mass-card-foot {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}
.modal-shell[hidden] { display: none; }
.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 60;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 31, 53, 0.48);
}
.modal-card {
  position: relative;
  max-width: 760px;
  margin: 4vh auto;
  background: #fff;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 28px 60px rgba(14, 30, 58, 0.28);
  max-height: 92vh;
  overflow: auto;
}
.modal-head {
  margin-bottom: 18px;
}
.mass-modal-grid {
  margin-bottom: 18px;
}
.modal-open {
  overflow: hidden;
}
.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
}
.mass-save-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}
@media (max-width: 1100px) {
  .mass-register-top {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 900px) {
  .desktop-mass-view { display: none; }
  .enhanced-mobile-mass { display: grid; }
  .mass-save-bar {
    flex-direction: column;
    align-items: stretch;
  }
}
@media (min-width: 901px) {
  .enhanced-mobile-mass { display: none; }
}


/* Mass register pro */
.mass-register-stats-4 { grid-template-columns: repeat(4, 1fr); }
.choice-stack { display: flex; flex-direction: column; gap: 8px; min-width: 112px; }
.choice-block { width: 100%; justify-content: center; text-align: center; padding: 8px 10px; }
.choice-btn.tone-good { background: var(--green-bg); border-color: #9edab8; color: #146540; }
.choice-btn.tone-warn { background: var(--orange-bg); border-color: #f3c67c; color: #8c5a0a; }
.choice-btn.tone-danger { background: var(--red-bg); border-color: #f0a8a2; color: #8f2f2a; }
.mass-detail-col { min-width: 180px; }
.detail-summary { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.duplicate-panel { border: 1px solid #f3c67c; background: #fff9ef; margin-bottom: 18px; }
/* Pequeña animación de atención cuando aparece el aviso de duplicados.
   Pulso suave del borde para que el usuario lo identifique al instante
   tras el scroll automático. */
@keyframes duplicate-panel-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(243, 198, 124, 0); }
  30% { box-shadow: 0 0 0 6px rgba(243, 198, 124, 0.55); }
}
.duplicate-panel-attention {
  animation: duplicate-panel-pulse 1.4s ease-in-out;
}
.duplicate-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mass-save-bar { position: sticky; bottom: 16px; z-index: 3; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); }
.modal-open { overflow: hidden; }
.modal-shell[hidden] { display: none; }
.modal-shell { position: fixed; inset: 0; z-index: 200; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(26, 35, 52, .5); }
.modal-card { position: relative; width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; margin: 12px auto; background: #fff; border-radius: 24px; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 22px; }
.mass-modal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mass-modal-grid .full { grid-column: 1 / -1; }
.mass-register-top { align-items: end; }
.mass-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.mass-card-foot { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.history-table .table-actions { display: flex; gap: 8px; align-items: center; }
.notes-timeline { display: grid; gap: 14px; margin-top: 14px; }
/* ── Tarjetas de seguimiento diario (note-badge) ──
   Rediseño visual conservando el mismo HTML.
   Cada badge tiene:
     - Icono SVG decorativo (vía ::before) según el campo (Comida, Sueño, etc)
     - Label arriba pequeña en mayúsculas suaves
     - Valor grande y resaltado
     - Subtítulo pequeño (horas, cantidades) si aplica
   El color de fondo viene de las clases badge-good/warn/danger/neutral
   y el icono usa el color del texto del propio badge para mantener coherencia. */

.note-card-v2 { display: grid; gap: 14px; }

/* Tarjeta de seguimiento "virtual": cuando un día solo tiene quick_events
   (registros del FAB) sin daily_note tradicional, mostramos una versión
   más ligera con un fondo sutil y un badge identificativo. */
.note-card-virtual { background: #FAFBFC; border-color: #E2E8F0; }
.note-virtual-tag {
  display: inline-block;
  background: #DCFCE7;
  color: #15803D;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 6px;
  vertical-align: middle;
}
.note-virtual-tag.med {
  background: #FFE4F1;
  color: #BE185D;
}

/* Campos del form de seguimiento que están "bloqueados" porque sus valores
   vienen del FAB. Se muestran como un badge no-editable con botón "Editar"
   al lado para que la educadora pueda decidir cambiar el valor si quiere
   (por ejemplo, si se equivocó al marcarlo en el FAB). */
.note-field-locked-display {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding: 4px 0;
}
.note-field-locked-badge {
  background: #DCFCE7;
  color: #15803D;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 6px;
  border: 0.5px solid #86EFAC;
}
.note-field-locked-count {
  font-size: 11px;
  color: #475569;
  font-weight: 500;
}
.note-field-locked-note {
  font-size: 10px;
  color: #94A3B8;
  font-style: italic;
}
.note-field-edit-btn {
  margin-left: auto;
  cursor: pointer;
}
/* Cuando el usuario pulsa "Editar", la fila pasa a estar en modo edición:
   ocultamos el display bloqueado y mostramos los radios. */
.note-field-locked.is-editing .note-field-locked-display { display: none; }
.note-field-locked.is-editing .note-field-locked-input { display: block !important; }

/* Bloque de medicaciones dentro de la tarjeta del día. Reemplaza al panel
   fijo que aparecía arriba — ahora cada med va con su día. */
.note-meds-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.note-med-card {
  background: #FFF8FC;
  border: 0.5px solid #FECDD3;
  border-left: 3px solid #FF0080;
  border-radius: 9px;
  padding: 11px 14px;
}
.note-med-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.note-med-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: #FFF0F8;
  display: grid; place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}
.note-med-info { flex: 1; min-width: 0; }
.note-med-tag {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: #BE185D; margin-bottom: 2px;
}
.note-med-title {
  font-size: 13px; font-weight: 600; color: #1E293B;
}
.note-med-actions {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.note-med-status {
  font-size: 10px; font-weight: 700;
  padding: 4px 10px; border-radius: 5px;
  border: 0.5px solid;
  cursor: default;
}
.note-med-status.ok {
  background: #F0FDF4; color: #166534;
  border-color: #BBF7D0;
}
.note-med-status.pending {
  background: #FFFBEB; color: #92400E;
  border-color: #FDE68A; cursor: pointer;
}
.note-med-status.pending:hover { background: #FEF3C7; }
.note-med-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.note-med-cell {
  background: #fff;
  border: 0.5px solid #FECDD3;
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 11px;
}
.note-med-cell span {
  display: block;
  font-size: 9px;
  color: #BE185D;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 1px;
}
.note-med-cell strong {
  display: block;
  font-size: 12px;
  color: #1E293B;
  font-weight: 600;
}
.note-med-notes {
  font-size: 11px;
  color: #475569;
  background: #fff;
  padding: 7px 10px;
  border-radius: 5px;
  border: 0.5px solid #FECDD3;
  margin-top: 7px;
}
.note-card-head { display: flex; justify-content: space-between; gap: 14px; align-items: start; }
.note-card-head h3 { margin: 0; font-size: 18px; }
.note-badge-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.note-badge {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 14px 12px 52px;
  background: #f8fbff;
  display: grid;
  gap: 4px;
  min-height: 76px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.note-badge:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(15,23,42,0.05); }

.note-badge span {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.note-badge strong {
  font-size: 15px;
  font-weight: 600;
  color: #1E293B;
  line-height: 1.25;
}
.note-badge small {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Dots cronológicos dentro de la celda Comida cuando hay registros de
   quick_events: una fila de pequeños círculos del color de cada toma para
   ver de un vistazo cómo le ha ido el día. */
.note-badge-dots {
  display: flex;
  gap: 5px;
  margin-top: 5px;
}
.note-badge-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.note-badge-dot.bien { background: #16A34A; }
.note-badge-dot.regular { background: #FBBF24; }
.note-badge-dot.mal { background: #EF4444; }
.note-badge-dot.d-normal { background: #16A34A; }
.note-badge-dot.d-liquida { background: #EF4444; }
.note-badge-dot.d-blanda { background: #FBBF24; }
.note-badge-dot.d-dura { background: #A16207; }

/* Icono decorativo en círculo a la izquierda. Vía background-image SVG inline
   para no tener que tocar el HTML de las plantillas. */
.note-badge::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 14px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background-color: rgba(255,255,255,0.55);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
}

/* Iconos por orden de aparición (HTML actual: Comida, Sueño, Deposiciones,
   Ánimo, Comportamiento, Medicación, Pañales, Toallitas, Agua).
   Usamos :nth-child para no obligar a tocar la plantilla. */
.note-badge-grid > .note-badge:nth-child(1)::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2327500A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><ellipse cx='12' cy='12' rx='9' ry='5'/><path d='M7 10c0.5 1 1 1.5 1.5 1.5'/><path d='M11 9.5c0.5 1 1 1.5 1.5 1.5'/><path d='M15 10c0.5 1 1 1.5 1.5 1.5'/></svg>");
}
.note-badge-grid > .note-badge:nth-child(2)::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233C3489' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/></svg>");
}
.note-badge-grid > .note-badge:nth-child(3)::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23854F0B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='13' r='6'/><path d='M9 13c0-2 .5-4 3-7 2.5 3 3 5 3 7'/></svg>");
}
.note-badge-grid > .note-badge:nth-child(4)::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23993556' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M8 14s1.5 2 4 2 4-2 4-2'/><line x1='9' y1='9' x2='9.01' y2='9'/><line x1='15' y1='9' x2='15.01' y2='9'/></svg>");
}
.note-badge-grid > .note-badge:nth-child(5)::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230C447C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><polyline points='12 6 12 12 16 14'/></svg>");
}
.note-badge-grid > .note-badge:nth-child(6)::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A32D2D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M10.5 20.5L3.5 13.5a4.95 4.95 0 010-7l7-7a4.95 4.95 0 017 7l-7 7a4.95 4.95 0 01-7 0z'/></svg>");
}
.note-badge-grid > .note-badge:nth-child(7)::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231D4ED8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 8l9-5 9 5'/><path d='M3 8v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8'/><path d='M3 8l9 5 9-5'/></svg>");
}
.note-badge-grid > .note-badge:nth-child(8)::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230F6E56' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='3' width='16' height='18' rx='2'/><line x1='8' y1='8' x2='16' y2='8'/><line x1='8' y1='12' x2='16' y2='12'/></svg>");
}
.note-badge-grid > .note-badge:nth-child(9)::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23185FA5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 2.69l5.66 5.66a8 8 0 1 1-11.31 0z'/></svg>");
}

.note-card-notes { border-top: 1px dashed var(--line); padding-top: 12px; display: grid; gap: 8px; }
.note-card-notes p { margin: 0; line-height: 1.45; }

/* ── Cronología desplegable del día ──
   Botón "Ver cronología" debajo del grid de tarjetas. Al pulsarlo
   muestra una lista vertical con timeline tipo: hora · icono · evento.
   Reutiliza los mismos colores e iconos de las note-badge para que
   visualmente sea coherente con la rejilla superior. */
.note-timeline-wrap { margin-top: 14px; }
.note-timeline-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 11px 14px;
  background: #F8FAFC;
  border: 0.5px solid #E2E8F0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  color: #475569;
  font-weight: 600;
  transition: background .15s ease;
}
.note-timeline-toggle:hover { background: #F1F5F9; }
.note-timeline-toggle .note-timeline-chevron {
  color: #94A3B8;
  transition: transform .2s ease;
  flex-shrink: 0;
}
.note-timeline-toggle.is-open .note-timeline-chevron { transform: rotate(180deg); }
.note-timeline-toggle-text { flex: 1; text-align: left; }
.note-timeline-count {
  font-size: 10px;
  font-weight: 600;
  color: #64748B;
  background: #fff;
  padding: 3px 9px;
  border-radius: 5px;
  border: 0.5px solid #E2E8F0;
}

.note-timeline {
  margin-top: 12px;
  padding: 14px 4px 8px;
}
.note-timeline-label {
  font-size: 10px;
  font-weight: 600;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}
.note-timeline-row {
  display: grid;
  grid-template-columns: 56px 36px 1fr;
  gap: 14px;
  align-items: center;
  padding: 9px 0;
}
.note-timeline-time {
  font-size: 13px;
  color: #94A3B8;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.note-timeline-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 15px 15px;
}
.note-timeline-content {
  font-size: 14px;
  color: #1E293B;
  line-height: 1.4;
}
.note-timeline-title { font-weight: 600; color: #1E293B; }
.note-timeline-meta { color: #94A3B8; font-weight: 400; }
.note-timeline-meta-good { color: #15803D; font-weight: 600; }

/* Pill de valoración (Bien/Regular/Mal) que aparece junto a las comidas
   en la cronología. Color según valoración. */
.note-timeline-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
  margin-left: 4px;
  vertical-align: middle;
}
.note-timeline-pill.bien { background: #DCFCE7; color: #15803D; }
.note-timeline-pill.regular { background: #FEF3C7; color: #92400E; }
.note-timeline-pill.mal { background: #FEE2E2; color: #991B1B; }

/* Iconos de la cronología — mismos colores y dibujos que las note-badge */
.note-timeline-icon-comida {
  background-color: #DCFCE7;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2327500A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><ellipse cx='12' cy='12' rx='9' ry='5'/><path d='M7 10c0.5 1 1 1.5 1.5 1.5'/><path d='M11 9.5c0.5 1 1 1.5 1.5 1.5'/><path d='M15 10c0.5 1 1 1.5 1.5 1.5'/></svg>");
}
.note-timeline-icon-sueno {
  background-color: #EDE9FE;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233C3489' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/></svg>");
}
.note-timeline-icon-depo {
  background-color: #FEF3C7;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23854F0B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='13' r='6'/><path d='M9 13c0-2 .5-4 3-7 2.5 3 3 5 3 7'/></svg>");
}
.note-timeline-icon-medicacion {
  background-color: #FEE2E2;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A32D2D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M10.5 20.5L3.5 13.5a4.95 4.95 0 010-7l7-7a4.95 4.95 0 017 7l-7 7a4.95 4.95 0 01-7 0z'/></svg>");
}
.note-timeline-icon-asist {
  background-color: #E0F2FE;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230C447C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 11l3 3L22 4'/><path d='M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11'/></svg>");
}

/* Enlace "cambiar hora" debajo del título del evento.
   Aparece pequeño y discreto, en azul tenue. Se muestra solo cuando el
   ratón pasa por encima de la fila (en móvil siempre visible). */
.note-timeline-edit {
  background: none;
  border: none;
  color: #0369A1;
  font-size: 11px;
  font-weight: 500;
  padding: 0;
  margin-left: 8px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 2px;
  opacity: 0;
  transition: opacity .15s ease;
}
.note-timeline-row:hover .note-timeline-edit { opacity: 1; }
@media (hover: none) {
  .note-timeline-edit { opacity: 1; }
}

@media (max-width: 700px) {
  .note-timeline-row { grid-template-columns: 48px 32px 1fr; gap: 10px; }
  .note-timeline-time { font-size: 12px; }
  .note-timeline-content { font-size: 13px; }
}

@media (max-width: 1100px) {
  .enhanced-mass-table th, .enhanced-mass-table td { vertical-align: top; }
  .choice-stack { min-width: 96px; }
}
@media (max-width: 920px) {
  .desktop-mass-view { display: none; }
  .enhanced-mobile-mass { display: grid !important; gap: 14px; }
  .mass-card-grid { grid-template-columns: 1fr; }
  .note-badge-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (min-width: 921px) {
  .enhanced-mobile-mass { display: none !important; }
}
@media (max-width: 700px) {
  .mass-register-stats-4 { grid-template-columns: repeat(2, 1fr); }
  .mass-modal-grid { grid-template-columns: 1fr; }
  .note-card-head { flex-direction: column; }
  .note-badge-grid { grid-template-columns: 1fr; }
  .duplicate-actions { flex-direction: column; align-items: stretch; }
}


/* ===== responsive fine-tuning for laptop / tablet ===== */
html { font-size: 16px; }

.enhanced-mass-table {
  table-layout: fixed;
  width: 100%;
}
.enhanced-mass-table th {
  white-space: nowrap;
  font-size: .82rem;
}
.enhanced-mass-table th,
.enhanced-mass-table td {
  padding: 8px 6px;
  vertical-align: top;
}
.mass-register-panel .table-scroll {
  overflow-x: visible;
}
.mass-student-col { min-width: 165px; }
.mass-detail-col { min-width: 110px; }
.sidebar { width: 230px; }
.main-layout { min-width: 0; }

@media (max-width: 1599px) {
  html { font-size: 15px; }
}
@media (max-width: 1400px) {
  html { font-size: 14px; }
  .app-shell { grid-template-columns: 200px 1fr; }
  .sidebar { width: 200px; padding: 16px 10px; }
  .main-layout { padding: 16px 16px 24px; }
  .page-heading, .hero-bar, .student-top-card, .panel { border-radius: 18px; }
  .enhanced-mass-table th,
  .enhanced-mass-table td { padding: 6px 4px; }
  .bulk-card { padding: 10px; }
  .mini-stat strong { font-size: 28px; }
}
@media (max-width: 1199px) {
  html { font-size: 13px; }
  .app-shell { grid-template-columns: 190px 1fr; }
  .sidebar { width: 190px; }
  .enhanced-mass-table th { font-size: .76rem; }
  .enhanced-mass-table th:nth-child(3),
  .enhanced-mass-table th:nth-child(4),
  .enhanced-mass-table th:nth-child(5),
  .enhanced-mass-table th:nth-child(6),
  .enhanced-mass-table th:nth-child(7),
  .enhanced-mass-table th:nth-child(8),
  .enhanced-mass-table th:nth-child(9) { min-width: 88px; }
  .mass-student-col { min-width: 145px; }
}
@media (max-width: 900px) {
  html { font-size: 13px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    width: 260px;
    z-index: 50;
    transition: left .2s ease;
  }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .desktop-mass-view { display: none; }
  .enhanced-mobile-mass { display: grid !important; gap: 14px; }
}
@media (min-width: 901px) {
  .enhanced-mobile-mass { display: none !important; }
}

/* ===== face UI clickable ===== */
.face-group {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  min-width: 116px;
}
.face-group-mobile { justify-content: flex-start; }
.face-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease, border-color .16s ease, color .16s ease;
  box-shadow: 0 3px 8px rgba(35,55,88,.06);
  padding: 0;
}
.face-btn:hover {
  transform: translateY(-1px) scale(1.06);
  box-shadow: 0 6px 14px rgba(35,55,88,.12);
}
.face-svg {
  width: 22px;
  height: 22px;
  display: block;
}
.face-ring,
.face-eye,
.face-mouth {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.face-eye {
  fill: currentColor;
  stroke: none;
}
.face-mouth {
  stroke-width: 2.6;
}
.face-green { border-color: #22c55e; color: #22c55e; }
.face-yellow { border-color: #eab308; color: #eab308; }
.face-red { border-color: #ef4444; color: #ef4444; }

.face-btn.face-green:hover { background: rgba(34,197,94,.08); }
.face-btn.face-yellow:hover { background: rgba(234,179,8,.10); }
.face-btn.face-red:hover { background: rgba(239,68,68,.08); }

.face-btn.active.face-green { background: #22c55e; color: #fff; }
.face-btn.active.face-yellow { background: #eab308; color: #fff; }
.face-btn.active.face-red { background: #ef4444; color: #fff; }

/* ===== notes / tracking cleaner default ===== */
.panel-head-subtle { padding-top: 0; }
#note-form-shell { margin-top: 10px; }
.notes-timeline { display: grid; gap: 14px; margin-top: 14px; }



/* ===== mass register layout fix for laptop and tablet ===== */
.enhanced-mass-table th:nth-child(3),
.enhanced-mass-table th:nth-child(4),
.enhanced-mass-table th:nth-child(5),
.enhanced-mass-table th:nth-child(6),
.enhanced-mass-table th:nth-child(7),
.enhanced-mass-table th:nth-child(8),
.enhanced-mass-table th:nth-child(9) {
  min-width: 92px;
}
.enhanced-mass-table th,
.enhanced-mass-table td {
  padding: 8px 5px;
}
.mass-register-stats-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.note-badge-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 1440px) {
  html { font-size: 14px; }
  .app-shell { grid-template-columns: 200px 1fr; }
  .sidebar { width: 200px; padding: 16px 10px; }
  .main-layout { padding: 16px 16px 24px; }
  .page-heading h1, .student-top-card h1 { font-size: clamp(26px, 3.2vw, 36px); }
  .bulk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .face-btn { width: 32px; height: 32px; }
  .face-svg { width: 20px; height: 20px; }
}
@media (max-width: 1280px) {
  html { font-size: 13px; }
  .desktop-mass-view { display: none; }
  .enhanced-mobile-mass { display: grid !important; gap: 14px; }
  .mass-register-stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bulk-grid { grid-template-columns: 1fr; }
  .mass-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mass-card .face-group-mobile { justify-content: flex-start; }
  .mass-card .face-btn { width: 36px; height: 36px; }
}
@media (max-width: 900px) {
  html { font-size: 13px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    width: 260px;
    z-index: 50;
    transition: left .2s ease;
  }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .enhanced-mobile-mass { display: grid !important; gap: 14px; }
  .mass-card-grid { grid-template-columns: 1fr; }
  .mass-register-stats-4 { grid-template-columns: 1fr 1fr; }
  .note-badge-grid { grid-template-columns: 1fr; }
}
@media (min-width: 1281px) {
  .enhanced-mobile-mass { display: none !important; }
}


.global-apply-panel {
  display: grid;
  grid-template-columns: 1.4fr auto auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.global-apply-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.global-face-btn {
  width: 44px;
  height: 44px;
}
.global-apply-confirm {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 1199px) {
  .global-apply-panel {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .global-apply-confirm {
    justify-content: flex-start;
  }
}
@media (max-width: 900px) {
  .global-apply-actions {
    gap: 8px;
  }
  .global-face-btn {
    width: 40px;
    height: 40px;
  }
}


.global-apply-panel[hidden] { display: none !important; }
.global-face-btn.active.face-green { background:#22c55e; color:#fff; }
.global-face-btn.active.face-yellow { background:#eab308; color:#fff; }
.global-face-btn.active.face-red { background:#ef4444; color:#fff; }

.enhanced-mass-table th,
.enhanced-mass-table td { text-align: center; }
.enhanced-mass-table .mass-student-col,
.enhanced-mass-table .mass-detail-col { text-align: left; }
.face-group { min-width: 100px; gap: 4px; }
.face-btn { width: 30px; height: 30px; }
.face-svg { width: 18px; height: 18px; }
.mass-detail-col { min-width: 100px; }
.mass-student-col { min-width: 150px; }
.enhanced-mass-table th:nth-child(3),
.enhanced-mass-table th:nth-child(4),
.enhanced-mass-table th:nth-child(5),
.enhanced-mass-table th:nth-child(6),
.enhanced-mass-table th:nth-child(7),
.enhanced-mass-table th:nth-child(8),
.enhanced-mass-table th:nth-child(9) { min-width: 82px; }

@media (max-width: 1400px) {
  .face-btn { width: 28px; height: 28px; }
  .face-svg { width: 16px; height: 16px; }
  .face-group { min-width: 92px; }
  .enhanced-mass-table th:nth-child(3),
  .enhanced-mass-table th:nth-child(4),
  .enhanced-mass-table th:nth-child(5),
  .enhanced-mass-table th:nth-child(6),
  .enhanced-mass-table th:nth-child(7),
  .enhanced-mass-table th:nth-child(8),
  .enhanced-mass-table th:nth-child(9) { min-width: 74px; }
}
@media (max-width: 900px) {
  .enhanced-mobile-mass { display: grid !important; gap: 8px; }
  .mass-card {
    display: grid;
    grid-template-columns: 140px repeat(7, minmax(46px, 1fr)) 84px;
    align-items: start;
    gap: 8px;
    padding: 12px;
  }
  .mass-card-head {
    grid-column: 1 / 2;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .mass-card-grid {
    grid-column: 2 / 9;
    display: grid;
    grid-template-columns: repeat(7, minmax(46px, 1fr));
    gap: 8px;
  }
  .mass-card-grid > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  .mass-card-grid .tiny.muted {
    text-align: center;
    min-height: 32px;
  }
  .face-group-mobile {
    flex-direction: column;
    align-items: center;
    gap: 5px;
  }
  .face-group-mobile .face-btn { width: 30px; height: 30px; }
  .mass-card-foot {
    grid-column: 9 / 10;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 0;
  }
  .mass-card-foot .detail-summary { margin-top: 0; }
}

/* .btn-success — definición canónica más abajo (~1748) con !important */
.hidden-global { display: none !important; }
.master-selector span { font-weight: 700; }
.table-master-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}
.table-master-check input { margin: 0; }

html { font-size: 14px; }
body, button, input, select, textarea { font-size: .95rem; }
.app-shell { grid-template-columns: 196px 1fr; }
.sidebar { width: 196px; padding: 14px 10px; }
.nav-link { padding: 12px 13px; border-radius: 14px; font-size: .95rem; }
.main-layout { padding: 14px 14px 22px; }
.hero-bar, .page-heading, .student-top-card, .panel { border-radius: 18px; }
.page-heading, .hero-bar, .student-top-card { padding: 15px 18px; }
.hero-title-wrap h1, .page-heading h1, .student-top-card h1 { font-size: clamp(24px, 3vw, 34px); }
.stats-grid { gap: 12px; margin-bottom: 14px; }
.stat-card, .mini-stat { padding: 14px 16px; border-radius: 16px; }
.stat-card strong, .mini-stat strong { font-size: 26px; }

.enhanced-mass-table th,
.enhanced-mass-table td { padding: 5px 4px; }
.enhanced-mass-table th { font-size: .74rem; }
.mass-student-col { min-width: 135px; }
.mass-detail-col { min-width: 88px; }
.face-group { min-width: 84px; gap: 3px; }
.face-btn { width: 26px; height: 26px; }
.face-svg { width: 15px; height: 15px; }
.detail-summary { font-size: 11px; }

.global-apply-panel {
  grid-template-columns: 1.2fr auto auto;
  gap: 12px;
  padding: 12px 14px;
}
.global-face-btn { width: 34px; height: 34px; }

.note-card-v2, .notes-timeline { gap: 10px; }
.note-card-head h3 { font-size: 16px; }

@media (min-width: 1600px) {
  html { font-size: 16px; }
  .app-shell { grid-template-columns: 230px 1fr; }
  .sidebar { width: 230px; padding: 18px 14px; }
  .main-layout { padding: 20px 22px 32px; }
  .face-btn { width: 30px; height: 30px; }
  .face-svg { width: 18px; height: 18px; }
  .face-group { min-width: 96px; }
}

@media (max-width: 1200px) {
  html { font-size: 13px; }
  .desktop-mass-view { display: none; }
  .enhanced-mobile-mass { display: grid !important; gap: 8px; }
  .mass-card {
    display: grid;
    grid-template-columns: 132px repeat(7, minmax(40px, 1fr)) 72px;
    align-items: start;
    gap: 6px;
    padding: 10px;
    border-radius: 16px;
  }
  .mass-card-head {
    grid-column: 1 / 2;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .mass-card-head strong { font-size: .9rem; }
  .mass-card-grid {
    grid-column: 2 / 9;
    display: grid;
    grid-template-columns: repeat(7, minmax(40px, 1fr));
    gap: 6px;
  }
  .mass-card-grid > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }
  .mass-card-grid .tiny.muted {
    text-align: center;
    min-height: 28px;
    font-size: 10px;
    line-height: 1.1;
  }
  .face-group-mobile {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: auto;
  }
  .face-group-mobile .face-btn { width: 26px; height: 26px; }
  .face-group-mobile .face-svg { width: 14px; height: 14px; }
  .mass-card-foot {
    grid-column: 9 / 10;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    margin-top: 0;
  }
  .mass-card-foot .btn { padding: 6px 8px; font-size: .8rem; }
  .mass-card-foot .detail-summary { margin-top: 0; font-size: 10px; }
  .global-apply-panel {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .global-apply-confirm {
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    width: 240px;
    z-index: 50;
    transition: left .2s ease;
  }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
}

.select-col { width: 52px; min-width: 52px; text-align: center; }

.table-master-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}
.table-master-check input { margin: 0; }
.select-col { width: 52px; min-width: 52px; text-align: center; }

.btn-success {
  background: linear-gradient(135deg, #39b978, #178956) !important;
  color: #fff !important;
  border: none !important;
}
.btn-success:hover { filter: brightness(1.03); }


/* v7 selector and responsive fixes */
.hidden-global { display: none !important; }
.select-col { width: 54px; min-width: 54px; text-align: center; }
.table-master-check,
.master-selector {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.table-master-check input,
.master-selector input,
.mobile-student-check input,
.student-select {
  width: 16px;
  height: 16px;
  margin: 0;
}
.global-apply-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.row-selected {
  background: rgba(47,128,237,.05) !important;
}

@media (max-width: 1200px) {
  .desktop-mass-view { display: none; }
  .enhanced-mobile-mass { display: grid !important; gap: 8px; }
  .global-apply-top {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (min-width: 1201px) {
  .enhanced-mobile-mass { display: none !important; }
}


/* final module polish */
.table-master-check span { display:none; }
.global-apply-panel {
  max-width: 720px;
  margin: 0 auto 16px;
  text-align: center;
  grid-template-columns: 1fr;
}
.global-apply-copy,
.global-apply-actions,
.global-apply-confirm { justify-content: center; }
.global-apply-actions { display:flex; gap:12px; justify-content:center; }
.global-apply-confirm { display:flex; align-items:center; gap:12px; justify-content:center; flex-wrap:wrap; }
#selected-count { font-weight: 700; }
.duplicate-form-grid { display:grid; gap:14px; }
.duplicate-picker {
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap:10px;
}
.duplicate-student-option {
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
}
.duplicate-student-option input { width:16px; height:16px; margin:0; }

@media (max-width: 1200px) {
  .global-apply-panel {
    margin: 0 0 16px;
    text-align: left;
    align-items: start;
  }
  .global-apply-actions,
  .global-apply-confirm { justify-content:flex-start; }
}


/* final mass register polishing */
.mass-register-shell,
.mass-register-stats,
.mass-register-panel,
.mass-save-bar,
.global-apply-panel {
  zoom: 0.94;
}
@supports not (zoom: 1) {
  .mass-register-shell,
  .mass-register-stats,
  .mass-register-panel,
  .mass-save-bar,
  .global-apply-panel {
    transform: scale(.94);
    transform-origin: top left;
    width: 106.4%;
  }
}

.enhanced-mass-table th {
  font-size: .72rem;
  letter-spacing: .01em;
  white-space: nowrap;
}
.enhanced-mass-table th,
.enhanced-mass-table td {
  padding: 4px 6px;
}
.enhanced-mass-table .mass-detail-col,
.enhanced-mass-table th:last-child,
.enhanced-mass-table td:last-child {
  text-align: center;
}
.mass-detail-col .btn {
  margin-inline: auto;
  display: inline-flex;
}
.mass-detail-col .detail-summary {
  text-align: center;
}
.face-group { min-width: 76px; gap: 4px; }
.face-btn { width: 24px; height: 24px; }
.face-svg { width: 14px; height: 14px; }
.mass-student-col { min-width: 132px; }
.mass-detail-col { min-width: 94px; }
.select-col { width: 38px; min-width: 38px; }

.global-apply-panel {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 10px;
  text-align: center;
}
.global-apply-top {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.global-apply-copy {
  max-width: 720px;
}
.global-apply-actions {
  justify-content: center;
}
.global-apply-confirm {
  justify-content: center;
}
.master-selector {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
}
.master-selector input {
  width: 16px;
  height: 16px;
}
#selected-count {
  font-weight: 600;
  color: var(--muted);
}

@media (max-width: 1200px) {
  .mass-register-shell,
  .mass-register-stats,
  .mass-register-panel,
  .mass-save-bar,
  .global-apply-panel {
    zoom: 1;
    transform: none;
    width: auto;
  }
  .global-apply-panel {
    justify-items: start;
    text-align: left;
  }
  .global-apply-top {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    max-width: none;
  }
  .global-apply-actions,
  .global-apply-confirm {
    justify-content: flex-start;
  }
  .face-group-mobile {
    min-width: auto;
    gap: 4px;
  }
  .mass-card-grid .tiny.muted {
    min-height: 24px;
    font-size: 10px;
  }
  .mass-card-foot .btn {
    align-self: center;
  }
}


/* Module close-up fixes */
.note-face-row {
  display: grid;
  gap: 10px;
}
.note-face-group {
  justify-content: flex-start;
  min-width: auto;
}
.note-form input[type="hidden"] {
  display: none;
}
.note-duplicate-panel + #note-form-shell {
  display: none !important;
}

.history-table td[data-label]::before {
  display: none;
}

@media (max-width: 1100px) {
  .history-table,
  .history-table thead,
  .history-table tbody,
  .history-table tr,
  .history-table td {
    display: block;
    width: 100%;
  }
  .history-table thead {
    display: none;
  }
  .history-table tr {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 12px;
    background: #fff;
  }
  .history-table td {
    border: 0;
    padding: 8px 0;
  }
  .history-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
    font-weight: 700;
  }
  .history-table .table-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}


/* module final v3 */
@media (max-width: 1200px) {
  .history-table thead {
    display: none;
  }
  .history-table,
  .history-table tbody,
  .history-table tr,
  .history-table td {
    display: block;
    width: 100%;
  }
  .history-table tr {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    margin-bottom: 12px;
    background: #fff;
  }
  .history-table td {
    border: none;
    padding: 8px 0;
  }
  .history-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
    font-weight: 700;
  }
  .history-table td.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }
}

.global-apply-panel {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}
@media (max-width: 1200px) {
  .global-apply-panel {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }
}


.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.alert-warning {
  background: #fff7e6;
  border: 1px solid #f3c67c;
  color: #8c5a0a;
  border-radius: 14px;
  padding: 12px 14px;
}
.note-badge.badge-good { background: #e7f7ee; border-color: #9edab8; }
.note-badge.badge-warn { background: #fff3df; border-color: #f3c67c; }
.note-badge.badge-danger { background: #fdeaea; border-color: #f0a8a2; }
.note-badge.badge-neutral { background: #f8fbff; border-color: var(--line); }

.medication-field .label-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.compact-check {
  font-size: 13px;
  white-space: nowrap;
}
#medication_textarea.is-disabled {
  opacity: .6;
  background: #f5f7fb;
}


.duplicate-confirm-panel {
  border: 1px solid #f0a8a2;
  background: #fdeaea;
}

/* ── Espacio inferior para acomodar el FAB ──
   El FAB ocupa la esquina inferior derecha (54px de alto + 22px de margen).
   Para que NUNCA tape botones de acciones que están al final de la página,
   añadimos un padding-bottom generoso al área de contenido principal.
   Combinado con el auto-hide on scroll, el contenido siempre es accesible. */
.main-layout { padding-bottom: 110px !important; }
@media (max-width: 700px) {
  /* En móvil aún más, porque el FAB queda más cerca del contenido */
  .main-layout { padding-bottom: 130px !important; }
}

/* ── Bloqueo de comida en registro masivo ──
   Cuando un alumno tiene comidas registradas desde el FAB, la celda Comida
   del masivo muestra esto en vez de los radios editables: un mini-resumen
   con el estado-día (Bien/Regular/Mal), el número de tomas, los dots y un
   badge "Ya marcado" en verde para indicar que está protegido. */
.mass-locked-comida {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: not-allowed;
  position: relative;
}
.mass-locked-comida strong {
  font-size: 13px;
  font-weight: 600;
  color: #1E293B;
  line-height: 1.1;
}
.mass-locked-comida small {
  font-size: 10px;
  color: #15803D;
  font-weight: 500;
}
.mass-locked-tag {
  display: inline-block;
  align-self: flex-start;
  background: #16A34A;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
}
.mass-locked-dots {
  display: flex;
  gap: 3px;
  margin-top: 2px;
}
.mass-locked-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.mass-locked-dot.bien { background: #16A34A; }
.mass-locked-dot.regular { background: #FBBF24; }
.mass-locked-dot.mal { background: #EF4444; }
.mass-locked-dot.d-normal { background: #16A34A; }
.mass-locked-dot.d-liquida { background: #EF4444; }
.mass-locked-dot.d-blanda { background: #FBBF24; }
.mass-locked-dot.d-dura { background: #A16207; }

/* ============================================================================
   Pills de estado de factura — fuente única de verdad
   ----------------------------------------------------------------------------
   Antes vivían duplicados en facturacion/index.html, facturacion/invoice_detail.html
   y student_detail.html. Movidos aquí para garantizar consistencia visual.
   Estados soportados: borrador, emitida, enviada, cobrada, impagada,
   reenviada, anulada, abonada.
   ============================================================================ */
.sp{display:inline-flex;padding:3px 9px;border-radius:999px;font-size:10px;font-weight:700;border:1px solid transparent;letter-spacing:.01em;}
.sp-borrador{background:#F1EFE8;color:#444441;border-color:#D3D1C7;}
.sp-emitida{background:#EFF6FF;color:#1D4ED8;border-color:#BFDBFE;}
.sp-enviada{background:#EEEDFE;color:#3C3489;border-color:#CECBF6;}
.sp-cobrada{background:#EAF3DE;color:#27500A;border-color:#C0DD97;}
.sp-impagada{background:#FCEBEB;color:#A32D2D;border-color:#F7C1C1;}
.sp-reenviada{background:#FAEEDA;color:#633806;border-color:#FAC775;}
.sp-anulada{background:#F1F5F9;color:#64748B;border-color:#CBD5E1;}
.sp-abonada{background:#F3E8FF;color:#6B21A8;border-color:#D8B4FE;}

/* ============================================================================
   KPI cards — sistema unificado reutilizable
   ----------------------------------------------------------------------------
   Movido aquí desde facturacion/index.html para que cualquier vista pueda
   reutilizarlo (Inicio, CRM, RR.HH., Comedor, Dashboard, etc.). Mantiene
   exactamente la misma apariencia que tenía en /facturacion.

   Uso:
     <div class="stat-g">
       <div class="sc blue">
         <div class="sl">Etiqueta</div>
         <div class="sv-row">
           <div class="sv">123 €</div>
           <span class="sc-pill pct-good">85%</span>
         </div>
         <div class="sc-progress"><div class="sc-progress-bar bar-good" style="width:85%"></div></div>
         <div class="sc-desc">Texto descriptivo</div>
       </div>
       ...
     </div>

   Variantes de color: blue, green, red, purple, amber.
   Ancho dinámico: ajusta `grid-template-columns` con la propia clase
   (ej. .stat-g.cols-3 para 3 columnas en lugar de 5).
   ============================================================================ */
.stat-g{display:grid;grid-template-columns:repeat(5,1fr);gap:12px;margin-bottom:18px;}
.stat-g.cols-3{grid-template-columns:repeat(3,1fr);}
.stat-g.cols-4{grid-template-columns:repeat(4,1fr);}
.stat-g.cols-2{grid-template-columns:repeat(2,1fr);}
.sc{border-radius:14px;padding:14px 16px;border:0.5px solid transparent;display:flex;flex-direction:column;position:relative;min-height:128px;}
.sc.blue{background:#EFF6FF;border-color:#BFDBFE;}
.sc.green{background:#EAF3DE;border-color:#C0DD97;}
.sc.red{background:#FCEBEB;border-color:#F7C1C1;}
.sc.purple{background:#EEEDFE;border-color:#CECBF6;}
.sc.amber{background:#FAEEDA;border-color:#FAC775;}
.sl{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;margin-bottom:10px;}
.sc.blue .sl{color:#1D4ED8;}
.sc.green .sl{color:#27500A;}
.sc.red .sl{color:#A32D2D;}
.sc.purple .sl{color:#3C3489;}
.sc.amber .sl{color:#633806;}
/* Fila importe + pill con % */
.sv-row{display:flex;align-items:baseline;gap:10px;margin-bottom:11px;flex-wrap:wrap;}
.sv{font-size:24px;font-weight:700;line-height:1;font-variant-numeric:tabular-nums;}
.sc.blue .sv{color:#1D4ED8;}
.sc.green .sv{color:#16A34A;}
.sc.red .sv{color:#A32D2D;}
.sc.purple .sv{color:#3C3489;}
.sc.amber .sv{color:#854F0B;}
.sc-pill{font-size:11px;font-weight:700;padding:3px 10px;border-radius:999px;background:#fff;border:0.5px solid;font-variant-numeric:tabular-nums;line-height:1.2;}
.sc.blue .sc-pill{color:#1D4ED8;border-color:#BFDBFE;}
.sc.green .sc-pill{color:#16A34A;border-color:#C0DD97;}
.sc.red .sc-pill{color:#A32D2D;border-color:#F7C1C1;}
.sc.purple .sc-pill{color:#3C3489;border-color:#CECBF6;}
.sc.amber .sc-pill{color:#854F0B;border-color:#FAC775;}
/* Barra de progreso por tarjeta */
.sc-progress{height:4px;border-radius:999px;background:rgba(15,23,42,.08);overflow:hidden;margin-bottom:9px;}
.sc-progress-bar{height:100%;border-radius:999px;transition:width .3s ease;}
.sc.blue .sc-progress-bar{background:#1D4ED8;}
.sc.green .sc-progress-bar{background:#16A34A;}
.sc.red .sc-progress-bar{background:#A32D2D;}
.sc.purple .sc-progress-bar{background:#3C3489;}
.sc.amber .sc-progress-bar{background:#854F0B;}
/* Descripción inferior */
.sc-desc{font-size:11.5px;color:#64748B;margin-top:auto;line-height:1.3;}
/* Lista interna (5ª tarjeta de facturación o similares) */
.sc-list{display:flex;flex-direction:column;gap:5px;}
.sc-list-row{display:flex;align-items:center;justify-content:space-between;font-size:13px;color:#444441;line-height:1.3;}
.sc-list-row .sc-list-label{font-weight:500;}
.sc-list-row .sc-list-val{font-weight:700;font-variant-numeric:tabular-nums;}
/* Helpers de color dinámico para barra de progreso */
.bar-good{background:#16A34A !important;}
.bar-warn{background:#D97706 !important;}
.bar-bad{background:#DC2626 !important;}
.pct-good{background:#EAF3DE;color:#27500A;border-color:#C0DD97;}
.pct-warn{background:#FAEEDA;color:#854F0B;border-color:#FAC775;}
.pct-bad{background:#FCEBEB;color:#A32D2D;border-color:#F7C1C1;}
.ssv{font-size:11px;margin-top:2px;}

/* Pantallas medias 901-1100: 5 columnas pero más compactas */
@media (max-width: 1100px) and (min-width: 901px){
  .stat-g{gap:8px;}
  .sc{padding:11px 12px;min-height:118px;}
  .sv{font-size:20px;}
  .sl{font-size:9px;margin-bottom:8px;}
  .sc-pill{font-size:10px;padding:2px 8px;}
  .sc-desc{font-size:10.5px;}
  .sc-list-row{font-size:12px;}
}

/* Tabletas pequeñas 768-900: 5 columnas no caben — pasamos a 3 */
@media (max-width: 900px) and (min-width: 768px){
  .stat-g{grid-template-columns:repeat(3, 1fr); gap:10px;}
  .sc{padding:13px 14px; min-height:auto;}
  .sv{font-size:20px;}
  .sl{font-size:10px;}
}

/* Móvil <768px: en lugar de 4 cards apiladas (mucho scroll), convertimos
   .stat-g en una tarjeta resumen única con filas: label a la izquierda,
   valor + pill % a la derecha, separadores entre filas. Mantiene todos
   los KPIs visibles sin obligar a scrollear. */
@media (max-width: 767px){
  /* La grid se convierte en una tarjeta blanca con bordes finos */
  .stat-g:not(.has-mobile-summary){
    display:block;
    background:#fff;
    border:0.5px solid #E2E8F0;
    border-radius:14px;
    padding:0;
    margin-bottom:18px;
    overflow:hidden;
    box-shadow:0 1px 3px rgba(15,23,42,.04);
  }
  /* Cada .sc deja de ser tarjeta y pasa a fila */
  .stat-g:not(.has-mobile-summary) .sc{
    display:flex !important;
    flex-direction:row !important;
    align-items:center !important;
    justify-content:space-between !important;
    background:transparent !important;
    border:0 !important;
    border-bottom:0.5px solid #F1F5F9 !important;
    border-radius:0 !important;
    padding:13px 16px !important;
    min-height:auto !important;
    gap:12px;
    position:relative;
  }
  .stat-g:not(.has-mobile-summary) .sc:last-child{border-bottom:0 !important;}
  /* Banda de color a la izquierda como indicador */
  .stat-g:not(.has-mobile-summary) .sc::before{
    content:'';
    position:absolute;
    left:0; top:50%;
    transform:translateY(-50%);
    width:3px; height:22px;
    border-radius:0 2px 2px 0;
  }
  .stat-g:not(.has-mobile-summary) .sc.blue::before  {background:#378ADD;}
  .stat-g:not(.has-mobile-summary) .sc.green::before {background:#16A34A;}
  .stat-g:not(.has-mobile-summary) .sc.red::before   {background:#A32D2D;}
  .stat-g:not(.has-mobile-summary) .sc.purple::before{background:#7F77DD;}
  .stat-g:not(.has-mobile-summary) .sc.amber::before {background:#BA7517;}
  /* Label como texto inline normal, no MAYÚSCULAS pequeñas */
  .stat-g:not(.has-mobile-summary) .sl{
    margin:0 !important;
    flex:1;
    min-width:0;
    font-size:13px !important;
    text-transform:none !important;
    letter-spacing:0 !important;
    color:#475569 !important;
    font-weight:600 !important;
  }
  /* Valor + pill compacto a la derecha */
  .stat-g:not(.has-mobile-summary) .sv-row{
    margin:0 !important;
    flex-shrink:0;
    align-items:center;
  }
  .stat-g:not(.has-mobile-summary) .sv{font-size:16px !important;font-weight:700 !important;}
  .stat-g:not(.has-mobile-summary) .sc-pill{font-size:11px;padding:2px 8px;}
  /* Barra y descripción ocultas en este formato compacto */
  .stat-g:not(.has-mobile-summary) .sc-progress,
  .stat-g:not(.has-mobile-summary) .sc-desc{display:none !important;}
}

/* Tarjeta resumen móvil (alternativa a stat-g, usada en /facturacion).
   Las páginas que la quieran mostrar añaden ambas: una .stat-g y una .stat-mobile.
   En desktop se ve la grid; en móvil se ve la tarjeta resumen. */
.stat-mobile{display:none;}
@media (max-width: 767px){
  .stat-mobile{
    display:block;
    background:#fff;
    border:0.5px solid #E2E8F0;
    border-radius:14px;
    padding:18px 18px 14px;
    margin-bottom:18px;
    box-shadow:0 1px 3px rgba(15,23,42,.04);
  }
  /* Cuando coexisten stat-mobile y stat-g, ocultar el grid */
  .stat-g.has-mobile-summary{display:none;}
  .sm-hero-label{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:#64748B;margin-bottom:6px;}
  .sm-hero-row{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:10px;flex-wrap:wrap;}
  .sm-hero-amount{font-size:24px;font-weight:800;color:#1E293B;line-height:1;}
  .sm-hero-amount small{font-size:14px;font-weight:600;color:#64748B;margin-left:6px;}
  .sm-hero-pct{font-size:13px;font-weight:700;padding:3px 11px;border-radius:999px;}
  .sm-progress{height:7px;border-radius:999px;background:#F1F5F9;overflow:hidden;margin-bottom:14px;}
  .sm-progress-bar{height:100%;border-radius:999px;transition:width .3s ease;}
  .sm-section{display:flex;flex-direction:column;gap:7px;padding-top:12px;border-top:0.5px solid #F1F5F9;}
  .sm-row{display:flex;align-items:center;justify-content:space-between;font-size:13px;line-height:1.3;}
  .sm-row .sm-row-label{display:flex;align-items:center;gap:8px;color:#475569;font-weight:500;}
  .sm-row .sm-row-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0;}
  .sm-row .sm-row-val{font-weight:700;color:#1E293B;font-variant-numeric:tabular-nums;}
  .sm-row .sm-row-sub{font-size:11px;color:#94A3B8;font-weight:500;margin-left:4px;}
}

/* ================================================================
   PILLS UNIFICADAS — sistema canónico compartido
   .sp / .badge / .pill / .status comparten apariencia base.
   Los inline-styles existentes siguen ganando (sin ruptura).
   Modifiers semánticos: .success .danger .warning .info .neutral
   .purple para estados especiales (abonada, vacaciones, etc.)
   ================================================================ */
.badge, .pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid transparent;
  letter-spacing: .01em;
  white-space: nowrap;
}
/* Modifiers semánticos compartidos por .badge y .pill */
.badge.success, .pill.success { background:#EAF3DE; color:#27500A; border-color:#C0DD97; }
.badge.danger,  .pill.danger  { background:#FCEBEB; color:#A32D2D; border-color:#F7C1C1; }
.badge.warning, .pill.warning { background:#FAEEDA; color:#633806; border-color:#FAC775; }
.badge.info,    .pill.info    { background:#EFF6FF; color:#1D4ED8; border-color:#BFDBFE; }
.badge.purple,  .pill.purple  { background:#F3E8FF; color:#6B21A8; border-color:#D8B4FE; }
.badge.neutral, .pill.neutral { background:#F1EFE8; color:#444441; border-color:#D3D1C7; }

/* .status — armonizar con sistema canónico (mismo radio y peso) */
.status { padding: 3px 9px; font-size: 10px; letter-spacing: .01em; border: 1px solid transparent; }
.status.success { background:#EAF3DE; color:#27500A; border-color:#C0DD97; }
.status.warning { background:#FAEEDA; color:#633806; border-color:#FAC775; }
.status.danger  { background:#FCEBEB; color:#A32D2D; border-color:#F7C1C1; }
.status.info    { background:#EFF6FF; color:#1D4ED8; border-color:#BFDBFE; }
.status.muted-pill { background:#F1F5F9; color:#64748B; border-color:#CBD5E1; }

/* .fp-pill modifiers globales (RRHH) — para usarlos sin redefinir en cada tab */
.fp-pill-muted   { background:#F1F5F9; color:#64748B; }
.fp-pill-warning { background:#FAEEDA; color:#854F0B; }
.fp-pill-danger  { background:#FCEBEB; color:#A32D2D; }
.fp-pill-success { background:#EAF3DE; color:#27500A; }
.fp-pill-info    { background:#EFF6FF; color:#1D4ED8; }

/* ================================================================
   FILTROS COLAPSABLES MÓVIL
   - .filters-bar.collapsible: en móvil oculta todo .ff excepto el primero
   - .filters-toggle-btn: botón "Filtros (N)" visible solo en móvil
   - .ff.always-show: filtro que siempre se ve (el primero ya lo es)
   ================================================================ */
@media (max-width: 768px) {
  .filters-bar.collapsible:not(.expanded) > *:not(:first-child):not(.always-show):not(.filters-toggle-btn) {
    display: none;
  }
  .filters-toggle-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    background: #fff;
    border: 0.5px solid #E2E8F0;
    border-radius: 8px;
    cursor: pointer;
    margin-left: auto;
    height: 36px;
    align-self: flex-end;
  }
  .filters-toggle-btn:hover { background: #F8FAFC; }
  .filters-toggle-btn .ftb-count {
    background: #1D4ED8;
    color: #fff;
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 700;
  }
  .filters-toggle-btn .ftb-arr { transition: transform .2s; font-size: 10px; }
  .filters-bar.expanded .filters-toggle-btn .ftb-arr { transform: rotate(180deg); }
}
.filters-toggle-btn { display: none; }
