/* Unified Portal Topbar V7 */

:root {
  --rv-ut-bg: rgba(255, 255, 255, 0.74);
  --rv-ut-surface: rgba(255, 255, 255, 0.9);
  --rv-ut-surface-soft: rgba(255, 255, 255, 0.72);
  --rv-ut-border: rgba(15, 23, 42, 0.09);
  --rv-ut-border-strong: rgba(15, 23, 42, 0.12);
  --rv-ut-ink: #111827;
  --rv-ut-ink-soft: rgba(17, 24, 39, 0.64);
  --rv-ut-ink-muted: rgba(17, 24, 39, 0.48);
  --rv-ut-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
  --rv-ut-shadow-sm: 0 8px 22px rgba(15, 23, 42, 0.06);
  --rv-ut-hover: rgba(15, 23, 42, 0.05);
  --rv-ut-active: rgba(15, 23, 42, 0.08);
}

body > header.rv-unified-topbar {
  position: sticky;
  top: 0;
  z-index: 2147483000;
  isolation: isolate;
  overflow: visible;
}

body > header.rv-unified-topbar::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(244, 246, 248, 0.92) 0%, rgba(244, 246, 248, 0.78) 64%, rgba(244, 246, 248, 0) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

html[data-theme="dark"] body > header.rv-unified-topbar::before {
  background: linear-gradient(180deg, rgba(18, 20, 24, 0.9) 0%, rgba(18, 20, 24, 0.76) 64%, rgba(18, 20, 24, 0) 100%);
}

html[data-theme="dark"] .rv-unified-topbar.is-portal::before {
  display: none !important;
}

.rv-unified-topbar .rv-ut-wrap {
  width: min(var(--portal-frame-max, 1120px), calc(100% - (var(--portal-frame-side, 24px) * 2)));
  max-width: none;
  margin: 0 auto;
  padding: 10px 0 8px;
  overflow: visible;
  box-sizing: border-box;
}

.rv-unified-topbar .rv-ut-pill,
.rv-unified-topbar .rv-ut-center,
.rv-unified-topbar .rv-ut-cta,
.rv-unified-topbar .rv-ut-menuShell {
  overflow: visible;
}

.rv-unified-topbar .rv-ut-pill {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(136px, 1fr) auto minmax(136px, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 8px 10px;
  border-radius: 26px;
  background: var(--rv-ut-bg);
  border: 1px solid var(--rv-ut-border);
  box-shadow: var(--rv-ut-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.rv-unified-topbar.is-compact-portal .rv-ut-pill {
  min-height: 60px;
}

.rv-unified-topbar .rv-ut-brand {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  justify-self: start;
  min-width: 0;
  max-width: 100%;
  padding: 6px 6px;
  border-radius: 18px;
}

.rv-unified-topbar .brand-logo {
  display: block;
  height: 28px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.rv-unified-topbar .rv-ut-center {
  min-width: 0;
  width: max-content;
  max-width: 100%;
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rv-unified-topbar .rv-ut-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}

.rv-unified-topbar .rv-ut-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 14px;
  color: var(--rv-ut-ink-soft);
  font-size: 13px;
  font-weight: 700;
  transition: background .16s ease, color .16s ease;
}

.rv-unified-topbar .rv-ut-links a::after,
.rv-unified-topbar .rv-ut-portalNavItem::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 5px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(.4);
  transform-origin: center;
  transition: opacity .16s ease, transform .16s ease;
}

.rv-unified-topbar .rv-ut-links a:hover,
.rv-unified-topbar .rv-ut-links a:focus-visible,
.rv-unified-topbar .rv-ut-links a.active,
.rv-unified-topbar .rv-ut-links a[aria-current="page"] {
  color: var(--rv-ut-ink);
  background: rgba(255, 255, 255, 0.42);
  outline: none;
}

.rv-unified-topbar .rv-ut-links a:hover::after,
.rv-unified-topbar .rv-ut-links a:focus-visible::after,
.rv-unified-topbar .rv-ut-links a.active::after,
.rv-unified-topbar .rv-ut-links a[aria-current="page"]::after {
  opacity: .92;
  transform: scaleX(1);
}

.rv-unified-topbar .rv-ut-portalNav {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 2px;
  width: auto;
  max-width: min(540px, 100%);
  min-width: 0;
}

.rv-unified-topbar .rv-ut-portalNavItem {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  min-width: 60px;
  padding: 5px 6px 8px;
  border-radius: 16px;
  color: var(--rv-ut-ink-soft);
  text-decoration: none;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}

.rv-unified-topbar .rv-ut-portalNavItem:hover,
.rv-unified-topbar .rv-ut-portalNavItem:focus-visible,
.rv-unified-topbar .rv-ut-portalNavItem.is-active,
.rv-unified-topbar .rv-ut-portalNavItem[aria-current="page"] {
  color: var(--rv-ut-ink);
  background: rgba(255, 255, 255, 0.46);
  outline: none;
}

.rv-unified-topbar .rv-ut-portalNavItem:hover::after,
.rv-unified-topbar .rv-ut-portalNavItem:focus-visible::after,
.rv-unified-topbar .rv-ut-portalNavItem.is-active::after,
.rv-unified-topbar .rv-ut-portalNavItem[aria-current="page"]::after {
  opacity: .92;
  transform: scaleX(1);
}

.rv-unified-topbar .rv-ut-portalNavIcon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  overflow: visible;
}

.rv-unified-topbar .rv-ut-portalNavIcon img {
  display: block;
  width: 20px;
  height: 20px;
  object-fit: contain;
  opacity: .96;
  transform: scale(1.24);
  transform-origin: center;
}

.rv-unified-topbar .rv-ut-portalNavLabel {
  font-size: 10.5px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}


.rv-unified-topbar .rv-ut-cta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  gap: 8px;
  min-width: 0;
  width: 100%;
  position: relative;
  z-index: 5;
}

.rv-unified-topbar .rv-ut-login,
.rv-unified-topbar .rv-ut-themeBtn,
.rv-unified-topbar .rv-ut-menuBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  min-width: 40px;
  padding: 0 14px;
  border: 1px solid var(--rv-ut-border-strong);
  border-radius: 16px;
  background: var(--rv-ut-surface);
  box-shadow: var(--rv-ut-shadow-sm);
  color: var(--rv-ut-ink);
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.rv-unified-topbar .rv-ut-login {
  min-width: 74px;
  font-size: 13px;
  font-weight: 800;
}

.rv-unified-topbar .rv-ut-themeBtn,
.rv-unified-topbar .rv-ut-menuBtn {
  padding: 0;
  cursor: pointer;
}

.rv-unified-topbar .rv-ut-themeBtn {
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
}

.rv-unified-topbar .rv-ut-login:hover,
.rv-unified-topbar .rv-ut-login:focus-visible,
.rv-unified-topbar .rv-ut-menuShell.is-open > .rv-ut-menuBtn,
.rv-unified-topbar .rv-ut-menuBtn:hover,
.rv-unified-topbar .rv-ut-menuBtn:focus-visible {
  background: var(--rv-ut-hover);
  border-color: rgba(15, 23, 42, 0.16);
  outline: none;
  transform: translateY(-1px);
}

.rv-unified-topbar .rv-ut-themeBtn:hover,
.rv-unified-topbar .rv-ut-themeBtn:focus-visible {
  background: transparent !important;
  border-color: transparent !important;
  outline: none;
  box-shadow: none !important;
  transform: translateY(-1px);
}

.rv-unified-topbar .rv-ut-themeBtn:focus-visible {
  outline: 2px solid rgba(15, 23, 42, 0.18);
  outline-offset: 3px;
  border-radius: 10px;
}

.rv-unified-topbar .rv-ut-themeVisual {
  position: relative;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  overflow: visible;
  --rv-ut-theme-scale: 1.68;
  --rv-ut-theme-scale-soft: 1.54;
}

.rv-unified-topbar .rv-ut-themeBird {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  object-fit: contain;
  transform: translate(-50%, -50%) scale(var(--rv-ut-theme-scale));
  transform-origin: 50% 50%;
  transition: opacity .18s ease, transform .24s ease;
  will-change: transform, opacity;
}

.rv-unified-topbar .rv-ut-themeBird--dark {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-8deg) scale(var(--rv-ut-theme-scale-soft));
}

.rv-unified-topbar.is-theme-dark .rv-ut-themeBird--light {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(8deg) scale(var(--rv-ut-theme-scale-soft));
}

.rv-unified-topbar.is-theme-dark .rv-ut-themeBird--dark {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(var(--rv-ut-theme-scale));
}

.rv-unified-topbar .rv-ut-themeSleep {
  position: absolute;
  top: -11px;
  right: -19px;
  font-size: 10px;
  line-height: 1;
  opacity: 0;
  transform: translateY(6px) scale(.7);
  pointer-events: none;
}

.rv-unified-topbar.is-theme-nap .rv-ut-themeSleep {
  animation: rvThemeSleep 1.2s ease forwards;
}

.rv-unified-topbar.is-theme-dark .rv-ut-themeBird--dark {
  transform-origin: 60% 58%;
}

.rv-unified-topbar.is-theme-nap .rv-ut-themeBird--dark {
  animation: rvThemeBirdSleep 1.05s ease both;
}

.rv-unified-topbar .rv-ut-menuShell {
  position: relative;
  z-index: 2147483200;
  display: inline-flex;
  align-items: center;
}

.rv-unified-topbar .rv-ut-menuIcon {
  width: 24px;
  height: 24px;
  display: block;
  object-fit: contain;
}

.rv-unified-topbar .rv-ut-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(244px, calc(100vw - 32px));
  min-width: 0;
  display: grid;
  gap: 4px;
  max-width: calc(100vw - 32px);
  max-height: min(70vh, 420px);
  overflow: auto;
  padding: 10px;
  border-radius: 22px;
  border: 1px solid var(--rv-ut-border);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, -4px, 0);
  transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
  z-index: 2147483500;
}

.rv-unified-topbar .rv-ut-menu[hidden] {
  display: grid !important;
}

.rv-unified-topbar .rv-ut-menuShell.is-open .rv-ut-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
}

.rv-unified-topbar .rv-ut-menuProfile {
  padding: 6px 8px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.rv-unified-topbar .rv-ut-menuProfileText {
  display: grid;
  min-width: 0;
}

.rv-unified-topbar .rv-ut-menuProfileText strong {
  font-size: 13px;
  line-height: 1.25;
  color: var(--rv-ut-ink);
}

.rv-unified-topbar .rv-ut-menuProfileText span {
  font-size: 12px;
  line-height: 1.4;
  color: var(--rv-ut-ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rv-unified-topbar .rv-ut-menu a {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 14px;
  color: var(--rv-ut-ink);
  font-size: 14px;
  font-weight: 700;
  pointer-events: auto;
}

.rv-unified-topbar .rv-ut-menu a:hover,
.rv-unified-topbar .rv-ut-menu a:focus-visible {
  background: var(--rv-ut-hover);
  outline: none;
}

.rv-unified-topbar .rv-ut-menu a.danger {
  color: #b42318;
}

html[data-theme="dark"] .rv-unified-topbar .rv-ut-pill {
  background: rgba(32, 34, 40, 0.78);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

html[data-theme="dark"] .rv-unified-topbar .rv-ut-links a,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-portalNavItem,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-menuProfileText span {
  color: rgba(232, 235, 241, 0.72);
}

html[data-theme="dark"] .rv-unified-topbar .rv-ut-links a:hover,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-links a:focus-visible,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-links a.active,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-links a[aria-current="page"],
html[data-theme="dark"] .rv-unified-topbar .rv-ut-portalNavItem:hover,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-portalNavItem:focus-visible,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-portalNavItem.is-active,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-portalNavItem[aria-current="page"] {
  color: #f5f7fb;
  background: rgba(255, 255, 255, 0.07);
}

html[data-theme="dark"] .rv-unified-topbar .rv-ut-login,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-themeBtn,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-menuBtn,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-menu {
  background: rgba(46, 48, 56, 0.92);
  border-color: rgba(255, 255, 255, 0.1);
  color: #f5f7fb;
}

html[data-theme="dark"] .rv-unified-topbar .rv-ut-login:hover,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-login:focus-visible,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-menuShell.is-open > .rv-ut-menuBtn,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-menuBtn:hover,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-menuBtn:focus-visible,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-menu a:hover,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-menu a:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .rv-unified-topbar .rv-ut-themeBtn {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .rv-unified-topbar .rv-ut-themeBtn:hover,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-themeBtn:focus-visible {
  background: transparent !important;
}

html[data-theme="dark"] .rv-unified-topbar .rv-ut-themeBtn:focus-visible {
  outline-color: rgba(255, 255, 255, 0.22);
}

html[data-theme="dark"] .rv-unified-topbar .rv-ut-menuProfile {
  border-bottom-color: rgba(255, 255, 255, 0.09);
}

html[data-theme="dark"] .rv-unified-topbar .rv-ut-menuProfileText strong,
html[data-theme="dark"] .rv-unified-topbar .rv-ut-menu a {
  color: #f5f7fb;
}

html[data-theme="dark"] .rv-unified-topbar .rv-ut-menu a.danger {
  color: #ffb0b8;
}

@keyframes rvThemeSleep {
  0% { opacity: 0; transform: translateY(6px) scale(.7); }
  20% { opacity: 1; transform: translateY(0) scale(1); }
  80% { opacity: 1; transform: translateY(-3px) scale(1); }
  100% { opacity: 0; transform: translateY(-6px) scale(.86); }
}

@keyframes rvThemeBirdSleep {
  0% { transform: translate(-50%, -50%) rotate(0deg) scale(var(--rv-ut-theme-scale)); }
  32% { transform: translate(-50%, -49%) rotate(-10deg) scale(var(--rv-ut-theme-scale)); }
  66% { transform: translate(-50%, -50%) rotate(-6deg) scale(var(--rv-ut-theme-scale)); }
  100% { transform: translate(-50%, -50%) rotate(0deg) scale(var(--rv-ut-theme-scale)); }
}

@media (max-width: 980px) {
  .rv-unified-topbar .rv-ut-wrap {
    padding-inline: 16px;
  }

  .rv-unified-topbar .rv-ut-pill {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
    border-radius: 24px;
  }

  .rv-unified-topbar .rv-ut-brand,
  .rv-unified-topbar .rv-ut-center,
  .rv-unified-topbar .rv-ut-cta {
    width: 100%;
    justify-content: center;
  }

  .rv-unified-topbar .rv-ut-brand {
    min-width: 0;
  }

  .rv-unified-topbar .rv-ut-portalNav {
    max-width: none;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 2px;
  }

  .rv-unified-topbar .rv-ut-portalNav::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 620px) {
  .rv-unified-topbar .rv-ut-pill {
    padding-inline: 10px;
  }

  .rv-unified-topbar .rv-ut-portalNav {
    gap: 6px;
  }

  .rv-unified-topbar .rv-ut-portalNavItem {
    min-width: 76px;
    padding-inline: 8px;
  }

  .rv-unified-topbar .rv-ut-portalNavIcon {
    width: 34px;
    height: 34px;
  }

  .rv-unified-topbar .rv-ut-portalNavIcon img {
    width: 30px;
    height: 30px;
  }

  .rv-unified-topbar .rv-ut-portalNavLabel {
    font-size: 11px;
  }

  .rv-unified-topbar .rv-ut-menu {
    max-width: calc(100vw - 32px);
  }
}
