/* ═══════════════════════════════════════════════════════════════════
   FireGen — css/styles.css
   Centralizado desde index.html V2.75 — no duplicar en otros archivos.
   Nota: La fuente Inter se carga desde <link> en los HTML con preconnect.
═══════════════════════════════════════════════════════════════════ */

/* ── BASE ── */
body {
  font-family: 'Inter', sans-serif;
  background-color: #f1f5f9;
  color: #1e293b;
}

.card {
  background: white;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  transition: all 0.2s;
}

.tab-active {
  border-bottom: 3px solid #ea580c;
  color: #ea580c;
  font-weight: 700;
  background: #fff7ed;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.70rem;
  font-weight: 700;
  text-transform: uppercase;
}

.table-container {
  max-height: 65vh;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 10;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

/* iOS zoom prevention */
input,
select,
textarea {
  font-size: 16px !important;
}

/* ── ASISTENCIA ── */
.btn-attendance {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.15s;
  cursor: pointer;
}

.att-present {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.att-absent {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.att-new {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  font-weight: bold;
}

.att-empty {
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
}

.att-not-applicable {
    background: #f8fafc;
    color: #cbd5e1;
    border: 1px dashed #e2e8f0;
    cursor: not-allowed;
    opacity: 0.5;
}

/* ── PRINT ARCHITECTURE ── */
#monthlyReportPrint {
    display: none;
}

@media print {
    .no-print,
    #directorioOverlay,
    #notificacionesOverlay,
    #rescateOverlay,
    #coordinacionOverlay,
    #expedienteOverlay {
        display: none !important;
    }

    body {
        background: white;
        padding: 0;
    }

    body > * {
        visibility: hidden !important;
    }

    body > #monthlyReportPrint {
        visibility: visible !important;
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    body > #monthlyReportPrint * {
        visibility: visible !important;
    }

    thead {
        display: table-header-group;
    }

    tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .card {
        box-shadow: none;
        border: 1px solid #e2e8f0;
        margin-bottom: 20px;
    }
}

/* ── SLIDE-OVER EXPEDIENTE ── */
#expedienteOverlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}

#expedienteOverlay.active {
  pointer-events: all;
  opacity: 1;
}

#expedienteOverlay .exp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

#expedienteOverlay .exp-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  background: #fff;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(.4, 0, .2, 1);
  box-shadow: -10px 0 50px rgba(0, 0, 0, 0.2);
}

#expedienteOverlay.active .exp-panel {
  transform: translateX(0);
}

/* ── AVATARES Y FOTOS (Estandarización y Optimización Responsiva) ── */
.exp-avatar,
.dir-photo,
.mobile-member-photo {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  max-width: 100%;
  aspect-ratio: 1 / 1;
}

.exp-avatar-placeholder,
.dir-photo-placeholder,
.mobile-member-photo-ph {
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #b45309);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  flex-shrink: 0;
  max-width: 100%;
  aspect-ratio: 1 / 1;
}

.exp-avatar {
  width: 100px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  background: #f1f5f9;
}

.exp-avatar-placeholder {
  width: 100px;
  font-size: 2.8rem;
  border: 4px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* ── NOMBRE CLICABLE ── */
.member-name-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #1e293b;
  font-weight: 700;
  text-align: left;
  padding: 0;
  transition: color 0.15s;
  text-decoration: underline dotted #cbd5e1;
}

.member-name-btn:hover {
  color: #ea580c;
}

/* ── RESCUE CHIPS ── */
.rescue-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 12px;
  padding: 10px 14px;
  transition: box-shadow 0.2s;
}

.rescue-chip:hover {
  box-shadow: 0 2px 8px rgba(239, 68, 68, .15);
}

.rescue-chip .chip-name {
  font-weight: 700;
  color: #991b1b;
  font-size: 0.85rem;
}

.rescue-chip .chip-phone {
  font-size: 0.75rem;
  color: #64748b;
}

/* ── ENGAGEMENT BADGES ── */
.eng-activo {
  background: #dcfce7;
  color: #166534;
}

.eng-inconstante {
  background: #fef9c3;
  color: #854d0e;
}

.eng-enfriando {
  background: #ffedd5;
  color: #9a3412;
}

.eng-alejado {
  background: #fee2e2;
  color: #991b1b;
}

/* ── SAVE FLASH ── */
@keyframes saveFlash {
  0% {
    opacity: 1
  }

  50% {
    opacity: .4
  }

  100% {
    opacity: 1
  }
}

.save-flash {
  animation: saveFlash 0.5s;
}

/* ── TABLA HISTÓRICA solo lectura ── */
.hist-readonly {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  text-align: center;
  font-size: 0.95rem;
  border: none;
  outline: none;
  width: 100%;
  cursor: default;
}

/* ── GRÁFICA CARD ── */
#chartCard {
  background: linear-gradient(135deg, #0f172a, #1e293b);
}

#chartCard h3 {
  color: #f97316;
}

/* ── ANÁLISIS TEXTAREA ── */
#analysisTextarea {
  resize: vertical;
  min-height: 90px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  outline: none;
  transition: border-color 0.2s;
  font-family: 'Inter', sans-serif;
}

#analysisTextarea:focus {
  border-color: #ea580c;
}

/* ── AUTOGUARDADO BADGE ── */
.auto-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #dcfce7;
  color: #166534;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 99px;
  transition: opacity 0.5s;
  opacity: 0;
}

.auto-badge.show {
  opacity: 1;
}

/* ── DIRECTORIO MAESTRO ── */
#directorioOverlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(.4, 0, .2, 1);
  overflow: hidden;
}

#directorioOverlay.active {
  transform: translateY(0);
}

#directorioOverlay .dir-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0c1a2e 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#directorioOverlay .dir-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8fafc;
}

/* ═══════════════════════════════════════
   OVERLAYS GENÉRICOS (Rescate / Coordinación)
   Mismo patrón que #directorioOverlay
════════════════════════════════════════ */
#rescateOverlay,
#coordinacionOverlay,
#notificacionesOverlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(.4, 0, .2, 1);
  overflow: hidden;
}

#rescateOverlay.active,
#coordinacionOverlay.active,
#notificacionesOverlay.active {
  transform: translateY(0);
}

.overlay-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0c1a2e 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.overlay-body {
  flex: 1;
  overflow-y: auto;
  background: #f8fafc;
}

/* ═══════════════════════════════════════
   BOTONES FLOTANTES (FAB) — Plan al Rescate / Coordinación
════════════════════════════════════════ */
.fab-btn {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: white;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(239,68,68,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
  user-select: none;
}

.fab-btn:hover,
.fab-btn:active {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(239,68,68,0.5);
}

.fab-btn-coord {
  bottom: 148px; /* apilado sobre el de rescate */
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  box-shadow: 0 4px 20px rgba(79,70,229,0.4);
}

.fab-btn-coord:hover,
.fab-btn-coord:active {
  box-shadow: 0 6px 28px rgba(79,70,229,0.5);
}

.fab-label {
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
}

/* En desktop, mover FABs a posición más cómoda */
@media (min-width: 1024px) {
  .fab-btn {
    bottom: 24px;
    right: 24px;
  }
  .fab-btn-coord {
    bottom: 96px;
    right: 24px;
  }
}

.dir-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  padding: 16px;
  display: flex;
  gap: 14px;
  transition: box-shadow 0.2s, transform 0.2s;
  border: 1px solid #f1f5f9;
}

.dir-card:hover {
  box-shadow: 0 6px 24px rgba(234, 88, 12, 0.12);
  transform: translateY(-1px);
}

.dir-photo {
  width: 76px;
  height: 76px;
  border: 3px solid #fed7aa;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.dir-photo-placeholder {
  width: 76px;
  height: 76px;
  font-size: 1.8rem;
  border: 3px solid #fed7aa;
}

.dir-info {
  flex: 1;
  min-width: 0;
}

.dir-name {
  font-weight: 900;
  font-size: 0.95rem;
  color: #0f172a;
  margin-bottom: 2px;
}

.dir-meta {
  font-size: 0.73rem;
  color: #64748b;
  margin-bottom: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.dir-badge {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
}

.dir-spirit {
  font-size: 0.72rem;
  color: #475569;
  margin-top: 4px;
}

.dir-wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #22c55e;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  margin-top: 6px;
}

.dir-wa-btn:hover {
  background: #16a34a;
}

/* ── BOTTOM NAVIGATION MÓVIL ── */
#bottomNav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: white;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  padding: 6px 0 env(safe-area-inset-bottom, 6px);
}

.bottom-nav-inner {
  display: flex;
  align-items: stretch;
}

.bn-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  gap: 3px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.bn-btn i {
  font-size: 1.15rem;
}

.bn-btn.bn-active {
  color: #ea580c;
}

.bn-btn.bn-active i {
  transform: scale(1.15);
}


/* ── MOBILE CARDS Base Maestro ── */
.mobile-member-card {
  background: white;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  gap: 10px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  border: 1px solid #f1f5f9;
  margin-bottom: 8px;
  transition: box-shadow 0.2s;
}

.mobile-member-card:active {
  box-shadow: 0 2px 10px rgba(234, 88, 12, 0.12);
}

.mobile-member-photo {
  width: 48px;
  height: 48px;
  border: 2px solid #fed7aa;
}

.mobile-member-photo-ph {
  width: 48px;
  height: 48px;
  font-size: 1.1rem;
  border: 2px solid #fed7aa;
}

.mobile-member-info {
  flex: 1;
  min-width: 0;
}

.mobile-member-name {
  font-weight: 800;
  font-size: 0.88rem;
  color: #0f172a;
}

.mobile-member-sub {
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 1px;
}

/* FIX responsive: permite que las 4 acciones (Ver/Editar/WA/Eliminar) pasen a una
   segunda línea en pantallas angostas en vez de desbordar el ancho de la tarjeta */
.mobile-member-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

/* ── SIN CULTO PANEL (solo móvil) ── */
#sin-culto-mobile-wrapper {
  display: block;
}
@media (min-width: 768px) {
  #sin-culto-mobile-wrapper {
    display: none;
  }
}


.mobile-att-card {
  background: white;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  gap: 10px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  border: 1px solid #f1f5f9;
  margin-bottom: 8px;
}

.mobile-att-info {
  flex: 1;
  min-width: 0;
}

.mobile-att-name {
  font-weight: 800;
  font-size: 0.85rem;
  color: #0f172a;
  margin-bottom: 6px;
}

.mobile-att-weeks {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.mobile-att-label {
  font-size: 0.6rem;
  color: #94a3b8;
  font-weight: 700;
  margin-top: 4px;
}

/* ── V3.0: LOGOUT BUTTON ── */
#logoutBtn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fee2e2;
  color: #991b1b;
  border: none;
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

#logoutBtn:hover {
  background: #fecaca;
}

/* ── ERROR BANNER ── */
#connectionBanner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: #dc2626;
  color: white;
  text-align: center;
  padding: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  transform: translateY(-100%);
  transition: transform 0.3s;
}

#connectionBanner.show {
  transform: translateY(0);
}

/* ── PWA SPLASH SCREEN ── */
#splashScreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease-out;
}

#splashScreen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-spinner {
  border: 4px solid rgba(249, 115, 22, 0.2);
  border-top-color: #ea580c;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-top: 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* ── UPDATE MODAL (oculto por defecto; solo .show lo revela) ── */
#updateModal {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 20px;
  max-width: 320px;
  transform: translateY(150%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.35s ease, opacity 0.25s ease, visibility 0.25s ease;
}

#updateModal.show {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ════════════════════ OPTIMIZACIÓN UI/UX MÓVIL (V3.0) ════════════════════ */
@media (max-width: 767px) {

  /* 1. Navegación y Estructura Global */
  #bottomNav {
    display: block;
  }

  #topNav {
    display: none !important;
  }

  body {
    padding-bottom: calc(115px + env(safe-area-inset-bottom, 15px)) !important;
  }

  #updateModal {
    bottom: 80px;
    left: 20px;
    right: 20px;
    max-width: 100%;
  }

  /* 2. Tarjetas y Contenedores (Reducir scroll vertical) */
  .card {
    border-radius: 12px !important;
    padding: 14px !important;
    margin-bottom: 10px !important;
  }

  /* 3. Formularios, Selects y Buscadores (Reducir altura) */
  input[type="text"],
  input[type="date"],
  input[type="month"],
  input[type="number"],
  select,
  textarea {
    padding: 10px 12px !important;
    border-radius: 8px !important;
  }

  /* Textarea de Análisis: ocupa mucho espacio, se reduce altura inicial */
  #analysisTextarea {
    min-height: 70px !important;
  }

  /* Buscador Maestro */
  #searchInput {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    padding-left: 40px !important;
  }

  /* Gap de formularios para reducir separación vertical */
  form.grid,
  .grid.gap-4,
  .grid.gap-6,
  .grid.gap-8 {
    gap: 12px !important;
  }

  /* 4. Botones (Reducir altura táctil sin perder usabilidad) */
  button:not(.bn-btn, .btn-attendance) {
    padding: 10px 16px !important;
    border-radius: 8px !important;
  }

  /* 5. KPIs */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  .kpi-card {
    padding: 12px 10px !important;
  }

  .kpi-card h3 {
    font-size: 1.35rem !important;
    margin-top: 2px !important;
  }

  .kpi-card p {
    margin-top: 4px !important;
  }

  /* 6. Tablas y Gráficas (Evitar paneo excesivo) */
  .table-container {
    max-height: 55vh !important;
  }

  .table-container table {
    min-width: 500px !important;
  }

  #chartCard .relative {
    height: 200px !important;
  }

  /* 7. Modales (Estandarización visual) */
  #userModal .p-4,
  #userModal .p-8 {
    padding: 16px !important;
  }

  #userModal form {
    gap: 12px !important;
  }

  #userModal h2 {
    font-size: 1.25rem !important;
  }

  /* 8. Header principal — evita desbordamiento por email largo en logoutBtn */
  #logoutBtn {
    max-width: 100%;
    overflow: hidden;
  }

  #logoutBtn #userEmailDisplay {
    display: inline-block;
    max-width: 44vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }

  /* 9. Directorio Profesional — Causa raíz del scroll horizontal:
     el buscador tenía un ancho fijo (160px) que, sumado al título y al botón
     de cerrar en una sola fila, no cabía en viewports desde 320px. Se pasa
     el header a dos filas y el buscador a ancho fluido. */
  #directorioOverlay .dir-header {
    flex-wrap: wrap;
    row-gap: 10px;
    padding: 14px 16px;
  }

  #directorioOverlay .dir-header>div:first-child,
  #directorioOverlay .dir-header>div:last-child {
    width: 100%;
  }

  #directorioOverlay .dir-header>div:last-child {
    justify-content: space-between;
  }

  #directorioOverlay .dir-header .relative {
    flex: 1;
    min-width: 0;
  }

  #dirSearch {
    width: 100% !important;
  }

  /* 10. Refinamiento adicional de compacidad (320px–480px) */
  header h1 {
    font-size: 1.35rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   RÉCORD Y RECONOCIMIENTOS — RESPONSIVE (SOLO #view-records)
   No afecta Nominal, Informe, Estrategias, Master ni otros módulos.
═══════════════════════════════════════════════════════════════════ */

/* ── Body lock while Records is open ── */
body.firegen-records-open {
  overflow: hidden !important;
  padding-bottom: 0 !important;
}

/* ── Base view-records: fullscreen overlay ── */
#view-records {
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Records section tabs scroll ── */
.records-section-tabs {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.records-section-tabs::-webkit-scrollbar {
  display: none;
}

/* ── Records table scroll containers ── */
.records-table-scroll,
.records-nextgen-scroll,
.records-invitaciones-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ── MOBILE — max-width: 767px ── */
@media (max-width: 767px) {

  /* View-records: safe area top */
  #view-records {
    padding-top: env(safe-area-inset-top, 0px);
  }

  /* Header: compact two-row layout */
  #view-records .records-header {
    padding: 12px 14px !important;
    gap: 8px !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  #view-records .records-header h2 {
    font-size: 1.15rem !important;
    line-height: 1.3 !important;
  }

  #view-records .records-header h2 i {
    flex-shrink: 0;
  }

  #view-records .records-header p {
    font-size: 0.7rem !important;
    margin-top: 2px !important;
  }

  /* Volver button: compact */
  #view-records .records-header .records-btn-back {
    padding: 8px 12px !important;
    font-size: 0.75rem !important;
    align-self: flex-start;
  }

  #view-records .records-header .records-btn-back .records-back-full {
    display: none;
  }
  #view-records .records-header .records-btn-back .records-back-short {
    display: inline;
  }

  /* Tabs bar: compact horizontal scroll */
  #view-records .records-section-tabs {
    padding: 0 8px;
    gap: 4px !important;
  }

  #view-records .records-section-tabs button {
    padding: 10px 8px !important;
    font-size: 0.72rem !important;
    white-space: nowrap;
    min-width: max-content;
  }

  /* Main content area: tighter padding */
  #view-records .records-main-content {
    padding: 12px !important;
  }

  #view-records .records-main-content .space-y-6 > * + * {
    margin-top: 12px;
  }

  /* Cards inside records: compact */
  #view-records .card {
    padding: 12px !important;
    border-radius: 12px !important;
  }

  /* Section headers: wrap title + button */
  #view-records .records-section-header {
    flex-wrap: wrap;
    gap: 8px !important;
  }

  #view-records .records-section-header h3 {
    font-size: 0.85rem !important;
    flex: 1 1 0%;
    min-width: 0;
  }

  #view-records .records-section-header button {
    padding: 8px 12px !important;
    font-size: 0.7rem !important;
  }

  /* Dashboard reconocimientos: 1 column */
  #recordsDashboard {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* Individual records table */
  #view-records .records-table-scroll table {
    min-width: 680px !important;
  }

  #view-records .records-table-scroll th,
  #view-records .records-table-scroll td {
    padding: 6px 4px !important;
    font-size: 0.65rem !important;
  }

  /* NextGen table */
  #view-records .records-nextgen-scroll table {
    min-width: 500px !important;
  }

  /* Invitaciones table */
  #view-records .records-invitaciones-scroll table {
    min-width: 500px !important;
  }

  /* Period config: compact */
  #periodFormPanel .grid {
    grid-template-columns: 1fr !important;
  }

  /* Active period bar */
  #activePeriodPanel .flex-wrap {
    gap: 6px;
  }

  #activePeriodPanel .flex-wrap button {
    padding: 6px 10px !important;
    font-size: 0.65rem !important;
  }

  /* Filter select */
  #recordsFilterType {
    font-size: 0.7rem !important;
    padding: 6px 8px !important;
  }

  /* NextGen month selector mobile */
  #view-records .records-nextgen-month-mobile {
    display: block;
    margin-bottom: 12px;
  }

  /* Modals: ensure scrollable on small screens */
  #nextGenModal > div,
  #invitacionModal > div,
  #premioModal > div {
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
  }
}

/* ── Desktop: hide short back text, show full ── */
.records-btn-back .records-back-short {
  display: none;
}
.records-btn-back .records-back-full {
  display: inline;
}