:root {
  --fh-fab-size: 44px;
  --fh-fab-gap: 10px;
  --fh-fab-inset: max(14px, env(safe-area-inset-bottom, 0px));
  --fh-mobile-nav-h: 64px;
}

.fh-floating-actions {
  position: fixed;
  right: max(14px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--fh-fab-inset) + var(--fh-mobile-nav-h));
  z-index: 10040;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--fh-fab-gap);
}

@media (min-width: 768px) {
  .fh-floating-actions {
    bottom: var(--fh-fab-inset);
  }
}

.fh-support-widget {
  position: relative;
}

.fh-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--fh-fab-size);
  height: var(--fh-fab-size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
}

.fh-support-fab {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 8px 22px rgba(45, 68, 34, 0.26);
}

.fh-support-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(45, 68, 34, 0.32);
}

.fh-scroll-top {
  background: #fff;
  color: var(--primary);
  border: 1px solid rgba(45, 68, 34, 0.18);
  box-shadow: 0 8px 22px rgba(20, 30, 15, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  pointer-events: none;
}

.fh-scroll-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.fh-scroll-top:hover {
  background: var(--bg-soft);
  transform: translateY(-2px);
}

/* Fixed to viewport so nothing clips the panel (desktop + mobile) */
.fh-support-panel {
  position: fixed;
  z-index: 10050;
  right: max(14px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--fh-fab-inset) + var(--fh-fab-size) + var(--fh-fab-gap));
  width: min(380px, calc(100vw - 28px));
  max-height: min(
    640px,
    calc(100dvh - var(--fh-fab-inset) - var(--fh-fab-size) - var(--fh-fab-gap) - 16px)
  );
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(20, 30, 15, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fh-support-panel[hidden] {
  display: none !important;
}

.fh-support-panel__head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
}

.fh-support-panel__head strong {
  display: block;
  font-size: 0.98rem;
}

.fh-support-panel__head small {
  opacity: 0.88;
  font-size: 0.75rem;
}

.fh-support-panel__close {
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.fh-support-panel .support-assistant {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 0 0 calc(10px + env(safe-area-inset-bottom, 0px));
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  overflow: hidden;
}

/* Compose box: prompts row + textarea + mic/send row */
.fh-support-compose {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.fh-support-panel__prompts-scroll {
  overflow: visible;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}

.fh-support-panel .support-assistant__suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  padding: 0;
  background: transparent;
}

.fh-support-panel .support-suggestion {
  flex: 1 1 calc(50% - 2px);
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: none;
  padding: 3px 6px;
  border-radius: 8px;
  border: 1px solid rgba(45, 68, 34, 0.14);
  background: #fff;
  box-shadow: none;
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: normal;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  color: var(--primary-dark);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.fh-support-panel .support-suggestion:hover {
  border-color: var(--primary);
  background: rgba(45, 68, 34, 0.06);
  color: var(--primary);
}

.fh-support-panel .support-suggestion--link {
  background: rgba(45, 68, 34, 0.06);
}

.fh-support-panel__prompts-scroll[hidden] {
  display: none;
}

.fh-support-compose__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 0;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  background: #fff;
}

.fh-support-compose__tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.fh-support-panel .support-voice-status,
.fh-support-panel .support-voice-interim {
  flex-shrink: 0;
  margin: 0;
  padding: 6px 12px;
  font-size: 0.78rem;
}

.fh-support-panel .support-assistant__messages {
  flex: 1 1 auto;
  min-height: 220px;
  max-height: none;
  overflow-y: auto;
  margin: 0;
  padding: 14px 12px;
  background: var(--bg-soft);
  -webkit-overflow-scrolling: touch;
}

.fh-support-panel .support-assistant__form {
  flex-shrink: 0;
  padding: 10px 12px 0;
  border-top: 1px solid var(--border);
  background: #fff;
}

.fh-support-panel .support-assistant__form textarea {
  width: 100%;
  min-height: 48px;
  max-height: 80px;
  resize: none;
  border: 0;
  border-radius: 0;
  padding: 10px 12px;
  box-sizing: border-box;
  background: #fff;
}

.fh-support-panel .support-assistant__form textarea:focus {
  outline: none;
  box-shadow: none;
}

.fh-support-panel .support-tool-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.fh-support-panel .support-tool-btn--mic {
  width: auto;
  height: 34px;
  border-radius: 999px;
  padding: 0 10px;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  font-family: inherit;
}

.fh-support-panel .support-tool-btn--mic span {
  font-family: inherit;
}

.fh-support-panel .support-tool-btn:hover,
.fh-support-panel .support-tool-btn.is-active,
.fh-support-panel .support-tool-btn.is-listening {
  background: rgba(45, 68, 34, 0.1);
  border-color: rgba(45, 68, 34, 0.28);
  color: var(--primary-dark);
}

.fh-support-panel .support-tool-btn.is-listening {
  background: rgba(165, 74, 46, 0.14);
  border-color: rgba(165, 74, 46, 0.35);
  color: var(--accent);
}

.fh-support-panel__foot {
  flex-shrink: 0;
  margin: 0;
  padding: 8px 12px 0;
  font-size: 0.78rem;
  text-align: center;
  color: var(--text-muted);
  background: #fff;
}

.fh-support-panel__foot a {
  color: var(--primary);
  font-weight: 600;
}

@media (max-width: 767px) {
  .fh-support-panel {
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    border-radius: 16px 16px 0 0;
    bottom: calc(var(--fh-mobile-nav-h) + env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - var(--fh-mobile-nav-h) - env(safe-area-inset-bottom, 0px) - 4px);
  }

  .fh-support-panel .support-assistant {
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .fh-support-panel .support-assistant__messages {
    min-height: min(48vh, 360px);
  }
}

body.fh-support-panel-open {
  overflow: hidden;
}

.checkout-shipping-info {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(45, 68, 34, 0.14);
  border-radius: var(--radius);
  background: var(--bg-soft);
  font-size: 0.88rem;
  line-height: 1.6;
}

.checkout-shipping-info strong {
  color: var(--primary);
}

.cart-shipping-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 12px;
}

.checkout-help-link {
  margin-left: 12px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--primary);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  vertical-align: middle;
  cursor: pointer;
}

.checkout-help-link:hover {
  background: rgba(45, 68, 34, 0.08);
}
