/* Layout-only button cleanup for the supplied 29.2.11 release. */
html body[data-b2s-button-layout] :is(
  button, input[type="submit"], input[type="button"], [role="button"],
  a.btn, a.b2s-btn, a.b2s-gh-btn, a.s04-btn, a.b2s30-card-button,
  a.b2s-session-account, a.b2s-session-signout, a.b2s-global-login,
  a.b2s-global-signup, a.b2s-guest-account-link, a.b2s-guest-logout-link,
  a.b2s2312-logout, a.b2s-mobile-guest-primary,
  .b2s394-mobile-action-set > a, .b2s-mobile-overflow-actions a
):not(:is(
  [data-password-toggle], .b2s-password-toggle, .b2s-global-password-toggle,
  .b2s28491-password-toggle, .provider-panel-close, .b2s2870-assist-close, .b2s2873-x,
  .b2s-mobile-more-button, .b2s-mobile-admin-more-button,
  .b2s-admin-menu-toggle, .b2s-admin-notification-button, .b2s-mobile-nav-close,
  .booking-dialog-close, [class*="icon-button"], [class*="backdrop"],
  [class*="overlay"], button[aria-label^="Close" i], button:has(> img), .leaflet-control *,
  .gm-style *, .maplibregl-control-container *, .mapboxgl-control-container *
)) {
  box-sizing: border-box !important;
  align-items: center !important;
  justify-content: center !important;
  align-self: center;
  gap: 8px !important;
  min-width: 0 !important;
  max-width: 100% !important;
  min-height: 44px !important;
  height: auto !important;
  max-height: none !important;
  padding: 10px 14px !important;
  border-radius: 8px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  letter-spacing: 0 !important;
  text-align: center !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  text-overflow: clip !important;
  word-break: normal !important;
  text-indent: 0 !important;
  text-decoration: none;
}

/* Account links must be flex controls, not top-aligned inline text. */
html body[data-b2s-button-layout] header.b2s-global-header[data-b2s-header-type="public"]
  .b2s-public-action-set > a {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 44px !important;
  height: auto !important;
  max-height: none !important;
  padding: 10px 14px !important;
  font-size: 14px !important;
  line-height: 1.3 !important;
  border-radius: 8px !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

@media (min-width: 821px) {
  html body[data-b2s-button-layout] header.b2s-global-header[data-b2s-header-type="public"]
    :is(.b2s-global-actions, .b2s-public-action-set) {
    flex: 0 0 auto !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding-block: 0 !important;
  }
}

html body[data-b2s-button-layout] :is(
  .b2s-public-action-set, .b2s-gh-actions, .b2s30-card-actions,
  .b2s-home-hero-actions, .actions, .button-row, .card-actions,
  .s04-actions, .s04-footer-actions, .s04-final-actions, .s04-location-secondary,
  .b2s2834-hero-actions, .admin-top-actions, .booking-dialog-actions,
  .b2s2842-share-actions, .availability-actions
) {
  min-width: 0 !important;
  max-width: 100% !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 10px !important;
}

/* Segmented controls remain compact but keep every label readable. */
html body[data-b2s-button-layout] :is(
  .b2s-map-view-btn, .b2315-map-view button, .s04-map-toolbar-btn,
  .guest-tab, .booking-filter, .b2s28190-filter, .b2s40-filter, .s04-step
) {
  padding: 10px 12px !important;
  font-size: 14px !important;
}

html body[data-b2s-button-layout] :is(
  .b2s28190-filters, .booking-filters, .b2s40-filters,
  .b2315-map-view, .b2s2057-map-view, .guest-tabs
) {
  min-width: 0 !important;
  max-width: 100% !important;
  flex-wrap: wrap !important;
}

@media (max-width: 820px) {
  html body[data-b2s-button-layout] :is(
    button, a.btn, a.b2s-btn, a.b2s-gh-btn, a.s04-btn, a.b2s30-card-button,
    a.b2s-mobile-guest-primary
  ):not(:is(
    [data-password-toggle], .b2s-password-toggle, .b2s-global-password-toggle,
  .b2s28491-password-toggle, .provider-panel-close, .b2s2870-assist-close, .b2s2873-x,
    .b2s-mobile-more-button, .b2s-mobile-admin-more-button,
    .b2s-admin-menu-toggle, .b2s-admin-notification-button, .b2s-mobile-nav-close,
    .booking-dialog-close, [class*="icon-button"], [class*="backdrop"],
    [class*="overlay"], button[aria-label^="Close" i], button:has(> img), .leaflet-control *, .gm-style *,
    .maplibregl-control-container *, .mapboxgl-control-container *
  )) {
    font-size: 14px !important;
  }

  html body[data-b2s-button-layout] :is(
    .b2s2834-hero-actions, .admin-top-actions, .s04-footer-actions,
    .s04-actions, .b2s2842-share-actions
  ) > :is(button, a.btn, a.s04-btn) {
    flex: 1 1 160px !important;
    width: auto !important;
  }

  html body[data-b2s-button-layout].admin-page :is(.admin-top, .report-section-head) {
    flex-wrap: wrap !important;
  }
  html body[data-b2s-button-layout].admin-page .admin-top .report-actions,
  html body[data-b2s-button-layout] .b2s2834-hero-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    overflow: visible !important;
  }
  html body[data-b2s-button-layout].admin-page .admin-top .report-actions > * {
    flex: 1 1 160px !important;
    min-width: 0 !important;
  }

  html body[data-b2s-button-layout] .b2s394-mobile-action-set > a {
    justify-content: center !important;
    min-height: 44px !important;
  }

  html body[data-b2s-button-layout] :is(.b2315-map-view, .b2s2057-map-view) button {
    flex: 1 1 auto !important;
    width: auto !important;
    padding-inline: 10px !important;
  }
}

html body[data-b2s-button-layout].b2s-login-page[data-b2s-form-mode="auth"]
  form.b2s-login-card .b2s-login-submit {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-height: 48px !important;
  height: auto !important;
  max-height: none !important;
  padding: 12px 16px !important;
}
html body[data-b2s-button-layout].b2s-login-page[data-b2s-form-mode="auth"]
  form.b2s-login-card .b2s-login-submit-arrow {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 20px !important;
  min-height: 0 !important;
  height: 20px !important;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1 !important;
}

html body[data-b2s-button-layout] .b2s2877-universal-banner {
  flex-wrap: wrap !important;
}
html body[data-b2s-button-layout] .b2s2877-universal-banner > .btn {
  flex: 0 1 auto !important;
  width: auto !important;
}

html body[data-b2s-button-layout][data-b2s-form-system] .s04-room-toolbar {
  flex-wrap: wrap !important;
  gap: 12px !important;
}
html body[data-b2s-button-layout][data-b2s-form-system] .s04-room-toolbar > div {
  flex: 1 1 300px !important;
  min-width: 0 !important;
}
html body[data-b2s-button-layout][data-b2s-form-system] .s04-room-toolbar > button {
  flex: 0 1 auto !important;
  width: auto !important;
}

/* Legacy map grids cannot shrink below the width of their longest label. */
html body[data-b2s-button-layout] .b23-map-card .b2315-map-view,
html body[data-b2s-button-layout] .b2s2057-map-tools,
html body[data-b2s-button-layout][data-b2s-form-system] .s04-map-toolbar {
  display: flex !important;
  flex-wrap: wrap !important;
  min-width: 0 !important;
  max-width: 100% !important;
  gap: 4px !important;
}
html body[data-b2s-button-layout] .b23-map-card .b2315-map-view button,
html body[data-b2s-button-layout] .b2s2057-map-tools .b2s-map-view-btn,
html body[data-b2s-button-layout][data-b2s-form-system] .s04-map-toolbar .s04-map-toolbar-btn {
  flex: 1 1 78px !important;
  min-width: 0 !important;
  width: auto !important;
  min-height: 44px !important;
  height: auto !important;
  max-height: none !important;
  padding: 10px 8px !important;
  font-size: 13px !important;
  line-height: 1.3 !important;
}

@media (max-width: 380px) {
  html body[data-b2s-button-layout] :is(.b2s-admin-topbar-inner, .b2s-admin-topbar-actions) {
    gap: 8px !important;
    min-width: 0 !important;
  }
  html body[data-b2s-button-layout] .b2s-admin-logo {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }
  html body[data-b2s-button-layout] .b2s-admin-logo img {
    max-width: 100% !important;
    object-fit: contain !important;
  }
  html body[data-b2s-button-layout] .guest-tabs {
    display: flex !important;
    gap: 6px !important;
  }
  html body[data-b2s-button-layout] .guest-tabs button {
    flex: 1 1 90px !important;
    width: auto !important;
  }
}

/* 29.2.11.2: shared action rows may grow instead of cropping wrapped labels. */
html body[data-b2s-button-layout] :is(
 .report-actions, .hero-links, .admin-comms-filters, .s04-map-footer-actions,
 .b2s29053-bulk-actions, .b2s2832-done-actions, .b2s2873-footer,
 .b2s28713-footer, .b2s2873-commercial-actions, .b2s2841-invite-actions,
 .b2s2844-invite-actions, .b2s-fo-hero-actions, .b2s-fo-local-actions, .b2s-fo-actions
) {
 min-width: 0 !important; max-width: 100% !important;
 flex-wrap: wrap !important; gap: 8px !important;
 height: auto !important; max-height: none !important;
}
html body[data-b2s-button-layout] :is(
 .actions, .card-actions, .report-actions, .hero-links, .s04-actions,
 .s04-final-actions, .s04-map-footer-actions, .b2s29053-bulk-actions,
 .b2s2832-done-actions, .b2s2873-footer, .b2s28713-footer,
 .b2s-fo-hero-actions, .b2s-fo-local-actions, .b2s-fo-actions
) > :is(button, a) {
 flex-shrink: 1 !important; min-width: 0 !important; max-width: 100% !important;
 box-sizing: border-box !important;
}
/* Target the original select AND clones, without changing access/routing code. */
html body[data-b2s-button-layout] select[aria-label="Switch workspace"] {
 box-sizing: border-box !important;
 display: inline-block !important; flex: 0 1 188px !important;
 width: 188px !important; min-width: 0 !important; max-width: 100% !important;
 height: 44px !important; min-height: 44px !important; max-height: 44px !important;
 margin: 0 !important; padding: 0 30px 0 12px !important;
 font-family: inherit !important; font-size: 14px !important;
 font-weight: 600 !important; line-height: normal !important;
 letter-spacing: 0 !important; border: 1px solid #927335 !important;
 border-radius: 8px !important; color: #fff !important;
 background-color: #102339 !important; vertical-align: middle !important;
 appearance: none !important;
 background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23e9d29f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
 background-repeat: no-repeat !important; background-position: right 10px center !important;
 background-size: 16px !important;
}
html body[data-b2s-button-layout] select[aria-label="Switch workspace"]:focus-visible {
 outline: 2px solid #e7b64e !important; outline-offset: 3px !important;
}
html body[data-b2s-button-layout] :is(
 .b2s-mobile-overflow-panel, details.b2s394-mobile-menu nav, .b2s-mobile-menu-panel
) select[aria-label="Switch workspace"] {
 display: block !important; width: calc(100% - 24px) !important;
 max-width: calc(100% - 24px) !important; margin: 12px !important;
}
html body[data-b2s-button-layout] :is(
 .header-actions, .provider-interest-header, .b2s-header-actions
):has(select[aria-label="Switch workspace"]) {
 min-width: 0 !important; flex-wrap: wrap !important;
 align-items: center !important; gap: 8px !important;
 height: auto !important; max-height: none !important;
}
@media (forced-colors: active) {
 html body[data-b2s-button-layout] select[aria-label="Switch workspace"] {
  appearance: auto !important; background-image: none !important;
 }
}

/* The admin mobile header has three reserved slots; keep the switcher in
   the navigation sheet there, rather than creating an overflowing fourth. */
html body[data-b2s-button-layout] #b2s-admin-navigation > select[aria-label="Switch workspace"] {
 display: block !important; width: 100% !important;
 max-width: 100% !important; margin: 0 0 16px !important;
 position: static !important;
}
@media (max-width: 1100px) {
 html body[data-b2s-button-layout] .b2s-admin-topbar-actions > select[aria-label="Switch workspace"] {
  display: none !important;
 }
}
@media (min-width: 1101px) {
 html body[data-b2s-button-layout] #b2s-admin-navigation > select[aria-label="Switch workspace"] {
  display: none !important;
 }
 html body[data-b2s-button-layout] .b2s-admin-topbar-actions:has(select[aria-label="Switch workspace"]) {
  display: flex !important; width: auto !important; gap: 10px !important;
 }
}

/* 29.2.11.3: keep the laptop workspace switch inside the header action row. */
@media (min-width: 1101px) {
 html body[data-b2s-button-layout] :is(.b2s2312-header-actions, .b2s-global-actions):has(> select[aria-label="Switch workspace"]) {
  display: flex !important; align-items: center !important;
  flex: 0 0 auto !important; flex-wrap: nowrap !important;
  width: auto !important; min-width: 0 !important; gap: 12px !important;
  margin-block: 0 !important; padding-block: 0 !important;
 }
 html body[data-b2s-button-layout] :is(.b2s2312-header-actions, .b2s-global-actions) > select[aria-label="Switch workspace"] {
  flex: 0 0 188px !important; margin: 0 !important;
 }
 html body[data-b2s-button-layout] :is(.b2s-global-header-inner, .b2s2312-topbar):has(select[aria-label="Switch workspace"]) {
  column-gap: 16px !important; align-items: center !important;
 }
}
