/* Estilos globales del panel: tema GDC, navegación, tablas, formularios, responsive y scanner QR. */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap');

:root {
  --primary: #050505;
  --secondary: #1c120b;
  --accent: #f47a22;
  --accent-dark: #c95712;
  --gold: #f3b84a;
  --cream: #fff7ec;
  --wine: #7a1f2b;

  --bg: #f4f7fb;
  --card: #ffffff;

  --text: #1f2937;
  --text-light: #6b7280;

  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;

  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

* {
  font-family: 'Poppins', sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding-top: 86px;
  background: var(--bg);
  color: var(--text);
}

/* =====================================
   NAVBAR
===================================== */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1050;
  background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
  box-shadow: var(--shadow);
  padding: 14px 22px 24px;
  border-bottom: 3px solid var(--accent);
}

.navbar-logo {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--accent);
}

/* =====================================
   SIDEBAR
===================================== */

.sidebar-mobile {
  background: linear-gradient(180deg, var(--primary), #17110d);
  box-shadow: var(--shadow);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-desktop {
  width: 250px;
  min-width: 250px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  transition: 0.3s;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85) !important;
}

.nav-link i {
  font-size: 18px;
}

.nav-link:hover {
  background: rgba(244, 122, 34, 0.18);
  color: white !important;
  padding-left: 22px;
  transform: translateX(4px);
}

.offcanvas {
  background: linear-gradient(180deg, var(--primary), #17110d);
  width: 260px;
}

/* =====================================
   LAYOUT
===================================== */

.main-content {
  width: 100%;
  display: flex;
  flex-direction: column;
}

#dashboard {
  order: 10;
}

#dashboard_graficos {
  order: 20;
}

#modulo_asistencia {
  order: 30;
}

#asistencias {
  order: 40;
}

#eventos {
  order: 50;
}

#modulo_personas {
  order: 60;
}

#modulo_pagos {
  order: 70;
}

#finanzas {
  order: 80;
}

#multas {
  order: 90;
}

@media (min-width: 992px) {
  .sidebar-desktop {
    position: fixed;
    top: 86px;
    left: 0;
    width: 260px;
    height: calc(100vh - 86px);
    overflow-y: auto;
    z-index: 1040;
  }

  .main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
  }
}

@media (max-width: 991.98px) {
  body {
    padding-top: 74px;
  }

  .main-content {
    width: 100%;
  }
}

/* =====================================
   MODULOS Y CARDS
===================================== */

.module-section {
  background: white;
  padding: 35px;
  border-radius: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 35px;
}

.module-section h2 {
  display: flex;
  align-items: center;
  gap: 12px;
}

.module-section + .module-section {
  margin-top: 40px;
}

.card {
  border: none;
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: 0.3s;
  cursor: default;
}

.card:hover {
  transform: translateY(-3px);
}

.card-body {
  padding: 24px;
}

.card-body h2 {
  font-size: 38px;
  font-weight: 700;
  margin-top: 12px;
}

.card-title {
  font-size: 15px;
  opacity: 0.85;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-grid > [class*="col-"] {
  width: auto;
  max-width: none;
  padding: 0;
}

.dashboard-grid .card {
  height: 100%;
  min-height: 124px;
}

.dashboard-grid .card-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-height: 124px;
  padding: 18px;
}

.dashboard-grid .card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 2.3em;
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.dashboard-grid .card-body h2 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.dashboard-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.attendance-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.attendance-stat {
  background: white;
  border-left: 5px solid var(--accent);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.attendance-stat > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.attendance-stat-label {
  color: var(--text-light);
  font-weight: 600;
}

.attendance-stat strong {
  color: var(--primary);
  font-size: 1.8rem;
  line-height: 1;
}

.attendance-stat small {
  color: var(--text-light);
}

.dashboard-chart-grid > [class*="col-"] {
  width: auto;
  max-width: none;
  padding: 0;
  margin: 0 !important;
}

h2 {
  font-size: 34px;
  font-weight: 700;
  color: #1d130c;
  margin-bottom: 28px;
}

/* =====================================
   GRAFICOS
===================================== */

.chart-container {
  position: relative;
  min-height: 320px;
}

canvas {
  max-width: 100% !important;
}

/* =====================================
   TABLAS
===================================== */

.table {
  background: white;
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 0;
}

.table thead {
  background: var(--primary);
  color: white;
}

.table tbody tr {
  transition: 0.2s;
}

.table tbody tr:hover {
  background: rgba(244, 122, 34, 0.07);
}

.table td,
.table th {
  border-color: rgba(0, 0, 0, 0.05);
}

.table-responsive {
  border-radius: 18px;
  overflow-x: auto;
}

/* =====================================
   FORMULARIOS Y BOTONES
===================================== */

.form-control,
.form-select {
  border-radius: 14px;
  min-height: 48px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem rgba(244, 122, 34, 0.15);
}

.btn {
  border-radius: 12px;
  font-weight: 500;
  transition: 0.25s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary,
.btn-success {
  background-color: var(--accent) !important;
  border-color: var(--accent) !important;
}

.btn-primary:hover,
.btn-success:hover {
  background-color: var(--accent-dark) !important;
  border-color: var(--accent-dark) !important;
}

.qr-attendance-panel {
  background: #f8fafc;
  border: 1px solid rgba(47, 128, 237, 0.18);
  border-radius: 18px;
  padding: 18px;
}

.qr-attendance-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.qr-scanner-wrapper {
  position: relative;
  background: #0f172a;
  border-radius: 16px;
  margin-top: 16px;
  width: min(100%, 360px);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.qr-scanner-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qr-scanner-wrapper::after {
  content: '';
  position: absolute;
  inset: 14%;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 14px;
  box-shadow:
    0 0 0 999px rgba(15, 23, 42, 0.18),
    0 0 22px rgba(244, 122, 34, 0.28);
  pointer-events: none;
}

.qr-attendance-status {
  font-size: 0.95rem;
}

/* =====================================
   Logo cliente configurado
===================================== */

.cliente-logo,
img[data-config-img="cliente.logo"] {
  width: 44px;
  height: 44px;
  max-width: 44px;
  max-height: 44px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  flex: 0 0 auto;
}

/* =====================================
   FOOTER
===================================== */

.app-footer {
  background: var(--primary);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

/* =====================================
   RESPONSIVE
===================================== */

/* =====================================
   PESTAÑAS PRINCIPALES
===================================== */

.app-tabs-wrapper {
  position: sticky;
  top: 86px;
  z-index: 1000;
  background: white;
  border-bottom: 2px solid rgba(0,0,0,0.07);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  padding-top: 16px;
}

@media (max-width: 991.98px) {
  .app-tabs-wrapper {
    top: 74px;
    padding-top: 20px;
  }
}

.app-tabs {
  border-bottom: none;
  padding: 8px 16px 0;
  gap: 2px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.app-tabs::-webkit-scrollbar {
  display: none;
}

.app-tabs .nav-link {
  color: #000 !important;
  background: var(--accent);
  border-radius: 10px 10px 0 0;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--accent-dark);
  border-bottom: none;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
  transform: none !important;
}

.app-tabs .nav-link:hover {
  color: var(--accent) !important;
  background: #000 !important;
  padding-left: 16px !important;
  border-color: #000;
}

.app-tabs .nav-link.active {
  color: var(--accent) !important;
  background: #000 !important;
  border-color: #000;
  font-weight: 700;
}

.app-tabs .nav-link i {
  font-size: 15px;
}

@media (max-width: 420px) {
  .tab-label { display: none; }
  .app-tabs .nav-link { padding: 10px 13px; }
}

.app-tab-content {
  padding: 24px 16px 48px;
}

@media (min-width: 768px) {
  .app-tab-content { padding: 32px 28px 60px; }
}

/* =====================================
   SUB-TABS (pills)
===================================== */

.subtabs {
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.subtabs .nav-link {
  color: var(--text) !important;
  background: rgba(0,0,0,0.05);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.84rem;
  font-weight: 500;
  border: none;
  transform: none !important;
  transition: 0.2s;
}

.subtabs .nav-link:hover {
  background: rgba(244, 122, 34, 0.14);
  color: var(--accent) !important;
  padding-left: 16px !important;
}

.subtabs .nav-link.active {
  background: var(--accent) !important;
  color: white !important;
}

/* =====================================
   TABLAS CON SCROLL LIMITADO
===================================== */

.tabla-scroll {
  max-height: 460px;
  overflow-y: auto;
  border-radius: 18px;
}

.tabla-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* Historial de puntaje: todas las actividades de la temporada, con su propio scroll */
.historial-puntaje-scroll {
  max-height: 60vh;
}

.historial-puntaje-falta td {
  background: #fff5f5;
}

/* Asistencia manual: lista de integrantes con scroll propio */
.asistencia-manual-lista {
  max-height: 45vh;
}

/* Fila separadora de bloque */
.tabla-bloque-header td {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  padding: 8px 12px;
}

/* Columnas fijas (Integrantes y Retirados): Nombre y RUT quedan a la vista
   al desplazar la tabla hacia el lado; solo el resto de los datos se mueve.
   El ancho de .col-fija debe coincidir con el left de .col-fija-2. */
@media (min-width: 768px) {
  /* .table trae overflow: hidden (para redondear esquinas), y eso convierte a la
     tabla en el contenedor de los elementos fijos: no se fijaba ni el Nombre/RUT
     ni el encabezado. Las esquinas las redondea igual el contenedor con scroll. */
  .tabla-columnas-fijas table {
    overflow: visible;
  }

  .tabla-columnas-fijas .col-fija,
  .tabla-columnas-fijas .col-fija-2 {
    position: sticky;
    z-index: 1;
  }

  .tabla-columnas-fijas .col-fija {
    left: 0;
    width: 220px;
    min-width: 220px;
    max-width: 220px;
  }

  /* Se monta 2px sobre .col-fija para que no quede una rendija (bordes de la
     tabla) por donde se vea el texto de las columnas que se desplazan. */
  .tabla-columnas-fijas .col-fija-2 {
    left: 218px;
    white-space: nowrap;
  }

  /* Borde que marca dónde termina la parte fija */
  .tabla-columnas-fijas .col-fija-2::after {
    content: '';
    position: absolute;
    top: 0;
    right: -1px;
    bottom: 0;
    width: 2px;
    background: rgba(0, 0, 0, 0.15);
  }

  /* Encabezado: fijo arriba y a la izquierda, sobre el resto */
  .tabla-columnas-fijas thead .col-fija,
  .tabla-columnas-fijas thead .col-fija-2 {
    z-index: 3;
  }

  .tabla-columnas-fijas .bloque-header-texto {
    display: inline-block;
    position: sticky;
    left: 12px;
  }
}

/* Integrantes en móvil: la tabla de 13 columnas pasa a tarjetas
   (Nombre como título, el resto en pares etiqueta:valor, Estado y
   Acciones sin etiqueta). Depende de los data-label que agrega
   renderizarTablaPersonas() — solo aplica a esta tabla. */
@media (max-width: 767.98px) {
  #tabla_personas_wrapper.tabla-scroll {
    max-height: none;
    overflow-y: visible;
  }

  #tabla_personas_wrapper table,
  #tabla_personas_wrapper tbody,
  #tabla_personas_wrapper tr,
  #tabla_personas_wrapper td {
    display: block;
    width: 100%;
  }

  #tabla_personas_wrapper thead {
    display: none;
  }

  #tabla_personas_wrapper tr:not(.tabla-bloque-header) {
    background: var(--card);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 12px 14px;
    margin-bottom: 10px;
    border: none !important;
  }

  #tabla_personas_wrapper td {
    border: none !important;
    padding: 4px 0;
  }

  #tabla_personas_wrapper td[data-label]:empty {
    display: none;
  }

  #tabla_personas_wrapper td[data-label]:not(.td-nombre):not(.td-estado):not(.td-acciones) {
    position: relative;
    min-height: 22px;
    padding-left: 42%;
    font-size: 0.85rem;
    color: var(--text);
  }

  #tabla_personas_wrapper td[data-label]:not(.td-nombre):not(.td-estado):not(.td-acciones)::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    top: 4px;
    width: 40%;
    padding-right: 8px;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-light);
  }

  #tabla_personas_wrapper .td-nombre {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    padding-bottom: 6px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
  }

  #tabla_personas_wrapper .td-estado {
    padding-top: 8px;
  }

  #tabla_personas_wrapper .td-acciones {
    padding-top: 10px;
    text-align: right;
  }

  #tabla_personas_wrapper .tabla-bloque-header {
    margin: 14px 0 8px;
    border-radius: 10px;
    overflow: hidden;
  }

  #tabla_personas_wrapper .tabla-bloque-header:first-child {
    margin-top: 0;
  }
}

/* =====================================
   MÓDULO ASISTENCIA — SCAN-IT STYLE
===================================== */

/* Asistencia ocupa todo el espacio disponible sin padding del tab */
#tab_asistencia {
  padding: 0 !important;
}

.scanner-centrado {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 74px - 52px); /* móvil: navbar + tabs */
}

@media (min-width: 992px) {
  .scanner-centrado {
    min-height: calc(100vh - 86px - 52px); /* escritorio: navbar + tabs */
  }
}

.scanner-centrado > .mb-3 {
  padding: 16px 16px 0;
}

.scanner-panel {
  background: #16213e;
  border-radius: 0;
  padding: 16px;
  color: white;
  flex: 1;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .scanner-centrado > .mb-3 {
    padding: 20px 28px 0;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  .scanner-panel {
    padding: 20px 28px 28px;
    align-items: center;
  }

  .scanner-panel > * {
    width: 100%;
    max-width: 520px;
  }
}

/* Botón selector de evento (móvil) */
.btn-evento-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: #0f3460;
  color: white;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 16px 20px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s;
  text-align: left;
}

.btn-evento-selector:hover,
.btn-evento-selector:focus {
  background: #1a4a80;
  outline: none;
}

.btn-evento-selector > i:first-child {
  color: var(--accent);
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* Video wrapper */
.scanner-video-wrapper {
  position: relative;
  background: #0a0a1a;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  width: 100%;
  margin-bottom: 16px;
  flex-shrink: 0;
}

/* Móvil: recuadro de cámara más alto — el 4/3 quedaba muy chico en pantalla angosta */
@media (max-width: 767px) {
  .scanner-video-wrapper {
    aspect-ratio: 2 / 3;
  }
}

.scanner-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(2); /* facilita centrar el QR; el lector analiza cuadro completo y recortes */
  transform-origin: center;
}

/* Marco de enfoque */
.scanner-video-wrapper::before {
  content: '';
  position: absolute;
  inset: 12%;
  border: 2px solid rgba(255,255,255,0.65);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.28);
  pointer-events: none;
  z-index: 1;
}

/* Línea roja animada */
.scanner-line {
  position: absolute;
  left: 12%;
  right: 12%;
  height: 2px;
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239,68,68,0.9), 0 0 20px rgba(239,68,68,0.4);
  animation: scanLine 2s ease-in-out infinite;
  border-radius: 2px;
  z-index: 2;
}

@keyframes scanLine {
  0%, 100% { top: 14%; }
  50%       { top: 83%; }
}

/* Status text */
.scanner-status {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.7);
  min-height: 1.4em;
  margin-bottom: 14px;
}

/* Botones scan/stop */
.scanner-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-scan {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: 0.2s;
  width: 100%;
}

.btn-scan:hover:not(:disabled) { background: var(--accent-dark); }

.btn-scan:disabled {
  background: #3a3a5c;
  cursor: not-allowed;
  color: rgba(255,255,255,0.45);
}

.btn-stop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  width: 100%;
}

.btn-stop:hover { background: rgba(255,255,255,0.18); }

/* Botón linterna (solo visible en dispositivos que permiten controlar el flash) */
.btn-torch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  width: 100%;
}

.btn-torch:hover { background: rgba(255,255,255,0.18); }

.btn-torch.activo {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #1a1a1a;
}

/* Input manual */
.manual-input .form-control {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: white;
  border-radius: 12px 0 0 12px;
  min-height: 50px;
  font-size: 1rem;
}

.manual-input .form-control::placeholder { color: rgba(255,255,255,0.38); }

.manual-input .form-control:focus {
  background: rgba(255,255,255,0.13);
  border-color: var(--accent);
  color: white;
  box-shadow: none;
}

.btn-accent {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0 22px;
  border-radius: 0 12px 12px 0;
  font-size: 1.1rem;
  min-height: 50px;
  cursor: pointer;
  transition: 0.2s;
}

.btn-accent:hover { background: var(--accent-dark); color: white; }

/* Modal eventos */
.modal-eventos-content { border-radius: 20px; overflow: hidden; }

.modal-eventos-header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
}

#lista_eventos_modal .btn-evento-item {
  background: #f8fafc;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 14px 16px;
  font-weight: 500;
  text-align: left;
  color: var(--text);
  transition: 0.2s;
}

#lista_eventos_modal .btn-evento-item:hover {
  background: rgba(244,122,34,0.08);
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 768px) {
  .sidebar-mobile {
    min-height: auto !important;
    padding: 15px !important;
  }

  .btn-mobile-full {
    width: 100%;
  }

  .card-body h2 {
    font-size: 28px;
  }

  .main-content {
    width: 100% !important;
    margin-left: 0 !important;
    padding: 18px !important;
  }

  .module-section {
    padding: 20px;
    border-radius: 20px;
  }

  h2 {
    font-size: 28px;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .dashboard-grid .card {
    min-height: 104px;
    border-radius: 16px;
  }

  .dashboard-grid .card-body {
    min-height: 104px;
    padding: 14px;
  }

  .dashboard-grid .card-title {
    min-height: 2.4em;
    font-size: 0.72rem;
  }

  .dashboard-grid .card-body h2 {
    font-size: clamp(1.35rem, 7vw, 1.8rem);
  }

  .dashboard-chart-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .attendance-stat-grid {
    grid-template-columns: 1fr;
  }

  .chart-container {
    min-height: 280px;
  }

  .table {
    font-size: 0.86rem;
  }

  .table td,
  .table th {
    padding: 0.6rem 0.7rem;
  }

  .table .btn-group-sm .btn {
    min-width: 2rem;
    min-height: 1.9rem;
  }

  /* =====================================
   Logo cliente configurado
  ===================================== */

  .cliente-logo,
  img[data-config-img="cliente.logo"] {
    width: 34px;
    height: 34px;
    max-width: 34px;
    max-height: 34px;
  }

}

/* ── Reloj en vivo ── */
.scanner-reloj {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1rem 0.25rem;
  color: var(--accent);
}
#reloj_hora {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
}
#reloj_fecha {
  font-size: 0.8rem;
  opacity: 0.75;
  text-transform: capitalize;
  margin-top: 0.15rem;
}

/* ── Últimos registros de asistencia ── */
.ultimos-registros-wrapper {
  margin: 1rem 1rem 0;
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 0.75rem;
}
/* Indicador de asistentes de la actividad (X/Y integrantes activos) */
.indicador-asistentes {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 0.6rem 0.9rem;
  color: #fff;
}
.indicador-asistentes-titulo {
  color: rgba(255,255,255,0.6);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
#indicador_asistentes_valor {
  font-size: 1.4rem;
  color: var(--accent);
}
#indicador_asistentes_pct {
  color: rgba(255,255,255,0.7);
}
.indicador-asistentes-barra {
  height: 6px;
  margin-top: 0.4rem;
  background: rgba(255,255,255,0.12);
}
.indicador-asistentes-barra .progress-bar {
  background: var(--accent);
}

.ultimos-registros-titulo {
  color: rgba(255,255,255,0.5);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}
/* Lista completa con scroll propio: alto según la pantalla, sin alargar la vista. */
.ultimos-registros-scroll {
  max-height: 40vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
@media (min-width: 768px) {
  .ultimos-registros-scroll {
    max-height: 50vh;
  }
}
.ultimos-registros-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.ultimos-registros-tabla td {
  padding: 4px 6px;
  color: rgba(255,255,255,0.85);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ultimos-registros-tabla td:last-child {
  text-align: right;
  white-space: nowrap;
}
.ultimos-registros-tabla .btn-outline-dark {
  color: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.5);
}

/* ── Logo institucional en panel scanner ── */
.scanner-logo-bg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}
.scanner-logo-img {
  width: min(180px, 45vw);
  border-radius: 50%;
  opacity: 0.18;
  pointer-events: none;
  user-select: none;
}

.formacion-fila-estatutaria {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .formacion-fila-estatutaria {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .formacion-fila-estatutaria {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
}

/* Roles sin permiso de eliminar (director1-3): se ocultan los botones de borrar.
   El servidor igual rechaza cualquier eliminación (roleMiddleware). */
body.sin-eliminar [onclick*="eliminarEvento"],
body.sin-eliminar [onclick*="eliminarPersona"],
body.sin-eliminar [onclick*="eliminarPago"],
body.sin-eliminar [onclick*="eliminarGasto"],
body.sin-eliminar [onclick*="eliminarIngreso"] {
  display: none !important;
}

/* Vestimenta distinta (Art. 8.4): badge y botón en Tablas → Asistencias */
.badge-vestimenta {
  background-color: #6f42c1;
  color: #fff;
}

.btn-vestimenta {
  color: #6f42c1;
  border-color: #6f42c1;
}

.btn-vestimenta:hover,
.btn-vestimenta:focus {
  color: #fff;
  background-color: #6f42c1;
  border-color: #6f42c1;
}

/* ===================================================================
   Planilla de Cuotas (matriz mensual, estética de hoja de cálculo).
   Look claro deliberado: tarjeta blanca tipo Excel sobre el panel.
   =================================================================== */
.planilla-cuotas {
  --pc-grid: #d5d8dc;
  --pc-head-bg: #eef0f2;
  --pc-head-ink: #53585f;
  --pc-excel: #217346;
  --pc-ink: #1f2328;
  --pc-row-alt: #fbfcfd;
  --pc-block-bg: #e9edf3;
  --pc-block-ink: #2c3e63;
  --pc-ok-bg: #cdebd6;   --pc-ok-ink: #12623a;
  --pc-pend-bg: #fdeeb0; --pc-pend-ink: #7a5a00;
  --pc-venc-bg: #f6c9cc; --pc-venc-ink: #9a1c1c;
  --pc-abono-bg: #cfe0fb;--pc-abono-ink: #1b4ea8;
  --pc-fut-bg: #f1f2f4;  --pc-fut-ink: #b2b8bf;
  --pc-tot-bg: #eaf4ee;  --pc-tot-ink: #15663a;
  border: 1px solid #c3c7cc;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.planilla-cuotas .pc-scroll {
  overflow: auto;
  max-height: 68vh;
  background: #fff;
}
.planilla-cuotas .pc-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 13px;
  color: var(--pc-ink);
  font-variant-numeric: tabular-nums;
}
.planilla-cuotas .pc-table th,
.planilla-cuotas .pc-table td {
  border-right: 1px solid var(--pc-grid);
  border-bottom: 1px solid var(--pc-grid);
  white-space: nowrap;
}
/* fila de letras de columna (A, B, C...) */
.planilla-cuotas .pc-cols th {
  background: var(--pc-head-bg);
  color: var(--pc-head-ink);
  font-weight: 600;
  height: 21px;
  text-align: center;
  font-size: 10.5px;
  letter-spacing: .04em;
  position: sticky;
  top: 0;
  z-index: 5;
}
/* fila de títulos (meses) */
.planilla-cuotas .pc-titles th {
  background: #e6e9ec;
  color: var(--pc-ink);
  font-weight: 600;
  padding: 7px 6px;
  text-align: center;
  position: sticky;
  top: 21px;
  z-index: 5;
}
.planilla-cuotas .pc-anio {
  display: block;
  font-size: 9.5px;
  font-weight: 500;
  color: #8a9099;
}
/* columnas congeladas: número de fila + nombre */
.planilla-cuotas .pc-rownum {
  background: var(--pc-head-bg);
  color: var(--pc-head-ink);
  text-align: center;
  font-size: 10.5px;
  font-weight: 600;
  width: 32px;
  min-width: 32px;
  position: sticky;
  left: 0;
  z-index: 3;
}
.planilla-cuotas .pc-colname {
  position: sticky;
  left: 32px;
  z-index: 3;
  background: #fff;
  min-width: 220px;
  text-align: left;
  font-weight: 600;
  color: #17407a;
  padding: 6px 10px;
}
.planilla-cuotas tbody tr:nth-child(even) .pc-colname { background: var(--pc-row-alt); }
/* esquinas (intersección congelada) */
.planilla-cuotas .pc-cTL  { position: sticky; left: 0;    top: 0;    z-index: 7; background: var(--pc-head-bg); width: 32px; }
.planilla-cuotas .pc-cNAME{ position: sticky;            top: 0;    z-index: 6; background: var(--pc-head-bg); }
.planilla-cuotas .pc-cTL2 { position: sticky; left: 0;    top: 21px; z-index: 7; background: #e6e9ec; }
.planilla-cuotas .pc-cNAME2{ position: sticky; left: 32px; top: 21px; z-index: 7; background: #e6e9ec; text-align: left; padding-left: 10px; }
.planilla-cuotas .pc-cNAME { position: sticky; left: 32px; top: 0; z-index: 6; background: var(--pc-head-bg); }

.planilla-cuotas tbody td { padding: 6px 8px; }
.planilla-cuotas tbody tr:nth-child(even) td { background: var(--pc-row-alt); }

/* separador de bloque (como la pestaña Integrantes) */
.planilla-cuotas tr.pc-block td {
  background: var(--pc-block-bg);
  color: var(--pc-block-ink);
  font-weight: 700;
  padding: 5px 10px;
  position: sticky;
  left: 0;
  font-size: 12.5px;
}
/* celdas de mes */
.planilla-cuotas td.pc-mc {
  text-align: center;
  font-weight: 700;
  width: 46px;
  min-width: 46px;
  font-size: 14px;
  line-height: 1;
}
.planilla-cuotas .pc-ok,    .planilla-cuotas tbody tr:nth-child(even) td.pc-ok    { background: var(--pc-ok-bg);    color: var(--pc-ok-ink); }
.planilla-cuotas .pc-pend,  .planilla-cuotas tbody tr:nth-child(even) td.pc-pend  { background: var(--pc-pend-bg);  color: var(--pc-pend-ink); }
.planilla-cuotas .pc-venc,  .planilla-cuotas tbody tr:nth-child(even) td.pc-venc  { background: var(--pc-venc-bg);  color: var(--pc-venc-ink); }
.planilla-cuotas .pc-abono, .planilla-cuotas tbody tr:nth-child(even) td.pc-abono { background: var(--pc-abono-bg); color: var(--pc-abono-ink); }
.planilla-cuotas .pc-fut,   .planilla-cuotas tbody tr:nth-child(even) td.pc-fut   { background: var(--pc-fut-bg);   color: var(--pc-fut-ink); }

.planilla-cuotas td.pc-deuda { text-align: right; font-weight: 600; padding-right: 10px; }
.planilla-cuotas .pc-d-si { color: #9a1c1c; }
.planilla-cuotas .pc-d-no { color: #12623a; }

/* fila de totales fija abajo */
.planilla-cuotas tfoot td {
  position: sticky;
  bottom: 0;
  background: var(--pc-tot-bg);
  color: var(--pc-tot-ink);
  font-weight: 700;
  border-top: 2px solid var(--pc-excel);
  z-index: 4;
  text-align: right;
  font-size: 11.5px;
  padding: 7px 6px;
}
.planilla-cuotas tfoot td.pc-tlabel {
  position: sticky;
  left: 0;
  z-index: 6;
  text-align: left;
  padding-left: 10px;
}
.planilla-cuotas .pc-empty {
  padding: 22px;
  text-align: center;
  color: #6b7280;
}
@media (max-width: 575px) {
  .planilla-cuotas .pc-colname { min-width: 150px; }
}
