/* =====================================================================
   Sistema de Actos Administrativos - Secretaría de Hacienda de Yopal
   style.css — Basado en el sistema Directorio LDAP con extensiones
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Variables ─────────────────────────────────────────────────────── */
:root {
  --bg-color: #f0f4f8;
  --surface-color: #ffffff;
  --surface-border: #d1d5db;
  --text-primary: #0f172a;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --primary-color: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-light: rgba(29, 78, 216, 0.08);
  --success-color: #059669;
  --warning-color: #d97706;
  --error-color: #dc2626;
  --error-bg: #fee2e2;
  --sidebar-w: 250px;

  /* Colores institucionales */
  --inst-green: #166534;
  --inst-green-l: #22c55e;
  --inst-blue: #1e3a8a;
  --inst-blue-l: #3b82f6;
}

/* ── Reset ─────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Animaciones globales ──────────────────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(29, 78, 216, .4);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(29, 78, 216, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(29, 78, 216, 0);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }

  100% {
    background-position: 1000px 0;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   PÁGINA PÚBLICA — HERO + BÚSQUEDA
   ══════════════════════════════════════════════════════════════════════ */

.public-page {
  height: 100vh;
  /* Fijo al 100% de la ventana */
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  position: relative;
  overflow: hidden;
}

/* Overlay de textura sutil (Gris claro sobre blanco) */
.public-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(30, 58, 138, .03) 0%, transparent 60%),
    radial-gradient(circle at 80% 20%, rgba(30, 58, 138, .04) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%231e3a8a' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ── Barra top ─────────────────────────────────────────────────────── */
.public-topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 40px;
  /* Reducido de 18px */
  background: #1e3a8a;
  /* Azul institucional sólido */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-bottom: 2px solid #166534;
  /* Verde oscuro (Secretaría de Hacienda) */
}

.public-topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.public-topbar-logo {
  height: 48px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: .9;
}

.public-topbar-text h1 {
  font-size: 19px;
  /* Agrandado de 13px */
  font-weight: 700;
  color: #fff;
  letter-spacing: .3px;
  margin-bottom: 1px;
  text-transform: uppercase;
}

.public-topbar-text p {
  font-size: 13.5px;
  /* Agrandado de 11px */
  color: rgba(255, 255, 255, .9);
  font-weight: 400;
}

.public-topbar-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all .2s;
  cursor: pointer;
  font-family: inherit;
}

.public-topbar-login-btn:hover {
  background: rgba(255, 255, 255, .22);
  border-color: rgba(255, 255, 255, .4);
  transform: translateY(-1px);
}

/* ── Hero Content ──────────────────────────────────────── */
.public-hero {
  position: relative;
  z-index: 5;
  flex: 1;
  /* Se ajusta automáticamente al espacio restante sin calc() */
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  overflow: hidden;
}

/* ── Panel izquierdo: tarjeta búsqueda + resultados ───────────── */
.public-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* CENTER HORIZONTALLY */
  justify-content: center;
  /* CENTER VERTICALLY BY DEFAULT */
  overflow: hidden;
  border-right: 1px solid rgba(0, 0, 0, .05);
  background: rgba(255, 255, 255, .4);
  /* Fondo sutil claro */
  animation: slideInLeft .6s ease-out;
  padding: 80px 40px;
  /* MORE PADDING AT TOP */
  transition: justify-content 0.5s ease;
  position: relative;
}

/* When searching/results are present, move card to top */
.public-left.has-results {
  justify-content: flex-start;
  padding-top: 40px;
}

/* Instrucción principal sobre la tarjeta */
.search-instruction {
  font-size: 18px;
  font-weight: 700;
  color: #1e3a8a;
  /* Azul institucional */
  text-align: center;
  margin-bottom: 20px;
  max-width: 500px;
  line-height: 1.4;
  animation: fadeInUp .5s ease-out .1s both;
}

/* Tarjeta de búsqueda (fija arriba en el panel izquierdo) */
/* Estilos consolidados en secciones posteriores */

/* Área de resultados (scrollable) */
.results-panel {
  flex: 1;
  width: 100%;
  /* Fix: evita que se encoja al tamaño del texto */
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Scrollbar suave para resultados */
.results-panel::-webkit-scrollbar {
  width: 5px;
}

.results-panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, .04);
}

.results-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .2);
  border-radius: 4px;
}

.results-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .35);
}

/* Estado inicial (sin consulta) */
.results-initial {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px 24px;
  text-align: center;
  gap: 14px;
  color: #475569;
  /* Gris oscuro para visibilidad */
  font-size: 13.5px;
}

.results-initial i {
  font-size: 44px;
  color: #cbd5e1;
}

/* Barra de conteo de resultados */
.results-count-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: #f1f5f9;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  width: 100%;
  max-width: 620px;
  /* Tamaño unificado exacto */
  margin: 20px auto 0;
}

/* Sin resultados */
.results-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 620px;
  /* Tamaño unificado exacto */
  margin: 20px auto;
  padding: 40px 24px;
  text-align: center;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  gap: 10px;
  color: #64748b;
  /* Gris oscuro para legibilidad */
  font-size: 13.5px;
}

.results-empty i {
  font-size: 38px;
  color: #cbd5e1;
  /* Icono sutil */
  margin-bottom: 4px;
}

.results-empty small {
  font-size: 12px;
  color: #94a3b8;
}


.public-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f0fdf4;
  /* Verde muy claro */
  border: 1px solid #bbf7d0;
  color: #166534;
  /* Verde oscuro institucional */
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 24px;
  width: fit-content;
}

.public-title {
  font-size: 2.2rem;
  /* Ligeramente más pequeño para ahorrar espacio */
  font-weight: 800;
  color: #0f172a;
  /* Oscuro para fondo blanco */
  line-height: 1.15;
  margin-bottom: 16px;
  /* Reducido de 24px */
  letter-spacing: -.5px;
}

.public-title span {
  background: linear-gradient(90deg, #eab308, #d97706); /* Amarillo oro del escudo de Yopal */
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.public-desc {
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 24px;
  /* Reducido de 36px */
  max-width: 520px;
  text-align: justify;
  margin-left: auto;
  margin-right: auto;
}

.public-desc strong {
  color: #1e293b;
  /* "Señor ciudadano" en oscuro */
}

/* Tarjeta de búsqueda */
.search-card {
  background: white;
  border: 1px solid #ef4444;
  /* Borde rojo solicitado */
  border-radius: 20px;
  padding: 30px;
  max-width: 620px;
  /* Tamaño unificado exacto */
  width: 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  animation: fadeInUp .5s ease-out .2s both;
  margin-bottom: 24px;
}

.search-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-card-title i {
  color: #4ade80;
}

.search-input-row {
  display: flex;
  gap: 10px;
}

.search-cedula-input {
  flex: 1;
  padding: 13px 18px;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  color: #0f172a;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  outline: none;
  transition: all .2s;
}

.search-cedula-input::placeholder {
  color: rgba(255, 255, 255, .4);
}

.search-cedula-input:focus {
  border-color: #4ade80;
  background: rgba(255, 255, 255, .16);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, .2);
}

.search-btn {
  padding: 13px 24px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.search-btn:hover {
  background: linear-gradient(135deg, #15803d, #14532d);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(21, 128, 61, .4);
}

.search-btn:active {
  transform: translateY(0);
}

/* Resultados de búsqueda */
.search-results-area {
  margin-top: 20px;
}

.search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.search-results-count {
  font-size: 12px;
  color: rgba(255, 255, 255, .7);
  font-weight: 500;
}

.search-results-count strong {
  color: #4ade80;
}

/* Tabla de resultados pública */
.results-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  animation: fadeInUp .3s ease-out;
  width: 100%;
  max-width: 520px;
  /* Igual al ancho de la tarjeta de búsqueda */
  margin-top: 10px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.results-table thead th {
  background: #1e3a8a;
  /* Azul institucional */
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 12px 14px;
  text-align: left;
  white-space: nowrap;
}

.results-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background .15s;
}

.results-table tbody tr:hover {
  background: #f8fafc;
  cursor: pointer;
}

.results-table tbody td {
  padding: 12px 14px;
  color: #1e293b;
  vertical-align: middle;
}

.acto-consecutivo-badge {
  display: inline-block;
  padding: 3px 10px;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  color: #1e40af;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .3px;
}

.acto-type-link {
  color: #4ade80;
  font-weight: 600;
  text-decoration: none;
  transition: color .15s;
}

.acto-type-link:hover {
  color: #86efac;
  text-decoration: underline;
}

/* Loader de búsqueda */
.search-loader {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  gap: 12px;
  color: #475569;
  font-size: 13.5px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 4px solid #f1f5f9;
  border-top-color: #1e3a8a;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* Mensaje de no resultados */
.no-results {
  text-align: center;
  padding: 30px;
  color: rgba(255, 255, 255, .5);
  font-size: 13px;
}

.no-results i {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
  opacity: .5;
}

/* ── Panel derecho: título + descripción + stats centrado ──────── */
.public-right {
  display: flex;
  flex-direction: column;
  padding: 48px 52px 44px;
  overflow-y: auto;
  height: 100%;
  animation: slideInRight .6s ease-out;
  align-items: center;
  /* Centrado horizontal de hijos */
  text-align: center;
  /* Alineación base centrada */
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Bloque de texto institucional (parte superior) */
.public-right-main {
  flex-shrink: 0;
}

/* Contenedor de la tarjeta: ocupa el espacio libre y centra la tarjeta */
.stats-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  /* centrado vertical */
  justify-content: center;
  /* centrado horizontal */
  padding: 20px 0;
  transition: flex .5s ease, align-items .5s ease, padding .5s ease;
  position: relative;
}

/* Cuando ya hay resultados la tarjeta sube (ocupa mínimo espacio) */
.public-right.has-results .stats-wrapper {
  flex: 0;
  align-items: flex-start;
  padding: 16px 0 0;
}

/* La tarjeta en sí */
.public-stats-card {
  background: white;
  border: 1px solid #ef4444;
  /* Borde rojo sutil */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  padding: 18px 24px;
  /* Reducido para ahorrar espacio vertical */
  width: 100%;
  max-width: 420px;
  transition: all .4s ease;
  animation: fadeInUp .5s ease-out .3s both;
}

/* Compacto cuando sube */
.public-right.has-results .public-stats-card {
  padding: 14px 20px;
  border-radius: 12px;
}

.stats-card-brand {
  display: flex;
  flex-direction: column;
  /* layout vertical */
  align-items: center;
  /* centrado horizontal */
  text-align: center;
  /* texto centrado */
  gap: 8px;
  margin-bottom: 16px;
  /* Reducido de 22px */
}

.stats-card-brand>i {
  font-size: 24px;
  color: #4ade80;
  flex-shrink: 0;
  margin-bottom: 4px;
}

.stats-card-brand h3 {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 3px;
}

.stats-card-brand p {
  font-size: 12.5px;
  color: #64748b;
  /* Gris oscuro */
}


/* Header institucional compacto (siempre visible) */
.public-right-header {
  padding: 22px 32px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  backdrop-filter: blur(12px);
  animation: fadeIn .6s ease-out;
  flex-shrink: 0;
}

.public-right-brand h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
  letter-spacing: -.2px;
}

.public-right-brand p {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 14px;
}

.public-stats-row {
  display: flex;
  gap: 14px;
  justify-content: center;
  /* centrar cajas de stats */
}

.public-stat {
  text-align: center;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  backdrop-filter: blur(10px);
  border-radius: 10px;
  padding: 10px 18px;
}

.public-stat-num {
  font-size: 22px;
  font-weight: 800;
  color: #4ade80;
  line-height: 1;
}

.public-stat-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  /* Gris oscuro */
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 3px;
}

/* Panel de resultados (área scrollable) */
.right-results-panel {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  /* necesario para que flex-child sea scrollable */
}

/* Estado inicial: sin búsqueda */
.right-initial-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  opacity: .5;
  text-align: center;
  padding: 40px;
  gap: 16px;
  color: rgba(255, 255, 255, .8);
  font-size: 14px;
}

.right-initial-state i {
  font-size: 48px;
  color: rgba(255, 255, 255, .3);
}

/* Tabla de resultados — panel derecho */
.right-results-table {
  width: 100%;
  max-width: 620px;
  /* Tamaño unificado exacto */
  margin: 0 auto;
  border-collapse: collapse;
  font-size: 13px;
  animation: fadeInUp .3s ease-out;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.right-results-table thead th {
  background: #1e3a8a;
  /* Azul institucional */
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.right-results-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background .15s;
}

.right-results-table tbody tr:hover {
  background: #f8fafc;
  cursor: pointer;
}

.right-results-table tbody td {
  padding: 10px 12px;
  color: #1e293b;
  /* Texto oscuro */
  vertical-align: middle;
  max-width: 180px;
}

.right-results-table .cell-nombre {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.right-results-table .cell-fecha {
  white-space: nowrap;
  color: #64748b;
  /* Gris medio */
  font-size: 11.5px;
}

.right-acto-link {
  color: #059669;
  /* Verde oscuro */
  font-weight: 600;
  text-decoration: none;
  font-size: 12px;
  transition: color .15s;
}

.right-acto-link:hover {
  color: #047857;
  text-decoration: underline;
}

.right-pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #991b1b;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  transition: all .2s;
  white-space: nowrap;
}

.right-pdf-btn:hover {
  background: #fee2e2;
  color: #7f1d1d;
  border-color: #fca5a5;
}

/* ── Modal de login flotante ───────────────────────────────────────── */
.login-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.login-modal-overlay.show {
  display: flex;
}

.login-modal {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .5);
  animation: fadeInUp .3s ease-out;
  position: relative;
}

.login-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all .15s;
}

.login-modal-close:hover {
  background: var(--bg-color);
  color: var(--text-primary);
}

.login-modal-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.login-modal-logo img {
  height: 56px;
  width: auto;
}

.login-modal h2 {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--inst-blue), var(--primary-color));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-modal p.subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 28px;
}

/* ══════════════════════════════════════════════════════════════════════
   FORMULARIOS COMPARTIDOS
   ══════════════════════════════════════════════════════════════════════ */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 16px;
  background: #fff;
  border: 1.5px solid #d1d5db;
  border-radius: 9px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: all .2s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.form-grid-2 {
  grid-template-columns: 1fr 1fr;
}

.form-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.required {
  color: var(--error-color);
}

/* Botones */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--inst-blue), var(--primary-color));
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all .2s;
  margin-top: 8px;
  text-decoration: none;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1e40af, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(29, 78, 216, .35);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  background: var(--success-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}

.btn-success:hover {
  background: #047857;
  box-shadow: 0 4px 12px rgba(5, 150, 105, .35);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--error-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  color: var(--primary-color);
  border: 1.5px solid var(--primary-color);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}

.btn-outline:hover {
  background: var(--primary-light);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Mensajes de estado */
.alert {
  padding: 12px 16px;
  border-radius: 9px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  animation: fadeInUp .3s ease-out;
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* Upload de archivo */
.file-upload-area {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  transition: all .2s;
  cursor: pointer;
  position: relative;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.file-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.file-upload-icon {
  font-size: 32px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.file-upload-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.file-upload-text strong {
  color: var(--primary-color);
}

.file-name-display {
  font-size: 12px;
  color: var(--success-color);
  margin-top: 8px;
  font-weight: 600;
}

/* Toggle de publicación */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle-switch input {
  display: none;
}

.toggle-track {
  width: 44px;
  height: 24px;
  background: #d1d5db;
  border-radius: 12px;
  position: relative;
  transition: background .25s;
}

.toggle-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .25s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.toggle-switch input:checked+.toggle-track {
  background: var(--success-color);
}

.toggle-switch input:checked+.toggle-track::after {
  transform: translateX(20px);
}

/* ══════════════════════════════════════════════════════════════════════
   LAYOUT AUTENTICADO — SIDEBAR + CONTENT
   ══════════════════════════════════════════════════════════════════════ */

.app-layout {
  display: flex;
  min-height: 100vh;
  background: #f0f4f8;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(160deg, #0f172a 0%, #1e3a8a 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(0, 0, 0, .2);
}

.sidebar-logo {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-logo-img {
  height: 36px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: .85;
  margin-bottom: 10px;
}

.sidebar-logo h3 {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  margin: 0;
  letter-spacing: .2px;
  line-height: 1.4;
}

.sidebar-logo p {
  color: #94a3b8;
  font-size: 10px;
  margin: 3px 0 0;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .15);
  border-radius: 2px;
}

.nav-section {
  font-size: 10px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .9px;
  padding: 16px 20px 5px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  border-left: 3px solid transparent;
  position: relative;
}

.nav-link:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
  border-left-color: rgba(255, 255, 255, .2);
}

.nav-link.active {
  background: rgba(29, 78, 216, .25);
  color: #fff;
  border-left-color: #60a5fa;
  font-weight: 600;
}

.nav-link i {
  width: 16px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-user-name {
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}

.sidebar-user-role {
  color: #94a3b8;
  font-size: 11px;
}

.sidebar-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: #f87171;
  text-decoration: none;
  transition: color .15s;
}

.sidebar-logout:hover {
  color: #fca5a5;
}

/* Content area */
.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 24px 32px 40px;
  min-width: 0;
}

/* Page header */
.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  letter-spacing: -.3px;
}

.page-header p {
  color: #64748b;
  font-size: 14px;
  margin: 4px 0 0;
}

.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── Stat Cards ─────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  border: 1px solid rgba(0, 0, 0, .04);
  transition: transform .2s, box-shadow .2s;
  animation: fadeInUp .4s ease-out both;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .1);
}

.stat-card .stat-icon {
  font-size: 22px;
  margin-bottom: 12px;
}

.stat-card .stat-val {
  font-size: 30px;
  font-weight: 800;
  color: var(--inst-blue);
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 12px;
  color: #64748b;
  margin-top: 5px;
}

.stat-blue .stat-val {
  color: var(--primary-color);
}

.stat-green .stat-val {
  color: var(--success-color);
}

.stat-orange .stat-val {
  color: var(--warning-color);
}

.stat-red .stat-val {
  color: var(--error-color);
}

/* ── Tablas del sistema ─────────────────────────────────────────────── */
.table-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
  border: 1px solid rgba(0, 0, 0, .05);
  overflow: hidden;
}

.table-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.table-card-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-card-header h2 i {
  color: var(--primary-color);
}

.table-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-input {
  padding: 8px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: all .2s;
  background: #f9fafb;
}

.filter-input:focus {
  border-color: var(--primary-color);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(29, 78, 216, .1);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background .15s;
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table tbody td {
  padding: 12px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}

/* Badges de estado */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
}

.badge-published {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-pending {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-admin {
  background: rgba(29, 78, 216, .1);
  color: #1e40af;
  border: 1px solid rgba(29, 78, 216, .25);
}

.badge-user {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.badge-blue {
  background: rgba(29, 78, 216, .08);
  color: var(--primary-color);
  border: 1px solid rgba(29, 78, 216, .2);
}

.consecutivo-badge {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(29, 78, 216, .08);
  border: 1px solid rgba(29, 78, 216, .2);
  border-radius: 6px;
  color: var(--primary-color);
  font-weight: 700;
  font-size: 12px;
}

/* Tabla de acciones */
.table-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ── Cards del formulario de subida ─────────────────────────────────── */
.form-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
  border: 1px solid rgba(0, 0, 0, .05);
  overflow: hidden;
}

.form-card-header {
  padding: 20px 28px;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
}

.form-card-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-card-header h2 i {
  color: var(--primary-color);
}

.form-card-body {
  padding: 28px;
}

/* ── Configuración LDAP ─────────────────────────────────────────────── */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.config-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-light);
}

/* ── Auditoría ──────────────────────────────────────────────────────── */
.accion-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.accion-login {
  background: #eff6ff;
  color: #1e40af;
}

.accion-subir {
  background: #ecfdf5;
  color: #065f46;
}

.accion-editar {
  background: #fffbeb;
  color: #92400e;
}

.accion-eliminar {
  background: #fef2f2;
  color: #991b1b;
}

.accion-descargar {
  background: #f5f3ff;
  color: #5b21b6;
}

/* ── Modal genérico ─────────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  z-index: 500;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: 14px;
  padding: 36px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .4);
  animation: fadeInUp .3s cubic-bezier(.175, .885, .32, 1.275);
}

.modal-box-lg {
  max-width: 700px;
}

/* ── Actividad reciente ─────────────────────────────────────────────── */
.activity-list {
  list-style: none;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.activity-body {
  flex: 1;
}

.activity-title {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 2px;
}

.activity-meta {
  font-size: 11px;
  color: #94a3b8;
}

/* ── Paginación (Público) ────────────────────────────────────────── */
.pagination-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
  padding: 10px;
  animation: fadeIn 0.5s ease-out;
}

.pg-btn {
  background: white;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.pg-btn:hover:not(:disabled) {
  background: #f1f5f9;
  color: #1e3a8a;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.pg-btn.active {
  background: #10b981;
  /* Esmeralda */
  color: #fff;
  border-color: #10b981;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.pg-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  filter: grayscale(1);
}

.pg-btn i {
  font-size: 11px;
}

/* ── Utilidades ─────────────────────────────────────────────────────── */
.text-muted {
  color: var(--text-muted);
}

.text-sm {
  font-size: 13px;
}

.text-xs {
  font-size: 11px;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.fw-600 {
  font-weight: 600;
}

.fw-700 {
  font-weight: 700;
}

.mt-1 {
  margin-top: 4px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-3 {
  margin-top: 16px;
}

.mt-4 {
  margin-top: 24px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 16px;
}

.mb-4 {
  margin-bottom: 24px;
}

.d-flex {
  display: flex;
}

.gap-2 {
  gap: 8px;
}

.align-center {
  align-items: center;
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .public-hero {
    grid-template-columns: 1fr;
  }

  .public-right {
    display: none;
  }

  .public-left {
    padding: 40px 30px;
  }

  .config-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .3s;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .content {
    margin-left: 0;
    padding: 16px;
  }

  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  .public-topbar {
    padding: 14px 20px;
  }

  .public-title {
    font-size: 1.8rem;
  }
}