:root {
  --sidebar-width: 250px;
  --sidebar-bg: #1E3A5F;
  --sidebar-hover: #2E86AB;
  --accent: #2E86AB;
  --accent-light: #e8f4fd;
}

/* ── Sidebar ──────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  position: sticky;
  top: 0;
  background: var(--sidebar-bg);
  transition: width .25s ease;
  flex-shrink: 0;
  overflow-y: auto;
}
#sidebar.collapsed { width: 0; overflow: hidden; }

.sidebar-link {
  color: rgba(255,255,255,.8) !important;
  border-radius: 8px;
  padding: .45rem .75rem;
  transition: background .2s, color .2s;
  font-size: .9rem;
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(255,255,255,.15) !important;
  color: #fff !important;
}
.sidebar-link.active { font-weight: 600; }

.sidebar-header { background: rgba(0,0,0,.2); }

.avatar-sm {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
  flex-shrink: 0;
}

/* ── Page content ────────────────────────────────────── */
#page-content-wrapper { min-width: 0; }

/* ── Cards ───────────────────────────────────────────── */
.stat-card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.12); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}

/* ── Auth pages ──────────────────────────────────────── */
.bg-gradient-primary { background: linear-gradient(135deg, #1E3A5F 0%, #2E86AB 100%); }

.auth-card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.auth-logo {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1E3A5F, #2E86AB);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
}

/* ── Tables ──────────────────────────────────────────── */
.table-hover tbody tr:hover { background: var(--accent-light); }

/* ── Botones de reporte (Mis Pacientes): ancho completo en celular,
   compactos a la derecha en pantallas medianas/grandes ──────────── */
.botones-reporte { width: 100%; }
@media (min-width: 768px) {
  .botones-reporte { width: auto; }
}

/* ── Controles de simple-datatables (selector "por página" + buscador) ── */
.datatable-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .9rem 1rem .5rem;
}
.datatable-dropdown label,
.datatable-search label {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
  font-size: .85rem;
  color: #6c757d;
}
.datatable-selector {
  border: 1px solid #ced4da;
  border-radius: 6px;
  padding: .3rem .5rem;
  font-size: .85rem;
}
.datatable-input {
  border: 1px solid #ced4da;
  border-radius: 6px;
  padding: .4rem .7rem;
  font-size: .9rem;
  min-width: 200px;
}
@media (max-width: 576px) {
  .datatable-top {
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
  }
  .datatable-dropdown, .datatable-search { width: 100%; }
  .datatable-search label { width: 100%; }
  .datatable-input { width: 100%; min-width: 0; }
}

#tablaPacientes thead th,
#tablaSinAsignar thead th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .02em;
}
#tablaPacientes tbody td,
#tablaSinAsignar tbody td {
  font-size: .85rem;
}

/* En celular: columnas más angostas y uniformes, el nombre se trunca en vez
   de estirar la tabla (N° Orden, Servicio, N° Cama, Apellidos y Nombres) */
@media (max-width: 576px) {
  #tablaPacientes thead th,
  #tablaSinAsignar thead th {
    font-size: .62rem;
    white-space: nowrap;
    padding-left: .4rem;
    padding-right: .4rem;
  }
  #tablaPacientes tbody td,
  #tablaSinAsignar tbody td {
    font-size: .78rem;
    padding-left: .4rem;
    padding-right: .4rem;
  }
  #tablaPacientes td a,
  #tablaSinAsignar td:nth-child(5) {
    display: inline-block;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
  }
}

/* ── Survey form ─────────────────────────────────────── */
.section-card {
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
}
.question-item { border-bottom: 1px solid #f0f0f0; }
.question-item:last-child { border-bottom: none; }
.required-star { color: #dc3545; }

.subseccion-datos-referencia {
  background: #fff4e5;
  color: #92400e;
  border-left: 4px solid #f0ad4e;
}
.subseccion-microbiologia {
  background: var(--accent-light);
  color: var(--sidebar-bg);
  border-left: 4px solid var(--accent);
}

.paso-numero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
}

/* Controles más grandes y táctiles, mismo tamaño en celular y PC */
.survey-input,
#inputServicio, #inputCama {
  min-height: 46px;
  font-size: 1rem;
  padding: .55rem .8rem;
}
textarea.survey-input { min-height: 90px; }

.section-card .card-body { padding: 1.1rem 1.25rem; }
@media (max-width: 576px) {
  .section-card .card-body { padding: 1rem; }
}

/* Barra de acciones siempre visible al fondo, accesible en celular */
.barra-acciones-encuesta {
  position: sticky;
  bottom: 0;
  z-index: 60;
  box-shadow: 0 -4px 14px rgba(0,0,0,.1);
}

/* ── Etiquetas y valores uniformes en toda la encuesta ──── */
.label-campo {
  display: block;
  color: var(--accent);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: .2rem;
}
.valor-campo {
  font-size: .95rem;
  font-weight: 600;
  color: #222;
}
.valor-campo-input {
  font-size: .95rem;
  font-weight: 600;
}

/* ── Radios y checkboxes más visibles ───────────────────── */
.form-check-input {
  width: 1.25em;
  height: 1.25em;
  margin-top: .15em;
  border: 2px solid #adb5bd;
  cursor: pointer;
}
.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}
.form-check-input:focus {
  box-shadow: 0 0 0 .2rem rgba(46, 134, 171, .25);
  border-color: var(--accent);
}
.form-check-label { cursor: pointer; padding-left: .15rem; }

.is-invalid { border-color: #dc3545 !important; }

/* ── Progress bar ────────────────────────────────────── */
.progress { height: 8px; border-radius: 4px; }

/* ── Badges ──────────────────────────────────────────── */
.badge-status-completada  { background: #d1fae5; color: #065f46; }
.badge-status-pendiente   { background: #fef3c7; color: #92400e; }
.badge-status-en_progreso { background: #dbeafe; color: #1e40af; }

/* ── Tooltips (color de la app en vez del negro por defecto) ────── */
.tooltip {
  --bs-tooltip-bg: var(--sidebar-bg);
  --bs-tooltip-color: #fff;
}
.tooltip .tooltip-inner {
  background-color: var(--sidebar-bg);
  color: #fff;
  font-size: .8rem;
  padding: .45rem .75rem;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

/* ── Utilities ───────────────────────────────────────── */
.border-white-20 { border-color: rgba(255,255,255,.2) !important; }
.text-primary-dark { color: var(--sidebar-bg); }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: #1e6f8f; border-color: #1e6f8f; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { position: fixed; z-index: 1040; height: 100vh; height: 100dvh; top: 0; }
  #sidebar.collapsed { width: 0; }
  #page-content-wrapper { margin-left: 0 !important; }
  .overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1039;
  }
  .overlay.show { display: block; }
}

/* ── Sticky survey progress ──────────────────────────── */
#survey-progress-bar { position: sticky; top: 0; z-index: 100; }
