.tgbc-chat {
  position: fixed;
  z-index: 1000;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  font-family: Arial, Helvetica, sans-serif;
  color: #172638;
}
.tgbc-chat *, .tgbc-chat *::before, .tgbc-chat *::after { box-sizing: border-box; }
.tgbc-chat-panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  display: flex;
  width: min(390px, calc(100vw - 32px));
  height: min(570px, calc(100vh - 120px));
  min-height: 350px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(11, 31, 58, .16);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(8, 24, 43, .24);
  transform-origin: bottom right;
  animation: tgbc-chat-open .18s ease-out;
}
.tgbc-chat-panel[hidden] { display: none; }
@keyframes tgbc-chat-open { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.tgbc-chat-header {
  display: flex;
  min-height: 75px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #0b1f3a;
  color: #fff;
}
.tgbc-chat-header > div { display: flex; align-items: center; gap: 11px; }
.tgbc-chat-mark {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%;
  background: #07547e;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}
.tgbc-chat-header h2 { margin: 0; color: #fff; font-size: 16px; line-height: 1.2; }
.tgbc-chat-header p { margin: 4px 0 0; color: rgba(255,255,255,.72); font-size: 11px; }
.tgbc-chat-close {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  font: inherit;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.tgbc-chat-messages {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding: 17px 15px;
  background: #f6f8fa;
  overscroll-behavior: contain;
}
.tgbc-chat-message {
  max-width: 91%;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  color: #263442;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.tgbc-chat-message--user {
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  background: #07547e;
  color: #fff;
}
.tgbc-chat-message--bot { align-self: flex-start; border: 1px solid #e4e8ec; border-bottom-left-radius: 4px; }
.tgbc-chat-results { display: grid; gap: 8px; }
.tgbc-chat-result {
  padding: 11px 12px;
  border: 1px solid #e1e7eb;
  border-radius: 10px;
  background: #fff;
}
.tgbc-chat-result-type { display: block; margin-bottom: 4px; color: #667386; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.tgbc-chat-result-title { display: inline-block; color: #07547e; font-size: 13px; font-weight: 750; line-height: 1.35; text-decoration: underline; text-underline-offset: 2px; }
.tgbc-chat-result-excerpt { margin: 5px 0 0; color: #526172; font-size: 11px; line-height: 1.45; }
.tgbc-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 7px;
  padding: 12px 13px 8px;
  border-top: 1px solid #e5e9ed;
  background: #fff;
}
.tgbc-chat-form input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #cbd3da;
  border-radius: 9px;
  background: #fff;
  color: #172638;
  font: inherit;
  font-size: 13px;
}
.tgbc-chat-form input::placeholder { color: #87909a; }
.tgbc-chat-form button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: #07547e;
  color: #fff;
  cursor: pointer;
}
.tgbc-chat-form button:disabled { cursor: wait; opacity: .65; }
.tgbc-chat-form button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tgbc-chat-disclaimer { margin: 0; padding: 0 15px 11px; background: #fff; color: #718092; font-size: 10px; line-height: 1.35; }
.tgbc-chat-tip {
  position: absolute;
  right: 0;
  bottom: 66px;
  max-width: min(250px, calc(100vw - 36px));
  padding: 11px 15px;
  border: 0;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 7px 24px rgba(8, 24, 43, .2);
  color: #0b1f3a;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(5px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.tgbc-chat-tip::after {
  position: absolute;
  right: 22px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: #fff;
  content: '';
  transform: rotate(45deg);
}
.tgbc-chat-tip.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.tgbc-chat-launcher {
  display: inline-flex;
  min-width: 132px;
  height: 54px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border: 1px solid rgba(255,255,255,.23);
  border-radius: 999px;
  background: #07547e;
  box-shadow: 0 8px 25px rgba(11, 31, 58, .28);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease;
}
.tgbc-chat-launcher:hover { transform: translateY(-2px); background: #064568; }
.tgbc-chat-launcher svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tgbc-chat-launcher .tgbc-chat-close-icon { display: none; }
.tgbc-chat.is-open .tgbc-chat-launcher .tgbc-chat-launch-icon,
.tgbc-chat.is-open .tgbc-chat-launcher > span { display: none; }
.tgbc-chat.is-open .tgbc-chat-launcher .tgbc-chat-close-icon { display: block; }
.tgbc-chat-launcher:focus-visible, .tgbc-chat-close:focus-visible, .tgbc-chat-form button:focus-visible,
.tgbc-chat-form input:focus-visible, .tgbc-chat-result-title:focus-visible, .tgbc-chat-tip:focus-visible { outline: 3px solid #d5a24f; outline-offset: 3px; }
@media (max-width: 480px) {
  .tgbc-chat { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  .tgbc-chat-panel { right: -4px; bottom: 68px; width: min(390px, calc(100vw - 24px)); height: min(570px, calc(100dvh - 100px)); }
  .tgbc-chat-launcher { min-width: 120px; height: 50px; }
}
@media (prefers-reduced-motion: reduce) { .tgbc-chat-panel { animation: none; } .tgbc-chat-launcher, .tgbc-chat-tip { transition: none; } }
