/* ═══ 1VIT — Sidebar Layout ═══ */

:root {
  --sidebar-width: 240px;
  --topbar-height: 56px;
}

/* ── Base typography (light-touch readability/eye-comfort pass) ── */
/* Loaded AFTER each page's inline <style>, so these wins the cascade. */
body {
  font-size: 15px;
  line-height: 1.55;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Inter, system-ui, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { letter-spacing: -0.01em; line-height: 1.25; }
p, li { line-height: 1.6; }
/* Tone down aggressive uppercase letter-spacing site-wide (chips/labels feel less shouty) */
[class*="label" i], [class*="-label" i], .s-card-label, .pi-label, .rd-label,
.section-title { letter-spacing: 0.3px; }

/* ── Remove dark-mode ambient glow ── */
body.has-sidebar::before { display: none !important; }

/* ── Layout Grid ── */
body.has-sidebar {
  display: flex;
  min-height: 100vh;
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  transform: translateX(-100%);
  background: var(--color-SecondaryBg);
  border-right: 1px solid var(--color-Line);
  overflow-y: auto;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease;
}
.sidebar.open { transform: translateX(0); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25); }

.sidebar-logo {
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-Line);
  display: flex;
  align-items: center;
}
.sidebar-logo a { display: flex; align-items: center; text-decoration: none; }
.sidebar-logo img {
  height: 24px;
  display: block;
}

/* Invert logo for light mode */
[data-theme="light"] .sidebar-logo img { filter: invert(1); }

/* Navigation sections */
.nav-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-PrimaryText);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.nav-section-header:hover {
  background: var(--color-HoverBg);
}

.nav-section-header .nav-icon {
  flex-shrink: 0;
  color: var(--color-TertiaryText);
}

.nav-section-header span {
  flex: 1;
}

.nav-section-header .nav-chevron {
  flex-shrink: 0;
  transition: transform 0.2s;
  color: var(--color-TertiaryText);
}

.nav-section.collapsed .nav-chevron {
  transform: rotate(-90deg);
}

.nav-section-items {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.nav-section.collapsed .nav-section-items {
  max-height: 0 !important;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px 10px 48px;
  font-size: 14px;
  color: var(--color-SecondaryText);
  text-decoration: none;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-item:hover {
  color: var(--color-PrimaryText);
  background: var(--color-HoverBg);
}
.nav-item.active {
  color: var(--color-PrimaryText);
  font-weight: 500;
  background: rgba(29, 169, 122, 0.10);
  border-left-color: var(--ic-accent);
}

.nav-item .nav-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(46, 189, 133, 0.12);
  color: var(--color-Buy);
  margin-left: auto;
}
.nav-item .nav-badge-count {
  background: #f6465d;
  color: #fff;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.nav-item .nav-external {
  margin-left: auto;
  color: var(--color-TertiaryText);
}

/* Sidebar bottom promo */
.sidebar-bottom {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--color-Line);
}

.sidebar-promo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #0f6a4e;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  color: #fff;
}
.sidebar-promo:hover { opacity: 0.9; }

.sidebar-promo-icon {
  flex-shrink: 0;
  color: #fff;
}
.sidebar-promo-text .promo-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.sidebar-promo-text .promo-desc {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  margin-top: 1px;
}

/* Sidebar collapse toggle (bottom) */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-top: 1px solid var(--color-Line);
  cursor: pointer;
  color: var(--color-TertiaryText);
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  transition: background 0.15s;
}
.sidebar-collapse-btn:hover {
  background: var(--color-HoverBg);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 199;
}

/* ══════════════════════════════════════════════════════════
   TOPBAR
   ══════════════════════════════════════════════════════════ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: var(--color-SecondaryBg);
  border-bottom: 1px solid var(--color-Line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 24px;
  z-index: 250;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
}

.topbar-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  padding: 8px 4px;
}
.topbar-brand img {
  height: 22px;
  display: block;
}
[data-theme="light"] .topbar-brand img { filter: invert(1); }

.sidebar-toggle {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--color-PrimaryText);
  border-radius: 8px;
}
.sidebar-toggle:hover {
  background: var(--color-HoverBg);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-balance {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-PrimaryText);
  padding: 6px 12px;
  border-radius: 8px;
}
.topbar-balance svg {
  color: var(--color-TertiaryText);
}
.topbar-balance-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-SecondaryText);
  margin-right: 2px;
}

/* Leader-role badge — prestige pill shown right after the Portfolio Balance chip
   for users an admin has assigned a leader tier. Each tier carries its own colour
   (ascending prestige) and the badge paints its own background, so it reads the
   same in both light and dark theme. Toggled via [hidden] by app-shell.js. */
.topbar-leader-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  user-select: none;
  /* prestige glow: per-tier halo colour, pulses via tlb-glow-pulse; a light
     streak sweeps across (::before) and the star icon twinkles (.tlb-icon). */
  position: relative;
  overflow: hidden;
  --tlb-glow: rgba(255, 255, 255, 0.5);
  animation: tlb-glow-pulse 2.8s ease-in-out infinite;
}
.topbar-leader-badge[hidden] { display: none; }
/* Sweeping shine that periodically twinkles across the pill. */
.topbar-leader-badge::before {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-18deg);
  pointer-events: none;
  animation: tlb-shimmer 3.6s ease-in-out infinite;
}
.topbar-leader-badge .tlb-icon {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  opacity: 0.95;
  transform-origin: center;
  animation: tlb-twinkle 2.8s ease-in-out infinite;
}
.topbar-leader-badge[data-role="copilot"] {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  --tlb-glow: rgba(37, 99, 235, 0.75);
}
.topbar-leader-badge[data-role="super_pilot"] {
  background: linear-gradient(135deg, #10b981, #059669);
  --tlb-glow: rgba(5, 150, 105, 0.75);
}
.topbar-leader-badge[data-role="master_pilot"] {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  --tlb-glow: rgba(124, 58, 237, 0.78);
}
.topbar-leader-badge[data-role="regional_director"] {
  background: linear-gradient(135deg, #fcd34d, #f59e0b);
  color: #3a2a00;
  border-color: rgba(0, 0, 0, 0.12);
  --tlb-glow: rgba(245, 158, 11, 0.85);
}

/* Pulsing coloured halo around the pill (uses the per-tier --tlb-glow). */
@keyframes tlb-glow-pulse {
  0%, 100% {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 0 3px 0 var(--tlb-glow);
  }
  50% {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 0 12px 2px var(--tlb-glow);
  }
}
/* Light streak sweep, then a long pause between passes. */
@keyframes tlb-shimmer {
  0% { left: -60%; }
  35%, 100% { left: 130%; }
}
/* The star icon twinkles: gentle scale, rotate and a bright sparkle. */
@keyframes tlb-twinkle {
  0%, 100% {
    opacity: 0.9;
    transform: scale(1) rotate(0deg);
    filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
  }
  50% {
    opacity: 1;
    transform: scale(1.18) rotate(10deg);
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.9));
  }
}
/* Respect users who prefer no motion: keep the badge, drop the animation. */
@media (prefers-reduced-motion: reduce) {
  .topbar-leader-badge,
  .topbar-leader-badge::before,
  .topbar-leader-badge .tlb-icon {
    animation: none;
  }
  .topbar-leader-badge::before { display: none; }
}

.topbar-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-TertiaryText);
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.topbar-icon:hover {
  background: var(--color-HoverBg);
  color: var(--color-PrimaryText);
}
.topbar-icon .notif-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  background: var(--color-Sell);
  border-radius: 50%;
  border: 1.5px solid var(--color-SecondaryBg);
}

/* ══════════════════════════════════════════════════════════
   MAIN WRAPPER
   ══════════════════════════════════════════════════════════ */
.main-wrapper {
  margin-left: 0;
  flex: 1;
  min-width: 0;
  min-height: 100vh;
}

.main-content {
  padding: calc(var(--topbar-height) + 24px) 32px 32px;
  max-width: 1440px;
}

.page-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--color-PrimaryText);
}

/* ══════════════════════════════════════════════════════════
   OVERRIDE EXISTING STYLES FOR SIDEBAR LAYOUT
   ══════════════════════════════════════════════════════════ */

/* Hide old brand-bar (replaced by sidebar + topbar) */
body.has-sidebar .brand-bar {
  display: none !important;
}

/* Remove old page container constraints */
body.has-sidebar .section-bg {
  background: transparent;
  padding: 0;
}
body.has-sidebar .page-container {
  max-width: none;
  padding: 0;
}

/* ── Role Tabs (centered iOS-style segmented control) ── */
body.has-sidebar .role-tabs {
  display: flex;
  width: fit-content;
  margin: 0 auto 32px;
  padding: 5px;
  gap: 3px;
  background: var(--color-Vessel);
  border: 1px solid var(--color-Line);
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}
body.has-sidebar .role-tab {
  padding: 12px 40px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--color-SecondaryText);
  border-radius: 999px;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.1s ease;
}
body.has-sidebar .role-tab:first-child,
body.has-sidebar .role-tab:last-child {
  border-radius: 999px;
  border-left: none;
}
body.has-sidebar .role-tab:hover:not(.active) {
  color: var(--color-PrimaryText);
  background: var(--color-HoverBg);
}
body.has-sidebar .role-tab:active:not(.active) {
  transform: scale(0.97);
}
body.has-sidebar .role-tab.active {
  background: var(--color-CardBg);
  color: var(--color-PrimaryText);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.06);
  text-shadow: none;
}
@media (max-width: 520px) {
  body.has-sidebar .role-tabs { width: 100%; max-width: 400px; }
  body.has-sidebar .role-tab { flex: 1; padding: 12px 20px; text-align: center; font-size: 14.5px; }
}

/* ── Portfolio Hero (Exness account card) ── */
body.has-sidebar .portfolio-hero {
  background: var(--color-CardBg);
  border: 1px solid var(--color-Line);
  border-left: none;
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: none;
  position: relative;
  overflow: visible;
}
body.has-sidebar .portfolio-hero::before {
  display: none;
}
body.has-sidebar .portfolio-hero-icon {
  background: var(--color-HoverBg);
  box-shadow: none;
  color: var(--color-PrimaryText);
}
body.has-sidebar .portfolio-hero-value {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.5px;
}
body.has-sidebar .hero-btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
body.has-sidebar .hero-btn-deposit {
  background: var(--color-BtnBg);
  color: var(--color-TextOnYellow);
  box-shadow: none;
}
body.has-sidebar .hero-btn-deposit:hover {
  background: var(--color-BtnBg);
  filter: brightness(1.08);
  box-shadow: none;
  transform: none;
}
body.has-sidebar .hero-btn-withdraw {
  border: 1px solid var(--color-Line);
  color: var(--color-PrimaryText);
  background: transparent;
}
body.has-sidebar .hero-btn-withdraw:hover {
  border-color: var(--color-SecondaryText);
  color: var(--color-PrimaryText);
}

/* ── Earnings Row ── */
body.has-sidebar .earnings-item {
  background: var(--color-CardBg);
  border: 1px solid var(--color-Line);
  border-radius: 12px;
  box-shadow: none;
}
body.has-sidebar .earnings-item::before {
  display: none;
}
body.has-sidebar .earnings-item:hover {
  border-color: var(--color-SecondaryText);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transform: none;
}

/* ── Summary Cards ── */
body.has-sidebar .summary-card {
  background: var(--color-CardBg);
  border: 1px solid var(--color-Line);
  border-radius: 12px;
  box-shadow: none;
}
body.has-sidebar .summary-card::after {
  display: none;
}
body.has-sidebar .summary-card:hover {
  background: var(--color-HoverBg);
  border-color: var(--color-SecondaryText);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transform: none;
}
body.has-sidebar .summary-card .card-icon {
  background: var(--color-HoverBg);
}
body.has-sidebar .summary-card:hover .card-icon {
  background: rgba(0,0,0,0.05);
  box-shadow: none;
}

/* ── Plan Cards ── */
body.has-sidebar .plan-card {
  background: var(--color-CardBg);
  border: 1px solid var(--color-Line);
  border-radius: 12px;
  box-shadow: none;
}
body.has-sidebar .plan-card::before {
  display: none;
}
body.has-sidebar .plan-card:hover {
  background: var(--color-HoverBg);
  border-color: var(--color-SecondaryText);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  transform: translateY(-2px);
}
body.has-sidebar .btn-accent {
  background: var(--color-BtnBg);
  color: var(--color-TextOnYellow);
  box-shadow: none;
}

/* ── Tables ── */
body.has-sidebar .inv-table {
  background: var(--color-CardBg);
  border: 1px solid var(--color-Line);
  border-radius: 12px;
  box-shadow: none;
}
body.has-sidebar .inv-table thead {
  background: var(--color-Vessel);
}

/* ── Partner Section Cards ── */
body.has-sidebar .partner-balance-card,
body.has-sidebar .partner-level-card,
body.has-sidebar .partner-link-card,
body.has-sidebar .p2p-bond-card,
body.has-sidebar .residual-pool-card,
body.has-sidebar .quick-reports,
body.has-sidebar .pool-card,
body.has-sidebar .mi-card,
body.has-sidebar .tree-card {
  background: var(--color-CardBg);
  border: 1px solid var(--color-Line);
  border-radius: 12px;
  box-shadow: none;
}
body.has-sidebar .partner-balance-card:hover,
body.has-sidebar .partner-level-card:hover,
body.has-sidebar .partner-link-card:hover,
body.has-sidebar .p2p-bond-card:hover,
body.has-sidebar .residual-pool-card:hover,
body.has-sidebar .quick-reports:hover,
body.has-sidebar .pool-card:hover,
body.has-sidebar .mi-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

/* ── Pool / MI Tier Cards ── */
body.has-sidebar .pool-tier,
body.has-sidebar .mi-tier {
  background: var(--color-Vessel);
  border: 1px solid var(--color-Line);
}

/* ── Divider ── */
body.has-sidebar .divider {
  background: none;
}

/* ── Section Title ── */
body.has-sidebar .section-title {
  font-size: 18px;
}

/* ── Filter / Pagination Buttons ── */
body.has-sidebar .ptx-filter {
  background: var(--color-CardBg);
  border: 1px solid var(--color-Line);
  color: var(--color-SecondaryText);
}
body.has-sidebar .ptx-filter.active {
  background: var(--color-PrimaryText);
  color: var(--color-SecondaryBg);
  border-color: var(--color-PrimaryText);
}
body.has-sidebar .ptx-page-btn {
  background: var(--color-CardBg);
  border: 1px solid var(--color-Line);
}

/* ── Profile Dropdown ── */
body.has-sidebar .profile-dropdown {
  background: var(--color-CardBg);
  border: 1px solid var(--color-Line);
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
  backdrop-filter: none;
}
body.has-sidebar .profile-menu-item:hover {
  background: var(--color-HoverBg);
}

/* ── Footer ── */
body.has-sidebar .page-footer {
  border-top: 1px solid var(--color-Line);
  padding: 24px 0;
  text-align: center;
  background: transparent;
}

/* ══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: min(86vw, 320px);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  }
  .sidebar.open ~ .sidebar-overlay {
    display: block;
  }
  .sidebar-toggle {
    display: flex;
    flex-shrink: 0;
  }
  .main-wrapper {
    margin-left: 0;
    /* Allow flex shrinking — without min-width:0 the wrapper takes its
       children's min-content size and overflows viewport, causing iOS
       to auto-zoom out on phones with content wider than 375px. */
    min-width: 0;
  }
  .main-content {
    padding: calc(var(--topbar-height) + 16px) 16px 16px;
    min-width: 0;
    max-width: 100vw;
    /* Clip any deeply-nested wider content (e.g. data tables inside
       overflow-x:auto wrappers) — iOS Safari otherwise treats them as
       viewport-content and auto-zooms-out to fit. The wrappers' own
       horizontal scroll still works for the user. */
    overflow-x: hidden;
  }

  /* Topbar tightens up — less padding, smaller gaps */
  .topbar {
    padding: 0 12px;
    gap: 6px;
  }
  .topbar-left {
    gap: 6px;
    /* Allow the brand to shrink so the hamburger + logo never spill off
       the left edge (topbar uses justify-content:flex-end). */
    min-width: 0;
  }
  .topbar-brand {
    padding: 8px 2px;
    min-width: 0;
  }
  .topbar-brand img {
    /* Scale the logo down proportionally on very narrow phones instead
       of letting the fixed-height logo overflow the topbar. */
    height: auto;
    max-height: 20px;
    max-width: 100%;
  }
  .topbar-right {
    gap: 4px;
  }

  /* Drop the "Portfolio Balance" word — the $ value is enough on mobile */
  .topbar-balance {
    padding: 6px 8px;
    font-size: 13px;
  }
  .topbar-balance-label {
    display: none;
  }
  .topbar-leader-badge {
    padding: 4px 9px;
    font-size: 11px;
  }
}

/* Extra-small phones: hide balance pill entirely, only icons + brand remain */
@media (max-width: 480px) {
  .topbar {
    padding: 0 8px;
    gap: 4px;
  }
  .topbar-brand img {
    max-height: 18px;
  }
  .topbar-balance {
    display: none;
  }
  /* Keep the leader badge as a compact icon-only medal on the smallest phones
     (the tier colour still conveys rank) so leaders don't lose the badge when the
     balance pill collapses. */
  .topbar-leader-badge {
    padding: 5px;
    gap: 0;
  }
  .topbar-leader-badge .tlb-label {
    display: none;
  }
  .topbar-icon {
    width: 34px;
    height: 34px;
  }
  .sidebar-toggle {
    width: 36px;
    height: 36px;
  }
}

/* Lock background scroll while the mobile sidebar drawer is open */
@media (max-width: 768px) {
  body.has-sidebar:has(.sidebar.open) {
    overflow: hidden;
  }
}

/* ── Sidebar scrollbar ── */
.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--color-Line);
  border-radius: 2px;
}

/* ── Profile UID copy button ────────────────────────────── */
.profile-uid {
  display: flex;
  align-items: center;
  gap: 6px;
}
.profile-uid-copy {
  background: none;
  border: none;
  padding: 2px;
  margin: 0;
  cursor: pointer;
  color: var(--color-TertiaryText);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.profile-uid-copy:hover {
  color: var(--color-PrimaryText);
  background: var(--color-HoverBg);
}
.profile-uid-copy.copied {
  color: var(--color-Buy);
}

/* ══════════════════════════════════════════════════════════
   DESKTOP TOP MENUBAR  (replaces the left sidebar at >=1024px)
   The sidebar becomes the mobile/tablet drawer (<1024px).
   ══════════════════════════════════════════════════════════ */
.app-menubar { display: none; }
.menu-group { position: relative; display: inline-flex; }
.menu-group-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 5px;
  height: 38px; padding: 0 13px;
  font-size: 13.5px; font-weight: 500; font-family: inherit;
  color: var(--color-SecondaryText);
  background: transparent; border: none; border-radius: 9px;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.menu-group:hover > .menu-group-btn,
.menu-group:focus-within > .menu-group-btn {
  background: var(--color-HoverBg); color: var(--color-PrimaryText);
}
.menu-group.active > .menu-group-btn { color: var(--color-PrimaryText); }
.menu-group.active > .menu-group-btn::before {
  content: ''; position: absolute; left: 13px; right: 13px; bottom: -8px; height: 2px;
  background: var(--ic-accent); border-radius: 2px;
}
.menu-caret { opacity: 0.65; transition: transform 0.18s; }
.menu-group:hover .menu-caret,
.menu-group:focus-within .menu-caret { transform: rotate(180deg); }
/* invisible hover bridge so the 8px gap under the button doesn't drop the flyout */
.menu-group::after { content: ''; position: absolute; top: 100%; left: 0; right: 0; height: 10px; }
.menu-flyout {
  position: absolute; top: calc(100% + 8px); left: 0;
  min-width: 216px; padding: 6px;
  background: var(--color-CardBg);
  border: 1px solid var(--color-Line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  z-index: 300;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity 0.18s ease, visibility 0.18s, transform 0.18s ease;
}
.menu-group:hover > .menu-flyout,
.menu-group:focus-within > .menu-flyout { opacity: 1; visibility: visible; transform: translateY(0); }
.menu-flyout-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 8px;
  font-size: 13.5px; color: var(--color-SecondaryText);
  text-decoration: none; white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.menu-flyout-item:hover { background: var(--color-HoverBg); color: var(--color-PrimaryText); }
.menu-flyout-item.active {
  color: var(--color-PrimaryText);
  background: rgba(29, 169, 122, 0.10);
  box-shadow: inset 2px 0 0 var(--ic-accent);
}
.menu-flyout-item .nav-badge { margin-left: auto; }

@media (min-width: 1024px) {
  .app-menubar { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; }
  .sidebar { display: none !important; }
  .sidebar-toggle { display: none !important; }
}
@media (max-width: 1023px) {
  .sidebar-toggle { display: flex; flex-shrink: 0; }
  .sidebar.open ~ .sidebar-overlay { display: block; }
  body.has-sidebar:has(.sidebar.open) { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .menu-flyout, .menu-caret { transition: none; }
}
