/* Total Chat — widget do visitante. Cor primária chega via
   var(--tchat-color), definida pelo JS no container .tchat-root. */

.tchat-root {
	position: fixed;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	-webkit-font-smoothing: antialiased;
}

/* O JS esconde por propriedade `hidden` (menu do chip, idade além do nº de
   crianças, badge, aviso). Sem isto, qualquer regra com `display` venceria a
   folha do navegador e o elemento oculto continuaria na tela. */
.tchat-root [hidden] {
	display: none !important;
}

.tchat-pos-right {
	right: 20px;
}

.tchat-pos-left {
	left: 20px;
}

/* Botão flutuante */

.tchat-button {
	position: relative;
	width: 56px;
	height: 56px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--tchat-color, #0B5CAB);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tchat-button:hover {
	transform: scale(1.06);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.tchat-button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.tchat-button svg {
	display: block;
}

.tchat-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	box-sizing: border-box;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #e53935;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
}

/* Painel */

.tchat-panel {
	position: absolute;
	bottom: 72px;
	width: 380px;
	height: 640px;
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px) scale(0.98);
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
}

.tchat-pos-right .tchat-panel {
	right: 0;
}

.tchat-pos-left .tchat-panel {
	left: 0;
}

.tchat-open .tchat-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
	pointer-events: auto;
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.tchat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	flex: 0 0 auto;
	padding: 12px 16px;
	background: var(--tchat-color, #0B5CAB);
	color: #fff;
}

/* Cabeçalho em duas linhas: avatar com a inicial, o nome (do atendente,
   quando configurado; senão o título) e, abaixo, o título em letra menor. */
.tchat-avatar {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.18);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 15px;
}

.tchat-header-textos {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.tchat-title {
	font-weight: 600;
	font-size: 15px;
	line-height: 1.2;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tchat-sub {
	font-size: 12px;
	line-height: 1.2;
	opacity: 0.85;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tchat-minimize {
	flex: 0 0 auto;
	min-width: 44px;
	min-height: 44px;
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	padding: 2px 8px;
	border-radius: 4px;
	cursor: pointer;
}

.tchat-minimize:hover {
	background: rgba(255, 255, 255, 0.15);
}

/* Mensagens */

.tchat-messages {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: #c3c8d1 transparent;
	padding: 12px;
	background: #f5f6f8;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Barra fina, sem as setas cinzas do sistema. */
.tchat-messages::-webkit-scrollbar {
	width: 8px;
}

.tchat-messages::-webkit-scrollbar-thumb {
	background: #c3c8d1;
	border-radius: 4px;
}

.tchat-messages::-webkit-scrollbar-track {
	background: transparent;
}

.tchat-msg {
	display: flex;
}

.tchat-msg-visitor {
	justify-content: flex-end;
}

.tchat-msg-operator {
	justify-content: flex-start;
}

.tchat-bubble {
	max-width: 80%;
	padding: 8px 12px;
	border-radius: 14px;
	overflow-wrap: break-word;
	word-break: break-word;
	white-space: pre-wrap;
}

.tchat-msg-visitor .tchat-bubble {
	background: var(--tchat-color, #0B5CAB);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.tchat-msg-operator .tchat-bubble {
	background: #e4e6eb;
	color: #1c1e21;
	border-bottom-left-radius: 4px;
}

/* A bolha do atendimento: mesma cor de sempre, sem itálico — o texto do fluxo
   é a conversa, não uma nota de rodapé. */
.tchat-msg-system .tchat-bubble {
	background: #e9eef5;
	color: #33415c;
}

/* Cards de cruzeiro (meta.cards)

   Não existe regra de preço aqui porque não existe campo de preço no
   template — nem oculto. Valor quem passa é o consultor humano. */

.tchat-bubble-text {
	display: block;
}

.tchat-bubble-cards {
	width: 100%;
	max-width: 94%;
	box-sizing: border-box;
}

.tchat-cards {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
	white-space: normal;
}

.tchat-bubble-text + .tchat-cards {
	margin-top: 8px;
}

.tchat-card {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 8px;
	border: 1px solid #d3d8e0;
	border-radius: 10px;
	background: #fff;
}

.tchat-card-img {
	flex: 0 0 auto;
	display: block;
	width: 72px;
	height: 72px;
	border-radius: 8px;
	object-fit: cover;
	background: #eef1f5;
}

.tchat-card-body {
	flex: 1 1 auto;
	min-width: 0;
}

.tchat-card-ship {
	margin: 0;
	padding: 0;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	color: #1c1e21;
	overflow-wrap: break-word;
	word-break: break-word;
}

.tchat-card-company {
	margin: 1px 0 5px;
	padding: 0;
	font-size: 12px;
	line-height: 1.3;
	color: #5b6472;
	overflow-wrap: break-word;
	word-break: break-word;
}

.tchat-card-line {
	margin: 0 0 2px;
	padding: 0;
	font-size: 12px;
	line-height: 1.35;
	color: #33415c;
	overflow-wrap: break-word;
	word-break: break-word;
}

.tchat-card-line:last-child {
	margin-bottom: 0;
}

.tchat-card-label {
	color: #6b7280;
}

/* Formulário do fluxo de atendimento (meta.form)

   Vive dentro de .tchat-messages, sempre como último elemento da conversa:
   no mobile ele rola junto com as mensagens em vez de disputar altura com
   o compositor. Aqui também não existe regra de preço, porque não existe
   campo de preço na gramática do formulário. */

.tchat-form {
	box-sizing: border-box;
	margin: 4px 0 2px;
	padding: 10px;
	border: 1px solid #d3d8e0;
	border-radius: 12px;
	background: #fff;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.tchat-form[aria-busy="true"] {
	opacity: 0.7;
}

.tchat-form-title {
	margin: 0;
	padding: 0;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	color: #1c1e21;
}

.tchat-form-error {
	margin: 0;
	padding: 6px 8px;
	border-radius: 8px;
	background: #fdecea;
	color: #a3241c;
	font-size: 12px;
	line-height: 1.35;
}

/* Blocos (uma cabine por bloco) */

.tchat-bloco {
	margin: 0;
	padding: 8px 10px 10px;
	border: 1px solid #e0e4ea;
	border-radius: 10px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.tchat-bloco-title {
	padding: 0 4px;
	font-size: 12px;
	font-weight: 700;
	color: #33415c;
}

/* Campos */

.tchat-campo {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.tchat-campo-label {
	font-size: 12px;
	line-height: 1.35;
	color: #33415c;
	overflow-wrap: break-word;
	word-break: break-word;
}

.tchat-campo-label input[type="checkbox"] {
	margin: 0 6px 0 0;
	vertical-align: middle;
	width: 16px;
	height: 16px;
}

.tchat-campo input[type="text"],
.tchat-campo input[type="email"],
.tchat-campo input[type="tel"],
.tchat-campo select,
.tchat-campo textarea {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	border: 1px solid #ccd0d5;
	border-radius: 8px;
	padding: 9px 10px;
	font: inherit;
	/* 16px: abaixo disso o iOS dá zoom ao focar o campo. */
	font-size: 16px;
	color: #1c1e21;
	background: #fff;
}

.tchat-campo textarea {
	resize: vertical;
	min-height: 62px;
}

.tchat-campo input:focus,
.tchat-campo select:focus,
.tchat-campo textarea:focus {
	border-color: var(--tchat-color, #0B5CAB);
}

/* Foco visível em tudo que se toca: anel na cor do tenant, só por teclado. */
.tchat-root button:focus-visible,
.tchat-root input:focus-visible,
.tchat-root select:focus-visible,
.tchat-root textarea:focus-visible,
.tchat-root a:focus-visible,
.tchat-root [tabindex]:focus-visible {
	outline: 2px solid var(--tchat-color, #0B5CAB);
	outline-offset: 2px;
}

.tchat-root input:focus:not(:focus-visible),
.tchat-root select:focus:not(:focus-visible),
.tchat-root textarea:focus:not(:focus-visible) {
	outline: none;
}

/* Stepper de hóspedes: o teto é calculado no JS (4 − o outro stepper). */

.tchat-stepper {
	display: flex;
	align-items: center;
	gap: 10px;
}

.tchat-stepper output {
	min-width: 24px;
	text-align: center;
	font-size: 15px;
	font-weight: 700;
	color: #1c1e21;
}

.tchat-stepper-btn {
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 1px solid #ccd0d5;
	border-radius: 50%;
	background: #fff;
	color: #1c1e21;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.tchat-stepper-btn:hover:not(:disabled) {
	border-color: var(--tchat-color, #0B5CAB);
	color: var(--tchat-color, #0B5CAB);
}

.tchat-stepper-btn:disabled {
	opacity: 0.45;
	cursor: default;
}

/* Opções, ações e chips */

.tchat-opcoes,
.tchat-acoes,
.tchat-persistentes {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	min-width: 0;
}

.tchat-opcao,
.tchat-acao,
.tchat-chip {
	box-sizing: border-box;
	max-width: 100%;
	border: 1px solid #ccd0d5;
	border-radius: 16px;
	padding: 7px 12px;
	background: #fff;
	color: #1c1e21;
	font: inherit;
	font-size: 13px;
	line-height: 1.25;
	text-align: left;
	cursor: pointer;
	overflow-wrap: break-word;
	word-break: break-word;
}

.tchat-opcao:hover:not([disabled]),
.tchat-acao:hover:not([disabled]),
.tchat-chip:hover:not([disabled]) {
	border-color: var(--tchat-color, #0B5CAB);
	color: var(--tchat-color, #0B5CAB);
}

/* A pílula ESCOLHIDA — inclusive sob o ponteiro.
   O seletor de hover acima é (0,3,0) (classe + :hover + :not([disabled])) e
   vencia a regra da escolhida, que era (0,2,0): passar o mouse sobre a opção já
   selecionada pintava o texto com a COR DO FUNDO dela, e o rótulo desaparecia
   justamente no momento de clicar. A segunda linha é (0,4,0) e ganha do hover
   sem mexer no hover das pílulas NÃO escolhidas, que continua sendo o de
   sempre. */
.tchat-opcao[aria-pressed="true"],
.tchat-opcao[aria-pressed="true"]:hover:not([disabled]) {
	border-color: var(--tchat-color, #0B5CAB);
	background: var(--tchat-color, #0B5CAB);
	color: #fff;
}

.tchat-opcao[disabled],
.tchat-acao[disabled],
.tchat-chip[disabled] {
	opacity: 0.45;
	cursor: default;
}

/* Alvo de toque de 44px (WCAG 2.5.8) nas pílulas e ações; o chip é atalho
   secundário e fica em 36px. */
.tchat-opcao,
.tchat-acao {
	min-height: 44px;
}

.tchat-chip {
	min-height: 36px;
}

/* Faixa de contagem (§6.3): nunca número exato. */

.tchat-opcao-faixa {
	display: block;
	font-size: 11px;
	line-height: 1.2;
	color: #6b7280;
}

.tchat-opcao[aria-pressed="true"] .tchat-opcao-faixa {
	color: rgba(255, 255, 255, 0.85);
}

.tchat-acao {
	border-color: var(--tchat-color, #0B5CAB);
	background: var(--tchat-color, #0B5CAB);
	color: #fff;
	font-weight: 600;
}

.tchat-acao:hover:not([disabled]) {
	color: #fff;
	filter: brightness(1.08);
}

/* O atalho persistente virou link (E3): "Filtrar por duração ▾" nas
   sugestões e "Escrever uma observação" dentro de "Quer detalhar mais?". */
.tchat-chip {
	border: 0;
	border-radius: 0;
	background: transparent;
	padding: 6px 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--tchat-color, #0B5CAB);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.tchat-chip:hover:not([disabled]) {
	border-color: transparent;
}

/* Opcionais recolhidos e a nota do cartão. */
.tchat-detalhes {
	border-top: 1px dashed #d3d8e0;
	padding-top: 8px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.tchat-detalhes-rotulo {
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	color: var(--tchat-color, #0B5CAB);
	list-style: none;
}

.tchat-detalhes-rotulo::-webkit-details-marker {
	display: none;
}

.tchat-detalhes-rotulo::before {
	content: "▸ ";
}

.tchat-detalhes[open] > .tchat-detalhes-rotulo::before {
	content: "▾ ";
}

.tchat-form-nota {
	margin: 0;
	padding: 0;
	font-size: 11.5px;
	line-height: 1.4;
	color: #5b6472;
}

.tchat-form-nota a {
	color: var(--tchat-color, #0B5CAB);
}

.tchat-chip-menu {
	flex: 1 1 100%;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 6px 0 2px;
}

.tchat-form-total {
	margin: 0;
	padding: 0;
	font-size: 12px;
	font-weight: 600;
	color: #33415c;
}

/* Botão de escolha dentro do card de cruzeiro */

.tchat-card-escolher {
	margin-top: 6px;
	border: 1px solid var(--tchat-color, #0B5CAB);
	border-radius: 16px;
	padding: 5px 12px;
	background: var(--tchat-color, #0B5CAB);
	color: #fff;
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
}

.tchat-card-escolher:hover {
	filter: brightness(1.08);
}

/* Aviso de armazenamento indisponível (§7.5): a retomada vale só nesta
   aba e neste aparelho. */

.tchat-aviso-armazenamento {
	flex: 0 0 auto;
	margin: 0;
	padding: 6px 12px;
	background: #fff8e1;
	border-top: 1px solid #f0e3b8;
	color: #6b5a1e;
	font-size: 11px;
	line-height: 1.35;
}

/* Entrada */

.tchat-input-row {
	display: flex;
	gap: 8px;
	flex: 0 0 auto;
	padding: 10px;
	border-top: 1px solid #e0e0e0;
	background: #fff;
}

.tchat-input {
	flex: 1 1 auto;
	min-width: 0;
	box-sizing: border-box;
	min-height: 44px;
	border: 1px solid #ccd0d5;
	border-radius: 22px;
	padding: 8px 14px;
	font: inherit;
	font-size: 16px;
	color: #1c1e21;
	background: #fff;
}

.tchat-input:focus {
	border-color: var(--tchat-color, #0B5CAB);
}

/* O compositor some quando há um formulário do fluxo na tela (regra do
   compositor, §2.6 do plano): fora do layout, não só desabilitado. */
.tchat-input-row[hidden] {
	display: none;
}

/* Com o painel aberto no celular a página não rola por trás. */
html.tchat-rolagem-travada {
	overflow: hidden;
}

.tchat-send {
	flex: 0 0 auto;
	border: 0;
	border-radius: 20px;
	padding: 8px 16px;
	background: var(--tchat-color, #0B5CAB);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.tchat-send:hover {
	filter: brightness(1.08);
}

.tchat-send:disabled {
	opacity: 0.6;
	cursor: default;
}

/* Mobile: painel em tela cheia */

@media (max-width: 600px) {
	.tchat-panel {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 100%;
		height: 100dvh;
		/* Com o teclado aberto o JS escreve a altura visível aqui. */
		height: var(--tchat-vv-h, 100dvh);
		max-height: none;
		border-radius: 0;
	}

	/* Área segura do iPhone: entalhe em cima, barra de gesto embaixo. */
	.tchat-header {
		padding-top: max(12px, env(safe-area-inset-top));
		padding-left: max(16px, env(safe-area-inset-left));
		padding-right: max(16px, env(safe-area-inset-right));
	}

	.tchat-input-row {
		padding-bottom: max(10px, env(safe-area-inset-bottom));
		padding-left: max(10px, env(safe-area-inset-left));
		padding-right: max(10px, env(safe-area-inset-right));
	}

	.tchat-messages {
		padding-left: max(12px, env(safe-area-inset-left));
		padding-right: max(12px, env(safe-area-inset-right));
	}

	/* Painel full-screen aberto: o balão flutuante ficaria pintado por cima
	   do botão Enviar (mesmo stacking context, vem depois no DOM). */
	.tchat-open .tchat-button {
		display: none;
	}

	/* Card ainda mais enxuto na tela estreita: a miniatura cede espaço para
	   o nome do navio e a data caberem sem quebrar em três linhas. */
	.tchat-bubble-cards {
		max-width: 100%;
	}

	.tchat-card-img {
		width: 60px;
		height: 60px;
	}

	/* O formulário rola dentro de .tchat-messages, e não numa gaveta
	   própria: em tela estreita o passo é a conversa. */
	.tchat-form {
		padding: 10px 8px;
	}

	/* Alvo de toque confortável no passo mais longo do fluxo (S10). */
	.tchat-stepper-btn {
		width: 36px;
		height: 36px;
	}

	.tchat-opcao,
	.tchat-acao {
		flex: 1 1 100%;
		text-align: center;
	}

	.tchat-chip-menu .tchat-opcao {
		flex: 1 1 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tchat-button,
	.tchat-panel,
	.tchat-open .tchat-panel {
		transition: none;
	}
}

/* Envio do formulário do fluxo: destaque sobre as ações de navegação.
   A variável é `--tchat-color` (a cor do tenant, posta pelo JS na .tchat-root). */
.tchat-acao-primaria {
	flex: 1 1 100%;
	background: var(--tchat-color, #0B5CAB);
	border-color: var(--tchat-color, #0B5CAB);
	color: #fff;
	font-weight: 600;
	font-size: 15px;
	text-align: center;
	border-radius: 22px;
}

.tchat-acao-primaria:hover:not([disabled]) {
	filter: brightness(1.08);
}

/* Papéis das ações (E4): pílula larga de opção, link secundário, voltar. */

.tchat-acao-opcao {
	flex: 1 1 100%;
	background: #fff;
	border-color: #ccd0d5;
	color: #1c1e21;
	font-weight: 600;
	text-align: left;
}

.tchat-acao-opcao:hover:not([disabled]) {
	background: #fff;
	border-color: var(--tchat-color, #0B5CAB);
	color: var(--tchat-color, #0B5CAB);
	filter: none;
}

.tchat-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0 14px;
	min-width: 0;
}

.tchat-acao-link,
.tchat-voltar {
	border: 0;
	background: transparent;
	padding: 6px 0;
	min-height: 44px;
	color: var(--tchat-color, #0B5CAB);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	text-align: left;
}

.tchat-acao-link {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.tchat-voltar {
	align-self: flex-start;
	min-height: 32px;
	padding: 2px 0;
}

.tchat-acao-link[disabled],
.tchat-voltar[disabled] {
	opacity: 0.45;
	cursor: default;
}

/* O eco da resposta do cliente (P4): local, um tom mais leve. */
.tchat-msg-visitor.tchat-eco .tchat-bubble {
	opacity: 0.92;
}

/* O balão da saudação (plano §3): acima do botão, do mesmo lado, sem cobrir
   outro botão flutuante do tema (no T4 o WhatsApp fica à esquerda). */
.tchat-teaser {
	position: absolute;
	bottom: 76px;
	width: min(300px, calc(100vw - 40px));
	display: flex;
	align-items: flex-start;
	background: #fff;
	color: #1c1e21;
	border-radius: 14px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.tchat-pos-right .tchat-teaser {
	right: 0;
}

.tchat-pos-left .tchat-teaser {
	left: 0;
}

.tchat-teaser-abrir {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	gap: 10px;
	align-items: flex-start;
	border: 0;
	background: transparent;
	padding: 12px 4px 12px 12px;
	font: inherit;
	font-size: 14px;
	line-height: 1.35;
	color: #1c1e21;
	text-align: left;
	cursor: pointer;
}

.tchat-teaser-abrir .tchat-avatar {
	background: var(--tchat-color, #0B5CAB);
	color: #fff;
	width: 30px;
	height: 30px;
	font-size: 13px;
}

.tchat-teaser-texto {
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: break-word;
}

.tchat-teaser-fechar {
	flex: 0 0 auto;
	width: 44px;
	min-height: 44px;
	border: 0;
	background: transparent;
	color: #6b7280;
	font: inherit;
	font-size: 20px;
	cursor: pointer;
}

.tchat-open .tchat-teaser {
	display: none;
}

/* Só para o leitor de tela (o rótulo do campo que avança). */
.tchat-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
