.tv-cb, .tv-cb * { box-sizing: border-box; }
.tv-cb {
  --tv-c: #0b6e8a;
  position: fixed;
  bottom: 20px;
  z-index: 99999;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: #1c2b33;
}
.tv-cb--right { right: 20px; }
.tv-cb--left { left: 20px; }

.tv-cb__fab {
  width: 60px; height: 60px; border-radius: 50%;
  border: 0; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--tv-c); color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  transition: transform .2s ease;
}
.tv-cb__fab:hover { transform: scale(1.06); }
.tv-cb__fab:focus-visible, .tv-cb button:focus-visible, .tv-cb input:focus-visible, .tv-cb textarea:focus-visible {
  outline: 3px solid var(--tv-c); outline-offset: 2px;
}

.tv-cb__panel {
  position: absolute; bottom: 74px;
  width: 370px; max-width: calc(100vw - 24px);
  height: 540px; max-height: calc(100vh - 110px);
  display: flex; flex-direction: column;
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
}
.tv-cb__panel[hidden] { display: none; }
.tv-cb--right .tv-cb__panel { right: 0; }
.tv-cb--left .tv-cb__panel { left: 0; }

.tv-cb__head {
  display: flex; align-items: center; gap: 6px;
  padding: 14px 12px 14px 16px;
  background: var(--tv-c); color: #fff;
}
.tv-cb__headtext { flex: 1; min-width: 0; }
.tv-cb__title { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-cb__sub { font-size: 12px; opacity: .85; }
.tv-cb__hbtn {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .16); color: #fff; border: 0; cursor: pointer; padding: 0;
  text-decoration: none; flex-shrink: 0;
}
.tv-cb__hbtn:hover { background: rgba(255, 255, 255, .3); color: #fff; }

.tv-cb__msgs {
  flex: 1; overflow-y: auto; padding: 14px;
  background: #f4f7f9;
  display: flex; flex-direction: column; gap: 8px;
}
.tv-cb__row { display: flex; }
.tv-cb__row--user { justify-content: flex-end; }
.tv-cb__bubble {
  max-width: 85%; padding: 9px 13px; border-radius: 14px;
  word-wrap: break-word; overflow-wrap: anywhere;
}
.tv-cb__row--bot .tv-cb__bubble { background: #fff; color: #1c2b33; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.tv-cb__row--user .tv-cb__bubble { background: var(--tv-c); color: #fff; border-bottom-right-radius: 4px; }
.tv-cb__bubble a { color: inherit; text-decoration: underline; }
.tv-cb__row--bot .tv-cb__bubble a { color: var(--tv-c); }

.tv-cb__typing { display: flex; gap: 4px; padding: 12px 14px; }
.tv-cb__typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #9aa9b2;
  animation: tv-cb-bounce 1.2s infinite ease-in-out;
}
.tv-cb__typing span:nth-child(2) { animation-delay: .15s; }
.tv-cb__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes tv-cb-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

.tv-cb__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; background: #f4f7f9; }
.tv-cb__chip {
  border: 1px solid var(--tv-c); color: var(--tv-c); background: #fff;
  border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.tv-cb__chip:hover { background: var(--tv-c); color: #fff; }

.tv-cb__form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e3eaee; background: #fff; margin: 0; }
.tv-cb__input {
  flex: 1; min-width: 0; border: 1px solid #cfd9df; border-radius: 999px;
  padding: 10px 14px; font-size: 15px; font-family: inherit; background: #fff; color: #1c2b33; box-shadow: none;
}
.tv-cb__send {
  width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--tv-c); color: #fff; flex-shrink: 0;
}

.tv-cb__lead {
  background: #fff; border-radius: 14px; padding: 12px; margin: 2px 0;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
.tv-cb__field {
  width: 100%; border: 1px solid #cfd9df; border-radius: 10px; padding: 9px 11px;
  font-size: 14px; font-family: inherit; color: #1c2b33; background: #fff; resize: none; box-shadow: none;
}
.tv-cb__hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.tv-cb__err { color: #b3261e; font-size: 13px; }
.tv-cb__err:empty { display: none; }
.tv-cb__submit {
  border: 0; border-radius: 10px; padding: 10px; cursor: pointer; font-size: 14px; font-weight: 600;
  background: var(--tv-c); color: #fff; font-family: inherit;
}
.tv-cb__submit:disabled { opacity: .6; cursor: default; }

@media (max-width: 480px) {
  .tv-cb--right { right: 12px; }
  .tv-cb--left { left: 12px; }
  .tv-cb { bottom: 12px; }
  .tv-cb__panel { width: calc(100vw - 24px); height: calc(100vh - 96px); bottom: 70px; }
  .tv-cb__input, .tv-cb__field { font-size: 16px; } /* stops iOS zoom on focus */
}

@media (prefers-reduced-motion: reduce) {
  .tv-cb__fab, .tv-cb__typing span { transition: none; animation: none; }
}
