.sac-chat {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99999;
  font-family: inherit;
  color: #1f1f1f;
}

.sac-chat * {
  box-sizing: border-box;
}

.sac-toggle {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.20);
  font-weight: 800;
  min-height: 48px;
  background: #111;
  color: #fff;
}

.sac-panel {
  width: min(380px, calc(100vw - 36px));
  height: min(560px, calc(100vh - 110px));
  margin-bottom: 12px;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 16px 50px rgba(0,0,0,.24);
  border: 1px solid rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
}

.sac-header {
  padding: 14px 14px 13px 16px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  background: #f7f7f7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sac-header strong,
.sac-header span {
  display: block;
}

.sac-header strong {
  font-size: 15px;
}

.sac-header span {
  font-size: 12px;
  opacity: .75;
  margin-top: 2px;
}

.sac-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(0,0,0,.08);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.sac-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #fafafa;
  -webkit-overflow-scrolling: touch;
}

.sac-bubble {
  max-width: 90%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 15px;
  line-height: 1.36;
  font-size: 14px;
  word-wrap: break-word;
}

.sac-bot {
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
}

.sac-user {
  margin-left: auto;
  background: #efefef;
}

.sac-products {
  width: 100%;
  margin: 2px 0 12px;
}

.sac-products-title {
  font-size: 12px;
  font-weight: 800;
  opacity: .72;
  margin: 4px 2px 7px;
}

.sac-product-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin: 0 0 8px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.10);
  text-decoration: none;
  color: inherit;
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
}

.sac-product-card:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.sac-product-card img {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: 10px;
  object-fit: cover;
  background: #f1f1f1;
}

.sac-product-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sac-product-body strong {
  font-size: 13px;
  line-height: 1.25;
}

.sac-product-body small {
  font-size: 12px;
  opacity: .78;
}

.sac-product-body em {
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  text-decoration: underline;
}

.sac-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(0,0,0,.08);
  background: #fff;
}

.sac-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.18);
  padding: 9px 10px;
  font: inherit;
  font-size: 16px;
}

.sac-send {
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 800;
  background: #111;
  color: #fff;
}

.sac-form.sac-busy .sac-send {
  opacity: .55;
  cursor: wait;
}

.sac-privacy {
  margin: 0;
  padding: 0 12px 12px;
  font-size: 11px;
  line-height: 1.3;
  opacity: .7;
  background: #fff;
}

@media (max-width: 600px) {
  .sac-chat {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    pointer-events: none;
  }

  .sac-toggle {
    position: fixed;
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    pointer-events: auto;
    padding: 13px 16px;
  }

  .sac-chat.sac-open .sac-toggle {
    display: none;
  }

  .sac-panel {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: auto;
    height: min(82dvh, 680px);
    max-height: calc(100dvh - 16px - env(safe-area-inset-bottom));
    margin: 0;
    border-radius: 22px;
    pointer-events: auto;
  }

  .sac-header {
    padding: 13px 12px 12px 14px;
  }

  .sac-messages {
    padding: 12px;
  }

  .sac-bubble {
    max-width: 94%;
    font-size: 14px;
  }

  .sac-form {
    padding: 10px;
    gap: 7px;
  }

  .sac-input {
    min-height: 46px;
  }

  .sac-send {
    min-width: 78px;
  }

  .sac-privacy {
    padding: 0 10px 10px;
  }
}

/* v2.5: Mobile Einbindung in die Storefront/WooCommerce-Handheld-Footer-Bar */
@media (max-width: 768px) {
  body.sac-footer-tab-active .sac-chat:not(.sac-open) .sac-toggle {
    display: none !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar {
    z-index: 99990;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li {
    width: 25% !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat {
    display: block !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat a,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat a:visited {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 100%;
    min-height: 66px;
    padding: 7px 4px 6px;
    text-indent: 0 !important;
    text-decoration: none !important;
    color: inherit !important;
    font-weight: 700;
    line-height: 1.1;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat a::before,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat a::after {
    content: none !important;
    display: none !important;
  }

  body.sac-footer-tab-active .sac-footer-icon {
    display: block;
    font-size: 25px;
    line-height: 1;
    margin-bottom: 1px;
  }

  body.sac-footer-tab-active .sac-footer-label {
    display: block;
    font-size: 11px;
    line-height: 1.1;
    white-space: nowrap;
  }

  body.sac-footer-tab-active .sac-chat.sac-open .sac-panel {
    bottom: calc(74px + env(safe-area-inset-bottom));
    max-height: calc(100dvh - 86px - env(safe-area-inset-bottom));
    height: min(78dvh, 660px);
  }

  /* v2.6: Hilfe-Tab optisch wie die anderen Mobile-Footer-Icons, ohne weißen Fokus-/Hintergrundkasten */
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat:hover,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat:focus-within,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat.current-menu-item {
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat a,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat a:hover,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat a:focus,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat a:active {
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat span,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat span:hover,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat span:focus {
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab .sac-footer-chat .sac-footer-label {
    color: inherit !important;
    font-weight: 700;
  }

}

/* v2.7: Hilfe als echter Button, damit Storefront/Theme keinen weißen Link-Fokus-Kasten setzt */
@media (max-width: 768px) {
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat:hover,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat:active,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat:focus,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat:focus-within {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    outline: 0 !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat > .sac-footer-trigger,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat > .sac-footer-trigger:hover,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat > .sac-footer-trigger:active,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat > .sac-footer-trigger:focus,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat > .sac-footer-trigger:focus-visible {
    appearance: none !important;
    -webkit-appearance: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 66px !important;
    margin: 0 !important;
    padding: 7px 4px 6px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    outline: 0 !important;
    color: inherit !important;
    font: inherit !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat > .sac-footer-trigger::before,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat > .sac-footer-trigger::after {
    content: none !important;
    display: none !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat > .sac-footer-trigger .sac-footer-icon {
    display: block !important;
    font-size: 25px !important;
    line-height: 1 !important;
    margin: 0 0 1px !important;
    background: transparent !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat > .sac-footer-trigger .sac-footer-label {
    display: block !important;
    font-size: 11px !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    background: transparent !important;
    color: inherit !important;
  }
}

/* v2.8: Hilfe-Tab als nativer Storefront-Footer-Link, ohne eigene weiße Button-Fläche */
@media (max-width: 768px) {
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat.sac-footer-chat-standard,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat.sac-footer-chat-standard:hover,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat.sac-footer-chat-standard:focus-within,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat.sac-footer-chat-standard:active {
    width: 25% !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    outline: 0 !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat.sac-footer-chat-standard > a.sac-footer-link,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat.sac-footer-chat-standard > a.sac-footer-link:visited,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat.sac-footer-chat-standard > a.sac-footer-link:hover,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat.sac-footer-chat-standard > a.sac-footer-link:focus,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat.sac-footer-chat-standard > a.sac-footer-link:active {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height: 4.235801032em !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    outline: 0 !important;
    color: inherit !important;
    text-decoration: none !important;
    text-indent: -9999px !important;
    overflow: hidden !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat.sac-footer-chat-standard > a.sac-footer-link::before {
    content: '?' !important;
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    outline: 0 !important;
    color: inherit !important;
    font-family: inherit !important;
    font-size: 2.05em !important;
    font-weight: 800 !important;
    line-height: 2.1 !important;
    text-align: center !important;
    text-indent: 0 !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat.sac-footer-chat-standard > a.sac-footer-link::after {
    content: none !important;
    display: none !important;
  }
}


/* v2.9 FINAL: Hilfe als neutraler Span im Mobile-Footer. Kein Link, kein Button, keine Theme-Aktivfläche. */
@media (max-width: 768px) {
  body.sac-footer-tab-active .sac-chat:not(.sac-open) .sac-toggle {
    display: none !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li {
    width: 25% !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat-final,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat-final:hover,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat-final:active,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat-final:focus,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat-final:focus-within,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat-final.current,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat-final.current-menu-item {
    width: 25% !important;
    display: block !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat-final > .sac-footer-control,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat-final > .sac-footer-control:hover,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat-final > .sac-footer-control:active,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat-final > .sac-footer-control:focus,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat-final > .sac-footer-control:focus-visible {
    appearance: none !important;
    -webkit-appearance: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 66px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    outline: 0 !important;
    color: inherit !important;
    font-family: inherit !important;
    font-size: 34px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    text-align: center !important;
    text-decoration: none !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
  }

  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat-final > .sac-footer-control::before,
  body.sac-footer-tab-active .storefront-handheld-footer-bar ul.sac-has-chat-tab li.sac-footer-chat-final > .sac-footer-control::after {
    content: none !important;
    display: none !important;
    background: transparent !important;
    box-shadow: none !important;
  }
}


/* v3.0: Schluss mit Theme-Kästen. Keine vierte LI-Spalte mehr, nur ein neutrales Fragezeichen als Overlay in der Mobile-Footer-Bar. */
@media (max-width: 768px) {
  body.sac-question-overlay-active .sac-chat:not(.sac-open) .sac-toggle {
    display: none !important;
  }

  body.sac-question-overlay-active .storefront-handheld-footer-bar {
    position: fixed !important;
    z-index: 99990 !important;
  }

  body.sac-question-overlay-active .storefront-handheld-footer-bar ul.sac-has-chat-overlay {
    width: 75% !important;
    max-width: 75% !important;
  }

  body.sac-question-overlay-active .storefront-handheld-footer-bar ul.sac-has-chat-overlay > li {
    width: 33.333333% !important;
  }

  body.sac-question-overlay-active .storefront-handheld-footer-bar ul.sac-has-chat-overlay > li.sac-footer-chat {
    display: none !important;
  }

  body.sac-question-overlay-active .storefront-handheld-footer-bar .sac-footer-question,
  body.sac-question-overlay-active .storefront-handheld-footer-bar .sac-footer-question:hover,
  body.sac-question-overlay-active .storefront-handheld-footer-bar .sac-footer-question:active,
  body.sac-question-overlay-active .storefront-handheld-footer-bar .sac-footer-question:focus,
  body.sac-question-overlay-active .storefront-handheld-footer-bar .sac-footer-question:focus-visible {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: 25% !important;
    height: 100% !important;
    min-height: 66px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    outline: 0 !important;
    color: inherit !important;
    font-family: inherit !important;
    font-size: 34px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    text-align: center !important;
    text-decoration: none !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
  }

  body.sac-question-overlay-active .storefront-handheld-footer-bar .sac-footer-question::before,
  body.sac-question-overlay-active .storefront-handheld-footer-bar .sac-footer-question::after {
    content: none !important;
    display: none !important;
  }

  body.sac-question-overlay-active .sac-chat.sac-open .sac-panel {
    bottom: calc(74px + env(safe-area-inset-bottom)) !important;
    max-height: calc(100dvh - 86px - env(safe-area-inset-bottom)) !important;
    height: min(78dvh, 660px) !important;
  }
}
