/* ============================================================
   HUMANIA.CSS — Sistema de Diseño Personalizado
   Superposición sobre Metronic/Craft (Bootstrap 5 + Inter)
   ============================================================ */

/* ────────────────────────────────────────────────────────────
   1. DESIGN TOKENS (Variables CSS)
   ──────────────────────────────────────────────────────────── */
:root {
  /* Paleta Principal */
  --hm-primary:        #009ef7;
  --hm-primary-light:  #e8f7ff;
  --hm-primary-dark:   #007ec4;
  --hm-primary-rgb:    0, 158, 247;

  /* Semánticos */
  --hm-success:        #17c653;
  --hm-success-light:  #e8fff3;
  --hm-warning:        #f6b100;
  --hm-warning-light:  #fff8e6;
  --hm-danger:         #f8285a;
  --hm-danger-light:   #fff0f4;
  --hm-info:           #7239ea;
  --hm-info-light:     #f3edff;

  /* Jerarquía de texto */
  --hm-text-primary:   #1e2139;
  --hm-text-secondary: #5e6278;
  --hm-text-muted:     #a1a5b7;

  /* Superficies (Antigravity Glassmorphism) */
  --hm-bg:             #f5f7fb;
  --hm-surface:        rgba(255, 255, 255, 0.75);
  --hm-border:         #e9ecef;
  --hm-border-light:   rgba(255, 255, 255, 0.5);

  /* Escala tipográfica */
  --hm-fs-xs:   0.85rem;
  --hm-fs-sm:   0.95rem;
  --hm-fs-base: 1.05rem;
  --hm-fs-lg:   1.2rem;
  --hm-fs-xl:   1.6rem;
  --hm-fs-2xl:  2.2rem;

  /* Sombras */
  --hm-shadow-sm:    0 10px 30px rgba(0,0,0,0.03), 0 2px 10px rgba(0,0,0,0.02);
  --hm-shadow-md:    0 20px 40px rgba(0,0,0,0.05), 0 5px 15px rgba(0,0,0,0.03);
  --hm-shadow-lg:    0 30px 60px rgba(0,0,0,0.08), 0 10px 20px rgba(0,0,0,0.04);
  --hm-shadow-hover: 0 25px 50px rgba(79,110,247,0.12), 0 8px 24px rgba(79,110,247,0.08);

  /* Radios */
  --hm-radius-sm:  6px;
  --hm-radius-md:  10px;
  --hm-radius-lg:  14px;
  --hm-radius-xl:  20px;

  /* Transiciones */
  --hm-transition: all 0.18s ease;

  /* Alturas estándar de controles */
  --hm-h-btn:      42px;
  --hm-h-btn-sm:   32px;
  --hm-h-input:    42px;
  --hm-h-filter:   38px;
}

/* ────────────────────────────────────────────────────────────
   2. GLOBALS — Reset y base
   ──────────────────────────────────────────────────────────── */
body {
  background-color: #f5f7fb !important;
  color: var(--hm-text-primary);
  font-size: var(--hm-fs-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Tipografía de datos — MONOESPACIADA */
.numero {
  font-family: ui-monospace, 'SF Mono', 'JetBrains Mono', Consolas, monospace !important;
  font-variant-numeric: tabular-nums !important;
  letter-spacing: 0.01em !important;
}

#kt_wrapper, #kt_content, #kt_post {
  background-color: transparent !important;
}

a { transition: var(--hm-transition); }

h1, h2, h3, h4, h5, h6, .card-title .card-label {
  letter-spacing: -0.03em !important;
}
h1 { font-weight: 800 !important; }

/* ────────────────────────────────────────────────────────────
   3. SIDEBAR
   ──────────────────────────────────────────────────────────── */
.aside.aside-default {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 10px 0 30px rgba(0,0,0,0.03);
  top: 0 !important;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (min-width: 992px) {
  .aside.aside-default {
    margin: 1.5rem;
    height: calc(100vh - 3rem) !important;
    border-radius: var(--hm-radius-xl) !important;
    border: 1px solid rgba(255, 255, 255, 0.6);
  }
}

.aside-logo {
  background-color: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3) !important;
  height: 72px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 1.5rem !important;
}

.sidebar-nav-item.active .sidebar-nav-link {
  background-color: var(--hm-primary-light) !important;
  color: var(--hm-primary) !important;
  font-weight: 600;
  border-left: 3px solid var(--hm-primary);
  padding-left: calc(1rem - 3px);
}
.sidebar-nav-item.active .sidebar-nav-icon { color: var(--hm-primary) !important; }
.sidebar-nav-link:hover { background-color: var(--hm-border-light) !important; color: var(--hm-text-primary) !important; }
.sidebar-nav-item.sidebar-section-label span { color: var(--hm-text-muted); letter-spacing: 0.06em; }

/* ────────────────────────────────────────────────────────────
   4. CARDS
   ──────────────────────────────────────────────────────────── */
.card, .hm-card {
  background: var(--hm-surface) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-radius: var(--hm-radius-md) !important;
  border: 1px solid rgba(255, 255, 255, 0.6) !important;
  box-shadow: var(--hm-shadow-sm) !important;
  width: 100%;
  margin-bottom: 3rem;
}
.card-body { padding: 2.5rem !important; }
.card-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.5) !important;
  background: transparent !important;
  padding-top: 2rem !important;
  padding-bottom: 1.5rem !important;
  min-height: 80px !important;
}
.hm-card-robust {
  box-shadow: 0 10px 30px rgba(0,0,0,0.06) !important;
  border: 1px solid rgba(0,0,0,0.05) !important;
}
.card-title .card-label {
  color: var(--hm-text-primary) !important;
  font-weight: 700 !important;
}

/* Stat cards */
.hm-stat-card {
  background: var(--hm-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--hm-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--hm-shadow-sm);
  padding: 1.5rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  margin-bottom: 1.5rem;
}
.hm-stat-card:hover { box-shadow: var(--hm-shadow-hover); }
.hm-stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--hm-radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.hm-stat-icon.primary   { background: var(--hm-primary-light); color: var(--hm-primary); }
.hm-stat-icon.success   { background: var(--hm-success-light); color: var(--hm-success); }
.hm-stat-icon.warning   { background: var(--hm-warning-light); color: var(--hm-warning); }
.hm-stat-icon.danger    { background: var(--hm-danger-light);  color: var(--hm-danger);  }
.hm-stat-icon.info      { background: var(--hm-info-light);    color: var(--hm-info);    }
.hm-stat-value {
  font-size: var(--hm-fs-2xl);
  font-weight: 700;
  line-height: 1;
  color: var(--hm-text-primary);
}
.hm-stat-label { font-size: var(--hm-fs-sm); color: var(--hm-text-muted); margin-top: 4px; }

/* ────────────────────────────────────────────────────────────
   5. TABLAS
   ──────────────────────────────────────────────────────────── */
.table thead tr th {
  font-size: var(--hm-fs-xs) !important;
  font-weight: 700 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  color: var(--hm-text-muted) !important;
  border-bottom: 2px solid var(--hm-border) !important;
  padding: 1.25rem 1.5rem !important;
}
.table tbody td {
  padding: 1.25rem 1.5rem !important;
  vertical-align: middle !important;
  font-size: var(--hm-fs-base) !important;
  color: var(--hm-text-secondary);
  border-bottom: 1px solid var(--hm-border-light) !important;
}
.table tbody tr:hover td { background-color: #f5f7ff !important; }
.table tbody tr:last-child td { border-bottom: none !important; }

/* Scroll horizontal para tablas grandes en mobile */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Columnas con anchos específicos */
.table-col-colaborador { width: 200px !important; }
.table-col-email     { width: 180px !important; }
.table-col-proceso   { width: 140px !important; }
.table-col-estado { width: 110px !important; text-align: center !important; }
.table-col-score,
.table-col-categoria { width: 130px !important; text-align: center !important; }
.table-col-firma     { width: 110px !important; text-align: center !important; }

/* Tabla comparación (detalle IA) — col 2 monoespaciada */
.table-comparacion td:nth-child(2),
.table-comparacion th:nth-child(2) {
  min-width: 140px !important;
  font-family: ui-monospace, 'SF Mono', monospace !important;
}

/* ────────────────────────────────────────────────────────────
   6. BADGES
   ──────────────────────────────────────────────────────────── */
/* Sistema unificado */
.badge, [class*="badge-"] {
  font-size: var(--hm-fs-xs) !important;
  font-weight: 600 !important;
  padding: 0.35em 0.75em !important;
  border-radius: var(--hm-radius-sm) !important;
  letter-spacing: 0.03em;
}

/* Badges uniformes con tamaño fijo y uppercase */
.badge-uniforme {
  min-width: 90px !important;
  text-align: center !important;
  text-transform: uppercase !important;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  padding: 0.25rem 0.4rem !important;
  border-radius: 4px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
}
.badge-estado-firma { min-width: 100px !important; }
.badge-auditoria    { min-width: 95px !important; }

/* Colores (reutiliza bg-*) */
.badge-light-success, .badge-success,
.badge.bg-success {
  background-color: var(--hm-success-light) !important; color: var(--hm-success) !important;
}
.badge-light-warning, .badge-warning,
.badge.bg-warning {
  background-color: var(--hm-warning-light) !important;
  color: #92400E !important;
}
.badge-light-danger, .badge-danger,
.badge.bg-danger {
  background-color: var(--hm-danger-light) !important;  color: var(--hm-danger) !important;
}
.badge-light-info, .badge-info,
.badge.bg-info {
  background-color: var(--hm-info-light) !important;    color: var(--hm-info) !important;
}
.badge-light-primary, .badge-primary,
.badge.bg-primary {
  background-color: var(--hm-primary-light) !important; color: var(--hm-primary) !important;
}
.badge.bg-secondary {
  background-color: #f1f1f4 !important; color: #5e6278 !important;
}

/* Badges para Planes */
.badge-light-hito, .badge.bg-hito { background: #E5D9F2 !important; color: #4C1D95 !important; }

/* Empty state */
.hm-empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 3.5rem 1.5rem; text-align: center;
}
.hm-empty-state i { font-size: 3rem; color: var(--hm-text-muted); margin-bottom: 1rem; }
.hm-empty-state h4 { font-size: var(--hm-fs-lg); font-weight: 700; color: var(--hm-text-primary); margin-bottom: 0.5rem; }
.hm-empty-state p  { font-size: var(--hm-fs-sm); color: var(--hm-text-muted); }


/* ────────────────────────────────────────────────────────────
   7. BOTONES
   ──────────────────────────────────────────────────────────── */
.hm-btn, .btn {
  height: var(--hm-h-btn);
  border-radius: var(--hm-radius-md);
  font-weight: 600;
  font-size: var(--hm-fs-sm);
  padding: 0 1.25rem;
  border: none;
  cursor: pointer;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.375rem !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  line-height: 1;
  letter-spacing: 0.01em;
  text-decoration: none;
  min-height: 42px;
}
.hm-btn:hover { transform: translateY(-1px); text-decoration: none; }
.hm-btn:active { transform: translateY(0); }
.hm-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.hm-btn:focus-visible { outline: 2px solid var(--hm-primary); outline-offset: 2px; }

.hm-btn-primary { background: var(--hm-primary); color: #fff; box-shadow: 0 4px 12px rgba(var(--hm-primary-rgb), 0.25); }
.hm-btn-primary:hover { background: var(--hm-primary-dark); box-shadow: 0 8px 20px rgba(var(--hm-primary-rgb), 0.35); color: #fff; }

/* Links tipo texto con icono (reemplaza botones en tablas) */
.hm-link-action {
  color: var(--hm-primary) !important;
  text-decoration: none !important;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: color 0.15s ease;
  background: none !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}
.hm-link-action:hover {
  color: var(--hm-primary-dark) !important;
  background: none !important;
}

/* Botón cuadrado pequeno (para + en rotacion) */
.btn-square-sm {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border-radius: 4px; cursor: pointer;
  background: transparent; color: var(--hm-primary);
  border: none !important; outline: none !important;
}
.btn-square-sm:hover { color: var(--hm-primary-dark); }

/* Quitar bordes negros en contenedores de iconos */
.btn-square-sm, .hm-stat-icon {
  border: none !important; outline: none !important;
}

/* Centrado vertical forzado en todos los btn */
.btn, .btn-sm, .btn-lg, .btn-light, .btn-light-primary, .btn-light-warning,
.btn-light-danger, .btn-light-success, .btn-outline-secondary,
.btn-primary, .btn-secondary, .btn-danger, .btn-success, .btn-warning {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Botón Dashboard Ver */
.btn-dashboard-ver {
  background: rgba(14, 165, 233, 0.1) !important;
  color: #0ea5e9 !important;
  border: 1px solid #0ea5e9 !important;
}


/* ────────────────────────────────────────────────────────────
   8. INPUTS Y FORMULARIOS
   ──────────────────────────────────────────────────────────── */
.hm-input, .form-control:not(.form-control-solid),
.hm-select, .form-select {
  height: var(--hm-h-input) !important;
  min-height: 42px !important;
  border-radius: var(--hm-radius-md) !important;
  border: 1.5px solid var(--hm-border) !important;
  font-size: var(--hm-fs-sm) !important;
  color: var(--hm-text-primary) !important;
  padding: 0 1rem !important;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: inline-flex !important;
  align-items: center !important;
}
.hm-input:focus, .form-control:not(.form-control-solid):focus,
.hm-select:focus, .form-select:focus {
  border-color: var(--hm-primary) !important;
  box-shadow: 0 0 0 3px rgba(var(--hm-primary-rgb), 0.12) !important;
  outline: none !important;
}

/* Comboboxes uniformes */
.combo-filtro {
  width: 160px !important;
  min-width: 120px !important;
  height: 42px !important;
  display: inline-flex !important;
  align-items: center !important;
}
.combo-procesos { width: 140px !important; min-width: 100px !important; }
.combo-colaborador { width: 200px !important; min-width: 160px !important; }

.hm-select, .form-select {
  padding: 0 2rem 0 1rem !important;
  min-width: 140px;
  width: auto;
  appearance: auto;
}
.hm-input::placeholder, .form-control::placeholder { color: var(--hm-text-muted); }

.form-control-solid:focus {
  border-color: var(--hm-primary) !important;
  box-shadow: 0 0 0 3px rgba(var(--hm-primary-rgb), 0.10) !important;
}
.form-label {
  font-size: var(--hm-fs-sm) !important;
  font-weight: 600 !important;
  color: var(--hm-text-secondary) !important;
  margin-bottom: 0.4rem !important;
}

/* ────────────────────────────────────────────────────────────
   9. UTILIDADES
   ──────────────────────────────────────────────────────────── */
.vcenter { display: flex !important; align-items: center !important; }
.card-footer .btn { align-self: center !important; }
.btn i, .btn svg { margin-right: 0.375rem !important; }

/* ────────────────────────────────────────────────────────────
   10. PAGINACIÓN
   ──────────────────────────────────────────────────────────── */
.hm-pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 2.5rem 0 1rem; flex-wrap: wrap;
  border-top: 1px solid var(--hm-border-light);
}
.hm-pagination .page-item .page-link {
  border-radius: var(--hm-radius-sm) !important;
  border: 1px solid var(--hm-border) !important;
  color: var(--hm-text-secondary) !important;
  font-size: var(--hm-fs-sm) !important;
  font-weight: 500;
  padding: 0.5rem 0.9rem !important;
  transition: var(--hm-transition);
  background: var(--hm-surface);
  min-width: 38px; text-align: center;
}
.hm-pagination .page-item .page-link:hover {
  background: var(--hm-primary-light) !important;
  border-color: var(--hm-primary) !important;
  color: var(--hm-primary) !important;
}
.hm-pagination .page-item.active .page-link {
  background: var(--hm-primary) !important;
  border-color: var(--hm-primary) !important;
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(var(--hm-primary-rgb), 0.30);
}

/* ────────────────────────────────────────────────────────────
   11. ALERTAS
   ──────────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--hm-radius-md) !important;
  border: none !important;
  padding: 1rem 1.25rem !important;
  font-size: var(--hm-fs-sm) !important;
}
.alert-info {
  background: var(--hm-info-light) !important;
  color: var(--hm-info) !important;
}
.alert-error {
  background: var(--hm-danger-light) !important;
  color: var(--hm-danger) !important;
  border-radius: var(--hm-radius-md) !important;
  padding: 1rem 1.25rem !important;
  max-width: 600px; margin: 0 auto 1rem auto;
}

/* ────────────────────────────────────────────────────────────
   12. HEADER / TOOLBAR
   ──────────────────────────────────────────────────────────── */
.header {
  background: #fff !important; border-bottom: 1px solid #eff2f5 !important;
  box-shadow: none !important; display: flex !important;
  align-items: stretch !important; height: 0px !important;
}
@media (min-width: 992px) {
  .header { display: none !important; }
  .wrapper { padding-top: 0 !important; }
}
.toolbar {
  background: transparent !important;
  border-bottom: none !important;
  box-shadow: none !important;
  margin: 0 !important; padding: 0 !important;
}
.toolbar > .container-xxl, .toolbar > .container-fluid {
  padding-top: 1.5rem !important; padding-bottom: 1.5rem !important;
}
.toolbar h1 {
  font-size: var(--hm-fs-xl) !important;
  font-weight: 700 !important;
  color: var(--hm-text-primary) !important;
}
.breadcrumb .breadcrumb-item a { color: var(--hm-text-muted) !important; }
.breadcrumb .breadcrumb-item a:hover { color: var(--hm-primary) !important; }
.breadcrumb .breadcrumb-item.text-gray-900 {
  color: var(--hm-text-primary) !important; font-weight: 600;
}

/* Card header search */
.card-header .form-control {
  background: var(--hm-bg) !important;
  border: 1.5px solid var(--hm-border) !important;
  padding-left: 4rem !important;
  height: calc(1.5em + 1.25rem + 2px);
  border-radius: 50px !important;
}
.card-header .position-relative i {
  color: var(--hm-text-muted) !important;
  position: absolute !important;
  left: 1.45rem !important; top: 50% !important;
  transform: translateY(-50%) !important;
  pointer-events: none !important;
  font-size: 1.4rem !important;
}

/* ────────────────────────────────────────────────────────────
    13. UNIFICACION DE PALETA DE COLORES DE TEXTO
   ──────────────────────────────────────────────────────────── */
.text-gray-700, .text-gray-800, .text-gray-900,
.text-dark, .text-black, .text-body { color: var(--hm-text-secondary) !important; }
.text-gray-500, .text-gray-600 { color: var(--hm-text-secondary) !important; }

/* ────────────────────────────────────────────────────────────
   14. LAYOUT ALIGNMENT & RESPONSIVE
   ──────────────────────────────────────────────────────────── */
.hm-layout-aligned .toolbar > .container-fluid,
.hm-layout-aligned .post > .container-fluid {
  padding-left: 2.25rem !important; padding-right: 2.25rem !important;
  max-width: 100% !important;
}
.hm-layout-aligned .post > .container-fluid > .card {
  margin-left: 0 !important; margin-right: 0 !important;
  width: auto !important; min-width: 100% !important;
  box-shadow: var(--hm-shadow-sm) !important;
  border: none !important; border-radius: 0 !important;
}
.hm-layout-aligned .post { padding: 0 !important; }

@media (max-width: 991px) {
  .hm-layout-aligned .toolbar > .container-fluid,
  .hm-layout-aligned .post > .container-fluid {
    padding-left: 1.25rem !important; padding-right: 1.25rem !important;
  }
  .hm-layout-aligned .post > .container-fluid > .card {
    margin-left: 0 !important; margin-right: 0 !important;
    min-width: 100% !important; margin-bottom: 1.5rem !important;
  }
  .card-body { padding: 1.5rem !important; }
  .card-header { padding-top: 1.5rem !important; padding-bottom: 1rem !important; }
  .table tbody td, .table thead tr th { padding: 1rem !important; }
}

/* Mobile: comboboxes 100% en pantallas pequeñas */
@media (max-width: 768px) {
  .combo-filtro, .combo-procesos, .combo-colaborador {
    width: 100% !important; max-width: 100% !important;
    margin-bottom: 0.5rem;
  }
  .badge-uniforme { min-width: auto; margin: 2px; }
  .hm-btn, .btn { width: 100%; margin-bottom: 0.5rem; }
  .btn-group .hm-btn { width: auto; }
}

/* Hugeicons — stroke weight */
.hgi-stroke { --stroke-width: 1.2px; }
.aside-default .hgi-stroke { --stroke-width: 2px; }