.tv-chat {
  position: fixed;
  z-index: 60;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: grid;
  justify-items: end;
  gap: .75rem;
  color: #111827;
  font: 400 .875rem/1.5 Inter, system-ui, sans-serif;
}

.tv-chat [hidden] { display: none; }
.tv-chat-panel {
  width: min(24rem, calc(100vw - 2rem));
  max-height: calc(100vh - 6rem);
  max-height: calc(100dvh - 6rem);
  overflow: auto;
  overscroll-behavior: contain;
  background: #fafaf7;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  box-shadow: 0 12px 32px #11182726;
}

.tv-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #eab308;
  padding: .5rem 1rem;
}

.tv-chat-header h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.tv-chat-close { font-size: 1.5rem; min-width: 2.5rem; min-height: 2.5rem; }
.tv-chat-content { padding: 1rem; }
.tv-chat-transcript {
  display: flex;
  flex-direction: column;
  gap: .625rem;
  height: min(17rem, 36vh);
  overflow: auto;
  overscroll-behavior: contain;
  padding: .125rem;
}

.tv-chat-message {
  flex: none;
  max-width: 92%;
  margin: 0;
  padding: .55rem .7rem;
  border-radius: .65rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.tv-chat-assistant { align-self: flex-start; background: #fff; border: 1px solid #e5e7eb; }
.tv-chat-user { align-self: flex-end; background: #fef08a; }
.tv-chat-status { margin: .4rem 0; }
.tv-chat-status:empty { display: none; }
.tv-chat-form { margin-top: .65rem; }
.tv-chat-form label { font-weight: 600; }
.tv-chat-input-row { display: flex; gap: .4rem; margin-top: .25rem; }
.tv-chat-input-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d1d5db;
  border-radius: .5rem;
  background: #fff;
  padding: .5rem .65rem;
  font-size: 1rem;
}

.tv-chat-toggle, .tv-chat-send {
  padding: .5rem .75rem;
  border: 1px solid #eab308;
  border-radius: .5rem;
  background: #eab308;
  font-weight: 600;
}

.tv-chat-send:disabled { opacity: .65; }
.tv-chat-toggle { box-shadow: 0 4px 16px #11182726; }
.tv-chat-note { color: #4b5563; font-size: .75rem; margin: .55rem 0 .35rem; }
.tv-chat-contact { text-decoration: underline; }
.tv-chat :focus-visible { outline: 2px solid #111827; outline-offset: 2px; }
#inquiry { scroll-margin-top: 6rem; }
