/* ──────────────────────────────────────────────────────────
   Jack-LM Shared Header
   Self-contained nav bar rendered by header.js into
   #app-header on every department page.

   Scoped under .bl-sh to avoid collisions with host styles.
   Colors use CSS custom properties that host pages can
   override — defaults match the Jack-LM dark-ish palette.
   ────────────────────────────────────────────────────────── */

:root {
  --bl-sh-bg: #ffffff;
  --bl-sh-bg-hover: #f1f5f9;
  --bl-sh-border: #e2e8f0;
  --bl-sh-fg: #0f172a;
  --bl-sh-fg-dim: #475569;
  --bl-sh-fg-muted: #94a3b8;
  --bl-sh-accent: #2563eb;
  --bl-sh-accent-bg: rgba(37, 99, 235, 0.08);
  --bl-sh-danger: #dc2626;
  --bl-sh-height: 52px;
}

.bl-sh {
  position: relative;
  height: var(--bl-sh-height);
  background: var(--bl-sh-bg);
  border-bottom: 1px solid var(--bl-sh-border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 13px;
  color: var(--bl-sh-fg);
  z-index: 80;
  box-sizing: border-box;
}

.bl-sh * { box-sizing: border-box; }

/* Logo */
.bl-sh-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700;
  color: var(--bl-sh-fg);
  letter-spacing: -0.4px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}
.bl-sh-logo-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  /* No background — the hardhat illustration carries its own colors. */
}
.bl-sh-logo-icon svg { width: 15px; height: 15px; fill: white; }
.bl-sh-logo-icon img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  /* A touch of warm shadow so the hat feels grounded in the bar. */
  filter: drop-shadow(0 1px 1px rgba(120, 60, 0, 0.18));
}

/* Project selector */
.bl-sh-proj {
  padding: 0 14px;
  border-left: 1px solid var(--bl-sh-border);
  border-right: 1px solid var(--bl-sh-border);
  display: flex; flex-direction: column; justify-content: center;
  height: 100%;
}
.bl-sh-proj-lbl {
  font-size: 9px;
  color: var(--bl-sh-fg-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.bl-sh-proj-sel {
  background: transparent;
  border: none;
  color: var(--bl-sh-fg);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  appearance: none;
  max-width: 240px;
  padding-right: 16px;
  background-image: url("data:image/svg+xml,%3Csvg width='9' height='5' viewBox='0 0 9 5' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l3.5 3L8 1' stroke='%23475569' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  font-family: inherit;
}

/* Nav */
.bl-sh-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
}
.bl-sh-nav::-webkit-scrollbar { height: 0; }

.bl-sh-tab {
  position: relative;
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 500;
  color: var(--bl-sh-fg-dim);
  cursor: pointer;
  border-radius: 7px;
  transition: color .15s, background .15s;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
  text-decoration: none;
  border: none;
  background: transparent;
  font-family: inherit;
}
.bl-sh-tab:hover { color: var(--bl-sh-fg); background: var(--bl-sh-bg-hover); }
.bl-sh-tab.is-active {
  color: var(--bl-sh-accent);
  font-weight: 600;
}
.bl-sh-tab.is-active::after {
  content: '';
  position: absolute;
  bottom: -14px;
  left: 11px; right: 11px;
  height: 2px;
  background: var(--bl-sh-accent);
  border-radius: 2px 2px 0 0;
}
.bl-sh-chevron { font-size: 9px; opacity: 0.5; margin-left: 4px; }

/* HO dropdown */
.bl-sh-ho-menu {
  position: absolute;
  top: var(--bl-sh-height);
  z-index: 200;
  background: var(--bl-sh-bg);
  border: 1px solid var(--bl-sh-border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  min-width: 200px;
  padding: 6px 0;
  display: none;
}
.bl-sh-ho-menu.is-open { display: block; }
.bl-sh-ho-item {
  padding: 8px 18px;
  font-size: 12.5px;
  color: var(--bl-sh-fg-dim);
  cursor: pointer;
  transition: background .1s, color .1s;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.bl-sh-ho-item:hover { background: var(--bl-sh-bg-hover); color: var(--bl-sh-accent); }
.bl-sh-ho-sep { height: 1px; background: var(--bl-sh-border); margin: 4px 0; }
/* Section subheading inside a dropdown — small uppercase label
   above an indented entry. Matches the .ho-menu-subhead style used
   on Head Office's custom topbar so both renderings align. */
.bl-sh-ho-subhead {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 18px 4px;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--bl-sh-fg-muted);
}
.bl-sh-ho-sub-item { padding-left: 30px; font-weight: 500; }
/* Inline badge that sits beside a subheading or menu item. Same
   visuals as .bl-sh-ho-badge but uses flex auto-margin so it docks
   to the right edge of the row. */
.bl-sh-md-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 5px;
  border-radius: 8px;
  background: #ef4444; color: #fff;
  font-size: 10px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}
/* Tab-level badge sits inline with the tab text (e.g. on My Desk).
   Slightly smaller than menu badges so it doesn't overweight the tab. */
.bl-sh-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 14px; height: 14px; padding: 0 4px;
  margin: 0 4px 0 6px;
  border-radius: 7px;
  background: #ef4444; color: #fff;
  font-size: 9px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}
.bl-sh-ho-badge {
  min-width: 16px;
  padding: 1px 7px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  font-family: inherit;
}

/* Right cluster — sized so its border-left lands at the same x as
   the Jack pane's border-left below the header. .bl-sh has 20px of
   right padding, so the cluster width is (--ai-pane-w − 20) — the
   resulting left edge is (viewport_width − ai-pane-w), matching the
   Jack pane and giving one continuous vertical divider top→bottom. */
.bl-sh-right {
  display: flex;
  align-items: center;
  height: 100%;
  width: calc(var(--ai-pane-w, 380px) - 20px);
  flex-shrink: 0;
  border-left: 1px solid var(--bl-sh-border);
  padding-left: 12px;
  gap: 10px;
  box-sizing: border-box;
}
.bl-sh-role {
  font-family: 'SF Mono', 'Roboto Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  letter-spacing: 0.3px;
  border-radius: 4px;
}
.bl-sh-role-admin { background: var(--bl-sh-accent-bg); color: var(--bl-sh-accent); }
.bl-sh-role-client { background: rgba(167, 139, 250, .12); color: #7c3aed; }
.bl-sh-role-consultant { background: rgba(59, 130, 246, .1); color: #2563eb; }
.bl-sh-role-default { background: var(--bl-sh-bg-hover); color: var(--bl-sh-fg-dim); }

.bl-sh-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--bl-sh-fg-dim);
}
.bl-sh-avatar {
  width: 26px; height: 26px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 9px;
  font-weight: 600;
  color: white;
  background: var(--bl-sh-accent);
}

.bl-sh-iconbtn {
  width: 28px; height: 28px;
  background: none;
  border: none;
  color: var(--bl-sh-fg-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color .12s, background .12s;
  border-radius: 6px;
  padding: 0;
}
.bl-sh-iconbtn:hover { color: var(--bl-sh-fg); background: var(--bl-sh-bg-hover); }
.bl-sh-iconbtn svg { width: 14px; height: 14px; }
.bl-sh-iconbtn.is-danger:hover { color: var(--bl-sh-danger); }

/* Messages chip — bell-icon style with red unread badge */
.bl-sh-msg-chip {
  position: relative;
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--bl-sh-fg-dim);
  text-decoration: none;
  transition: color .12s, background .12s;
}
.bl-sh-msg-chip:hover { color: var(--bl-sh-fg); background: var(--bl-sh-bg-hover); }
.bl-sh-msg-chip.is-active { color: var(--bl-sh-accent); background: var(--bl-sh-accent-bg); }
.bl-sh-msg-chip svg { width: 16px; height: 16px; }
.bl-sh-msg-badge {
  position: absolute;
  top: -2px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #ef4444;
  color: white;
  font-size: 9px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bl-sh-bg);
  box-sizing: border-box;
  font-family: inherit;
}

/* Active Conferences chip — appears only when the user has rooms in flight.
   Inherits .bl-sh-msg-chip layout; adds a live-state pulse when the user is
   currently joined to one of them. */
.bl-sh-conf-chip.is-live {
  color: #22c55e;
  animation: bl-sh-conf-live-pulse 1.6s ease-in-out infinite;
}
@keyframes bl-sh-conf-live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); }
  50%      { box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

/* Conference popover — opened by the "Active calls" item inside the
   My Desk dropdown. Position-fixed so it floats over the page;
   anchors loosely under the My Desk tab area. */
.bl-sh-conf-pop {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9100;
  min-width: 320px;
  max-width: 420px;
  background: var(--bl-sh-bg);
  border: 1px solid var(--bl-sh-border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,.22);
  padding: 6px;
  font-family: inherit;
}
.bl-sh-conf-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
}
.bl-sh-conf-row + .bl-sh-conf-row {
  border-top: 1px solid var(--bl-sh-border);
}
.bl-sh-conf-row:hover { background: var(--bl-sh-bg-hover); }
.bl-sh-conf-row-main { flex: 1; min-width: 0; }
.bl-sh-conf-row-title {
  font-weight: 600; font-size: 13px;
  color: var(--bl-sh-fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bl-sh-conf-row-sub {
  font-size: 11px; color: var(--bl-sh-fg-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.bl-sh-conf-row-role {
  font-size: 10px;
  color: var(--bl-sh-fg-dim);
  letter-spacing: .3px;
  text-transform: uppercase;
  margin-top: 2px;
}
.bl-sh-conf-join {
  background: #16a34a; color: #fff;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.bl-sh-conf-join:hover { background: #15803d; }
