:root {
  --topnav-main-height: 64px;
  --topnav-row-height: 48px;
  --topnav-height: calc(var(--topnav-main-height) + var(--topnav-row-height));
  --topnav-teal: #0f8a80;
  --topnav-ink: #11203a;
}

html { scroll-padding-top: calc(var(--topnav-height) + 12px); }
body { display: block; padding-top: var(--topnav-height); font-family: "Segoe UI", Arial, sans-serif; }

.sidebar {
  width: 100%; height: var(--topnav-height); inset: 0 0 auto; bottom: auto;
  background: #fff; color: var(--topnav-ink); border-bottom: 1px solid #dfe5ec;
  box-shadow: 0 2px 8px rgb(15 23 42 / 5%); display: block; z-index: 100;
}
.sidebar-logo {
  position: absolute; right: 28px; top: 0; height: var(--topnav-main-height);
  display: flex; align-items: center; padding: 0; border: 0; color: #0f172a;
  font-size: 24px; font-weight: 800; letter-spacing: -.7px; direction: ltr;
}
.sidebar-logo span { color: #3977f6; }
.sidebar-bu-badge {
  position: absolute; right: 176px; top: 15px; min-width: 230px; max-width: min(42vw, 330px);
  height: 34px; margin: 0; padding: 0 14px; display: flex; align-items: center; gap: 8px;
  color: var(--topnav-ink); background: #f8fafc; border: 1px solid #d9e1ea; border-radius: 12px;
  font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: default;
}
.sidebar-bu-badge.topnav-switchable { cursor: pointer; }
.sidebar-bu-badge.topnav-switchable::before { content: "⌄"; font-size: 11px; color: #475569; }
.sidebar-bu-badge::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #22b8a7; flex: 0 0 auto; }

.sidebar-nav {
  position: absolute; inset: var(--topnav-main-height) 0 auto; height: var(--topnav-row-height);
  padding: 0 22px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch;
  border-top: 1px solid #f0f3f6; background: #fff; overflow: visible;
}
#sidebar-facade, #sidebar-scaffold, #sidebar-global {
  min-width: 0; height: var(--topnav-row-height); align-items: stretch; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; overscroll-behavior-inline: contain;
}
#sidebar-facade::-webkit-scrollbar, #sidebar-scaffold::-webkit-scrollbar, #sidebar-global::-webkit-scrollbar { display: none; }
#sidebar-facade:not([style*="display: none"]), #sidebar-scaffold:not([style*="display: none"]), #sidebar-global:not([style*="display: none"]) { display: flex; }
.nav-item {
  flex: 0 0 auto; min-height: var(--topnav-row-height); margin: 0; padding: 0 17px;
  justify-content: center; gap: 6px; border-radius: 0; border-bottom: 3px solid transparent;
  background: transparent; color: #26354d; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.nav-item:hover { background: #f8fafc; color: #0f766e; }
.nav-item.active { background: transparent; color: #0f766e; border-bottom-color: var(--topnav-teal); }
.nav-item.topnav-secondary-item { display: none; }
.nav-badge { margin-inline-start: 2px; background: #fee2e2; color: #dc2626; padding: 1px 6px; font-size: 10px; }

.topnav-more-button {
  position: relative; z-index: 2; min-width: 68px; height: var(--topnav-row-height); padding: 0 14px;
  border: 0; border-bottom: 3px solid transparent; background: #fff; color: #26354d;
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
  box-shadow: 10px 0 16px -16px rgb(15 23 42 / 60%);
}
.topnav-more-button:hover, .topnav-more-button[aria-expanded="true"], .topnav-more-button.active { color: #0f766e; background: #f8fafc; }
.topnav-more-button.active { border-bottom-color: var(--topnav-teal); }
.topnav-more-button[hidden] { display: none; }
.topnav-more-menu {
  position: fixed; z-index: 140; top: calc(var(--topnav-height) - 2px); left: 22px;
  width: min(330px, calc(100vw - 24px)); max-height: min(70vh, 520px); overflow: auto;
  display: none; padding: 8px; background: #fff; border: 1px solid #dfe5ec; border-radius: 0 0 12px 12px;
  box-shadow: 0 18px 36px rgb(15 23 42 / 18%);
}
.topnav-more-menu.open { display: grid; gap: 3px; }
.topnav-more-link {
  width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 11px; border: 0; border-radius: 8px; background: transparent; color: #1e293b;
  font: inherit; font-size: 13px; font-weight: 600; text-align: start; cursor: pointer;
}
.topnav-more-link:hover, .topnav-more-link:focus-visible, .topnav-more-link.active { background: #eefaf8; color: #0f766e; }
.topnav-more-link small { color: #64748b; font-size: 11px; font-weight: 500; }

.sidebar-bu-switcher {
  position: fixed; z-index: 102; right: 418px; top: 16px; height: 32px; margin: 0; padding: 0 10px;
  display: flex; align-items: center; border: 0; border-radius: 8px; color: #536176; background: transparent;
  font-size: 11px; cursor: pointer;
}
.sidebar-bu-switcher:hover, .sidebar-bu-switcher:focus-visible { color: #0f766e; background: #eefaf8; outline: none; }

.main-wrap { margin-inline-start: 0; width: 100%; min-height: calc(100vh - var(--topnav-height)); }
.topbar {
  /* z-index: auto -- the base sticky z-index:10 would make this flex item a stacking context below
     the header bar (z-index 100), trapping the fixed #user-info (name, language, logout) under it. */
  position: static; z-index: auto; padding: 18px 28px 6px; border: 0; background: var(--bg); gap: 9px;
}
.topbar h1 { font-size: 26px; line-height: 1.2; font-weight: 750; color: var(--topnav-ink); }
.topbar .clock { display: none; }
.topbar .user-info {
  position: fixed; z-index: 102; top: 10px; left: 24px; height: 44px;
  align-items: center; padding: 0 4px 0 10px; background: #fff;
}
.topbar .user-info .btn { padding: 7px 10px; font-size: 12px; }
.topbar .mobile-nav-toggle { display: none; }
.content { padding: 14px 28px 24px; }
.impersonation-bar { position: relative; z-index: 4; }

@media (max-width: 760px) {
  :root { --topnav-main-height: 58px; --topnav-row-height: 50px; }
  body { display: block; padding-top: var(--topnav-height); }
  .sidebar { width: 100%; height: var(--topnav-height); transform: none; box-shadow: 0 2px 8px rgb(15 23 42 / 7%); }
  .sidebar.mobile-open { transform: none; }
  .sidebar-logo { right: 12px; height: var(--topnav-main-height); font-size: 21px; }
  .sidebar-bu-badge {
    right: 118px; left: 12px; top: 12px; min-width: 0; max-width: none; height: 34px; padding: 0 10px;
    font-size: 11px;
  }
  .sidebar-bu-switcher { display: none !important; }
  .sidebar-nav { inset: var(--topnav-main-height) 0 auto; padding: 0; grid-template-columns: minmax(0, 1fr) 62px; }
  .nav-item { min-height: var(--topnav-row-height); padding: 0 14px; font-size: 12px; }
  .topnav-more-button {
    min-width: 62px; height: var(--topnav-row-height); padding: 0 8px; background: #fff;
    box-shadow: 8px 0 16px -14px rgb(15 23 42 / 75%);
  }
  .topnav-more-menu { top: calc(var(--topnav-height) - 1px); inset-inline: 6px; width: auto; border-radius: 0 0 12px 12px; }
  .topbar { padding: 15px 12px 5px; flex-wrap: wrap; }
  .topbar h1 { font-size: 22px; }
  .topbar .clock, .topbar .mobile-nav-toggle { display: none !important; }
  .topbar .user-info {
    position: static; display: flex !important; height: auto; margin-inline-start: auto; padding: 0;
    background: transparent; flex-wrap: wrap; justify-content: flex-end;
  }
  .topbar .user-info .btn { min-height: 36px; }
  .content { padding: 10px 12px 18px; overflow-x: clip; }
}
