.tsb-root,
.tsb-root * { box-sizing: border-box; }

.tsb-root {
  --tsb-green: #0b806f;
  --tsb-green-dark: #075e54;
  --tsb-green-soft: #dcf8c6;
  --tsb-ink: #17242b;
  --tsb-muted: #617078;
  --tsb-border: #d7e0dc;
  --tsb-cream: #efeae2;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--tsb-ink);
  line-height: 1.45;
}

.tsb-root [hidden] { display: none !important; }

.tsb-launcher {
  position: fixed;
  z-index: 2147483000;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 14px));
  width: 60px;
  height: 60px;
  padding: 13px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(145deg, #19ae7d, var(--tsb-green));
  box-shadow: 0 12px 34px rgba(2, 68, 56, .34), 0 3px 9px rgba(0, 0, 0, .18);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.tsb-launcher:hover { transform: translateY(-2px) scale(1.025); box-shadow: 0 15px 38px rgba(2, 68, 56, .4), 0 4px 11px rgba(0, 0, 0, .18); }
.tsb-launcher:active { transform: scale(.96); }
.tsb-launcher svg { display: block; width: 100%; height: 100%; }
.tsb-launcher-dot { position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; border: 3px solid #fff; border-radius: 50%; background: #ff4e58; }

.tsb-panel {
  position: fixed;
  z-index: 2147483001;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 14px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: min(390px, calc(100vw - 28px));
  height: min(620px, calc(100dvh - 40px));
  min-height: 430px;
  overflow: hidden;
  border: 1px solid rgba(7, 94, 84, .18);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(12, 39, 34, .28), 0 5px 18px rgba(0, 0, 0, .12);
  animation: tsb-in .22s ease-out both;
}

.tsb-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 12px 12px 12px 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--tsb-green-dark), var(--tsb-green));
}

.tsb-avatar { flex: 0 0 42px; display: grid; place-items: center; width: 42px; height: 42px; padding: 8px; border-radius: 50%; color: var(--tsb-green); background: #fff; box-shadow: 0 2px 7px rgba(0, 0, 0, .18); }
.tsb-avatar svg { width: 100%; height: 100%; }
.tsb-heading { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.tsb-heading strong { overflow: hidden; font-size: 15px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.tsb-subtitle { margin-top: 2px; font-size: 11.5px; line-height: 1.3; color: rgba(255, 255, 255, .82); }

.tsb-languages { display: flex; padding: 2px; border-radius: 9px; background: rgba(0, 0, 0, .16); }
.tsb-languages button { min-width: 30px; min-height: 28px; padding: 3px 6px; border: 0; border-radius: 7px; color: rgba(255, 255, 255, .72); background: transparent; font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; }
.tsb-languages button.is-active { color: var(--tsb-green-dark); background: #fff; }

.tsb-close { flex: 0 0 36px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; color: #fff; background: transparent; font: 300 30px/34px Arial, sans-serif; cursor: pointer; }
.tsb-close:hover { background: rgba(0, 0, 0, .16); }

.tsb-messages {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 14px 10px;
  background-color: var(--tsb-cream);
  background-image: radial-gradient(circle at 20px 20px, rgba(7, 94, 84, .045) 1.2px, transparent 1.3px), radial-gradient(circle at 8px 8px, rgba(7, 94, 84, .03) 1px, transparent 1.1px);
  background-size: 32px 32px, 24px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(7, 94, 84, .28) transparent;
}

.tsb-row { display: flex; margin: 0 0 10px; }
.tsb-row-user { justify-content: flex-end; }
.tsb-bubble { max-width: 88%; padding: 10px 11px; border-radius: 13px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); font-size: 13.5px; line-height: 1.48; overflow-wrap: anywhere; }
.tsb-bubble-bot { border-top-left-radius: 4px; background: #fff; }
.tsb-bubble-user { border-top-right-radius: 4px; background: var(--tsb-green-soft); }
.tsb-actions { display: grid; gap: 7px; margin-top: 11px; }
.tsb-action { display: block; width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid #a9d8cc; border-radius: 9px; color: #086658; background: #f6fffc; font: inherit; font-size: 12.5px; font-weight: 750; line-height: 1.25; text-align: center; text-decoration: none !important; cursor: pointer; }
.tsb-action:hover { border-color: var(--tsb-green); color: #064f45; background: #eafaf5; }

.tsb-composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--tsb-border); background: #f5f7f6; }
.tsb-composer input { min-width: 0; flex: 1; height: 44px; padding: 0 14px; border: 1px solid #cad5d1; border-radius: 22px; outline: 0; color: var(--tsb-ink); background: #fff; font: inherit; font-size: 14px; }
.tsb-composer input::placeholder { color: #7b878c; }
.tsb-composer input:focus { border-color: var(--tsb-green); box-shadow: 0 0 0 3px rgba(11, 128, 111, .14); }
.tsb-send { flex: 0 0 auto; min-width: 66px; height: 44px; padding: 0 14px; border: 0; border-radius: 22px; color: #fff; background: var(--tsb-green); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.tsb-send:hover { background: var(--tsb-green-dark); }

.tsb-privacy { padding: 0 12px 9px; color: var(--tsb-muted); background: #f5f7f6; font-size: 10.5px; line-height: 1.35; text-align: center; }
.tsb-sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.tsb-root button:focus-visible,
.tsb-root a:focus-visible,
.tsb-root input:focus-visible { outline: 3px solid #ffcf45; outline-offset: 2px; }

body.app-view .tsb-launcher { bottom: max(180px, calc(env(safe-area-inset-bottom) + 180px)); }
body.app-view .tsb-panel { bottom: max(176px, calc(env(safe-area-inset-bottom) + 176px)); height: min(590px, calc(100dvh - 196px)); min-height: 360px; }

@keyframes tsb-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 520px) {
  .tsb-launcher { right: max(14px, env(safe-area-inset-right)); bottom: max(14px, calc(env(safe-area-inset-bottom) + 10px)); width: 56px; height: 56px; padding: 12px; }
  .tsb-panel { right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); width: calc(100vw - max(16px, env(safe-area-inset-left) + env(safe-area-inset-right))); height: min(680px, calc(100dvh - max(16px, env(safe-area-inset-top) + env(safe-area-inset-bottom)))); min-height: 390px; border-radius: 17px; }
  .tsb-header { min-height: 68px; padding: 10px; }
  .tsb-avatar { flex-basis: 39px; width: 39px; height: 39px; }
  .tsb-subtitle { font-size: 10.5px; }
  .tsb-bubble { max-width: 92%; }
  .tsb-composer { padding: 8px; }
  .tsb-send { min-width: 58px; padding: 0 10px; }
  body.app-view .tsb-launcher { bottom: max(178px, calc(env(safe-area-inset-bottom) + 178px)); }
  body.app-view .tsb-panel { bottom: max(172px, calc(env(safe-area-inset-bottom) + 172px)); height: calc(100dvh - 184px); min-height: 340px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .tsb-panel { height: calc(100dvh - 12px); min-height: 0; bottom: 6px; }
  .tsb-header { min-height: 58px; padding-top: 7px; padding-bottom: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .tsb-panel { animation: none; }
  .tsb-launcher { transition: none; }
}

@media print { .tsb-root { display: none !important; } }
