/* ============================================================
   QAD Calidad — Topbar
   Barra superior, botón de usuario/dropdown, panel de
   notificaciones. No declarar aquí estilos del sidebar — ver
   sidebar.css.
   ============================================================ */

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.5rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-subtle);
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  height: var(--topbar-height);
}

.btn-icon {
  padding: 0.4375rem;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.btn-icon:hover { background: var(--color-bg); color: var(--color-text); }

.topbar-title { font-size: 0.9375rem; font-weight: 600; color: var(--color-text); }

.selected-org-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
  max-width: 28rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
}
.selected-org-pill span {
  color: var(--color-text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.selected-org-pill strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
}

.consultant-mode-pill {
  margin-left: 0.75rem;
  font-size: 0.72rem;
  background: var(--color-navy);
  color: var(--color-text-faint);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.consultant-mode-pill .dot {
  width: 6px;
  height: 6px;
  background: var(--color-success);
  border-radius: 50%;
  display: inline-block;
}

/* ─── Notificaciones ─────────────────────────────────────────── */
.notif-bell-wrap { position: relative; margin-right: 0.5rem; }
.notif-badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
}
.notif-badge-count .count {
  background: var(--color-danger);
  color: var(--color-surface);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: var(--radius-pill);
  display: inline-block;
  min-width: 14px;
  text-align: center;
}
.notif-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 360px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  z-index: var(--z-dropdown);
  overflow: hidden;
  max-height: 480px;
  overflow-y: auto;
}
.notif-panel-loading { padding: 1rem; text-align: center; color: var(--color-text-faint); font-size: 0.83rem; }

.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--color-danger);
  border: 2px solid var(--color-surface);
}

/* ─── Botón/menú de usuario en el topbar ─────────────────────── */
.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.625rem 0.3rem 0.3rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}
.topbar-user-btn:hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(46,92,138,0.08);
}
.topbar-user-btn .user-avatar { width: 1.75rem; height: 1.75rem; font-size: 0.7rem; }
.topbar-user-btn .user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-body);
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-user-btn svg { width: 0.875rem; height: 0.875rem; color: var(--color-text-faint); stroke-width: 2.5; }

.topbar-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  min-width: 14rem;
  z-index: var(--z-dropdown);
  overflow: hidden;
  animation: modal-in 0.15s ease;
}
.topbar-dropdown-header { padding: 0.875rem 1rem; border-bottom: 1px solid var(--color-border-row); }
.topbar-dropdown-header .name { font-weight: 600; font-size: 0.875rem; color: var(--color-text); }
.topbar-dropdown-header .email { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 1px; }
.topbar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  color: var(--color-text-body);
  transition: background 0.15s;
}
.topbar-dropdown-item:hover { background: var(--color-bg); }
.topbar-dropdown-item.danger:hover { background: var(--color-danger-bg); color: var(--color-danger-text); }
.topbar-dropdown-item svg { width: 1rem; height: 1rem; flex-shrink: 0; color: var(--color-text-faint); stroke-width: 1.75; }
.topbar-dropdown-divider { border: none; border-top: 1px solid var(--color-border-row); margin: 0.125rem 0; }
