/* Canal do motorista — Torre Platlog. Mobile primeiro, sem fonte externa, sem biblioteca. */
:root {
  --topo: #123047; --topo-txt: #f2f6f9; --topo-mut: #a9bccb;
  --fundo: #e9eef2; --padrao: #dde4ea;
  --eu: #cfeee4; --eu-txt: #0d2a22;
  --eles: #ffffff; --eles-txt: #14212b;
  --mut: #5d6b77; --linha: #d3dbe2;
  --acento: #0f8f7e; --acento-txt: #ffffff;
  --perigo: #b42318; --aviso: #fff4d6; --aviso-txt: #5c4300;
  --sistema: #fff8e5;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --topo: #0d2130; --topo-txt: #e8eef3; --topo-mut: #8ea5b6;
    --fundo: #0f1a22; --padrao: #13212b;
    --eu: #125347; --eu-txt: #e3f5ef;
    --eles: #1c2a35; --eles-txt: #e4ebf0;
    --mut: #93a3af; --linha: #25343f;
    --acento: #19a894; --acento-txt: #04130f;
    --perigo: #f97066; --aviso: #3b2f0b; --aviso-txt: #f5dfa3;
    --sistema: #2a2512;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--fundo); color: var(--eles-txt);
  overscroll-behavior: none;
}
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.app { display: flex; flex-direction: column; height: 100dvh; max-width: 760px; margin: 0 auto; background: var(--fundo); position: relative; }

/* ── topo ── */
.topo {
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px 12px;
  background: var(--topo); color: var(--topo-txt); position: relative; z-index: 3;
}
.marca {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto;
  background: var(--acento); color: var(--acento-txt);
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
}
.quem { flex: 1; min-width: 0; }
.quem .nome { font-weight: 700; font-size: 16px; }
.quem .estado { font-size: 12px; color: var(--topo-mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icone { background: none; border: 0; color: inherit; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; }
.icone:active { background: rgba(255,255,255,.12); }
.menu {
  position: absolute; right: 8px; top: calc(52px + env(safe-area-inset-top));
  background: var(--eles); color: var(--eles-txt); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.25); padding: 6px 0; min-width: 210px;
}
.menu button { display: block; width: 100%; text-align: left; padding: 12px 16px; background: none; border: 0; color: inherit; }
.menu button:active { background: var(--padrao); }

.aviso { background: var(--aviso); color: var(--aviso-txt); font-size: 13px; padding: 8px 12px; text-align: center; }
.aviso.suave { display: flex; gap: 10px; align-items: center; justify-content: center; }
.aviso.suave button { border: 0; background: var(--acento); color: var(--acento-txt); border-radius: 99px; padding: 5px 14px; font-weight: 700; }

/* ── conversa ── */
.conversa {
  flex: 1; overflow-y: auto; padding: 12px 10px 8px;
  display: flex; flex-direction: column; gap: 3px;
  background: var(--fundo);
  -webkit-overflow-scrolling: touch;
}
.dia { align-self: center; font-size: 12px; color: var(--mut); background: var(--eles); border-radius: 8px; padding: 3px 10px; margin: 10px 0 6px; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.msg {
  max-width: 82%; padding: 7px 9px 5px; border-radius: 10px;
  box-shadow: 0 1px 1px rgba(0,0,0,.08); word-wrap: break-word; overflow-wrap: anywhere;
  position: relative; margin-top: 4px;
}
.msg.eles { align-self: flex-start; background: var(--eles); color: var(--eles-txt); border-top-left-radius: 3px; }
.msg.eu { align-self: flex-end; background: var(--eu); color: var(--eu-txt); border-top-right-radius: 3px; }
.msg.seguida { margin-top: 1px; border-radius: 10px; }
.msg .txt { white-space: pre-wrap; }
.msg .txt a { color: inherit; text-decoration: underline; }
.msg .rodape { display: flex; gap: 4px; justify-content: flex-end; align-items: center; font-size: 11px; color: var(--mut); margin-top: 2px; }
.msg.eu .rodape { color: color-mix(in srgb, var(--eu-txt) 60%, transparent); }
.msg .marca-envio { font-size: 12px; }
.msg.falhou { outline: 1.5px solid var(--perigo); }
.msg .falha { color: var(--perigo); font-size: 12px; margin-top: 3px; }
.msg img.foto { display: block; max-width: 100%; width: 260px; max-height: 340px; object-fit: cover; border-radius: 7px; margin: -2px -4px 4px; background: var(--padrao); }
.msg .doc { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--padrao); border-radius: 8px; color: inherit; text-decoration: none; margin-bottom: 3px; }
.msg .doc .docIc { font-size: 26px; }
.msg .doc .docNome { font-weight: 600; font-size: 14px; }
.msg .doc .docSub { font-size: 12px; color: var(--mut); }
.progresso { height: 3px; background: var(--linha); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.progresso i { display: block; height: 100%; width: 40%; background: var(--acento); animation: correr 1.1s linear infinite; }
@keyframes correr { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

.boasvindas { margin: auto; text-align: center; max-width: 320px; padding: 20px; color: var(--mut); }
.boasvindas h1 { color: var(--eles-txt); font-size: 22px; margin: 6px 0; }
.bvIcone { font-size: 46px; }
.primario { border: 0; background: var(--acento); color: var(--acento-txt); border-radius: 99px; padding: 12px 22px; font-weight: 700; font-size: 16px; margin-top: 8px; }
.primario:disabled { opacity: .6; }
.primario.largo { width: 100%; margin-top: 14px; padding: 14px; }

/* ── entrada: celular + PIN ── */
.entrada {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto;
  background: var(--topo); color: var(--topo-txt);
  display: flex; justify-content: center; align-items: flex-start;
  padding: calc(40px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
}
.entradaCaixa { width: 100%; max-width: 360px; text-align: center; }
.marca.grande { width: 64px; height: 64px; font-size: 30px; margin: 0 auto 14px; }
.entrada h1 { font-size: 24px; margin: 0 0 4px; }
.entrada .sub { color: var(--topo-mut); margin: 0 0 28px; }
.entrada form { text-align: left; background: var(--eles); color: var(--eles-txt); border-radius: 16px; padding: 18px 16px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.entrada label { display: block; font-size: 13px; font-weight: 600; color: var(--mut); margin: 10px 0 6px; }
.entrada label:first-child { margin-top: 0; }
.entrada input {
  width: 100%; border: 1.5px solid var(--linha); border-radius: 12px; padding: 13px 14px;
  font: inherit; font-size: 20px; letter-spacing: .5px; background: var(--fundo); color: var(--eles-txt);
  font-variant-numeric: tabular-nums;
}
.entrada input:focus { outline: none; border-color: var(--acento); }
.dica { font-size: 12.5px; color: var(--mut); margin: 12px 0 0; line-height: 1.4; text-align: center; }
.erroEntrada { min-height: 20px; color: #ffd2cc; font-size: 14px; font-weight: 600; margin: 14px 0 0; }

/* ── respostas rapidas (as opcoes do robo viram botoes) ── */
.respostas {
  display: flex; gap: 6px; overflow-x: auto; padding: 6px 10px 4px;
  background: var(--fundo); scrollbar-width: none;
}
.respostas::-webkit-scrollbar { display: none; }
.respostas button {
  flex: 0 0 auto; border: 1px solid var(--acento); color: var(--acento); background: var(--eles);
  border-radius: 99px; padding: 8px 14px; font-size: 14px; font-weight: 600; max-width: 78vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.respostas button:active { background: var(--acento); color: var(--acento-txt); }

/* ── compositor ── */
.compositor {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--fundo);
}
.compositor textarea {
  flex: 1; resize: none; border: 0; border-radius: 22px; padding: 11px 14px;
  background: var(--eles); color: var(--eles-txt); font: inherit; font-size: 16px;
  max-height: 140px; line-height: 1.35; box-shadow: 0 1px 1px rgba(0,0,0,.08);
}
.compositor textarea:focus { outline: 2px solid var(--acento); outline-offset: 0; }
.compositor .foto { color: var(--mut); background: var(--eles); box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.compositor .foto svg, .enviar svg { width: 24px; height: 24px; fill: currentColor; }
.enviar {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: var(--acento); color: var(--acento-txt); display: grid; place-items: center;
}
.enviar:disabled { opacity: .5; }
button:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }

/* ── previa da foto ── */
.previa { position: fixed; inset: 0; background: #0b1319; color: #fff; display: flex; flex-direction: column; z-index: 30; }
.previaTopo { display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 10px 8px; font-size: 13px; color: #b8c7d2; }
.icone.claro { color: #fff; }
.previaImg { flex: 1; display: grid; place-items: center; overflow: hidden; padding: 8px; }
.previaImg img { max-width: 100%; max-height: 100%; object-fit: contain; }
.previaRodape { display: flex; gap: 8px; padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); }
.previaRodape input { flex: 1; border: 0; border-radius: 22px; padding: 12px 16px; font-size: 16px; background: #1d2a33; color: #fff; }

.zoom { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 40; display: grid; place-items: center; }
.zoom img { max-width: 100%; max-height: 100%; object-fit: contain; }

@media (prefers-reduced-motion: reduce) { .progresso i { animation: none; width: 100%; opacity: .5; } }
@media (min-width: 761px) { .app { box-shadow: 0 0 0 1px var(--linha); } }
