:root {
  --fundo: #f4f1ee;
  --cartao: #ffffff;
  --texto: #1f2628;
  --suave: #6b7275;
  --linha: #e3ddd7;
  --escuro: #1f2628;
  --ouro: #d6baa3;
  --ouro-forte: #b8967a;
  --ok: #2e7d4f;
  --ok-fundo: #e5f3ea;
  --alerta: #b06a00;
  --alerta-fundo: #fff3df;
  --erro: #b3261e;
  --erro-fundo: #fde8e6;
  --azul: #2c5d8a;
  --azul-fundo: #e6eef7;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fundo); color: var(--texto); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select, textarea { font: inherit; color: inherit; }

/* topo */
#topo {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  background: var(--escuro); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  min-height: 56px;
}
#titulo { flex: 1; font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#titulo small { display: block; font-weight: 400; font-size: 12px; color: var(--ouro); }
.icone { background: none; border: 0; color: #fff; font-size: 28px; line-height: 1; width: 40px; height: 40px; border-radius: 20px; }
.icone:active { background: rgba(255,255,255,.12); }
#sinal { font-size: 12px; padding: 4px 8px; border-radius: 12px; white-space: nowrap; }
#sinal.ok { background: rgba(46,125,79,.35); }
#sinal.fila { background: var(--alerta); }
#sinal.off { background: var(--erro); }

#aviso { padding: 10px 14px; font-size: 14px; background: var(--alerta-fundo); color: var(--alerta); border-bottom: 1px solid var(--linha); }
#aviso.erro { background: var(--erro-fundo); color: var(--erro); }

main { padding: 12px 12px 96px; max-width: 640px; margin: 0 auto; }

/* login */
.login { display: flex; flex-direction: column; align-items: center; padding-top: 32px; gap: 14px; }
.login img { width: 96px; height: 96px; border-radius: 22px; }
.login h1 { margin: 0; font-size: 22px; }
.login form { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; }

/* blocos */
.cartao { background: var(--cartao); border: 1px solid var(--linha); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.cartao h2 { margin: 0 0 8px; font-size: 16px; }
.cartao h3 { margin: 12px 0 6px; font-size: 14px; color: var(--suave); text-transform: uppercase; letter-spacing: .03em; }
.linha-info { display: flex; gap: 8px; font-size: 14px; margin: 4px 0; }
.linha-info b { min-width: 92px; color: var(--suave); font-weight: 500; }
.suave { color: var(--suave); font-size: 13px; }
.centro { text-align: center; }

label.campo { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--suave); margin: 10px 0; }
input[type=text], input[type=number], input[type=password], input[type=time], select, textarea {
  width: 100%; padding: 12px; border: 1px solid var(--linha); border-radius: 10px; background: #fff; font-size: 16px; color: var(--texto);
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ouro); border-color: var(--ouro); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 13px 16px; font-weight: 600; font-size: 16px;
  background: var(--escuro); color: #fff; min-height: 48px; text-decoration: none;
}
.btn:active { opacity: .85; }
.btn[disabled] { opacity: .5; }
.btn.ouro { background: var(--ouro); color: var(--escuro); }
.btn.claro { background: #fff; color: var(--texto); border: 1px solid var(--linha); }
.btn.perigo { background: var(--erro); }
.btn.ok { background: var(--ok); }
.btn.pequeno { min-height: 36px; padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn.largo { width: 100%; }
.botoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.botoes .btn { flex: 1; }

/* progresso */
.progresso { height: 8px; border-radius: 4px; background: var(--linha); overflow: hidden; margin: 8px 0 4px; }
.progresso div { height: 100%; background: var(--ok); }

/* lista da rota */
.cliente { display: flex; gap: 12px; align-items: flex-start; background: var(--cartao); border: 1px solid var(--linha);
  border-radius: 14px; padding: 12px; margin-bottom: 8px; cursor: pointer; }
.cliente:active { background: #faf7f4; }
.cliente .num { flex: 0 0 34px; height: 34px; border-radius: 17px; background: var(--fundo); display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 14px; }
.cliente .corpo { flex: 1; min-width: 0; }
.cliente .nome { font-weight: 600; }
.cliente .predio { font-size: 12px; color: var(--ouro-forte); font-weight: 600; text-transform: uppercase; }
.cliente.feito { opacity: .55; }
.cliente.feito .num { background: var(--ok-fundo); color: var(--ok); }
.cliente.pulado { opacity: .55; }
.cliente.pulado .num { background: var(--alerta-fundo); color: var(--alerta); }
.cliente.em_andamento { border-color: var(--azul); box-shadow: 0 0 0 1px var(--azul) inset; }
.cliente.em_andamento .num { background: var(--azul); color: #fff; }
.etiquetas { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.etq { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--fundo); white-space: nowrap; }
.etq.hora { background: var(--alerta-fundo); color: var(--alerta); }
.etq.dia { background: var(--azul-fundo); color: var(--azul); }
.etq.ok { background: var(--ok-fundo); color: var(--ok); }
.etq.erro { background: var(--erro-fundo); color: var(--erro); }
.legenda { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; font-size: 12px; color: var(--suave); align-items: center; }
.filtros { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; }
.filtros button { border: 1px solid var(--linha); background: #fff; border-radius: 16px; padding: 6px 12px; font-size: 14px; white-space: nowrap; }
.filtros button.ativo { background: var(--escuro); color: #fff; border-color: var(--escuro); }

/* máquinas */
.maquina { display: flex; gap: 12px; align-items: center; background: var(--cartao); border: 1px solid var(--linha);
  border-radius: 14px; padding: 12px; margin-bottom: 8px; cursor: pointer; }
.maquina .cod { font-weight: 700; font-size: 18px; min-width: 64px; }
.maquina .corpo { flex: 1; min-width: 0; }
.maquina.feita { background: #f8faf8; }
.maquina.feita .cod { color: var(--ok); }
.maquina .estado { font-size: 22px; }

/* formulário da máquina */
.abas { display: flex; background: var(--linha); border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 12px; }
.abas button { flex: 1; border: 0; background: none; padding: 10px 4px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--suave); }
.abas button.ativo { background: #fff; color: var(--texto); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.ml-grande { display: flex; align-items: center; gap: 10px; }
.ml-grande input { font-size: 28px; font-weight: 700; text-align: center; padding: 10px; }
.ml-grande .passo { flex: 0 0 52px; height: 52px; font-size: 26px; border-radius: 12px; border: 1px solid var(--linha); background: #fff; }
.atalhos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.atalhos button { flex: 1 0 15%; border: 1px solid var(--linha); background: #fff; border-radius: 10px; padding: 8px 0; font-size: 14px; }
.completa { margin-top: 8px; font-size: 14px; color: var(--azul); font-weight: 600; }
.marcar { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-size: 15px; }
.marcar input { width: 22px; height: 22px; accent-color: var(--escuro); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--linha); background: #fff; border-radius: 16px; padding: 7px 12px; font-size: 14px; }
.chip.ativo { background: var(--erro-fundo); color: var(--erro); border-color: var(--erro); }
.chip.dia.ativo { background: var(--escuro); color: #fff; border-color: var(--escuro); }
.bloco { border: 1px solid var(--linha); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.bloco .horas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.bloco .horas input[type=time] { flex: 1 1 40%; min-width: 0; }
.bloco .horas select { flex: 1 1 100%; min-width: 0; }
input, select, textarea { min-width: 0; max-width: 100%; }
.pendencia { font-size: 14px; background: var(--alerta-fundo); color: var(--alerta); padding: 8px 10px; border-radius: 10px; margin: 4px 0; }
details summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.rodape-fixo { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(244,241,238,.96); border-top: 1px solid var(--linha); z-index: 5; }
.rodape-fixo .btn { width: 100%; max-width: 616px; display: flex; margin: 0 auto; }

/* menu e toast */
#menu { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; display: flex; align-items: flex-end; }
#menu .folha { background: #fff; width: 100%; border-radius: 18px 18px 0 0; padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); }
#menu .folha button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 14px 8px; font-size: 16px; border-bottom: 1px solid var(--linha); }
#menu .folha button:last-child { border-bottom: 0; color: var(--suave); }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--escuro); color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 30; max-width: 90%; text-align: center; }
#toast.erro { background: var(--erro); }
.vazio { text-align: center; color: var(--suave); padding: 40px 10px; }
.carregando { text-align: center; color: var(--suave); padding: 40px 10px; }
