/* -------------------------------------------------------------
 * SISTEMA DE DISEÑO PREMIUM - GREENVIC PERU SAC
 * ------------------------------------------------------------- */

:root {
  /* Paleta de colores HSL */
  --primary: #10b981;          /* Esmeralda Vibrante */
  --primary-hover: #059669;    /* Verde Bosque Oscuro */
  --primary-light: #ecfdf5;    /* Menta Muy Claro */
  --secondary: #0f172a;        /* Azul Pizarra Oscuro (para texto principal) */
  --text-muted: #64748b;       /* Gris Slate (para subtítulos) */
  --bg-main: #f8fafc;          /* Gris Neutro Claro */
  --bg-card: #ffffff;          /* Blanco Puro */
  --border-color: #e2e8f0;     /* Gris Borde Suave */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  /* Sombras y bordes */
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-premium: 0 20px 25px -5px rgba(16, 185, 129, 0.08), 0 10px 10px -5px rgba(16, 185, 129, 0.03);
  
  /* Transición */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modificaciones generales de la página */
.content-wrapper {
  background-color: var(--bg-main) !important;
}

/* -------------------------------------------------------------
   TARJETA PRINCIPAL Y PESTAÑAS (TABS)
   ------------------------------------------------------------- */
.card-success.card-outline {
  border-top: 4px solid var(--primary) !important;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md) !important;
  border-left: none;
  border-right: none;
  border-bottom: none;
  overflow: hidden;
}

.card-success.card-outline .card-header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.25rem 0 1.25rem;
}

.nav-tabs {
  border-bottom: none !important;
}

.nav-tabs .nav-item .nav-link {
  border: none !important;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  position: relative;
  transition: var(--transition);
}

.nav-tabs .nav-item .nav-link:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

.nav-tabs .nav-item .nav-link.active {
  color: var(--primary) !important;
  background-color: transparent !important;
  font-weight: 700;
}

.nav-tabs .nav-item .nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  width: 80%;
  height: 3px;
  background-color: var(--primary);
  border-radius: 9999px;
}

/* -------------------------------------------------------------
   TABLAS Y LISTADOS DE DOCUMENTOS
   ------------------------------------------------------------- */
.table-documents td {
  vertical-align: middle !important;
}

.table-documents tbody tr {
  cursor: pointer;
}

/* Estilo premium de la tabla generada en el controlador */
.dataTable {
  border-collapse: separate !important;
  border-spacing: 0 10px !important;
  width: 100% !important;
}

.dataTable thead th {
  border: none !important;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem !important;
  font-weight: 700;
}

.dataTable tbody tr {
  background-color: var(--bg-card) !important;
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.dataTable tbody tr td {
  border: 1px solid var(--border-color) !important;
  border-style: solid none !important;
  padding: 1.1rem 1rem !important;
}

.dataTable tbody tr td:first-child {
  border-left: 1px solid var(--border-color) !important;
  border-top-left-radius: var(--radius-md) !important;
  border-bottom-left-radius: var(--radius-md) !important;
}

.dataTable tbody tr td:last-child {
  border-right: 1px solid var(--border-color) !important;
  border-top-right-radius: var(--radius-md) !important;
  border-bottom-right-radius: var(--radius-md) !important;
}

/* Fila activa/seleccionada en el preview */
.dataTable tbody tr.active-preview-row {
  background-color: var(--primary-light) !important;
  box-shadow: var(--shadow-premium) !important;
  transform: translateY(-2px);
}

.dataTable tbody tr.active-preview-row td {
  border-color: rgba(16, 185, 129, 0.25) !important;
}

.dataTable tbody tr:hover:not(.active-preview-row) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md) !important;
  background-color: #fafbfc !important;
}

.dataTable tbody tr:hover td {
  border-color: #cbd5e1 !important;
}

/* Textos e iconos del listado */
.doc-date {
  font-size: 1.05rem;
  color: var(--secondary);
  font-weight: 700;
  margin-bottom: 0.25rem !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.doc-date i {
  color: var(--primary);
  font-size: 0.95rem;
}

.doc-range {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.35rem 0 !important;
  font-weight: 500;
}

.doc-monto {
  font-size: 0.95rem;
  color: var(--secondary);
  margin: 0 0 0.25rem 0 !important;
  font-weight: 700;
}

.doc-upload {
  font-size: 0.75rem;
  display: block;
  margin-top: 0.15rem;
}

.doc-lock-hint {
  font-size: 0.72rem;
  margin-top: 0.35rem;
  color: var(--text-muted) !important;
}

.dataTable tbody tr.doc-row-pending {
  cursor: default;
}

.dataTable tbody tr.doc-row-pending .doc-row-info {
  cursor: default;
}

.doc-row-pending:hover {
  transform: none !important;
}

.dataTable tbody tr.doc-row-pending:hover:not(.active-preview-row) {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.dataTable tbody tr .show-modal-click {
  cursor: pointer;
}

/* Loading listado de boletas */
.docs-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  min-height: 180px;
  text-align: center;
}

.docs-loading-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: docsSpin 0.8s linear infinite;
  margin-bottom: 0.85rem;
}

@keyframes docsSpin {
  to { transform: rotate(360deg); }
}

.docs-loading-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.docs-loading-error i {
  font-size: 2rem;
  color: var(--danger);
  margin-bottom: 0.5rem;
}

.docs-loading-error .docs-loading-text {
  color: var(--secondary);
}

/* -------------------------------------------------------------
   BOTONES E ICONOS — BOLETAS (tamaño unificado: icono + texto)
   ------------------------------------------------------------- */
.btn-doc,
.dataTable .btn,
.doc-preview-actions .btn,
#preview-action-placeholder .btn,
#modal-action-placeholder .btn,
.modal-footer-premium .btn,
.confirm-firma-footer .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  padding: 0.45rem 0.8rem;
  min-height: 2.125rem;
  border-radius: 7px;
  white-space: nowrap;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.btn-doc i,
.dataTable .btn i,
.doc-preview-actions .btn i,
#preview-action-placeholder .btn i,
#modal-action-placeholder .btn i,
.modal-footer-premium .btn i,
.confirm-firma-footer .btn i {
  font-size: 0.8rem;
  line-height: 1;
  flex-shrink: 0;
}

.btn-doc-label {
  display: inline;
  line-height: 1.2;
}

.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: var(--transition);
  border: none;
}

.btn-doc.btn-success,
.dataTable .btn-success,
.doc-preview-actions .btn-success,
#preview-action-placeholder .btn-success,
#modal-action-placeholder .btn-success,
.confirm-firma-footer .btn-success {
  background-color: var(--primary) !important;
  color: #fff !important;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.25);
}

.btn-doc.btn-success:hover:not(:disabled),
.dataTable .btn-success:hover:not(:disabled),
.doc-preview-actions .btn-success:hover:not(:disabled),
#preview-action-placeholder .btn-success:hover:not(:disabled),
.confirm-firma-footer .btn-success:hover:not(:disabled) {
  background-color: var(--primary-hover) !important;
  transform: none;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.btn-doc.btn-warning,
.dataTable .btn-warning,
.doc-preview-actions .btn-warning,
#preview-action-placeholder .btn-warning,
#modal-action-placeholder .btn-warning {
  background-color: var(--warning) !important;
  border-color: var(--warning) !important;
  color: #fff !important;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.25);
}

.btn-doc.btn-warning:hover:not(:disabled),
.dataTable .btn-warning:hover:not(:disabled),
.doc-preview-actions .btn-warning:hover:not(:disabled),
#preview-action-placeholder .btn-warning:hover:not(:disabled),
#modal-action-placeholder .btn-warning:hover:not(:disabled) {
  background-color: #d97706 !important;
  transform: none;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.btn-doc.btn-secondary,
.btn-doc.btn-light,
.modal-footer-premium .btn-secondary,
.confirm-firma-btn-cancel {
  box-shadow: none !important;
}

.btn-doc:disabled,
.dataTable .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Badge — estado firmado (misma línea visual que botones) */
.badge-doc,
.dataTable .badge-doc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.45rem 0.8rem;
  min-height: 2.125rem;
  border-radius: 7px;
  line-height: 1.25;
  white-space: nowrap;
}

.badge-doc i,
.dataTable .badge-doc i {
  font-size: 0.8rem;
  line-height: 1;
  flex-shrink: 0;
}

.badge-doc.badge-success,
.dataTable .badge-doc.badge-success {
  background-color: var(--primary-light) !important;
  color: var(--primary-hover) !important;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Celdas de acción en tabla */
.dataTable tbody tr td.td-accion {
  padding: 0.75rem 0.45rem !important;
  vertical-align: middle;
  width: 1%;
  white-space: nowrap;
}

.dataTable thead th:nth-child(2),
.dataTable thead th:nth-child(3) {
  min-width: 6.5rem;
}

/* -------------------------------------------------------------
   PANEL DE VISTA PREVIA DETALLADO (PREVIEW PANEL)
   ------------------------------------------------------------- */
.preview-sticky-wrapper {
  position: -webkit-sticky;
  position: sticky;
  top: 1.5rem;
  z-index: 10;
}

.doc-preview-panel {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 130px);
  min-height: 550px;
  max-height: 750px;
  transition: var(--transition);
}

.doc-preview-header {
  padding: 1.25rem;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.doc-preview-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-preview-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  display: block;
}

.doc-preview-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.doc-preview-actions .btn-doc,
#preview-action-placeholder .btn-doc {
  font-size: 0.8125rem;
}

.doc-preview-body {
  flex-grow: 1;
  background-color: #f1f5f9;
  position: relative;
  overflow: hidden;
  padding: 0;
}

/* Visor de PDF embebido */
.doc-iframe-viewer {
  width: 100%;
  height: 100%;
  border: none;
  background-color: #f1f5f9;
}

/* Contenedor de Estado Vacío (Illustration) */
.doc-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2.5rem;
  text-align: center;
  background-color: var(--bg-card);
}

.placeholder-illustration {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-pulse-circle {
  position: absolute;
  width: 100px;
  height: 100px;
  background-color: var(--primary-light);
  border-radius: 50%;
  animation: pulse-ring 2.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.placeholder-icon-wrapper {
  position: relative;
  width: 75px;
  height: 75px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  color: var(--primary);
  font-size: 2.25rem;
}

.doc-preview-placeholder h4 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 0.5rem;
}

.doc-preview-placeholder p {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 280px;
  line-height: 1.5;
  margin: 0;
}

/* Animaciones */
@keyframes pulse-ring {
  0% {
    transform: scale(0.65);
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
  100% {
    transform: scale(1.15);
    opacity: 0;
  }
}

/* -------------------------------------------------------------
   MODAL CONFIRMAR FIRMA
   ------------------------------------------------------------- */
.modal-confirm-firma {
  max-width: 440px;
}

.modal-confirm-firma-content {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(16, 185, 129, 0.25), 0 0 0 1px rgba(16, 185, 129, 0.08);
  overflow: hidden;
  animation: confirmFirmaIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes confirmFirmaIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.confirm-firma-icon-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 1.5rem auto 1rem;
}

.confirm-firma-icon-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), #d1fae5);
  animation: confirmFirmaPulse 2s ease-out infinite;
}

@keyframes confirmFirmaPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 0; }
}

.confirm-firma-icon {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--primary), var(--primary-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px -4px rgba(16, 185, 129, 0.4);
}

.confirm-firma-icon i {
  font-size: 1.5rem;
  color: #fff;
}

.confirm-firma-title {
  font-weight: 800;
  color: var(--secondary);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  padding: 0 1.25rem;
}

.confirm-firma-message {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0 auto 1rem;
  max-width: 320px;
  padding: 0 1.25rem;
}

.confirm-firma-resumen {
  background: var(--primary-light);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  margin: 0 1.25rem 1.1rem;
  padding: 0.65rem 0.85rem;
}

.confirm-firma-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.35rem;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.confirm-firma-detalle {
  font-size: 0.75rem;
  color: var(--secondary);
  font-weight: 600;
}

.confirm-firma-footer {
  display: flex;
  gap: 0.5rem;
  padding: 0 1.25rem 1.25rem;
  background: #fff;
  justify-content: center;
}

.confirm-firma-footer .btn-doc {
  flex: 1 1 auto;
  min-width: 7.5rem;
}

.confirm-firma-btn-cancel {
  background: #f1f5f9 !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border-color) !important;
}

.confirm-firma-btn-cancel:hover {
  background: #e2e8f0 !important;
  color: var(--secondary) !important;
}

.confirm-firma-btn-ok:hover {
  transform: none;
}

#modalConfirmarFirma.show ~ .modal-backdrop {
  background-color: rgba(15, 23, 42, 0.55);
}

@media (max-width: 575.98px) {
  .confirm-firma-title {
    font-size: 1rem;
  }
}

/* -------------------------------------------------------------
   DISEÑO DEL MODAL RESPONSIVE (MÓVIL)
   ------------------------------------------------------------- */
.modal-content-premium {
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.modal-header-premium {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header-premium .close {
  padding: 0;
  margin: 0;
  color: var(--text-muted);
  font-size: 1.5rem;
  transition: var(--transition);
  opacity: 0.7;
}

.modal-header-premium .close:hover {
  color: var(--danger);
  opacity: 1;
}

.modal-body-premium {
  padding: 0;
  background-color: #e2e8f0;
  position: relative;
}

.modal-footer-premium {
  background-color: #ffffff;
  border-top: 1px solid var(--border-color);
  padding: 0.65rem 1rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

/* -------------------------------------------------------------
   RESPONSIVE OVERRIDES (MOBILE & TABLET)
   ------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .dataTable {
    margin-top: 5px !important;
  }

  .dataTable tbody tr td {
    padding: 0.85rem 0.6rem !important;
  }

  .dataTable tbody tr td.td-accion {
    padding: 0.6rem 0.35rem !important;
  }

  .doc-date {
    font-size: 0.95rem;
  }

  .doc-range {
    font-size: 0.78rem;
  }
}

/* Tablet: botones un poco más compactos pero con texto */
@media (max-width: 767.98px) {
  .dataTable .btn-doc,
  .dataTable .badge-doc {
    font-size: 0.75rem;
    padding: 0.4rem 0.55rem;
    min-height: 2rem;
    gap: 0.3rem;
  }

  .dataTable .btn-doc i,
  .dataTable .badge-doc i {
    font-size: 0.75rem;
  }
}

/* Móvil muy estrecho: solo icono en tabla (title conserva el texto) */
@media (max-width: 420px) {
  .dataTable .btn-doc-label {
    display: none;
  }

  .dataTable .btn-doc,
  .dataTable .badge-doc {
    padding: 0.45rem 0.5rem;
    min-width: 2.125rem;
    min-height: 2.125rem;
  }
}

@media (max-width: 575.98px) {
  /* Ajuste de márgenes del modal de vista previa en móviles pequeños */
  .modal-dialog {
    margin: 0.5rem !important;
  }
  
  .modal-body-premium {
    height: 480px !important;
  }

  .modal-header-premium {
    padding: 1rem;
  }

  .modal-footer-premium {
    padding: 0.65rem 0.85rem;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .modal-footer-premium .btn-doc,
  #modal-action-placeholder .btn-doc {
    flex: 1 1 auto;
    min-width: 7rem;
  }

  .confirm-firma-footer {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .confirm-firma-footer .btn-doc {
    flex: 1 1 calc(50% - 0.35rem);
    min-width: 0;
    max-width: none;
  }
}

/* -------------------------------------------------------------
   NAVBAR & SIDEBAR PREMIUM STYLING
   ------------------------------------------------------------- */
.main-header.navbar {
  background-color: #ffffff !important;
  border-bottom: 2px solid var(--primary-light) !important;
  box-shadow: var(--shadow-sm) !important;
  padding: 0.5rem 1rem !important;
}

.main-header.navbar .nav-link {
  color: var(--secondary) !important;
  font-weight: 600;
  transition: var(--transition);
}

.main-header.navbar .nav-link:hover {
  color: var(--primary) !important;
}

.main-sidebar {
  background-color: var(--secondary) !important; /* Slate Oscuro */
  border-right: 1px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15) !important;
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active {
  background-color: var(--primary) !important;
  color: #ffffff !important;
  box-shadow: var(--shadow-sm) !important;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link:hover:not(.active) {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: var(--primary-light) !important;
}

.sidebar .user-panel {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding: 1.25rem 0.5rem !important;
  display: flex;
  align-items: center;
}

.sidebar .user-panel img {
  border: 2px solid var(--primary);
  padding: 2px;
  background-color: #ffffff;
}

.sidebar .user-panel .info a.h5 {
  color: #ffffff !important;
  font-weight: 700;
  letter-spacing: -0.2px;
  transition: var(--transition);
}

.sidebar .user-panel .info .d-block {
  color: var(--primary) !important;
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.2rem;
}

/* -------------------------------------------------------------
   LOGIN PAGE PREMIUM DESIGN (index.php)
   ------------------------------------------------------------- */
body.login-page {
  background: linear-gradient(135deg, var(--bg-main) 0%, #eefbf4 100%) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-box {
  width: 420px !important;
}

.login-box .card {
  border-radius: var(--radius-lg) !important;
  border: none !important;
  box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.08), 0 15px 25px -20px rgba(16, 185, 129, 0.05) !important;
  background-color: var(--bg-card) !important;
  overflow: hidden;
}

.login-box .card-header {
  border-bottom: none !important;
  padding: 3rem 2rem 1.5rem 2rem !important;
  background-color: transparent !important;
}

.login-box .card-header img {
  max-width: 60% !important;
  height: auto !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.02));
  transition: var(--transition);
}

.login-box .card-header img:hover {
  transform: scale(1.02);
}

.login-box .card-body {
  padding: 1.5rem 2.5rem 3rem 2.5rem !important;
}

.login-box .input-group {
  margin-bottom: 1.5rem !important;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.login-box .form-control {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
  border: 1.5px solid var(--border-color) !important;
  border-right: none !important;
  height: 48px !important;
  font-size: 0.95rem !important;
  color: var(--secondary) !important;
  background-color: #fcfdfe !important;
  transition: var(--transition) !important;
}

.login-box .form-control:focus {
  border-color: var(--primary) !important;
  background-color: #ffffff !important;
  box-shadow: none !important;
}

.login-box .input-group-text {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
  border: 1.5px solid var(--border-color) !important;
  border-left: none !important;
  background-color: #f8fafc !important;
  color: var(--text-muted) !important;
  transition: var(--transition) !important;
  width: 48px !important;
  justify-content: center !important;
}

/* Enfoque coordinado del icono con el input */
.login-box .form-control:focus + .input-group-append .input-group-text {
  border-color: var(--primary) !important;
  color: var(--primary) !important;
  background-color: var(--primary-light) !important;
}

#acceder {
  height: 48px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 700 !important;
  font-size: 1rem !important;
  letter-spacing: 0.03em !important;
  border-radius: var(--radius-sm) !important;
  cursor: pointer !important;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2) !important;
  background-color: var(--primary) !important;
  color: #ffffff !important;
  border: none !important;
  transition: var(--transition) !important;
}

#acceder:hover {
  background-color: var(--primary-hover) !important;
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3) !important;
  transform: translateY(-1px) !important;
}

.login-box a {
  color: var(--primary) !important;
  font-weight: 600;
  font-size: 0.88rem;
  transition: var(--transition);
}

.login-box a:hover {
  color: var(--primary-hover) !important;
  text-decoration: none !important;
}

/* -------------------------------------------------------------
   UPDATE PASSWORD PAGE (updatePassword.php)
   ------------------------------------------------------------- */
.auth-update-page .login-box {
  width: 440px !important;
}

.auth-update-card .card-body {
  text-align: left !important;
  padding: 1.25rem 2.5rem 2.5rem 2.5rem !important;
}

.auth-update-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
}

.auth-update-alert i {
  color: var(--warning);
  font-size: 1.1rem;
  margin-top: 0.15rem;
}

.auth-update-alert strong {
  display: block;
  color: var(--secondary);
  font-size: 0.88rem;
  margin-bottom: 0.15rem;
}

.auth-update-alert span {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.auth-update-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--secondary);
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

.auth-update-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}

.auth-update-note {
  margin-top: 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
}

@media (max-width: 575.98px) {
  .auth-update-page .login-box {
    width: calc(100% - 1.5rem) !important;
  }

  .auth-update-card .card-body {
    padding: 1rem 1.25rem 1.75rem 1.25rem !important;
  }
}

/* -------------------------------------------------------------
   MI PERFIL — Formulario responsive
   ------------------------------------------------------------- */
.profile-page-title {
  letter-spacing: -0.5px;
}

.profile-form {
  max-width: 960px;
  margin: 0 auto;
}

.profile-card {
  margin-bottom: 1.25rem;
}

.profile-card .card-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.profile-card-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.15rem 1.5rem;
  background: linear-gradient(135deg, var(--primary-light) 0%, #fff 100%);
  border-bottom: 1px solid var(--border-color);
}

.profile-card-header > i {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.profile-card-header h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--secondary);
  margin: 0 0 0.15rem;
  letter-spacing: -0.02em;
}

.profile-card-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.profile-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 0.35rem;
}

.profile-input {
  border: 1.5px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  min-height: 42px;
  font-size: 0.9rem;
  transition: var(--transition);
}

.profile-input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12) !important;
}

.profile-input-addon {
  background: var(--primary-light) !important;
  border: 1.5px solid var(--border-color) !important;
  border-right: none !important;
  color: var(--primary) !important;
}

.profile-textarea {
  min-height: 120px;
  resize: vertical;
}

.profile-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.profile-hint-example {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #fffbeb;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--warning);
  color: #92400e;
}

.profile-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.profile-radio {
  margin: 0;
  cursor: pointer;
}

.profile-radio input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.profile-radio span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border: 1.5px solid var(--border-color);
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
}

.profile-radio input:checked + span {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-hover);
}

.profile-check-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
}

.profile-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 1rem;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: #fafbfc;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.profile-upload-zone:hover,
.profile-upload-zone:focus {
  border-color: var(--primary);
  background: var(--primary-light);
  outline: none;
}

.profile-upload-zone i {
  font-size: 1.75rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.profile-upload-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-upload-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-md) - 2px);
}

.profile-upload-zone.has-preview i,
.profile-upload-zone.has-preview .profile-upload-text {
  position: relative;
  z-index: 1;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.profile-upload-zone.has-preview::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.45), transparent 50%);
  pointer-events: none;
}

.profile-upload-sm .profile-upload-zone {
  min-height: 110px;
}

.profile-hijos-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.profile-hijos-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-hijos-list:not(.has-items) {
  display: none;
}

.profile-hijos-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: #fafbfc;
  margin-bottom: 0.5rem;
}

.profile-hijos-empty.d-none {
  display: none !important;
}

.profile-hijos-empty i {
  font-size: 2.25rem;
  color: var(--text-muted);
  opacity: 0.5;
  margin-bottom: 0.65rem;
}

.profile-hijos-empty p {
  font-weight: 700;
  color: var(--secondary);
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}

.profile-hijos-empty span {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 280px;
}

.profile-hijos-list.has-items {
  display: flex;
  margin-top: 0.75rem;
}

.profile-hijo-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
}

.profile-hijo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--secondary);
}

.profile-form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
  margin: 0.5rem 0 2rem;
  padding-top: 0.5rem;
}

.profile-btn-save {
  min-width: 10rem;
}

@media (max-width: 575.98px) {
  .profile-card .card-body {
    padding: 1rem;
  }

  .profile-card-header {
    padding: 1rem;
  }

  .profile-form-actions {
    flex-direction: column-reverse;
  }

  .profile-form-actions .btn-doc {
    width: 100%;
    justify-content: center;
  }

  .profile-hijos-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-hijos-toolbar .btn-doc {
    width: 100%;
    justify-content: center;
  }
}

/* ── Rendimiento ── */
.rendimiento-puntos-banner {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
  background: linear-gradient(135deg, #e8f8f0 0%, #f0faf5 100%);
  border: 1px solid rgba(40, 167, 69, 0.15);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(40, 167, 69, 0.08);
}

.rendimiento-puntos-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #28a745;
  border-radius: 12px;
  color: #fff;
  font-size: 1.35rem;
}

.rendimiento-puntos-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a3a4a;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.rendimiento-puntos-desc {
  margin: 0;
  font-size: 0.88rem;
  color: #5a7a8a;
  line-height: 1.55;
}

.rendimiento-puntos-desc strong {
  color: #28a745;
  font-weight: 600;
}

.rendimiento-regalo-card {
  border-radius: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rendimiento-regalo-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.12);
}

.rendimiento-regalo-icon {
  font-size: 2rem;
  color: #28a745;
  margin-bottom: 0.75rem;
}

.rendimiento-regalo-nombre {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a3a4a;
  margin-bottom: 0.5rem;
}

.rendimiento-regalo-puntos {
  font-size: 0.85rem;
  padding: 0.4em 0.9em;
  border-radius: 20px;
}

@media (max-width: 576px) {
  .rendimiento-puntos-banner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.25rem;
  }
}