:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #182235;
  --muted: #6d788a;
  --line: #e4eaf1;
  --primary: #126d7a;
  --primary2: #0f5862;
  --soft: #eaf6f7;
  --ok: #198754;
  --warn: #b7791f;
  --danger: #c0392b;
  --shadow: 0 10px 30px rgba(26, 46, 71, 0.08);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 7px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   PROTECCIÓN GLOBAL DE ELEMENTOS VECTORIALES
   ========================================================================== */
svg {
  box-sizing: border-box;
}

.tile-icon-svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  display: block;
  flex-shrink: 0;
}

/* ==========================================================================
   FRANJA SUPERIOR INSTITUCIONAL (HEADER GLOBAL)
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: #081726;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  height: 58px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-sandwich-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.header-sandwich-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.header-sandwich-btn:active {
  transform: scale(0.96);
}

.header-brand {
  display: flex;
  align-items: center;
}

.brand-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  user-select: none;
}

.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.header-facility-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 12.5px;
  font-weight: 500;
  user-select: none;
}

.facility-icon {
  color: #38bdf8;
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
}

.header-pill-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 4px 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-pill-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 9999px;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.header-pill-icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  transform: translateY(-1px);
}

.header-pill-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  user-select: none;
}

.system-status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  display: inline-block;
  animation: pulseStatus 2.5s infinite;
}

@keyframes pulseStatus {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(0.92); }
}

.system-status-name {
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   TELÓN CON DESENFOQUE DE FONDO (BLUR BACKDROP)
   ========================================================================== */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 18, 30, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

body.menu-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.menu-open .main-container {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
  transition: filter 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   MENÚ LATERAL DESPLEGABLE (OFF-CANVAS DRAWER)
   ========================================================================== */
.sidebar-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 290px;
  background: #081626;
  color: #ffffff;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.55);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  overflow-x: hidden;
}

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

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-title-eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.btn-drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-drawer-close:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.drawer-nav {
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-section-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 0 12px 6px;
  text-transform: uppercase;
}

.nav-link {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  border-left: 3.5px solid transparent;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  transform: translateX(3px);
}

.nav-link.active {
  background: #0e2940;
  color: #38bdf8;
  font-weight: 600;
  border-left-color: #38bdf8;
  border-radius: 2px 8px 8px 2px;
}

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

.drawer-footer-brand {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.drawer-footer-meta {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
}

/* ==========================================================================
   ÁREA DE CONTENIDO PRINCIPAL
   ========================================================================== */
.app-layout {
  min-height: calc(100vh - 58px);
  background: var(--bg);
  overflow-x: clip;
}

.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 36px 48px;
  transition: filter 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Topbar dentro del contenido principal */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar-title-block h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 750;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.topbar-title-block p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.topbar-title-block p:empty {
  display: none;
}

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

/* Utilidades globales */
.csrf-hidden {
  display: none !important;
}

/* Utilidades globales */
.csrf-hidden {
  display: none !important;
}

/* ==========================================================================
   SISTEMA DE BOTONES MODERNOS Y TÁCTILES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
}

.btn:active {
  transform: translateY(0);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Botón Primario Institucional */
.btn.primary {
  background: linear-gradient(180deg, #168292 0%, #126d7a 100%);
  border-color: #0e5b66;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(18, 109, 122, 0.35), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.btn.primary:hover {
  background: linear-gradient(180deg, #1994a6 0%, #147a89 100%);
  border-color: #0c4d57;
  color: #ffffff;
  box-shadow: 0 4px 14px -2px rgba(18, 109, 122, 0.45);
}

/* Botón Secundario / Soft / Edición con presencia táctil evidente */
.btn.soft,
.btn.btn-secondary,
.btn-secondary {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #1e293b;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.btn.soft:hover,
.btn.btn-secondary:hover,
.btn-secondary:hover {
  background: #f8fafc;
  border-color: #64748b;
  color: #0f172a;
  box-shadow: 0 4px 10px -1px rgba(0, 0, 0, 0.1);
}

/* Botón de Acción Especial (ej. Asociar Servicio) */
.btn.btn-action {
  background: #ffffff;
  border: 1.5px solid #0284c7;
  color: #0284c7;
  font-weight: 600;
}

.btn.btn-action:hover {
  background: #f0f9ff;
  border-color: #0369a1;
  color: #0369a1;
}

.btn.danger {
  background: #ffffff;
  border: 1.5px solid #fca5a5;
  color: #dc2626;
}

.btn.danger:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #b91c1c;
}

/* Botones Soft de Estado / Acción (Reutilizables en todos los módulos) */
.btn.soft-warning {
  background: #fff7ed;
  border: 1.5px solid #fed7aa;
  color: #c2410c;
  font-weight: 600;
}

.btn.soft-warning:hover {
  background: #ffedd5;
  border-color: #fdba74;
  color: #9a3412;
  box-shadow: 0 2px 8px -1px rgba(194, 65, 12, 0.18);
}

.btn.soft-success {
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  color: #15803d;
  font-weight: 600;
}

.btn.soft-success:hover {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
  box-shadow: 0 2px 8px -1px rgba(22, 101, 52, 0.18);
}

.btn.soft-danger {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  color: #dc2626;
  font-weight: 600;
}

.btn.soft-danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
  box-shadow: 0 2px 8px -1px rgba(220, 38, 38, 0.18);
}

.btn.dark {
  background: #0c4a55;
  border-color: #0c4a55;
  color: #ffffff;
}

.btn.dark:hover {
  background: #08343c;
}

/* Tamaños de Botón */
.btn.small {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 7px;
  gap: 6px;
}

.btn-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Botón Volver / Breadcrumb */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.16s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-back:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
  transform: translateX(-2px);
}

.btn-back svg {
  width: 14px;
  height: 14px;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   SISTEMA DE GRIDS Y KPIS COHESIVOS
   ========================================================================== */
.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

/* ==========================================================================
   SISTEMA BASE DE TARJETAS KPI (ESTÁNDAR PARA TODOS LOS MÓDULOS)
   ========================================================================== */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card,
.card.kpi {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.kpi-card::before,
.card.kpi::before {
  display: none;
}

.kpi-card:hover,
.card.kpi:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 6px 16px -2px rgba(15, 23, 42, 0.06);
}

/* Variante reutilizable para KPIs que abren un desglose. El acento sólo se
   muestra cuando el módulo opta explícitamente por esta interacción. */
.kpi-card--detail {
  cursor: pointer;
  padding-left: 26px;
}

.kpi-card--detail::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent-color, #126d7a);
}

.kpi-card--detail:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent-color, #126d7a) 32%, transparent);
  outline-offset: 3px;
}

.kpi-detail-modal[hidden] { display: none; }

.kpi-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.kpi-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(3px);
}

.kpi-detail-panel {
  position: relative;
  width: min(100%, 460px);
  padding: 28px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
}

.kpi-detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
}

.kpi-detail-eyebrow {
  display: block;
  margin-bottom: 7px;
  color: #0f7b86;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.kpi-detail-panel h2 {
  margin: 0;
  padding-right: 30px;
  color: #0f172a;
  font-size: 22px;
  line-height: 1.2;
}

.kpi-detail-value {
  margin: 16px 0 6px;
  color: #0f172a;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.03em;
}

.kpi-detail-description {
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.45;
}

.kpi-detail-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0;
}

.kpi-detail-fact {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #e5edf3;
  border-radius: 10px;
  background: #f8fafc;
}

.kpi-detail-fact span,
.kpi-detail-fact strong { display: block; }
.kpi-detail-fact span { color: #64748b; font-size: 11px; }
.kpi-detail-fact strong { margin-top: 3px; color: #1e293b; font-size: 13px; overflow-wrap: anywhere; }

.kpi-detail-list {
  display: grid;
  gap: 8px;
  margin: 0 0 20px;
}

.kpi-detail-list[hidden] { display: none; }

.kpi-detail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent-color, #126d7a);
  border-radius: 0 9px 9px 0;
  background: #f8fafc;
}

.kpi-detail-item-copy { min-width: 0; }
.kpi-detail-item-copy strong,
.kpi-detail-item-copy span { display: block; overflow-wrap: anywhere; }
.kpi-detail-item-copy strong { color: #1e293b; font-size: 13px; }
.kpi-detail-item-copy span { margin-top: 2px; color: #64748b; font-size: 11px; }
.kpi-detail-item > strong { flex: 0 0 auto; color: #0f172a; font-size: 13px; text-align: right; }

.kpi-detail-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  margin-top: 20px;
}

.kpi-detail-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #0f7b86;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  margin-left: auto;
}

.kpi-detail-link::after { content: "→"; font-size: 16px; transition: transform .16s ease; }
.kpi-detail-link:hover { color: #0a5d66; text-decoration: underline; }
.kpi-detail-link:hover::after { transform: translateX(3px); }

/* Identificadores copiable en tablas: el valor sigue siendo texto, no enlace. */
.data-copy-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.data-copy-line > strong,
.row-text-strong {
  color: #1e293b;
  font-size: 13px;
  font-weight: 750;
}

.copy-id-btn {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  padding: 0;
  border: 1px solid #dbe4ea;
  border-radius: 6px;
  background: #f8fafc;
  color: #60758a;
  cursor: pointer;
  transition: .15s ease;
}

.copy-id-btn:hover,
.copy-id-btn:focus-visible {
  border-color: #126d7a;
  background: #e6f7f9;
  color: #0e5b66;
  outline: none;
}

.copy-id-btn svg { width: 13px; height: 13px; }

body.kpi-detail-open { overflow: hidden; }

@media (max-width: 520px) {
  .kpi-detail-modal { padding: 14px; }
  .kpi-detail-panel { padding: 24px 20px 20px; }
}

/* Variantes de acento institucional para KPIs (utilizables en cualquier módulo) */
.kpi-card.accent-teal, .card.kpi.accent-teal { --accent-color: #126d7a; }
.kpi-card.accent-indigo, .card.kpi.accent-indigo { --accent-color: #4f46e5; }
.kpi-card.accent-emerald, .card.kpi.accent-emerald { --accent-color: #059669; }
.kpi-card.accent-amber, .card.kpi.accent-amber { --accent-color: #d97706; }

.kpi-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-label-text,
.kpi-card .label,
.card.kpi .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748b;
  font-weight: 750;
  margin-bottom: 0;
}

.kpi-icon-bubble {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #475569;
  flex-shrink: 0;
}

.accent-teal .kpi-icon-bubble { background: #e6f7f9; color: #0e5b66; }
.accent-indigo .kpi-icon-bubble { background: #eef2ff; color: #4338ca; }
.accent-emerald .kpi-icon-bubble { background: #ecfdf5; color: #047857; }
.accent-amber .kpi-icon-bubble { background: #fffbeb; color: #b45309; }

.kpi-icon-bubble svg {
  width: 18px;
  height: 18px;
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.kpi-value-row strong,
.kpi-card strong,
.card.kpi strong {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.kpi-pill {
  font-size: 11px;
  font-weight: 650;
  padding: 2px 7px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kpi-pill.success { background: #ecfdf5; color: #065f46; }
.kpi-pill.info { background: #eff6ff; color: #1e40af; }
.kpi-pill.primary { background: #e6f7f9; color: #0e5b66; }
.kpi-pill.warning { background: #fffbeb; color: #92400e; }

.kpi-footer-text,
.kpi-card .kpi-subtext,
.card.kpi .kpi-subtext {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
  line-height: 1.35;
}

/* Espaciadores de margen consistentes */
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 2rem !important; }

/* Toolbar avanzada y controles de filtro en UNA SOLA FILA */
.toolbar-advanced {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}

.toolbar-filters-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  width: 100%;
  overflow-x: auto;
  padding: 6px 2px 6px 2px;
}

.toolbar-search-wrap {
  flex: 1 1 300px;
  min-width: 220px;
  position: relative;
}

.toolbar-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.toolbar-search-wrap input.input {
  padding-left: 38px;
  height: 42px;
  box-sizing: border-box;
  font-size: 13px;
  width: 100%;
  border-radius: 9px;
}

.toolbar-filters-row select.input {
  height: 42px;
  box-sizing: border-box;
  font-size: 13px;
  border-radius: 9px;
  white-space: nowrap;
}

#empresaServicioFilter {
  flex: 0 1 280px;
  min-width: 200px;
}

#empresaEstadoFilter,
#servicioEstadoFilter {
  flex: 0 0 185px;
  min-width: 175px;
}

#filtroEmpresaPersonal {
  flex: 0 1 240px;
  min-width: 190px;
}

#filtroEstamentoPersonal {
  flex: 0 1 220px;
  min-width: 180px;
}

#filtroEstadoPersonal,
#filtroEstadoEmpresas {
  flex: 0 0 160px;
  min-width: 150px;
}

/* Botón limpiar filtros: MISMO TAMAÑO EXACTO que los select (42px), rojo con icono de X, solo visible al filtrar */
.btn-clear-filter {
  height: 42px;
  box-sizing: border-box;
  border-radius: 9px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: #dc2626;
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  gap: 7px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn-clear-filter:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.15);
  transform: none !important;
}

.btn-clear-filter.hidden {
  display: none !important;
}

.btn-clear-filter svg {
  stroke: #dc2626;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-clear-filter:hover svg {
  stroke: #b91c1c;
}

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

.results-counter {
  font-size: 12.5px;
  font-weight: 600;
  color: #64748b;
}

/* ==========================================================================
   TARJETA DE PERFIL Y CABECERA EJECUTIVA (EMPRESA / PERSONAL / SERVICIO)
   ========================================================================== */
.profile-header-card {
  padding: 22px 24px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.profile-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
}

.profile-identity-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #126d7a 0%, #094750 100%);
  color: #ffffff;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 10px -2px rgba(18, 109, 122, 0.35);
  flex-shrink: 0;
}

.profile-title-block h2 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 750;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.profile-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge-commercial {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 11.5px;
  font-weight: 600;
}

.profile-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #64748b;
}

.profile-meta-row strong {
  color: #1e293b;
  font-weight: 600;
}

.meta-sep {
  color: #cbd5e1;
}

.profile-actions-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Grilla de Contacto / Datos Clave - Diseño Minimalista y Limpio sin fondos grises ni línea doble */
.contact-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  padding-top: 20px;
  margin-top: 0;
}

.contact-info-tile {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 2px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.contact-tile-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #126d7a;
  flex-shrink: 0;
}

.contact-tile-icon svg {
  width: 17px;
  height: 17px;
}

.tile-label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 2px;
}

.tile-value {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
  word-break: break-word;
}

/* ==========================================================================
   SISTEMA DE PESTAÑAS SEGMENTADAS MINIMALISTA DE ALTA VISIBILIDAD (TABS)
   - Contenedor cápsula blanco, limpio y nítido, sin fondos grises.
   - Pestaña inactiva: fondo transparente limpio, texto slate oscuro, badge suave en teal,
     y realce interactivo suave en hover para máxima intuición táctil.
   - Pestaña activa: cápsula sólida institucional #126d7a, texto blanco y relieve suave.
   ========================================================================== */
.tabs-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  padding: 5px;
  border-radius: 14px;
  border: 1.5px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  margin: 22px 0 20px;
  max-width: 100%;
  overflow-x: auto;
}

.tab-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: #334155;
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  user-select: none;
}

.tab-btn:hover {
  color: #126d7a;
  background: #f0fdfa;
  border-color: rgba(18, 109, 122, 0.2);
}

.tab-btn:active {
  transform: scale(0.98);
}

.tab-btn.active {
  background: #126d7a;
  color: #ffffff;
  font-weight: 750;
  border-color: #0e5661;
  box-shadow: 0 2px 8px rgba(18, 109, 122, 0.28);
}

.tab-btn.active:hover {
  background: #0e5661;
  color: #ffffff;
}

.tab-btn .tab-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  stroke: #64748b;
  opacity: 0.85;
  transition: all 0.2s ease;
}

.tab-btn:hover .tab-icon {
  stroke: #126d7a;
  opacity: 1;
}

.tab-btn.active .tab-icon {
  opacity: 1;
  stroke: #ffffff;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  background: #f0fdfa;
  color: #126d7a;
  border: 1px solid #ccfbf1;
  transition: all 0.2s ease;
}

.tab-btn:hover .tab-badge {
  background: #126d7a;
  color: #ffffff;
  border-color: #126d7a;
}

.tab-btn.active .tab-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.tab-pane {
  display: block;
}

.tab-pane.hidden {
  display: none !important;
}

/* ==========================================================================
   GRILLA DE ASIGNACIÓN VIGENTE (FICHA PERSONAL / OPERACIÓN)
   ========================================================================== */
.asig-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.asig-tile {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.asig-tile:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.05);
}

.asig-tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.asig-tile-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.asig-tile-icon-wrap {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.asig-tile-val {
  font-size: 15px;
  font-weight: 750;
  color: #0f172a;
  line-height: 1.35;
}

.asig-tile-sub {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}

.helper-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  border-radius: 12px;
  color: #0e5b66;
  font-size: 13px;
  line-height: 1.5;
}

.helper-info-banner .helper-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  color: #126d7a;
}

.uppercase-input {
  text-transform: uppercase !important;
}

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

.m-0 {
  margin: 0 !important;
}

.mb-1 {
  margin: 0 0 4px !important;
}


.concept-label {
  font-weight: 700;
  color: #123345;
  padding: 6px 0;
}

.current-price-label {
  font-weight: 700;
  color: var(--muted);
  padding: 8px 0;
}

.brand-center {
  text-align: center;
  margin-bottom: 22px;
}

.brand-center h2 {
  margin: 0 0 6px;
  color: #0c2332;
  font-size: 22px;
}

.full-width {
  width: 100%;
}

.btn.small {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Tarjetas y Contenedores */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.section {
  padding: 22px 24px;
}

.section h3 {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 750;
  color: #1a293f;
}

/* Toolbar y Filtros */
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}

.prestacion-asociadas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.prestacion-asociada-card {
  border: 1px solid #bfe8df;
  border-radius: 10px;
  background: #f0fdfa;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prestacion-asociada-card strong {
  display: block;
  color: #0f766e;
  margin-bottom: 2px;
}

.prestacion-asociada-card span {
  color: #52647a;
  font-size: 13px;
}

.btn-quitar-asoc {
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-quitar-asoc:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fca5a5;
}

@media (max-width: 720px) {
  .toolbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

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

.input,
select {
  height: 42px;
  border: 1px solid #d8e1e9;
  border-radius: 9px;
  background: #ffffff;
  padding: 0 12px;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  min-width: 150px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 109, 122, 0.15);
}

.input.small {
  width: 100px;
  min-width: 100px;
}

.input.error,
.input.is-invalid,
select.error,
select.is-invalid {
  border-color: var(--danger) !important;
  background-color: #fdf2f2;
}

.input.error:focus,
.input.is-invalid:focus,
select.error:focus,
select.is-invalid:focus {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(224, 49, 49, 0.18) !important;
}

/* Barra superior de acciones sobre la tabla (ej. botón Descargar XLSX) */
.table-top-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 6px;
  margin-bottom: 12px;
  width: 100%;
}

/* Tablas */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 820px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f7f9fc;
  color: #536074;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: #fbfcfe;
}

.row-link-strong {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

.money {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.right {
  text-align: right;
}

/* ==========================================================================
   TABLA ADAPTABLE COMPACTA (SIN SCROLL HORIZONTAL)
   Permite conservar todas las columnas sin desbordamiento
   ========================================================================== */
.table-fit {
  min-width: 0 !important;
  width: 100% !important;
  table-layout: auto;
}

.table-fit th,
.table-fit td {
  padding: 10px 8px !important;
  font-size: 12.5px;
  vertical-align: middle;
  line-height: 1.35;
}

.table-fit th {
  font-size: 11px;
}

.table-fit .cell-nowrap {
  white-space: nowrap !important;
}

.table-fit .col-run {
  white-space: nowrap !important;
  width: 98px;
}

.table-fit .col-nombre {
  min-width: 120px;
  white-space: normal;
  word-break: break-word;
}

.table-fit .col-servicio {
  min-width: 120px;
  white-space: normal;
  word-break: break-word;
}

.table-fit .col-estamento {
  white-space: nowrap !important;
  width: 85px;
}

.table-fit .col-cargo {
  min-width: 110px;
  white-space: normal;
  word-break: break-word;
}

.table-fit .col-fecha {
  white-space: nowrap !important;
  width: 85px;
}

.table-fit .col-estado {
  white-space: nowrap !important;
  width: 70px;
  text-align: center;
}

.table-fit .col-accion {
  white-space: nowrap !important;
  width: 80px;
  text-align: right;
}

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

/* Badges */
.badge {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge.ok {
  background: #e8f6ef;
  color: var(--ok);
}

.badge.draft {
  background: #fff3df;
  color: var(--warn);
}

.badge.info {
  background: #eaf4fb;
  color: #2c668c;
}

.badge.closed {
  background: #f1f5f9;
  color: #475569;
}

.badge.review {
  background: #fef3c7;
  color: #b45309;
}

.badge.validated {
  background: #e0f2fe;
  color: #0369a1;
}

.badge.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.note {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 18px 0;
}


.empty {
  padding: 45px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Modales */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 29, 39, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
  backdrop-filter: blur(3px);
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #ffffff;
  border-radius: 18px;
  padding: 26px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
  animation: modalIn 0.2s ease-out;
}

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

.modal h3 {
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 750;
  color: #0e2b3c;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 12.5px;
  color: #4a5568;
  font-weight: 650;
}

.field label .req,
label .req,
.req {
  color: #dc2626 !important;
  font-weight: 700;
  margin-left: 2px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
}

/* Textareas con auto-crecimiento y tamaño manual no editable */
textarea.input,
textarea.textarea,
.textarea-autogrow {
  resize: none !important;
  min-height: 44px;
  height: 44px;
  padding: 10px 14px;
  line-height: 1.45;
  overflow-y: hidden;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, height 0.12s ease;
}

/* Selector de Horarios Asistenciales tipo Calendario/Popover */
.schedule-field-wrap {
  position: relative;
}

.schedule-picker-input-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.schedule-picker-input-group .input {
  width: 100%;
  padding-right: 42px;
  cursor: pointer;
}

.schedule-picker-icon-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: #64748b;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.schedule-picker-icon-btn:hover {
  color: var(--primary);
  background: #f1f5f9;
}

.schedule-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  min-width: 320px;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid #d8e1e9;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(12, 29, 39, 0.18);
  padding: 14px;
  z-index: 1050;
  display: none;
  animation: schedulePopoverIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.schedule-popover.show {
  display: block;
}

@keyframes schedulePopoverIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.schedule-popover-title {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.schedule-custom-builder {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.schedule-custom-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.schedule-custom-row label {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 650;
  min-width: 44px;
}

.schedule-custom-row select.input,
.schedule-custom-row input[type="time"] {
  height: 36px;
  font-size: 12.5px;
  border-radius: 7px;
  padding: 0 8px;
  flex: 1;
  min-width: 0;
}

.schedule-range-sep {
  font-size: 12px;
  color: #94a3b8;
}

.schedule-24h-note {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.schedule-24h-note svg {
  flex-shrink: 0;
  color: #15803d;
}

.btn-apply-schedule {
  width: 100%;
  justify-content: center;
}

.link-btn-text {
  background: none;
  border: none;
  color: var(--primary, #0c4a55);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

.link-btn-text:hover {
  color: #08343c;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* Alertas y Notificaciones */
.alert-box {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13.5px;
  display: none;
}

.alert-box.show {
  display: block;
}

.alert-box.success {
  background: #e8f6ef;
  color: var(--ok);
  border: 1px solid #c3ebd5;
}

.alert-box.error {
  background: #fdf2f2;
  color: var(--danger);
  border: 1px solid #fbd5d5;
}

/* Responsive (Tablets y Móviles) */
@media (max-width: 980px) {
  .app-header {
    padding: 0 18px;
  }

  .main-container {
    padding: 22px 20px 36px;
  }
}

@media (max-width: 768px) {
  .header-center,
  .header-facility-pill {
    display: none;
  }
}

@media (max-width: 650px) {
  .app-header {
    padding: 0 14px;
    height: 54px;
  }

  .header-pill-group {
    padding: 3px 5px;
  }

  .header-pill-status {
    padding: 3px 8px;
  }

  .main-container {
    padding: 16px 14px 32px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

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

/* Utilities */
.m-0 {
  margin: 0 !important;
}

.mb-1 {
  margin: 0 0 4px !important;
}

/* ==========================================================================
   BOTÓN ABRIR / FICHA / VER DETALLE (ACCIÓN DE ALTA RELEVANCIA)
   - Sofisticado tono Azul Royal / Índigo corporativo.
   - Comunica clara importancia y destino de navegación sin competir con el CTA primario.
   - Reposo: fondo suave (#eff6ff), borde delicado (#bfdbfe), texto nítido (#1d4ed8).
   - Hover: elevación sólida (#2563eb), texto blanco, transición suave del icono flecha.
   ========================================================================== */
.btn-open,
.btn.btn-open {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(29, 78, 216, 0.06);
}

.btn-open:hover,
.btn.btn-open:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

.btn-open:active,
.btn.btn-open:active {
  transform: translateY(0);
  background: #1e40af;
  border-color: #1e40af;
  color: #ffffff;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-open-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 2.2;
  transition: transform 0.18s ease;
}

.btn-open:hover .btn-open-icon {
  transform: translateX(3px);
  stroke: #ffffff;
}

/* ==========================================================================
   BOTONES DE DESCARGA Y EXPORTACIÓN INDEPENDIENTES (XLSX, PDF, DOCX)
   ========================================================================== */
.btn-download {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 11px 22px;
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #ffffff !important;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  text-decoration: none;
  min-width: 185px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.btn-download:hover {
  transform: translateY(-2px) scale(1.02);
}

.btn-download:active {
  transform: scale(0.97);
}

/* Brillo sutil y dinámico al pasar el cursor (Shimmer) */
.btn-download .btn-download-shimmer {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: translateX(-100%);
  transition: transform 0.9s ease-out;
}

.btn-download:hover .btn-download-shimmer {
  transform: translateX(100%);
}

/* Iconos SVG vectoriales nítidos con micro-interacción */
.btn-download-icon {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
  transition: transform 0.3s ease-out;
}

.btn-download:hover .btn-download-icon {
  transform: translateY(-1.5px) scale(1.1);
}

.btn-download-text {
  position: relative;
  z-index: 2;
  white-space: nowrap;
}

/* Variante XLSX (Verde Excel) */
.btn-download-xlsx {
  background-color: #107c41;
}

.btn-download-xlsx:hover {
  background: linear-gradient(135deg, #12914c 0%, #0d6b38 100%);
  box-shadow: 0 12px 24px -6px rgba(16, 124, 65, 0.45), 0 4px 10px -2px rgba(16, 124, 65, 0.3);
}

.btn-download-xlsx:active {
  background-color: #084021;
}

.btn-download-xlsx:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(16, 124, 65, 0.35);
}

/* Variante PDF (Rojo Adobe) */
.btn-download-pdf {
  background-color: #c5221f;
}

.btn-download-pdf:hover {
  background: linear-gradient(135deg, #dc2c28 0%, #ab1a17 100%);
  box-shadow: 0 12px 24px -6px rgba(197, 34, 31, 0.45), 0 4px 10px -2px rgba(197, 34, 31, 0.3);
}

.btn-download-pdf:active {
  background-color: #801614;
}

.btn-download-pdf:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(197, 34, 31, 0.35);
}

/* Variante DOCX / Documento (Azul Word) */
.btn-download-docx {
  background-color: #185abd;
}

.btn-download-docx:hover {
  background: linear-gradient(135deg, #2070e3 0%, #134e9e 100%);
  box-shadow: 0 12px 24px -6px rgba(24, 90, 189, 0.45), 0 4px 10px -2px rgba(24, 90, 189, 0.3);
}

.btn-download-docx:active {
  background-color: #0b3777;
}

.btn-download-docx:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(24, 90, 189, 0.35);
}

/* Modificador compacto (para toolbars de fichas y tablas) */
.btn-download.btn-download-sm {
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 9px;
  min-width: 140px;
  gap: 8px;
}

.btn-download.btn-download-sm .btn-download-icon {
  width: 17px;
  height: 17px;
}

/* Contenedor de barra de descargas */
.downloads-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 14px 0 16px;
}
.switch-control-group {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  padding: 6px 14px;
  border-radius: 24px;
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  width: fit-content;
  max-width: max-content;
  align-self: flex-start;
}

.switch-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 58px;
  height: 32px;
  padding: 3px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  cursor: pointer;
  outline: none;
  transition: transform 0.15s ease;
  user-select: none;
  flex-shrink: 0;
}

.switch-btn:active {
  transform: scale(0.96);
}

.switch-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.4);
}

/* Track / Fondo del switch */
.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background-color: #94a3b8;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
  transition: background-color 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.switch-glow {
  pointer-events: none;
  position: absolute;
  inset: -2px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.3);
  filter: blur(6px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Perilla deslizante (Thumb) */
.switch-thumb {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 9999px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
              width 0.18s ease;
}

.switch-thumb-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background-color: #94a3b8;
  transition: background-color 0.25s ease;
}

/* Estado ACTIVO del Switch */
.switch-btn.is-active .switch-track {
  background-color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4), inset 0 1px 3px rgba(255, 255, 255, 0.3);
}

.switch-btn.is-active .switch-glow {
  opacity: 1;
}

.switch-btn.is-active .switch-thumb {
  transform: translateX(26px);
}

.switch-btn.is-active .switch-thumb-dot {
  background-color: #10b981;
}

/* Indicador y Label externo */
.switch-status-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  user-select: none;
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background-color: #94a3b8;
  transition: all 0.25s ease;
}

.status-label-text {
  color: #64748b;
  transition: color 0.25s ease;
}

.switch-btn.is-active + .switch-status-label .status-indicator-dot,
.switch-control-group.is-active .status-indicator-dot {
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.switch-btn.is-active + .switch-status-label .status-label-text,
.switch-control-group.is-active .status-label-text {
  color: #059669;
}

/* ==========================================================================
   TOAST NOTIFICATION DE DESCARGA / ACCIONES
   ========================================================================== */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background-color: #0f172a;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 550;
  border-radius: 9999px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-notification.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.toast-notification-icon {
  width: 18px;
  height: 18px;
  color: #34d399;
  flex-shrink: 0;
}

.toast-notification.toast-error {
  background-color: #1e1b1b;
  border: 1px solid #7f1d1d;
  box-shadow: 0 10px 25px -5px rgba(220, 38, 38, 0.35);
}

.toast-notification.toast-error .toast-notification-icon {
  color: #f87171;
}

.toast-notification.toast-warn {
  background-color: #1f1b13;
  border: 1px solid #78350f;
  box-shadow: 0 10px 25px -5px rgba(217, 119, 6, 0.3);
}

.toast-notification.toast-warn .toast-notification-icon {
  color: #fbbf24;
}

.toast-notification.toast-success .toast-notification-icon {
  color: #34d399;
}

/* Filas de horarios en formulario de asignación */
.horario-row-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  position: relative;
}

.horario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) auto;
  gap: 12px;
  align-items: flex-end;
}

.details-styled {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-top: 14px;
}

.details-styled summary {
  font-weight: 650;
  color: var(--primary);
  cursor: pointer;
  user-select: none;
  font-size: 14px;
}

.details-styled summary:hover {
  color: var(--primary2);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}

.card-nested {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 10px;
}

.toolbar-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ==========================================================================
   MODAL DE CONFIRMACIÓN GLOBAL BASE (EXVAL)
   ========================================================================== */
.modal-backdrop-confirm {
  z-index: 1050 !important;
}

.modal.modal-confirm {
  width: min(440px, 92vw);
  padding: 24px 28px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
  animation: modalIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fef2f2;
  border: 1px solid #fee2e2;
  color: #dc2626;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.modal.modal-confirm h3.confirm-title {
  margin: 0 0 8px;
  font-size: 17.5px;
  font-weight: 750;
  color: #0e2b3c;
}

.modal.modal-confirm p.confirm-message {
  margin: 0 0 22px;
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.5;
}

.modal.modal-confirm .confirm-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.modal.modal-confirm .confirm-actions .btn {
  min-width: 110px;
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.modal.modal-confirm .confirm-actions .btn.danger {
  background: #dc2626 !important;
  border: 1px solid #dc2626 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35) !important;
}

.modal.modal-confirm .confirm-actions .btn.danger:hover {
  background: #b91c1c !important;
  border-color: #b91c1c !important;
  color: #ffffff !important;
  box-shadow: 0 6px 16px rgba(185, 28, 28, 0.45) !important;
  transform: translateY(-1px);
}

.modal.modal-confirm .confirm-actions .btn.danger:active {
  transform: translateY(0);
}

.modal.modal-confirm .confirm-actions .btn:not(.danger) {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #475569;
}

.modal.modal-confirm .confirm-actions .btn:not(.danger):hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #1e293b;
}

/* ==========================================================================
   COMPONENTES GLOBALES DE PAGINACIÓN CENTRADA (Exval UI)
   ========================================================================== */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 4px 8px;
  border-top: 1px solid var(--line);
  margin-top: 14px;
}

.table-pagination.hidden,
.table-pagination[hidden] {
  display: none !important;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-page {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.825rem;
  font-weight: 600;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--line);
  background: var(--panel, #ffffff);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-page:hover:not(:disabled) {
  background: var(--soft, #f1f5f9);
  border-color: #168292;
  color: #168292;
}

.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-num {
  min-width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  font-size: 0.825rem;
  font-weight: 600;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.page-num:hover {
  background: var(--soft, #f1f5f9);
  color: var(--text);
}

.page-num.active {
  background: #183d4d;
  color: #ffffff;
  border-color: #183d4d;
}

.page-ellipsis {
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.85rem;
  user-select: none;
}

/* Salto entre bloques de diez páginas: conserva la estética discreta del …,
   pero es una acción accesible y no un texto inerte. */
.page-ellipsis-action {
  width: auto;
  cursor: pointer;
}

.page-ellipsis-action:hover,
.page-ellipsis-action:focus-visible {
  color: #168292;
  background: var(--soft, #f1f5f9);
  outline: none;
}

/* Resultado compacto para seleccionar personal por RUN dentro de modales. */
.assignment-person-result {
  min-height: 0;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.875rem;
}

.assignment-person-result.is-selected {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: #155e75;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  border-radius: var(--radius-sm, 6px);
}

.assignment-person-result strong {
  color: var(--text);
}

/* ==========================================================================
   BARRA DE FILTRO DE BÚSQUEDA INTELIGENTE PARA TABLAS
   ========================================================================== */
.table-filter-bar,
.dotacion-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1 1 340px;
  max-width: 540px;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.search-input-wrap .search-input {
  width: 100%;
  height: 42px;
  padding-left: 36px;
  padding-right: 32px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.search-input-wrap .search-input:focus {
  border-color: #168292;
  box-shadow: 0 0 0 3px rgba(22, 130, 146, .12);
  outline: none;
}

.search-input-wrap .btn-clear-search {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.search-input-wrap .btn-clear-search:hover {
  color: #334155;
}

/* ==========================================================================
   BARRA DE AUDITORÍA Y FILTRO OPERATIVO EN 2 LÍNEAS (PESTAÑA 1)
   ========================================================================== */
.dotacion-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}

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

.dotacion-toolbar-top {
  justify-content: flex-start;
  padding: 0;
}

.dotacion-toolbar-bottom {
  padding-top: 2px;
}

.dotacion-toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dotacion-toolbar-filters {
  width: 100%;
  flex-wrap: nowrap;
}

.dotacion-results-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 9px 4px 11px;
}

/* El resumen acompaña a la tabla: no compite visualmente con los filtros. */
.dotacion-results-summary .dotacion-metric-pill {
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.dotacion-results-summary .metric-label { color: #64748b; }
.dotacion-results-summary .metric-value { color: #15803d; font-size: 14px; }

.search-group-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.filtro-periodo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.filtro-periodo-wrap .filtro-periodo-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.dotacion-filter-select {
  min-width: 190px;
  height: 35px;
  font-size: 12.5px;
}

.dotacion-metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 4px 12px;
  height: 34px;
  box-sizing: border-box;
}

.dotacion-metric-pill .metric-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #166534;
}

.dotacion-metric-pill .metric-value {
  font-size: 13.5px;
  font-weight: 700;
  color: #15803d;
}

.dotacion-filter-count {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.search-input-wrap.search-compact {
  width: 340px;
  flex: 1 1 340px;
  max-width: 100%;
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search-input-wrap.search-compact .search-input {
  height: 35px;
  font-size: 12.5px;
  padding-left: 30px;
  padding-right: 24px;
  border-radius: 7px;
  width: 100%;
}

.search-input-wrap.search-compact .search-icon {
  left: 9px;
  position: absolute;
  pointer-events: none;
  color: #94a3b8;
  width: 14px;
  height: 14px;
}

@media (max-width: 900px) {
  .dotacion-toolbar-filters { flex-wrap: wrap; }
  .dotacion-results-summary { align-items: flex-start; flex-wrap: wrap; }
}

/* Switcher Segmentado: Dotación vs Diálisis */
.vista-segmented-control {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 2.5px;
  gap: 2px;
  border: 1px solid var(--line);
}

.segment-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
  line-height: 1.2;
}

.segment-btn:hover {
  color: #1e293b;
  background: rgba(255, 255, 255, 0.7);
}

.segment-btn.active {
  color: #0f172a;
  background: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.segment-btn .segment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9999px;
  background: #e2e8f0;
  color: #475569;
  transition: all .15s ease;
}

.segment-btn.active .segment-badge {
  background: #0f766e;
  color: #ffffff;
}

/* Pastilla de KPI Total P x Q */
.dotacion-kpi-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 7px;
  padding: 4px 12px;
  height: 35px;
  box-sizing: border-box;
}

.dotacion-kpi-pill .kpi-label {
  font-size: 11px;
  color: #166534;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dotacion-kpi-pill .kpi-amount {
  font-size: 13.5px;
  font-weight: 700;
  color: #15803d;
}

.filter-pills {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
  line-height: 1.2;
}

.filter-pill:hover {
  color: #1e293b;
  background: rgba(255, 255, 255, 0.7);
}

.filter-pill.active {
  color: #0f172a;
  background: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.filter-pill .pill-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9999px;
  background: #e2e8f0;
  color: #475569;
  transition: all .15s ease;
}

.filter-pill.active .pill-badge {
  background: #0f766e;
  color: #ffffff;
}

.filter-pill.active .pill-badge.pill-badge-warning {
  background: #f59e0b;
  color: #ffffff;
}

.filter-pill.active .pill-badge.pill-badge-success {
  background: #10b981;
  color: #ffffff;
}

/* ==========================================================================
   COMPONENTE CHECKBOX / TOGGLE MINIMALISTA Y SUTIL
   ========================================================================== */
.checkbox {
  --checkbox-color: #64748b;
  --checkbox-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  font-size: 12.5px;
  font-weight: 500;
  color: #475569;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 0 11px;
  border-radius: 8px;
  height: 34px;
  box-sizing: border-box;
  transition: all 150ms ease;
  white-space: nowrap;
}

.checkbox:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #1e293b;
}

.checkbox input {
  position: absolute;
  pointer-events: none;
  inset: 0;
  opacity: 0;
}

.checkbox .checkmark {
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color 150ms ease;
}

.checkbox .checkmark svg {
  width: var(--checkbox-size);
  height: var(--checkbox-size);
  color: #94a3b8;
  flex-shrink: 0;
  transition: color 150ms ease;
}

.checkbox .checkmark svg rect {
  stroke-dasharray: 88 0;
  stroke-dashoffset: 73;
  transition: stroke-dasharray 120ms ease;
}

.checkbox input:checked ~ .checkmark svg rect {
  stroke-dasharray: 80 18;
}

.checkbox .checkmark svg polyline {
  stroke-dasharray: 0 30;
  stroke-dashoffset: 1;
  transition: stroke-dasharray 150ms ease;
}

.checkbox input:checked ~ .checkmark svg polyline {
  stroke-dasharray: 30 30;
}

/* Estado activo: sutil, sobrio y elegante sin estridencias ni brillos neon */
.checkbox:has(input:checked) {
  background: #f8fafc;
  border-color: #0f766e;
  color: #0f766e;
  font-weight: 600;
}

.checkbox:has(input:checked) .checkmark svg {
  color: #0f766e;
}

.checkbox:has(input:focus-visible) {
  outline: none;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
}

.dotacion-filter-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  max-width: 820px;
  flex-wrap: wrap;
}

.badge-prestacion {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.prestaciones-banner-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  background: linear-gradient(135deg, #f0fdfa 0%, #f8fafc 100%);
  border: 1px solid #ccfbf1;
  border-left: 4px solid #0f766e;
  border-radius: 8px;
  margin-top: 10px;
  margin-bottom: 12px;
}

.prestaciones-banner-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prestaciones-banner-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: #1e293b;
  font-weight: 600;
}

.prestaciones-banner-title svg {
  color: #0f766e;
  flex-shrink: 0;
}

.prestaciones-banner-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #64748b;
}

.metric-divider {
  color: #cbd5e1;
}

.prestaciones-banner-action {
  flex-shrink: 0;
}

#tablaPrestacionesSinPersona {
  width: 100%;
}

#tablaPrestacionesSinPersona th,
#tablaPrestacionesSinPersona td {
  padding: 11px 14px;
}

.col-prestacion-nombre {
  font-weight: 600;
  color: #1e293b;
}

.text-teal {
  color: #0f766e;
  font-weight: 600;
}

.table-wrap {
  min-height: auto;
}

/* Ficha de servicio: tablas compactas para evitar el desplazamiento lateral. */
.table-wrap:has(.service-detail-table) { overflow-x: hidden; }

.service-detail-table {
  min-width: 0;
  table-layout: fixed;
}

.service-detail-table th,
.service-detail-table td {
  padding: 11px 12px;
  white-space: normal;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.service-personal-table th:nth-child(1) { width: 20%; }
.service-personal-table th:nth-child(2) { width: 22%; }
.service-personal-table th:nth-child(3) { width: 12%; }
.service-personal-table th:nth-child(4) { width: 18%; }
.service-personal-table th:nth-child(5) { width: 10%; }
.service-personal-table th:nth-child(6) { width: 8%; }
.service-personal-table th:nth-child(7) { width: 10%; }

.service-person-cell,
.service-company-cell,
.service-cargo-cell {
  min-width: 0;
}

.service-person-cell strong,
.service-company-cell strong,
.service-cargo-cell strong,
.service-person-cell span,
.service-company-cell span,
.service-cargo-cell span {
  display: block;
}

.service-person-cell strong,
.service-company-cell strong,
.service-cargo-cell strong { color: #1e293b; font-size: 12.5px; }
.service-person-cell span,
.service-company-cell span,
.service-cargo-cell span { margin-top: 3px; color: #718096; font-size: 11px; }

@media (max-width: 900px) {
  .table-wrap:has(.service-detail-table) { overflow-x: auto; }
  .service-detail-table { min-width: 720px; }
}
