/* ============================================================
   BAILAPRO · Estilos v2 — "Ritmo"
   Rediseño pro: cabecera con degradado y patrón de compás,
   tarjetas con profundidad, micro-interacciones y un modo
   móvil real (bottom-sheet, tap targets grandes, nav fluida).
   Compatible 100% con app.js: mismos nombres de clase.
   ============================================================ */
:root {
  /* Paleta (coincide con el objeto CC de app.js) */
  --bg: #F6F4FA; --surface: #FFFFFF; --ink: #2A1E33; --ink-soft: #6E6480;
  --line: #E4E0EC; --primary: #A62960; --primary-soft: #FBEFF4;
  --violet: #5B2A86; --teal: #1F6E8C;
  --gold: #B98420; --gold-soft: #FBF3E3; --green: #2E7D5B; --green-soft: #E9F4EF;
  --red: #B23B3B; --red-soft: #F9ECEC; --dim: #B9B3C4;

  /* Degradados de marca */
  --grad-header: linear-gradient(130deg, #221230 0%, #38184E 42%, #6E1F52 78%, #8F2358 100%);
  --grad-primary: linear-gradient(135deg, #B22E68 0%, #8A2A78 55%, #5B2A86 100%);

  /* Profundidad */
  --shadow-sm: 0 1px 2px rgba(42, 30, 51, .06), 0 2px 8px rgba(42, 30, 51, .05);
  --shadow-md: 0 2px 4px rgba(42, 30, 51, .06), 0 10px 28px rgba(42, 30, 51, .10);
  --shadow-pop: 0 6px 16px rgba(166, 41, 96, .28);

  --radius: 16px; --radius-lg: 20px;
  --serif: 'Fraunces', Georgia, serif; --sans: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); font-family: var(--sans); font-size: 15px;
  background:
    radial-gradient(900px 380px at 85% -80px, rgba(166, 41, 96, .07), transparent 60%),
    radial-gradient(700px 320px at 0% 120px, rgba(91, 42, 134, .06), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--serif); margin: 0; letter-spacing: -.01em; }
button { font-family: var(--sans); cursor: pointer; }
::selection { background: var(--primary); color: #fff; }

:focus-visible { outline: 3px solid rgba(166, 41, 96, .45); outline-offset: 2px; border-radius: 6px; }

.loading { display: flex; align-items: center; justify-content: center; min-height: 60vh; color: var(--ink-soft); }
.loading::before {
  content: ""; width: 18px; height: 18px; margin-right: 10px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--primary); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Cabecera — el "escenario": degradado plum→magenta con un
   patrón de compás (4 pulsos, el primero acentuado en oro)
   ============================================================ */
.header { position: relative; background: var(--grad-header); padding: 26px 16px 0; overflow: hidden; }
.header::before {
  /* patrón rítmico: · · · ● repetido, como marcar el 1 del compás */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(circle 3px at 10px 10px, rgba(233, 201, 125, .55) 98%, transparent),
    radial-gradient(circle 2px at 34px 10px, rgba(255, 255, 255, .16) 98%, transparent),
    radial-gradient(circle 2px at 58px 10px, rgba(255, 255, 255, .16) 98%, transparent),
    radial-gradient(circle 2px at 82px 10px, rgba(255, 255, 255, .16) 98%, transparent);
  background-size: 96px 24px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), transparent 65%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), transparent 65%);
}
.header-inner { position: relative; max-width: 1150px; margin: 0 auto; }
.header-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.brand h1 { color: #fff; font-size: 34px; font-weight: 700; font-style: italic; }
.brand h1 span { color: #E9C97D; font-style: normal; }
.brand p { color: #CBBEDD; font-size: 13.5px; margin: 3px 0 0; letter-spacing: .02em; }
.brand-link { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { height: 42px; width: 42px; object-fit: contain; border-radius: 10px; background: rgba(255,255,255,.1); padding: 3px; }

.header-stats { display: flex; flex-wrap: wrap; gap: 8px 10px; padding-bottom: 6px; }
.header-stats span {
  color: #D9CEE8; font-size: 12.5px; background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .13); border-radius: 999px; padding: 5px 12px;
  backdrop-filter: blur(4px);
}
.header-stats b { color: #fff; font-weight: 700; }
.header-stats .gold { color: #E9C97D; }

.header-account { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; }
.header-account span { color: #D9CEE8; font-size: 13px; font-weight: 600; }
.header-account .btn-ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.4); color: #fff; box-shadow: none; }
.header-account .btn-ghost:hover { background: rgba(255,255,255,.18); }

/* Botón de menú hamburguesa (solo visible en móvil, ver media query) */
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; align-items: center; gap: 4px;
  width: 38px; height: 34px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.4);
  border-radius: 9px; cursor: pointer; padding: 0;
}
.nav-toggle span { display: block; width: 18px; height: 2px; background: #fff; border-radius: 2px; }

/* Navegación por pestañas: la activa "entra" en el contenido */
.nav { display: flex; gap: 4px; margin-top: 22px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav button {
  position: relative; background: transparent; border: 0; color: #C9BCD9;
  font-size: 14px; font-weight: 600; padding: 11px 16px 12px;
  border-radius: 12px 12px 0 0; white-space: nowrap; transition: color .15s, background .15s;
}
.nav button:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav button.active { background: var(--bg); color: var(--ink); }
.nav button.active::after {
  content: ""; position: absolute; left: 16px; right: 16px; top: 6px; height: 3px;
  border-radius: 3px; background: linear-gradient(90deg, var(--primary), #E9C97D);
}

/* Cuadrícula semanal (Resumen: semana actual · Horario móvil: semana navegable) */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week-day {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; min-width: 0; display: flex; flex-direction: column; gap: 6px;
}
.week-day.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.week-day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.week-day-name { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.week-day.today .week-day-name { color: var(--primary); }
.week-day-num { font-size: 13px; font-weight: 700; color: var(--ink); }
.week-day-chips { display: flex; flex-direction: column; gap: 4px; }
.week-day-empty { font-size: 12px; color: var(--dim); }

.container { max-width: 1150px; margin: 0 auto; padding: 26px 16px 40px; }
.footer { text-align: center; font-size: 12px; color: var(--ink-soft); padding: 0 16px 28px; }

/* ============================================================
   Botones
   ============================================================ */
.btn {
  display: inline-block; border-radius: 12px; font-weight: 600; font-size: 14px; padding: 9px 18px;
  background: var(--grad-primary); color: #fff; border: 1px solid transparent;
  box-shadow: var(--shadow-pop); transition: transform .12s ease, box-shadow .12s ease, filter .12s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(166, 41, 96, .25); }
.btn-ghost {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { filter: none; border-color: var(--dim); }
.btn-danger { background: var(--surface); color: var(--red); border: 1px solid #E8C6C6; box-shadow: none; }
.btn-danger:hover { background: var(--red-soft); filter: none; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-soft { background: var(--primary-soft); color: var(--primary); border: 1px solid transparent; box-shadow: none; }
.btn-soft:hover { background: #F6DEEA; filter: none; }
.btn-sm { padding: 6px 13px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }
.linklike { background: none; border: 0; color: var(--primary); font-weight: 600; font-size: 14px; padding: 0; }
.linklike:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ============================================================
   Tarjetas, listas, chips
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px; box-shadow: var(--shadow-sm);
}
.chip {
  display: inline-block; border-radius: 999px; padding: 1px 10px;
  font-size: 12px; font-weight: 600; line-height: 21px;
}
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; transition: background .12s; }
.row:hover { background: #FAF8FD; }
.row + .row { border-top: 1px solid var(--line); }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }

/* Filas de alumnos plegables (detalle de clase) */
.row-wrap + .row-wrap { border-top: 1px solid var(--line); }
.row-wrap .row { border-top: 0; }
.row-expand { padding: 4px 16px 16px; background: #FAF8FD; border-top: 1px dashed var(--line); }

/* Listados de alumnos en tarjeta (clase y sección Alumnos): 1, 2 o 3 columnas según el ancho */
.students-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .students-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .students-grid { grid-template-columns: repeat(3, 1fr); } }
.students-grid .row-wrap {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.students-grid .row-wrap + .row-wrap { border-top: none; }

/* Alumnos con la cuota del mes en curso pendiente de pago: fondo rojizo para que destaquen a simple vista */
.row-wrap--overdue .row { background: #F9ECEC; }
.row-wrap--overdue .row:hover { background: #F5DEDE; }
.row-wrap--overdue .row-expand { background: #FBF3F3; }
.students-grid .row-wrap--overdue { border-color: #E7C6C6; }

.empty {
  background: var(--surface); border: 1.5px dashed var(--dim); border-radius: var(--radius-lg);
  padding: 48px 24px; text-align: center;
}
.empty .icon { font-size: 34px; margin-bottom: 8px; }
.empty p { color: var(--ink-soft); font-size: 14px; }
.empty p b { color: var(--ink); font-size: 16px; }
.empty .btn { margin-top: 6px; }

/* ============================================================
   Formularios
   ============================================================ */
.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--ink-soft); margin-bottom: 5px;
}
.hint { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 5px; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line);
  background: #fff; color: var(--ink); font-size: 14px; font-family: var(--sans); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea.input { min-height: 70px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ============================================================
   Modal — en móvil se convierte en bottom-sheet
   ============================================================ */
.modal-bg {
  position: fixed; inset: 0; z-index: 50; background: rgba(34, 18, 48, .55);
  backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 16px; animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 520px;
  margin: 32px 0; box-shadow: 0 24px 70px rgba(34, 18, 48, .4); animation: slideUp .22s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(14px); } }
.modal.wide { max-width: 780px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 19px; }
.modal-head .x {
  background: var(--bg); border: 0; font-size: 20px; color: var(--ink-soft);
  line-height: 1; width: 32px; height: 32px; border-radius: 50%;
}
.modal-head .x:hover { background: var(--line); color: var(--ink); }
.modal-body { padding: 18px 20px; }
.modal-foot {
  position: sticky; bottom: 0; background: var(--surface);
  display: flex; justify-content: flex-end; gap: 8px; margin: 12px -20px -18px;
  padding: 12px 20px 18px; border-top: 1px solid var(--line);
}

/* Selector de color y toggles */
.color-dot { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; transition: transform .1s; }
.color-dot:hover { transform: scale(1.12); }
.color-dot.sel { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
.icon-dot {
  width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff;
  font-size: 18px; display: flex; align-items: center; justify-content: center; transition: transform .1s, border-color .12s;
}
.icon-dot:hover { transform: scale(1.08); border-color: var(--dim); }
.icon-dot.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary-soft); }
.toggle-card {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border-radius: 12px; padding: 10px 12px; font-size: 14px; background: #fff;
  border: 1.5px solid var(--line); color: var(--ink); transition: border-color .12s, background .12s;
}
.toggle-card:hover { border-color: var(--dim); }
.toggle-card .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.toggle-card small { display: block; color: var(--ink-soft); font-size: 12px; }

/* ============================================================
   Calendario mensual
   ============================================================ */
.cal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav h2 { font-size: 21px; min-width: 190px; text-align: center; text-transform: capitalize; }
.cal-scroll { overflow-x: auto; padding-bottom: 10px; scrollbar-width: thin; scrollbar-color: var(--dim) transparent; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; min-width: 900px; }
.cal-dayname {
  text-align: center; font-size: 12.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ink-soft); padding: 4px 0;
}
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; min-width: 900px; margin-bottom: 5px; border-radius: 14px; }
.cal-week.current { background: #F3D3E4; border-radius: 14px; padding: 3px; margin: -3px -3px 2px; box-shadow: 0 0 0 2px var(--primary) inset; }
.cal-cell {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  min-height: 96px; padding: 5px; transition: box-shadow .12s;
}
.cal-cell:hover { box-shadow: var(--shadow-sm); }
.cal-cell.out { background: transparent; border-color: transparent; opacity: .3; box-shadow: none; }
.cal-cell.today { border: 2px solid var(--ink); }
.cal-cell.curweek { background: #FCF3F8; border-color: #E9B9D4; }
.cal-cell.curweek.today { background: #FCF3F8; }
.cal-daynum { float: right; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); padding: 1px 7px; border-radius: 999px; }
.cal-cell.today .cal-daynum { background: var(--ink); color: #E9C97D; }
.cal-chips { clear: both; display: flex; flex-direction: column; gap: 3px; margin-top: 20px; }
.cal-chip {
  display: flex; align-items: center; gap: 4px; width: 100%; text-align: left; border: 0; border-radius: 6px; padding: 3px 6px;
  font-size: 12px; line-height: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 1px 3px rgba(42, 30, 51, .15); transition: filter .1s, transform .1s;
}
.cal-chip:hover { filter: brightness(1.08); transform: translateY(-1px); }
.cal-chip-icon { font-size: 12px; flex-shrink: 0; }

/* ============================================================
   Tarjetas de clase y pestañas internas
   ============================================================ */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.class-card {
  text-align: left; border-radius: var(--radius-lg); padding: 18px; background: var(--surface);
  border: 1px solid var(--line); border-top-width: 5px; box-shadow: var(--shadow-sm);
  transition: transform .14s ease, box-shadow .14s ease;
}
.class-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.class-card-img { margin: -18px -18px 12px; border-radius: 0; overflow: hidden; height: 130px; }
.class-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.class-card-icon { display: flex; align-items: center; justify-content: center; font-size: 40px; }
.img-preview {
  width: 84px; height: 84px; border-radius: 12px; overflow: hidden; border: 1.5px solid var(--line);
  background: var(--bg); flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-preview.placeholder { font-size: 26px; color: var(--dim); }

/* ============================================================
   Cabecera de detalle (clase / evento): imagen | info | acciones
   ============================================================ */
.detail-head { display: grid; grid-template-columns: minmax(200px, 320px) 1fr auto; align-items: stretch; }
.detail-img { min-height: 220px; background: var(--bg); overflow: hidden; }
.detail-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-img-fallback {
  width: 100%; height: 100%; min-height: 220px; display: flex; align-items: center; justify-content: center;
  font-size: 60px;
}
.detail-info { padding: 20px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.detail-stats {
  padding: 20px; display: flex; flex-direction: column; gap: 9px; align-items: flex-end; justify-content: center;
  border-left: 1px solid var(--line);
}
.detail-stats .chip { white-space: nowrap; }
.detail-stats .btn { width: auto; }
.class-detail-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
@media (max-width: 760px) {
  .detail-head { grid-template-columns: 1fr; }
  .detail-img, .detail-img-fallback { min-height: 170px; }
  .detail-info { padding: 16px 16px 4px; }
  .detail-stats { align-items: flex-start; border-left: 0; border-top: 1px solid var(--line); padding: 16px; }
}

/* Tarjetas de la lista de eventos: imagen | info */
.event-card {
  display: flex; align-items: stretch; width: 100%; text-align: left; border: 1px solid var(--line);
  border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden;
  margin-bottom: 12px; cursor: pointer; transition: transform .14s ease, box-shadow .14s ease;
}
.event-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.event-card.dim { opacity: .65; }
.event-card-img { width: 170px; flex-shrink: 0; background: var(--bg); }
.event-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.event-card-img-fallback {
  width: 100%; height: 100%; min-height: 120px; display: flex; align-items: center; justify-content: center; font-size: 34px;
}
.event-card-body { padding: 14px 18px; flex: 1; min-width: 0; }
@media (max-width: 600px) {
  .event-card { flex-direction: column; }
  .event-card-img { width: 100%; height: 140px; }
}

/* Listas de personas (alumnos apuntados, asistentes, invitados): varias columnas si el ancho lo permite */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.people-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); transition: border-color .12s, box-shadow .12s;
}
.people-item:hover { border-color: var(--dim); box-shadow: var(--shadow-sm); }
.people-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button {
  border-radius: 999px; padding: 7px 18px; font-size: 14px; font-weight: 600;
  background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line); transition: all .12s;
}
.tabs button:hover { color: var(--ink); border-color: var(--dim); }
.tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); box-shadow: var(--shadow-sm); }

/* ============================================================
   Admin: sub-navegación por secciones
   ============================================================ */
.admin-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.admin-tabs button {
  display: flex; align-items: center; gap: 6px; border-radius: 12px; padding: 9px 16px;
  font-size: 14px; font-weight: 600; background: var(--surface); color: var(--ink-soft);
  border: 1.5px solid var(--line); transition: all .12s;
}
.admin-tabs button:hover { color: var(--ink); border-color: var(--dim); }
.admin-tabs button.active {
  background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: var(--shadow-sm);
}
.admin-tabs button.danger.active { background: var(--red); border-color: var(--red); }
.badge-count {
  display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--red);
  color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.payrow-highlight { animation: payrowFlash 2.2s ease; border-radius: 10px; }
@keyframes payrowFlash {
  0% { background: var(--primary-soft); }
  70% { background: var(--primary-soft); }
  100% { background: transparent; }
}
@media (max-width: 640px) {
  .admin-tabs { gap: 6px; }
  .admin-tabs button { flex: 1 1 auto; justify-content: center; padding: 9px 10px; font-size: 13px; }
}

/* Selector de formato de exportación (Excel / PDF / JSON) */
.fmt-group { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.fmt-pill {
  padding: 7px 16px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff;
  font-size: 13px; font-weight: 700; color: var(--ink-soft); cursor: pointer; transition: all .12s;
}
.fmt-pill:hover { border-color: var(--dim); color: var(--ink); }
.fmt-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Bloque de exportación individual dentro de la tarjeta "Exportar datos" */
.export-row {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 14px 0;
  border-top: 1px solid var(--line);
}
.export-row:first-of-type { border-top: 0; padding-top: 0; }
.export-row .field { margin: 0; min-width: 220px; flex: 1 1 220px; }
@media (max-width: 640px) {
  .export-row { flex-direction: column; align-items: stretch; }
  .export-row .field { min-width: 0; }
  .export-row .btn { width: 100%; }
}

/* ============================================================
   Medios
   ============================================================ */
.media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.media-grid.small { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .media-grid, .media-grid.small { grid-template-columns: 1fr; } }
.media-item { position: relative; }
.media-item img, .media-item video {
  width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block; object-fit: cover;
}
.media-item img { max-height: 320px; }
.media-item.small img { max-height: 140px; }
.media-item iframe { width: 100%; aspect-ratio: 16/9; border: 1px solid var(--line); border-radius: 12px; display: block; }
.media-rm {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; color: var(--red); border: 1px solid var(--line); font-weight: 700; box-shadow: var(--shadow-sm);
}

/* ============================================================
   Pastillas de estado (pagos, asistencia)
   ============================================================ */
.pill { border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 600; background: transparent; transition: filter .1s, transform .1s; }
.pill:hover { filter: brightness(.97); }
.pill:active { transform: scale(.97); }
.pill-sm { padding: 2px 11px; font-size: 12px; }
.month-pill {
  border-radius: 8px; padding: 6px 9px; font-size: 12px; font-weight: 600;
  background: transparent; margin: 2px; min-width: 58px; transition: transform .1s;
}
.month-pill:active { transform: scale(.95); }

/* ============================================================
   Resumen
   ============================================================ */
.stats-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.stat-card {
  border-radius: var(--radius-lg); padding: 14px 18px; min-width: 170px; flex: 1;
  border: 1px solid rgba(42, 30, 51, .05); box-shadow: var(--shadow-sm);
}
.stat-card .lbl { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .85; }
.stat-card .val { display: block; font-size: 30px; font-weight: 700; font-family: var(--serif); margin-top: 2px; }
.stat-card .sub { display: block; font-size: 12px; opacity: .85; }
.panel2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}

/* Cuadrícula de avatares (p. ej. ausencias avisadas) */
.avatar-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.avatar-grid-item { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 62px; text-align: center; }
.avatar-grid-item span {
  font-size: 11px; font-weight: 600; color: var(--ink-soft); max-width: 62px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Sesiones de programación: tarjeta clicable y línea de tiempo */
.session-card { cursor: pointer; transition: box-shadow .12s, border-color .12s; }
.session-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }
.session-nav-list {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.session-nav-item {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 11px 16px; cursor: pointer; font-family: var(--sans);
}
.session-nav-item + .session-nav-item { border-top: 1px solid var(--line); }
.session-nav-item:hover { background: #FAF8FD; }
.session-nav-item.active { background: var(--primary-soft); }

.banner { border-radius: 12px; padding: 10px 14px; font-size: 14px; margin-bottom: 12px; border: 1px solid transparent; }
.banner.ok { background: var(--green-soft); color: var(--green); border-color: #CBE5D8; }
.banner.err { background: var(--red-soft); color: var(--red); border-color: #EBCACA; }

/* Utilidades */
.muted { color: var(--ink-soft); }
.small { font-size: 12px; }
.mt2 { margin-top: 8px; } .mt3 { margin-top: 12px; } .mt4 { margin-top: 16px; }
.mb2 { margin-bottom: 8px; } .mb3 { margin-bottom: 12px; } .mb4 { margin-bottom: 16px; }
.flexwrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.flexend { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.spread { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px; }

/* ============================================================
   MÓVIL (≤ 720px): cabecera compacta, sheet inferior,
   tap targets grandes, sin zoom de iOS en inputs
   ============================================================ */
@media (max-width: 720px) {
  .header { padding: 18px 14px 0; }
  .brand h1 { font-size: 27px; }
  .brand p { font-size: 12.5px; }
  .header-top { align-items: flex-start; }
  .header-stats { padding-bottom: 2px; gap: 6px; }
  .header-stats span { font-size: 11.5px; padding: 4px 10px; }

  /* En móvil la nav se colapsa en un menú desplegable con botón de hamburguesa */
  .nav-toggle { display: flex; }
  .nav {
    display: none; flex-direction: column; gap: 2px; margin-top: 12px; overflow: visible;
    mask-image: none; -webkit-mask-image: none;
    background: rgba(17, 8, 26, .35); border-radius: 12px; padding: 6px; backdrop-filter: blur(6px);
  }
  .nav.open { display: flex; }
  .nav button {
    text-align: left; width: 100%; padding: 12px 14px; border-radius: 9px; white-space: normal;
  }
  .nav button.active::after { left: 10px; right: auto; top: 50%; transform: translateY(-50%); width: 4px; height: 60%; }

  .container { padding: 20px 14px 36px; }
  .card { padding: 15px; }

  /* Inputs a 16px: evita el auto-zoom de iOS */
  .input, select.input, textarea.input { font-size: 16px; padding: 11px 12px; }

  /* Botones y pastillas con área táctil cómoda */
  .btn { padding: 11px 18px; }
  .btn-sm { padding: 8px 13px; }
  .pill { padding: 7px 15px; }
  .month-pill { padding: 8px 10px; min-width: 62px; }

  /* Modal como hoja inferior */
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal, .modal.wide {
    max-width: 100%; margin: 0; border-radius: 22px 22px 0 0;
    max-height: 94dvh; overflow-y: auto; animation: sheetUp .25s ease;
  }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: .6; } }
  .modal-head { position: sticky; top: 0; background: var(--surface); z-index: 2; border-radius: 22px 22px 0 0; }
  .modal-head::before {
    content: ""; position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 4px; border-radius: 4px; background: var(--line);
  }
  .modal-foot { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .modal-foot .btn, .modal-foot .btn-ghost { flex: 1; text-align: center; }

  .cal-nav h2 { min-width: 0; font-size: 18px; }
  .stats-row { gap: 10px; }
  .stat-card { min-width: calc(50% - 5px); padding: 12px 14px; }
  .stat-card .val { font-size: 25px; }

  /* Semana en formato de columna: un día debajo de otro */
  .week-grid { grid-template-columns: 1fr; gap: 8px; }
  .week-day-head { gap: 8px; }
  .week-day-num { font-size: 16px; }
}

@media (max-width: 420px) {
  .stat-card { min-width: 100%; }
  .header-stats span:nth-child(n+4) { display: none; } /* prioriza lo esencial */
}

/* Accesibilidad: respeta la preferencia de menos movimiento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
