.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-align: left;
}

.topbar .brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.topbar .brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.topbar .brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.topbar .brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.25px;
  color: #e2e8f0;
  line-height: 1.1;
}

.topbar .brand-sub {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.1;
}

.resource-switcher {
  position: relative;
  z-index: 90;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.resource-switcher-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.resource-switcher-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.45px;
  text-transform: uppercase;
  color: #94a3b8;
}

.resource-switcher-menu {
  position: relative;
}

.resource-switcher-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 46px;
  min-width: min(100%, 320px);
  padding: 0 16px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: 999px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.94), rgba(239, 248, 255, 0.9));
  color: var(--text, #f8fafc);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.resource-switcher-toggle:hover,
.resource-switcher-toggle:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.42);
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.98), rgba(239, 248, 255, 0.94));
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.24),
    0 0 0 3px rgba(56, 189, 248, 0.12);
  outline: none;
}

.resource-switcher-current {
  max-width: min(60vw, 320px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-switcher-icon {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.2s ease;
}

.resource-switcher.is-open .resource-switcher-icon {
  transform: rotate(225deg) translateY(-1px);
}

.resource-switcher-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, calc(100vw - 32px));
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.98), rgba(239, 248, 255, 0.96));
  backdrop-filter: blur(14px);
  box-shadow:
    0 20px 44px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.03);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease,
    transform 0.2s ease;
}

.resource-switcher.is-open .resource-switcher-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.resource-switcher-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted, #cbd5e1);
  font-size: 14px;
  font-weight: 600;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.resource-switcher-link:hover,
.resource-switcher-link:focus-visible {
  color: var(--text, #f8fafc);
  border-color: rgba(56, 189, 248, 0.32);
  background: rgba(56, 189, 248, 0.12);
  transform: translateY(-1px);
  outline: none;
}

.resource-switcher-link.is-active {
  color: var(--text, #f8fafc);
  border-color: rgba(56, 189, 248, 0.38);
  background: rgba(56, 189, 248, 0.16);
}

.resource-switcher-state {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  color: #94a3b8;
}

.resource-switcher-link.is-active .resource-switcher-state {
  color: #bae6fd;
}

@media (max-width: 720px) {
  .topbar .brand-sub {
    display: none;
  }

  .resource-switcher-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .resource-switcher-menu,
  .resource-switcher-toggle {
    width: 100%;
  }

  .resource-switcher-current {
    max-width: calc(100vw - 140px);
  }

  .resource-switcher-panel {
    width: 100%;
    left: 0;
    right: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .resource-switcher-toggle,
  .resource-switcher-icon,
  .resource-switcher-panel,
  .resource-switcher-link {
    transition: none;
  }
}

/* Light resource shell refresh */
.topbar .brand-name {
  color: #102033;
}

.topbar .brand-sub,
.resource-switcher-label,
.resource-switcher-state {
  color: #53667e;
}

.topbar .brand-mark,
.resource-switcher,
.resource-switcher-toggle,
.resource-switcher-panel,
.resource-switcher-link {
  border-color: rgba(14, 165, 233, 0.16);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(239, 248, 255, 0.9));
  color: #102033;
  box-shadow: 0 14px 34px rgba(15, 40, 80, 0.1);
}

.resource-switcher-toggle:hover,
.resource-switcher-toggle:focus-visible,
.resource-switcher-link:hover,
.resource-switcher-link:focus-visible,
.resource-switcher-link.is-active {
  border-color: rgba(14, 165, 233, 0.35);
  background: linear-gradient(135deg, rgba(224, 246, 255, 0.98), rgba(229, 255, 247, 0.92));
  color: #061526;
  box-shadow: 0 16px 34px rgba(14, 165, 233, 0.14);
}
