/* ── База шапки и переключателя заведений (перенос из views.js) ── */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: calc(var(--topbar-h, 64px) + var(--sat, env(safe-area-inset-top, 0px)));
  padding: var(--sat, env(safe-area-inset-top, 0px)) 12px 0;
  box-sizing: border-box;
  background: var(--topbar-bg, transparent);
  color: var(--topbar-color, var(--ink));
  border-bottom: var(--topbar-border, none);
  top: 0;
  z-index: 90;
  box-shadow: none;
}
.topbar .venueWrap {
  position: relative;
  order: 1;
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  justify-content: flex-start;
}
.topbar .brand {
  order: 2;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: static;
  transform: none;
}
.topbar #profileTopBtn {
  order: 3;
  flex: 0 0 auto;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topbar #modeSeg {
  order: 10;
  flex: 1 1 100%;
}
.venueToggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: var(--venue-toggle-border, 1.5px solid var(--line));
  background: var(--venue-toggle-bg, var(--card, #FFFFFF));
  color: var(--venue-toggle-color, var(--ink));
  box-shadow: var(--venue-toggle-shadow, none);
  border-radius: 999px;
  padding: 0 12px;
  height: calc(var(--topbar-h, 64px) - 20px);
  font: 700 calc(var(--topbar-h, 64px) * 0.22) "Golos Text", system-ui, sans-serif;
  cursor: pointer;
  transition: background .2s, transform .2s, border-color .2s;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.venueToggle:hover {
  background: #F5F5F5;
  transform: translateY(-1px);
}
.venueToggle .vt-arrow {
  font-size: 9px;
  transition: transform .2s;
}
.venueToggle[aria-expanded="true"] .vt-arrow {
  transform: rotate(180deg);
}
.venueWrap #brandSeg {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 1000;
  box-sizing: border-box;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: max-content;
  min-width: min(176px, calc(100vw - 24px));
  max-width: min(232px, calc(100vw - 24px));
  border: var(--venue-menu-border, 1px solid var(--line));
  border-radius: 16px;
  background: var(--venue-menu-bg, var(--card, #FFFFFF));
  box-shadow: var(--venue-menu-shadow, 0 12px 28px rgba(16, 20, 24, .18));
  padding: 7px;
  animation: fadeIn .2s ease;
}
.venueWrap #brandSeg.open {
  display: flex;
}
.venueWrap #brandSeg button {
  box-sizing: border-box;
  align-self: stretch;
  width: auto;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  font: 650 13px/1.2 var(--venue-option-font, "Golos Text"), system-ui, sans-serif;
  background: transparent;
  color: var(--venue-option-color, var(--ink));
  text-align: left;
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  cursor: pointer;
}
.venueWrap #brandSeg button:hover {
  background: var(--venue-option-hover-bg, rgba(0, 0, 0, .05));
}
.venueWrap #brandSeg button.on {
  border: var(--venue-option-active-border, 1px solid transparent);
  border-radius: 9px;
  background: var(--venue-option-active-bg, var(--tint-cool));
  color: var(--venue-option-active-color, var(--flame));
  box-shadow: var(--venue-option-active-shadow, none);
  font-weight: 750;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (min-width: 821px) {
  header.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  align-content: center;
  gap: 8px;
  padding: 8px 18px;
}
.topbar {
  grid-template-rows: 64px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  align-content: center;
  gap: 8px;
  padding: 8px 18px;
}
  .topbar .venueWrap {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    order: 0;
    min-width: 0;
  }
  .topbar .brand {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    margin-right: 0;
    order: 0;
    flex: none;
    min-width: 0;
    max-width: 100%;
  }
  .topbar #modeSeg:not([hidden]) {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    margin-top: 4px;
  }
  .topbar #mbonusBtn {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    order: 0;
    margin: 0 56px 0 0;
    position: static;
    width: auto;
    max-width: none;
    height: 44px;
    padding: 0 14px;
    flex-direction: row;
    border-radius: 999px;
    align-self: center;
  }
  .topbar #profileTopBtn {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    order: 0;
    position: static;
    margin: 0;
    margin-left: 0;
    align-self: center;
  }
}
/* ── Кнопки заказа доставки и чипсы добавок (перенос из views.js) ── */
#deliveryGrid .cta {
  background: var(--card-bg, #FFFFFF);
  border: var(--card-border, 1.5px solid var(--line));
  color: var(--ink, #101418);
  border-radius: 12px;
  padding: 12px;
  min-height: 44px;
  font: 700 14px "Golos Text", system-ui, sans-serif;
  cursor: pointer;
  box-shadow: none;
  transition: background .15s, border-color .15s, color .15s;
}
#deliveryGrid .cta:active {
  transform: translateY(1px);
}
#deliveryGrid .cta:disabled {
  background: #EDF2F6;
  border-color: var(--line);
  color: #8B98A5;
  cursor: not-allowed;
  transform: none;
}
#deliveryGrid .cta.incart {
  border: var(--cta-border, var(--card-border));
  color: var(--flame);
}
#deliveryGrid .cta.added {
  background: var(--btn-fire-bg, var(--flame));
  border: var(--btn-fire-border, var(--card-border));
  color: var(--btn-fire-color, #FFFFFF);
}
.addonChip {
  display: inline-block;
  border: 1.5px solid var(--line);
  background: #FFFFFF;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  margin: 0 6px 6px 0;
}
.addonChip b {
  color: var(--flame);
}


/* One canonical mobile header grid for both brands; critical CSS mirrors 160-06. */
@media (max-width: 820px) {
  :root { --topbar-h: 60px; }
  html body header.topbar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: 52px 0;
    align-items: center;
    align-content: center;
    gap: 0 8px;
    width: 100%;
    max-width: none;
    height: calc(60px + var(--sat, env(safe-area-inset-top, 0px)));
    min-height: calc(60px + var(--sat, env(safe-area-inset-top, 0px)));
    margin: 0;
    padding: calc(var(--sat, env(safe-area-inset-top, 0px)) + 4px) 12px 0;
    box-sizing: border-box;
    border-radius: 0;
    border-bottom: none;
    box-shadow: none;
  }
  html body header.topbar > #brandSeg { display: none; }
  html body header.topbar > #brandSeg,
  html body header.topbar > .venueWrap {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    order: 1;
    min-width: 0;
  }
  html body header.topbar .venueWrap {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-start;
  }
  html body header.topbar .brand,
  html body header.topbar #headerBrand.brand {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    order: 2;
    margin: 0;
    min-width: 0;
    max-width: 100%;
    height: 52px;
    min-height: 52px;
    max-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  html body header.topbar #profileTopBtn {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    order: 3;
    margin: 0;
    margin-left: 0;
    position: static;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    max-width: 32px;
    min-height: 32px;
    max-height: 32px;
    padding: 0;
  }
  html body header.topbar #modeSeg {
    grid-column: 1 / -1;
    grid-row: 2;
    order: 10;
    justify-self: center;
    width: max-content;
    max-width: 100%;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    padding: 0;
    overflow-x: auto;
  }
  html[data-staff-role] body header.topbar {
    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 .brand,
  html[data-staff-role] body header.topbar #headerBrand.brand {
    height: 52px;
    min-height: 52px;
    max-height: 52px;
  }
}


/* Place the role switcher in the wordmark column when no menu heading is visible. */
@media (max-width: 820px) {
  html[data-staff-role] body header.topbar.has-mode-switcher > #headerBrand.brand { display:none; }
  html[data-staff-role] body header.topbar.has-mode-switcher > #modeSeg {
    grid-column:2; grid-row:1; justify-self:center; align-self:center;
    display:flex; width:max-content; max-width:min(100%,250px);
    height:32px; min-height:32px; max-height:32px;
    margin:0; padding:0; align-items:center; justify-content:center;
    overflow-x:auto; overflow-y:hidden;
  }
  html[data-staff-role] body header.topbar.has-mode-switcher > #modeSeg button {
    flex:0 0 auto; width:auto; min-width:0; max-width:none;
    height:32px; min-height:32px; max-height:32px; padding:0 5px;
    font-size:9px; white-space:nowrap;
  }
  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;
  }
}

/* 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;
  }
}

/* Keep one safe-area reservation for every iOS standalone session, guest or staff. */
@media (max-width:820px) {
  html.is-ios-standalone body header.topbar,
  html.is-ios-standalone[data-staff-role] body header.topbar,
  html.is-ios-standalone[data-staff-role] body header.topbar.has-mode-switcher {
    position:sticky;
    top:0;
    height:calc(60px + var(--sat, env(safe-area-inset-top, 0px)));
    min-height:calc(60px + var(--sat, env(safe-area-inset-top, 0px)));
    max-height:calc(60px + var(--sat, env(safe-area-inset-top, 0px)));
    grid-template-rows:52px 0;
    padding:calc(var(--sat, env(safe-area-inset-top, 0px)) + 4px) 12px 0;
    align-content:center;
  }

  html body header.topbar {
    grid-template-columns:minmax(52px,1fr) minmax(0,auto) minmax(52px,1fr);
  }

  html body header.topbar > #topbar-actions {
    grid-column:3;
    grid-row:1;
    justify-self:end;
    align-self:center;
    display:flex;
    flex:0 0 auto;
    align-items:center;
    justify-content:flex-end;
    gap:8px;
    width:max-content;
    max-width:100%;
    min-width:0;
    margin:0;
    padding:0;
    position:relative;
    z-index:2;
    box-sizing:border-box;
  }

  html body header.topbar > #topbar-actions > #profileTopBtn {
    display:grid;
    flex:0 0 var(--tap-hit);
    width:var(--tap-hit);
    min-width:var(--tap-hit);
    max-width:var(--tap-hit);
    height:var(--tap-hit);
    min-height:var(--tap-hit);
    max-height:var(--tap-hit);
    margin:0;
    padding:0;
    place-items:center;
    position:static;
    transform:none;
  }

  html body header.topbar > #topbar-actions > #mbonusBtn {
    flex:0 0 auto;
    min-width:44px;
    max-width:100%;
    margin:0;
    align-self:center;
  }

  html body header.topbar .venueWrap > #venueToggle.venueToggle {
    box-sizing:border-box;
    flex:0 0 52px;
    width:52px;
    min-width:52px;
    max-width:52px;
    height:48px;
    min-height:48px;
    max-height:48px;
    margin:0;
    padding:0;
    align-self:center;
    justify-content: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 {
    box-sizing:border-box;
    flex:0 0 44px;
    width:44px;
    min-width:44px;
    max-width:44px;
    height:44px;
    min-height:44px;
    max-height:44px;
  }
}