/* =====================================================================
   Eikove.App · Shell móvil global (barra inferior de 5 destinos)
   ---------------------------------------------------------------------
   Se carga ANTES de angosto.css: la capa angosta sigue siendo la última.
   Solo se muestra en pantallas <= 768 px. En escritorio manda la
   navegación propia de cada panel.
   ===================================================================== */
:root {
  --alto-shell: 62px;
  --shell-fondo: color-mix(in srgb, var(--tarjeta, #ffffff) 96%, transparent);
  --shell-borde: var(--borde, #e3e9f2);
  --shell-texto: var(--suave, #6b7a90);
  --shell-activo: var(--texto, #ef7878);
  --shell-acento: var(--oro, #ef7878);
  --z-contenido: 1;
  --z-sticky: 20;
  --z-cab: 90;
  --z-barra: 100;
  --z-cajon: 400;
  --z-dock: 450;
  --z-hoja: 500;
  --z-aviso: 1000;
}

.tb-shell {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-barra);
  display: none;
  background: var(--shell-fondo);
  border-top: 1px solid var(--shell-borde);
  box-shadow: 0 -6px 22px rgba(239, 120, 120, .10);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateZ(0);
}

.tb-shell-in {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  height: var(--alto-shell);
  max-width: 560px;
  margin: 0 auto;
  padding: 0 4px;
}

.tb-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 44px;
  padding: 8px 2px 7px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--shell-texto);
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .01em;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tb-slot .tb-ico {
  position: relative;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
}
.tb-slot .tb-ico svg { width: 23px; height: 23px; display: block; }
.tb-slot .tb-txt { line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tb-slot.activo { color: var(--shell-activo); }
.tb-slot.activo .tb-ico svg { stroke-width: 2.1; }
.tb-slot.activo::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 35%;
  right: 35%;
  height: 2px;
  border-radius: 0 0 3px 3px;
  background: var(--shell-acento);
}
.tb-slot:focus-visible { outline: 2px solid var(--azul-3, #c94a4a); outline-offset: -2px; }

.tb-slot .tb-nb {
  position: absolute;
  top: 1px;
  right: calc(50% - 19px);
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: #c62828;
  color: #fff;
  font-size: 10px;
  line-height: 17px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}
.tb-slot .tb-nb[hidden] { display: none; }

/* Reserva de espacio para que la barra no tape el final del contenido */
@media (max-width: 768px) {
  .tb-shell { display: block; }
  body.tb-con-shell {
    padding-bottom: calc(var(--alto-shell) + env(safe-area-inset-bottom) + 10px) !important;
  }
  /* Toasts por encima de la barra, nunca debajo */
  body.tb-con-shell #toasts,
  body.tb-con-shell #contenedor-notificaciones-popups {
    bottom: calc(var(--alto-shell) + env(safe-area-inset-bottom) + 12px);
  }
}

/* Tema oscuro */
html[data-tema="oscuro"] .tb-shell {
  --shell-fondo: rgba(18, 27, 41, .97);
  --shell-borde: #26364e;
  --shell-texto: #93a4bb;
  --shell-activo: #e8eef8;
}

/* Pastilla EN VIVO de la cabecera (reemplaza el botón flotante) */
.tb-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(229, 57, 53, .35);
  background: rgba(229, 57, 53, .10);
  color: #b3261e;
  font: inherit;
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: .04em;
  cursor: pointer;
}
.tb-live-pill[hidden] { display: none !important; }
.tb-live-pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e53935;
  box-shadow: 0 0 0 0 rgba(229, 57, 53, .55);
  animation: tb-pulso 1.8s ease-out infinite;
}
html[data-tema="oscuro"] .tb-live-pill { color: #ff8b86; border-color: rgba(255, 139, 134, .4); }
@keyframes tb-pulso {
  0% { box-shadow: 0 0 0 0 rgba(229, 57, 53, .55); }
  70% { box-shadow: 0 0 0 7px rgba(229, 57, 53, 0); }
  100% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .tb-live-pill::before { animation: none; }
}

/* Botón de ayuda en cabecera (reemplaza el SOS flotante) */
.tb-sos-cab {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--borde, #d6deea);
  background: transparent;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.tb-sos-cab:hover { background: rgba(239, 120, 120, .06); }
.tb-sos-cab:focus-visible { outline: 2px solid var(--azul-3, #c94a4a); outline-offset: 2px; }

/* Hoja de creación (+) */
.tb-hoja-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}
.tb-hoja-tabs::-webkit-scrollbar { display: none; }
.tb-hoja-tab {
  flex: none;
  min-height: 38px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--borde, #d6deea);
  background: var(--tarjeta, #fff);
  color: var(--texto, #142033);
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}
.modal .tb-hoja-tabs .tb-hoja-tab {
  background: transparent;
  border-color: var(--borde, #d6deea);
  color: var(--texto, #142033);
}
.modal .tb-hoja-tabs .tb-hoja-tab.activa {
  background: #ef7878;
  border-color: #ef7878;
  color: #fff;
}
.tb-hoja-lista { display: grid; gap: 8px; }
/* El atributo hidden debe ganarle al display:grid de la lista (los paneles por
   rol conviven en la hoja y sólo se ve el de la pestaña activa). */
.tb-hoja-lista[hidden] { display: none; }
.tb-hoja-opcion {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 11px 13px;
  border: 1px solid var(--borde, #d6deea);
  border-radius: 14px;
  background: var(--tarjeta, #fff);
  color: var(--texto, #142033);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.tb-hoja-opcion:hover { border-color: var(--azul-3, #c94a4a); }
.tb-hoja-opcion .tb-hoja-ico {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: var(--azul-claro, #e7eef8);
  font-size: 19px;
}
.tb-hoja-opcion b { display: block; font-size: 14px; }
.tb-hoja-opcion small { display: block; margin-top: 1px; color: var(--suave, #5b6b82); font-size: 11.5px; line-height: 1.35; }
.tb-hoja-opcion.destacada { border-color: var(--oro, #ef7878); box-shadow: 0 0 0 3px rgba(239, 120, 120, .12) inset; }
.tb-hoja-opcion.destacada .tb-hoja-ico { background: var(--aviso-claro, #fff4dc); }
.tb-hoja-nota { margin: 10px 0 0; color: var(--suave, #5b6b82); font-size: 11.5px; line-height: 1.4; }

/* Botón de ayuda sobre la cabecera azul marino */
.superapp-header .tb-sos-cab { color: #fff; border-color: rgba(255, 255, 255, .38); }
.superapp-header .tb-sos-cab:hover { background: rgba(255, 255, 255, .14); }

/* Avisos abiertos en el lugar (fuera del muro) */
.tb-avisos-velo { position: fixed; inset: 0; z-index: 1290; background: rgba(0, 0, 0, .55); }
.tb-avisos-hoja {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1300; max-height: 82vh; display: flex; flex-direction: column;
  background: var(--tarjeta, #fff); color: var(--texto, #1a1a1a); border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .4);
  animation: tbAvisosSube .24s cubic-bezier(.3, .9, .3, 1);
}
@keyframes tbAvisosSube { from { transform: translateY(100%); } to { transform: none; } }
.tb-avisos-hoja header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; border-bottom: 1px solid rgba(128, 128, 128, .25); font-size: 16px; }
.tb-avisos-x { width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(128, 128, 128, .18); color: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.tb-avisos-lista { overflow-y: auto; overscroll-behavior: contain; padding: 10px 12px calc(14px + env(safe-area-inset-bottom)); display: grid; gap: 8px; align-content: start; }
.tb-aviso { display: block; padding: 10px 12px; border: 1px solid rgba(128, 128, 128, .3); border-radius: 10px; color: inherit; text-decoration: none; }
.tb-aviso.nuevo { border-color: #ef7878; background: rgba(239, 120, 120, .12); }
.tb-aviso b { font-size: 12.5px; }
.tb-aviso p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.tb-aviso small, .tb-avisos-vacio { color: rgba(128, 128, 128, .95); font-size: 12px; }
.tb-avisos-vacio { text-align: center; padding: 18px 0; font-size: 14px; }
body.tb-avisos-abierto { overflow: hidden; }
@media (min-width: 769px) { .tb-avisos-hoja { left: 50%; right: auto; width: 460px; transform: translateX(-50%); border-radius: 18px; bottom: 24px; animation: none; } }
