/* ════════════════════════════════════════════════════════════════════════
   Unified header / footer button layout (Leo 2026-06-25)
   Baseline applied across pages so anything in a top bar or footer sits in a
   tidy row, evenly spaced, and WRAPS instead of overlapping when space is
   tight. Non-destructive: only adds gap/wrap to existing flex bars + makes the
   right-side cluster and buttons uniform. Pages may still override.
   ════════════════════════════════════════════════════════════════════════ */
.topbar, .topnav, .sb-topbar, .app-topbar,
.topbar-left, .topbar-right, .topbar-actions, .topnav-right, .topnav-left,
footer, .site-footer, .page-footer {
  flex-wrap: wrap;            /* never collide — wrap to a new line instead */
}
.topbar-right, .topbar-actions, .topnav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;          /* keep the action cluster on the right */
}
/* Uniform pill buttons inside any header/footer row */
.topbar .btn, .topbar-right .btn, .topbar-actions .btn, .topnav .btn,
.sb-topbar .btn, footer .btn, .app-topbar .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 14px;
  border-radius: 8px;
  white-space: nowrap;
  line-height: 1.2;
}

.mysquad-session-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 20px;
  font-size: 0.75rem;
  color: #e6edf3;
}

.mysquad-session-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3fb950;
  box-shadow: 0 0 8px rgba(63, 185, 80, 0.55);
}

.mysquad-session-logout {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid #30363d;
  border-radius: 20px;
  color: #8b949e;
  font-size: 0.7rem;
  cursor: pointer;
}

.mysquad-session-logout:hover {
  color: #e6edf3;
  border-color: #58a6ff;
}

.mysquad-global-session,
.auth-top-right,
#auth-bar {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10050;
  display: flex;
  align-items: center;
  gap: 10px;
  /* Keep the signed-in row (status · chip · Account · Log out) on ONE right-aligned
     line — the username chip truncates so the buttons never wrap or overlap. */
  max-width: min(680px, calc(100vw - 24px));
  flex-wrap: nowrap;
  justify-content: flex-end;
  white-space: nowrap;
}

/* When the auth bar is embedded inside a page's OWN top bar, keep it in the
   normal flow (right-aligned within that bar) instead of being yanked out to a
   fixed top-right overlay that collides with the page's nav/buttons. Only the
   auto-created standalone `.mysquad-global-session` floats. This is what makes
   the top-right buttons sit side-by-side, uniformly, in the bar across pages. */
.topbar #auth-bar,
.topbar-right #auth-bar,
.topbar-actions #auth-bar,
.topnav #auth-bar,
header #auth-bar,
.sb-topbar #auth-bar,
.topbar-right .mysquad-global-session {
  position: static;
  top: auto;
  right: auto;
  transform: none;
  z-index: auto;
  margin-left: auto;
  max-width: 100%;
}

/* Long usernames truncate instead of pushing the buttons off-row / overlapping them. */
.mysquad-global-session .mysquad-session-chip,
.auth-top-right .mysquad-session-chip,
#auth-bar .mysquad-session-chip {
  flex-shrink: 1;
  min-width: 0;
  max-width: 200px;
  overflow: hidden;
}
.mysquad-session-chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Uniform, side-by-side pill buttons in the top bar — fixed size, never shrink. */
.mysquad-global-session .btn,
.mysquad-global-session .mysquad-session-logout,
.auth-top-right .btn,
.auth-top-right .mysquad-session-logout,
#auth-bar .btn,
#auth-bar .mysquad-session-logout {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  line-height: 1.2;
}
.mysquad-global-session .mysquad-session-status,
.auth-top-right .mysquad-session-status,
#auth-bar .mysquad-session-status {
  flex-shrink: 0;
}

body.has-platform-pnav .mysquad-global-session,
body.has-platform-pnav #auth-bar:not(.auth-top-right) {
  top: 3.35rem;
}

body.has-dev-bypass-banner .mysquad-global-session,
body.has-dev-bypass-banner #auth-bar,
body.has-dev-bypass-banner .auth-top-right {
  top: 2.75rem;
}

body.has-dev-bypass-banner.has-platform-pnav .mysquad-global-session,
body.has-dev-bypass-banner.has-platform-pnav #auth-bar:not(.auth-top-right) {
  top: 5.1rem;
}

.mysquad-dev-bypass-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10060;
  padding: 8px 14px;
  font-size: 0.72rem;
  line-height: 1.45;
  color: #fef3c7;
  background: linear-gradient(90deg, #78350f, #92400e);
  border-bottom: 1px solid rgba(251, 191, 36, 0.35);
  text-align: center;
}

.mysquad-dev-bypass-banner code {
  font-size: 0.68rem;
  color: #fde68a;
}

.mysquad-session-status {
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8b949e;
  white-space: nowrap;
}

.mysquad-session-status.ok {
  color: #3fb950;
}

.mysquad-session-status.out {
  color: #8b949e;
}

.mysquad-session-status.dev {
  color: #fbbf24;
}

.mysquad-session-chip.dev {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(120, 53, 15, 0.35);
}

.mysquad-session-dot.dev {
  background: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.55);
}

/* ════════════════════════════════════════════════════════════════════════
   Left ACCOUNT DOCK (Leo 2026-07-03) — retires the top-right auth chip/buttons.
   One futuristic dock at the bottom-left of every session page; the avatar pops
   an account menu (Account · My Hub · Browse Alley · Log out / Sign in). Matches
   the Three.js portal aesthetic (glass, cyan→purple glow, 3D pop via GSAP).
   ════════════════════════════════════════════════════════════════════════ */

/* Old floating top-right session bar is retired — never show it. */
.mysquad-global-session {
  display: none !important;
}

.mysquad-account-dock {
  position: fixed;
  left: 16px;
  bottom: 40px;
  z-index: 10060;
  font-family: inherit;
}
.mad-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(20, 26, 36, 0.92), rgba(13, 17, 23, 0.94));
  border: 1px solid rgba(0, 212, 255, 0.28);
  color: #f5f9ff;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 32px -14px rgba(0, 0, 0, 0.75);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.mad-trigger:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 212, 255, 0.55);
  box-shadow: 0 16px 36px -14px rgba(0, 212, 255, 0.45);
}
.mad-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: #04121a;
  background: linear-gradient(135deg, #00d4ff, #bc8cff);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.5);
  flex-shrink: 0;
}
.mad-trigger.is-admin .mad-avatar {
  background: linear-gradient(135deg, #ffd76a, #ff8f5a);
  box-shadow: 0 0 16px rgba(255, 180, 90, 0.5);
  color: #241400;
}
.mad-trigger.is-hub-owner .mad-avatar {
  background: linear-gradient(135deg, #34d399, #00d4ff);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.45);
  color: #041a12;
}
.mad-handle.mad-role {
  color: #8be9c0;
  letter-spacing: 0.02em;
}
.mad-trigger.is-admin .mad-handle.mad-role {
  color: #ffd76a;
}
.mad-id {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}
.mad-name {
  font-weight: 700;
  font-size: 0.82rem;
  color: #ffffff;
}
.mad-handle {
  font-size: 0.66rem;
  color: #a7bccf;
}
.mad-caret {
  margin-left: 4px;
  font-size: 0.7rem;
  color: #7fd6ff;
  transition: transform 0.22s ease;
}
.mysquad-account-dock.open .mad-caret {
  transform: rotate(180deg);
}

.mad-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  min-width: 224px;
  padding: 6px;
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(18, 23, 32, 0.98), rgba(11, 14, 20, 0.98));
  border: 1px solid rgba(0, 212, 255, 0.24);
  box-shadow: 0 26px 64px -22px rgba(0, 0, 0, 0.85), 0 0 34px -14px rgba(0, 212, 255, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.26s ease, transform 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.26s ease;
}
.mysquad-account-dock.open .mad-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.mad-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 11px;
  border: none;
  background: transparent;
  color: #eef4fb;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.mad-item:hover {
  background: rgba(0, 212, 255, 0.12);
  color: #ffffff;
}
.mad-item.danger:hover {
  background: rgba(255, 90, 90, 0.14);
  color: #ff9a9a;
}
.mad-ico {
  width: 18px;
  text-align: center;
  opacity: 0.85;
  font-size: 0.92rem;
}
.mad-sep {
  height: 1px;
  margin: 5px 8px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
}

/* ---- Brighter white type across session pages (Leo 2026-07-03) ---------- */
body {
  color: #eef2f6;
}
.muted,
.dim,
.sub,
.subtle,
.hint,
.text-muted,
.text-dim,
small.muted {
  color: #cbd6e2 !important;
}

/* ---- In-sidebar variant (admin/operator shells with a left sb-sidebar) ---- */
.mysquad-account-dock.in-sidebar {
  position: static;
  left: auto;
  bottom: auto;
  display: block;
  margin: 8px 8px 4px;
}
.mysquad-account-dock.in-sidebar .mad-trigger {
  width: 100%;
  box-sizing: border-box;
}
.mysquad-account-dock.in-sidebar .mad-id {
  flex: 1;
  min-width: 0;
}
.mysquad-account-dock.in-sidebar .mad-name,
.mysquad-account-dock.in-sidebar .mad-handle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}
/* Menu is fixed so a scrolling/overflow-hidden sidebar can't clip it. */
.mysquad-account-dock.in-sidebar .mad-menu {
  position: fixed;
  left: 12px;
  bottom: 66px;
}
/* Collapsed sidebar → avatar only. */
.sb-sidebar.collapsed .mysquad-account-dock.in-sidebar .mad-id,
.sb-sidebar.collapsed .mysquad-account-dock.in-sidebar .mad-caret {
  display: none;
}

/* ── Bottom terminal status bar mount (Leo 2026-07-09) ─────────────────────
   Compact, inline in the fixed bottom bar between MYSQUAD-OS and [BENCH]. The
   menu pops UPWARD out of the bar. Replaces the floating bottom-left dock. */
.mysquad-account-dock.in-statusbar {
  position: static;
  left: auto;
  bottom: auto;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.mysquad-account-dock.in-statusbar .mad-trigger {
  padding: 1px 8px 1px 2px;
  gap: 5px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid rgba(0, 212, 255, 0.28);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}
.mysquad-account-dock.in-statusbar .mad-trigger:hover {
  border-color: rgba(0, 212, 255, 0.55);
  background: rgba(0, 212, 255, 0.06);
}
.mysquad-account-dock.in-statusbar .mad-avatar {
  width: 16px;
  height: 16px;
  font-size: 0.6rem;
  border-radius: 4px;
}
.mysquad-account-dock.in-statusbar .mad-name {
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mysquad-account-dock.in-statusbar .mad-handle { display: none; }
.mysquad-account-dock.in-statusbar .mad-caret { font-size: 0.55rem; }
/* Menu is fixed so the overflowing status bar can't clip it; opens upward. */
.mysquad-account-dock.in-statusbar .mad-menu {
  position: fixed;
  left: 12px;
  bottom: 30px;
}

@media (max-width: 620px) {
  .mad-id {
    display: none;
  }
  .mad-trigger {
    padding: 8px;
  }
}
