/* Mini app BLT · identidade visual da marca (azuis do logo, onda, cartões claros) */
:root {
  --azul: #0f8fd1;
  --azul-claro: #29abe2;
  --azul-escuro: #0b5f99;
  --marinho: #0a3a63;
  --fundo: #eef5fb;
  --cartao: #ffffff;
  --campo: #f4f8fc;
  --texto: #0f2a43;
  --sub: #6a849c;
  --borda: #dce8f2;
  --aberto: #e5484d;
  --aberto-bg: #fdeced;
  --andamento: #e8900c;
  --andamento-bg: #fff3dc;
  --concluido: #16a05a;
  --concluido-bg: #e5f6ec;
  --sombra: 0 1px 2px rgba(10, 58, 99, .06), 0 6px 18px rgba(10, 58, 99, .07);
  --sombra-forte: 0 10px 30px rgba(11, 95, 153, .22);
  --raio: 16px;
  --suave: cubic-bezier(.22, .8, .3, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--fundo); color: var(--texto); color-scheme: light; }
html { overflow-x: hidden; } /* impede a página de deslizar para o lado */
body {
  font: 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: Barlow, Inter, sans-serif; letter-spacing: .2px; }
h2 { font-size: 22px; margin: 0; color: var(--marinho); }
h3 { font-size: 15px; margin: 0 0 12px; color: var(--marinho); }
.sub { color: var(--sub); font-size: 13px; margin: 4px 0; }
.centro { text-align: center; }
.ico { width: 20px; height: 20px; fill: currentColor; flex: none; }
.ico.grande { width: 28px; height: 28px; }

/* ---------------------------------------------------------------- topo */
.topo {
  position: relative; color: #fff; padding: 18px 16px 34px;
  background: linear-gradient(135deg, var(--azul-claro) 0%, var(--azul) 45%, var(--azul-escuro) 100%);
  overflow: hidden; overflow: clip; /* clip: nem por código o topo rola para o lado */
}
.topo::before {
  content: ""; position: absolute; width: 260px; height: 260px; right: -90px; top: -120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.22), transparent 70%);
}
.topo-conteudo { position: relative; display: flex; align-items: center; gap: 12px; animation: entrar .5s var(--suave) both; }
.logo { width: 52px; height: 52px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255,255,255,.85), 0 6px 16px rgba(0,0,0,.18); background: #fff; }
.topo-textos { flex: 1; min-width: 0; }
.topo h1 { font-size: 22px; margin: 0; line-height: 1.1; }
.topo p { margin: 3px 0 0; font-size: 13px; opacity: .9; }
.botao-topo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.16); color: #fff; transition: transform .15s, background .2s; }
.botao-topo:active { transform: scale(.92); background: rgba(255,255,255,.3); }
.botao-topo .ico { width: 22px; height: 22px; }
.opcoes.modos .opcao { display: flex; gap: 12px; align-items: flex-start; padding: 14px 38px 14px 14px; }
.opcoes.modos .opcao .ico { margin: 2px 0 0; }
.opcoes.modos .opcao b { display: block; margin-bottom: 2px; }
.opcoes.modos .opcao small { display: block; line-height: 1.35; font-weight: 400; }
.opcoes.modos .opcao.ativo::after { top: 18px; transform: none; }
.selo { background: #ffd34d; color: #5a3d00; font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 20px; letter-spacing: .5px; }

.kpis { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; animation: entrar .5s .08s var(--suave) both; }
.kpi { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25); border-radius: 14px; padding: 9px 10px; backdrop-filter: blur(6px); }
.kpi b { display: block; font: 700 22px/1.1 Barlow, sans-serif; }
.kpi span { font-size: 11.5px; opacity: .9; }
.kpi.alerta b { color: #ffe1e1; }
.kpi.ok b { color: #d9ffe9; }
/* Topo compacto fora da lista de registros */
.kpis { transition: opacity .25s, max-height .35s var(--suave), margin .35s var(--suave); max-height: 90px; }
body.compacto .kpis { opacity: 0; max-height: 0; margin-top: 0; overflow: hidden; }
body.compacto .topo { padding-bottom: 28px; }
.onda { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 26px; fill: var(--fundo); }

main { padding: 6px 14px 12px; }

/* ---------------------------------------------------------------- telas e animações */
.tela { display: none; }
.tela.ativa { display: block; animation: entrar .35s var(--suave) both; }
@keyframes entrar { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes surgir { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes brilho { from { background-position: -200px 0; } to { background-position: calc(200px + 100%) 0; } }
@keyframes pulso { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes carregar { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

.titulo-tela { margin: 8px 2px 14px; }

/* ---------------------------------------------------------------- cartões e campos */
.cartao { background: var(--cartao); border-radius: var(--raio); padding: 16px; margin-bottom: 12px; box-shadow: var(--sombra); }
.campo { display: block; margin-bottom: 14px; }
.campo:last-child { margin-bottom: 0; }
.rotulo { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--marinho); margin: 0 0 7px; }
.tag { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .6px; color: var(--azul); background: #e3f2fb; padding: 3px 7px; border-radius: 6px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--texto); background: var(--campo);
  border: 1.5px solid transparent; border-radius: 12px; padding: 12px 14px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input::placeholder, textarea::placeholder { color: #9fb3c6; }
input:focus, textarea:focus { background: #fff; border-color: var(--azul); box-shadow: 0 0 0 4px rgba(15, 143, 209, .14); }
textarea { resize: vertical; min-height: 84px; }
.linha { display: flex; gap: 10px; margin-top: 14px; }
.linha > .campo { flex: 1; margin: 0; }
.dica { font-size: 12.5px; color: var(--sub); margin: 12px 0 0; }

.status-opcoes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.status-op { font: inherit; font-size: 13px; font-weight: 600; padding: 11px 4px; border-radius: 12px; border: 1.5px solid var(--borda); background: #fff; color: var(--sub); transition: all .2s var(--suave); }
.status-op:active { transform: scale(.96); }
.status-op.aberto.ativo { background: var(--aberto-bg); border-color: var(--aberto); color: var(--aberto); }
.status-op.andamento.ativo { background: var(--andamento-bg); border-color: var(--andamento); color: var(--andamento); }
.status-op.concluido.ativo { background: var(--concluido-bg); border-color: var(--concluido); color: var(--concluido); }

/* ---------------------------------------------------------------- botões */
.botao {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 15px; border: 0; border-radius: 14px; padding: 14px; margin-top: 4px;
  transition: transform .15s, box-shadow .2s, opacity .2s;
}
.botao:active { transform: scale(.97); }
.botao.primario { color: #fff; background: linear-gradient(135deg, var(--azul-claro), var(--azul-escuro)); box-shadow: var(--sombra-forte); }
.botao.perigo { color: #fff; background: var(--aberto); }
.botao.perigo.contorno { background: transparent; color: var(--aberto); border: 1.5px solid #f3c3c5; margin-top: 10px; }
.botao:disabled { opacity: .5; box-shadow: none; }
button.link { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--azul); font: inherit; font-size: 14px; font-weight: 600; padding: 6px 0; }
button.link .ico { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- busca e filtros */
.busca { position: relative; margin-top: 4px; }
.busca .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--sub); }
.busca input { padding-left: 44px; background: #fff; box-shadow: var(--sombra); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px 4px; margin: 0 -14px; padding-left: 14px; padding-right: 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid var(--borda); background: #fff; color: var(--marinho); border-radius: 20px; padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 500; transition: all .2s var(--suave); }
.chip.ativo { background: var(--azul); color: #fff; border-color: var(--azul); box-shadow: 0 4px 12px rgba(15, 143, 209, .3); }
.linha-contagem { display: flex; justify-content: space-between; align-items: center; margin: 6px 2px; }

/* ---------------------------------------------------------------- lista de registros */
.item {
  position: relative; background: var(--cartao); border-radius: var(--raio); padding: 14px 14px 12px 18px; margin-bottom: 10px;
  box-shadow: var(--sombra); overflow: hidden; animation: surgir .4s var(--suave) both; transition: transform .15s, box-shadow .2s;
}
.item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--sub); }
.item.aberto::before { background: var(--aberto); }
.item.andamento::before { background: var(--andamento); }
.item.concluido::before { background: var(--concluido); }
.item:active { transform: scale(.985); }
.item-topo { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--sub); }
.item-area { display: inline-flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.item-area .ico { width: 14px; height: 14px; }
.item-titulo { font-weight: 600; font-size: 15px; margin: 6px 0 2px; color: var(--texto); }
.item-texto { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-acao { font-size: 13.5px; color: var(--sub); }
.item-rodape { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--borda); font-size: 12.5px; color: var(--marinho); }
.item-rodape span { display: inline-flex; align-items: center; gap: 5px; }
.item-rodape .ico { width: 15px; height: 15px; color: var(--sub); }
.etiqueta { flex: none; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.etiqueta.aberto { background: var(--aberto-bg); color: var(--aberto); }
.etiqueta.andamento { background: var(--andamento-bg); color: var(--andamento); }
.etiqueta.concluido { background: var(--concluido-bg); color: var(--concluido); }
.vencido, .vencido .ico { color: var(--aberto) !important; font-weight: 600; }

/* Carregando (esqueleto com brilho) */
.esqueleto { height: 118px; border-radius: var(--raio); margin-bottom: 10px; background: #fff linear-gradient(90deg, #fff 0, #eef4f9 50%, #fff 100%) no-repeat; background-size: 200px 100%; animation: brilho 1.2s ease-in-out infinite; box-shadow: var(--sombra); }

/* Vazio */
.vazio { text-align: center; color: var(--sub); padding: 24px 10px 30px; animation: entrar .4s var(--suave) both; }
.vazio img { width: 96px; margin-bottom: 8px; filter: drop-shadow(0 8px 14px rgba(11, 95, 153, .25)); animation: flutuar 3s ease-in-out infinite; }
.vazio b { display: block; color: var(--marinho); font-size: 15px; margin-bottom: 2px; }
@keyframes flutuar { 50% { transform: translateY(-6px); } }

/* ---------------------------------------------------------------- seleção em lote */
.barra-lote { position: sticky; top: 8px; z-index: 5; background: #fff; border-radius: var(--raio); padding: 10px 14px 12px; margin-bottom: 10px; box-shadow: var(--sombra-forte); animation: surgir .3s var(--suave) both; }
.barra-lote-topo { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--marinho); font-weight: 600; }
.barra-lote-topo .link { font-size: 13px; }
.botao-pilula { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 600; color: var(--azul); background: #e3f2fb; border: 0; border-radius: 20px; padding: 7px 13px 7px 10px; transition: transform .15s, background .2s; }
.botao-pilula:active { transform: scale(.95); background: #d2eaf8; }
.botao-pilula .ico { width: 17px; height: 17px; }
.barra-lote .botao { margin-top: 8px; padding: 12px; }
.item .marca { display: none; }
.selecionando .item { display: flex; gap: 12px; align-items: flex-start; }
.selecionando .item .marca { display: grid; place-items: center; flex: none; width: 24px; height: 24px; margin-top: 2px; border: 2px solid var(--borda); border-radius: 8px; transition: all .2s var(--suave); }
.selecionando .item .conteudo { flex: 1; min-width: 0; }
.selecionando .item.marcado { box-shadow: 0 0 0 2px var(--aberto), var(--sombra); }
.selecionando .item.marcado .marca { background: var(--aberto); border-color: var(--aberto); }
.item .marca .ico { width: 15px; height: 15px; color: #fff; opacity: 0; }
.selecionando .item.marcado .marca .ico { opacity: 1; animation: pulso .25s var(--suave); }

/* ---------------------------------------------------------------- opções (exportar e agenda) */
.cartao > .rotulo { margin-top: 16px; }
.cartao > .rotulo:first-child { margin-top: 0; }
.opcoes { display: grid; gap: 8px; }
.opcoes.duas { grid-template-columns: 1fr 1fr; }
.opcao {
  font: inherit; text-align: left; color: var(--texto); background: var(--campo); border: 1.5px solid transparent;
  border-radius: 14px; padding: 12px 14px; transition: all .2s var(--suave); position: relative;
}
.opcao:active { transform: scale(.97); }
.opcoes.duas .opcao { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; }
.opcao .ico { color: var(--azul); margin-bottom: 6px; }
.opcao small { color: var(--sub); font-size: 12px; }
.opcao.ativo { background: #e8f5fd; border-color: var(--azul); color: var(--marinho); font-weight: 600; }
.opcoes.lista .opcao.ativo::after { content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--azul); transform: translateY(-50%); box-shadow: 0 0 0 4px rgba(15, 143, 209, .18); }

.progresso { margin-top: 14px; animation: entrar .3s var(--suave) both; }
.progresso-barra { height: 6px; background: #dcebf6; border-radius: 6px; overflow: hidden; }
.progresso-barra i { display: block; width: 40%; height: 100%; background: linear-gradient(90deg, var(--azul-claro), var(--azul-escuro)); border-radius: 6px; animation: carregar 1.1s ease-in-out infinite; }
.progresso.ok .progresso-barra i { width: 100%; animation: none; background: var(--concluido); }

/* ---------------------------------------------------------------- números */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.card { background: var(--cartao); border-radius: var(--raio); padding: 12px 10px; box-shadow: var(--sombra); animation: surgir .4s var(--suave) both; }
.card b { display: block; font: 700 26px/1.1 Barlow, sans-serif; color: var(--marinho); }
.card span { font-size: 11.5px; color: var(--sub); }
.card.aberto b { color: var(--aberto); }
.card.andamento b { color: var(--andamento); }
.card.concluido b { color: var(--concluido); }
.card.vencido { background: linear-gradient(135deg, #ff6b6f, var(--aberto)); }
.card.vencido b, .card.vencido span { color: #fff; }
.barras { display: grid; gap: 12px; }
.barra-linha { font-size: 13.5px; }
.barra-linha div:first-child { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.barra-linha small { color: var(--sub); }
.barra { height: 8px; background: #e7f0f7; border-radius: 8px; overflow: hidden; }
.barra i { display: block; height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, var(--azul-claro), var(--azul)); transition: width .8s var(--suave); }

/* ---------------------------------------------------------------- agenda */
.agenda-atual { display: flex; gap: 12px; align-items: center; }
.agenda-atual .ico-caixa { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: #e8f5fd; color: var(--azul); }
.agenda-atual.ativa .ico-caixa { background: var(--concluido-bg); color: var(--concluido); }
.agenda-atual b { color: var(--marinho); }

/* ---------------------------------------------------------------- navegação inferior */
.abas {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 20;
  display: flex; background: rgba(255,255,255,.96); backdrop-filter: blur(12px);
  border-radius: 20px; padding: 6px; box-shadow: 0 8px 28px rgba(10, 58, 99, .16);
}
.aba { flex: 1; border: 0; background: none; color: #8aa0b4; font: inherit; font-size: 10.5px; font-weight: 600; padding: 7px 0 6px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 3px; transition: color .2s, background .25s var(--suave); }
.aba .ico { width: 22px; height: 22px; transition: transform .25s var(--suave); }
.aba.ativa { color: var(--azul); background: #e8f5fd; }
.aba.ativa .ico { transform: translateY(-1px) scale(1.08); }
#aba-novo .ico { color: #fff; background: linear-gradient(135deg, var(--azul-claro), var(--azul-escuro)); border-radius: 10px; padding: 3px; width: 26px; height: 26px; margin-top: -2px; box-shadow: 0 4px 10px rgba(15, 143, 209, .35); }

/* ---------------------------------------------------------------- aviso */
.aviso {
  position: fixed; left: 16px; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; align-items: center; gap: 10px; background: var(--marinho); color: #fff;
  padding: 13px 16px; border-radius: 14px; font-size: 14px; box-shadow: var(--sombra-forte);
  animation: surgir .3s var(--suave) both;
}
.aviso .ico { width: 22px; height: 22px; color: #6fe3a3; }
.aviso.erro { background: #b4232a; }
.aviso.erro .ico { color: #ffd0d2; }
