/* Staff actions stay in one compact, horizontally scrollable mobile strip. */
html body #adminBar.adminBar:not([hidden]) {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  margin: 0 0 12px;
  padding: 0;
  position: static;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  box-sizing: border-box;
}
html body #adminBar.adminBar::-webkit-scrollbar {
  display: none;
}
html body #adminBar.adminBar > button,
html body #editToggle,
html body #promoToggle,
html body #dashToggle,
html body #chatsToggle2 {
  position: static;
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  min-width: 0;
  min-height: 44px;
  height: 44px;
  margin: 0;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 12px;
  box-sizing: border-box;
}

/* Staff timestamp stays beside the menu title at every width. */
@media (max-width:820px) {
  html[data-staff-role] body :is(#menuView,#deliveryView) .menu-head .menu-title-group > .upd {
    display:inline-flex;
    flex:0 1 auto;
    min-width:0;
    margin:0;
    padding:0;
    white-space:nowrap;
  }
}

/* The edit action is a 32px icon in the mobile menu row; 44px text controls remain on desktop. */
#adminBar #editToggle { order:4; }
@media (max-width:820px) {
  #adminBar #editToggle {
    flex:0 0 32px;
    width:32px;
    min-width:32px;
    max-width:32px;
    height:32px;
    min-height:32px;
    max-height:32px;
    padding:0;
    font-size:0;
    border-radius:9px;
  }
  #adminBar #editToggle::before { content:"✏️"; font-size:15px; line-height:1; }
}
/* Скрываем распирающий карточку текстовый бейдж внутри .upd (режим уже виден в #modeSeg и #adminBar) */
.menu-head .upd #adminBadge,
.menu-head .adminBadge {
  display: none;
}
html body div.wrap > section {
  grid-column: 2;
  min-width: 0;
  width: 100%;
}

/* 4. Широкая гармоничная шапка .menu-head в обоих брендах */
.menu-head,
#menuView .menu-head,
#deliveryView .menu-head {
  animation: none;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 2px 0 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #FFFFFF 0%, var(--panel, #F3F8FC) 100%);
  border: 1.5px solid var(--line, #D8DFE4);
  box-shadow: 0 6px 20px -8px rgba(16, 20, 24, 0.08);
}
@media (max-width: 820px) {
  :root {
    --menu-rail-width: 80px;
    --menu-rail-gap: 10px;
  }
  html body #menuView .menu-head,
  html body #deliveryView .menu-head {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
  }
}
.menu-head .mh-top,
#menuView .menu-head .mh-top,
#deliveryView .menu-head .mh-top {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}
.menu-head .mh-top > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  width: 100%;
}
.menu-head h1 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  font: 800 clamp(20px, 2.8vw, 28px)/1.15 "Unbounded", "Golos Text", system-ui, sans-serif;
  color: #123a6b;
}
.menu-head h1 em {
  display: inline-flex;
  align-items: center;
  font: 700 10.5px/1.2 "Golos Text", system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(62, 143, 208, 0.12);
  color: var(--ocean, #1F4E8C);
  border: 1px solid rgba(62, 143, 208, 0.28);
  border-bottom: 1px solid rgba(62, 143, 208, 0.28);
  max-width: 100%;
  white-space: normal;
  box-sizing: border-box;
}
.menu-head .upd {
  margin: 0 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(47, 125, 79, 0.08);
  border: 1px solid rgba(47, 125, 79, 0.2);
  font: 600 11.5px/1.3 "Golos Text", system-ui, sans-serif;
  white-space: nowrap;
  color: var(--soft);
  letter-spacing: 0.02em;
  text-transform: none;
}
/* A timestamp inside the title group belongs directly under the heading, never auto-pushed right. */
.menu-head .menu-title-group > .upd {
  margin: 0;
  align-self: flex-start;
}
.menu-head .mh-top .mh-right,
#menuView .menu-head .mh-top .mh-right,
#deliveryView .menu-head .mh-top .mh-right,
.menu-head .mh-top .search,
#menuView .menu-head .mh-top .search,
#deliveryView .menu-head .mh-top .search {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  flex: 1 1 100%;
  box-sizing: border-box;
}

/* Staff guest view: title, role switcher and edit action share one line. */
@media (max-width: 820px) {
  .menu-head .menu-controls-row {
    display:flex;
    align-items:center;
    flex-wrap:nowrap;
    gap:5px;
    width:100%;
    min-width:0;
    min-height:32px;
    margin:0 0 8px;
  }
  .menu-head .menu-controls-row > h1 {
    flex:0 0 auto;
    min-width:0;
    white-space:nowrap;
    font-size:clamp(17px,4.7vw,21px);
  }
  .menu-controls-row > .mode-seg-slot {
    display:flex;
    flex:1 1 auto;
    justify-content:flex-end;
    align-items:center;
    min-width:0;
    height:32px;
  }
  .menu-controls-row > .mode-seg-slot > #modeSeg {
    display:flex;
    flex:1 1 auto;
    width:100%;
    min-width:0;
    max-width:100%;
    height:32px;
    min-height:32px;
    max-height:32px;
    margin:0;
    padding:0;
    align-items:center;
    justify-content:flex-end;
    gap:3px;
    overflow-x:auto;
    overflow-y:hidden;
    scrollbar-width:none;
    -webkit-overflow-scrolling:touch;
  }
  .menu-controls-row > .mode-seg-slot > #modeSeg::-webkit-scrollbar { display:none; }
  .menu-controls-row > .mode-seg-slot > #modeSeg[hidden] { display:none; }
  .menu-controls-row > .mode-seg-slot > #modeSeg button {
    box-sizing:border-box;
    flex:0 0 auto;
    width:auto;
    min-width:0;
    max-width:none;
    height:32px;
    min-height:32px;
    max-height:32px;
    padding:0 5px;
    font:700 9px/1 "Golos Text",system-ui,sans-serif;
    white-space:nowrap;
    border-radius:9px;
  }
  .menu-controls-row > #editToggle {
    position:static;
    display:inline-flex;
    flex:0 0 32px;
    width:32px;
    min-width:32px;
    max-width:32px;
    height:32px;
    min-height:32px;
    max-height:32px;
    margin:0;
    padding:0;
    align-items:center;
    justify-content:center;
    border-radius:9px;
    font-size:0;
  }
  .menu-controls-row > #editToggle::before { content:"✏️"; font-size:15px; line-height:1; }
  .menu-controls-row > #editToggle.on::before { content:"✓"; font-size:15px; }
  .menu-controls-row > #adminBar[hidden] { display:none; }

  /* Compact controls only. Search fields and full-width purchase actions are excluded. */
  html body header.topbar :is(button,[role="button"],.venueToggle,.ava),
  html body #adminBar > button,
  html body #chatFab,
  html body .topbar-actions > button,
  html body #deliverySubFilter .subchip {
    box-sizing:border-box;
    height:32px;
    min-height:32px;
    max-height:32px;
    padding:0 8px;
  }
  html body #deliverySubFilter .subchip {
    width:auto;
    min-width:58px;
    max-width:none;
    flex:0 0 auto;
    padding:0 14px;
  }
  html body #mbonusBtn {
    width:56px;
    min-width:56px;
    max-width:56px;
    height:56px;
    min-height:56px;
    max-height:56px;
    padding:6px 4px;
  }
  html body header.topbar #profileTopBtn,
  html body header.topbar #venueToggle,
  html body #chatFab,
  html body .topbar-actions > button { flex:0 0 32px; }
  /* Text CTAs keep their normal dimensions; only the horizontal padding is compact. */
  html body #cartPanel :is(button,[role="button"],.btn-primary,.checkout-btn),
  html body #deliveryGrid .cta,
  html body #grid .cta {
    padding:8px 12px;
  }

}

/* Recommendation add-on controls retain their exact 44px targets inside the compact cart theme. */
@media (max-width:820px) {
  html body #cartPanel .addon-pill-card .ac-add-btn {
    box-sizing:border-box;
    flex:0 0 44px;
    width:44px;
    min-width:44px;
    max-width:44px;
    height:44px;
    min-height:44px;
    max-height:44px;
    padding:0;
  }
  html body #cartPanel .addon-pill-card .ac-stepper {
    flex:0 0 104px;
    width:104px;
    min-width:104px;
    max-width:104px;
    height:44px;
    min-height:44px;
    max-height:44px;
  }
  html body #cartPanel .addon-pill-card .ac-step {
    flex:0 0 44px;
    width:44px;
    min-width:44px;
    max-width:44px;
    height:44px;
    min-height:44px;
    max-height:44px;
    padding:0;
  }
}

/* Mobile theme: mirror the title/role and search/support rows used by first paint. */
@media (max-width:820px) {
  html body #deliveryView .menu-head .mh-top,
  html body #menuView .menu-head .mh-top {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:32px 32px;
    gap:4px;
    width:100%;
    min-width:0;
    max-width:100%;
    height:68px;
    box-sizing:border-box;
  }
  html body #deliveryView .menu-head .mh-top > div:first-child,
  html body #menuView .menu-head .mh-top > div:first-child {
    grid-column:1;
    grid-row:1;
    display:flex;
    align-items:center;
    width:100%;
    min-width:0;
    max-width:100%;
    height:32px;
    min-height:32px;
    max-height:32px;
    overflow:hidden;
  }
  html body .menu-head .menu-controls-row {
    display:flex;
    align-items:center;
    flex-wrap:nowrap;
    gap:10px;
    width:100%;
    min-width:0;
    max-width:100%;
    height:32px;
    min-height:32px;
    max-height:32px;
  }
  html body .menu-controls-row > h1 {
    flex:0 0 auto;
    min-width:0;
    white-space:nowrap;
    font-size:clamp(16px,4.4vw,19px);
    line-height:1;
  }
  html body .menu-controls-row > .mode-seg-slot {
    display:flex;
    flex:1 1 auto;
    min-width:0;
    height:32px;
    align-items:center;
    overflow:hidden;
  }
  html body .menu-controls-row > .mode-seg-slot > #modeSeg {
    display:flex;
    flex:1 1 0%;
    width:100%;
    min-width:0;
    max-width:100%;
    height:32px;
    min-height:32px;
    max-height:32px;
    margin:0;
    padding:0;
    gap:5px;
    align-items:center;
    justify-content:flex-start;
    overflow-x:auto;
    overflow-y:hidden;
    overscroll-behavior-x:contain;
    scrollbar-width:none;
    -webkit-overflow-scrolling:touch;
  }
  html body .menu-controls-row > .mode-seg-slot > #modeSeg::-webkit-scrollbar { display:none; }
  html body .menu-controls-row > .mode-seg-slot > #modeSeg[hidden] { display:none; }
  html body .menu-controls-row > .mode-seg-slot > #modeSeg button {
    box-sizing:border-box;
    flex:0 0 auto;
    width:auto;
    min-width:0;
    max-width:none;
    height:32px;
    min-height:32px;
    max-height:32px;
    padding:0 5px;
    font:700 9px/1 "Golos Text",system-ui,sans-serif;
    white-space:nowrap;
    border-radius:9px;
  }
  html body .menu-controls-row > #editToggle {
    display:inline-flex;
    flex:0 0 32px;
    width:32px;
    min-width:32px;
    max-width:32px;
    height:32px;
    min-height:32px;
    max-height:32px;
    margin:0;
    padding:0;
    align-items:center;
    justify-content:center;
    font-size:0;
  }
  html body .menu-controls-row > #editToggle::before { content:"✏️"; font-size:15px; }
  html body #deliveryView .menu-head .mh-top > .mh-right,
  html body #menuView .menu-head .mh-top > .mh-right {
    grid-column: 1;
    grid-row: 2;
    position: relative;
    display: flex;
    align-self: stretch;
    align-items: center;
    gap: 8px;
    flex: 0 1 100%;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    box-sizing: border-box;
  }
  html body #deliveryView .menu-head .mh-top > .mh-right > .search,
  html body #menuView .menu-head .mh-top > .mh-right > .search {
    display: flex;
    flex: 1 1 0%;
    width: auto;
    min-width: 0;
    max-width: 100%;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    padding: 0 10px;
    margin: 0;
    box-sizing: border-box;
  }
  html body #deliveryView .menu-head .mh-top > .mh-right > .search input,
  html body #menuView .menu-head .mh-top > .mh-right > .search input {
    flex: 1 1 0%;
    width: auto;
    min-width: 0;
    max-width: 100%;
    height: 30px;
    min-height: 30px;
    max-height: 30px;
    padding: 0;
    box-sizing: border-box;
  }
  html body #deliveryView .menu-head .mh-top > .mh-right > #chatFab.chat-fab,
  html body #menuView .menu-head .mh-top > .mh-right > #chatFab.chat-fab {
    position: relative;
    inset: auto;
    z-index: 2;
    display: inline-flex;
    flex: 0 0 32px;
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    padding: 0;
    margin: 0;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: none;
    transform: none;
    font-size: 0;
  }
  html body #deliveryView .menu-head .mh-top > .mh-right > #chatFab.chat-fab::after,
  html body #menuView .menu-head .mh-top > .mh-right > #chatFab.chat-fab::after,
  html body #deliveryView .menu-head .mh-top > .mh-right > #chatFab.chat-fab::before,
  html body #menuView .menu-head .mh-top > .mh-right > #chatFab.chat-fab::before {
    content: none;
  }
  html body #deliveryView .menu-head .mh-top > .mh-right > #chatFab.chat-fab > svg,
  html body #menuView .menu-head .mh-top > .mh-right > #chatFab.chat-fab > svg {
    display: block;
    width: 16px;
    height: 16px;
  }
  html[data-staff-role] body .menu-head .menu-title-group > .upd { display:inline-flex; }
  /* Guest menu headers preserve the 90px first-paint contract below the brand bar. */
  html body #menuView .menu-head {
    height:90px;
    min-height:90px;
    max-height:90px;
    overflow:visible;
    padding:8px 10px;
  }
  html body #deliveryView .menu-head {
    height:90px;
    min-height:90px;
    max-height:90px;
    overflow:visible;
    padding:8px 10px;
  }
  html body header.topbar #profileTopBtn { width:32px; min-width:32px; max-width:32px; height:32px; min-height:32px; max-height:32px; padding:0; flex:0 0 32px; }
  html body #deliveryView .subfilter-bar .subchip,
  html body #menuView .subfilter-bar .subchip,
  html body #deliverySubFilter .subchip {
    width:auto;
    min-width:58px;
    max-width:none;
    height:32px;
    min-height:32px;
    max-height:32px;
    padding:0 14px;
    flex:0 0 auto;
    border-radius:10px;
    background:var(--panel,#fff);
    border:1px solid var(--line,#e2e8f0);
    color:var(--ink,#20252b);
  }
  html body #deliveryView .subfilter-bar .subchip.on,
  html body #menuView .subfilter-bar .subchip.on,
  html body #deliverySubFilter .subchip.on {
    background:transparent;
    border:0;
    color:#fff;
    box-shadow:none;
  }
  html body #deliveryGrid .steprow,
  html body #grid .steprow { display:flex; justify-content:center; align-items:center; width:100%; }
  html body #deliveryGrid .steprow > .cta[data-add]:not(.incart),
  html body #grid .steprow > .cta[data-add]:not(.incart) {
    display:flex;
    align-items:center;
    justify-content:center;
    width:100%;
    min-width:0;
    max-width:100%;
    flex:1 1 100%;
    margin:0;
    box-sizing:border-box;
    padding:0 12px;
  }
}


/* Keep the mobile menu row compact; earlier generic controls must not set a 44px minimum. */
@media (max-width:820px) {
  html body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg,
  html body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg button,
  html body .menu-head .menu-controls-row > #editToggle {
    box-sizing:border-box;
    height:32px;
    min-height:32px;
    max-height:32px;
  }
  html body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg button {
    flex:0 0 auto;
    width:auto;
    min-width:0;
    max-width:none;
    padding:0 5px;
    white-space:nowrap;
  }
  html body #deliveryView #dSearch,
  html body #menuView #searchInput {
    box-sizing:border-box;
    height:30px;
    min-height:0;
    max-height:30px;
    padding:0;
    line-height:30px;
  }
}


/* The hidden attribute is authoritative during staff-role hydration. */
html body #adminBar.adminBar[hidden] { display:none; }

/* Desktop keeps the empty legacy rail collapsed, but reveals it when admin shortcuts are active. */
@media (min-width:821px) {
  html[data-staff-role] body #adminBar.adminBar:not(.has-admin-actions) {
    height:0;
    min-height:0;
    max-height:0;
    margin:0;
    padding:0;
    overflow:hidden;
  }

  html[data-staff-role] body #adminBar.adminBar.has-admin-actions:not([hidden]) {
    display:flex;
    align-items:center;
    flex-wrap:nowrap;
    gap:8px;
    width:max-content;
    max-width:100%;
    height:44px;
    min-height:44px;
    max-height:44px;
    margin:0 0 12px;
    padding:0;
    overflow:visible;
    box-sizing:border-box;
  }
}


/* Keep the menu-heading role row compact at mobile widths. */
@media (max-width:820px) {
  html body .menu-head .menu-controls-row,
  html body .menu-head .menu-controls-row > .mode-seg-slot {
    box-sizing:border-box; height:32px; min-height:32px; max-height:32px;
  }
  html body .menu-head .menu-controls-row > .mode-seg-slot {
    display:flex; flex:1 1 auto; align-items:center; min-width:0; overflow:hidden;
  }
  html body .menu-head .menu-controls-row #modeSeg,
  html body .menu-head .menu-controls-row #modeSeg button {
    box-sizing:border-box; height:32px; min-height:32px; max-height:32px;
  }
  html body .menu-head .menu-controls-row #modeSeg button {
    flex:0 0 auto; width:auto; min-width:0; max-width:none;
    padding:0 5px; white-space:nowrap;
  }
}

/* Keep the role toggle and edit shortcut compact in both the real toolbar and isolated fixtures. */
@media (max-width:820px) {
  html body #modeSeg,
  html body #modeSeg button,
  html body #editToggle {
    box-sizing:border-box;
    height:32px;
    min-height:32px;
    max-height:32px;
  }
  html body #modeSeg button {
    flex:0 0 auto;
    width:auto;
    min-width:0;
    max-width:none;
    padding:0 5px;
    white-space:nowrap;
  }
}

/* Compact role controls in the menu fixture and in the real mobile menu/header. */
@media (max-width:820px) {
  html body .menu-head #modeSeg,
  html body .menu-head #modeSeg > button,
  html body .menu-head #editToggle,
  html[data-staff-role] body header.topbar #modeSeg,
  html[data-staff-role] body header.topbar #modeSeg > button {
    box-sizing:border-box;
    height:32px;
    min-height:32px;
    max-height:32px;
  }
  html body .menu-head #modeSeg > button,
  html[data-staff-role] body header.topbar #modeSeg > button {
    flex:0 0 auto;
    width:auto;
    min-width:0;
    max-width:none;
    padding:0 5px;
    white-space:nowrap;
  }
}

/* Delivery filter buttons retain their full mobile hit cell. */
@media (max-width:820px) {
  html body #deliveryView #deliverySubFilter .subchip {
    box-sizing:border-box;
    height:44px;
    min-height:44px;
    max-height:44px;
    align-self:center;
  }
}

/* Work modes keep role switcher in the topbar's existing center cell. */
@media (max-width:820px) {
  html[data-staff-role] body header.topbar.has-mode-switcher {
    height:calc(60px + var(--sat, env(safe-area-inset-top, 0px)));
    min-height:calc(60px + var(--sat, env(safe-area-inset-top, 0px)));
    grid-template-rows:52px 0;
    align-content:center;
  }
  html[data-staff-role] body header.topbar.has-mode-switcher > #modeSeg {
    grid-column:2;
    grid-row:1;
    justify-self:center;
    align-self:center;
  }
}

/* Approved mobile storefront contract after #185: readable controls, full menu head, brand-led delivery chips. */
@media (max-width:820px) {
  html body #deliveryView .menu-head .mh-top,
  html body #menuView .menu-head .mh-top {
    grid-template-rows:32px 40px;
    height:76px;
  }
  html body #deliveryView .menu-head .mh-top > .mh-right,
  html body #menuView .menu-head .mh-top > .mh-right {
    height:40px;
    min-height:40px;
    max-height:40px;
  }
  html body #deliveryView .menu-head .mh-top > .mh-right > .search,
  html body #menuView .menu-head .mh-top > .mh-right > .search {
    height:40px;
    min-height:40px;
    max-height:40px;
  }
  html body #deliveryView .menu-head .mh-top > .mh-right > .search input,
  html body #menuView .menu-head .mh-top > .mh-right > .search input,
  html body #deliveryView #dSearch,
  html body #menuView #searchInput {
    box-sizing:border-box;
    height:36px;
    min-height:36px;
    max-height:36px;
    line-height:36px;
    padding-top:0;
    padding-bottom:0;
  }

  html body .menu-head {
    height:auto;
    min-height:0;
    max-height:none;
    overflow:visible;
  }

  html body #deliveryView #deliverySubFilter .subchip,
  html body #deliveryView .subfilter-bar .subchip {
    box-sizing:border-box;
    height:44px;
    min-height:44px;
    max-height:44px;
    border-radius:0;
    background:transparent;
    border:0;
    box-shadow:none;
    color:var(--fr-choc,var(--ink));
    padding:0 14px;
  }
  html body #deliveryView #deliverySubFilter .subchip:hover::before,
  html body #deliveryView .subfilter-bar .subchip:hover::before {
    background:var(--fr-rice,var(--panel));
  }
  html body #deliveryView #deliverySubFilter .subchip.on,
  html body #deliveryView .subfilter-bar .subchip.on {
    color:#fff;
  }
  html body #deliveryView #deliverySubFilter .subchip.on::before,
  html body #deliveryView .subfilter-bar .subchip.on::before {
    background:var(--flame);
    border-color:var(--fr-choc);
    box-shadow:2px 2px 0 var(--fr-choc);
  }

  html body header.topbar #profileTopBtn,
  html body header.topbar button#venueToggle.venueToggle {
    box-sizing:border-box;
    flex:0 0 44px;
    width:44px;
    min-width:44px;
    max-width:44px;
    height:44px;
    min-height:44px;
    max-height:44px;
    padding:0;
  }
}

/* Staff admin actions fill the entire mobile content row, including the rail gutter. */
@media (max-width:820px) {
  html[data-staff-role] body #adminBar.adminBar:not([hidden]) {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    align-items:stretch;
    gap:8px;
    width:100%;
    max-width:100%;
    min-width:0;
    margin:0 0 12px 0;
    padding:0;
    overflow:visible;
    box-sizing:border-box;
  }
  html[data-staff-role] body #adminBar.adminBar > button:not([hidden]) {
    display:inline-flex;
    box-sizing:border-box;
    flex:0 1 auto;
    width:100%;
    min-width:0;
    max-width:none;
    height:44px;
    min-height:44px;
    max-height:44px;
    margin:0;
    padding:0 6px;
    font-size:clamp(10px,2.8vw,12px);
    line-height:1;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    justify-content:center;
  }
}

@media (max-width:350px) {
  html[data-staff-role] body #adminBar.adminBar:not([hidden]) {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  html[data-staff-role] body #adminBar.adminBar > #chatsToggle2:not([hidden]) {
    grid-column:1 / -1;
  }
}

/* Late mobile admin action refinements; iOS topbar geometry is owned by 160-06. */
@media (max-width:820px) {
  html[data-staff-role] body #adminBar.adminBar > #chatsToggle2:not([hidden]) {
    grid-column:auto;
  }

  html[data-staff-role] body #adminBar.adminBar > #promoToggle:not([hidden]),
  html[data-staff-role] body #adminBar.adminBar > #dashToggle:not([hidden]),
  html[data-staff-role] body #adminBar.adminBar > #chatsToggle2:not([hidden]) {
    display:inline-flex;
    box-sizing:border-box;
    width:100%;
    min-width:0;
    max-width:none;
    height:44px;
    min-height:44px;
    max-height:44px;
    margin:0;
    padding:0 6px;
    font-size:clamp(10px,2.8vw,12px);
    line-height:1;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    justify-content:center;
  }
}


/* Keep the 320px staff actions on two rows; support chats owns the full second row. */
@media (max-width:350px) {
  html[data-staff-role] body #adminBar.adminBar:not([hidden]) {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  html[data-staff-role] body #adminBar.adminBar > #promoToggle:not([hidden]),
  html[data-staff-role] body #adminBar.adminBar > #dashToggle:not([hidden]) {
    grid-column:auto;
  }
  html[data-staff-role] body #adminBar.adminBar > #chatsToggle2:not([hidden]) {
    grid-column:1 / -1;
    width:100%;
    max-width:none;
  }
}


/* All three staff shortcuts stay on one row, including narrow 320px screens. */
@media (max-width:350px) {
  html[data-staff-role] body #adminBar.adminBar:not([hidden]) {
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
  html[data-staff-role] body #adminBar.adminBar > #promoToggle:not([hidden]),
  html[data-staff-role] body #adminBar.adminBar > #dashToggle:not([hidden]),
  html[data-staff-role] body #adminBar.adminBar > #chatsToggle2:not([hidden]) {
    grid-column:auto;
    width:100%;
    min-width:0;
    max-width:none;
    padding:0 3px;
    font-size:10px;
  }
}



/* Lock the three admin shortcuts to one explicit grid row at 320px and 390px. */
@media (max-width:820px) {
  html[data-staff-role] body #adminBar.adminBar:not([hidden]) {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    grid-template-rows:44px;
    grid-auto-flow:column;
    align-items:stretch;
    overflow:visible;
  }
  html[data-staff-role] body #adminBar.adminBar > #promoToggle:not([hidden]),
  html[data-staff-role] body #adminBar.adminBar > #dashToggle:not([hidden]),
  html[data-staff-role] body #adminBar.adminBar > #chatsToggle2:not([hidden]) {
    grid-row:1;
    grid-column:auto;
    min-width:0;
    width:100%;
    max-width:none;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
}

/* Search and support remain in the second row; staff hit cells are owned by the scoped block below. */
@media (max-width:820px) {
  html body :is(#menuView,#deliveryView) .menu-head .mh-top {
    grid-template-rows: 28px 40px;
    height: 74px;
    overflow: visible;
  }
  html body :is(#menuView,#deliveryView) .menu-head .mh-top > .mh-right {
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    overflow: visible;
    align-items: center;
  }
  html body :is(#menuView,#deliveryView) .menu-head .mh-top > .mh-right > #supportLauncherHost,
  html body :is(#menuView,#deliveryView) .menu-head .mh-top > .mh-right > #supportLauncherHost > #chatFab.chat-fab {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
  }
}



/* Inactive role labels keep AAA contrast on the dark switcher surface. */
/* Inactive role labels keep AAA contrast on the dark switcher surface. */
html body #modeSeg button:not(.on) {
  color: #AFC0D0;
}



/* Shared staff title and update group: stable left alignment at every width. */
html[data-staff-role] body .menu-head .menu-title-group {
  display:flex;
  flex:0 1 auto;
  align-items:center;
  justify-content:flex-start;
  gap:4px;
  min-width:0;
}
html[data-staff-role] body .menu-head .menu-title-group > h1 {
  flex:0 1 auto;
  min-width:0;
  margin:0;
}
html[data-staff-role] body .menu-head .menu-title-group > .upd {
  display:inline-flex;
  flex:0 1 auto;
  align-items:center;
  min-width:0;
  margin:0;
  margin-left:0;
  padding:0;
  white-space:nowrap;
}

/* Desktop menu staff row: title, role switcher and edit share the menu heading above search. */
@media (min-width: 821px) {
  html[data-staff-role] body > div.wrap {
    width: 100%;
    min-width: 0;
  }

  html[data-staff-role] body :is(#menuView,#deliveryView) .menu-head {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 10px 14px;
    overflow: visible;
    box-sizing: border-box;
  }

  html[data-staff-role] body :is(#menuView,#deliveryView) .menu-head .mh-top {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    height: auto;
    min-height: 0;
    max-height: none;
  }

  html[data-staff-role] body :is(#menuView,#deliveryView) .menu-head .mh-top > div:first-child {
    display: block;
    width: 100%;
    min-width: 0;
  }

  html[data-staff-role] body .menu-head .menu-controls-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 176px 150px;
    align-items: center;
    column-gap: 16px;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    margin: 0;
  }

  html[data-staff-role] body .menu-head .menu-title-group {
    display: flex;
    grid-column: 1;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    margin: 0;
    overflow: hidden;
  }

  html[data-staff-role] body :is(#menuView,#deliveryView) .menu-head .menu-title-group > h1 {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(20px, 2.3vw, 28px);
  }

  html[data-staff-role] body .menu-head .menu-title-group > .upd {
    display: inline-flex;
    flex: 0 0 auto;
    max-width: 100%;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot {
    grid-column: 2;
    display: flex;
    justify-content: flex-end;
    flex: 0 0 176px;
    width: 176px;
    min-width: 176px;
    max-width: 176px;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    align-items: center;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    flex: 0 0 176px;
    width: 176px;
    min-width: 176px;
    max-width: 176px;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    padding: 0;
    gap: 0;
    align-items: stretch;
    justify-content: stretch;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: var(--staff-mode-track-bg, var(--esp));
    box-shadow: none;
    box-sizing: border-box;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg > button {
    display: flex;
    flex: none;
    width: auto;
    min-width: 0;
    max-width: none;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
    color: #AFC0D0;
    font: 700 10.5px/1 "Golos Text", system-ui, sans-serif;
    white-space: nowrap;
    box-sizing: border-box;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg > button::before {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg > button.on {
    position: relative;
    isolation: isolate;
    background: var(--staff-mode-active-bg);
    color: var(--staff-mode-active-color);
    box-shadow: var(--staff-mode-active-shadow);
  }

  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg > button.on::before {
    background: transparent;
    box-shadow: none;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > #editToggle {
    grid-column: 3;
    justify-self: end;
    flex: 0 0 150px;
    width: 150px;
    min-width: 150px;
    max-width: 150px;
  }

  /* Keep all four role cells inside the 176px track; no content-sized overflow. */
  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg > button {
    position: relative;
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    margin: 0;
    padding: 0 1px;
    border-radius: 999px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    box-sizing: border-box;
  }

  html[data-staff-role] body .menu-head .menu-title-group {
    align-items: flex-start;
  }

  html[data-staff-role] body :is(#menuView,#deliveryView) .menu-head .menu-title-group > .upd {
    display: inline-flex;
    flex: 0 0 auto;
    align-self: flex-start;
    width: max-content;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    margin-left: 0;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    line-height: 1.2;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > #editToggle {
    position: static;
    display: inline-flex;
    flex: 0 0 150px;
    width: 150px;
    min-width: 150px;
    max-width: 150px;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    margin: 0;
    padding: 0 12px;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 10px;
  }

  html[data-staff-role] body .menu-head .mh-top > .mh-right {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 40px;
    margin: 0;
    overflow: visible;
  }

  html[data-staff-role] body .menu-head .mh-top > .mh-right > .search {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: none;
    margin: 0;
  }
}

/* Shared mobile staff toolbar: 44px hit cells with centered 32px brand faces. */
@media (max-width: 820px) {
  html[data-staff-role] body :is(#menuView,#deliveryView) .menu-head {
    box-sizing: border-box;
    height: 108px;
    min-height: 108px;
    max-height: 108px;
    overflow: visible;
    padding: 8px 10px;
  }

  html[data-staff-role] body :is(#menuView,#deliveryView) .menu-head .mh-top {
    display: grid;
    grid-template-columns: minmax(0,1fr);
    grid-template-rows: 44px 44px;
    row-gap: 8px;
    column-gap: 0;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 96px;
    min-height: 96px;
    max-height: 96px;
    overflow: visible;
    box-sizing: border-box;
  }

  html[data-staff-role] body :is(#menuView,#deliveryView) .menu-head .mh-top > div:first-child {
    grid-column: 1;
    grid-row: 1;
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    padding: 0;
    overflow: visible;
    box-sizing: border-box;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: stretch;
    width: auto;
    min-width: 0;
    max-width: none;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    overflow: visible;
    contain: none;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: repeat(4,44px);
    grid-template-rows: 44px;
    flex: 0 0 176px;
    width: 176px;
    min-width: 176px;
    max-width: 176px;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    margin: 0;
    padding: 0;
    gap: 0;
    overflow: visible;
    background: transparent;
    border: 0;
    box-shadow: none;
    box-sizing: border-box;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 6px 0;
    border-radius: 999px;
    background: var(--staff-mode-track-bg,var(--esp));
    pointer-events: none;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg > button {
    position: relative;
    isolation: isolate;
    display: flex;
    flex: 1 1 0;
    width: 100%;
    min-width: 44px;
    max-width: none;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    margin: 0;
    padding: 6px 0;
    align-items: center;
    justify-content: center;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    box-sizing: border-box;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg > button::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 6px;
    border-radius: 9px;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg > button.on {
    color: var(--staff-mode-active-color);
  }

  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg > button.on::before {
    background: var(--staff-mode-active-bg);
    box-shadow: var(--staff-mode-active-shadow);
  }

  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg > button:focus-visible {
    outline: none;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > .mode-seg-slot > #modeSeg > button:focus-visible::before {
    outline: 2px solid var(--staff-focus-ring,var(--esp));
    outline-offset: 2px;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > #editToggle {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    margin: 0;
    padding: 6px;
    align-items: center;
    justify-content: center;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--staff-edit-color,var(--ink));
    font-size: 0;
    box-sizing: border-box;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > #editToggle::before {
    content: "✏️";
    position: relative;
    z-index: 1;
    font-size: 15px;
    line-height: 1;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > #editToggle.on::before {
    content: "✓";
  }

  html[data-staff-role] body .menu-head .menu-controls-row > #editToggle::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 6px;
    border: var(--staff-edit-border);
    border-radius: 9px;
    background: var(--staff-edit-bg);
    box-shadow: var(--staff-edit-shadow);
    pointer-events: none;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > #editToggle.on {
    color: var(--staff-edit-active-color);
  }

  html[data-staff-role] body .menu-head .menu-controls-row > #editToggle.on::after {
    background: var(--staff-edit-active-bg);
  }

  html[data-staff-role] body .menu-head .menu-controls-row > #editToggle:focus-visible {
    outline: none;
  }

  html[data-staff-role] body .menu-head .menu-controls-row > #editToggle:focus-visible::after {
    outline: 2px solid var(--staff-focus-ring,var(--esp));
    outline-offset: 2px;
  }

  html[data-staff-role] body :is(#menuView,#deliveryView) .menu-head .mh-top > .mh-right {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    margin: 0;
    padding: 0;
    overflow: visible;
    box-sizing: border-box;
  }

  html[data-staff-role] body :is(#menuView,#deliveryView) .menu-head .mh-top > .mh-right > .search {
    display: flex;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: 100%;
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    margin: 0;
    padding: 0 10px;
    box-sizing: border-box;
  }

  html[data-staff-role] body :is(#menuView,#deliveryView) .menu-head .mh-top > .mh-right > .search input,
  html[data-staff-role] body #deliveryView #dSearch,
  html[data-staff-role] body #menuView #searchInput {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: 100%;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    margin: 0;
    padding: 0;
    line-height: 36px;
    box-sizing: border-box;
  }

}


/* Staff menu update timestamp is intentionally omitted below the 520px breakpoint. */
@media (max-width: 519px) {
  html[data-staff-role] body :is(#menuView,#deliveryView) .menu-head .menu-title-group > .upd {
    display: none;
  }
}
@media (min-width: 520px) {
  html[data-staff-role] body :is(#menuView,#deliveryView) .menu-head .menu-title-group > .upd {
    display: inline-flex;
  }
}


/* Mobile avatar: retain the 44px hit cell while drawing only a 32px brand face. */
@media (max-width: 820px) {
  html body header.topbar #profileTopBtn {
    position: relative;
    isolation: isolate;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }

  html body header.topbar #profileTopBtn::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: var(--tap-extend-y) var(--tap-extend-x);
    border-radius: 50%;
    background: var(--ava-bg, linear-gradient(135deg, #3e8fd0, #123a6b));
    border: var(--ava-border, 1.5px solid #fff);
    box-shadow: var(--ava-shadow, none);
    pointer-events: none;
  }

  html body header.topbar #profileTopBtn:focus-visible {
    outline: none;
  }

  html body header.topbar #profileTopBtn:focus-visible::before {
    outline: 2px solid var(--staff-focus-ring, currentColor);
    outline-offset: 2px;
  }
}
