/* ==========================================================================
   Tema iTuNómina: Basado en la identidad oficial de https://itunomina.pro/
   ========================================================================== */

@import "/lib/inter/inter.css";

:root,
[data-bs-theme="light"] {
  /* Paleta Oficial itunomina.pro */
  --itn-primary: #2563eb;        /* Royal Blue */
  --itn-primary-hover: #1d4ed8;  /* Blue 700 */
  --itn-primary-dark: #1e40af;   /* Blue 800 */
  --itn-secondary: #0f172a;      /* Slate 900 */
  --itn-accent: #06b6d4;         /* Cyan 500 */
  --itn-accent-green: #10b981;   /* Emerald 500 */
  --itn-bg-light: #f8fafc;       /* Slate 50 */
  --itn-card-border: #e2e8f0;    /* Slate 200 */
  --itn-text-muted: #64748b;     /* Slate 500 */
  --itn-text-body: #1e293b;      /* Slate 800 */

  /* Mapeo de Bootstrap Variables */
  --bs-primary: #2563eb;
  --bs-primary-rgb: 37, 99, 235;
  --bs-secondary: #64748b;
  --bs-secondary-rgb: 100, 116, 139;
  --bs-success: #10b981;
  --bs-success-rgb: 16, 185, 129;
  --bs-info: #06b6d4;
  --bs-info-rgb: 6, 182, 212;
  --bs-warning: #f59e0b;
  --bs-warning-rgb: 245, 158, 11;
  --bs-danger: #ef4444;
  --bs-danger-rgb: 239, 68, 68;

  --bs-link-color: #2563eb;
  --bs-link-color-rgb: 37, 99, 235;
  --bs-link-hover-color: #1d4ed8;

  --bs-body-bg: #f8fafc;
  --bs-body-color: #1e293b;
  --bs-secondary-color: #64748b;
  --bs-border-color: #e2e8f0;

  --bs-border-radius: 0.5rem;
  --bs-border-radius-lg: 0.75rem;

  --bs-font-sans-serif: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --bs-body-font-family: var(--bs-font-sans-serif);
  --bs-focus-ring-color: rgba(37, 99, 235, 0.18);
}

[data-bs-theme="dark"] {
  --itn-bg-dark: #0b1329;        /* Deep Slate */
  --itn-card-dark: #111c38;      /* Slate 800 */
  --itn-border-dark: #202e52;    /* Slate 700 */

  --bs-body-bg: #0b1329;
  --bs-body-color: #f1f5f9;
  --bs-secondary-color: #94a3b8;
  --bs-tertiary-bg: #111c38;
  --bs-border-color: #202e52;

  --bs-primary: #3b82f6;
  --bs-primary-rgb: 59, 130, 246;
  --bs-link-color: #38bdf8;
  --bs-link-color-rgb: 56, 189, 248;
  --bs-link-hover-color: #7dd3fc;
  --bs-focus-ring-color: rgba(59, 130, 246, 0.25);
}

/* Tipografía base */
body {
  font-family: var(--bs-body-font-family);
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .itn-display {
  font-family: var(--bs-font-sans-serif);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--bs-heading-color, inherit);
}

/* ---------- Botones ---------- */
.btn-primary {
  --bs-btn-bg: #2563eb;
  --bs-btn-border-color: #2563eb;
  --bs-btn-hover-bg: #1d4ed8;
  --bs-btn-hover-border-color: #1d4ed8;
  --bs-btn-active-bg: #1e40af;
  --bs-btn-active-border-color: #1e40af;
  --bs-btn-focus-shadow-rgb: 37, 99, 235;

  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  color: #ffffff !important;
  font-weight: 600;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
}

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

.btn-primary:disabled {
  background: #93c5fd !important;
  color: #ffffff !important;
  box-shadow: none;
  transform: none;
}

[data-bs-theme="dark"] .btn-primary:disabled {
  background: #1e3a8a !important;
  color: #94a3b8 !important;
}

.btn-link {
  color: var(--bs-secondary-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.btn-link:hover {
  color: var(--bs-primary);
  text-decoration: underline;
}

[data-bs-theme="dark"] .btn-link:hover {
  color: #38bdf8;
}

/* ---------- Formularios ---------- */
.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
  margin-bottom: 0.45rem;
}

.form-control,
.form-control-lg {
  border-radius: 10px;
  border: 1.5px solid var(--bs-border-color);
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  background-color: #ffffff;
  color: #1e293b;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-control-lg {
  background-color: #14203d;
  border-color: #283a66;
  color: #f8fafc;
}

.form-control:focus,
.form-control-lg:focus {
  border-color: #2563eb;
  background-color: #ffffff;
  color: #0f172a;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-control-lg:focus {
  border-color: #3b82f6;
  background-color: #14203d;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.22);
}

.form-control-lg {
  padding: 0.75rem 1rem;
}

.itn-ver-password {
  border: 1.5px solid var(--bs-border-color);
  border-left: none;
  background-color: #ffffff;
  color: var(--bs-secondary-color);
  border-top-right-radius: 10px !important;
  border-bottom-right-radius: 10px !important;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

[data-bs-theme="dark"] .itn-ver-password {
  background-color: #14203d;
  border-color: #283a66;
  color: #94a3b8;
}

.itn-ver-password:hover {
  color: var(--bs-primary);
}

[data-bs-theme="dark"] .itn-ver-password:hover {
  color: #38bdf8;
}

.input-group .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

/* ---------- Panel de Marca (Login / Cambiar Password) ---------- */
.itn-login {
  min-height: 100vh;
}

.itn-login__marca {
  position: relative;
  overflow: hidden;
  color: #ffffff;
  background:
    radial-gradient(circle at 10% 15%, rgba(37, 99, 235, 0.35) 0%, transparent 55%),
    radial-gradient(circle at 90% 85%, rgba(6, 182, 212, 0.25) 0%, transparent 50%),
    linear-gradient(150deg, #0b1329 0%, #0f172a 45%, #172554 100%);
}

.itn-login__marca > * {
  position: relative;
  z-index: 1;
}

.itn-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  color: inherit;
  text-decoration: none;
}

.itn-logo__mark {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 11px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  color: #ffffff;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.itn-logo span.brand-accent {
  color: #2563eb;
}

.itn-login__marca .itn-logo span.brand-accent {
  color: #38bdf8;
}

.itn-login__lema {
  font-size: clamp(2rem, 3.2vw, 3rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
  max-width: 17ch;
}

.itn-login__lema em {
  font-style: normal;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.itn-login__puntos li {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  color: #cbd5e1;
  font-size: 0.95rem;
}

.itn-login__puntos .bi {
  color: #38bdf8;
  font-size: 1.1rem;
}

.itn-login__panel {
  width: 100%;
  max-width: 27rem;
}

.itn-pie {
  font-size: 0.85rem;
  color: var(--bs-secondary-color);
}

/* ---------- Shell del Portal (/app) ---------- */
.itn-topbar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding-block: 0.6rem;
  z-index: 1020;
}

[data-bs-theme="dark"] .itn-topbar {
  background: #0f172a;
  border-bottom-color: #202e52;
}

.itn-usuario {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  border: 0;
  padding: 0.35rem 0.6rem;
  border-radius: 9999px;
  transition: background-color 0.2s ease;
}

.itn-usuario:hover {
  background-color: rgba(37, 99, 235, 0.08);
}

[data-bs-theme="dark"] .itn-usuario:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.itn-avatar {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.itn-layout {
  display: block;
}

@media (min-width: 992px) {
  .itn-layout {
    display: grid;
    grid-template-columns: 16rem 1fr;
    min-height: calc(100vh - 3.8rem);
  }
}

.itn-sidebar {
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
}

[data-bs-theme="dark"] .itn-sidebar {
  background: #0b1329;
  border-right-color: #202e52;
}

.itn-sidebar__titulo {
  display: block;
  margin: 0.5rem 0.85rem 0.4rem;
  font-size: 0.725rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
}

.itn-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  color: #475569;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.925rem;
  transition: all 0.2s ease;
}

[data-bs-theme="dark"] .itn-nav {
  color: #94a3b8;
}

.itn-nav:hover {
  background: #eff6ff;
  color: #2563eb;
}

[data-bs-theme="dark"] .itn-nav:hover {
  background: rgba(37, 99, 235, 0.12);
  color: #38bdf8;
}

.itn-nav.active {
  background: #2563eb;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

[data-bs-theme="dark"] .itn-nav.active {
  background: #2563eb;
  color: #ffffff !important;
}

.itn-contenido {
  padding: 1.5rem;
  min-width: 0;
  background-color: var(--bs-body-bg);
}

@media (min-width: 992px) {
  .itn-contenido {
    padding: 2.25rem 3rem;
  }
}

.itn-card {
  background: #ffffff;
  border: 1px solid var(--bs-border-color);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}

[data-bs-theme="dark"] .itn-card {
  background: #111c38;
  border-color: #202e52;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.itn-card--enlace {
  color: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.itn-card--enlace:hover {
  color: inherit;
  border-color: #2563eb;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
  transform: translateY(-2px);
}

[data-bs-theme="dark"] .itn-card--enlace:hover {
  border-color: #3b82f6;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.itn-card__icono {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  margin-bottom: 0.9rem;
  border-radius: 12px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 1.25rem;
}

[data-bs-theme="dark"] .itn-card__icono {
  background: rgba(37, 99, 235, 0.16);
  color: #38bdf8;
}

/* ---------- Tablas ---------- */
.itn-tabla thead th {
  background: #0f172a;
  color: #ffffff;
  font-size: 0.775rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 0;
  padding: 0.8rem 1rem;
  white-space: nowrap;
}

[data-bs-theme="dark"] .itn-tabla thead th {
  background: #182442;
  color: #f1f5f9;
}

.itn-tabla tbody td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
}

.itn-tabla.table > :not(caption) > * > * {
  background-color: transparent;
}

.itn-tabla tbody tr:hover > * {
  background-color: rgba(37, 99, 235, 0.04);
}

[data-bs-theme="dark"] .itn-tabla tbody tr:hover > * {
  background-color: rgba(255, 255, 255, 0.03);
}

.itn-vacio {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--bs-secondary-color);
}

.itn-th-sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}

.itn-th-sortable:hover {
  background: #1e293b !important;
}

[data-bs-theme="dark"] .itn-th-sortable:hover {
  background: #25335a !important;
}

.itn-th-sortable i {
  font-size: 0.75rem;
  margin-left: 0.35rem;
  opacity: 0.6;
}

.itn-th-sortable[aria-sort="ascending"] i,
.itn-th-sortable[aria-sort="descending"] i {
  opacity: 1;
  color: var(--itn-accent, #06b6d4);
}

.itn-tabla--compacta tbody td {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

/* ---------- Badges de Roles ---------- */
.itn-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.775rem;
  font-weight: 600;
}

.itn-badge--admin {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.itn-badge--rrhh {
  background: #ecfeff;
  color: #0e7490;
  border: 1px solid #a5f3fc;
}

.itn-badge--supervisor {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.itn-badge--empleado {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

[data-bs-theme="dark"] .itn-badge--admin {
  background: rgba(37, 99, 235, 0.15);
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.2);
}

[data-bs-theme="dark"] .itn-badge--rrhh {
  background: rgba(6, 182, 212, 0.15);
  color: #67e8f9;
  border-color: rgba(103, 232, 249, 0.2);
}

[data-bs-theme="dark"] .itn-badge--supervisor {
  background: rgba(16, 185, 129, 0.15);
  color: #86efac;
  border-color: rgba(134, 239, 172, 0.2);
}

[data-bs-theme="dark"] .itn-badge--empleado {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border-color: rgba(203, 213, 225, 0.2);
}

/* ── Árbol jerárquico de Áreas ─────────────────────────────────────────── */
.itn-tree-indent {
  display: inline-flex;
  align-items: center;
  user-select: none;
  font-family: monospace;
  font-weight: 600;
  color: var(--bs-secondary-color);
  opacity: 0.75;
}

.itn-tree-toggle {
  line-height: 1;
  text-decoration: none !important;
  color: var(--bs-secondary-color);
  transition: transform 0.15s ease;
}

.itn-tree-toggle:hover {
  color: var(--bs-primary);
}

tr.itn-tree-row-raiz {
  background-color: rgba(var(--bs-primary-rgb), 0.02) !important;
  font-weight: 500;
}

tr.itn-tree-row-sub {
  transition: background-color 0.15s ease;
}

/* ── Utilidades de ancho, tipografía e indentación (Cumplimiento CSP style-src 'self') ── */
.itn-col-10p, .itn-w-10p { width: 10%; }
.itn-col-35p, .itn-w-35p { width: 35%; }
.itn-col-45p, .itn-w-45p { width: 45%; }
.itn-col-110, .itn-w-110 { width: 110px; }
.itn-col-120, .itn-w-120 { width: 120px; }
.itn-col-130, .itn-w-130 { width: 130px; }
.itn-col-140, .itn-w-140 { width: 140px; }
.itn-col-160, .itn-w-160 { width: 160px; }
.itn-col-220, .itn-w-220 { width: 220px; }
.itn-col-280, .itn-w-280 { width: 280px; }
.itn-minw-280 { min-width: 280px; }
.itn-maxw-240 { max-width: 240px; }
.itn-maxw-400 { max-width: 400px; }
.itn-letter-spacing-1 { letter-spacing: 1px; }

.itn-tree-spacer {
  display: inline-block;
  width: 16px;
  text-align: center;
}

.itn-tree-indent-1 { margin-left: 26px; }
.itn-tree-indent-2 { margin-left: 52px; }
.itn-tree-indent-3 { margin-left: 78px; }
.itn-tree-indent-4 { margin-left: 104px; }
.itn-tree-indent-5 { margin-left: 130px; }
.itn-tree-indent-6 { margin-left: 156px; }

.itn-fs-70 { font-size: 0.7rem; }
.itn-fs-xs { font-size: 0.75rem; }
.itn-fs-xxs { font-size: 0.65rem; }

/* Modales anidados sobre otros modales (sin conflictos de z-index) */
.modal.itn-modal-nested {
  z-index: 1065;
}
.modal-backdrop.itn-modal-nested-backdrop {
  z-index: 1060;
}

/* ── Organigrama Interactivo HTML/CSS (DW-045 · 100% CSP style-src 'self') ── */
.itn-org-canvas {
  overflow: auto;
  min-height: 480px;
  max-height: 72vh;
  padding: 2rem 1.5rem;
  background-color: var(--bs-tertiary-bg);
  background-image: radial-gradient(rgba(37, 99, 235, 0.12) 1px, transparent 1px);
  background-size: 20px 20px;
  border-radius: 12px;
}

[data-bs-theme="dark"] .itn-org-canvas {
  background-color: #0b1329;
  background-image: radial-gradient(rgba(56, 189, 248, 0.14) 1px, transparent 1px);
}

.itn-org-zoom-75 { zoom: 0.75; }
.itn-org-zoom-90 { zoom: 0.9; }
.itn-org-zoom-100 { zoom: 1; }
.itn-org-zoom-115 { zoom: 1.15; }

.itn-org-tree {
  display: inline-flex;
  justify-content: center;
  min-width: 100%;
}

.itn-org-tree ul {
  padding-top: 24px;
  position: relative;
  display: flex;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.itn-org-tree li {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  list-style-type: none;
  position: relative;
  padding: 24px 10px 0 10px;
}

/* Conectores ortogonales entre padres e hijos */
.itn-org-tree li::before,
.itn-org-tree li::after {
  content: '';
  position: absolute;
  top: 0;
  right: 50%;
  border-top: 2px solid #94a3b8;
  width: 50%;
  height: 24px;
}

.itn-org-tree li::after {
  right: auto;
  left: 50%;
  border-left: 2px solid #94a3b8;
}

.itn-org-tree li:only-child::after,
.itn-org-tree li:only-child::before {
  display: none;
}

.itn-org-tree li:only-child {
  padding-top: 0;
}

.itn-org-tree li:first-child::before,
.itn-org-tree li:last-child::after {
  border: 0 none;
}

.itn-org-tree li:last-child::before {
  border-right: 2px solid #94a3b8;
  border-radius: 0 6px 0 0;
}

.itn-org-tree li:first-child::after {
  border-radius: 6px 0 0 0;
}

.itn-org-tree ul ul::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  border-left: 2px solid #94a3b8;
  width: 0;
  height: 24px;
}

/* Tarjeta de Nodo Organizacional */
.itn-org-node {
  width: 245px;
  background: var(--bs-body-bg);
  border: 1.5px solid var(--bs-border-color);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  text-align: left;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  position: relative;
}

[data-bs-theme="dark"] .itn-org-node {
  background: #142142;
  border-color: #283a66;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.itn-org-node:hover {
  transform: translateY(-2px);
  border-color: #2563eb;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.16);
}

.itn-org-node--raiz {
  border-top: 4px solid #2563eb;
  width: 265px;
}

.itn-org-node--sub {
  border-top: 4px solid #06b6d4;
}

.itn-org-node--seleccionado {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25), 0 8px 22px rgba(37, 99, 235, 0.18) !important;
}

.itn-org-node--coincidencia {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.32) !important;
}

.itn-org-progress {
  height: 6px;
  border-radius: 999px;
  background-color: var(--bs-secondary-bg);
  overflow: hidden;
}

.itn-org-progress-bar {
  height: 100%;
  border-radius: 999px;
}

.itn-w-0p { width: 0%; }
.itn-w-25p { width: 25%; }
.itn-w-50p { width: 50%; }
.itn-w-75p { width: 75%; }
.itn-w-100p { width: 100%; }

.itn-maxh-220 {
  max-height: 220px;
  overflow-y: auto;
}


