/* Fixed chrome around one scrolling transcript; no message shares the composer layout. */
.techai-chat {
  --chat-screen-height: var(--chat-viewport-height, 100vh);
  --chat-banner-reserve: var(--privacy-banner-height, 0px);
  position: fixed;
  left: calc(20px + env(safe-area-inset-left, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px) + var(--chat-banner-reserve, 0px) + var(--chat-viewport-offset-bottom, 0px));
  z-index: 110;
  isolation: isolate;
  color: #1e293b;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.55;
  text-align: left;
}
@supports (height: 100dvh) {
  .techai-chat { --chat-screen-height: var(--chat-viewport-height, 100dvh); }
}
.techai-chat *, .techai-chat *::before, .techai-chat *::after { box-sizing: border-box; }
.techai-chat :where(button, input, textarea) { font: inherit; }
.techai-chat button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.techai-chat button:disabled { cursor: default; opacity: .55; }
.techai-chat :focus-visible { outline: 3px solid #a5b4fc; outline-offset: 3px; }
.techai-chat [hidden] { display: none !important; }

.techai-chat-launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 18px 8px 9px;
  border: 1px solid #4338ca;
  border-radius: 999px;
  background: #4338ca;
  color: #fff;
  box-shadow: 0 6px 20px #312e8129;
  font-size: 14px;
  font-weight: 700;
  transition: background .18s ease, transform .18s ease;
}
.techai-chat-launcher:hover { background: #3730a3; transform: translateY(-2px); }
.techai-chat-launcher-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #ffffff24; font-size: 21px; line-height: 1; }

.techai-chat-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 12px);
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 408px;
  max-width: calc(100vw - 40px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  height: 640px;
  max-height: calc(100vh - 112px - var(--chat-banner-reserve, 0px));
  height: min(640px, max(0px, calc(var(--chat-screen-height) - 112px - var(--chat-banner-reserve, 0px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))));
  min-height: 0;
  overflow: hidden;
  border: 1px solid #e2e5f0;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 20px 64px #1e1b4b29, 0 4px 16px #0f172a14;
}
.techai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 12px;
  padding: 17px 16px;
  background: linear-gradient(115deg, #312e81, #4338ca);
  color: #fff;
}
.techai-chat-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.techai-chat-mark { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border: 1px solid #ffffff30; border-radius: 13px; background: #ffffff20; color: #fff; font-size: 14px; font-weight: 800; letter-spacing: .03em; }
.techai-chat-brand-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.techai-chat-title { margin: 0; overflow: hidden; color: #fff; font-size: 16px; font-weight: 700; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.techai-chat-subtitle { margin: 0; overflow: hidden; color: #e0e7ff; font-size: 11px; font-weight: 400; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.techai-chat-actions { display: flex; align-items: center; flex: 0 0 auto; gap: 5px; }
.techai-chat-action, .techai-chat-new { display: grid; place-items: center; width: 36px; height: 36px; margin: 0; padding: 0; border: 1px solid #ffffff26; border-radius: 10px; background: #ffffff0d; color: #fff; font-size: 24px; font-weight: 400; line-height: 1; text-decoration: none; transition: background .15s ease; }
.techai-chat-action:hover, .techai-chat-new:hover { background: #ffffff24; }

.techai-chat-viewport, .techai-chat-contact-view {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  -webkit-overflow-scrolling: touch;
}
.techai-chat-viewport { background: #f8fafc; }
.techai-chat-viewport::-webkit-scrollbar, .techai-chat-contact-view::-webkit-scrollbar { width: 5px; }
.techai-chat-viewport::-webkit-scrollbar-thumb, .techai-chat-contact-view::-webkit-scrollbar-thumb { border-radius: 5px; background: #cbd5e1; }
.techai-chat-intro { margin: 16px 16px 0; padding: 12px 14px; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; color: #64748b; font-size: 13px; line-height: 1.65; }
.techai-chat-messages { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 18px 16px 14px; }
.techai-chat-message { flex: 0 0 auto; min-width: 0; max-width: 90%; }
.techai-chat-message--you { align-self: flex-end; }
.techai-chat-message--assistant { align-self: flex-start; }
.techai-chat-message-sender { display: block; margin: 0 3px 5px; color: #64748b; font-size: 11px; font-weight: 600; line-height: 1.4; }
.techai-chat-message--you .techai-chat-message-sender { text-align: right; }
.techai-chat-message-body { margin: 0; padding: 11px 13px; border: 1px solid #e2e8f0; border-radius: 15px 15px 15px 4px; background: #fff; color: #334155; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; white-space: pre-wrap; }
.techai-chat-message--you .techai-chat-message-body { border-color: #4f46e5; border-radius: 15px 15px 4px 15px; background: #4f46e5; color: #fff; }
.techai-chat-status { margin: 0; padding: 0 19px 14px; color: #64748b; font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.techai-chat-status:empty { display: none; }
.techai-chat-status.is-error, .techai-chat-contact-status.is-error { color: #b42318; }

.techai-chat-footer { flex: 0 0 auto; min-width: 0; border-top: 1px solid #e8ecf3; background: #fff; }
.techai-chat-composer { min-width: 0; padding: 12px 14px 0; }
.techai-chat-form { margin: 0; padding: 0; }
.techai-chat-input-label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.techai-chat-input-row { display: flex; align-items: flex-end; gap: 8px; min-width: 0; padding: 5px; border: 1px solid #d8deea; border-radius: 15px; background: #fff; transition: border-color .15s ease, box-shadow .15s ease; }
.techai-chat-input-row:focus-within { border-color: #818cf8; box-shadow: 0 0 0 3px #e0e7ff; }
.techai-chat-input { display: block; flex: 1 1 0%; width: 0; min-width: 0; height: 44px; min-height: 44px; max-height: 112px; margin: 0; resize: none; padding: 11px 9px; border: 0; border-radius: 9px; outline: none; background: transparent; box-shadow: none; color: #0f172a; font-size: 14px; line-height: 22px; overflow-y: auto; }
.techai-chat-input:focus-visible { outline: none; }
.techai-chat-input::placeholder { color: #94a3b8; }
.techai-chat-send { flex: 0 0 auto; min-width: 52px; min-height: 42px; padding: 8px 13px; border: 1px solid #4338ca; border-radius: 10px; background: #4338ca; color: #fff; font-size: 13px; font-weight: 600; line-height: 1.4; transition: background .15s ease; }
.techai-chat-send:hover { background: #3730a3; }
.techai-chat-disclosure { margin: 0; padding: 7px 2px 10px; color: #94a3b8; font-size: 10px; line-height: 1.4; text-align: center; }
.techai-chat-privacy-link { color: #64748b; text-decoration: none; }
.techai-chat-privacy-link:hover { color: #4338ca; text-decoration: underline; text-underline-offset: 3px; }
.techai-chat-contact-toggle { display: block; width: calc(100% - 28px); min-height: 38px; margin: 0 14px 12px; padding: 8px 12px; border: 1px solid #e0e7ff; border-radius: 10px; background: #f5f6ff; color: #4338ca; font-size: 12px; font-weight: 600; line-height: 1.5; }
.techai-chat-contact-toggle:hover { border-color: #c7d2fe; background: #eef2ff; }
.techai-chat-footer > .techai-chat-contact-toggle:first-child, .techai-chat-composer[hidden] + .techai-chat-contact-toggle { margin-top: 12px; }

.techai-chat-contact-view { background: #f8fafc; }
.techai-chat-contact-form { display: grid; gap: 14px; margin: 0; padding: 20px 18px; border: 0; background: transparent; }
.techai-chat-contact-title { margin: 0; color: #0f172a; font-size: 17px; font-weight: 700; line-height: 1.4; }
.techai-chat-contact-intro, .techai-chat-contact-hint { margin: 0; color: #64748b; font-size: 12px; line-height: 1.65; }
.techai-chat-field { min-width: 0; }
.techai-chat-field-label { display: block; margin-bottom: 6px; color: #475569; font-size: 12px; font-weight: 600; }
.techai-chat-field-input { display: block; width: 100%; min-height: 44px; margin: 0; padding: 10px 12px; border: 1px solid #d8deea; border-radius: 10px; background: #fff; color: #0f172a; font-size: 14px; line-height: 1.5; }
.techai-chat-field-input:focus { border-color: #818cf8; outline: 3px solid #e0e7ff; outline-offset: 0; }
.techai-chat-check-row { display: flex; align-items: flex-start; gap: 9px; color: #475569; font-size: 12px; line-height: 1.65; cursor: pointer; }
.techai-chat-checkbox { flex: 0 0 auto; width: 17px; height: 17px; margin: 2px 0 0; accent-color: #4338ca; }
.techai-chat-contact-status { margin: 0; color: #64748b; font-size: 12px; line-height: 1.55; }
.techai-chat-contact-status:empty { display: none; }
.techai-chat-contact-send { justify-self: stretch; min-height: 44px; }
.techai-chat-receipt { margin: 0 14px 12px; padding: 10px 12px; border: 1px solid #bbf7d0; border-radius: 10px; background: #f0fdf4; color: #166534; font-size: 12px; line-height: 1.6; }
.techai-chat-hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 600px) {
  .techai-chat { left: calc(14px + env(safe-area-inset-left, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px) + var(--chat-banner-reserve, 0px)); }
  .techai-chat-panel {
    position: fixed;
    left: calc(12px + env(safe-area-inset-left, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px) + var(--chat-banner-reserve, 0px) + var(--chat-viewport-offset-bottom, 0px));
    width: calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    max-width: none;
    height: calc(100vh - 24px - var(--chat-banner-reserve, 0px));
    max-height: calc(100vh - 24px - var(--chat-banner-reserve, 0px));
    height: min(680px, max(0px, calc(var(--chat-screen-height) - 24px - var(--chat-banner-reserve, 0px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))));
    border-radius: 19px;
  }
  .techai-chat-header { padding: 14px; gap: 8px; }
  .techai-chat-mark { width: 36px; height: 36px; border-radius: 11px; }
  .techai-chat-brand { gap: 9px; }
  .techai-chat-title { font-size: 15px; }
  .techai-chat-subtitle { font-size: 10px; }
  .techai-chat-action, .techai-chat-new { width: 34px; height: 36px; }
  .techai-chat-input, .techai-chat-field-input { font-size: 16px; }
}
@media (max-height: 520px) {
  .techai-chat-panel { position: fixed; left: calc(12px + env(safe-area-inset-left, 0px)); bottom: calc(10px + var(--chat-viewport-offset-bottom, 0px) + var(--chat-banner-reserve, 0px)); height: max(0px, calc(var(--chat-screen-height) - 20px - var(--chat-banner-reserve, 0px))); max-height: calc(100vh - 20px - var(--chat-banner-reserve, 0px)); }
  .techai-chat-header { padding: 9px 12px; }
  .techai-chat-mark { width: 34px; height: 34px; }
  .techai-chat-subtitle { display: none; }
  .techai-chat-intro { margin: 10px 12px 0; padding: 9px 11px; }
  .techai-chat-messages { padding: 12px; gap: 12px; }
  .techai-chat-composer { padding-top: 8px; }
  .techai-chat-disclosure { padding-bottom: 7px; }
  .techai-chat-contact-toggle { min-height: 32px; margin-bottom: 8px; padding: 5px 10px; }
}
.techai-chat[data-keyboard="true"] { --chat-banner-reserve: 0px; }
.techai-chat[data-compact="true"] .techai-chat-header { padding: 9px 12px; }
.techai-chat[data-compact="true"] .techai-chat-mark { width: 34px; height: 34px; }
.techai-chat[data-compact="true"] .techai-chat-subtitle { display: none; }
.techai-chat[data-compact="true"] .techai-chat-composer { padding-top: 8px; }
.techai-chat[data-compact="true"] .techai-chat-contact-toggle { min-height: 32px; margin-bottom: 8px; padding: 5px 10px; }
.techai-chat[data-compact="true"] .techai-chat-disclosure { padding-bottom: 7px; }
@media (prefers-reduced-motion: reduce) {
  .techai-chat *, .techai-chat *::before, .techai-chat *::after { transition: none; scroll-behavior: auto; }
  .techai-chat-launcher:hover { transform: none; }
}
