/* Painel de entregas — página única com menu lateral (mesmo visual do gestão:
   lateral roxo açaí, conteúdo em lavanda claro, item ativo em lavanda). */
:root {
  --roxo: #51275D;
  --roxo-2: #6f3c88;
  --roxo-hover: #8a4fa6;
  --roxo-borda: #431f4d;
  --lavanda: #F5EFF7;
  --lavanda-2: #E9DEEE;
  --lavanda-3: #B99FC4;
  --acai-100: #e9dcee;
  --acai-900: #271230;
  --borda: #DCCFE3;
  --texto: #2A1626;
  --suave: #6B5873;
  --verde: #2E7D4F;
  --verde-bg: #E3F3E8;
  --ambar: #8A5A00;
  --ambar-bg: #FCEFD4;
  --vermelho: #A3261E;
  --vermelho-bg: #FBE3E1;
  --cinza-bg: #EFEAF1;
  --branco: #ffffff;
  --lateral: 272px;
}

* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; }
html { background: var(--lavanda); }
body {
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--lavanda);
  color: var(--texto);
  font-size: 14px;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ── login ─────────────────────────────────────────── */
.tela-centro { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: linear-gradient(160deg, var(--roxo) 0%, var(--roxo) 38%, var(--lavanda) 38%); }
.cartao-login {
  background: var(--branco); width: 100%; max-width: 360px; border-radius: 16px;
  padding: 28px 24px; box-shadow: 0 10px 34px rgba(81, 39, 93, .18);
  display: flex; flex-direction: column; gap: 6px;
}
.logo-login { height: 64px; width: auto; align-self: flex-start; margin-bottom: 6px; }
.cartao-login h1 { margin: 2px 0 0; font-size: 20px; color: var(--roxo); }
.cartao-login .sub { margin: 0 0 12px; color: var(--suave); }
.cartao-login label { font-weight: 600; font-size: 13px; margin-top: 8px; }
.cartao-login input {
  border: 1px solid var(--borda); border-radius: 10px; padding: 11px 12px; font-size: 15px;
  background: var(--lavanda);
}
.cartao-login input:focus { outline: 2px solid var(--roxo-2); background: var(--branco); }
.erro { color: var(--vermelho); min-height: 18px; font-size: 13px; margin-top: 6px; }
.primario {
  background: var(--roxo); color: #fff; border: 0; border-radius: 10px; padding: 12px;
  font-weight: 700; font-size: 15px; margin-top: 6px;
}
.primario:hover { background: var(--roxo-2); }
.secundario { background: var(--roxo); color: #fff; border: 0; border-radius: 8px; padding: 7px 14px; font-weight: 600; }
.secundario:hover { background: var(--roxo-2); }
.btn-link { background: none; border: 0; color: var(--roxo); font-weight: 600; padding: 6px 8px; border-radius: 8px; }
.btn-link:hover { background: var(--lavanda-2); }

/* ── estrutura: lateral + principal ────────────────── */
.app { display: flex; min-height: 100vh; }
.lateral {
  width: var(--lateral); flex: 0 0 var(--lateral); background: var(--roxo); color: var(--acai-100);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--roxo-borda); z-index: 1100;
}
.lat-marca { padding: 20px 20px 16px; border-bottom: 1px solid var(--roxo-borda); position: relative; }
.lat-fechar { position: absolute; top: 14px; right: 12px; background: none; border: 0; color: var(--acai-100);
  padding: 6px; border-radius: 8px; display: inline-flex; }
.lat-fechar:hover { background: var(--roxo-hover); color: #fff; }
.lat-fechar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.lat-marca img { height: 48px; width: auto; display: block; margin-bottom: 8px; }
.lat-sub { font-size: 12px; font-weight: 600; letter-spacing: .06em; color: #d4bdde; }
.menu { flex: 1; overflow-y: auto; padding: 12px; }
.grupo { margin-bottom: 6px; }
.grupo-tit {
  width: 100%; display: flex; align-items: center; gap: 8px; background: none; border: 0;
  padding: 14px 12px 8px; color: var(--acai-100); font-size: 14px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; text-align: left;
}
.grupo-tit:hover { color: #fff; }
.grupo-tit .seta { margin-left: auto; font-size: 11px; opacity: .8; }
.grupo-tit .selo { margin-left: 0; }
.item {
  width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0;
  padding: 12px 14px; border-radius: 10px; color: var(--acai-100); font-size: 15px; text-align: left;
  margin-bottom: 4px; min-height: 46px;
}
.item:hover { background: var(--roxo-hover); color: #fff; }
.item.ativo { background: var(--lavanda-3); color: var(--acai-900); font-weight: 700; }
.item svg { width: 21px; height: 21px; flex: 0 0 21px; }
.item svg, .hamb svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.item .rot { flex: 1; }
.selo { background: #dc2626; color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 10px;
  font-weight: 700; min-width: 20px; text-align: center; }
.lat-usuario { padding: 14px 16px; border-top: 1px solid var(--roxo-borda); }
.lat-nome { color: #fff; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lat-login { font-size: 11px; color: var(--lavanda-3); margin-top: 1px; }
.ver-como { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; font-size: 11px; color: var(--lavanda-3); }
.ver-como select { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 6px 8px; font-size: 13px; font-family: inherit; }
.ver-como select option { color: var(--texto); }
.tag-simula { background: #1F6FB2; color: #fff; border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 700; }
.lat-sair { margin-top: 10px; width: 100%; background: rgba(255,255,255,.12); color: #fff; border: 0;
  border-radius: 8px; padding: 7px 12px; font-weight: 600; font-size: 13px; }
.lat-sair:hover { background: rgba(255,255,255,.2); }
.veu { display: none; }
/* animação do menu (esconder/mostrar); desligada no carregamento pra não "piscar" */
:root { --anim-menu: .32s cubic-bezier(.4, 0, .2, 1); }
.sem-anim, .sem-anim * { transition: none !important; }

.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cab {
  display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--branco);
  border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 1000; min-height: 58px;
}
.cab-titulo { margin: 0; font-size: 20px; font-weight: 700; color: var(--roxo-2); white-space: nowrap; }
.hamb { display: inline-flex; background: none; border: 0; color: var(--roxo); padding: 6px; border-radius: 8px; }
@media (min-width: 901px) {
  /* a barra desliza pra fora (margem negativa) e o conteúdo cresce junto */
  .lateral { transition: margin-left var(--anim-menu), visibility 0s linear 0s; }
  .app.lateral-oculta .lateral { margin-left: calc(-1 * var(--lateral)); visibility: hidden;
    transition: margin-left var(--anim-menu), visibility 0s linear .32s; }
  .hamb { max-width: 0; padding: 6px 0; opacity: 0; overflow: hidden; pointer-events: none;
    transition: max-width var(--anim-menu), padding var(--anim-menu), opacity .2s ease; }
  .app.lateral-oculta .hamb { max-width: 44px; padding: 6px; opacity: 1; pointer-events: auto;
    transition: max-width var(--anim-menu), padding var(--anim-menu), opacity .25s ease .12s; }
  .app.lateral-oculta .cab { gap: 12px; }
  .cab { transition: gap var(--anim-menu); }
}
.hamb:hover { background: var(--lavanda-2); }
.tag-teste { background: #f5b638; color: #2a1c00; border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 800; }
.atualizado { color: var(--suave); font-size: 12px; margin-left: auto; text-align: right; }

/* ── conteúdo ──────────────────────────────────────── */
.conteudo { width: 100%; max-width: 1320px; padding: 18px 24px 40px; }
.barra-data { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.barra-data input[type=date] {
  border: 1px solid var(--borda); border-radius: 8px; padding: 7px 10px; background: var(--branco); color: var(--texto);
}
.barra-data label { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.nav-data { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--borda); background: var(--branco); color: var(--roxo); font-size: 18px; font-weight: 700; }
.aviso-sankhya { background: #fdf3e0; color: #8a5a00; border: 1px solid #f0d9a8; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; font-size: 13.5px; }
.aviso-erro { background: var(--vermelho-bg); color: var(--vermelho); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; }
.sem-modulo { background: var(--branco); border: 1px solid var(--borda); border-radius: 14px; padding: 28px; text-align: center; color: var(--suave); }
.sem-modulo b { color: var(--texto); display: block; font-size: 16px; margin-bottom: 4px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--branco); border-radius: 12px; padding: 12px 14px; border: 1px solid var(--borda); }
.kpi .v { font-size: 26px; font-weight: 700; color: var(--roxo); line-height: 1.1; }
.kpi .r { font-size: 12px; color: var(--suave); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kpi.verde .v { color: var(--verde); }
.kpi.ambar .v { color: var(--ambar); }
.kpi.vermelho .v { color: var(--vermelho); }
.kpi.azul .v { color: #1F5F99; }

.bloco { background: var(--branco); border: 1px solid var(--borda); border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; }
.bloco h2 { margin: 0 0 10px; font-size: 15px; color: var(--roxo); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bloco h2 .cont { background: var(--lavanda-2); color: var(--roxo); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.bloco-topo { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.bloco-topo h2 { margin: 0; }
.vazio { color: var(--suave); padding: 10px 0; }
.nota-rodape { color: var(--suave); font-size: 12px; margin-top: 8px; }

/* entrada do conteúdo ao trocar de aba */
@keyframes visao-entra { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.visao-entra > * { animation: visao-entra .38s cubic-bezier(.2, .7, .2, 1) both; }
.visao-entra > *:nth-child(2) { animation-delay: .06s; }
.visao-entra > *:nth-child(3) { animation-delay: .12s; }
.visao-entra > *:nth-child(4) { animation-delay: .18s; }
.visao-entra > *:nth-child(n+5) { animation-delay: .22s; }
/* aviso de carregamento (aparece com um pequeno atraso: carga rápida nem pisca) */
.carregando { display: flex; align-items: center; gap: 12px; background: var(--branco); border: 1px solid var(--borda);
  border-radius: 14px; padding: 16px 18px; color: var(--suave); font-weight: 600; animation: visao-entra .25s ease .15s both; }
.spin { width: 18px; height: 18px; flex: 0 0 18px; border-radius: 50%; border: 2.5px solid var(--lavanda-2);
  border-top-color: var(--roxo); animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .visao-entra > *, .carregando { animation: none; }
  .spin { animation-duration: 2s; }
  :root { --anim-menu: 0s; }
}

/* veículo da carga */
.veiculos { display: flex; flex-direction: column; gap: 3px; margin-top: 5px; }
.veic { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--texto); flex-wrap: wrap; }
.veic b { letter-spacing: .03em; }
.veic svg { width: 15px; height: 15px; flex: 0 0 15px; fill: none; stroke: var(--roxo-2); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }

/* motoristas */
.grade-mot { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.mot { border: 1px solid var(--borda); border-radius: 12px; padding: 12px; cursor: pointer; background: var(--branco); }
.mot:hover, .mot.sel { border-color: var(--roxo-2); box-shadow: 0 0 0 2px var(--lavanda-2); }
.mot .nome { font-weight: 700; }
.mot .prog { height: 8px; background: var(--cinza-bg); border-radius: 999px; overflow: hidden; margin: 8px 0 6px; display: flex; }
.mot .prog i { display: block; height: 100%; }
.mot .prog .e { background: var(--verde); }
.mot .prog .n { background: var(--vermelho); }
.mot .linha { display: flex; justify-content: space-between; font-size: 12px; color: var(--suave); }
.mot .num { font-weight: 700; color: var(--texto); }

/* tabela */
.filtros { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip-f { border: 1px solid var(--borda); background: var(--branco); border-radius: 999px; padding: 5px 12px; font-weight: 600; font-size: 12px; color: var(--suave); }
.chip-f.ativo { background: var(--roxo); color: #fff; border-color: var(--roxo); }
.filtros-sel { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.filtros-sel label { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.sel-mot { border: 1px solid var(--borda); border-radius: 8px; padding: 6px 10px; background: var(--branco); font-family: inherit; max-width: 100%; }
.tabela-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--suave); padding: 8px; border-bottom: 1px solid var(--borda); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--lavanda-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
.cli { font-weight: 600; }
.sub2 { color: var(--suave); font-size: 12px; }
.status { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.st-entregue { background: var(--verde-bg); color: var(--verde); }
.st-entregue_dev { background: var(--ambar-bg); color: var(--ambar); }
.st-nao_realizada { background: var(--vermelho-bg); color: var(--vermelho); }
.st-pendente { background: var(--cinza-bg); color: var(--suave); }
.st-aguardando_lib { background: #E3EEF9; color: #1F5F99; }
.mot .lib { margin-top: 6px; font-size: 12px; font-weight: 600; border-radius: 8px; padding: 4px 8px; display: inline-block; }
.mot .lib.nao { background: #E3EEF9; color: #1F5F99; }
.mot .lib.sim { background: var(--verde-bg); color: var(--verde); }
.filtro-emp { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.od-emp { white-space: nowrap; }
.tag-fora { display: inline-block; background: var(--vermelho); color: #fff; border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 700; margin-left: 4px; }

/* itens devolvidos: lista recolhível */
.dev-det { margin-top: 4px; font-size: 13px; }
.dev-det summary { cursor: pointer; color: var(--ambar); font-weight: 600; list-style-position: inside; }
.dev-det ul { margin: 6px 0 2px; padding-left: 18px; }
.dev-det li { margin: 2px 0; }

/* devoluções por motivo */
.tabela-motivos td.num b { color: var(--roxo); }
.barra-motivo { height: 8px; background: var(--cinza-bg); border-radius: 999px; overflow: hidden; display: flex; min-width: 80px; }
.barra-motivo i { display: block; height: 100%; }
.barra-motivo .p { background: #C98A00; }
.barra-motivo .n { background: var(--vermelho); }
.tipo { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.tipo-parcial { background: var(--ambar-bg); color: var(--ambar); }
.tipo-nao_realizada { background: var(--vermelho-bg); color: var(--vermelho); }

/* mapa */
.legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--suave); margin-bottom: 8px; align-items: center; }
.legenda i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.mapa-lateral { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 12px; }
#mapa { height: calc(100vh - 210px); min-height: 420px; border-radius: 12px; z-index: 0; }
.lista-mot { display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 210px); overflow-y: auto; }
.mot-mapa { border: 1px solid var(--borda); border-radius: 10px; padding: 10px; cursor: pointer; background: var(--branco); }
.mot-mapa.sel { border-color: var(--roxo-2); box-shadow: 0 0 0 2px var(--lavanda-2); }
.mot-mapa .nome { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.mot-mapa .cor { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px; }
.mot-mapa .sub2 { margin-top: 4px; }
.marcador-num {
  background: var(--roxo); color: #fff; border: 2px solid #fff; border-radius: 50%;
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  font: 700 11px Montserrat, sans-serif; box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.marcador-num.fora { border-color: var(--vermelho); border-width: 3px; }
.pin { display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.legenda-mapa { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 10px; font-size: 12px; color: var(--texto); }
.leg-grupo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.leg-grupo > b { color: var(--roxo); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.leg-grupo > span { display: inline-flex; align-items: center; gap: 6px; }
.legenda-mapa .pin { filter: none; }
.leg-num { width: 18px; height: 18px; border-radius: 50%; color: #fff; font: 700 10px Montserrat, sans-serif;
  font-style: normal; display: inline-flex; align-items: center; justify-content: center; border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.leg-num.fora { border-color: var(--vermelho); border-width: 3px; }
.leaflet-tooltip.dica-mapa { font-family: Montserrat, sans-serif; font-size: 12px; border-radius: 8px; padding: 6px 9px; }

/* liberações */
.lib-card { border: 1px solid var(--borda); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--branco); }
.lib-topo { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.lib-linhas { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.lib-linhas .sub2 { display: inline-block; min-width: 96px; }
.lib-acoes { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.lib-obs { flex: 1; min-width: 200px; border: 1px solid var(--borda); border-radius: 8px; padding: 8px 10px; font-family: inherit; }
.lib-card.lib-destaque { border-color: var(--roxo-2); box-shadow: 0 0 0 3px var(--lavanda-2); }
.btn-recusar { background: var(--branco); color: var(--vermelho); border: 1px solid var(--vermelho); border-radius: 8px; padding: 7px 14px; font-weight: 600; }

/* conferência */
.carga { border: 1px solid var(--borda); border-radius: 14px; background: var(--branco); padding: 14px; margin-bottom: 12px; }
.carga.ok { border-color: #9CCFB0; }
.carga-topo { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.carga-topo .nome { font-weight: 700; font-size: 16px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.chip { border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.c-finalizada { background: var(--verde-bg); color: var(--verde); }
.c-em_andamento { background: var(--ambar-bg); color: var(--ambar); }
.c-divergencia, .c-nao_iniciada { background: var(--vermelho-bg); color: var(--vermelho); }
.carga-acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.btn-grande { background: var(--roxo); color: #fff; border: 0; border-radius: 10px; padding: 12px 16px; font-weight: 700; font-size: 15px; }
.btn-grande:disabled { background: #C9BDD0; cursor: not-allowed; }
.confirmada { background: var(--verde-bg); color: var(--verde); border-radius: 10px; padding: 10px 12px; font-weight: 600; }
.confirmada.forcada { background: var(--ambar-bg); color: var(--ambar); }
.lista-notas-conf { margin-top: 8px; border-top: 1px solid var(--lavanda-2); }
.nota-conf { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--lavanda-2); font-size: 13px; }
.nota-conf > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.nota-conf > .chip { flex-shrink: 0; margin-top: 1px; }
.nota-conf:last-child { border-bottom: 0; }
.ver-notas { background: none; border: 0; color: var(--roxo); font-weight: 600; padding: 4px 0; }
.dev { border: 1px solid var(--borda); border-radius: 14px; background: var(--branco); padding: 12px 14px; margin-bottom: 10px; }
.dev-topo { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.dev .linhas { font-size: 13px; margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.foto-status { border-radius: 10px; padding: 8px 10px; font-size: 13px; font-weight: 600; margin-top: 8px; }
.fs-enviada { background: var(--verde-bg); color: var(--verde); }
.fs-aguardando_devolucao, .fs-pendente, .fs-teste { background: var(--ambar-bg); color: var(--ambar); }
.fs-registro { background: var(--lavanda-2); color: var(--texto); }
.fs-erro { background: var(--vermelho-bg); color: var(--vermelho); }
.previas { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.previas img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--borda); }
.ver-fotos { margin-top: 6px; padding-left: 0; }
.galeria { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.galeria:empty { display: none; }
.gal-item { margin: 0; width: 132px; }
.gal-item img { width: 132px; height: 132px; object-fit: cover; border-radius: 10px; border: 1px solid var(--borda); cursor: zoom-in; display: block; }
.gal-item figcaption { font-size: 11px; color: var(--suave); margin-top: 3px; line-height: 1.3; }
.foto-grande { position: fixed; inset: 0; background: rgba(20, 8, 24, .96); z-index: 2100; display: flex; flex-direction: column; }
/* contêiner que rola quando a foto está ampliada (margin:auto centraliza sem cortar o lado esquerdo) */
.fg-rolo { flex: 1; min-height: 0; overflow: auto; display: flex; padding: calc(16px + env(safe-area-inset-top)) 16px 8px;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.fg-rolo img { margin: auto; max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5);
  cursor: zoom-in; flex-shrink: 0; }
.foto-grande.zoom .fg-rolo img { max-width: none; max-height: none; cursor: zoom-out; border-radius: 0; }
.fg-barra { display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 8px 16px calc(12px + env(safe-area-inset-bottom)); }
.fg-btn { width: 48px; height: 48px; border-radius: 12px; border: 0; background: rgba(255,255,255,.92); color: var(--roxo);
  font-size: 24px; font-weight: 700; line-height: 1; }
.fg-nivel { color: #fff; font-weight: 700; min-width: 36px; text-align: center; }
.foto-grande .btn-fechar { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; background: #ffffff; border: 0;
  border-radius: 50%; width: 44px; height: 44px; font-size: 18px; cursor: pointer; z-index: 1; }
body.sem-scroll { overflow: hidden; }

/* fotos do conferente juntadas antes de aprovar */
.lote { width: 100%; margin-top: 4px; padding: 10px; border: 1px dashed var(--lavanda-3); border-radius: 12px; background: var(--lavanda); }
.lote-fotos { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.lote-foto { position: relative; display: block; }
.lote-foto img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; border: 1px solid var(--borda); display: block; }
.lote-x { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff;
  background: var(--vermelho); color: #fff; font-size: 12px; font-weight: 700; padding: 0; line-height: 1; }
/* área de toque de 44px em volta do ✕ pequeno */
.lote-x::after { content: ""; position: absolute; inset: -8px; }
.lote-acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.lote-acoes button:disabled { opacity: .5; cursor: not-allowed; }
.lote-dica { margin-top: 6px; line-height: 1.4; }
.modo-teste { background: #fdf1d8; border: 2px solid #d99a00; color: #5c3f00; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 13.5px; line-height: 1.45; }

/* acessos */
.mods { display: flex; gap: 4px; flex-wrap: wrap; }
.mod-chip { background: var(--lavanda-2); color: var(--roxo); border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.mod-chip.tudo { background: var(--roxo); color: #fff; }
.inativo td { opacity: .55; }
.form-grade { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.campo { display: flex; flex-direction: column; gap: 4px; }
.campo.largo { grid-column: 1 / -1; }
.campo > span { font-weight: 600; font-size: 12px; color: var(--suave); }
.campo input, .campo select { border: 1px solid var(--borda); border-radius: 8px; padding: 9px 10px; font-size: 14px; background: var(--branco); color: var(--texto); }
.campo input:disabled, .campo select:disabled { background: var(--cinza-bg); }
.campo .dica { font-size: 11.5px; color: var(--suave); }
.perm-grupos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.perm-grupo { border: 1px solid var(--borda); border-radius: 10px; padding: 10px 12px; }
.perm-grupo h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--roxo); }
.perm-grupo label { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; cursor: pointer; }
.perm-grupo input { accent-color: var(--roxo); width: 16px; height: 16px; }
.perm-grupo label.extra { color: var(--suave); font-size: 12.5px; padding-left: 2px; }
.linha-ativo { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-top: 12px; }
.linha-ativo input { accent-color: var(--roxo); width: 16px; height: 16px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(42, 22, 38, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 2000; }
.modal-card { background: var(--branco); border-radius: 16px; padding: 20px; max-width: 420px; width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; }
.modal-card.largo { max-width: 640px; }
.modal-card h3 { margin: 0 0 8px; color: var(--roxo); }
.modal-card p { margin: 0 0 16px; color: var(--suave); line-height: 1.45; }
.modal-acoes { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.modal-acoes .esq { margin-right: auto; }

/* ── celular / tablet: lateral vira gaveta ─────────── */
@media (max-width: 900px) {
  .lateral { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%);
    transition: transform var(--anim-menu), box-shadow var(--anim-menu); }
  .app.menu-aberto .lateral { transform: none; box-shadow: 0 0 30px rgba(0,0,0,.3); }
  .veu { display: block; position: fixed; inset: 0; background: rgba(42, 22, 38, .45); z-index: 1050;
    opacity: 0; pointer-events: none; transition: opacity var(--anim-menu); }
  .app.menu-aberto .veu { opacity: 1; pointer-events: auto; }
  /* gaveta ocupa só a área visível (acima da barra do Safari/Chrome) */
  .lateral { height: auto; max-height: 100dvh; }
  .lat-usuario { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  /* com o menu aberto só a lista do menu rola; o fundo e o véu não arrastam */
  .veu, .lateral { touch-action: none; }
  .menu { touch-action: pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  html.menu-trava, html.menu-trava body { overflow: hidden; }
  .hamb { display: inline-flex; }
  .cab { padding: 10px 14px; gap: 8px; }
  .cab-titulo { font-size: 17px; }
  .atualizado { display: none; }
  .conteudo { padding: 12px 12px 30px; }
  .mapa-lateral { grid-template-columns: minmax(0, 1fr); }
  .mapa-lateral > * { min-width: 0; }
  .lista-mot { max-height: none; flex-direction: row; overflow-x: auto; }
  .mot-mapa { min-width: 220px; }
}
@media (max-width: 760px) {
  .col-opc { display: none; }
  .form-grade, .perm-grupos { grid-template-columns: 1fr; }
  /* tabela vira lista de cartões */
  .tabela-wrap table, .tabela-wrap tbody, .tabela-wrap tr, .tabela-wrap td { display: block; width: 100%; }
  .tabela-wrap thead { display: none; }
  .tabela-wrap tr { border: 1px solid var(--borda); border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; }
  .tabela-wrap td { border: 0; padding: 4px 0 4px 124px; position: relative; text-align: left;
                   min-height: 22px; overflow-wrap: anywhere; }
  .tabela-wrap td.num { text-align: left; }
  .tabela-wrap td[data-l]::before {
    content: attr(data-l); position: absolute; left: 0; top: 6px; width: 116px; color: var(--suave);
    font-size: 11px; text-transform: uppercase; letter-spacing: .03em; line-height: 1.25;
  }
  .tabela-wrap td:empty { display: none; }
}

/* devoluções aguardando o conferente + antecipações (01/10/2026) */
.dev-aguarda { border-color: var(--ambar, #C98A00); box-shadow: 0 0 0 1px rgba(201,138,0,.25); }
.obs-dev { flex: 1; min-width: 180px; padding: 10px 12px; border: 1px solid var(--borda); border-radius: 10px; font: inherit; }
table.itens-dev { margin-top: 8px; }
table.itens-dev td, table.itens-dev th { padding: 6px 8px; }
.tag-antecip { display: inline-block; background: #1F6FB2; color: #fff; border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 700; margin-right: 4px; }

/* carga parcial (01/10/2026) */
.carga.parcial { border-color: var(--ambar); }
.confirmada.parcial { background: var(--ambar-bg); color: var(--ambar); font-weight: 500; }
.confirmada .aviso-parcial { margin-top: 6px; font-weight: 700; }
.confirmada .etapas { margin-top: 6px; font-size: 12px; font-weight: 500; opacity: .85; line-height: 1.5; }
.botoes-conf { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-parcial { border: 2px solid var(--ambar); background: #fff; color: var(--ambar); border-radius: 12px;
  padding: 10px 16px; font: inherit; font-weight: 700; cursor: pointer; }
.btn-parcial:hover { background: var(--ambar-bg); }
.chips-nota { display: flex; gap: 4px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.c-lib { background: #E3EEF9; color: #1F5F99; }
.c-nao-lib { background: var(--cinza-bg); color: var(--suave); }
.mot .lib.parc { background: var(--ambar-bg); color: var(--ambar); }

/* conta: esqueci a senha / avisos (05/10/2026) */
.cartao-login .esqueci { display: block; margin: 10px auto 0; font-size: 13px; }
#form-conta .campo { margin-top: 10px; }
#form-conta .campo input { padding: 10px 12px; border: 1px solid var(--borda); border-radius: 10px; font: inherit; }
#form-conta p { color: var(--suave); line-height: 1.45; margin: 6px 0 0; }

/* notas do dia: números como filtro, itens, ver no mapa */
.kpi-filtro { text-align: left; font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.kpi-filtro:hover { border-color: var(--lavanda); }
.kpi-filtro.ativo { border-color: var(--roxo); box-shadow: 0 0 0 2px var(--roxo) inset; }
.itens-nota { margin-top: 4px; font-size: 12px; }
.itens-nota summary { cursor: pointer; color: var(--roxo); font-weight: 600; }
.itens-nota ul { list-style: none; margin: 6px 0 0; padding: 0; }
.itens-nota li { display: flex; gap: 8px; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed var(--lavanda-2); }
.itens-nota li b { white-space: nowrap; }
.tag-devol { color: var(--ambar); font-weight: 700; white-space: nowrap; }
.ver-mapa { white-space: nowrap; }
.mot .lib.fin { background: var(--verde-bg); color: var(--verde); }

/* itens da devolução: no celular continua tabela compacta (3 colunas), não vira cartão */
@media (max-width: 760px) {
  .tabela-wrap table.itens-dev { display: table; width: 100%; }
  .tabela-wrap table.itens-dev thead { display: table-header-group; }
  .tabela-wrap table.itens-dev tbody { display: table-row-group; }
  .tabela-wrap table.itens-dev tr { display: table-row; border: 0; padding: 0; margin: 0; border-radius: 0; }
  .tabela-wrap table.itens-dev th,
  .tabela-wrap table.itens-dev td { display: table-cell; width: auto; padding: 6px 6px; min-height: 0; }
  .tabela-wrap table.itens-dev td { border-top: 1px solid var(--lavanda-2); }
  .tabela-wrap table.itens-dev td.num, .tabela-wrap table.itens-dev th.num { text-align: right; white-space: nowrap; }
  .tabela-wrap table.itens-dev td[data-l]::before { content: none; }
}
@media (max-width: 760px) {
  .dev-topo { flex-direction: column; gap: 6px; }
  .dev-topo .status { align-self: flex-start; }
  .dev .carga-acoes .btn-grande { width: 100%; }
  .dev .obs-dev { min-width: 0; width: 100%; }
}

/* código do parceiro (Sankhya) ao lado do nome do cliente */
.cod-parc { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: var(--lavanda-2);
  color: var(--suave); font-size: 11px; font-weight: 600; line-height: 18px; white-space: nowrap; vertical-align: 1px; }

/* ordens de carga no cartão do motorista (logística) */
.ordens-mot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 2px; font-size: 13px; }
.oc-chip { background: var(--lavanda); border: 1px solid var(--borda); border-radius: 8px; padding: 2px 8px; font-weight: 600; white-space: nowrap; }

/* contagem de volumes do motorista (Conferência > Liberar cargas) */
.alerta-contagem { background: #fdecec; border: 1px solid #f3b4b4; color: #8a1c1c; border-radius: 10px;
  padding: 10px 14px; margin-bottom: 12px; }
.contagem { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--lavanda-2);
  color: var(--texto); font-size: 13px; }
.contagem.ok { background: #e7f6ec; }
.contagem.divergencia { background: #fdecec; border: 1px solid #f3b4b4; }
.contagem-bloco { margin-top: 8px; }
.tab-contagem { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13px; }
.tab-contagem th, .tab-contagem td { padding: 4px 6px; border-bottom: 1px solid rgba(0,0,0,.08); text-align: right; }
.tab-contagem th:first-child, .tab-contagem td:first-child { text-align: left; }
.tab-contagem th { font-weight: 600; color: var(--suave); font-size: 12px; }
.tab-contagem td.dif { color: #b42318; font-weight: 700; }
.tab-contagem th:not(:first-child), .tab-contagem td:not(:first-child) { width: 1%; white-space: nowrap; padding-left: 12px; }
.tab-contagem-rol { overflow-x: auto; }
.tab-contagem td.info { color: #8a5a00; font-weight: 700; }
.tab-contagem tr.linha-info td:first-child { font-style: italic; }
.aviso-extras { margin-top: 6px; padding: 6px 10px; border-radius: 8px; background: #fff4d6; color: #6b4a00; }

/* ── celular: alvos de toque ≥ 44px e campos sem zoom do iPhone (18/11/2026) ──
   O iPhone dá zoom em qualquer campo com fonte < 16px ao focar (no Safari; dentro
   do app AFS o zoom já é travado, mas o site também é usado no navegador). */
@media (max-width: 900px) {
  input, select, textarea { font-size: 16px !important; }
  /* (só aqui: no desktop o .hamb usa max-width:0 pra sumir, e min-width venceria) */
  .hamb { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; padding: 0; margin-left: -6px; }
}
@media (max-width: 900px), (pointer: coarse) {
  .chip-f { min-height: 44px; padding: 0 14px; font-size: 13px; display: inline-flex; align-items: center; }
  .btn-link { min-height: 44px; padding: 0 10px; display: inline-flex; align-items: center; }
  .secundario, .btn-recusar { min-height: 44px; padding: 0 16px; }
  .lat-fechar { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; top: 8px; right: 6px; }
  .nav-data { width: 44px; height: 44px; }
  .lat-sair { min-height: 44px; }
  .ver-notas { min-height: 44px; }
  .ver-fotos { padding-left: 0; }
}
/* contagem de volumes no card do motorista (Logística) */
.mot .cont-box { margin-top: 8px; padding: 8px 10px; border-radius: 10px; font-size: 13px; line-height: 1.35; }
.mot .cont-box .cont-tit { font-weight: 700; }
.mot .cont-box .cont-sub { font-size: 12px; opacity: .85; margin-top: 1px; }
.mot .cont-box.ok { background: var(--verde-bg); color: var(--verde); }
.mot .cont-box.aguarda { background: var(--lavanda-2); color: var(--suave); }
.mot .cont-box.dif { background: var(--vermelho-bg); color: var(--vermelho); }
.mot .cont-mini { width: 100%; border-collapse: collapse; margin-top: 6px; color: var(--texto);
  font-variant-numeric: tabular-nums; }
.mot .cont-mini th { font-size: 11px; font-weight: 600; color: var(--suave); text-align: left; padding: 2px 0 3px;
  border-bottom: 1px solid rgba(163, 38, 30, .2); }
.mot .cont-mini td { padding: 4px 0; border-bottom: 1px solid rgba(163, 38, 30, .12); }
.mot .cont-mini tr:last-child td { border-bottom: 0; }
.mot .cont-mini .n { text-align: right; width: 58px; white-space: nowrap; padding-left: 6px; }
.mot .cont-mini td.dif { color: var(--vermelho); font-weight: 700; }

/* novas entregas (Notas do dia) */
.mot .lib.nova { background: var(--ambar-bg); color: var(--ambar); display: table; }
tr.ne-registro td { opacity: .6; }
