:root {
  --azul: #1f4e7a;
  --azul-claro: #2c5d8f;
  --fundo: #f5f7fa;
  --cartao: #ffffff;
  --texto: #14202c;
  --texto2: #5b6875;
  --borda: #dfe5ec;
  --critica: #c62828;
  --alta: #e8730c;
  --media: #c9a227;
  --baixa: #6b7c8f;
  --ok: #2e7d32;
  --sombra: 0 1px 3px rgba(20,32,44,.10), 0 1px 2px rgba(20,32,44,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #12171d; --cartao: #1b222b; --texto: #e8edf3; --texto2: #94a3b3;
    --borda: #2b343f; --sombra: 0 1px 3px rgba(0,0,0,.4);
    --azul: #4a89c7; --azul-claro: #5b9ad8;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--fundo); color: var(--texto);
  font: 15px/1.45 -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
.oculto { display: none !important; }
h1 { font-size: 19px; margin: 0; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 12px; }

/* topo ------------------------------------------------------------------ */
.topo {
  position: sticky; top: 0; z-index: 5; background: var(--azul); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 14px 0;
}
.topo h1 { color: #fff; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topo-linha { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.topo input[type=search] {
  width: 100%; margin: 10px 0 8px; padding: 9px 12px; border-radius: 9px;
  border: 0; background: rgba(255,255,255,.16); color: #fff; font-size: 15px;
}
.topo input[type=search]::placeholder { color: rgba(255,255,255,.7); }
.icone {
  background: rgba(255,255,255,.15); border: 0; color: #fff; width: 34px; height: 34px;
  border-radius: 8px; font-size: 18px; cursor: pointer; flex: none;
}
.icone.texto { width: auto; padding: 0 12px; font-size: 13px; font-weight: 600; }
.secoes { display: flex; gap: 6px; margin: 10px 0 0; }
.secao {
  flex: 1; background: rgba(255,255,255,.12); border: 0; color: rgba(255,255,255,.8);
  padding: 9px 10px; border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.secao.ativa { background: #fff; color: var(--azul); }
.badge {
  background: var(--critica); color: #fff; border-radius: 9px; padding: 1px 6px;
  font-size: 11.5px; margin-left: 4px;
}
.secao.ativa .badge { background: var(--critica); }

/* conversa */
.msgs {
  background: var(--fundo); border: 1px solid var(--borda); border-radius: 10px;
  padding: 10px; max-height: 46vh; overflow-y: auto; font-size: 13.5px;
  white-space: pre-wrap; line-height: 1.5;
}
.msgs .de-nos { color: var(--azul-claro); font-weight: 600; }
.msgs .de-contato { color: var(--texto); font-weight: 600; }
.aviso {
  background: rgba(232,115,12,.12); border: 1px solid var(--alta); border-radius: 9px;
  padding: 9px 11px; font-size: 13px; margin-bottom: 10px;
}

.abas { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.abas::-webkit-scrollbar { display: none; }
.aba {
  background: none; border: 0; color: rgba(255,255,255,.72); padding: 9px 11px 10px;
  font-size: 13.5px; white-space: nowrap; cursor: pointer; border-bottom: 3px solid transparent;
}
.aba.ativa { color: #fff; border-bottom-color: #fff; font-weight: 600; }
.aba .n {
  background: rgba(255,255,255,.22); border-radius: 9px; padding: 1px 6px;
  margin-left: 5px; font-size: 11.5px;
}
.aba.ativa .n { background: rgba(255,255,255,.32); }

/* lista ----------------------------------------------------------------- */
.lista { padding: 12px 12px 88px; display: flex; flex-direction: column; gap: 9px; }
.item {
  background: var(--cartao); border-radius: 12px; padding: 12px 13px;
  box-shadow: var(--sombra); border-left: 4px solid var(--baixa); cursor: pointer;
}
.item.p-critica { border-left-color: var(--critica); }
.item.p-alta { border-left-color: var(--alta); }
.item.p-media { border-left-color: var(--media); }
.item h3 { margin: 0 0 5px; font-size: 15px; font-weight: 600; line-height: 1.35; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--texto2); }
.tag { background: var(--fundo); border: 1px solid var(--borda); border-radius: 20px; padding: 1px 8px; }
.tag.atrasado { background: var(--critica); border-color: var(--critica); color: #fff; font-weight: 600; }
.tag.hoje { background: var(--alta); border-color: var(--alta); color: #fff; font-weight: 600; }
.prox { margin-top: 7px; font-size: 13.5px; color: var(--texto); }
.prox b { color: var(--azul-claro); }
.vazio { text-align: center; color: var(--texto2); padding: 48px 20px; }

/* detalhe --------------------------------------------------------------- */
.detalhe { padding: 14px 12px 100px; display: flex; flex-direction: column; gap: 12px; }
.bloco { background: var(--cartao); border-radius: 12px; padding: 13px; box-shadow: var(--sombra); }
.bloco h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--texto2); }
.campos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: block; font-size: 12.5px; color: var(--texto2); margin-bottom: 8px; }
input, select, textarea {
  width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--borda);
  border-radius: 9px; background: var(--fundo); color: var(--texto);
  font: inherit; font-size: 15px;
}
textarea { min-height: 76px; resize: vertical; }
.resumo { font-size: 14px; color: var(--texto2); white-space: pre-wrap; }
.hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.hist li { font-size: 13px; border-left: 2px solid var(--borda); padding-left: 9px; }
.hist .quando { color: var(--texto2); font-size: 11.5px; }
.presets { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.preset {
  border: 1px solid var(--borda); background: var(--fundo); color: var(--texto);
  border-radius: 20px; padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.preset.ativo { background: var(--azul); border-color: var(--azul); color: #fff; }
.job { border: 1px solid var(--borda); border-radius: 10px; padding: 10px; margin-top: 9px; font-size: 13.5px; }
.job .cab { display: flex; justify-content: space-between; gap: 8px; color: var(--texto2); font-size: 12px; }
.job pre { white-space: pre-wrap; font: inherit; margin: 7px 0 0; }
.job.aguardando { border-color: var(--alta); background: rgba(232,115,12,.08); }
.job-acoes { display: flex; gap: 8px; margin-top: 9px; }

/* botões ---------------------------------------------------------------- */
button.primario, button.secundario, button.perigo {
  border: 0; border-radius: 9px; padding: 11px 16px; font-size: 15px;
  font-weight: 600; cursor: pointer;
}
button.primario { background: var(--azul); color: #fff; }
button.secundario { background: var(--fundo); color: var(--texto); border: 1px solid var(--borda); }
button.perigo { background: var(--critica); color: #fff; }
button:disabled { opacity: .55; cursor: default; }
button.mic { flex: 0 0 auto; }
button.mic.gravando {
  background: var(--critica); color: #fff; border-color: var(--critica);
  animation: pulsa 1.1s ease-in-out infinite;
}
@keyframes pulsa { 50% { opacity: .62; } }

.linha-botoes { display: flex; gap: 9px; }
.linha-botoes button { flex: 1; }
.fab {
  position: fixed; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 28px; border: 0; background: var(--azul);
  color: #fff; font-size: 30px; line-height: 1; box-shadow: 0 4px 14px rgba(20,32,44,.3);
  cursor: pointer; z-index: 6;
}

/* login / modal / toast -------------------------------------------------- */
.centro { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.cartao-login {
  background: var(--cartao); border-radius: 16px; padding: 30px 24px; width: min(360px, 100%);
  box-shadow: var(--sombra); text-align: center;
}
.cartao-login h1 { color: var(--azul); font-size: 24px; }
.cartao-login .sub { color: var(--texto2); margin: 4px 0 22px; font-size: 13px; }
.cartao-login input { text-align: center; letter-spacing: 8px; font-size: 22px; margin-bottom: 14px; }
.cartao-login button { width: 100%; }
.erro { color: var(--critica); font-size: 13.5px; min-height: 19px; margin: 10px 0 0; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: end center; z-index: 20; }
.modal-caixa {
  background: var(--cartao); border-radius: 16px 16px 0 0; padding: 20px;
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
}
.dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-botoes { display: flex; gap: 9px; margin-top: 14px; }
.modal-botoes button { flex: 1; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(88px + env(safe-area-inset-bottom)); background: var(--texto); color: var(--fundo);
  padding: 11px 18px; border-radius: 22px; font-size: 14px; z-index: 30; box-shadow: var(--sombra);
}
@media (min-width: 720px) {
  .lista, .detalhe { max-width: 780px; margin: 0 auto; }
  .topo { padding-left: 24px; padding-right: 24px; }
}
