/* Alinha — tokens e base partilhada (site público + painéis). Paleta retirada do monograma da marca. */
:root {
  --creme: #eee5d4;
  --creme-claro: #f7f2ea;
  --papel: #fbf8f3;
  --areia: #dccfb8;
  --areia-escura: #c9b99c;
  --taupe: #6c6050;
  --taupe-escuro: #4a4136;
  --tinta: #2f2922;
  --texto: #3d352b;
  --texto-suave: #7b7062;
  --salvia: #7f978b;
  --salvia-clara: #e3eae4;
  --terracota: #b8875a;
  --perigo: #b0533f;
  --perigo-claro: #f6e3dd;
  --aviso: #b58a2a;
  --aviso-claro: #f6edd6;
  --ok: #4f7d64;
  --ok-claro: #e1eee5;
  --linha: #e6dccb;
  --sombra: 0 1px 2px rgba(74, 65, 54, .06), 0 8px 24px rgba(74, 65, 54, .08);
  --sombra-forte: 0 20px 60px rgba(47, 41, 34, .18);
  --raio: 14px;
  --raio-g: 24px;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--sans); color: var(--texto); background: var(--papel); line-height: 1.6; font-size: 15px; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--taupe); text-decoration: none; }
a:hover { color: var(--taupe-escuro); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; color: var(--tinta); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--areia); color: var(--tinta); }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; padding: .8em 1.5em; border-radius: 999px; border: 1px solid transparent;
  background: var(--taupe); color: #fff; font-weight: 600; font-size: .95rem; cursor: pointer; transition: all .2s ease; white-space: nowrap; text-decoration: none; line-height: 1.2; }
.btn:hover { background: var(--taupe-escuro); color: #fff; transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-claro { background: var(--creme-claro); color: var(--taupe-escuro); border-color: var(--linha); }
.btn-claro:hover { background: var(--creme); color: var(--tinta); }
.btn-contorno { background: transparent; color: var(--taupe-escuro); border-color: var(--areia-escura); }
.btn-contorno:hover { background: var(--creme-claro); color: var(--tinta); }
.btn-perigo { background: var(--perigo); }
.btn-perigo:hover { background: #8f3f2f; }
.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #3c634d; }
.btn-sm { padding: .45em 1em; font-size: .85rem; }
.btn-xs { padding: .3em .75em; font-size: .78rem; }
.btn-bloco { width: 100%; }

/* Formulários */
.campo { margin-bottom: 1rem; }
.campo label, .rotulo { display: block; font-size: .8rem; font-weight: 600; color: var(--texto-suave); margin-bottom: .35rem; letter-spacing: .02em; }
.input, input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: .7em .9em; border: 1px solid var(--linha); border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s; font-size: .95rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--taupe); box-shadow: 0 0 0 3px rgba(108, 96, 80, .15); }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox], input[type=radio] { accent-color: var(--taupe); width: 1.05em; height: 1.05em; vertical-align: middle; }
.check { display: flex; align-items: center; gap: .55em; font-size: .92rem; cursor: pointer; margin-bottom: .5rem; }
.ajuda { font-size: .8rem; color: var(--texto-suave); margin-top: .3rem; }

/* Alertas */
.alerta { padding: .85em 1.1em; border-radius: 12px; margin-bottom: 1rem; font-size: .92rem; border: 1px solid transparent; }
.alerta-ok { background: var(--ok-claro); color: #2e5a42; border-color: #c6dccd; }
.alerta-erro { background: var(--perigo-claro); color: #7c3426; border-color: #ecc8bd; }
.alerta-aviso { background: var(--aviso-claro); color: #75591a; border-color: #ead9ae; }
.alerta-info { background: var(--creme-claro); color: var(--taupe-escuro); border-color: var(--linha); }

.selo { display: inline-flex; align-items: center; gap: .3em; padding: .2em .7em; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; background: var(--creme); color: var(--taupe-escuro); white-space: nowrap; }
.selo-ok { background: var(--ok-claro); color: #2e5a42; }
.selo-perigo { background: var(--perigo-claro); color: #8a3a2b; }
.selo-aviso { background: var(--aviso-claro); color: #7a5c17; }
.selo-info { background: var(--salvia-clara); color: #3f5a4d; }
.selo-neutro { background: #efebe5; color: #6b6358; }

.muted { color: var(--texto-suave); }
.pequeno { font-size: .85rem; }
.centro { text-align: center; }
.direita { text-align: right; }
.oculto { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ===== Assistente (chat) ===== */
.chat-botao { position: fixed; right: 20px; bottom: 20px; z-index: 900; display: flex; align-items: center; gap: .6em; padding: .75em 1.2em .75em .8em; border-radius: 999px; border: 0;
  background: var(--tinta); color: var(--creme); box-shadow: var(--sombra-forte); cursor: pointer; font-weight: 600; transition: transform .2s; }
.chat-botao:hover { transform: translateY(-2px); }
.chat-botao .chat-avatar { width: 34px; height: 34px; }
.chat-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--creme) url(/assets/img/logo-a.png) center/78% no-repeat; flex-shrink: 0; }
.chat-foto { width: 46px; height: 46px; object-fit: cover; border: 2px solid rgba(255,255,255,.85); background: #fff; }
.chat-painel { --chat-cor: var(--tinta); position: fixed; right: 20px; bottom: 20px; z-index: 950; width: 390px; max-width: calc(100vw - 24px); height: 620px; max-height: calc(100vh - 40px);
  background: var(--papel); border-radius: 22px; box-shadow: var(--sombra-forte); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--linha);
  transform-origin: center; animation: chatAbrir .45s cubic-bezier(.2, .8, .2, 1); }
.chat-painel.fechando { animation: chatFechar .3s ease forwards; }
/* Abre do centro para as extremidades */
@keyframes chatAbrir { from { opacity: 0; transform: scale(.4); clip-path: circle(0% at 50% 50%); } 60% { opacity: 1; } to { opacity: 1; transform: none; clip-path: circle(75% at 50% 50%); } }
@keyframes chatFechar { from { opacity: 1; transform: none; clip-path: circle(75% at 50% 50%); } to { opacity: 0; transform: scale(.4); clip-path: circle(0% at 50% 50%); } }
@media (prefers-reduced-motion: reduce) { .chat-painel, .chat-painel.fechando { animation-duration: .01s; } .wa-bolha::before, .wa-bolha::after { animation: none; } }
.chat-topo { display: flex; align-items: center; gap: .75em; padding: 14px 16px; background: var(--chat-cor); color: #fff; }
.chat-topo strong { display: block; font-size: 1.05rem; font-weight: 700; line-height: 1.25; }
.chat-topo span { font-size: .8rem; opacity: .85; }
.chat-topo .chat-fechar { margin-left: auto; background: rgba(255,255,255,.1); border: 0; color: inherit; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 1.2rem; }
.chat-mensagens { flex: 1; overflow-y: auto; padding: 18px 14px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(180deg, var(--creme-claro), var(--papel)); }
.msg { max-width: 86%; padding: .7em 1em; border-radius: 18px; font-size: .92rem; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; animation: msgEntrar .2s ease; }
@keyframes msgEntrar { from { opacity: 0; transform: translateY(6px); } }
.msg-bot { background: #fff; border: 1px solid var(--linha); border-bottom-left-radius: 6px; align-self: flex-start; }
.msg-eu { background: var(--chat-cor); color: #fff; border-bottom-right-radius: 6px; align-self: flex-end; }
.msg a { color: var(--terracota); text-decoration: underline; font-weight: 600; }
.msg-eu a { color: #fff; }
.msg-equipa { border-color: var(--salvia-clara); background: #f7faf8; }
.msg-autor { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .03em; color: #5f7a6e; margin-bottom: 2px; }
.chat-opcoes { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; max-height: 150px; overflow-y: auto; }
.chat-opcoes button { border: 1px solid var(--areia-escura); background: #fff; color: var(--taupe-escuro); border-radius: 999px; padding: .45em .95em; font-size: .84rem; cursor: pointer; font-weight: 600; transition: all .15s; }
.chat-opcoes button:hover { background: var(--chat-cor); border-color: var(--chat-cor); color: #fff; }
.chat-form { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--linha); background: #fff; }
.chat-form input { border-radius: 999px; }
.chat-form input[type=text] { flex: 1; min-width: 0; }
.chat-form button { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: 0; background: var(--chat-cor); color: #fff; cursor: pointer; display: grid; place-items: center; }
.digitando { display: inline-flex; gap: 4px; padding: .9em 1em; }
.digitando i { width: 7px; height: 7px; border-radius: 50%; background: var(--areia-escura); animation: pulsar 1s infinite; }
.digitando i:nth-child(2) { animation-delay: .15s; } .digitando i:nth-child(3) { animation-delay: .3s; }
@keyframes pulsar { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
/* Formulário de entrada (nome + WhatsApp) */
.chat-entrada { flex: 1; overflow-y: auto; padding: 16px; background: #eceff3; }
.chat-entrada-cartao { background: #fff; border-radius: 16px; padding: 18px 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.chat-entrada p { margin: 0 0 16px; font-size: .95rem; line-height: 1.5; color: var(--texto); }
.chat-entrada label { display: block; font-size: .85rem; font-weight: 700; margin: 0 0 6px; color: var(--tinta); }
.chat-entrada input { width: 100%; margin-bottom: 14px; border-radius: 10px; }
.chat-entrada input:focus { border-color: var(--chat-cor); box-shadow: 0 0 0 3px color-mix(in srgb, var(--chat-cor) 18%, transparent); outline: 0; }
.chat-entrada button { width: 100%; border: 0; border-radius: 12px; padding: .95em 1em; background: var(--chat-cor); color: #fff; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; cursor: pointer; transition: filter .15s; }
.chat-entrada button:hover { filter: brightness(1.08); }
.chat-entrada button:disabled { opacity: .6; cursor: wait; }
.chat-entrada-erro { color: var(--perigo); font-size: .84rem; margin: -6px 0 10px; min-height: 0; }
.chat-entrada-erro:empty { display: none; }

/* Primeiro ecrã (nome + WhatsApp): a janela fica com a altura do formulário, sem espaço vazio por baixo */
.chat-painel.chat-com-entrada { height: auto; }
.chat-com-entrada .chat-entrada { flex: 0 0 auto; }
/* Anexos e mensagens de voz */
.chat-form { align-items: center; }
.chat-form .chat-anexar, .chat-form .chat-mic { width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--texto-suave); background: transparent; border: 0; transition: background .15s, color .15s; }
.chat-form .chat-anexar:hover, .chat-form .chat-mic:hover { background: var(--creme); color: var(--chat-cor); }
.chat-form .chat-mic { background: var(--chat-cor); color: #fff; width: 44px; height: 44px; }
.chat-form .chat-mic:hover { background: var(--chat-cor); color: #fff; filter: brightness(1.1); }
.chat-form .chat-enviar { display: none !important; }
.chat-form.tem-texto .chat-enviar { display: grid !important; }
.chat-form.tem-texto .chat-mic { display: none; }
.chat-gravar { display: flex; align-items: center; gap: 10px; padding: 10px 12px 12px; border-top: 1px solid var(--linha); background: #fff; font-size: .92rem; font-variant-numeric: tabular-nums; }
.chat-gravar-ponto { width: 10px; height: 10px; border-radius: 50%; background: #d64545; animation: gravarPiscar 1s infinite; }
@keyframes gravarPiscar { 50% { opacity: .25; } }
.chat-gravar-txt { color: var(--texto-suave); flex: 1; }
.chat-gravar-cancelar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--creme); color: var(--texto); font-size: 1.2rem; cursor: pointer; }
.chat-gravar-enviar { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--chat-cor); color: #fff; cursor: pointer; display: grid; place-items: center; }
.msg-com-anexo { padding: 6px; }
.msg-com-anexo > span { display: block; padding: 4px 6px 2px; }
.msg-anexo-img img { display: block; max-width: 220px; max-height: 260px; border-radius: 12px; }
.msg audio { display: block; width: 240px; max-width: 100%; height: 40px; }
/* Mensagem de voz: mesmo leitor do painel */
.msg.msg-audio { padding: 4px 6px; white-space: normal; }
.msg-audio .msg-autor { margin: 1px 6px 2px; }
.chat-audio { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.85); border-radius: 999px; padding: 4px 12px 4px 4px; width: 230px; max-width: 100%; color: var(--texto); }
.chat-audio button { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--chat-cor); color: #fff; font-size: .74rem; cursor: pointer; flex-shrink: 0; display: grid; place-items: center; padding: 0; }
.chat-audio .barra { flex: 1; height: 4px; background: #cbd5e1; border-radius: 4px; position: relative; cursor: pointer; }
.chat-audio .barra i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--chat-cor); border-radius: 4px; }
.chat-audio .barra b { position: absolute; top: 50%; left: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--chat-cor); }
.chat-audio span { font-size: .74rem; color: #475569; font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }
.msg-bot .chat-audio { background: var(--creme-claro); }
.msg video { display: block; max-width: 240px; border-radius: 12px; }
.msg-anexo-doc { display: inline-block; padding: 6px 8px; font-weight: 600; word-break: break-all; }
.msg-a-enviar { opacity: .6; }
body.chat-aberto .wa-flutuante { display: none !important; }

/* Bolinha do WhatsApp com efeito sonar */
.wa-flutuante { --wa-cor: #25d366; position: fixed; right: 22px; bottom: 22px; z-index: 900; display: flex; align-items: center; gap: 12px; }
.wa-bolha { position: relative; width: 62px; height: 62px; border-radius: 50%; border: 0; background: var(--wa-cor); color: #fff; display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.22); transition: transform .2s; }
.wa-bolha:hover { transform: scale(1.07); }
.wa-bolha svg { position: relative; z-index: 1; }
.wa-bolha::before, .wa-bolha::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--wa-cor); z-index: 0; animation: waSonar 2.2s ease-out infinite; }
.wa-bolha::after { animation-delay: 1.1s; }
@keyframes waSonar { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(2); opacity: 0; } }
.wa-balao { background: #fff; color: var(--tinta); font-size: .86rem; font-weight: 600; padding: .6em 1em; border-radius: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.14); white-space: nowrap; animation: msgEntrar .4s ease 1.5s both; }
.chat-embutido { position: static; width: 100%; max-width: none; height: 640px; max-height: calc(100vh - 180px); animation: none; box-shadow: var(--sombra); }
@media (max-width: 520px) {
  .chat-painel:not(.chat-embutido) { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  /* Primeira caixa (nome + WhatsApp): cartão compacto por baixo, sem a parte branca */
  .chat-painel.chat-com-entrada:not(.chat-embutido) { right: 12px; bottom: 12px; width: calc(100vw - 24px); height: auto; max-height: calc(100dvh - 24px); border-radius: 22px; }
  .chat-botao span { display: none; } .chat-botao { padding: .6em; }
  .wa-flutuante { right: 16px; bottom: 16px; } .wa-bolha { width: 56px; height: 56px; } .wa-balao { display: none; }
}

/* Seletor de idioma (PT / BR) */
.idiomas { display: inline-flex; background: var(--creme); border-radius: 999px; padding: 3px; gap: 2px; flex-shrink: 0; }
.idiomas a { font-size: .74rem; font-weight: 700; letter-spacing: .06em; padding: 5px 10px; border-radius: 999px; color: var(--texto-suave); line-height: 1; }
.idiomas a:hover { color: var(--tinta); }
.idiomas a.ativo { background: #fff; color: var(--tinta); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
@media (max-width: 420px) { .idiomas a { padding: 5px 8px; } }
/* Pergunta ao fechar o chat (minimizar / encerrar) */
.chat-confirmar { position: absolute; inset: 0; z-index: 5; background: rgba(15,23,42,.35); display: flex; align-items: center; justify-content: center; padding: 20px; animation: msgEntrar .2s ease; }
.chat-confirmar-caixa { background: #fff; border-radius: 18px; padding: 22px 20px 14px; width: 100%; max-width: 300px; text-align: center; box-shadow: 0 16px 40px rgba(0,0,0,.2); }
.chat-confirmar-caixa b { display: block; font-size: 1.05rem; color: var(--tinta); margin-bottom: 6px; }
.chat-confirmar-caixa p { font-size: .86rem; color: var(--texto-suave); margin: 0 0 16px; line-height: 1.45; }
.chat-confirmar-caixa button { display: block; width: 100%; border-radius: 12px; padding: .8em 1em; font-weight: 700; cursor: pointer; margin-bottom: 8px; border: 0; }
.chat-conf-sec { background: var(--creme-claro); color: var(--tinta); border: 1px solid var(--linha) !important; }
.chat-conf-pri { background: var(--chat-cor); color: #fff; }
.chat-conf-pri:disabled { opacity: .6; }
.chat-conf-link { background: none; color: var(--texto-suave); font-weight: 600 !important; font-size: .84rem; margin-bottom: 0 !important; }
.chat-fim { align-self: center; text-align: center; background: #fff; border: 1px solid var(--linha); border-radius: 16px; padding: 14px 16px; font-size: .9rem; line-height: 1.5; max-width: 92%; animation: msgEntrar .3s ease; }
.chat-fim span { display: block; font-size: 1.6rem; margin-bottom: 4px; }

/* Campos de ficheiro: não passam da caixa (o "Nenhum ficheiro selecionado" corta com reticências) */
input[type=file]:not([hidden]) { display: block; width: 100%; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; color: var(--texto-suave);
  padding: 6px; border: 1px dashed var(--linha); border-radius: 10px; background: #fff; cursor: pointer; }
input[type=file]::file-selector-button { margin-right: 10px; padding: 6px 12px; border: 1px solid var(--linha); border-radius: 8px; background: var(--creme); color: var(--tinta); font: inherit; font-weight: 600; cursor: pointer; }
input[type=file]:hover::file-selector-button { background: #e6dccb; }
