/* ===================================
   CONFIG TRATAMIENTO — FULLSCREEN
   =================================== */

/* Buscador de insumo custom */
.ct-insumo-item:hover,
.ct-insumo-item.activo {
  background: #eff6ff;
}

.ct-insumo-item:last-child {
  border-bottom: none !important;
}

:root {
  --ct-primary: #1a6fc4;
  --ct-success: #198754;
  --ct-danger: #dc3545;
  --ct-warning: #f0ad4e;
  --ct-muted: #6c757d;
  --ct-bg: #f4f6f9;
  --ct-card-bg: #ffffff;
  --ct-header: #1c2a3a;
  --ct-border: #dee2e6;
}

/* SweetAlert2 debe quedar sobre el panel fullscreen */
.swal2-container {
  z-index: 10001 !important;
}

/* ── Panel principal ─────────────────────────────────────────────────────── */
#config-tratamiento {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: var(--ct-bg);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

#config-tratamiento.ct-activo {
  transform: translateY(0);
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.ct-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--ct-header);
  color: #fff;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.ct-header-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.ct-header-paciente {
  font-size: 13px;
  opacity: 0.85;
  white-space: nowrap;
}

.ct-header-peso {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ct-spacer {
  flex: 1;
}

.ct-btn-cerrar {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.ct-btn-cerrar:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ── Cuerpo scrollable ───────────────────────────────────────────────────── */
.ct-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Tarjeta genérica ────────────────────────────────────────────────────── */
.ct-card {
  background: var(--ct-card-bg);
  border: 1px solid var(--ct-border);
  border-radius: 8px;
  padding: 16px;
}

.ct-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ct-muted);
  margin-bottom: 12px;
}

/* ── Ficha del insumo seleccionado ───────────────────────────────────────── */
#ct-ficha-insumo {
  display: none;
  background: #eef4ff;
  border: 1px solid #bcd0f7;
  border-radius: 6px;
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 13px;
}

.ct-ficha-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.ct-ficha-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ct-ficha-label {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ct-muted);
}

.ct-ficha-valor {
  font-size: 13px;
  font-weight: 600;
  color: #1c2a3a;
}

.ct-badge-multidosis {
  display: inline-block;
  background: #d1ecf1;
  color: #0c5460;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
}

/* ── Toggle tipo dosis ───────────────────────────────────────────────────── */
.ct-toggle-dosis {
  display: flex;
  gap: 0;
  border: 1px solid var(--ct-primary);
  border-radius: 6px;
  overflow: hidden;
  width: fit-content;
  margin-bottom: 14px;
}

.ct-toggle-dosis input[type="radio"] {
  display: none;
}

.ct-toggle-dosis label {
  padding: 6px 18px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ct-primary);
  background: #fff;
  transition:
    background 0.15s,
    color 0.15s;
  margin: 0;
  user-select: none;
}

.ct-toggle-dosis input[type="radio"]:checked+label {
  background: var(--ct-primary);
  color: #fff;
}

/* ── Cálculo en tiempo real ──────────────────────────────────────────────── */
#ct-calculo-box {
  background: #fffbea;
  border: 1px solid #ffe082;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  margin-top: 8px;
  display: none;
}

.ct-calculo-formula {
  color: #5f4400;
  font-weight: 500;
}

.ct-calculo-resultado {
  font-size: 15px;
  font-weight: 700;
  color: #1c7a1c;
  margin-top: 4px;
}

/* ── Grid formulario ─────────────────────────────────────────────────────── */
.ct-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.ct-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ct-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ct-muted);
}

.ct-input {
  border: 1px solid var(--ct-border);
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 13px;
  width: 100%;
  background: #fff;
  transition: border-color 0.15s;
}

.ct-input:focus {
  outline: none;
  border-color: var(--ct-primary);
  box-shadow: 0 0 0 2px rgba(26, 111, 196, 0.12);
}

.ct-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  margin-top: 8px;
}

/* ── Botón guardar ───────────────────────────────────────────────────────── */
.ct-btn-guardar {
  background: var(--ct-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s,
    opacity 0.2s;
  margin-top: 12px;
}

.ct-btn-guardar:hover {
  background: #155a9e;
}

.ct-btn-guardar:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ct-btn-limpiar {
  background: #fff;
  color: var(--ct-muted);
  border: 1px solid var(--ct-border);
  border-radius: 6px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.ct-btn-limpiar:hover {
  background: #f0f4fa;
  color: #1c2a3a;
}

/* ── Divisor entre zonas ─────────────────────────────────────────────────── */
.ct-divisor {
  border: none;
  border-top: 2px solid var(--ct-border);
  margin: 0;
}

/* ── Calendario horizontal de tratamientos ───────────────────────────────── */
.ct-cal-wrap {
  overflow-x: auto;
  overflow-y: visible;
  border-radius: 7px;
  border: 1px solid var(--ct-border);
}

.ct-cal-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 500px;
}

.ct-cal-tabla thead tr {
  background: #f0f4fa;
  position: sticky;
  top: 0;
  z-index: 2;
}

.ct-cal-th-nombre {
  padding: 7px 12px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--ct-muted);
  text-align: left;
  white-space: nowrap;
  min-width: 160px;
  border-bottom: 2px solid var(--ct-border);
  border-right: 2px solid var(--ct-border);
  position: sticky;
  left: 0;
  background: #f0f4fa;
  z-index: 1;
}

.ct-cal-th-fecha {
  padding: 6px 8px;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  min-width: 64px;
  border-bottom: 2px solid var(--ct-border);
  border-right: 1px solid var(--ct-border);
  line-height: 1.3;
  color: #1c2a3a;
}

.ct-cal-th-fecha.ct-cal-hoy,
.ct-cal-td.ct-cal-hoy {
  background: #fffbea;
  border-left: 2px solid #f0ad4e;
  border-right: 2px solid #f0ad4e;
}

.ct-cal-th-fecha.ct-cal-hoy {
  color: #856404;
  border-bottom: 2px solid #f0ad4e;
}

.ct-cal-td-nombre {
  padding: 8px 12px;
  border-bottom: 1px solid var(--ct-border);
  border-right: 2px solid var(--ct-border);
  vertical-align: middle;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
}

.ct-cal-nombre {
  font-weight: 600;
  color: #1c2a3a;
  font-size: 12px;
  white-space: nowrap;
}

.ct-cal-meta {
  font-size: 10px;
  color: var(--ct-muted);
  margin-top: 2px;
}

.ct-cal-td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--ct-border);
  border-right: 1px solid var(--ct-border);
  vertical-align: top;
  text-align: center;
}

.ct-cal-app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 600;
  margin: 1px;
  white-space: nowrap;
}

.ct-cal-app.aplicado {
  background: #d4edda;
  color: #155724;
}

.ct-cal-app.sin_aplicar {
  background: #fff3cd;
  color: #856404;
}

.ct-cal-app.anulado {
  background: #f8d7da;
  color: #721c24;
  text-decoration: line-through;
}

/* Fila alterna */
.ct-cal-tabla tbody tr:nth-child(even) .ct-cal-td-nombre,
.ct-cal-tabla tbody tr:nth-child(even) .ct-cal-td {
  background: #fafbfc;
}

/* ── Tabla tratamientos (zona inferior) ──────────────────────────────────── */
.ct-tabla-titulo {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ct-muted);
  margin-bottom: 10px;
}

.ct-trat-item {
  background: var(--ct-card-bg);
  border: 1px solid var(--ct-border);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.ct-trat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: #f0f4fa;
  font-size: 13px;
  font-weight: 600;
  flex-wrap: wrap;
}

.ct-trat-nombre {
  flex: 1;
  min-width: 150px;
}

.ct-trat-meta {
  font-size: 11px;
  color: var(--ct-muted);
  font-weight: 400;
}

.ct-planilla-wrap {
  padding: 8px 14px 10px;
  overflow-x: auto;
}

.ct-planilla-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ct-planilla-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  border-radius: 5px;
  padding: 4px 7px;
  font-size: 10px;
  min-width: 68px;
  border: 1px solid transparent;
}

.ct-planilla-chip.aplicado {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.ct-planilla-chip.sin_aplicar {
  background: #fff3cd;
  border-color: #ffeeba;
  color: #856404;
}

.ct-planilla-chip.anulado {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
  text-decoration: line-through;
}

.ct-chip-fecha {
  font-weight: 700;
  font-size: 10px;
}

.ct-chip-hora {
  font-size: 9px;
  opacity: 0.8;
}

.ct-chip-estado {
  font-size: 9px;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 2px;
}

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.ct-spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  gap: 10px;
  color: var(--ct-muted);
  font-size: 14px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 576px) {
  .ct-form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ct-header-paciente {
    width: 100%;
    order: 3;
  }

  .ct-body {
    padding: 10px;
  }

  .ct-card {
    padding: 12px;
  }
}

@media (min-width: 1200px) {
  .ct-body {
    padding-left: 5rem;
    padding-right: 5rem;
    margin: 0 auto;
    width: 100%;
  }
}

@media (min-width: 1600px) {
  .ct-body {
    padding-left: 10rem;
    padding-right: 10rem;
  }
}

@media (min-width: 1920px) {
  .ct-body {
    padding-left: 16rem;
    padding-right: 16rem;
  }
}

/* ===================================
   LISTA PACIENTES HOSPITALIZADOS
   =================================== */

/* Wrapper principal */
#pantallaHospitalizados {
  background: var(--ct-bg);
  min-height: 100%;
}

/* ── Header de pantalla ─────────────────────────────────────────────────── */
.lp-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: var(--ct-header);
  color: #fff;
  border-radius: 10px;
  margin: 10px 14px 0;
  box-shadow: 0 2px 6px rgba(28, 42, 58, 0.08);
}

.lp-header-titulo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lp-header-titulo>i {
  font-size: 22px;
  color: #5fb3ff;
}

.lp-header-h5 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
}

.lp-header-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 600;
}

.lp-header-sub>#lp-contador-pacientes {
  color: #ffd866;
  font-weight: 700;
}

/* ── Toolbar ────────────────────────────────────────────────────────────── */
.lp-toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 12px 14px 0;
  background: var(--ct-card-bg);
  border: 1px solid var(--ct-border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(28, 42, 58, 0.04);
  flex-wrap: wrap;
}

.lp-btn-visor {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ct-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s;
  white-space: nowrap;
}

.lp-btn-visor:hover {
  background: #155a9e;
  transform: translateY(-1px);
}

.lp-btn-visor>i {
  font-size: 14px;
}

.lp-btn-refrescar {
  background: #fff;
  color: var(--ct-muted);
  border: 1px solid var(--ct-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  margin-left: auto;
}

.lp-btn-refrescar:hover {
  background: #f0f4fa;
  color: var(--ct-primary);
  border-color: var(--ct-primary);
}

/* ── Buscador ───────────────────────────────────────────────────────────── */
.lp-buscador-wrap {
  position: relative;
  flex: 1 1 240px;
  max-width: 360px;
  min-width: 200px;
}

.lp-buscador-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--ct-muted);
  font-size: 13px;
  pointer-events: none;
}

.lp-buscador {
  width: 100%;
  border: 1px solid var(--ct-border);
  border-radius: 8px;
  padding: 8px 12px 8px 34px;
  font-size: 13px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.lp-buscador:focus {
  outline: none;
  border-color: var(--ct-primary);
  box-shadow: 0 0 0 3px rgba(26, 111, 196, 0.12);
}

/* ── Filtros (chips) ────────────────────────────────────────────────────── */
.lp-filtros {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.lp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: var(--ct-muted);
  border: 1px solid var(--ct-border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
}

.lp-chip>i {
  font-size: 11px;
}

.lp-chip:hover {
  background: #f0f4fa;
  color: #1c2a3a;
  border-color: #c5d3e3;
}

.lp-chip.activo {
  background: var(--ct-header);
  color: #fff;
  border-color: var(--ct-header);
}

.lp-chip.activo.lp-chip-ADMITIDO {
  background: #6f42c1;
  border-color: #6f42c1;
}

.lp-chip.activo.lp-chip-EN_TRATAMIENTO {
  background: #b8860b;
  border-color: #b8860b;
}

.lp-chip.activo.lp-chip-EN_PABELLON {
  background: #d2691e;
  border-color: #d2691e;
}

/* ── Main ───────────────────────────────────────────────────────────────── */
.lp-main {
  padding: 12px 14px 28px;
}

/* ── Grid de cards ──────────────────────────────────────────────────────── */
.lp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}

/* ── Card ───────────────────────────────────────────────────────────────── */
.lp-card {
  background: var(--ct-card-bg);
  border: 1px solid var(--ct-border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(28, 42, 58, 0.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.lp-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(28, 42, 58, 0.12);
  border-color: #c5d3e3;
}

/* Header de card (estado + acciones) */
.lp-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--ct-header);
  color: #fff;
  flex-wrap: wrap;
}

.lp-card-header .lp-mascota-icono {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}

.lp-card-titulo-grupo {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lp-mascota-nombre {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #fff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lp-mascota-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}

/* Estado badge */
.lp-estado-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.lp-estado-badge.lp-estado-ADMITIDO {
  background: #ede4ff;
  color: #4a2a8f;
  border-color: #d4c2f7;
}

.lp-estado-badge.lp-estado-EN_TRATAMIENTO {
  background: #fff3cd;
  color: #856404;
  border-color: #ffeeba;
}

.lp-estado-badge.lp-estado-EN_PABELLON {
  background: #ffe1c7;
  color: #8a3b00;
  border-color: #ffc99a;
}

.lp-estado-badge.lp-estado-DE_ALTA {
  background: #e5e7ea;
  color: #495057;
  border-color: #ced4da;
}

/* Tag de cirugía */
.lp-cirugia-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fef0f0;
  color: #b02a37;
  border: 1px solid #f5c2c7;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 600;
  margin: 2px 4px 0 0;
}

.lp-cirugia-tag>i {
  font-size: 9px;
}

.lp-cirugia-lista {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 12px 0;
}

/* Body de card */
.lp-card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.lp-mascota-bloque {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lp-peso-badge {
  display: inline-flex;
  align-items: center;
  background: #eef4ff;
  color: var(--ct-primary);
  border: 1px solid #bcd0f7;
  border-radius: 12px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* Bloque tutor */
.lp-tutor-bloque {
  background: #fafbfc;
  border: 1px solid var(--ct-border);
  border-radius: 7px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.lp-tutor-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ct-muted);
}

.lp-tutor-nombre {
  font-size: 13px;
  font-weight: 600;
  color: #1c2a3a;
  margin: 0;
}

.lp-tutor-contacto {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--ct-muted);
}

.lp-tutor-contacto>span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lp-tutor-contacto i {
  font-size: 10px;
}

.lp-tutores-mas {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #d1ecf1;
  color: #0c5460;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 700;
  margin-top: 3px;
  cursor: pointer;
  width: fit-content;
}

/* Filas info (ficha, ubicacion, ingreso, medico) */
.lp-info-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ct-muted);
  line-height: 1.4;
}

.lp-info-row i {
  width: 14px;
  text-align: center;
  font-size: 11px;
  color: #8fa0b3;
  flex-shrink: 0;
}

.lp-info-row strong {
  color: #1c2a3a;
  font-weight: 600;
}

.lp-info-row .lp-info-label {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ct-muted);
  letter-spacing: 0.4px;
  margin-right: 2px;
}

.lp-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}

/* Acciones (dropdown) */
.lp-card-acciones-wrap {
  position: relative;
  margin-left: auto;
}

.lp-btn-acciones {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.lp-btn-acciones:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lp-acciones-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--ct-border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(28, 42, 58, 0.18);
  padding: 4px 0;
  z-index: 100;
  display: none;
}

.lp-acciones-menu.abierto {
  display: block;
}

.lp-acciones-menu button,
.lp-acciones-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  padding: 7px 14px;
  font-size: 12px;
  color: #1c2a3a;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.lp-acciones-menu button:hover,
.lp-acciones-menu a:hover {
  background: #eef4ff;
  color: var(--ct-primary);
}

.lp-acciones-menu button>i,
.lp-acciones-menu a>i {
  width: 16px;
  font-size: 12px;
  color: var(--ct-muted);
}

.lp-acciones-menu button.lp-accion-peligro:hover,
.lp-acciones-menu a.lp-accion-peligro:hover {
  background: #fef0f0;
  color: var(--ct-danger);
}

.lp-acciones-menu .lp-acciones-sep {
  border-top: 1px solid var(--ct-border);
  margin: 4px 0;
}

/* ── Estado vacío ───────────────────────────────────────────────────────── */
.lp-vacio {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
  background: var(--ct-card-bg);
  border: 1px dashed var(--ct-border);
  border-radius: 10px;
  text-align: center;
  color: var(--ct-muted);
}

.lp-vacio-icon {
  font-size: 56px;
  color: #c5d3e3;
  margin-bottom: 12px;
}

.lp-vacio-titulo {
  font-size: 15px;
  font-weight: 700;
  color: #1c2a3a;
  margin: 0 0 4px;
}

.lp-vacio-texto {
  font-size: 13px;
  color: var(--ct-muted);
  margin: 0;
}

/* ── Responsivo ─────────────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
  .lp-grid {
    grid-template-columns: 1fr;
  }

  .lp-toolbar {
    gap: 8px;
    padding: 10px;
  }

  .lp-btn-refrescar {
    margin-left: 0;
  }

  .lp-buscador-wrap {
    max-width: 100%;
    flex: 1 1 100%;
  }

  .lp-filtros {
    width: 100%;
  }

  .lp-header-bar {
    margin: 8px 10px 0;
    padding: 10px 12px;
  }

  .lp-main {
    padding: 10px;
  }

  .lp-info-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 992px) {
  .lp-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1400px) {
  .lp-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1800px) {
  .lp-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   — Vista tabla —
   Refactor de cards a tabla densa responsiva. Mantiene tokens y comparte clases
   con la vista de cards (badges, cirugia, acciones-menu) para reutilizacion.
   ───────────────────────────────────────────────────────────────────────────── */

/* Wrapper de tabla */
.lp-tabla-wrap {
  background: var(--ct-card-bg);
  border: 1px solid var(--ct-border);
  border-radius: 10px;
  margin: 12px 14px;
  box-shadow: 0 1px 3px rgba(28, 42, 58, 0.04);
}

/* Tabla base */
.lp-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--ct-card-bg);
}

.lp-tabla thead {
  color: #fff;
}

.lp-tabla thead th {
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
  text-align: left;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
  background: var(--ct-header);
  position: sticky;
  /* Bajo la toolbar sticky (~60px de alto) */
  top: 60px;
  z-index: 10;
}

.lp-tabla thead th:first-child {
  border-top-left-radius: 9px;
}

.lp-tabla thead th:last-child {
  border-top-right-radius: 9px;
}

.lp-tabla tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--ct-border);
  vertical-align: top;
  color: #1c2a3a;
}

.lp-tabla tbody tr:hover td {
  background: #f4f8ff;
}

.lp-tabla tbody tr:last-child td {
  border-bottom: none;
}

/* Anchos de columnas (escritorio) */
.lp-col-acciones {
  width: 44px;
  text-align: center;
}

.lp-col-estado {
  width: 180px;
}

.lp-col-paciente {
  width: auto;
}

.lp-col-ficha {
  width: 90px;
  text-align: center;
}

.lp-col-medico {
  width: 160px;
}

.lp-col-ubicacion {
  width: 180px;
}

.lp-col-ingreso {
  width: 140px;
}

/* Celdas de contenido */
.lp-celda-estado>*+* {
  margin-top: 4px;
}

.lp-paciente-nombre {
  font-size: 15px;
  font-weight: 700;
  color: #1c2a3a;
}

.lp-paciente-meta {
  font-size: 11px;
  color: var(--ct-muted);
}

.lp-paciente-tutor {
  font-size: 12px;
  color: #2b3b52;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lp-paciente-tutor>i.fa-user,
.lp-paciente-tutor>i.fas.fa-user {
  font-size: 10px;
  color: var(--ct-muted);
}

.lp-paciente-contacto {
  font-size: 11px;
  color: var(--ct-muted);
  line-height: 1.4;
}

.lp-paciente-tutores-extra {
  margin-top: 4px;
}

.lp-celda-ficha {
  font-weight: 600;
  font-size: 13px;
  color: #1c2a3a;
  text-align: center;
}

.lp-celda-medico {
  font-size: 12px;
  color: #2b3b52;
}


.lp-ubic-hospital {
  font-weight: 600;
  color: var(--ct-primary);
  font-size: 13px;
}

.lp-ubic-jaula {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #eef4ff;
  color: #1c2a3a;
  font-size: 11px;
  font-weight: 600;
  width: fit-content;
}


.lp-ing-fecha {
  font-weight: 600;
  font-size: 13px;
  color: #1c2a3a;
}

.lp-ing-hora {
  font-size: 11px;
  color: var(--ct-muted);
}

/* Refuerzo de borde por estado (lectura rapida) */
.lp-tabla tbody tr[data-estado="ADMITIDO"] {
  border-left: 3px solid #b59ad8;
}

.lp-tabla tbody tr[data-estado="EN_TRATAMIENTO"] {
  border-left: 3px solid #f0ad4e;
}

.lp-tabla tbody tr[data-estado="EN_PABELLON"] {
  border-left: 3px solid #fd7e14;
}

/* Boton de acciones dentro de la tabla (override del estilo de cards) */
.lp-tabla .lp-btn-acciones {
  background: transparent;
  color: var(--ct-muted);
  border: 1px solid var(--ct-border);
  width: 32px;
  height: 32px;
}

.lp-tabla .lp-btn-acciones:hover {
  background: #eef4ff;
  color: var(--ct-primary);
}

.lp-tabla .lp-card-acciones-wrap {
  position: relative;
}

.lp-tabla .lp-acciones-menu {
  min-width: 240px;
  max-height: 380px;
  overflow-y: auto;
}

.lp-link-ficha {
  color: var(--ct-primary);
  font-weight: 600;
  text-decoration: none;
}

.lp-link-ficha i {
  font-size: 9px;
  margin-left: 3px;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.lp-link-ficha:hover {
  text-decoration: underline;
}

.lp-link-ficha:hover i {
  opacity: 1;
}

/* Responsive */
@media (max-width: 1199px) {

  .lp-tabla .lp-col-medico,
  .lp-tabla td.lp-celda-medico {
    display: none;
  }
}

@media (max-width: 991px) {

  .lp-tabla .lp-col-ficha,
  .lp-tabla td.lp-celda-ficha {
    display: none;
  }
}

@media (max-width: 767px) {

  .lp-acciones-menu {
    left: auto;
    right: 0;
  }

  /* Modo tabla colapsada: filas como mini-cards */
  .lp-tabla-wrap {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }

  .lp-tabla,
  .lp-tabla tbody,
  .lp-tabla tr,
  .lp-tabla td {
    display: block;
    width: 100%;
  }

  .lp-tabla thead {
    display: none;
  }

  .lp-tabla tbody tr {
    position: relative;
    background: var(--ct-card-bg);
    border: 1px solid var(--ct-border);
    border-radius: 10px;
    margin-bottom: 12px;
    padding: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }

  .lp-tabla tbody tr:hover td {
    background: transparent;
  }

  .lp-tabla tbody td {
    padding: 6px 0;
    border-bottom: none;
  }

  .lp-tabla tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ct-muted);
    margin-bottom: 2px;
  }

  /* La celda de acciones flota arriba a la derecha */
  .lp-tabla td.lp-celda-acciones {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0;
    width: auto;
  }

  .lp-tabla td.lp-celda-acciones::before {
    display: none;
  }
}

/* ===================================
   WORKSPACE CLÍNICO (multi-pestañas)
   =================================== */

/* ── Contenedor fullscreen ─────────────────────────────────────────────── */
#workspace-clinico {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: var(--ct-bg);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#workspace-clinico.ws-activo {
  transform: translateY(0);
}

/* ── Header ────────────────────────────────────────────────────────────── */
.ws-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: var(--ct-header);
  color: #fff;
  flex-shrink: 0;
  min-height: 52px;
}

.ws-titulo {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
  padding: 12px 0;
}

.ws-spacer {
  flex: 1;
}

.ws-btn-cerrar {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.ws-btn-cerrar:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ── Barra de pestañas (Material underline) ───────────────────────────── */
.ws-tabs-wrap {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.ws-tabs-wrap::-webkit-scrollbar {
  display: none;
}

.ws-tabs {
  display: flex;
  gap: 0;
  align-items: stretch;
  height: 52px;
}

.ws-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  user-select: none;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
}

.ws-tab:hover {
  color: rgba(255, 255, 255, 0.9);
}

.ws-tab.activa {
  color: #fff;
  border-bottom-color: #5b9eef;
}

.ws-tab .ws-tab-estado-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.ws-tab .ws-tab-estado-dot.estado-ADMITIDO {
  background: #b59ad8;
}

.ws-tab .ws-tab-estado-dot.estado-EN_TRATAMIENTO {
  background: #f0ad4e;
}

.ws-tab .ws-tab-estado-dot.estado-EN_PABELLON {
  background: #fd7e14;
}

.ws-tab .ws-tab-cerrar {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  padding: 0 2px;
  cursor: pointer;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.ws-tab .ws-tab-cerrar:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}

/* ── Flechas de scroll ─────────────────────────────────────────────────── */
.ws-scroll-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.ws-scroll-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.ws-scroll-btn[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Body ──────────────────────────────────────────────────────────────── */
.ws-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--ct-bg);
}

.ws-body-inner {
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Ficha resumen del paciente activo ────────────────────────────────── */
.ws-ficha {
  background: var(--ct-card-bg);
  border: 1px solid var(--ct-border);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(28, 42, 58, 0.04);
}

.ws-ficha-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ct-border);
  margin-bottom: 16px;
}

.ws-ficha-icono {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #eef4ff;
  color: var(--ct-primary);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ws-ficha-titulo {
  flex: 1;
  min-width: 0;
}

.ws-ficha-nombre {
  font-size: 22px;
  font-weight: 700;
  color: #1c2a3a;
  margin: 0;
}

.ws-ficha-sub {
  font-size: 13px;
  color: var(--ct-muted);
  margin-top: 2px;
}

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

.ws-ficha-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ws-ficha-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ct-muted);
}

.ws-ficha-valor {
  font-size: 14px;
  font-weight: 600;
  color: #1c2a3a;
}

.ws-placeholder {
  margin-top: 24px;
  padding: 32px;
  background: #f0f4fa;
  border: 2px dashed var(--ct-border);
  border-radius: 10px;
  text-align: center;
  color: var(--ct-muted);
  font-size: 13px;
}

/* ── Estado vacío ──────────────────────────────────────────────────────── */
.ws-vacio {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--ct-muted);
}

.ws-vacio-icon {
  font-size: 64px;
  color: #c5d3e3;
  margin-bottom: 14px;
}

.ws-vacio-texto {
  font-size: 14px;
  color: var(--ct-muted);
  margin: 0;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .ws-tabs-wrap {
    max-width: none;
  }

  .ws-titulo {
    font-size: 13px;
  }

  .ws-titulo .ws-titulo-texto {
    display: none;
  }

  .ws-body {
    padding: 12px;
  }

  .ws-ficha {
    padding: 16px;
  }

  .ws-ficha-grid {
    grid-template-columns: 1fr;
  }
}