/* Shared header layout: fixed sequence and one recent screen, across all roles.
 * Palette is supplied by application_theme.css; field widths are independent.
 */
@media screen {
  #hms-global-header .global-shell-search {
    display:flex; flex-wrap:nowrap; align-items:center;
    width:100% !important; max-width:none !important;
    margin:0; gap:3ch !important;
  }
  #hms-global-header .global-shell-home { flex:0 0 auto; }
  #hms-global-header .global-shell-search-cluster {
    display:flex; flex:0 1 380px; width:380px; min-width:160px;
    align-items:center; flex-direction:row; gap:0;
  }
  #hms-global-header .search-wrap {
    flex:1 1 auto; width:100%; min-width:0; max-width:380px !important;
  }
  #hms-global-header .search-row { width:100%; }
  #hms-global-header .search-input { width:100%; min-width:0; margin:0; }
  #hms-global-header #hms-recent-menu {
    flex:0 1 260px; min-width:0; max-width:260px; order:0;
  }
  #hms-global-header #hms-recent-list {
    padding:0; overflow:visible; min-width:0; display:flex;
  }
  #hms-global-header #hms-recent-list .hms-recent-screen {
    width:auto; max-width:100%; min-width:0; flex:0 1 auto;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }
  #hms-global-header .global-shell-actions {
    display:flex; flex:0 0 auto; flex-wrap:nowrap; width:auto;
    margin-left:auto; gap:8px; justify-content:flex-end; align-items:center;
  }
  #hms-global-header .global-shell-action,
  #hms-global-header .global-shell-notify-btn { min-height:38px; }
  #hms-global-header [hidden] { display:none !important; }
  .hms-visually-hidden {
    position:absolute !important; width:1px !important; height:1px !important;
    padding:0 !important; margin:-1px !important; overflow:hidden !important;
    clip:rect(0,0,0,0) !important; white-space:nowrap !important; border:0 !important;
  }
}
@media screen and (max-width:900px) {
  #hms-global-header .global-shell-search { gap:1.5ch !important; }
  #hms-global-header .global-shell-search-cluster { flex:1 1 220px; width:220px; }
  #hms-global-header #hms-recent-menu { flex:0 1 160px; max-width:160px; }
  #hms-global-header .global-shell-action { padding-left:9px; padding-right:9px; }
}
@media screen and (max-width:660px) {
  #hms-global-header .global-shell-search { display:grid; grid-template-columns:auto minmax(0,1fr); gap:7px 12px !important; }
  #hms-global-header .global-shell-home { grid-column:1; grid-row:1; }
  #hms-global-header .global-shell-search-cluster { grid-column:2; grid-row:1; width:100%; min-width:0; }
  #hms-global-header .search-wrap { max-width:none !important; }
  #hms-global-header #hms-recent-menu { grid-column:1; grid-row:2; max-width:100%; }
  #hms-global-header .global-shell-actions { grid-column:2; grid-row:2; gap:6px; }
  #hms-global-header #hms-recent-list .hms-recent-screen { max-width:112px; font-size:11px; }
}
@media print { #hms-global-header { display:none !important; } }

/* Keep quick Stock and Reports together without colliding with recent screens. */
@media screen and (max-width:660px){
 #hms-global-header #hms-recent-menu{grid-column:1/-1;grid-row:3}
 #hms-global-header .global-shell-actions{grid-column:1/-1;grid-row:2;justify-content:flex-end;flex-wrap:wrap;min-width:0;max-width:100%}
 #hms-global-header #hms-recent-list .hms-recent-screen{max-width:100%}
}
