/* =========================================
   TOP BAR — user menu (who you are, your status, your account)
   ========================================= */

.tb-menu {
  width: 300px;
  padding: 8px;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(33, 37, 41, 0.18);
}

.tb-perfil {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 14px;
  border-bottom: 1px solid #f0ebe7;
}

.tb-avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 50%;
  background: #f3f1ef;
}

.tb-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tb-perfil-texto {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tb-perfil-texto strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: #212529;
}

.tb-perfil-texto small {
  overflow: hidden;
  font-size: 0.8rem;
  color: #5c636a;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tb-menu .pr-selector {
  padding: 10px 2px;
}

.tb-links {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  border-bottom: 1px solid #f0ebe7;
}

.tb-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  color: #212529 !important;
  font-size: 0.9rem;
  text-decoration: none !important;
}

.tb-link .lucide-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #5c636a;
}

.tb-link:hover {
  background: #f6f2ef;
}

.tb-link:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: -2px;
}

.tb-salir {
  padding-top: 8px;
}

.tb-link-salir,
.tb-link-salir .lucide-icon {
  color: #a52834 !important;
}

.tb-link-salir:hover {
  background: rgba(220, 53, 69, 0.07);
}

@media (max-width: 575.98px) {
  .tb-menu {
    width: min(300px, calc(100vw - 24px));
  }
}

/* =========================================
   Top bar buttons: no white outlines on the red bar; a soft fill only on hover/focus
   ========================================= */

.main-header .user-btn {
  gap: 2px;
  padding: 4px 12px 4px 4px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.main-header .user-btn:hover,
.main-header .user-btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.18);
}

.main-header .user-btn:focus-visible,
.main-header .bell-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.main-header .user-avatar-container {
  border: 0;
  background-color: rgba(255, 255, 255, 0.22);
}

.main-header .user-avatar-container:hover {
  transform: none;
}

.main-header .bell-btn {
  border: 0;
  background: rgba(255, 255, 255, 0.08);
}

.main-header .bell-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Chat panel shortcut: same round button as the bell, but a link */
.main-header .tb-chat,
.main-header .tb-chat:hover,
.main-header .tb-chat:focus {
  color: #fff;
  text-decoration: none;
}

/* Shortcut card (mini-systems such as reportes) */
.main-header .tb-accesos { position: relative; }

.main-header .tb-accesos-card {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 1050;
  width: 300px;
  padding: 14px;
  border-radius: 14px;
  background: #fff;
  color: #212529;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  animation: tbAccesosEntrar 0.2s ease-out;
}

.main-header .tb-accesos-card[hidden] { display: none; }

@keyframes tbAccesosEntrar {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.main-header .tb-accesos-titulo {
  margin: 0 0 10px;
  color: #6c757d;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.main-header .tb-accesos-grilla {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.main-header .tb-acceso {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  color: #212529;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.main-header .tb-acceso:hover { border-color: #dee2e6; background: #f8f9fa; color: #212529; }

.main-header .tb-acceso:focus-visible { outline: 2px solid var(--primary-blue, #c4442a); outline-offset: 2px; }

.main-header .tb-acceso-icono {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #f8ebe7;
  color: var(--primary-blue, #c4442a);
}

@media (max-width: 575.98px) {
  .main-header .tb-accesos { position: static; }

  .main-header .tb-accesos-card {
    position: fixed;
    top: 64px;
    left: 12px;
    right: 12px;
    width: auto;
  }
}

/* Visible tooltip (data-tip) for the shortcut button and tiles: shows on hover and keyboard focus */
.main-header .tb-tip { position: relative; }

.main-header .tb-tip::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 1060;
  width: max-content;
  max-width: 220px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #1c1c1e;
  color: #fff;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.main-header .tb-tip:hover::after,
.main-header .tb-tip:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: 0.25s;
}

/* No tooltip on the button while its card is open */
.main-header .tb-tip[aria-expanded="true"]::after { display: none; }

/* Phones: keep the avatar, smaller logo and buttons so nothing gets squeezed */
@media (max-width: 575.98px) {
  .main-header .header-content { padding: 0 10px; }
  .main-header .brand-icon { width: auto; height: 30px; }
  .main-header .header-actions { gap: 6px; }
  .main-header .bell-btn { width: 40px; height: 40px; }
  .main-header .user-btn { padding: 3px; }
  .main-header .user-btn > .lucide-icon { display: none; }
  .main-header .pr-avatar { margin-right: 0; }

  .main-header .user-avatar-container {
    display: flex;
    width: 36px;
    height: 36px;
    margin-right: 0;
  }

  /* Tooltips near the right edge open toward the left */
  .main-header .tb-tip::after { left: auto; right: 0; transform: translateY(-4px); }
  .main-header .tb-tip:hover::after,
  .main-header .tb-tip:focus-visible::after { transform: none; }
  .main-header .tb-acceso.tb-tip::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .main-header .tb-accesos-card { animation: none; }
  .main-header .tb-tip::after { transition: none; }
}
