/* Header tools keep their geometry while search expands in the free space. */
html:root { --header-control-size:44px; }
html:root .topbar .account { flex:0 0 auto; min-width:0; }
html:root .topbar :is(#company-search-toggle,#notifications-toggle,#logout) {
  display:grid; place-items:center; flex:0 0 var(--header-control-size);
  width:var(--header-control-size); height:var(--header-control-size); min-height:var(--header-control-size);
  margin:0; padding:0; border-radius:var(--radius-md);
}
html:root .topbar #logout .ui-icon { width:20px; height:20px; stroke-width:1.7; }
html:root .topbar #profile-toggle {
  flex:0 0 auto; width:clamp(160px,28vw,240px); min-width:0; height:var(--header-control-size);
  min-height:var(--header-control-size); padding:4px 10px; gap:9px; justify-content:flex-start;
  overflow:hidden; border:1px solid var(--theme-chrome-border); border-radius:var(--radius-md);
  background:#ffffff08;
}
html:root .topbar #profile-toggle:hover { background:#ffffff12; }
html:root .topbar #header-avatar { width:32px; height:32px; }
html:root .topbar #account-name { min-width:0; max-width:none; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:left; }
html:root .topbar .company-search { flex:0 0 var(--header-control-size); width:var(--header-control-size); min-width:var(--header-control-size); }
html:root .topbar .company-search.is-open { flex:none; width:auto; }
html:root .topbar .company-search-bar { min-height:var(--header-control-size); }

@media(min-width:1101px) {
  html:root body.communication-rail-visible .topbar-inner { padding-right:0; }
  html:root body.communication-rail-visible .topbar .account {
    display:grid; grid-template-columns:var(--header-control-size) 12px var(--workspace-context-width) var(--workspace-content-inset) var(--communication-rail-width);
    gap:0; align-items:center;
  }
  html:root body.communication-rail-visible .topbar #company-search { grid-column:1; grid-row:1; }
  html:root body.communication-rail-visible .topbar #profile-toggle { grid-column:3; grid-row:1; width:100%; }
  html:root body.communication-rail-visible .topbar #logout { grid-column:5; grid-row:1; justify-self:center; border:0; background:transparent; }
  html:root body.communication-rail-visible .topbar #logout:hover { background:#ffffff12; }
}
@media(max-width:560px) {
  html:root .topbar #profile-toggle { width:var(--header-control-size); padding:5px; justify-content:center; }
  html:root .topbar .brand-family { display:none; }
}
