/* ── Menu bar ───────────────────────────────────────── */
.menubar {
  position: relative;
  display: flex; align-items: center; gap: 2px;
  padding: 0 8px 0 14px; height: 44px;
  background: #12121f; border-bottom: 1px solid var(--border); flex-shrink: 0;
  user-select: none; -webkit-user-select: none;
}
.mb-center {
  /* Flex item between the menus and the right-pinned connection chip —
     shrinks/ellipsizes instead of overlapping neighbours. */
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.mb-item { position: relative; }
/* Right-pinned items (connection chip): dropdown opens leftward so it stays
   inside the viewport. */
.mb-item-right { margin-left: auto; }
.mb-item-right .mb-panel { left: auto; right: 0; }
.mb-top {
  padding: 7px 14px; border: none; border-radius: 6px;
  background: transparent; color: var(--text);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
}
.mb-top:hover, .mb-top[aria-expanded="true"] { background: var(--s2); color: var(--text); }
.mb-panel {
  position: absolute; top: 100%; left: 0; margin-top: 2px;
  min-width: 280px; padding: 6px 0;
  background: var(--s2); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 16px 40px rgba(0,0,0,.55); z-index: 800;
}
.mb-panel.hidden { display: none; }
.mb-panel-narrow { min-width: 220px; }
.mb-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; padding: 9px 14px; border: none; background: transparent;
  color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.mb-opt:hover { background: rgba(99,102,241,.15); }
.mb-opt:disabled { opacity: .45; cursor: default; }
.mb-opt:disabled:hover { background: transparent; }
.mb-note {
  padding: 0 14px 8px; margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45;
}
.mb-sep { height: 1px; margin: 6px 10px; background: var(--border); }
/* View-menu checkable items: the ✓ reserves space so labels don't shift. */
.mb-opt-check .mb-check { visibility: hidden; color: var(--accent); font-weight: 700; }
.mb-opt-check.checked .mb-check { visibility: visible; }
.mb-kb { font-size: 12px; color: var(--muted); font-weight: 500; }
.brand-mark {
  font-size: 16px; font-weight: 700; letter-spacing: -.3px;
  color: var(--text);
}
.brand-mark em {
  /* legacy: italic em color-swap retired — keep selector benign for any
     residual markup so it doesn't accidentally re-introduce the look. */
  color: inherit; font-style: normal;
}
.mb-brand-open {
  margin: 0; padding: 7px 14px 7px 0;
  border: none; border-radius: 6px;
  background: transparent; font: inherit;
  cursor: pointer;
  display: inline-flex; align-items: center;
}
.mb-brand-open:hover { background: var(--s2); }

/* Unread Copilot suggestion — glow until the sidebar is opened. */
.mb-brand-open.copilot-pulse {
  animation: copilotPulse 1.8s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes copilotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); background: transparent; }
  50% { box-shadow: 0 0 10px 2px rgba(99, 102, 241, .45); background: rgba(99, 102, 241, .12); }
}
@media (prefers-reduced-motion: reduce) {
  .mb-brand-open.copilot-pulse {
    animation: none;
    background: rgba(99, 102, 241, .16);
    box-shadow: 0 0 8px 1px rgba(99, 102, 241, .4);
  }
}
.mb-status {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
  padding-right: 14px; font-size: 13px; color: var(--muted);
}

/* ── Connection chip (single source of truth) ───────────────
   Replaces the menubar dot/label PLUS the bottom status-bar TX/WS readouts.
   One pill: state + device + TX rate + WS health. */
.conn-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 11px; border-radius: 999px;
  background: var(--s2); border: 1px solid var(--border);
  font-size: 12px; color: var(--muted); cursor: pointer;
  font-family: inherit; line-height: 1.2;
  transition: background .12s, border-color .12s;
}
.conn-chip:hover { background: var(--s3); }
.conn-chip b { color: var(--text); font-weight: 600; }
.conn-chip .conn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--device-off);
  flex-shrink: 0;
}
.conn-chip.live {
  border-color: rgba(34,197,94,.4);
  background: rgba(34,197,94,.08);
  color: #bbf7d0;
}
.conn-chip.live b { color: #86efac; }
.conn-chip.live .conn-dot {
  background: var(--device-ok);
  box-shadow: 0 0 8px var(--device-ok);
}
.conn-chip.warn {
  border-color: rgba(245,165,36,.4);
  background: rgba(245,165,36,.08);
  color: #fcd34d;
}
.conn-chip.warn .conn-dot {
  background: var(--device-warn);
  animation: connDotPulse 1s ease-in-out infinite;
}
.conn-chip.off {
  border-color: rgba(239,68,68,.35);
  background: rgba(239,68,68,.06);
  color: #fecaca;
}
.conn-chip-sep { color: var(--muted-2); }
.conn-chip-tx { font-variant-numeric: tabular-nums; }
@keyframes connDotPulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.mb-panel.mb-panel-device { min-width: 360px; }
.mb-device-grid {
  padding: 12px 14px; display: flex; flex-direction: column; gap: 10px;
}
.mb-device-grid label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.mb-port-row { display: flex; gap: 8px; align-items: center; }
.mb-port-row select { flex: 1; min-width: 0; max-width: none; }
.mb-connect-row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.mb-manual-port label { display: block; margin-bottom: 4px; }
.mb-manual-port input {
  width: 100%; box-sizing: border-box;
  background: var(--s1); border: 1px solid var(--border); color: var(--text);
  padding: 8px 10px; border-radius: 7px; font-size: 13px; outline: none;
  font-family: ui-monospace, monospace;
}
.mb-manual-port input:focus { border-color: var(--accent); }
.mb-manual-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.mb-device-hint { margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.45; max-width: 340px; }

.logo { font-size: 17px; font-weight: 700; letter-spacing: -.4px; }
.logo em { color: inherit; font-style: normal; }
.vsep { width: 1px; height: 20px; background: var(--border); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); flex-shrink: 0; transition: background .3s; }
.dot.on { background: var(--green); box-shadow: 0 0 7px var(--green); }
.dot.warn { background: #f5a524; box-shadow: 0 0 7px #f5a524; animation: dotPulse 1s ease-in-out infinite; }
@keyframes dotPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
#connLabel { font-size: 13px; color: var(--muted); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml { margin-left: auto; display: flex; gap: 8px; align-items: center; }

select {
  background: var(--s2); border: 1px solid var(--border); color: var(--text);
  padding: 7px 12px; border-radius: 7px; font-size: 14px; outline: none; cursor: pointer; max-width: 260px;
}
select:focus { border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 18px; border-radius: 7px; border: none;
  cursor: pointer; font-size: 14px; font-weight: 600;
  font-family: inherit; white-space: nowrap; transition: filter .1s, transform .05s;
}
.btn:hover  { filter: brightness(1.1); }
.btn:active { filter: brightness(.88); transform: translateY(1px); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost  { background: var(--s2); color: var(--text); border: 1px solid var(--border); }
.btn-sm     { padding: 5px 13px; font-size: 13px; border-radius: 6px; font-weight: 500; }

