/* ==========================================================================
   App header — the only stylesheet for the top bar (all breakpoints).
   Markup: index.html .topbar > .wrap > .brand | .pearl-search-group | .spacer | #headerActions
   Modules render their buttons into #headerActions (reminders, help, profile).
   ========================================================================== */

.topbar{
  position:sticky; top:0; z-index:var(--z-header);
  color:var(--header-ink);
  background:linear-gradient(180deg, var(--header-bg), var(--header-bg-2));
  border-bottom:1px solid rgba(255,255,255,.06);
  box-shadow:0 6px 20px rgba(28,25,46,.14);
  padding-top:env(safe-area-inset-top, 0px);
}
.topbar > .wrap{
  max-width:none; margin:0;
  display:flex; align-items:center; gap:var(--space-3);
  min-height:64px;
  padding:10px 20px;
}
.topbar .spacer{ flex:1 1 auto; min-width:8px; }

/* ---- Brand ---- */
.topbar .brand{ display:flex; align-items:center; gap:var(--space-3); flex:0 0 auto; min-width:0; }
.topbar .brand .t{ display:none; }
.logoWrap{
  position:relative; display:inline-flex; align-items:center; justify-content:center;
  width:40px; height:40px; flex:0 0 auto; border-radius:var(--radius-sm);
  transition:transform var(--dur) var(--ease-out);
}
.logoWrap:hover{ transform:scale(1.06); }
.logo{
  width:100%; height:100%; display:block;
  background:transparent url('/icon.ico') center / contain no-repeat;
}
body.bm-style-spring .logoWrap .logo{ background-image:url('/spring.ico'); }
body.bm-style-winter .logoWrap .logo{ background-image:url('/winter.ico'); }

.bmExternalBrandTitle[hidden]{ display:none; }
body.bmExternalUser .logoWrap{
  width:36px; height:36px; border:1px solid var(--header-ctl-border); border-radius:11px; background:var(--header-ctl);
}
body.bmExternalUser .bmExternalBrandTitle:not([hidden]){
  min-width:0; max-width:min(38vw,390px); display:flex; align-items:center; gap:8px; white-space:nowrap;
}
.bmExternalBrandName{ overflow:hidden; text-overflow:ellipsis; font:800 14px/1.05 var(--font); letter-spacing:-.025em; }
.bmExternalBrandProduct{
  flex:0 0 auto; min-height:19px; padding:0 7px; display:inline-flex; align-items:center;
  border:1px solid var(--header-ctl-border); border-radius:var(--radius-pill); background:var(--header-ctl);
  color:var(--header-ink-2); font:800 7.5px/1 var(--font); letter-spacing:.12em; text-transform:uppercase;
}

/* ---- Search group: scope switch + field + Pearl Hunt launcher ---- */
.pearl-search-group{ display:flex; align-items:center; gap:10px; flex:0 1 560px; min-width:0; }
.globalSearchWrap{ position:relative; display:flex; align-items:center; flex:1 1 auto; min-width:0; }
.globalSearchWrap > .bmSearchFieldWrap{ flex:1 1 auto; min-width:0; }
.globalSearchWrap .search{
  width:100%; min-width:0; height:var(--ctl-lg);
  padding:0 40px 0 88px;
  border:1px solid rgba(255,255,255,.2); border-radius:var(--radius-pill);
  background:#fff; color:var(--text);
  font:500 14px/1 var(--font); letter-spacing:.1px; outline:none;
  box-shadow:var(--shadow-sm);
  transition:box-shadow var(--dur) var(--ease);
}
.globalSearchWrap .search::placeholder{ color:rgba(38,38,56,.5); }
.globalSearchWrap .search:focus{ box-shadow:0 0 0 4px rgba(255,255,255,.2), var(--shadow-md); }

/* the inactive field is not rendered at all */
.globalSearchWrap[data-scope="hotels"] #contactQ,
.globalSearchWrap[data-scope="hotels"] .bmSearchFieldWrap:has(#contactQ),
.globalSearchWrap[data-scope="contacts"] #q,
.globalSearchWrap[data-scope="contacts"] .bmSearchFieldWrap:has(#q){ display:none; }

.bmSearchScope{
  position:absolute; left:5px; top:50%; z-index:2;
  display:flex; padding:3px; border-radius:var(--radius-pill);
  background:rgba(63,60,87,.07);
  transform:translateY(-50%);
}
.bmSearchScopeBtn{
  position:relative; z-index:1;
  width:36px; height:28px; padding:0; border:0; border-radius:var(--radius-pill);
  display:grid; place-items:center;
  background:transparent; color:rgba(63,60,87,.55); cursor:pointer;
  transition:color var(--dur) var(--ease);
}
.bmSearchScopeBtn svg{ width:16px; height:16px; }
.bmSearchScopeBtn:hover{ color:var(--accent2); }
.bmSearchScopeBtn[aria-pressed="true"]{ color:#fff; }
.bmSearchScopeBtn:focus-visible{ outline:none; box-shadow:var(--focus-ring); }
.bmSearchScopeThumb{
  position:absolute; top:3px; left:3px; width:36px; height:28px;
  border-radius:var(--radius-pill); background:var(--accent2);
  box-shadow:0 3px 8px rgba(42,39,55,.25);
  transition:transform var(--dur-slow) var(--ease-spring);
}
.globalSearchWrap[data-scope="contacts"] .bmSearchScopeThumb{ transform:translateX(36px); }
.bmSearchScope[hidden]{ display:none; }
.globalSearchWrap:has(.bmSearchScope[hidden]) .search{ padding-left:20px; }

body.bmExternalUser .topbar .globalSearchWrap,
body.bmExternalUser .pearl-search-group #pearlHuntLaunch{ display:none; }

/* ---- Actions ---- */
.appHeaderActions{ display:flex; align-items:center; gap:8px; flex:0 0 auto; }
.appHeaderActions > *{ flex:0 0 auto; }
#updatedPill{ order:1; }
#headerAnimationToggle{ order:2; }
#bmSpoReminderBtn{ order:3; }
.spoBtnWrap{ order:4; }
#bmDashboardLayoutBtn{ order:5; }
#dashboardHelpBtn{ order:6; }
#settingsBtn{ order:7; }
.bmProfileHolder{ order:8; }
#logoutBtn{ order:9; }

/* shared look of every control on the dark band */
.topbarIconBtn,
.bmProfileBtn,
.spoBtn,
.headerAnimBtn,
#bmSpoReminderBtn{
  position:relative;
  height:var(--ctl-md); min-width:var(--ctl-md);
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border:1px solid var(--header-ctl-border); border-radius:var(--radius-sm);
  background:var(--header-ctl); color:var(--header-ink);
  font:700 12px/1 var(--font); letter-spacing:.01em; white-space:nowrap;
  cursor:pointer;
  transition:background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.topbarIconBtn:hover,
.bmProfileBtn:hover,
.spoBtn:hover,
.headerAnimBtn:hover,
#bmSpoReminderBtn:hover{ background:var(--header-ctl-hover); border-color:rgba(255,255,255,.22); }
.topbarIconBtn:active,
.bmProfileBtn:active,
.spoBtn:active,
#bmSpoReminderBtn:active{ transform:scale(.96); }
.topbarIconBtn:focus-visible,
.bmProfileBtn:focus-visible,
.spoBtn:focus-visible,
#bmSpoReminderBtn:focus-visible{ outline:none; box-shadow:0 0 0 3px rgba(255,255,255,.28); }
.topbarIconBtn:disabled{ opacity:.4; cursor:not-allowed; }

.topbarIconBtn{ width:var(--ctl-md); padding:0; }
.topbarIconBtn svg{ width:18px; height:18px; display:block; }
#logoutBtn.bmTopbarLogoutBtn{ display:none; }   /* sign out lives in the profile menu */
.bmDashboardLayoutTopBtn svg{ width:16px; height:16px; }

/* updated / animation chips */
.topbar .pill{
  display:inline-flex; align-items:center; gap:6px; height:30px; padding:0 12px;
  border-radius:var(--radius-pill); border:1px solid var(--header-ctl-border); background:transparent;
  color:var(--header-ink-2); font:600 11.5px/1 var(--font);
}
.topbar .pill .muted{ color:rgba(255,255,255,.55); }
.topbar .pill #updatedAt{ font-variant-numeric:tabular-nums; color:var(--header-ink); }
.headerAnimBtn{ padding:0 14px; border-radius:var(--radius-pill); }
.headerAnimBtn .dot{ width:8px; height:8px; border-radius:50%; background:currentColor; opacity:.8; }
.headerAnimBtn[data-enabled="0"]{ opacity:.72; }

/* profile */
.bmProfileHolder{ position:relative; display:inline-flex; align-items:center; }
.bmProfileBtn{ width:var(--ctl-md); padding:0; overflow:hidden; font-size:13px; font-weight:800; }
.bmProfileBtn img{ width:100%; height:100%; object-fit:cover; display:block; }

/* help */
#dashboardHelpBtn{ display:none; }
#dashboardHelpBtn.bmHelpVisible{ display:inline-flex; }
#dashboardHelpBtn .bmHelpQuestionIcon{ width:19px; height:19px; display:block; }
#dashboardHelpBtn .bmHelpQuestionIcon circle,
#dashboardHelpBtn .bmHelpQuestionIcon path{ fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
#dashboardHelpBtn .bmHelpNewDot{
  position:absolute; right:4px; top:4px; width:7px; height:7px; border-radius:50%;
  background:#9C8CFF; box-shadow:0 0 0 2px var(--header-bg);
}

/* workspace messages / SPO board launcher */
.spoBtnWrap{ position:relative; display:inline-flex; align-items:center; isolation:isolate; }
.spoBtn{ padding:0 13px 0 11px; }
.spoBtn .spoBtnIcon{ display:inline-flex; width:18px; height:18px; }
.spoBtn .spoBtnIcon svg{ width:18px; height:18px; display:block; }
.spoBtnDot{
  width:8px; height:8px; flex:0 0 8px; border-radius:50%;
  background:#A89BFF; box-shadow:0 0 0 4px rgba(168,155,255,.18);
}
.spoUnreadBadge{
  position:absolute; top:-7px; right:-7px; z-index:2;
  min-width:19px; height:19px; padding:0 5px; border-radius:var(--radius-pill);
  display:none; align-items:center; justify-content:center;
  background:#FF5B7D; color:#fff; font:800 10.5px/1 var(--font);
  box-shadow:0 0 0 2px var(--header-bg); pointer-events:none;
}
.spoUnreadBadge.show{ display:flex; animation:bmBadgePop .35s var(--ease-spring); }
@keyframes bmBadgePop{ from{ transform:scale(.4); opacity:0; } to{ transform:none; opacity:1; } }
.spoMobileOnly{ display:none; }

/* SPO / contract reminders — tone tints on the dark band */
#bmSpoReminderBtn{ padding:0 12px; }
#bmSpoReminderBtn .bmSpoReminderIcon{ display:inline-flex; width:17px; height:17px; }
#bmSpoReminderBtn .bmSpoReminderIcon svg{ display:block; width:17px; height:17px; }
#bmSpoReminderBtn .bmSpoReminderLabel{ display:none; font-weight:800; }
#bmSpoReminderBtn.hasItems .bmSpoReminderLabel{ display:inline; }
#bmSpoReminderBtn .bmSpoReminderSecondary{ display:none; opacity:.7; font-size:10.5px; font-weight:700; }
#bmSpoReminderBtn .bmSpoReminderSecondary:not(:empty){ display:inline; padding-left:8px; border-left:1px solid currentColor; }
#bmSpoReminderBtn[data-tone="release"]{ background:rgba(126,214,165,.16); border-color:rgba(126,214,165,.38); color:#BDF0D2; }
#bmSpoReminderBtn[data-tone="expired"]{ background:rgba(255,128,140,.15); border-color:rgba(255,128,140,.38); color:#FFC9CF; }
#bmSpoReminderBtn[data-tone="expiring"]{ background:rgba(255,196,102,.15); border-color:rgba(255,196,102,.38); color:#FFE0AE; }
#bmSpoReminderBtn[data-tone="upcoming"]{ background:rgba(180,170,255,.15); border-color:rgba(180,170,255,.36); color:#DCD6FF; }

/* ---- Breakpoints ---- */
@media (max-width:1280px){
  .spoBtn .spoBtnLabel{ display:none; }
  .spoBtn{ width:var(--ctl-md); padding:0; }
  .spoBtn .spoBtnDot{ display:none; }
  #updatedPill{ display:none; }
}
@media (max-width:1100px){
  .topbar > .wrap{ flex-wrap:wrap; row-gap:10px; }
  .pearl-search-group{ order:10; flex:1 0 100%; }
  #bmSpoReminderBtn .bmSpoReminderSecondary{ display:none; }
}
@media (max-width:760px){
  .topbar{ position:relative; }
  .topbar > .wrap{ padding:8px 12px 12px; gap:8px; row-gap:10px; min-height:0; }
  .appHeaderActions{ gap:6px; }
  #headerAnimationToggle, #bmDashboardLayoutBtn{ display:none; }
  .spoDesktopOnly{ display:none; }
  .spoMobileOnly{ display:inline-flex; }
  #bmSpoReminderBtn{ width:var(--ctl-md); padding:0; }
  #bmSpoReminderBtn.hasItems .bmSpoReminderLabel,
  #bmSpoReminderBtn .bmSpoReminderSecondary:not(:empty){ display:none; }
  .globalSearchWrap .search{ font-size:16px; }   /* no iOS zoom on focus */
  body.bmExternalUser .bmExternalBrandTitle:not([hidden]){ max-width:48vw; gap:6px; }
  .bmExternalBrandName{ font-size:12px; }
  .bmExternalBrandProduct{ display:none; }
}
@media (max-width:380px){
  .topbar > .wrap{ padding-left:10px; padding-right:10px; }
  .appHeaderActions{ gap:5px; }
  .topbarIconBtn, .bmProfileBtn, .spoBtn, #bmSpoReminderBtn{ --ctl-md:36px; }
}

/* external (partner) accounts */
body.bmExternalUser.bmAccessNoHotels .globalSearchWrap,
body.bmExternalUser #updatedPill,
body.bmExternalUser #dashboardHelpBtn{ display:none; }
body.bmExternalUser .bmProfileHolder{ gap:9px; }
