/* ============================================================
   Storyteller App — Layout System
   Shell grid, topbar, sidebar, workspace, side rail, mobile
   ============================================================ */

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; font-size: 16px; }

/* Responsive root scaling for UI */
@media (max-width: 1600px) { html { font-size: 14px; } }
@media (max-width: 1366px) { html { font-size: 12px; } }
@media (max-width: 768px) { html { font-size: 14px; } } /* Reset for mobile readable text */

body {
  font-family: var(--font-body);
  background: linear-gradient(rgba(8, 3, 3, 0.92), rgba(8, 3, 3, 0.95)), url('/assets/home_bg.jpg') center/cover no-repeat;
  color: var(--c-text-primary);
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* ── Login Screen ──────────────────────────────────────────── */
#login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, var(--c-backdrop-inner) 0%, var(--c-backdrop-outer) 70%, var(--c-black) 100%);
  z-index: 100000;
  color-scheme: dark;
}

/* Chrome/Safari Autofill Dark Mode Override */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--c-bg-600) inset !important;
  -webkit-text-fill-color: var(--c-parchment) !important;
  caret-color: var(--c-parchment) !important;
  border-color: var(--c-gold-600) !important;
  transition: background-color 50000s ease-in-out 0s;
}

/* Global Auth State Guardrail */
body[data-auth-state="logged-out"] #floating-buttons-container,
body[data-auth-state="logged-out"] #dynamic-fab-container,
body[data-auth-state="logged-out"] #st-floating-feed-btn,
body[data-auth-state="logged-out"] #st-quick-feed-drawer,
body[data-auth-state="logged-out"] .popup-panel {
  display: none !important;
}

/* ── App Shell (always flex to preload, but hidden visually until logged in) ── */
#app-shell {
  display: flex;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  transition: opacity 0.3s ease;
}
#app-shell.visible { 
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* ── Top Bar ───────────────────────────────────────────────── */
#topbar {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: var(--topbar-h);
  z-index: var(--z-topbar);
  background: var(--c-bg-600);
  border-bottom: 1px solid var(--c-border-strong);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 var(--sp-4);
  gap: var(--sp-4);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.topbar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
}

/* Session title */
.session-title {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  color: var(--c-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chronicle-name {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* Role badge */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 3px var(--sp-2);
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.role-badge.player {
  background: hsla(0, 72%, 45%, 0.15);
  border: 1px solid var(--c-role-player);
  color: var(--c-red-300);
}
.role-badge.storyteller {
  background: hsla(43, 90%, 48%, 0.12);
  border: 1px solid var(--c-gold-500);
  color: var(--c-gold-300);
}

/* Player avatars in topbar */
.player-presence {
  display: flex;
  align-items: center;
  gap: 2px;
}
.player-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  background: var(--c-bg-400);
  border: 2px solid var(--c-border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 600;
  position: relative;
  cursor: default;
  transition: border-color var(--dur-fast) var(--ease-smooth);
}
.player-avatar.online { border-color: var(--c-success); }
.player-avatar.in-combat { border-color: var(--c-combat-active); }
.player-avatar[data-role="storyteller"] { border-color: var(--c-gold-500); }

/* ── Sidebars ───────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  z-index: var(--z-sidebar);
  background: var(--c-bg-600);
  border-right: 1px solid var(--c-border-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform var(--dur-normal) var(--ease-out-quart);
}
body.left-sidebar-collapsed #sidebar {
  transform: translateX(-100%);
}

#right-sidebar {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  width: var(--right-sidebar-w);
  height: calc(100vh - var(--topbar-h));
  z-index: var(--z-sidebar);
  background: var(--c-bg-700);
  border-left: 1px solid var(--c-border-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform var(--dur-normal) var(--ease-out-quart);
}
body.right-sidebar-collapsed #right-sidebar {
  transform: translateX(100%);
}

/* Drag handle on the sidebar's left edge — drag to resize */
#right-sidebar-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 6px;
  cursor: ew-resize;
  z-index: 10;
  transition: background var(--dur-fast);
}
#right-sidebar-resizer:hover,
body.right-sidebar-resizing #right-sidebar-resizer {
  background: var(--c-border-strong);
}
/* Kill layout transitions while dragging so the pane tracks the pointer */
body.right-sidebar-resizing #right-sidebar,
body.right-sidebar-resizing #workspace {
  transition: none;
}
body.right-sidebar-resizing {
  cursor: ew-resize;
  user-select: none;
}
@media (max-width: 768px) {
  #right-sidebar-resizer { display: none; }
}

/* Horizontal handle splitting the Chronicle Stream from the combat tracker.
   touch-action:none stops a touch drag from scrolling the panel instead. */
#context-split-resizer {
  flex: 0 0 6px;
  cursor: ns-resize;
  touch-action: none;
  background: transparent;
  transition: background var(--dur-fast);
}
#context-split-resizer:hover,
body.context-split-resizing #context-split-resizer {
  background: var(--c-border-strong);
}
body.context-split-resizing {
  cursor: ns-resize;
  user-select: none;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-3) var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  scrollbar-width: thin;
  scrollbar-color: var(--c-border-medium) transparent;
}

.sidebar-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-text-muted);
  padding: var(--sp-3) var(--sp-3) var(--sp-1);
  margin-top: var(--sp-2);
}
.sidebar-section-label:first-child { margin-top: 0; }

.sidebar-divider {
  height: 1px;
  background: var(--c-border-subtle);
  margin: var(--sp-2) var(--sp-3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  color: var(--c-text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-smooth),
    color var(--dur-fast) var(--ease-smooth),
    border-color var(--dur-fast) var(--ease-smooth);
  border: 1px solid transparent;
  user-select: none;
  position: relative;
}

.nav-item:hover {
  background: hsla(0, 60%, 30%, 0.12);
  color: var(--c-text-primary);
  border-color: hsla(0, 60%, 30%, 0.25);
}

.nav-item.active {
  background: hsla(0, 72%, 35%, 0.18);
  color: var(--c-red-300);
  border-color: hsla(0, 72%, 35%, 0.35);
}
.nav-item.active .nav-icon { color: var(--c-red-400); }

/* ST-only items */
body:not(.role-storyteller) .st-only { display: none !important; }

/* Consolidated nav (B-05, see client/src/nav_shell.js).
   `.nav-legacy` hides the flat list the 8 destinations replace. It needs !important
   because ui_shell.initShell sets an inline display on every .nav-item.st-only. */
.nav-legacy { display: none !important; }

#nav-shell {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.nav-dest-group { display: flex; flex-direction: column; }

.nav-dest-caret {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  transition: transform var(--dur-fast) var(--ease-smooth);
}
.nav-dest-group.open .nav-dest-caret { transform: rotate(90deg); }

.nav-subtabs { display: none; }
.nav-dest-group.open .nav-subtabs {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: var(--sp-1) 0 var(--sp-2) var(--sp-6);
  border-left: 1px solid var(--c-border-subtle);
  padding-left: var(--sp-2);
}

.nav-subtab {
  display: flex;
  align-items: center;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--c-text-muted);
  text-decoration: none;
  font-size: var(--text-xs);
  cursor: pointer;
  user-select: none;
  transition:
    background var(--dur-fast) var(--ease-smooth),
    color var(--dur-fast) var(--ease-smooth);
}
.nav-subtab:hover {
  background: hsla(0, 60%, 30%, 0.12);
  color: var(--c-text-primary);
}
.nav-subtab.active {
  color: var(--c-red-300);
  background: hsla(0, 72%, 35%, 0.14);
}

/* Nav icon */
.nav-icon {
  font-size: var(--text-md);
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  transition: color var(--dur-fast);
}

/* Nav badge (e.g. unread count) */
.nav-badge {
  margin-left: auto;
  background: var(--c-red-500);
  color: white;
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 0 5px;
  border-radius: var(--r-full);
  min-width: 18px;
  text-align: center;
  line-height: 18px;
}

/* Combat indicator pill on nav item */
.nav-item.combat-active-indicator::after {
  content: '⚔️';
  position: absolute;
  right: var(--sp-2);
  animation: pulse-combat 1.2s ease-in-out infinite;
}

/* Sidebar Quick Stats (pinned bottom) */
.sidebar-quick-stats {
  padding: var(--sp-3);
  border-top: 1px solid var(--c-border-subtle);
  background: var(--c-bg-700);
  flex-shrink: 0;
}

/* ── Main Workspace ────────────────────────────────────────── */
#workspace {
  position: fixed;
  top: var(--topbar-h);
  left: var(--sidebar-w);
  right: var(--right-sidebar-w);
  bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: left var(--dur-normal) var(--ease-out-quart), right var(--dur-normal) var(--ease-out-quart);
}

body.left-sidebar-collapsed #workspace {
  left: 0;
}

body.right-sidebar-collapsed #workspace {
  right: 0;
}

/* Floating expand buttons */
.sidebar-expand-btn {
  position: absolute;
  top: var(--sp-4);
  background: var(--c-bg-700);
  border: 1px solid var(--c-border-medium);
  color: var(--c-text-primary);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  transition: all var(--dur-fast);
  opacity: 0;
  visibility: hidden;
}
.sidebar-expand-btn:hover {
  background: var(--c-bg-600);
  transform: scale(1.1);
}

.sidebar-expand-btn.left {
  left: var(--sp-4);
}
body.left-sidebar-collapsed .sidebar-expand-btn.left {
  opacity: 1;
  visibility: visible;
}

.sidebar-expand-btn.right {
  right: var(--sp-4);
}
body.right-sidebar-collapsed .sidebar-expand-btn.right {
  opacity: 1;
  visibility: visible;
}

/* Primary content pane */
#primary-pane {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Content views inside primary pane */
.content-view {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-5);
  padding-bottom: 100px !important;
  display: none !important;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--c-border-medium) transparent;
}
.content-view.active { display: flex !important; }

/* ── Right Sidebar Specifics ─────────────────────────────── */
#right-sidebar {
  /* Inherits fixed positioning from above */
}

/* ── Agent HUD Tabs ────────────────────────────────────────── */
#agent-hud {
  display: flex;
  height: var(--agent-hud-h);
  border-bottom: 1px solid var(--c-border-strong);
  flex-shrink: 0;
  background: var(--c-bg-600);
  overflow-x: auto;
  scrollbar-width: none;
}
#agent-hud::-webkit-scrollbar { display: none; }

.agent-tab {
  flex: 1;
  min-width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--c-text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid transparent;
  transition:
    color var(--dur-fast) var(--ease-smooth),
    border-color var(--dur-fast) var(--ease-smooth),
    background var(--dur-fast) var(--ease-smooth);
  position: relative;
  padding: var(--sp-1) var(--sp-1);
}
.agent-tab:hover {
  background: hsla(0,0%,100%,0.04);
  color: var(--c-text-primary);
}
.agent-tab .tab-icon { font-size: 16px; }
.agent-tab .tab-label { font-size: 9px; }

/* Per-agent active colors */
.agent-tab[data-agent="storyteller"].active { border-color: var(--c-agent-storyteller); color: var(--c-agent-storyteller); }
.agent-tab[data-agent="tactician"].active   { border-color: var(--c-agent-tactician);   color: var(--c-agent-tactician); }
.agent-tab[data-agent="rules"].active       { border-color: var(--c-agent-rules);       color: var(--c-agent-rules); }
.agent-tab[data-agent="disciplines"].active { border-color: var(--c-agent-disciplines); color: var(--c-agent-disciplines); }
.agent-tab[data-agent="lorekeeper"].active  { border-color: var(--c-agent-lorekeeper);  color: var(--c-agent-lorekeeper); }
.agent-tab[data-agent="npc"].active         { border-color: var(--c-agent-npc);         color: var(--c-agent-npc); }

/* Unread badge on agent tab */
.agent-tab .unread-dot {
  position: absolute;
  top: 6px; right: 8px;
  width: 6px; height: 6px;
  border-radius: var(--r-full);
  background: var(--c-red-400);
  display: none;
}
.agent-tab.has-unread .unread-dot { display: block; }

/* ── Agent Content Area ────────────────────────────────────── */
#agent-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  scrollbar-width: thin;
  scrollbar-color: var(--c-border-medium) transparent;
}

/* ── Chat Panel ────────────────────────────────────────────── */
#chat-panel {
  height: var(--chat-h);
  flex-shrink: 0;
  border-top: 1px solid var(--c-border-strong);
  display: flex;
  flex-direction: column;
  background: var(--c-bg-700);
}

.chat-header {
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--c-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chat-header h4 {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-text-muted);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  scrollbar-width: thin;
  scrollbar-color: var(--c-border-medium) transparent;
}

.chat-input-row {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--c-border-subtle);
  flex-shrink: 0;
}

/* ── Floating Action Buttons ───────────────────────────────── */
#floating-buttons {
  position: fixed;
  bottom: var(--sp-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-floating);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--sp-3);
}

/* ── VTT Combat Grid (body.combat-active) ────────────── */
#view-vtt {
  display: none;
  flex-direction: row;
  height: 100%;
}
#view-vtt.active {
  display: flex;
}

.vtt-main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: flex 0.3s ease;
  background-color: var(--c-bg-800);
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 50px 50px;
  box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
}



/* ── Mobile Layout ─────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar, #right-sidebar {
    transform: translateX(-100%);
    z-index: var(--z-drawer);
  }
  
  #right-sidebar {
    transform: translateX(100%);
    width: min(92vw, 420px);
  }
  #sidebar.open, #right-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  /* The context panel (Chronicle Stream + action input) is the main play surface.
     On mobile it is a drawer parked off-screen, so its opener has to stay reachable
     instead of only appearing in the right-sidebar-collapsed state. */
  .sidebar-expand-btn.right {
    opacity: 1;
    visibility: visible;
    top: auto;
    bottom: calc(var(--mobile-nav-h) + var(--sp-4));
  }

  #workspace {
    left: 0;
    right: 0;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    grid-template-areas: 'primary';
    padding-bottom: var(--mobile-nav-h);
  }

  /* NOTE: #mobile-nav's display is switched on in the later mobile media query —
     the base `#mobile-nav { display: none }` rule is declared after this block and
     would win the cascade at equal specificity from here. */
  #view-vtt {
    flex-direction: column !important;
  }
  .vtt-main-area {
    min-height: 50vh;
  }
  #coterie-location-drawer {
    width: 100% !important;
  }


  #floating-buttons {
    bottom: calc(var(--mobile-nav-h) + var(--sp-4));
    left: 50%;
    transform: translateX(-50%);
  }


  
  .action-card {
    min-height: 80px;
    padding: var(--sp-4);
  }
}

/* ── Mobile Bottom Nav ─────────────────────────────────────── */
#mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0;
  width: 100%;
  height: var(--mobile-nav-h);
  z-index: var(--z-topbar);
  background: var(--c-bg-600);
  border-top: 1px solid var(--c-border-strong);
  flex-direction: row;
}
.mobile-nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 18px;
  cursor: pointer;
  color: var(--c-text-muted);
  transition: color var(--dur-fast);
  /* These are <button>s — without this they render with the UA's light chrome
     against the dark bar. */
  background: transparent;
  border: none;
  font-family: inherit;
}
.mobile-nav-tab.active { color: var(--c-red-300); }
.mobile-nav-tab span { font-size: 9px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Slide-up Drawer (mobile side rail) ────────────────────── */
#mobile-drawer {
  display: none;
  position: fixed;
  bottom: var(--mobile-nav-h); left: 0;
  width: 100%;
  height: 70vh;
  z-index: var(--z-drawer);
  background: var(--c-bg-700);
  border-top: 2px solid var(--c-red-700);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--dur-normal) var(--ease-out-quart);
  box-shadow: var(--shadow-xl);
}
#mobile-drawer.open {
  display: flex;
  transform: translateY(0);
}

/* ── Overlay (sidebar on mobile, modals) ───────────────────── */
#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: calc(var(--z-drawer) - 1);
  backdrop-filter: blur(2px);
}
#overlay.visible { display: block; }

/* ── Knowledge Catalog Styling ───────────────────────────── */
.catalog-card:hover {
  transform: translateY(-2px);
  border-color: var(--c-amber-500) !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6) !important;
}

.catalog-tab-btn {
  background: rgba(30, 20, 25, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--c-text-muted);
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.catalog-tab-btn:hover {
  background: rgba(50, 30, 40, 0.8);
  color: var(--c-white);
}

.catalog-tab-btn.active {
  background: var(--c-amber-900);
  border-color: var(--c-amber-500);
  color: var(--c-white);
  font-weight: bold;
}

.pill-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--c-neutral-200);
  border-radius: 12px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--c-white);
}

.pill-btn.active {
  background: var(--c-purple-600);
  border-color: var(--c-purple-300);
  color: var(--c-white);
  font-weight: bold;
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  /* The left nav is an off-canvas drawer on mobile (see the transform rules above),
     not a persistent icon rail — so it needs a readable width with visible labels,
     and the content area must not reserve a gutter for a bar that isn't there. */
  #sidebar {
    width: min(80vw, 280px);
  }
  .content-area {
    margin-left: 0;
    padding: var(--sp-2);
  }
  
  /* Character Sheet Mobile Layout */
  .sheet-grid {
    display: flex;
    flex-direction: column;
  }
  .sheet-section {
    width: 100%;
  }
  /* The chronicle title is decorative and wraps to three lines at this width,
     crowding the role badge and logout button — drop the whole block. */
  .topbar-center {
    display: none;
  }
  #mobile-menu-btn {
    display: block !important;
  }
  /* Declared here (after the base `#mobile-nav { display: none }`) so it actually wins. */
  #mobile-nav {
    display: flex;
  }
}
