/* variáveis de cor ficam em variaveis.css, compartilhado por todas as telas */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--fundo);
  color: var(--texto);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}

.oculto { display: none !important; }
button { font: inherit; }

/* ---------------------------------------------------------------- tela PIN */
.tela-pin {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .5rem; padding: 2rem 1.5rem;
  background: linear-gradient(175deg, var(--azul-escuro), #1c2557);
  color: #fff; text-align: center;
}
.pin-logo { width: 72px; height: 72px; margin-bottom: .5rem; border-radius: 16px; }
.marca-produto { font-size: .78rem; font-weight: 700; color: var(--agua); letter-spacing: .04em; margin: 0 0 .4rem; }
.tela-pin h1 { font-size: 1.3rem; margin: 0; }
.tela-pin p { color: #c3cbf0; font-size: .9rem; margin: 0 0 1rem; }
.tela-pin form { width: 100%; max-width: 280px; display: flex; flex-direction: column; gap: .8rem; }
#campo-pin {
  width: 100%; padding: 1rem; font-size: 1.6rem; text-align: center; letter-spacing: .5rem;
  border-radius: 12px; border: 0; background: rgba(255, 255, 255, .12); color: #fff;
}
#campo-pin::placeholder { color: rgba(255, 255, 255, .4); letter-spacing: .3rem; }
#campo-pin:focus { outline: 2px solid #fff; }
.erro-pin { color: #ffb4ab; font-size: .85rem; margin: 0; }

.botao-grande {
  background: #fff; color: var(--azul-escuro); border: 0; border-radius: 12px;
  padding: 1rem; font-size: 1.05rem; font-weight: 700; cursor: pointer;
}
.botao-grande:active { transform: scale(.98); }

/* ------------------------------------------------------ escolha de condomínio */
.lista-condominios { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: .6rem; }
.cartao-condominio {
  width: 100%; text-align: left; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18);
  color: #fff; border-radius: 12px; padding: .9rem 1rem; font-size: 1rem; font-weight: 600; cursor: pointer;
}
.cartao-condominio:active { background: rgba(255, 255, 255, .2); }
.sem-condominios { color: #c3cbf0; font-size: .88rem; }

/* ------------------------------------------------------------------- topo */
.topo {
  display: flex; align-items: center; gap: .7rem;
  background: var(--azul-escuro); color: #fff;
  padding: calc(env(safe-area-inset-top) + .8rem) 1rem .8rem;
  position: sticky; top: 0; z-index: 10;
}
.topo img { width: 34px; height: 34px; border-radius: 8px; }
.topo-titulo { flex: 1; min-width: 0; }
.topo-titulo strong { display: block; font-size: .95rem; }
.topo-titulo small { color: #b7c1ec; font-size: .76rem; display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.botao-icone {
  background: rgba(255, 255, 255, .12); border: 0; color: #fff; width: 38px; height: 38px;
  border-radius: 50%; font-size: 1.1rem; cursor: pointer; flex-shrink: 0;
}

/* ---------------------------------------------------------------- filtros */
.filtros {
  display: flex; gap: .5rem; padding: .8rem 1rem 0; position: sticky; top: 66px;
  background: var(--fundo); z-index: 9;
}
.filtros input {
  flex: 1; min-width: 0; padding: .65rem .7rem; border-radius: 10px;
  border: 1px solid var(--borda); background: #fff; font-size: .92rem;
}
.filtros input[type="month"] { flex: 0 0 168px; font-size: .84rem; padding-left: .55rem; padding-right: .3rem; }

.resumo-topo { padding: .6rem 1rem 0; font-size: .82rem; color: var(--texto-suave); }
.resumo-topo strong { color: var(--texto); }

/* ------------------------------------------------------------------ lista */
.lista { padding: .8rem 1rem 2.5rem; display: flex; flex-direction: column; gap: .8rem; }

.item {
  background: var(--superficie); border: 1px solid var(--borda); border-radius: 14px;
  padding: .9rem 1rem; box-shadow: 0 1px 2px rgba(16, 35, 55, .05), 0 4px 14px rgba(16, 35, 55, .06);
}
.item.concluido { background: #fbfdfb; border-color: #cfe8db; }
.item.aguardando { background: var(--ambar-fundo); border-color: #f2dfab; }
.item.geral { border-left: 3px solid var(--azul); margin-bottom: .9rem; }

.item-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.item-unidade { font-weight: 700; font-size: 1.05rem; }
.item-morador { color: var(--texto-suave); font-size: .84rem; }
.item-medidor { font-size: .74rem; color: var(--texto-suave); font-family: ui-monospace, Consolas, monospace; text-align: right; }

.etiqueta {
  display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 700;
}
.etiqueta.ok { background: var(--verde-fundo); color: var(--verde); }
.etiqueta.paga { background: var(--azul-claro); color: var(--azul-escuro); }
.etiqueta.pendente { background: #f2dfab; color: #7a5310; }

.indicador-fila {
  background: var(--ambar-fundo); color: #7a5310; text-align: center; font-size: .8rem;
  font-weight: 600; padding: .5rem 1rem; border-bottom: 1px solid #f2dfab;
}

.item-corpo { margin-top: .7rem; }
.campo-leitura { display: flex; flex-direction: column; gap: .3rem; }
.campo-leitura span { font-size: .76rem; color: var(--texto-suave); }
.linha-anterior { display: flex; justify-content: space-between; align-items: baseline; font-size: .82rem;
  color: var(--texto-suave); margin-bottom: .4rem; }
.linha-anterior strong { color: var(--texto); font-size: .95rem; }

.entrada-atual {
  width: 100%; padding: .9rem .8rem; font-size: 1.4rem; font-weight: 700; text-align: center;
  border: 2px solid var(--borda); border-radius: 12px; letter-spacing: .02em;
}
.entrada-atual:focus { outline: none; border-color: var(--azul); }

.previa {
  margin-top: .6rem; background: var(--azul-claro); border-radius: 10px; padding: .6rem .7rem;
  font-size: .84rem; display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap;
}
.previa strong { font-size: 1rem; }
.previa.invalida { background: var(--vermelho-fundo); color: var(--vermelho); }
.previa.alerta { background: var(--ambar-fundo); color: #7a5310; }

.foto-area { margin-top: .6rem; }
.botao-foto {
  width: 100%; padding: .8rem; border: 2px dashed var(--ambar); border-radius: 10px;
  background: var(--ambar-fundo); color: #7a5310; font-size: .9rem; font-weight: 600; cursor: pointer;
}
.botao-foto:active { transform: scale(.98); }
.foto-preview {
  display: flex; align-items: center; gap: .7rem; background: var(--verde-fundo);
  border-radius: 10px; padding: .5rem .7rem;
}
.foto-preview img {
  width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, .1);
}
.botao-remover-foto {
  margin-left: auto; background: none; border: 1px solid var(--borda); color: var(--texto-suave);
  border-radius: 8px; padding: .4rem .7rem; font-size: .78rem; cursor: pointer; white-space: nowrap;
}

.opcoes { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .7rem; }
.opcoes label { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--texto-suave); }
.opcoes input[type="checkbox"] { width: 18px; height: 18px; }
.opcoes input[type="text"] { flex: 1; min-width: 0; padding: .5rem .6rem; border: 1px solid var(--borda);
  border-radius: 8px; font-size: .84rem; }

.botao-confirmar {
  width: 100%; margin-top: .8rem; padding: .95rem; border: 0; border-radius: 12px;
  background: var(--azul); color: #fff; font-size: 1rem; font-weight: 700; cursor: pointer;
}
.botao-confirmar:active { transform: scale(.98); }
.botao-confirmar:disabled { opacity: .55; }

.resultado-ok { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-top: .5rem; }
.resultado-ok .valor { font-size: 1.3rem; font-weight: 800; color: var(--azul-escuro); }
.botao-refazer {
  background: none; border: 1px solid var(--borda); color: var(--texto-suave);
  border-radius: 8px; padding: .4rem .7rem; font-size: .78rem; cursor: pointer;
}

.botoes-imprimir { display: flex; flex-direction: column; gap: .45rem; margin-top: .7rem; }
.botao-imprimir {
  width: 100%; padding: .7rem; border-radius: 10px; font-size: .86rem; font-weight: 700;
  cursor: pointer; border: 1px solid var(--borda); background: #fff; color: var(--texto);
}
.botao-imprimir.bluetooth { background: var(--azul-escuro); color: #fff; border-color: var(--azul-escuro); }
.botao-imprimir:disabled { opacity: .6; }

.vazio { text-align: center; color: var(--texto-suave); padding: 3rem 1rem; font-size: .9rem; }

/* -------------------------------------------------------------- avisos */
.avisos { position: fixed; bottom: 1rem; left: 1rem; right: 1rem; display: flex;
  flex-direction: column; gap: .5rem; z-index: 80; }
.aviso {
  background: #16232e; color: #fff; padding: .75rem 1rem; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-size: .88rem; text-align: center;
}
.aviso.erro { background: var(--vermelho); }
.aviso.sucesso { background: var(--verde); }

@media (min-width: 560px) {
  body { max-width: 480px; margin: 0 auto; box-shadow: 0 0 40px rgba(16, 35, 55, .08); min-height: 100vh; }
}
