/* ═══════════════════════════════════════════════════════════════════
   Topbar global compartilhado entre todos os apps do painel.
   Injetado em <header id="rr-topbar"></header> via /js/topbar.js.
   ═══════════════════════════════════════════════════════════════════ */

#rr-topbar {
  display: block;
  position: sticky;
  top: 0;
  z-index: 100;
}

.rr-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 28px;
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #ededeb;
}

/* ─── Botão "Voltar ao painel" (opcional, antes do logo) ─────── */
.rr-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: rgba(237, 237, 235, 0.85);
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.rr-back-btn:hover {
  color: #c9a24f;
  border-color: rgba(201, 162, 79, 0.40);
  background: rgba(201, 162, 79, 0.06);
}
.rr-back-arrow { font-size: 14px; line-height: 1; transform: translateY(-1px); }

@media (max-width: 720px) {
  .rr-back-btn { padding: 8px 12px; }
  .rr-back-label { display: none; }
}

/* ─── Brand: logo + nome do app ───────────────────────────────── */
.rr-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.rr-brand:hover { opacity: 0.9; }
.rr-brand img {
  width: 56px; height: auto;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.5));
}

.rr-brand-divider {
  display: inline-block;
  width: 1px;
  height: 22px;
  background: rgba(201, 162, 79, 0.45);
}

.rr-app-label {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}
.rr-app-eyebrow {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #c9a24f;
}
.rr-app-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: #ededeb;
}

/* ─── Ações específicas do app (slot central/direita) ────────── */
.rr-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  margin-right: 4px;
}

/* ─── User pill (à direita) ───────────────────────────────────── */
.rr-user-wrap { position: relative; flex-shrink: 0; }

.rr-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 14px 4px 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  color: rgba(237, 237, 235, 0.85);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.rr-user-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(201, 162, 79, 0.30);
}
.rr-user-btn[aria-expanded="true"] {
  background: rgba(201, 162, 79, 0.10);
  border-color: rgba(201, 162, 79, 0.40);
}

.rr-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #c9a24f 0%, #b58a3f 100%);
  color: #0a0a0b;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.04em;
  /* Anel verde + glow externo (indicador online elegante) */
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.10) inset,
    0 0 0 2px #0a0a0b,
    0 0 0 3.5px rgba(111, 199, 132, 0.85),
    0 0 14px 2px rgba(111, 199, 132, 0.35);
  flex-shrink: 0;
  position: relative;
  animation: rr-online-pulse 3.2s ease-in-out infinite;
}

@keyframes rr-online-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.10) inset,
      0 0 0 2px #0a0a0b,
      0 0 0 3.5px rgba(111, 199, 132, 0.85),
      0 0 14px 2px rgba(111, 199, 132, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.10) inset,
      0 0 0 2px #0a0a0b,
      0 0 0 3.5px rgba(111, 199, 132, 1),
      0 0 22px 4px rgba(111, 199, 132, 0.55);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rr-user-avatar { animation: none; }
}
.rr-user-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.rr-user-initials {
  width: 100%; height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #c9a24f 0%, #b58a3f 100%);
  color: #0a0a0b;
  font-weight: 800;
}

.rr-user-name {
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rr-user-caret {
  font-size: 10px;
  color: rgba(237, 237, 235, 0.45);
  transition: transform 0.18s ease;
}
.rr-user-btn[aria-expanded="true"] .rr-user-caret {
  transform: rotate(180deg);
  color: #c9a24f;
}

/* ─── Dropdown menu ──────────────────────────────────────────── */
.rr-user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 280px;
  background: #0d0d0f;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  box-shadow:
    0 24px 64px -16px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(201, 162, 79, 0.08);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.rr-user-menu[data-open="true"] {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.rr-user-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(201, 162, 79, 0.05), transparent);
}
.rr-user-info-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #c9a24f 0%, #b58a3f 100%);
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10) inset;
}
.rr-user-info-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.rr-user-info-avatar .rr-user-initials {
  font-size: 15px;
}
.rr-user-info-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.rr-user-info-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: #ededeb;
}
.rr-user-info-email {
  font-size: 12px;
  color: rgba(237, 237, 235, 0.55);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.rr-user-menu-actions {
  display: flex;
  flex-direction: column;
  padding: 6px;
}
.rr-user-menu-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: rgba(237, 237, 235, 0.85);
  font-family: inherit;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.rr-user-menu-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #ededeb;
}
.rr-user-menu-item.danger:hover {
  background: rgba(217, 124, 124, 0.10);
  color: #d97c7c;
}
.rr-user-menu-item .ico {
  font-size: 14px;
  width: 16px;
  text-align: center;
  opacity: 0.7;
}

/* ─── Responsivo ─────────────────────────────────────────────── */
@media (max-width: 720px) {
  .rr-topbar { padding: 10px 16px; gap: 12px; }
  .rr-brand img { width: 44px; }
  .rr-app-eyebrow { display: none; }
  .rr-app-name { font-size: 13px; }
  .rr-user-name { display: none; }
  .rr-user-btn { padding: 3px 6px; }
}
