.tgp-chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 9997;
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  padding: 0 18px;
  color: #fff;
  background: #08745f;
  box-shadow: 0 16px 40px rgba(7, 21, 37, 0.28);
  font: 700 0.88rem/1 "Poppins", "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.tgp-chat-launcher:hover,
.tgp-chat-launcher:focus-visible {
  background: #064f8a;
  transform: translateY(-2px);
  outline: 3px solid rgba(11, 127, 211, 0.25);
  outline-offset: 3px;
}

.tgp-chat-launcher-mark {
  width: 18px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 4px;
  position: relative;
}

.tgp-chat-launcher-mark::after {
  content: "";
  position: absolute;
  left: 2px;
  bottom: -5px;
  width: 6px;
  height: 6px;
  border-left: 2px solid currentColor;
  transform: skewY(-35deg);
}

.tgp-chat {
  position: fixed;
  right: 24px;
  top: 88px;
  bottom: 84px;
  z-index: 9998;
  display: grid;
  width: min(448px, calc(100vw - 32px));
  height: auto;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
  overflow: hidden;
  border: 1px solid rgba(7, 21, 37, 0.42);
  border-radius: 8px;
  color: #071525;
  background: #fff;
  box-shadow: 0 26px 80px rgba(7, 21, 37, 0.32);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.tgp-chat.is-open {
  opacity: 1;
  transform: translateY(0);
}

.tgp-chat[hidden] {
  display: none;
}

.tgp-chat-header {
  grid-row: 1;
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px 16px;
  color: #fff;
  background: #071015;
}

.tgp-chat-header > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tgp-chat-header strong,
.tgp-chat-header small {
  display: block;
}

.tgp-chat-header strong {
  font-size: 1rem;
}

.tgp-chat-header small {
  color: #9fdcc4;
  font-size: 0.72rem;
}

.tgp-chat-status {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #62e4a9;
  box-shadow: 0 0 0 4px rgba(98, 228, 169, 0.15);
}

.tgp-chat-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 4px;
  color: #fff;
  background: transparent;
  font: 400 1.7rem/1 Arial, sans-serif;
  cursor: pointer;
}

.tgp-chat-close:hover,
.tgp-chat-close:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  outline: 2px solid #62e4a9;
}

.tgp-chat-log {
  grid-row: 3;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 18px 14px;
  background: #fff;
}

.tgp-chat-message {
  max-width: 86%;
  border-radius: 6px;
  padding: 10px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
  line-height: 1.5;
}

.tgp-chat-message.is-assistant {
  align-self: flex-start;
  border: 1px solid #d9e4ec;
  color: #26394c;
  background: #f5f8fa;
}

.tgp-chat-message.is-user {
  align-self: flex-end;
  color: #fff;
  background: #0b7fd3;
}

.tgp-chat-message.is-thinking {
  color: #5b6675;
  font-style: italic;
}

.tgp-chat-quick {
  grid-row: 4;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 10px 14px 4px;
  background: #fff;
}

.tgp-chat-quick:empty {
  display: none;
}

.tgp-chat-quick button,
.tgp-chat-actions button,
.tgp-chat-actions a {
  flex: 0 0 auto;
  border: 1px solid rgba(11, 127, 211, 0.3);
  border-radius: 4px;
  padding: 8px 10px;
  color: #064f8a;
  background: #fff;
  font: 700 0.72rem/1.2 "Poppins", sans-serif;
  cursor: pointer;
}

.tgp-chat-quick button:hover,
.tgp-chat-quick button:focus-visible,
.tgp-chat-actions button:hover,
.tgp-chat-actions button:focus-visible,
.tgp-chat-actions a:hover,
.tgp-chat-actions a:focus-visible {
  border-color: #1aa66a;
  color: #071525;
  background: #e8f7ef;
  outline: 2px solid rgba(26, 166, 106, 0.22);
}

.tgp-chat-form {
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px 14px 14px;
  background: #071015;
}

.tgp-chat-form .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tgp-chat-form input {
  width: 100%;
  min-width: 0;
  height: 60px;
  border: 1px solid #d5dde4;
  border-radius: 6px;
  padding: 0 14px;
  color: #071525;
  background: #fff;
  font: 500 0.83rem "Poppins", sans-serif;
}

.tgp-chat-form input:focus {
  border-color: #0b7fd3;
  outline: 3px solid rgba(11, 127, 211, 0.14);
}

.tgp-chat-form button {
  position: relative;
  width: 46px;
  min-width: 46px;
  border: 0;
  border-radius: 6px;
  padding: 0;
  color: #fff;
  background: #1aa66a;
  font: 700 1.5rem/1 "Segoe UI", Arial, sans-serif;
  cursor: pointer;
}

.tgp-chat-form button:hover,
.tgp-chat-form button:focus-visible {
  background: #08745f;
  outline: 3px solid rgba(26, 166, 106, 0.2);
}

.tgp-chat-actions {
  grid-row: 5;
  display: flex;
  gap: 7px;
  padding: 0 14px 8px;
  background: #fff;
}

.tgp-chat-privacy {
  grid-row: 6;
  margin: 0;
  padding: 12px 14px;
  border-top: 1px solid #e2e7eb;
  color: #6b7785;
  background: #fff;
  font-size: 0.68rem;
  text-align: center;
  line-height: 1.4;
}

.tgp-chat-book {
  align-self: flex-start;
  border-radius: 4px;
  padding: 9px 12px;
  color: #fff;
  background: #1aa66a;
  font-size: 0.78rem;
  font-weight: 800;
}

.tgp-chat-book.is-secondary {
  color: #064f8a;
  background: #fff;
  border: 1px solid #0b7fd3;
}

@media (max-width: 640px) {
  .tgp-chat-launcher {
    right: 14px;
    bottom: 14px;
  }

  .tgp-chat {
    left: 8px;
    right: 8px;
    top: 8px;
    bottom: 76px;
    width: auto;
    height: auto;
  }

  .tgp-chat-quick {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

.tgp-chat-launcher[aria-expanded="true"] {
  width: 56px;
  min-width: 56px;
  min-height: 56px;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
  background: #071015;
}

.tgp-chat-launcher[aria-expanded="true"] > span:last-child {
  display: none;
}

.tgp-chat-launcher[aria-expanded="true"] .tgp-chat-launcher-mark {
  width: 14px;
  height: 14px;
  border: 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  border-radius: 0;
  transform: rotate(45deg) translate(-2px, -2px);
}

.tgp-chat-launcher[aria-expanded="true"] .tgp-chat-launcher-mark::after {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .tgp-chat,
  .tgp-chat-launcher {
    transition: none;
  }
}
