#btvn-ssa,
#btvn-ssa * {
  box-sizing: border-box;
}

#btvn-ssa {
  --btvn-primary: #8b4f32;
  --btvn-accent: #d6a55c;
  --btvn-ink: #2f2925;
  --btvn-muted: #716a65;
  --btvn-line: #e9e2dc;
  --btvn-soft: #f8f5f2;
  --btvn-safe-bottom: max(20px, env(safe-area-inset-bottom));
  position: fixed;
  right: 20px;
  bottom: var(--btvn-safe-bottom);
  z-index: 999990;
  width: 58px;
  color: var(--btvn-ink);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  isolation: isolate;
}

#btvn-ssa button,
#btvn-ssa input,
.btvn-ssa-product-help,
.btvn-ssa-cart-help button {
  font: inherit;
}

#btvn-ssa button {
  text-transform: none;
  letter-spacing: 0;
  min-height: 0;
  margin: 0;
  box-shadow: none;
}

.btvn-ssa-launcher {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  color: #fff !important;
  background: var(--btvn-primary) !important;
  background: linear-gradient(145deg, var(--btvn-primary), color-mix(in srgb, var(--btvn-primary), #000 18%)) !important;
  box-shadow: 0 10px 30px rgba(63, 34, 20, .28), 0 2px 8px rgba(63, 34, 20, .16) !important;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.btvn-ssa-launcher:hover,
.btvn-ssa-launcher:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(63, 34, 20, .34), 0 3px 10px rgba(63, 34, 20, .18) !important;
}

.btvn-ssa-launcher svg {
  display: block;
  width: 29px;
  height: 29px;
  fill: currentColor;
}

.btvn-ssa-badge {
  position: absolute;
  top: -3px;
  right: -2px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: #d9392f;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.btvn-ssa-badge[hidden] {
  display: none !important;
}

.btvn-ssa-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .82);
  border-radius: 50%;
  color: #fff;
  background: var(--btvn-primary);
  font-size: 11px;
  font-weight: 800;
}

.btvn-ssa-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
}

.btvn-ssa-teaser {
  position: absolute;
  right: 0;
  bottom: 72px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 9px;
  width: min(350px, calc(100vw - 34px));
  padding: 11px 9px 11px 11px;
  border: 1px solid var(--btvn-line);
  border-radius: 16px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(.98);
  background: #fff;
  box-shadow: 0 16px 44px rgba(53, 39, 31, .18), 0 3px 10px rgba(53, 39, 31, .08);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease, visibility .22s;
}

.btvn-ssa-teaser.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.btvn-ssa-teaser .btvn-ssa-avatar {
  width: 40px;
  height: 40px;
  border-color: #f1e7df;
}

.btvn-ssa-teaser-main {
  display: flex !important;
  min-width: 0;
  padding: 0 !important;
  border: 0 !important;
  color: var(--btvn-ink) !important;
  background: transparent !important;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  cursor: pointer;
}

.btvn-ssa-teaser-main strong {
  margin-bottom: 1px;
  font-size: 12px;
  line-height: 1.3;
}

.btvn-ssa-teaser-main span {
  display: -webkit-box;
  overflow: hidden;
  color: #4d4743;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.38;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.btvn-ssa-teaser-close,
.btvn-ssa-panel-close {
  display: grid !important;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  color: #766f6a !important;
  background: transparent !important;
  font-size: 23px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.btvn-ssa-teaser-close:hover,
.btvn-ssa-panel-close:hover {
  background: rgba(0, 0, 0, .06) !important;
}

.btvn-ssa-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  display: flex;
  width: min(398px, calc(100vw - 34px));
  height: min(680px, calc(100vh - 112px));
  max-height: 680px;
  overflow: hidden;
  border: 1px solid rgba(83, 56, 40, .14);
  border-radius: 20px;
  opacity: 0;
  transform: translateY(12px) scale(.985);
  background: #fff;
  box-shadow: 0 24px 64px rgba(46, 31, 23, .24), 0 4px 14px rgba(46, 31, 23, .1);
  flex-direction: column;
  transform-origin: bottom right;
  transition: opacity .2s ease, transform .22s ease;
}

.btvn-ssa-panel[hidden] {
  display: none !important;
}

.btvn-ssa-panel.is-ready {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.btvn-ssa-header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  min-height: 76px;
  padding: 12px 12px 12px 15px;
  color: #fff;
  background: var(--btvn-primary);
  background: linear-gradient(135deg, var(--btvn-primary), color-mix(in srgb, var(--btvn-primary), #000 16%));
}

.btvn-ssa-header .btvn-ssa-avatar {
  width: 42px;
  height: 42px;
  border-color: rgba(255, 255, 255, .72);
}

.btvn-ssa-header > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.btvn-ssa-title {
  overflow: hidden;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btvn-ssa-subtitle {
  overflow: hidden;
  margin-top: 1px;
  color: rgba(255, 255, 255, .88);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btvn-ssa-header small {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  color: rgba(255, 255, 255, .86);
  font-size: 10px;
  line-height: 1.2;
}

.btvn-ssa-header small i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 50%;
  background: #39d27a;
}

.btvn-ssa-header .btvn-ssa-panel-close {
  color: #fff !important;
}

.btvn-ssa-header .btvn-ssa-panel-close:hover {
  background: rgba(255, 255, 255, .14) !important;
}

.btvn-ssa-body {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 15px 14px;
  background: linear-gradient(180deg, #fbfaf8 0, var(--btvn-soft) 100%);
  overscroll-behavior: contain;
  flex: 1 1 auto;
  scrollbar-width: thin;
  scrollbar-color: #d8cec6 transparent;
}

.btvn-ssa-product {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  margin-bottom: 15px;
  padding: 9px;
  border: 1px solid #eadfd7;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(62, 43, 31, .05);
}

.btvn-ssa-product[hidden] {
  display: none !important;
}

.btvn-ssa-product img {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0;
  border-radius: 10px;
  background: #f3efeb;
  object-fit: cover;
}

.btvn-ssa-product > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.btvn-ssa-product strong {
  display: -webkit-box;
  overflow: hidden;
  color: #312823;
  font-size: 13px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.btvn-ssa-product-meta,
.btvn-ssa-selection {
  overflow: hidden;
  margin-top: 3px;
  color: var(--btvn-muted);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btvn-ssa-selection {
  color: var(--btvn-primary);
  font-weight: 650;
}

.btvn-ssa-agent {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 6px;
  color: #726a65;
  font-size: 10px;
  font-weight: 650;
}

.btvn-ssa-agent .btvn-ssa-avatar {
  width: 22px;
  height: 22px;
  border: 1px solid #eadfd7;
  font-size: 7px;
}

.btvn-ssa-message {
  width: fit-content;
  max-width: 88%;
  margin-bottom: 9px;
  padding: 10px 12px;
  border: 1px solid #e8ded7;
  border-radius: 4px 14px 14px 14px;
  color: #38312d;
  background: #fff;
  box-shadow: 0 2px 7px rgba(53, 38, 29, .045);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
}

.btvn-ssa-message.is-user {
  margin-left: auto;
  border-color: color-mix(in srgb, var(--btvn-primary), #fff 72%);
  border-radius: 14px 4px 14px 14px;
  color: #fff;
  background: var(--btvn-primary);
}

.btvn-ssa-message.is-followup {
  border-color: #ead6bf;
  background: #fffaf3;
}

.btvn-ssa-category-links {
  display: flex;
  gap: 7px;
  margin: 10px 0 14px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.btvn-ssa-category-links::-webkit-scrollbar {
  display: none;
}

.btvn-ssa-category-links[hidden] {
  display: none !important;
}

.btvn-ssa-category-links a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #e5d8ce;
  border-radius: 999px;
  color: var(--btvn-primary);
  background: #fff;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.btvn-ssa-category-links a:hover {
  border-color: var(--btvn-primary);
  background: #fffaf6;
}

.btvn-ssa-intents {
  margin-top: 12px;
}

.btvn-ssa-intents[hidden] {
  display: none !important;
}

.btvn-ssa-intents > p {
  margin: 0 0 8px;
  color: #625b56;
  font-size: 12px;
  font-weight: 650;
}

.btvn-ssa-intents > div {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.btvn-ssa-intents button {
  display: inline-flex !important;
  align-items: center;
  min-height: 34px !important;
  padding: 7px 11px !important;
  border: 1px solid #dccdc2 !important;
  border-radius: 10px !important;
  color: #473b34 !important;
  background: #fff !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.btvn-ssa-intents button:hover,
.btvn-ssa-intents button.is-selected {
  border-color: var(--btvn-primary) !important;
  color: var(--btvn-primary) !important;
  background: #fffaf6 !important;
}

.btvn-ssa-thread:not([hidden]) {
  margin-top: 14px;
}

.btvn-ssa-typing {
  display: flex;
  width: fit-content;
  gap: 4px;
  margin: 4px 0 9px;
  padding: 11px 13px;
  border: 1px solid #e8ded7;
  border-radius: 4px 14px 14px 14px;
  background: #fff;
}

.btvn-ssa-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a89b92;
  animation: btvnTyping 1s infinite ease-in-out;
}

.btvn-ssa-typing i:nth-child(2) { animation-delay: .14s; }
.btvn-ssa-typing i:nth-child(3) { animation-delay: .28s; }

@keyframes btvnTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: .55; }
  30% { transform: translateY(-3px); opacity: 1; }
}

.btvn-ssa-success {
  margin: 14px 0 4px;
  padding: 17px 15px;
  border: 1px solid #bfe2ca;
  border-radius: 14px;
  text-align: center;
  background: #f2fbf5;
}

.btvn-ssa-success[hidden] {
  display: none !important;
}

.btvn-ssa-success-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 0 auto 8px;
  border-radius: 50%;
  color: #fff;
  background: #2f9f5b;
  font-size: 19px;
  font-weight: 800;
}

.btvn-ssa-success strong {
  display: block;
  color: #236b3d;
  font-size: 14px;
}

.btvn-ssa-success p {
  margin: 5px 0 0;
  color: #456653;
  font-size: 12px;
  line-height: 1.45;
}

.btvn-ssa-footer {
  flex: 0 0 auto;
  padding: 11px 12px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--btvn-line);
  background: #fff;
}

.btvn-ssa-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 7px;
  min-height: 46px;
  padding: 3px 4px 3px 13px;
  border: 1px solid #d9cfc8;
  border-radius: 14px;
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.btvn-ssa-composer:focus-within {
  border-color: var(--btvn-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--btvn-primary), transparent 88%);
}

.btvn-ssa-input {
  width: 100% !important;
  min-width: 0;
  height: 38px !important;
  min-height: 38px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  color: #332c28 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 13px !important;
  line-height: 38px !important;
}

.btvn-ssa-input::placeholder {
  color: #918a85;
}

.btvn-ssa-submit {
  display: grid !important;
  place-items: center !important;
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 11px !important;
  color: #fff !important;
  background: var(--btvn-primary) !important;
  line-height: 1 !important;
  cursor: pointer;
}

.btvn-ssa-submit:hover {
  filter: brightness(.93);
}

.btvn-ssa-submit:disabled {
  opacity: .55;
  cursor: wait;
}

.btvn-ssa-submit svg {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  fill: currentColor;
  transform: translateX(1px);
}

.btvn-ssa-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
}

.btvn-ssa-status {
  display: none;
  min-height: 0;
  margin: 6px 2px 0;
  color: #b03228;
  font-size: 11px;
  line-height: 1.35;
}

.btvn-ssa-status.is-visible {
  display: block;
}

.btvn-ssa-status.is-loading {
  color: var(--btvn-muted);
}

.btvn-ssa-direct {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 8px;
}

.btvn-ssa-direct a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 35px;
  padding: 7px 9px;
  border: 1px solid #e0d5cd;
  border-radius: 10px;
  color: #463a33;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.btvn-ssa-direct a:hover {
  border-color: var(--btvn-primary);
  color: var(--btvn-primary);
}

.btvn-ssa-direct .btvn-ssa-zalo {
  border-color: #cdddf6;
  color: #0757b7;
  background: #f5f9ff;
}

.btvn-ssa-direct svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.btvn-ssa-privacy {
  display: block;
  margin-top: 6px;
  color: #918984;
  font-size: 9px;
  line-height: 1.3;
  text-align: center;
}

.btvn-ssa-product-help {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 42px !important;
  margin: 10px 0 0 8px !important;
  padding: 9px 15px !important;
  border: 1px solid #cdbbab !important;
  border-radius: 7px !important;
  color: #70432c !important;
  background: #fffaf6 !important;
  box-shadow: none !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

.btvn-ssa-product-help:hover,
.btvn-ssa-product-help.is-primary {
  border-color: var(--btvn-primary, #8b4f32) !important;
  color: #fff !important;
  background: var(--btvn-primary, #8b4f32) !important;
}

.btvn-ssa-cart-help {
  display: flex;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #e4d8cf;
  border-radius: 10px;
  background: #fffaf6;
  flex-direction: column;
}

.btvn-ssa-cart-help strong {
  color: #4d382c;
  font-size: 14px;
}

.btvn-ssa-cart-help span {
  margin: 3px 0 10px;
  color: #756a63;
  font-size: 12px;
}

.btvn-ssa-cart-help button {
  width: 100%;
  margin: 0 !important;
}

@media (max-width: 849px) {
  #btvn-ssa {
    right: 12px;
    bottom: max(76px, calc(env(safe-area-inset-bottom) + 68px));
    width: 54px;
  }

  .btvn-ssa-launcher {
    width: 54px;
    height: 54px;
  }

  .btvn-ssa-launcher svg {
    width: 27px;
    height: 27px;
  }

  .btvn-ssa-teaser,
  .btvn-ssa-panel {
    right: 0;
    bottom: 66px;
  }

  .btvn-ssa-teaser {
    width: min(340px, calc(100vw - 24px));
  }

  .btvn-ssa-panel {
    position: fixed;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: calc(100vw - 16px);
    height: min(650px, calc(100dvh - 16px));
    max-height: calc(100dvh - 16px);
    border-radius: 18px;
  }

  body.btvn-ssa-panel-open {
    overscroll-behavior: none;
  }

  body.btvn-ssa-input-active #btvn-ssa .btvn-ssa-panel {
    height: min(560px, calc(100dvh - 8px));
  }

  .btvn-ssa-body {
    padding: 14px 13px 12px;
  }

  .btvn-ssa-product-help {
    width: 100% !important;
    margin: 9px 0 0 !important;
  }
}

@media (max-width: 380px) {
  .btvn-ssa-header {
    grid-template-columns: 38px minmax(0, 1fr) 30px;
    min-height: 68px;
    padding: 10px;
  }

  .btvn-ssa-header .btvn-ssa-avatar {
    width: 38px;
    height: 38px;
  }

  .btvn-ssa-intents button {
    max-width: 100%;
    flex: 1 1 calc(50% - 4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  #btvn-ssa *,
  #btvn-ssa *::before,
  #btvn-ssa *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
