/* Workspace Clinico - maquetado de secciones (complementa configTratamiento.css) */
/*
.ws-section (default)	span 6 visual: ancho completo (stack en mobile)
.ws-section--col	span 2 visual: 1/3
.ws-section--media	span 4 visual: 2/3
.ws-section--mitad	span 3 visual: 1.5/3 (mitad exacta)
.ws-section--ancha	1 / -1 visual: completo

*/

.ws-grid-secciones {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.ws-section {
  background: var(--ct-card-bg, #fff);
  border: 1px solid var(--ct-border, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  grid-column: span 6;
}

/* 1 columna visual (1/3) */
.ws-section--col {
  grid-column: span 2;
}

/* 2 columnas visuales (2/3) */
.ws-section--media {
  grid-column: span 4;
}

/* mitad del grid (1.5 columnas visuales → 3/6) */
.ws-section--mitad {
  grid-column: span 3;
}

/* ancho completo */
.ws-section--ancha {
  grid-column: 1 / -1;
}

@media (max-width: 991px) {

  .ws-section,
  .ws-section--col,
  .ws-section--media,
  .ws-section--mitad {
    grid-column: 1 / -1;
  }
}

.ws-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #eef0f3;
}

.ws-section-titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ws-section-titulo h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-section-icono {
  color: #1a6fc4;
  font-size: 1rem;
  flex-shrink: 0;
}

.ws-section-body {
  padding: 12px 16px;
  min-height: 90px;
  flex: 1;
}

/* Botones compactos del workspace */
.ws-btn-primario,
.ws-btn-secundario {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  line-height: 1.2;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.ws-btn-primario {
  background: #198754;
  color: #fff;
  border-color: #198754;
}

.ws-btn-primario:hover {
  background: #157347;
  border-color: #146c43;
}

.ws-btn-secundario {
  background: transparent;
  color: #374151;
  border-color: #d1d5db;
}

.ws-btn-secundario:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.ws-btn-alta {
  background: #198754;
  color: #fff;
  border-color: #198754;
}

.ws-btn-alta:hover {
  background: #157347;
  border-color: #146c43;
}

/* Tarjeta monetaria */
.ws-monetario-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 600px) {
  .ws-monetario-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.ws-monetario-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #f1f3f5;
}

.ws-monetario-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #6b7280;
  font-weight: 600;
}

.ws-monetario-valor {
  font-weight: 600;
  font-size: 1.1rem;
  color: #1f2937;
}

.ws-monetario-item--saldo {
  background: #fff7ed;
  border-color: #fed7aa;
}

.ws-monetario-item--saldo .ws-monetario-valor {
  color: #b45309;
}

/* Dias Hospitalizado (reemplaza al placeholder de Evolucion del peso) */
.ws-section--dias .ws-section-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ws-dias-hosp {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 4px;
  min-height: 130px;
  width: 100%;
}

.ws-dias-hosp__numero {
  font-size: 3.25rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ct-primary, #1a6fc4);
}

.ws-dias-hosp__label {
  margin-top: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #6b7280;
}

.ws-dias-hosp__desde {
  margin-top: 10px;
  font-size: 0.78rem;
  font-style: italic;
  color: #9ca3af;
}

@media (max-width: 767.98px) {
  .ws-dias-hosp {
    min-height: 110px;
  }

  .ws-dias-hosp__numero {
    font-size: 2.5rem;
  }
}

/* Listas internas */
.ws-lista {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 180px;
  overflow-y: auto;
}

.ws-lista-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px dashed #eef0f3;
}

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

.ws-lista-nombre {
  color: #374151;
  font-size: 0.85rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-lista-meta {
  color: #6b7280;
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* Estado vacio de tarjetas */
.ws-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  padding: 16px;
  gap: 6px;
  text-align: center;
}

.ws-empty i {
  font-size: 1.4rem;
}

.ws-empty span {
  font-size: 0.8rem;
}

/* ── Informe Monetario: card único (Total acumulado destacado) ── */
.ws-monetario-grid--unico {
  grid-template-columns: 1fr;
}

.ws-monetario-item--destacado {
  align-items: center;
  text-align: center;
  padding: 16px 14px;
  background: linear-gradient(180deg, #f0f7ff 0%, #f9fafb 100%);
  border-color: #d6e6f6;
  gap: 6px;
}

.ws-monetario-item--destacado .ws-monetario-label {
  font-size: 0.72rem;
  color: #1a6fc4;
}

.ws-monetario-item--destacado .ws-monetario-valor {
  font-size: 1.9rem;
  color: #1a6fc4;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

/* ── Informe Monetario: link "Ver detalle" ── */
.ws-monetario-link-detalle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  align-self: flex-end;
  background: none;
  border: none;
  padding: 2px 4px;
  font-size: 0.8rem;
  color: #1a6fc4;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}

.ws-monetario-link-detalle:hover {
  color: #145390;
}

.ws-monetario-item--destacado .ws-monetario-link-detalle {
  align-self: center;
}

/* ── Informe Monetario: estado cargando del valor ── */
@keyframes ws-monetario-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.45;
  }
}

.ws-monetario-valor.is-loading {
  display: inline-block;
  min-width: 120px;
  height: 1.6rem;
  border-radius: 6px;
  background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 50%, #e5e7eb 100%);
  background-size: 200% 100%;
  color: transparent;
  animation: ws-monetario-pulse 1.2s ease-in-out infinite;
}

/* ── Informe Monetario: modal detalle (popup Swal) ── */
.ws-monetario-detalle-popup {
  padding: 0 !important;
  border-radius: 12px;
}

.ws-monetario-detalle-popup .swal2-html-container {
  margin: 0;
  padding: 0;
  text-align: left;
}

.ws-monetario-detalle-popup .swal2-close {
  margin: 6px 8px 0 0;
}

.ws-monetario-detalle {
  display: flex;
  flex-direction: column;
  padding: 18px 22px 22px;
  font-size: 0.85rem;
  color: #1f2937;
}

/* ── Informe Monetario: header del detalle ── */
.ws-monetario-detalle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid #eef0f3;
}

.ws-monetario-detalle-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #1f2937;
}

.ws-monetario-detalle-total {
  font-size: 1rem;
  font-weight: 700;
  color: #198754;
  background: #ecfdf5;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #d1fae5;
  white-space: nowrap;
}

/* ── Informe Monetario: contenedor scrollable de secciones ── */
.ws-monetario-detalle-secciones {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

/* ── Informe Monetario: bloque sección categoría ── */
.ws-monetario-detalle-seccion {
  background: #f9fafb;
  border: 1px solid #eef0f3;
  border-radius: 10px;
  padding: 10px 12px 12px;
}

.ws-monetario-detalle-seccion-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid #eef0f3;
}

.ws-monetario-detalle-seccion-header i {
  color: #1a6fc4;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.ws-monetario-detalle-seccion-header h4 {
  margin: 0;
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1f2937;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-monetario-detalle-seccion-subtotal {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1a6fc4;
  white-space: nowrap;
}

/* ── Informe Monetario: tabla del detalle ── */
.ws-monetario-detalle-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.ws-monetario-detalle-tabla thead th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
  color: #6b7280;
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #e5e7eb;
  background: transparent;
}

.ws-monetario-detalle-tabla tbody td {
  padding: 7px 8px;
  border-bottom: 1px solid #f1f3f5;
  color: #374151;
  vertical-align: middle;
}

.ws-monetario-detalle-tabla tbody tr:last-child td {
  border-bottom: none;
}

.ws-monetario-detalle-tabla tbody tr:hover td {
  background: #f3f6fa;
}

.ws-monetario-detalle-tabla thead th:nth-child(2),
.ws-monetario-detalle-tabla thead th:nth-child(3),
.ws-monetario-detalle-tabla thead th:nth-child(4),
.ws-monetario-detalle-tabla tbody td:nth-child(2),
.ws-monetario-detalle-tabla tbody td:nth-child(3),
.ws-monetario-detalle-tabla tbody td:nth-child(4) {
  text-align: right;
  white-space: nowrap;
}

.ws-monetario-detalle-tabla tbody td:nth-child(4) {
  font-weight: 700;
  color: #1f2937;
}

.ws-monetario-detalle-tabla thead th:last-child,
.ws-monetario-detalle-tabla tbody td:last-child {
  width: 36px;
  text-align: center;
}

/* ── Informe Monetario: botón eliminar fila (solo tratamientos) ── */
.ws-monetario-detalle-btn-eliminar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: #dc2626;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.15s, color 0.15s;
}

.ws-monetario-detalle-btn-eliminar:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.ws-monetario-detalle-btn-eliminar:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.25);
}

/* ── Informe Monetario: estado vacío del detalle ── */
.ws-monetario-detalle-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 28px 16px;
  color: #9ca3af;
  text-align: center;
}

.ws-monetario-detalle-empty i {
  font-size: 1.6rem;
}

.ws-monetario-detalle-empty span {
  font-size: 0.85rem;
}

/* ── Informe Monetario: responsive tabla detalle ── */
@media (max-width: 600px) {
  .ws-monetario-detalle {
    padding: 14px 14px 16px;
  }

  .ws-monetario-detalle-header h3 {
    font-size: 0.95rem;
  }

  .ws-monetario-detalle-total {
    font-size: 0.85rem;
    padding: 4px 8px;
  }

  .ws-monetario-detalle-seccion {
    padding: 8px 10px;
  }

  .ws-monetario-detalle-tabla {
    font-size: 0.75rem;
  }

  .ws-monetario-detalle-tabla thead th,
  .ws-monetario-detalle-tabla tbody td {
    padding: 5px 4px;
  }

  .ws-monetario-detalle-tabla thead th {
    font-size: 0.62rem;
    letter-spacing: 0.2px;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   MÓDULO RECETAS — Workspace Clínico
   Paleta: primario #1a6fc4 / hover #145390
           neutros #1f2937 / #374151 / #6b7280 / #9ca3af
           fondos  #f9fafb / #eef0f3
           success #198754 / danger #dc3545 / warning #f59e0b
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Recetas: contenedor lista ──
   overflow visible es necesario para que el dropdown de acciones no quede
   recortado al desplegarse hacia afuera del item.
*/
.ws-recetas-lista {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: visible;
}

/* ── Recetas: empty state ── */
.ws-recetas-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
  color: #9ca3af;
  gap: 10px;
}

.ws-recetas-empty i {
  font-size: 2.4rem;
  color: #d1d5db;
}

.ws-recetas-empty span {
  font-size: 0.88rem;
  color: #6b7280;
  font-weight: 500;
}

/* ── Recetas: item card ── */
.ws-receta-item {
  border: 1px solid #eef0f3;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ws-receta-item:hover {
  border-color: #1a6fc4;
  box-shadow: 0 2px 6px -2px rgba(26, 111, 196, 0.18);
}

/* ── Recetas: header del item ── */
.ws-receta-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.ws-receta-item-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.ws-receta-item-fecha {
  color: #6b7280;
  font-size: 0.68rem;
  font-weight: 500;
}

.ws-receta-item-medico {
  color: #1f2937;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ws-receta-item-medico i {
  color: #1a6fc4;
  font-size: 0.72rem;
}

/* ── Recetas: botón acciones (dots) ── */
.ws-receta-item-acciones {
  flex-shrink: 0;
}

.ws-receta-btn-acciones {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  padding: 0;
}

.ws-receta-btn-acciones:hover,
.ws-receta-btn-acciones:focus {
  background: #f3f4f6;
  color: #1f2937;
  outline: none;
}

.ws-receta-btn-acciones[aria-expanded="true"] {
  background: #f3f4f6;
  color: #1a6fc4;
}

/* ── Recetas: dropdown acciones ── */
.ws-receta-dropdown {
  box-shadow: 0 6px 16px -4px rgba(15, 23, 42, 0.18);
  border: 1px solid #e5e7eb;
  padding: 4px 0;
  font-size: 0.85rem;
  border-radius: 8px;
  min-width: 180px;
}

.ws-receta-dd-item {
  padding: 7px 14px;
  color: #374151;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.12s ease, color 0.12s ease;
}

.ws-receta-dd-item i {
  margin-right: 8px;
  width: 14px;
  text-align: center;
  color: #6b7280;
}

.ws-receta-dd-item:hover,
.ws-receta-dd-item:focus {
  background: #f0f7ff;
  color: #1a6fc4;
  text-decoration: none;
}

.ws-receta-dd-item:hover i,
.ws-receta-dd-item:focus i {
  color: #1a6fc4;
}

.ws-receta-dd-item--danger {
  color: #dc3545;
}

.ws-receta-dd-item--danger i {
  color: #dc3545;
}

.ws-receta-dd-item--danger:hover,
.ws-receta-dd-item--danger:focus {
  background: #fee2e2;
  color: #b91c1c;
}

.ws-receta-dd-item--danger:hover i,
.ws-receta-dd-item--danger:focus i {
  color: #b91c1c;
}

/* ── Recetas: detalle (HTML Quill) ── */
.ws-receta-item-detalle {
  font-size: 0.72rem;
  color: #374151;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.ws-receta-item-detalle p {
  margin: 0 0 4px 0;
}

.ws-receta-item-detalle p:last-child {
  margin-bottom: 0;
}

.ws-receta-item-detalle strong {
  color: #1f2937;
  font-weight: 600;
}

.ws-receta-item-detalle em {
  font-style: italic;
}

.ws-receta-item-detalle u {
  text-decoration: underline;
}

.ws-receta-item-detalle br {
  line-height: 1.45;
}

/* ── Recetas: modal popup override Swal ── */
.ws-receta-modal-popup {
  padding: 0 !important;
  width: 700px !important;
  max-width: 95vw !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

.ws-receta-modal-popup .swal2-html-container {
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
}

/* ── Recetas: modal estructura ── */
.ws-receta-modal {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.ws-receta-modal-cuerpo {
  padding: 16px 20px;
}

.ws-receta-campo {
  margin-bottom: 14px;
}

.ws-receta-campo:last-child {
  margin-bottom: 0;
}

.ws-receta-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

/* ── Recetas: buscador médico (autocomplete custom) ── */
.ws-receta-buscador {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 10px;
  background: #ffffff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ws-receta-buscador:focus-within {
  border-color: #1a6fc4;
  box-shadow: 0 0 0 3px rgba(26, 111, 196, 0.12);
}

.ws-receta-buscador-icono {
  color: #94a3b8;
  font-size: 13px;
  flex-shrink: 0;
}

.ws-receta-buscador-input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 13px;
  height: 38px;
  background: transparent;
  color: #1f2937;
}

.ws-receta-buscador-input::placeholder {
  color: #9ca3af;
}

.ws-receta-buscador-dropdown {
  position: absolute;
  left: -2px;
  right: -2px;
  top: calc(100% + 4px);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  z-index: 10050;
  max-height: 220px;
  overflow-y: auto;
  display: none;
}

.ws-receta-buscador-dropdown.activo,
.ws-receta-buscador-dropdown.visible,
.ws-receta-buscador-dropdown.show {
  display: block;
}

.ws-receta-medico-item {
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.85rem;
  transition: background 0.12s ease;
}

.ws-receta-medico-item:last-child {
  border-bottom: none;
}

.ws-receta-medico-item:hover,
.ws-receta-medico-item.activo {
  background: #eff6ff;
}

.ws-receta-medico-item-nombre {
  font-weight: 600;
  color: #1e293b;
  display: block;
  line-height: 1.25;
}

.ws-receta-medico-item-sub {
  font-size: 0.72rem;
  color: #94a3b8;
  display: block;
  margin-top: 2px;
}

/* ── Recetas: pill médico seleccionado ── */
.ws-receta-medico-seleccionado {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  padding: 4px 10px;
  background: #ecfdf5;
  color: #065f46;
  border-radius: 12px;
  margin-top: 6px;
  font-weight: 500;
}

.ws-receta-medico-seleccionado.activo {
  display: inline-flex;
}

.ws-receta-medico-seleccionado i {
  color: #198754;
  font-size: 0.72rem;
}

/* ── Recetas: editor Quill ── */
.ws-receta-quill-container {
  min-height: 220px;
}

.ws-receta-quill-container .ql-toolbar.ql-snow {
  border: 1px solid #cbd5e1;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  background: #f9fafb;
}

.ws-receta-quill-container .ql-container.ql-snow {
  border: 1px solid #cbd5e1;
  border-top: none;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  background: #ffffff;
}

.ws-receta-quill-container .ql-editor {
  min-height: 180px;
  font-size: 0.92rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1f2937;
  line-height: 1.5;
}

.ws-receta-quill-container .ql-editor.ql-blank::before {
  color: #9ca3af;
  font-style: normal;
  font-size: 0.88rem;
}

/* ── Recetas: pie del modal ── */
.ws-receta-modal-pie {
  padding: 12px 20px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ws-receta-btn-cancelar {
  background: transparent;
  color: #6b7280;
  border: 1px solid #d1d5db;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ws-receta-btn-cancelar:hover,
.ws-receta-btn-cancelar:focus {
  background: #f3f4f6;
  color: #1f2937;
  border-color: #9ca3af;
  outline: none;
}

.ws-receta-btn-guardar {
  background: #1a6fc4;
  color: #ffffff;
  border: 1px solid #1a6fc4;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ws-receta-btn-guardar:hover,
.ws-receta-btn-guardar:focus {
  background: #145390;
  border-color: #145390;
  outline: none;
  box-shadow: 0 2px 6px -1px rgba(20, 83, 144, 0.35);
}

.ws-receta-btn-guardar:disabled,
.ws-receta-btn-guardar[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.ws-receta-btn-guardar i {
  font-size: 0.8rem;
}

/* ── Recetas: responsive ── */
@media (max-width: 600px) {
  .ws-receta-modal-popup {
    width: 95vw !important;
    max-width: 95vw !important;
  }

  .ws-receta-modal-cuerpo {
    padding: 12px 14px;
  }

  .ws-receta-modal-pie {
    padding: 10px 14px;
  }

  .ws-receta-btn-cancelar,
  .ws-receta-btn-guardar {
    padding: 7px 12px;
    font-size: 0.8rem;
  }

  .ws-receta-quill-container {
    min-height: 180px;
  }

  .ws-receta-quill-container .ql-editor {
    min-height: 140px;
    font-size: 0.88rem;
  }

  .ws-recetas-lista {
    max-height: 360px;
    gap: 8px;
  }

  .ws-receta-item {
    padding: 10px;
  }

  .ws-receta-item-fecha {
    font-size: 0.66rem;
  }

  .ws-receta-item-medico {
    font-size: 0.74rem;
  }

  .ws-receta-item-detalle {
    font-size: 0.7rem;
  }

  .ws-receta-btn-acciones {
    width: 28px;
    height: 28px;
  }

  .ws-recetas-empty {
    padding: 24px 12px;
  }

  .ws-recetas-empty i {
    font-size: 2rem;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   MÓDULO TRATAMIENTOS EN CURSO — Workspace Clínico (solo lectura)
   ══════════════════════════════════════════════════════════════════════════ */

.ws-tratamientos-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ws-tratamiento-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  background: #fff;
}

.ws-tratamiento-info {
  flex: 1;
  min-width: 0;
}

.ws-tratamiento-nombre {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-tratamiento-meta {
  font-size: 0.7rem;
  color: #6b7280;
  margin-top: 2px;
}

.ws-tratamiento-progress {
  flex-shrink: 0;
  width: 160px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ws-tratamiento-progress-bar-wrap {
  height: 6px;
  background: #eef0f3;
  border-radius: 999px;
  overflow: hidden;
}

.ws-tratamiento-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #1a6fc4, #198754);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.ws-tratamiento-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.66rem;
  color: #6b7280;
}

.ws-tratamiento-progress-pct {
  font-weight: 600;
  color: #1f2937;
}

.ws-tratamientos-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  gap: 8px;
  color: #9ca3af;
}

.ws-tratamientos-empty i {
  font-size: 1.8rem;
  color: #d1d5db;
}

.ws-tratamientos-empty span {
  font-size: 0.82rem;
  color: #6b7280;
}

@media (max-width: 600px) {
  .ws-tratamiento-item {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .ws-tratamiento-progress {
    width: 100%;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Z-INDEX OVERRIDES (evita superposiciones entre workspace, panel config y Swal)
   - #workspace-clinico: 10000 (definido en configTratamiento.css)
   - #config-tratamiento: 10010 (debe ir SOBRE el workspace cuando se activa)
   - SweetAlert2 container: 10100 (debe ir SOBRE ambos)
   ══════════════════════════════════════════════════════════════════════════ */
#config-tratamiento {
  z-index: 10010 !important;
}

.swal2-container {
  z-index: 10100 !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   ===== Card Insumos + Modal de carga =====
   Estilos para la card "Insumos" del workspace clínico (lista de filas)
   y para su modal Swal NO fullscreen (.ws-insumo-modal-popup).
   Patrón calcado de:
     - Tratamientos en curso   → filas de la card
     - .ws-receta-modal-popup  → estructura del modal Swal y pie
     - .ws-receta-buscador     → autocomplete con dropdown
     - .ct-insumo-item         → mecánica del item buscable
   Reutiliza var(--ct-card-bg) y var(--ct-border) ya declaradas en
   configTratamiento.css (cargado antes del workspace).
   ══════════════════════════════════════════════════════════════════════════ */

/* ── A. Filas de la card "Insumos" ── */
.ws-insumo-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ws-insumo-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  background: var(--ct-card-bg, #fff);
  margin-bottom: 3px;
}

.ws-insumo-fila__nombre {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-insumo-fila__meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 0.7rem;
  color: #6b7280;
  line-height: 1.2;
}

.ws-insumo-fila__meta-cantidad {
  font-weight: 600;
  color: #1f2937;
}

.ws-insumo-fila__acciones {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-insumo-fila__btn-eliminar {
  background: transparent;
  color: #b91c1c;
  border: 1px solid transparent;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ws-insumo-fila__btn-eliminar:hover,
.ws-insumo-fila__btn-eliminar:focus {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
  outline: none;
}

.ws-insumo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  gap: 8px;
  color: #9ca3af;
}

.ws-insumo-empty i {
  font-size: 1.8rem;
  color: #d1d5db;
}

.ws-insumo-empty span {
  font-size: 0.82rem;
  color: #6b7280;
}

/* ── B. Modal Swal (NO fullscreen) ── */
.ws-insumo-modal-popup {
  padding: 0 !important;
  width: 820px !important;
  max-width: 95vw !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

.ws-insumo-modal-popup .swal2-html-container {
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
}

.ws-insumo-modal {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.ws-insumo-modal-cuerpo {
  padding: 16px 20px;
  max-height: 65vh;
  overflow-y: auto;
}

.ws-insumo-campo {
  margin-bottom: 14px;
}

.ws-insumo-campo:last-child {
  margin-bottom: 0;
}

.ws-insumo-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

.ws-insumo-modal-pie {
  padding: 12px 20px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ws-insumo-btn-cancelar {
  background: transparent;
  color: #6b7280;
  border: 1px solid #d1d5db;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ws-insumo-btn-cancelar:hover,
.ws-insumo-btn-cancelar:focus {
  background: #f3f4f6;
  color: #1f2937;
  border-color: #9ca3af;
  outline: none;
}

.ws-insumo-btn-guardar {
  background: #1a6fc4;
  color: #fff;
  border: 1px solid #1a6fc4;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ws-insumo-btn-guardar:hover,
.ws-insumo-btn-guardar:focus {
  background: #145390;
  border-color: #145390;
  outline: none;
  box-shadow: 0 2px 6px -1px rgba(20, 83, 144, 0.35);
}

.ws-insumo-btn-guardar:disabled,
.ws-insumo-btn-guardar[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.ws-insumo-btn-guardar i {
  font-size: 0.8rem;
}

/* ── C. Buscador con dropdown de resultados ── */
.ws-insumo-buscador {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ws-insumo-buscador:focus-within {
  border-color: #1a6fc4;
  box-shadow: 0 0 0 3px rgba(26, 111, 196, 0.12);
}

.ws-insumo-buscador-icono {
  color: #94a3b8;
  font-size: 13px;
  flex-shrink: 0;
}

.ws-insumo-buscador__input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 13px;
  height: 38px;
  background: transparent;
  color: #1f2937;
}

.ws-insumo-buscador__input::placeholder {
  color: #9ca3af;
}

.ws-insumo-buscador__spinner {
  display: none;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border: 2px solid #e5e7eb;
  border-top-color: #1a6fc4;
  border-radius: 50%;
  animation: ws-insumo-spin 0.7s linear infinite;
  pointer-events: none;
}

.ws-insumo-buscador__spinner.activo {
  display: block;
}

@keyframes ws-insumo-spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

.ws-insumo-buscador__dropdown {
  position: absolute;
  left: -2px;
  right: -2px;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  z-index: 10200 !important;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

.ws-insumo-buscador__dropdown.activo,
.ws-insumo-buscador__dropdown.visible,
.ws-insumo-buscador__dropdown.show {
  display: block;
}

.ws-insumo-buscador__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.85rem;
  transition: background 0.12s ease;
}

.ws-insumo-buscador__item:last-child {
  border-bottom: none;
}

.ws-insumo-buscador__item:hover,
.ws-insumo-buscador__item.activo {
  background: #eff6ff;
}

.ws-insumo-buscador__item-nombre {
  font-weight: 600;
  color: #1e293b;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.ws-insumo-buscador__item-saldo {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.ws-insumo-buscador__item-saldo.is-bajo {
  background: #fef3c7;
  color: #92400e;
}

.ws-insumo-buscador__item-saldo.is-cero {
  background: #fee2e2;
  color: #991b1b;
}

.ws-insumo-buscador__vacio {
  padding: 12px 14px;
  color: #94a3b8;
  font-size: 0.82rem;
  text-align: center;
}

/* ── D. Tabla temporal de insumos seleccionados (antes de guardar) ── */
.ws-insumo-seleccionados {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.ws-insumo-seleccionados__fila {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--ct-border, #dee2e6);
  border-radius: 8px;
  background: #fff;
}

.ws-insumo-seleccionados__nombre {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-insumo-seleccionados__input-cantidad {
  flex-shrink: 0;
  width: 90px;
  height: 34px;
  padding: 4px 8px;
  font-size: 0.85rem;
  text-align: right;
  color: #1f2937;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  -moz-appearance: textfield;
}

.ws-insumo-seleccionados__input-cantidad::-webkit-outer-spin-button,
.ws-insumo-seleccionados__input-cantidad::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ws-insumo-seleccionados__input-cantidad:focus {
  border-color: #1a6fc4;
  box-shadow: 0 0 0 3px rgba(26, 111, 196, 0.12);
}

.ws-insumo-seleccionados__input-cantidad.is-invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.12);
}

.ws-insumo-seleccionados__unidad {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: #6b7280;
  min-width: 36px;
}

.ws-insumo-seleccionados__saldo {
  flex-shrink: 0;
  font-size: 0.7rem;
  color: #94a3b8;
  white-space: nowrap;
}

.ws-insumo-seleccionados__btn-quitar {
  flex-shrink: 0;
  background: transparent;
  color: #b91c1c;
  border: 1px solid transparent;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ws-insumo-seleccionados__btn-quitar:hover,
.ws-insumo-seleccionados__btn-quitar:focus {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
  outline: none;
}

.ws-insumo-seleccionados__vacio {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 16px;
  border: 1px dashed #e5e7eb;
  border-radius: 8px;
  background: #fafbfc;
  color: #9ca3af;
  font-size: 0.8rem;
  text-align: center;
}

.ws-insumo-seleccionados__vacio i {
  font-size: 1.4rem;
  color: #d1d5db;
}

/* ── Responsive: hasta ~720px ── */
@media (max-width: 720px) {
  .ws-insumo-modal-popup {
    width: 95vw !important;
    max-width: 95vw !important;
  }

  .ws-insumo-modal-cuerpo {
    padding: 12px 14px;
    max-height: 70vh;
  }

  .ws-insumo-modal-pie {
    padding: 10px 14px;
  }

  .ws-insumo-btn-cancelar,
  .ws-insumo-btn-guardar {
    padding: 8px 12px;
    font-size: 0.82rem;
  }

  .ws-insumo-fila {
    flex-wrap: wrap;
    gap: 8px;
  }

  .ws-insumo-fila__meta {
    align-items: flex-start;
    flex-direction: row;
    gap: 8px;
  }

  .ws-insumo-seleccionados__fila {
    flex-wrap: wrap;
  }

  .ws-insumo-seleccionados__nombre {
    flex-basis: 100%;
    white-space: normal;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   ===== Card Prestaciones Solicitadas + Modal =====
   Estilos para la card "Prestaciones Solicitadas" del workspace clínico
   (lista de filas con badge de estado y botón Validar) y para su modal Swal
   NO fullscreen (.ws-prestacion-modal-popup).
   Patrón calcado del bloque .ws-insumo-* con tres variaciones específicas:
     - Badge de estado pendiente/aplicada por fila.
     - Botón "Validar" compacto (azul) con estado deshabilitado.
     - Border-left coloreado por estado (naranja=pendiente, verde=aplicada).
   Reutiliza var(--ct-card-bg) y var(--ct-border) ya declaradas en
   configTratamiento.css (cargado antes del workspace).
   ══════════════════════════════════════════════════════════════════════════ */

/* ── A. Filas de la card "Prestaciones Solicitadas" ── */
.ws-prestacion-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ws-prestacion-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid #eef0f3;
  border-left: 4px solid #cbd5e1;
  border-radius: 8px;
  background: var(--ct-card-bg, #fff);
  margin-bottom: 3px;
}

.ws-prestacion-fila--pendiente {
  border-left: 4px solid #f59e0b;
}

.ws-prestacion-fila--aplicada {
  border-left: 4px solid #10b981;
}

.ws-prestacion-fila__nombre {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ws-prestacion-fila__codigo {
  font-size: 0.7rem;
  font-weight: 500;
  color: #6b7280;
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.ws-prestacion-fila__meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 0.7rem;
  color: #6b7280;
  line-height: 1.2;
}

.ws-prestacion-fila__meta-precio {
  font-weight: 600;
  color: #1f2937;
}

.ws-prestacion-fila__acciones {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-prestacion-fila__btn-eliminar {
  background: transparent;
  color: #b91c1c;
  border: 1px solid transparent;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ws-prestacion-fila__btn-eliminar:hover,
.ws-prestacion-fila__btn-eliminar:focus {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
  outline: none;
}

/* Badge de estado (NUEVO respecto a ws-insumo-*) */
.ws-prestacion-fila__badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.4;
  background: #f1f5f9;
  color: #475569;
}

.ws-prestacion-fila__badge i {
  font-size: 0.62rem;
}

.ws-prestacion-fila__badge--pendiente {
  background: #fef3c7;
  color: #92400e;
}

.ws-prestacion-fila__badge--aplicada {
  background: #d1fae5;
  color: #065f46;
}

/* Botón Validar compacto (NUEVO respecto a ws-insumo-*) */
.ws-prestacion-fila__btn-validar {
  background: #1a6fc4;
  color: #fff;
  border: 1px solid #1a6fc4;
  border-radius: 6px;
  padding: 4px 10px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.ws-prestacion-fila__btn-validar i {
  font-size: 0.7rem;
}

.ws-prestacion-fila__btn-validar:hover,
.ws-prestacion-fila__btn-validar:focus {
  background: #145390;
  border-color: #145390;
  outline: none;
  box-shadow: 0 2px 6px -1px rgba(20, 83, 144, 0.35);
}

.ws-prestacion-fila__btn-validar:disabled,
.ws-prestacion-fila__btn-validar[disabled],
.ws-prestacion-fila__btn-validar[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.ws-prestacion-fila__btn-validar:disabled:hover,
.ws-prestacion-fila__btn-validar[disabled]:hover,
.ws-prestacion-fila__btn-validar[aria-disabled="true"]:hover {
  background: #1a6fc4;
  border-color: #1a6fc4;
  box-shadow: none;
}

/* ── E. Empty state de la card ── */
.ws-prestacion-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  gap: 8px;
  color: #9ca3af;
}

.ws-prestacion-empty i {
  font-size: 1.8rem;
  color: #d1d5db;
}

.ws-prestacion-empty span {
  font-size: 0.82rem;
  color: #6b7280;
}

/* ── B. Modal Swal (NO fullscreen) ── */
.ws-prestacion-modal-popup {
  padding: 0 !important;
  width: 820px !important;
  max-width: 95vw !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

.ws-prestacion-modal-popup .swal2-html-container {
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
}

.ws-prestacion-modal {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.ws-prestacion-modal-cuerpo {
  padding: 16px 20px;
  max-height: 65vh;
  overflow-y: auto;
}

.ws-prestacion-campo {
  margin-bottom: 14px;
}

.ws-prestacion-campo:last-child {
  margin-bottom: 0;
}

.ws-prestacion-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

.ws-prestacion-modal-pie {
  padding: 12px 20px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ws-prestacion-btn-cancelar {
  background: transparent;
  color: #6b7280;
  border: 1px solid #d1d5db;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ws-prestacion-btn-cancelar:hover,
.ws-prestacion-btn-cancelar:focus {
  background: #f3f4f6;
  color: #1f2937;
  border-color: #9ca3af;
  outline: none;
}

.ws-prestacion-btn-guardar {
  background: #1a6fc4;
  color: #fff;
  border: 1px solid #1a6fc4;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ws-prestacion-btn-guardar:hover,
.ws-prestacion-btn-guardar:focus {
  background: #145390;
  border-color: #145390;
  outline: none;
  box-shadow: 0 2px 6px -1px rgba(20, 83, 144, 0.35);
}

.ws-prestacion-btn-guardar:disabled,
.ws-prestacion-btn-guardar[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.ws-prestacion-btn-guardar i {
  font-size: 0.8rem;
}

/* ── C. Buscador con dropdown de resultados ── */
.ws-prestacion-buscador {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ws-prestacion-buscador:focus-within {
  border-color: #1a6fc4;
  box-shadow: 0 0 0 3px rgba(26, 111, 196, 0.12);
}

.ws-prestacion-buscador-icono {
  color: #94a3b8;
  font-size: 13px;
  flex-shrink: 0;
}

.ws-prestacion-buscador__input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 13px;
  height: 38px;
  background: transparent;
  color: #1f2937;
}

.ws-prestacion-buscador__input::placeholder {
  color: #9ca3af;
}

.ws-prestacion-buscador__spinner {
  display: none;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border: 2px solid #e5e7eb;
  border-top-color: #1a6fc4;
  border-radius: 50%;
  animation: ws-prestacion-spin 0.7s linear infinite;
  pointer-events: none;
}

.ws-prestacion-buscador__spinner.activo {
  display: block;
}

@keyframes ws-prestacion-spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

.ws-prestacion-buscador__dropdown {
  position: absolute;
  left: -2px;
  right: -2px;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  z-index: 10200 !important;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

.ws-prestacion-buscador__dropdown.activo,
.ws-prestacion-buscador__dropdown.visible,
.ws-prestacion-buscador__dropdown.show {
  display: block;
}

.ws-prestacion-buscador__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.85rem;
  transition: background 0.12s ease;
}

.ws-prestacion-buscador__item:last-child {
  border-bottom: none;
}

.ws-prestacion-buscador__item:hover,
.ws-prestacion-buscador__item.activo {
  background: #eff6ff;
}

.ws-prestacion-buscador__item-nombre {
  font-weight: 600;
  color: #1e293b;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.ws-prestacion-buscador__item-precio {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.ws-prestacion-buscador__vacio {
  padding: 12px 14px;
  color: #94a3b8;
  font-size: 0.82rem;
  text-align: center;
}

/* ── D. Tabla temporal de prestaciones seleccionadas (antes de guardar) ── */
.ws-prestacion-seleccionados {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.ws-prestacion-seleccionados__fila {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--ct-border, #dee2e6);
  border-radius: 8px;
  background: #fff;
}

.ws-prestacion-seleccionados__nombre {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-prestacion-seleccionados__input-cantidad {
  flex-shrink: 0;
  width: 90px;
  height: 34px;
  padding: 4px 8px;
  font-size: 0.85rem;
  text-align: right;
  color: #1f2937;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  -moz-appearance: textfield;
}

.ws-prestacion-seleccionados__input-cantidad::-webkit-outer-spin-button,
.ws-prestacion-seleccionados__input-cantidad::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ws-prestacion-seleccionados__input-cantidad:focus {
  border-color: #1a6fc4;
  box-shadow: 0 0 0 3px rgba(26, 111, 196, 0.12);
}

.ws-prestacion-seleccionados__input-cantidad.is-invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.12);
}

.ws-prestacion-seleccionados__precio {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.ws-prestacion-seleccionados__btn-quitar {
  flex-shrink: 0;
  background: transparent;
  color: #b91c1c;
  border: 1px solid transparent;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ws-prestacion-seleccionados__btn-quitar:hover,
.ws-prestacion-seleccionados__btn-quitar:focus {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
  outline: none;
}

.ws-prestacion-seleccionados__vacio {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 16px;
  border: 1px dashed #e5e7eb;
  border-radius: 8px;
  background: #fafbfc;
  color: #9ca3af;
  font-size: 0.8rem;
  text-align: center;
}

.ws-prestacion-seleccionados__vacio i {
  font-size: 1.4rem;
  color: #d1d5db;
}

/* ── F. Responsive: hasta ~720px ── */
@media (max-width: 720px) {
  .ws-prestacion-modal-popup {
    width: 95vw !important;
    max-width: 95vw !important;
  }

  .ws-prestacion-modal-cuerpo {
    padding: 12px 14px;
    max-height: 70vh;
  }

  .ws-prestacion-modal-pie {
    padding: 10px 14px;
  }

  .ws-prestacion-btn-cancelar,
  .ws-prestacion-btn-guardar {
    padding: 8px 12px;
    font-size: 0.82rem;
  }

  .ws-prestacion-fila {
    flex-wrap: wrap;
    gap: 8px;
  }

  .ws-prestacion-fila__meta {
    align-items: flex-start;
    flex-direction: row;
    gap: 8px;
  }

  .ws-prestacion-fila__acciones {
    flex-wrap: wrap;
  }

  .ws-prestacion-seleccionados__fila {
    flex-wrap: wrap;
  }

  .ws-prestacion-seleccionados__nombre {
    flex-basis: 100%;
    white-space: normal;
  }
}

/* ─────────────────────────────────────────────────────────────────────
   Swal "Selecciona el profesional que aplicó" — overflow visible para
   que el dropdown del buscador (.ws-insumo-buscador__dropdown) no sea
   recortado por el redondeo del popup ni por .swal2-html-container.
   ───────────────────────────────────────────────────────────────────── */
.ws-validar-medico-popup {
  overflow: visible !important;
}

.ws-validar-medico-popup .swal2-html-container {
  overflow: visible !important;
}

/* ════════════════════════════════════════════════════════════════════
   WORKSPACE EXÁMENES  (.ws-examenes-*)
   Lista de exámenes hospitalizados + modal "Agregar exámenes".
   Reusa convenciones de ws-insumo-* y ws-receta-buscador-*.
   ════════════════════════════════════════════════════════════════════ */

/* ── A. Estado vacío / loading / error ── */
.ws-examenes-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  gap: 8px;
  color: #94a3b8;
  text-align: center;
}

.ws-examenes-empty i {
  font-size: 2rem;
  color: #cbd5e1;
}

.ws-examenes-empty span {
  font-size: 0.82rem;
  color: #6b7280;
}

/* ── B. Alerta "pendientes en otras áreas" ── */
.ws-examenes-alerta {
  background: #fff8e1;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.ws-examenes-alerta-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #9a3412;
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.ws-examenes-alerta-header i {
  color: #f59e0b;
  font-size: 0.9rem;
}

.ws-examenes-alerta-tabla {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
  background: transparent;
}

.ws-examenes-alerta-tabla th,
.ws-examenes-alerta-tabla td {
  padding: 4px 6px;
  text-align: left;
  border: none;
  color: #1f2937;
}

.ws-examenes-alerta-tabla th {
  font-weight: 600;
  color: #92400e;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ── C. Categorías de exámenes (LAB INTERNO, IMÁGENES, etc.) ── */
.ws-examenes-categoria {
  margin-bottom: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.ws-examenes-categoria:last-child {
  margin-bottom: 0;
}

.ws-examenes-categoria-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.ws-examenes-categoria-titulo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #1f2937;
  font-size: 14px;
}

.ws-examenes-categoria-titulo i {
  color: #1a6fc4;
  font-size: 13px;
}

.ws-examenes-categoria-badge {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ws-examenes-categoria-items {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ── D. Items individuales ── */
.ws-examenes-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
}

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

.ws-examenes-item-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

.ws-examenes-item-codigo {
  display: inline-block;
  background: #e2e8f0;
  color: #475569;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  width: fit-content;
}

.ws-examenes-item-nombre {
  font-weight: 500;
  color: #1f2937;
  font-size: 13.5px;
}

.ws-examenes-item-meta {
  font-size: 11.5px;
  color: #9ca3af;
}

.ws-examenes-item-acciones {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* ── E. Badges de estado ── */
.ws-examenes-estado-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #f1f5f9;
  color: #475569;
}

.ws-examenes-estado-badge--pendiente {
  background: #fef3c7;
  color: #92400e;
}

.ws-examenes-estado-badge--en_revision {
  background: #dbeafe;
  color: #1e40af;
}

.ws-examenes-estado-badge--cargado {
  background: #f1f5f9;
  color: #475569;
}

.ws-examenes-estado-badge--aprobado {
  background: #d1fae5;
  color: #065f46;
}

.ws-examenes-estado-badge--rechazado {
  background: #fee2e2;
  color: #991b1b;
}

.ws-examenes-estado-badge--observado {
  background: #fed7aa;
  color: #9a3412;
}

/* ── F. Botón eliminar item ── */
.ws-examenes-btn-eliminar {
  background: transparent;
  color: #b91c1c;
  border: 1px solid transparent;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ws-examenes-btn-eliminar:hover,
.ws-examenes-btn-eliminar:focus {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
  outline: none;
}

/* ── G. Sección "Exámenes Adicionales" (visualmente más tenue) ── */
.ws-examenes-adicionales {
  margin-top: 14px;
  opacity: 0.92;
}

.ws-examenes-adicionales .ws-examenes-categoria-header {
  background: #f1f5f9;
}

.ws-examenes-adicionales .ws-examenes-categoria-titulo {
  color: #475569;
}

/* ── H. Modal Swal "Agregar exámenes" ── */
.ws-examenes-modal-popup {
  padding: 0 !important;
  width: 760px !important;
  max-width: 95vw !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

.ws-examenes-modal-popup .swal2-html-container {
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
}

.ws-examenes-modal {
  width: 100%;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.ws-examenes-modal-cuerpo {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 20px;
  max-height: 65vh;
  overflow-y: auto;
}

.ws-examenes-modal-pie {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
  margin-top: 16px;
  border-top: 1px solid #e2e8f0;
  padding: 12px 20px;
  background: #f9fafb;
}

.ws-examenes-modal-campo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.ws-examenes-modal-campo:last-child {
  margin-bottom: 0;
}

.ws-examenes-modal-label {
  font-weight: 600;
  color: #374151;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── I. Select de categoría ── */
.ws-examenes-select-categoria {
  height: 38px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
  background: #fff;
  color: #1f2937;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ws-examenes-select-categoria:focus {
  border-color: #1a6fc4;
  box-shadow: 0 0 0 3px rgba(26, 111, 196, 0.12);
}

/* ── J. Buscador con dropdown (calcado de ws-insumo-buscador__*) ── */
.ws-examenes-buscador {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 10px 0 36px;
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ws-examenes-buscador:focus-within {
  border-color: #1a6fc4;
  box-shadow: 0 0 0 3px rgba(26, 111, 196, 0.12);
}

.ws-examenes-buscador-icono {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 13px;
  pointer-events: none;
}

.ws-examenes-buscador-input {
  border: none;
  outline: none;
  flex: 1;
  height: 36px;
  background: transparent;
  font-size: 14px;
  color: #1f2937;
}

.ws-examenes-buscador-input::placeholder {
  color: #9ca3af;
}

.ws-examenes-buscador-input:disabled {
  cursor: not-allowed;
  color: #9ca3af;
}

.ws-examenes-buscador-spinner {
  display: none;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border: 2px solid #e5e7eb;
  border-top-color: #1a6fc4;
  border-radius: 50%;
  animation: ws-examenes-spin 0.7s linear infinite;
  pointer-events: none;
}

.ws-examenes-buscador-spinner.activo {
  display: block;
}

@keyframes ws-examenes-spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

.ws-examenes-buscador-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 10050;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  display: none;
}

.ws-examenes-buscador-dropdown.activo,
.ws-examenes-buscador-dropdown.visible,
.ws-examenes-buscador-dropdown.show {
  display: block;
}

.ws-examenes-buscador-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13.5px;
  color: #1f2937;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.12s ease;
}

.ws-examenes-buscador-item:last-child {
  border-bottom: none;
}

.ws-examenes-buscador-item:hover,
.ws-examenes-buscador-item.activo {
  background: #e0f2fe;
}

.ws-examenes-buscador-item-nombre {
  font-weight: 500;
  color: #1f2937;
}

.ws-examenes-buscador-item-codigo {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  color: #94a3b8;
  margin-left: 6px;
}

.ws-examenes-buscador-vacio {
  padding: 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  font-style: italic;
}

/* ── K. Acumulador (exámenes seleccionados antes de guardar) ── */
.ws-examenes-seleccionados {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  min-height: 60px;
  max-height: 220px;
  overflow-y: auto;
  background: #fafbfc;
}

.ws-examenes-seleccionados-vacio {
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  padding: 14px;
}

.ws-examenes-seleccionados-fila {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #f1f5f9;
  border-radius: 6px;
  margin-bottom: 4px;
}

.ws-examenes-seleccionados-fila:last-child {
  margin-bottom: 0;
}

.ws-examenes-seleccionados-nombre {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: #1f2937;
}

.ws-examenes-seleccionados-codigo {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  color: #94a3b8;
  background: #e2e8f0;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.ws-examenes-seleccionados-btn-quitar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #dc3545;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.78rem;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.ws-examenes-seleccionados-btn-quitar:hover,
.ws-examenes-seleccionados-btn-quitar:focus {
  background: #fee2e2;
  color: #991b1b;
  outline: none;
}

/* ── L. Botones del modal ── */
.ws-examenes-btn-cancelar {
  padding: 8px 16px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ws-examenes-btn-cancelar:hover,
.ws-examenes-btn-cancelar:focus {
  background: #f1f5f9;
  color: #1f2937;
  outline: none;
}

.ws-examenes-btn-guardar {
  padding: 8px 18px;
  background: #1a6fc4;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.ws-examenes-btn-guardar:hover,
.ws-examenes-btn-guardar:focus {
  background: #155a9f;
  outline: none;
  box-shadow: 0 2px 6px -1px rgba(20, 83, 144, 0.35);
}

.ws-examenes-btn-guardar:disabled,
.ws-examenes-btn-guardar[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── M. Responsive ── */
@media (max-width: 720px) {
  .ws-examenes-modal-popup {
    width: 95vw !important;
    max-width: 95vw !important;
  }

  .ws-examenes-modal-cuerpo {
    padding: 12px 14px;
    max-height: 70vh;
  }

  .ws-examenes-modal-pie {
    padding: 10px 14px;
  }

  .ws-examenes-btn-cancelar,
  .ws-examenes-btn-guardar {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .ws-examenes-item {
    flex-wrap: wrap;
  }
}