/* ---------------------------------------------------------------------------
   Paleta e tipografia do app de baterias (TCL Aviation), aplicadas a um chat.
   Fonte Archivo, fundo slate-100, cabecalho no gradiente #0f172a -> #1e3a8a,
   primaria blue-600.
   --------------------------------------------------------------------------- */
:root {
  --tinta:        #0f172a;   /* slate-900 */
  --marinho:      #1e3a8a;   /* blue-900  */
  --azul:         #2563eb;   /* blue-600  */
  --azul-escuro:  #1d4ed8;   /* blue-700  */
  --azul-claro:   #dbeafe;   /* blue-100  */
  --azul-palido:  #eff6ff;   /* blue-50   */
  --fundo:        #f1f5f9;   /* slate-100 */
  --papel:        #ffffff;
  --texto:        #1e293b;   /* slate-800 */
  --texto-fraco:  #64748b;   /* slate-500 */
  --texto-tenue:  #94a3b8;   /* slate-400 */
  --borda:        #e2e8f0;   /* slate-200 */
  --borda-forte:  #cbd5e1;   /* slate-300 */
  --alerta-fundo: #fffbeb;   /* amber-50  */
  --alerta-borda: #fde68a;   /* amber-200 */
  --alerta-texto: #92400e;   /* amber-800 */
  --ok:           #059669;   /* emerald-600 */
  --erro:         #dc2626;   /* red-600   */
  --cabecalho:    linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  --sombra:       0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--fundo);
  color: var(--texto);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--azul); }

/* ---------------------------------------------------------------------- topo */
.topo {
  background: var(--cabecalho);
  color: #fff;
  box-shadow: 0 4px 12px -6px rgba(15, 23, 42, .5);
  position: sticky; top: 0; z-index: 20;
}
.topo-interno {
  max-width: 860px; margin: 0 auto; padding: .85rem 1rem;
  display: flex; align-items: center; gap: .8rem;
}
.marca { display: flex; align-items: baseline; gap: .55rem; min-width: 0; }
.marca h1 { margin: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.marca span { color: #bfdbfe; font-size: .72rem; font-weight: 500; }
.topo nav { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.topo nav a, .topo nav button {
  color: #dbeafe; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  padding: .35rem .7rem; border-radius: .5rem; font-size: .8rem; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.topo nav a:hover, .topo nav button:hover { background: rgba(255,255,255,.18); color: #fff; }

/* ------------------------------------------------------------------- conversa
   Bolhas no formato que todo mundo ja conhece do WhatsApp: a minha a direita,
   a do robo a esquerda, com o "rabinho" na primeira de cada lado. */
.conversa {
  max-width: 860px; margin: 0 auto; padding: 1.1rem 1rem 8rem;
  display: flex; flex-direction: column; gap: .55rem;
}
.linha { display: flex; }
.linha.minha { justify-content: flex-end; }

.bolha {
  max-width: min(80%, 620px);
  padding: .6rem .8rem;
  border-radius: 1rem;
  box-shadow: var(--sombra);
  line-height: 1.5;
  font-size: .935rem;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.bolha.robo  { background: var(--papel); border-top-left-radius: .25rem; }
.bolha.minha { background: var(--azul); color: #fff; border-top-right-radius: .25rem; }
.bolha.minha a { color: #fff; }
.bolha p { margin: 0 0 .5rem; }
.bolha p:last-child { margin-bottom: 0; }
.bolha strong { font-weight: 700; }

.hora { display: block; margin-top: .3rem; font-size: .68rem; color: var(--texto-tenue); text-align: right; }
.bolha.minha .hora { color: rgba(255,255,255,.7); }

/* marcador de citacao dentro do texto: [1] clicavel */
.marcador {
  display: inline-block; min-width: 1.15rem; height: 1.15rem; line-height: 1.15rem;
  margin: 0 .1rem; padding: 0 .28rem;
  background: var(--azul-claro); color: var(--azul-escuro);
  border-radius: .3rem; font-size: .72rem; font-weight: 700; text-align: center;
  cursor: pointer; vertical-align: .05rem; border: 0;
}
.marcador:hover { background: var(--azul); color: #fff; }

/* ------------------------------------------------------------------- citacoes */
.fontes { margin-top: .55rem; padding-top: .5rem; border-top: 1px solid var(--borda); }
.fontes-titulo {
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--texto-tenue); margin-bottom: .4rem;
}
.fonte {
  border: 1px solid var(--borda); border-radius: .6rem; overflow: hidden;
  margin-bottom: .35rem; background: #fbfdff;
}
.fonte-topo {
  display: flex; align-items: center; gap: .45rem; flex-wrap: wrap;
  padding: .45rem .55rem; cursor: pointer; user-select: none;
}
.fonte-topo:hover { background: var(--azul-palido); }
.fonte-n {
  flex: none; width: 1.3rem; height: 1.3rem; line-height: 1.3rem; text-align: center;
  background: var(--azul-claro); color: var(--azul-escuro);
  border-radius: .3rem; font-size: .72rem; font-weight: 700;
}
.fonte-nome { font-weight: 700; font-size: .82rem; }
.fonte-onde { font-size: .76rem; color: var(--texto-fraco); }
.fonte-corpo { display: none; padding: 0 .55rem .55rem; }
.fonte.aberta .fonte-corpo { display: block; }
.fonte-texto {
  background: #fff; border: 1px solid var(--borda); border-radius: .4rem;
  padding: .5rem .6rem; font-size: .8rem; line-height: 1.55; color: #334155;
  white-space: pre-wrap; max-height: 15rem; overflow: auto;
}
.fonte-acoes { display: flex; gap: .4rem; margin-top: .45rem; flex-wrap: wrap; }

.etiqueta {
  font-size: .66rem; font-weight: 700; padding: .12rem .4rem; border-radius: .3rem;
  text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
}
.et-obrigacao         { background: #dcfce7; color: #166534; }
.et-fiscalizacao      { background: var(--azul-claro); color: var(--azul-escuro); }
.et-orientacao        { background: #f1f5f9; color: #475569; }
.et-diretriz          { background: #ede9fe; color: #5b21b6; }
.et-guia              { background: #f1f5f9; color: #64748b; }
.et-procedimento_local{ background: #ffedd5; color: #9a3412; }
.et-restrito          { background: #fee2e2; color: #991b1b; }
.et-alerta            { background: var(--alerta-fundo); color: var(--alerta-texto); border: 1px solid var(--alerta-borda); }

/* imagem do trecho — chega como foto no chat */
.print { margin-top: .45rem; }
.print img {
  width: 100%; border: 1px solid var(--borda-forte); border-radius: .5rem;
  display: block; background: #fff;
}
.print-legenda { font-size: .7rem; color: var(--texto-fraco); margin-top: .25rem; }

/* --------------------------------------------------------------------- avisos */
.aviso {
  background: var(--alerta-fundo); border: 1px solid var(--alerta-borda);
  color: var(--alerta-texto); border-radius: .6rem; padding: .5rem .65rem;
  font-size: .8rem; line-height: 1.45; margin-top: .5rem;
}
.aviso a { color: var(--alerta-texto); font-weight: 700; }

/* ------------------------------------------------------------------- digitando */
.digitando { display: flex; gap: .25rem; padding: .25rem .1rem; }
.digitando i {
  width: .42rem; height: .42rem; border-radius: 50%; background: var(--texto-tenue);
  animation: pisca 1.3s infinite ease-in-out;
}
.digitando i:nth-child(2) { animation-delay: .18s; }
.digitando i:nth-child(3) { animation-delay: .36s; }
@keyframes pisca { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-.18rem); } }

/* ------------------------------------------------------------------- composer */
.barra {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(241, 245, 249, .94); backdrop-filter: blur(8px);
  border-top: 1px solid var(--borda); padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom));
  z-index: 15;
}
.barra-interna { max-width: 860px; margin: 0 auto; display: flex; gap: .5rem; align-items: flex-end; }
.barra textarea {
  flex: 1; resize: none; border: 1px solid var(--borda-forte); border-radius: 1.35rem;
  padding: .65rem 1rem; font-size: .93rem; line-height: 1.4; background: #fff;
  max-height: 8rem; min-height: 2.7rem; outline: none;
}
.barra textarea:focus { border-color: var(--azul); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13); }
.enviar {
  flex: none; width: 2.7rem; height: 2.7rem; border-radius: 50%; border: 0;
  background: var(--azul); color: #fff; cursor: pointer;
  display: grid; place-items: center;
}
.enviar:hover:not(:disabled) { background: var(--azul-escuro); }
.enviar:disabled { background: var(--borda-forte); cursor: not-allowed; }
.enviar svg { width: 1.15rem; height: 1.15rem; }

/* --------------------------------------------------------------------- botoes */
.btn {
  border: 1px solid var(--borda-forte); background: #fff; color: var(--texto);
  border-radius: .45rem; padding: .3rem .6rem; font-size: .76rem; font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--azul-palido); border-color: var(--azul); color: var(--azul-escuro); }
.btn-forte { background: var(--azul); border-color: var(--azul); color: #fff; }
.btn-forte:hover { background: var(--azul-escuro); border-color: var(--azul-escuro); color: #fff; }
.btn:disabled { opacity: .55; cursor: progress; }

/* --------------------------------------------------------------- sugestoes */
.sugestoes { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.sugestao {
  background: #fff; border: 1px solid var(--borda); border-radius: 1rem;
  padding: .4rem .75rem; font-size: .8rem; cursor: pointer; color: var(--texto);
  box-shadow: var(--sombra);
}
.sugestao:hover { border-color: var(--azul); color: var(--azul-escuro); background: var(--azul-palido); }

/* ------------------------------------------------------------------- formulario */
.folha {
  max-width: 440px; margin: 2.5rem auto; background: #fff; border: 1px solid var(--borda);
  border-radius: .9rem; padding: 1.6rem; box-shadow: var(--sombra);
}
.folha h2 { margin: 0 0 .3rem; font-size: 1.25rem; font-weight: 800; }
.folha .sub { margin: 0 0 1.2rem; color: var(--texto-fraco); font-size: .85rem; line-height: 1.5; }
.campo { margin-bottom: .8rem; }
.campo label { display: block; font-size: .78rem; font-weight: 700; margin-bottom: .25rem; color: #475569; }
.campo input, .campo textarea, .campo select {
  width: 100%; border: 1px solid var(--borda-forte); border-radius: .5rem;
  padding: .55rem .7rem; font-size: .9rem; outline: none; background: #fff;
}
.campo input:focus, .campo textarea:focus, .campo select:focus {
  border-color: var(--azul); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
}
.campo .dica { font-size: .72rem; color: var(--texto-tenue); margin-top: .2rem; }
.folha .principal {
  width: 100%; background: var(--azul); color: #fff; border: 0; border-radius: .55rem;
  padding: .7rem; font-size: .92rem; font-weight: 700; cursor: pointer; margin-top: .4rem;
}
.folha .principal:hover { background: var(--azul-escuro); }
.folha .principal:disabled { background: var(--borda-forte); cursor: progress; }
.recado { border-radius: .5rem; padding: .6rem .7rem; font-size: .82rem; margin-bottom: .9rem; line-height: 1.45; }
.recado.erro { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.recado.ok   { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.rodape-folha { text-align: center; margin-top: 1rem; font-size: .8rem; color: var(--texto-fraco); }

/* ---------------------------------------------------------------------- painel */
.painel { max-width: 1180px; margin: 1.2rem auto; padding: 0 1rem 4rem; }
.cartoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin-bottom: 1.2rem; }
.cartao { background: #fff; border: 1px solid var(--borda); border-radius: .7rem; padding: .8rem; box-shadow: var(--sombra); }
.cartao .n { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.cartao .r { font-size: .74rem; color: var(--texto-fraco); margin-top: .2rem; }
.secao { background: #fff; border: 1px solid var(--borda); border-radius: .7rem; margin-bottom: 1.2rem; overflow: hidden; }
.secao > h3 {
  margin: 0; padding: .75rem 1rem; font-size: .92rem; font-weight: 800;
  border-bottom: 1px solid var(--borda); display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
}
.secao > h3 .acoes { margin-left: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { padding: .5rem .7rem; text-align: left; border-bottom: 1px solid var(--borda); vertical-align: top; }
th { background: #f8fafc; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--texto-fraco); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.rolagem { overflow-x: auto; }
td select, td input { border: 1px solid var(--borda-forte); border-radius: .35rem; padding: .22rem .35rem; font-size: .78rem; max-width: 100%; }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .78rem; }
.esmaecido { color: var(--texto-tenue); }

@media (max-width: 640px) {
  .bolha { max-width: 88%; }
  .marca span { display: none; }
  .conversa { padding-bottom: 7rem; }
}

/* ------------------------------------------------- formulário do pedido IRA */
.folha-larga { max-width: 720px; }

.grupo {
  margin: 1.5rem 0 .7rem; padding-bottom: .35rem; font-size: .92rem; font-weight: 800;
  border-bottom: 1px solid var(--borda); display: flex; align-items: baseline; gap: .5rem;
}
.grupo span {
  margin-left: auto; font-size: .68rem; font-weight: 600; color: var(--texto-tenue);
  font-family: ui-monospace, Consolas, monospace;
}
.nota { font-size: .8rem; color: var(--texto-fraco); line-height: 1.5; margin: 0 0 .8rem; }

.dupla, .tripla { display: grid; gap: .7rem; }
.dupla { grid-template-columns: 1fr 1fr; }
.tripla { grid-template-columns: 1.2fr 1fr .8fr; }
@media (max-width: 560px) { .dupla, .tripla { grid-template-columns: 1fr; } }

.marcar {
  display: flex; gap: .6rem; align-items: flex-start; margin: 1rem 0;
  background: var(--azul-palido); border: 1px solid var(--azul-claro);
  border-radius: .55rem; padding: .7rem; font-size: .82rem; line-height: 1.5;
}
.marcar input { margin-top: .18rem; width: 1rem; height: 1rem; flex: none; }

/* trilha dos três passos */
.passos { display: flex; gap: .35rem; margin: 0 0 1.2rem; flex-wrap: wrap; }
.passo {
  flex: 1 1 auto; text-align: center; font-size: .72rem; font-weight: 700;
  padding: .38rem .5rem; border-radius: .4rem; background: #fff;
  border: 1px solid var(--borda); color: var(--texto-tenue); white-space: nowrap;
}
.passo.atual { border-color: var(--azul); color: var(--azul-escuro); background: var(--azul-palido); }
.passo.feito { border-color: #a7f3d0; color: #065f46; background: #ecfdf5; }

.bloco {
  background: #fff; border: 1px solid var(--borda); border-radius: .7rem;
  padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.bloco .grupo:first-child { margin-top: 0; }

.receita { margin: 0; padding-left: 1.2rem; font-size: .85rem; line-height: 1.6; }
.receita li { margin-bottom: 1rem; }
.receita input[type=file] { display: block; margin: .4rem 0; font-size: .78rem; max-width: 100%; }

.doc {
  display: flex; gap: .7rem; align-items: center; flex-wrap: wrap;
  padding: .55rem 0; border-bottom: 1px solid var(--borda);
}
.doc:last-child { border-bottom: 0; }
.doc-nome { font-size: .83rem; font-weight: 600; flex: 1 1 260px; }
.doc-nome span { font-weight: 500; font-family: ui-monospace, Consolas, monospace; font-size: .7rem; }
.doc-acao { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.doc-acao input[type=file] { font-size: .74rem; max-width: 190px; }
.doc-acao .estado { font-size: .74rem; }

/* ---------------------------------------- ficha da bateria (Wh → veredito)
   Mesma semântica de cor da calculadora do app de baterias:
   verde = pode · âmbar = precisa de aprovação · vermelho = não pode. */
.ficha {
  border: 1px solid; border-radius: .65rem; padding: .65rem .75rem;
  margin-bottom: .7rem;
}
.ficha-liberado  { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.ficha-aprovacao { background: var(--alerta-fundo); border-color: var(--alerta-borda); color: var(--alerta-texto); }
.ficha-proibido  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.ficha-pergunta  { background: var(--azul-palido); border-color: var(--azul-claro); color: var(--azul-escuro); }

.ficha-topo { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.ficha-selo {
  font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
}
.ficha-wh {
  margin-left: auto; font-size: 1.5rem; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ficha-wh small { font-size: .78rem; font-weight: 700; }
.ficha-estimativa {
  display: block; font-size: .66rem; font-weight: 600; text-transform: none;
  letter-spacing: 0; opacity: .8; margin-top: .15rem; text-align: right;
}
.ficha-conta { font-size: .72rem; opacity: .82; margin-top: .2rem; }
.ficha-aviso { font-size: .82rem; font-weight: 700; margin-top: .45rem; }

.ficha-regras { margin: .55rem 0 0; padding-left: 1.05rem; font-size: .83rem; line-height: 1.5; }
.ficha-regras li { margin-bottom: .35rem; }
.ficha-fonte {
  display: block; font-size: .66rem; opacity: .72; margin-top: .1rem;
  font-family: ui-monospace, Consolas, monospace;
}

/* ------------------------------------ validação dos documentos do pedido */
.val-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
  padding: .3rem 0; border-top: 1px dashed var(--borda);
}
.val-nome { font-weight: 700; min-width: 7.5rem; }
.val-acoes { margin-left: auto; display: flex; gap: .25rem; }
.val-acoes .btn { padding: .15rem .45rem; font-size: .7rem; }
.val-motivo { flex-basis: 100%; font-size: .72rem; color: #991b1b; }
.val-pronto { margin-top: .4rem; font-weight: 700; color: #065f46; }
.val-faltam { margin-top: .4rem; font-weight: 700; color: #92400e; }

/* ------------------------------------ exclusão de conta */
.btn-perigo { background: #fff; border-color: #fecaca; color: #991b1b; }
.btn-perigo:hover:not(:disabled) { background: #fef2f2; }
tr.excluida > td { opacity: .62; }

/* ------------------------------------ aviso: consulta pública pelo Google */
.aviso-ia { max-width: 52rem; margin: .25rem auto 0; padding: 0 1rem; font-size: .68rem;
            color: var(--texto-tenue); text-align: center; line-height: 1.35; }

/* ------------------------------------ crédito do autor */
.rodape-autor { text-align: center; font-size: .72rem; color: var(--texto-tenue); padding: 1.2rem 1rem 1.6rem; }
.rodape-autor a { color: inherit; text-decoration: underline; }
.rodape-chat { padding: .15rem 1rem .4rem; font-size: .66rem; }
