:root {
  --verde: #0f766e;
  --verde-esc: #115e59;
  --verde-claro: #ccfbf1;
  --bg: #f1f5f9;
  --card: #ffffff;
  --txt: #1e293b;
  --txt2: #64748b;
  --borda: #e2e8f0;
  --wpp: #22b357;
  --azul: #2563eb;
  --sombra: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--txt);
  font-size: 16px; padding-bottom: env(safe-area-inset-bottom);
}
.tela { display: none; }
.tela.ativa { display: block; }

/* ---- LOGIN ---- */
#tela-login { min-height: 100vh; display: none; place-items: center; padding: 20px; }
#tela-login.ativa { display: grid; }
.login-card {
  background: var(--card); border-radius: 22px; box-shadow: var(--sombra);
  padding: 28px; width: min(380px, 100%); text-align: center;
}
.logo-img { width: 190px; max-width: 70%; height: auto; object-fit: contain; margin-bottom: 6px; }
.sub { color: var(--txt2); margin: 2px 0 20px; font-size: 17px; font-weight: 600; }
.perfis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.perfil {
  padding: 14px 12px; border: 2px solid var(--borda); border-radius: 14px;
  background: #fff; font-size: 17px; font-weight: 700; cursor: pointer; color: var(--verde);
  transition: .15s;
}
.perfil.sel { border-color: var(--verde); background: var(--verde); color: #fff; }

.pin-dots { display: flex; justify-content: center; gap: 14px; height: 22px; margin-bottom: 18px; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--verde); }
.pin-dot.on { background: var(--verde); border-color: var(--verde); }

.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tecla {
  padding: 18px 0; font-size: 24px; font-weight: 700; border-radius: 14px;
  border: none; background: #f1f5f9; color: var(--verde-esc); cursor: pointer;
  touch-action: manipulation; user-select: none;
}
.tecla:active { background: var(--verde); color: #fff; }
.tecla-acao { background: #fff; color: var(--txt2); font-size: 20px; border: 2px solid var(--borda); }
.erro { color: #dc2626; min-height: 22px; margin: 14px 0 0; font-weight: 600; }

/* ---- BOTÕES ---- */
.btn { border: none; border-radius: 10px; font-size: 15px; font-weight: 600; padding: 9px 14px; cursor: pointer; }
.btn-ghost { background: rgba(255,255,255,.16); color: #fff; }
.btn-ghost:active { background: rgba(255,255,255,.30); }

/* ---- TOPO ---- */
.topo {
  position: sticky; top: 0; z-index: 10; background: var(--verde); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  box-shadow: var(--sombra); flex-wrap: wrap;
}
.topo-info { display: flex; flex-direction: column; }
.vend { font-size: 19px; font-weight: 800; text-transform: capitalize; }
.resumo { font-size: 13px; opacity: .9; }
.topo-acoes { display: flex; gap: 7px; }

/* ---- LISTA COMPACTA ---- */
.lista { padding: 8px; display: flex; flex-direction: column; gap: 6px; max-width: 900px; margin: 0 auto; }
.vazia { text-align: center; color: var(--txt2); padding: 48px 16px; }

.linha {
  background: var(--card); border-radius: 10px; box-shadow: var(--sombra);
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center;
  gap: 8px; padding: 7px 8px; border: 1px solid var(--borda); border-left: 4px solid var(--verde);
}
.linha.passado { opacity: .5; border-left-color: var(--wpp); }
.linha.passado .nome { text-decoration: line-through; }
.linha.arrastando { opacity: .35; }
.linha.arraste-alvo { outline: 2px dashed var(--verde); }

.mover { display: flex; flex-direction: column; align-items: center; }
.seta {
  width: 30px; height: 20px; border: none; background: transparent; color: var(--txt2);
  font-size: 12px; cursor: pointer; padding: 0; line-height: 1; touch-action: manipulation;
}
.seta:active { color: var(--verde); }
.pos { font-size: 15px; font-weight: 800; color: var(--verde); min-width: 22px; text-align: center; cursor: grab; touch-action: none; }

.nome-col { min-width: 0; cursor: pointer; }
.nome { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.end-linha { font-size: 13px; color: var(--txt2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.val-linha { font-size: 13px; color: var(--txt2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.val-linha .val { color: var(--verde-esc); font-weight: 700; }
.parcelas { margin-top: 4px; font-size: 12px; color: var(--txt2); display: none; white-space: normal; }
.linha.aberta .parcelas { display: block; }
.linha.aberta .nome, .linha.aberta .end-linha { white-space: normal; }

.icones { display: flex; gap: 6px; }
.ico {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  border: none; cursor: pointer; text-decoration: none; color: #fff; background: var(--verde);
}
.ico svg { width: 21px; height: 21px; fill: currentColor; }
.ico.wpp { background: var(--wpp); }
.ico.tel { background: var(--verde); }
.ico.mapa { background: var(--azul); }
.ico.passei { background: #f1f5f9; color: var(--txt2); border: 1px solid var(--borda); }
.linha.passado .ico.passei { background: var(--wpp); color: #fff; border-color: var(--wpp); }
.ico.off { opacity: .35; pointer-events: none; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--verde-esc); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 15px; z-index: 50; box-shadow: var(--sombra);
}

@media (min-width: 700px) {
  .nome { font-size: 17px; }
  .ico { width: 44px; height: 44px; }
}
