/* Fuente y suavizado */
:root {
  --brand: #0d6efd;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #0b1220;
  --muted: #6b7280;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --card: #121a2b;
    --text: #eef2ff;
    --muted: #9aa3b2;
  }
}
html, body {
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.navbar, .offcanvas, .modal-content {
  border-radius: 0 !important;
}
.card {
  background: var(--card);
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(9, 17, 33, .08);
}
.card-title { margin-bottom: .25rem; }
.kpi-chip {
  background: var(--card);
  border-radius: 20px;
  padding: .75rem 1rem;
  display: flex; align-items: center; gap: .5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.kpi-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--brand); display: inline-block; }

/* Bottom Nav tipo tabs */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030;
  background: var(--card);
  border-top: 1px solid rgba(0,0,0,.06);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: .35rem .5rem; gap: .25rem;
}
.bottom-nav a {
  text-decoration: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  font-size: .78rem; padding: .35rem .25rem; border-radius: 12px;
}
.bottom-nav a.active { color: var(--brand); background: rgba(13,110,253,.08); }
.bottom-spacer { height: 68px; } /* espacio para que el contenido no quede detrás */

/* FAB */
.fab {
  position: fixed; right: 16px; bottom: 84px; z-index: 1030;
  width: 56px; height: 56px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; background: var(--brand);
  box-shadow: 0 10px 24px rgba(13,110,253,.4);
  border: none;
}

/* Inputs más touch-friendly */
.form-control, .form-select, .btn { border-radius: 12px; }
.form-section-title { font-size: .85rem; color: var(--muted); margin-top: .25rem; margin-bottom: .5rem; }

/* Barra fija de acciones en formularios */
.sticky-actions {
  position: sticky; bottom: 0; background: var(--bg);
  padding: .75rem; border-top: 1px solid rgba(0,0,0,.08);
}

/* Tablas -> responsive cards estilo móvil (en pantallas pequeñas) */
@media (max-width: 768px) {
  table.table { display: none; }
  .mobile-list .mcard {
    background: var(--card); border-radius: var(--radius); padding: .9rem; margin-bottom: .75rem;
    box-shadow: 0 6px 24px rgba(9, 17, 33, .08);
  }
  .mrow { display: flex; justify-content: space-between; gap: .5rem; margin: .15rem 0; }
  .mkey { color: var(--muted); font-size: .85rem; }
  .mval { font-weight: 600; }
}
/* ======== TABLAS CEBRA MODERNAS ======== */

.table-zebra {
  border-collapse: separate !important;
  border-spacing: 0 4px !important;
  font-size: 0.85rem;
}

/* Encabezado */
.table-zebra thead tr th {
  background: #0d6efd;
  color: #ffffff;
  border: none !important;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.4px;
  padding: 10px 12px;
}

/* Filas base */
.table-zebra tbody tr {
  background: #ffffff;
}

/* Cebra: filas pares con fondo suave */
.table-zebra tbody tr:nth-child(even) td {
  background: #f5f8ff !important;  /* azul muy clarito */
}

.table-zebra tbody tr:nth-child(odd) td {
  background: #ffffff !important;
}

/* Hover suave */
.table-zebra tbody tr:hover td {
  background: #e0edff !important;
}

/* Celdas */
.table-zebra tbody tr td {
  border: none !important;
  padding: 8px 10px;
  vertical-align: middle;
}

/* Bordes redondeados por fila (izquierda/derecha) */
.table-zebra tbody tr td:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.table-zebra tbody tr td:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}
/* Acciones en tabla escritorio: siempre en una línea */
.table-actions {
  display: flex !important;
  flex-direction: row !important;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;     /* espacio entre botones */
}

/* Quita márgenes de formularios inline */
.table-actions form {
  margin: 0;
}

/* Botones compactos */
.table-actions .btn {
  padding: 4px 8px;
  font-size: 0.75rem;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

/* Mantiene el modal centrado correctamente */
.modal-dialog {
  margin: 1.75rem auto;   /* margen vertical estándar de Bootstrap */
  max-width: 500px;       /* tamaño elegante */
}

/* Redondeo limpio y sin halo blanco */
.modal-content {
  border-radius: 16px !important;
  overflow: hidden !important;       /* elimina borde blanco invisible */
  border: none !important;           /* sin borde */
  background-clip: padding-box !important;
}

/* Fondo detrás del modal (backdrop) */
.modal {
  background: rgba(0, 0, 0, 0.4) !important;
}

/* Opcional: Edición responsive */
@media (max-width: 576px) {
  .modal-dialog {
    margin: 1rem auto;
    max-width: 95%;
  }
}
/* CARD de ranking: control puntual */
  .card-ranking {
    overflow: hidden;
  }

  .card-ranking .card-body {
    padding: 0.75rem 1rem;
  }

  .ranking-row {
    padding: 0.4rem 0.25rem;
    border-radius: 0.5rem;
    overflow: hidden;          /* Nada se sale del row */
  }

  .ranking-row + .ranking-row {
    margin-top: 0.35rem;
  }

  .rank-badge {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .85rem;
  }

  .ranking-middle {
    flex: 1 1 auto;
    min-width: 0;              /* clave para que truncate funcione */
  }



  .ranking-progress {
    height: 6px;
    width: 100%;
    max-width: 100%;
  }

  @media (max-width: 420px) {
    .card-ranking .card-body {
      padding: 0.75rem 0.75rem;
    }
    .rank-badge {
      width: 26px;
      height: 26px;
      min-width: 26px;
      min-height: 26px;
      font-size: .75rem;
    }
  }

/* Evita overflow horizontal del card */
.hospital-block {
  min-width: 0;        /* Clave para evitar desbordes */
}

/* hospital-name acepta 2 líneas */
.hospital-name {
  white-space: normal !important;
  line-height: 1.1;
}

/* Control estricto de la barra dentro del card */
.hospital-progress {
  height: 6px;
  max-width: 100%;
  overflow: hidden;
}

/* Mobile layout */
@media (max-width: 576px) {
  .hospital-name {
    font-size: 0.85rem;
  }
}

/* Botones homogéneos en la barra superior */
.btn-topbar {
  border-radius: 999px;
  padding-inline: 0.9rem;
  padding-block: 0.25rem;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 32px;
}

/* Avatar redondo estilo Material */
.topbar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #0d6efd;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
}

/* Ajuste dropdown más moderno */
.navbar .dropdown-menu {
  border-radius: 12px;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
  border: none;
}
.navbar .dropdown-item {
  font-size: 0.9rem;
}
.navbar .dropdown-header {
  font-size: 0.8rem;
}

/* Cuando el dropdown está abierto, oscurecer rol */
.dropdown.show .user-role,
.dropdown.show .user-name {
  color: #212529 !important;   /* color oscuro */
}
/* Cuando el dropdown está abierto, avatar oscuro */
.dropdown.show .topbar-avatar {
  background: #212529 !important;   /* oscuro */
  color: #212529 !important;           /* letra blanca */
  transition: all .15s ease-in-out;
}



@media (max-width: 768px) {
  table.table.calendar-table-mobile {
    display: table !important;
  }
}
@media (max-width: 768px) {
  .mobile-list table.table { 
    display: none;
  }
}

.modal-content table.table { display: table !important; }



/* CUADROS DEL CALENDARIO MÓVIL */
.calendar-table-mobile td.day-box {
  height: 55px;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  vertical-align: top;
  text-align: left;
  padding: 6px !important;
  font-size: 0.85rem;
  font-weight: 600;
}

.calendar-table-mobile td.day-box.empty {
  background: transparent !important;
  cursor: default;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
  margin-right: 4px;
}

/* Leyenda organizada en columnas flexibles */
.legend-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding-top: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text);
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  margin-right: 6px;
  flex-shrink: 0;
}

/* Resaltar el día de hoy en el calendario */
.calendar-table td.day-today {
  box-shadow: 0 0 0 2px #ffc107 inset;
}

.calendar-table-mobile td.day-box.today {
  outline: 2px solid #ffc107;
  outline-offset: -2px;
}


