/* Despacho: fundo branco, contornos finos, pouca coisa por tela. Uma cor de marca (índigo) para a ação e para o
   caminho no mapa; verde, âmbar e vermelho ficam só para situação. */
html, body { background: #fff; }
:root {
  /* sempre claro: o celular em tema escuro não escurece o sistema (Chrome, Samsung, Safari) */
  color-scheme: only light;
  --tinta: #101828;
  --tinta-2: #344054;
  --suave: #667085;
  --linha: #e4e7ec;
  --linha-forte: #d0d5dd;
  --fundo: #ffffff;
  --faixa: #f6f7f9;
  --marca: #4f46e5;
  --marca-forte: #4338ca;
  --marca-clara: #eef2ff;
  --ok: #067647;
  --ok-clara: #ecfdf3;
  --alerta: #b54708;
  --alerta-clara: #fffaeb;
  --erro: #b42318;
  --erro-clara: #fef3f2;
  --raio: 10px;
  --raio-g: 14px;
  --topo: 60px;
  --sombra: 0 12px 32px rgba(16, 24, 40, .14);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; color: var(--tinta); background: var(--fundo); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: 26px; } h2 { font-size: 18px; letter-spacing: -0.015em; } h3 { font-size: 15px; letter-spacing: -0.01em; font-weight: 650; }
p { margin: 0; }
a { color: var(--marca); text-underline-offset: 2px; }
.suave { color: var(--suave); }
.pequeno { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.rotulo { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--suave); }
svg.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* botões e campos */
button, .botao { font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; border: 1px solid var(--linha-forte); background: #fff; color: var(--tinta-2); padding: 8px 14px; border-radius: var(--raio); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; transition: background .12s, border-color .12s, box-shadow .12s; }
button:hover, .botao:hover { background: var(--faixa); }
button:disabled { opacity: .5; cursor: default; }
button.principal, .botao.principal { background: var(--marca); border-color: var(--marca); color: #fff; }
button.principal:hover, .botao.principal:hover { background: var(--marca-forte); border-color: var(--marca-forte); }
button.perigo { color: var(--erro); }
button.liso { border-color: transparent; padding: 6px 10px; min-height: 0; font-weight: 500; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--linha-forte); border-radius: var(--raio); padding: 8px 12px; background: #fff; width: 100%; min-height: 40px; }
input::placeholder, textarea::placeholder { color: #98a2b3; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--marca); box-shadow: 0 0 0 3px var(--marca-clara); }
button:focus-visible, .botao:focus-visible, summary:focus-visible { outline: 2px solid var(--marca); outline-offset: 2px; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--marca); flex: none; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--tinta-2); margin-bottom: 6px; }
.campo { margin-bottom: 16px; }
.linha { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.linha > .cresce { flex: 1; min-width: 160px; }
.entre { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* topo */
.topo { border-bottom: 1px solid var(--linha); position: sticky; top: 0; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px); z-index: 20; }
.topo .dentro { display: flex; align-items: center; gap: 28px; height: var(--topo); padding: 0 24px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 17px; letter-spacing: -0.03em; color: var(--tinta); text-decoration: none; }
.logo svg { width: 28px; height: 28px; flex: none; }
.abas { display: flex; gap: 2px; align-self: stretch; overflow-x: auto; scrollbar-width: none; }
.abas::-webkit-scrollbar { display: none; }
.abas button { border: 0; border-radius: 0; background: none; padding: 0 14px; color: var(--suave); white-space: nowrap; font-weight: 550; min-height: 0; box-shadow: inset 0 -2px 0 transparent; }
.abas button:hover { color: var(--tinta); background: none; }
.abas button[aria-selected=true] { color: var(--tinta); box-shadow: inset 0 -2px 0 var(--marca); }
.topo-fim { margin-left: auto; display: flex; align-items: center; gap: 6px; min-width: 0; }
.topo select { width: auto; max-width: 240px; min-height: 36px; padding: 6px 10px; font-weight: 550; font-size: 14px; }
.topo .conta { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; margin-left: 10px; font-size: 13px; color: var(--suave); white-space: nowrap; }
main { max-width: 1120px; margin: 0 auto; padding: 32px 24px 96px; }
main.larga { max-width: none; padding: 0; }

/* cartões e listas */
.cartao { border: 1px solid var(--linha); border-radius: var(--raio-g); padding: 20px; background: #fff; }
.pilha { display: grid; gap: 14px; align-content: start; }
.grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.numero { font-size: 32px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.05; }
.barra { height: 8px; background: var(--faixa); border-radius: 99px; overflow: hidden; }
.barra > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .4s; }
.passo { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border: 1px solid var(--linha); border-radius: var(--raio-g); background: #fff; width: 100%; text-align: left; justify-content: flex-start; font-weight: 500; font-size: 15px; color: var(--tinta); min-height: 64px; }
.passo:hover:not(:disabled) { border-color: var(--linha-forte); background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .06); }
.passo .n { font-size: 22px; font-weight: 750; min-width: 44px; text-align: right; letter-spacing: -0.02em; }
.passo .seta { margin-left: auto; color: var(--marca); font-weight: 600; font-size: 14px; white-space: nowrap; }
.passo.feito { color: var(--suave); background: var(--faixa); border-color: transparent; opacity: 1; }
.passo.feito .seta { color: var(--ok); }

/* resumo do Início: anel de progresso e três números */
.resumo { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.anel { --p: 0; width: 132px; height: 132px; border-radius: 50%; background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--faixa) 0); display: grid; place-items: center; flex: none; }
.anel > div { width: 106px; height: 106px; border-radius: 50%; background: #fff; display: grid; place-items: center; text-align: center; }
.anel b { font-size: 30px; font-weight: 750; letter-spacing: -0.03em; line-height: 1; display: block; }
.resumo .grade { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.resumo .grade > div { padding: 4px 20px; border-left: 1px solid var(--linha); }
.resumo .grade > div:first-child { border-left: 0; padding-left: 0; }

.lista { border: 1px solid var(--linha); border-radius: var(--raio-g); overflow: hidden; background: #fff; }
.item { display: flex; align-items: center; justify-content: flex-start; gap: 12px; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--linha); background: #fff; width: 100%; text-align: left; border-radius: 0; min-height: 0; font-weight: 400; font-size: 15px; color: var(--tinta); }
.item:last-child { border-bottom: 0; }
button.item:hover { background: var(--faixa); }
.item .corpo { flex: 1; min-width: 0; }
.item .titulo { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { color: var(--suave); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vazio { padding: 40px 20px; text-align: center; color: var(--suave); }
/* lista em cartões soltos (rotas): cada item com a cor da rota na borda */
.lista.cartoes { border: 0; border-radius: 0; overflow: visible; display: grid; gap: 10px; background: none; }
.lista.cartoes .item { border: 1px solid var(--linha); border-radius: var(--raio-g); align-items: flex-start; padding: 16px; position: relative; }
.lista.cartoes .item:hover { border-color: var(--linha-forte); background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .06); }
.lista.cartoes .item .sub { white-space: normal; }
.lista.cartoes .vazio { border: 1px dashed var(--linha-forte); border-radius: var(--raio-g); }

.etiqueta { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--faixa); color: var(--tinta-2); white-space: nowrap; line-height: 1.5; }
.etiqueta.ok { background: var(--ok-clara); color: var(--ok); }
.etiqueta.alerta { background: var(--alerta-clara); color: var(--alerta); }
.etiqueta.erro { background: var(--erro-clara); color: var(--erro); }
.etiqueta.marca { background: var(--marca-clara); color: var(--marca-forte); }

.filtros { display: flex; gap: 6px; flex-wrap: wrap; }
.filtros button { border-radius: 99px; padding: 5px 13px; min-height: 0; font-size: 13px; font-weight: 550; }
.filtros button[aria-pressed=true] { background: var(--tinta); color: #fff; border-color: var(--tinta); }

/* o que se usa pouco fica recolhido */
details.mais { margin-top: 22px; border-top: 1px solid var(--linha); padding-top: 12px; }
details.mais > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--tinta-2); padding: 6px 0; }
details.mais > .secao:first-of-type { border-top: 0; margin-top: 4px; padding-top: 10px; }

/* gaveta lateral */
.fundo-gaveta { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 40; }
.gaveta { position: fixed; top: 0; right: 0; bottom: 0; width: min(500px, 100%); background: #fff; z-index: 41; overflow-y: auto; padding: 24px; box-shadow: var(--sombra); }
.gaveta > .entre { margin-bottom: 18px; position: sticky; top: -24px; background: #fff; padding: 14px 0; z-index: 2; border-bottom: 1px solid var(--linha); }
.secao { border-top: 1px solid var(--linha); margin-top: 22px; padding-top: 20px; }
.mapa { height: 280px; border: 1px solid var(--linha); border-radius: var(--raio-g); z-index: 1; background: var(--faixa); }
.mapa.alto { height: 380px; }
.mapa.grande { height: 520px; }
/* o mapa de fundo em tons neutros: o que tem cor na tela é a rota, as paradas e o entregador */
.leaflet-tile-pane { filter: grayscale(.9) contrast(.92) brightness(1.05); }
.leaflet-container { font: inherit; }
.leaflet-bar a { color: var(--tinta-2); }

.aviso { padding: 12px 16px; border-radius: var(--raio); background: var(--alerta-clara); color: #93370d; font-size: 14px; border: 1px solid #fedf89; }
.aviso.erro { background: var(--erro-clara); color: var(--erro); border-color: #fecdca; }
.aviso.ok { background: var(--ok-clara); color: var(--ok); border-color: #abefc6; }
#recado { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--tinta); color: #fff; padding: 11px 20px; border-radius: 99px; z-index: 60; max-width: calc(100% - 32px); box-shadow: var(--sombra); font-weight: 500; font-size: 14px; }
#recado.erro { background: var(--erro); }
[hidden] { display: none !important; }

/* entrar */
.entrar { max-width: 380px; margin: 14vh auto 0; padding: 0 20px; }
.entrar .logo { font-size: 22px; margin-bottom: 6px; }
.entrar .logo svg { width: 36px; height: 36px; }
.entrar button.principal { min-height: 46px; font-size: 15px; }

/* duas colunas: lista à esquerda, mapa ocupando o resto (rotas) */
.dupla { display: grid; grid-template-columns: minmax(400px, 480px) 1fr; height: calc(100dvh - var(--topo) - 1px); }
.dupla > .coluna { overflow-y: auto; padding: 28px 24px 60px; display: grid; gap: 16px; align-content: start; border-right: 1px solid var(--linha); }
.dupla > .palco { position: relative; background: var(--faixa); min-height: 0; }
.dupla > .palco > .mapa { position: absolute; inset: 0; height: auto; border: 0; border-radius: 0; }
.dupla > .palco > .sobre { position: absolute; left: 16px; bottom: 16px; z-index: 5; background: rgba(255, 255, 255, .94); border: 1px solid var(--linha); border-radius: var(--raio); padding: 8px 12px; }
.dupla > .palco > .vazio { position: absolute; inset: 0; display: grid; place-items: center; }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* parada (rota e entregador) */
.parada { border: 1px solid var(--linha); border-radius: var(--raio-g); background: #fff; overflow: hidden; }
.parada > header { display: flex; gap: 12px; align-items: flex-start; padding: 16px; }
.parada .ordem { width: 30px; height: 30px; border-radius: 50%; background: var(--marca); color: #fff; font-weight: 700; font-size: 14px; display: grid; place-items: center; flex: none; }
.parada.feita .ordem { background: var(--ok); }
.parada .entrega { display: flex; gap: 10px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--linha); }
.parada .entrega .corpo { flex: 1; min-width: 0; }
.parada.destaque { outline: 2px solid var(--marca); outline-offset: 2px; }
/* no painel, as paradas da rota viram uma linha do tempo: o número de cada uma preso a um fio vertical */
.trilho { display: grid; }
.trilho .parada { border: 0; border-radius: 0; overflow: visible; position: relative; padding-bottom: 14px; background: none; }
.trilho .parada::before { content: ""; position: absolute; left: 14px; top: 46px; bottom: 0; width: 2px; background: var(--linha); }
.trilho .parada:last-child::before { display: none; }
.trilho .parada > header { padding: 8px 0; }
.trilho .parada .entrega { margin-left: 42px; padding: 9px 0; }
.trilho .parada.destaque { outline: 0; }
.trilho .parada.destaque > header { background: var(--marca-clara); border-radius: var(--raio); box-shadow: 0 0 0 8px var(--marca-clara); }

/* pinos do mapa */
.pino { width: 28px; height: 28px; border-radius: 50%; color: #fff; font: 700 13px system-ui, sans-serif; display: grid; place-items: center; border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(16, 24, 40, .4); transition: transform .12s; }
.pino.aproximado { border-style: dashed; box-shadow: 0 0 0 2px var(--alerta), 0 2px 6px rgba(16, 24, 40, .4); }
.pino.pequeno { width: 18px; height: 18px; font-size: 9px; border-width: 2px; }
.leaflet-marker-icon.destaque { z-index: 1000 !important; }
.leaflet-marker-icon.destaque .pino { transform: scale(1.45); }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--suave); align-items: center; }
.legenda i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--linha-forte); }
.legenda i.aproximado { border-style: dashed; box-shadow: 0 0 0 2px var(--alerta); }
.bolinha { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 7px; }
.alternar { display: inline-flex; border: 1px solid var(--linha-forte); border-radius: var(--raio); overflow: hidden; }
.alternar button { border: 0; border-radius: 0; min-height: 38px; }
.alternar button[aria-pressed=true] { background: var(--tinta); color: #fff; }

/* ao vivo */
.vivo { width: 8px; height: 8px; border-radius: 50%; background: var(--linha-forte); display: inline-block; }
body.ao-vivo .vivo { background: #12b76a; box-shadow: 0 0 0 3px var(--ok-clara); }
.pino.entregador { width: 34px; height: 34px; border-radius: 11px; font-size: 14px; animation: pulso 1.8s infinite; }
@keyframes pulso { 0% { box-shadow: 0 0 0 0 rgba(16, 24, 40, .55); } 70% { box-shadow: 0 0 0 14px rgba(16, 24, 40, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 24, 40, 0); } }
@media (prefers-reduced-motion: reduce) { .pino.entregador { animation: none; } .barra > i { transition: none; } }

/* ── telas do entregador (celular) ─────────────────────────────────────────── */
body.rua { background: var(--faixa); }
body.rua main { max-width: 560px; padding: 16px 14px 150px; }
body.rua .cabeca { position: sticky; top: 0; background: #fff; z-index: 10; border-bottom: 1px solid var(--linha); padding: 12px 16px 14px; }
body.rua .cabeca .dentro { max-width: 532px; margin: 0 auto; }
body.rua .cabeca h1 { font-size: 20px; }
body.rua .cabeca .volta { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; text-decoration: none; margin-bottom: 4px; }
body.rua button, body.rua .botao { min-height: 46px; font-size: 15px; }
body.rua button.liso { min-height: 0; }
body.rua #recado { bottom: 104px; }
.botao-grande { width: 100%; min-height: 54px !important; font-size: 16px !important; border-radius: 14px; }
/* localização: uma linha com chave de ligar, no lugar de um cartão inteiro */
.loc { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--linha); border-radius: var(--raio-g); }
.loc .corpo { flex: 1; min-width: 0; }
.loc .titulo { font-weight: 600; font-size: 14px; }
.loc.ligada .titulo { color: var(--ok); }
.chave { width: 52px; min-width: 52px; height: 30px; min-height: 30px !important; padding: 0; border-radius: 99px; background: var(--linha-forte); border: 0; position: relative; flex: none; }
.chave::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .3); transition: transform .15s; }
.chave:hover { background: var(--linha-forte); }
.chave[aria-checked=true] { background: #12b76a; }
.chave[aria-checked=true]::after { transform: translateX(22px); }
/* a parada da vez em destaque; as outras recolhidas; as concluídas guardadas */
.parada.proxima { border: 0; box-shadow: 0 0 0 2px var(--marca), 0 8px 24px rgba(79, 70, 229, .14); }
.parada.proxima > header { padding: 18px 16px 16px; }
.parada.proxima > header h2 { font-size: 22px; }
.parada.proxima .ordem { width: 34px; height: 34px; font-size: 15px; }
.parada .caminho { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 16px 16px; }
.parada .caminho .cheio { grid-column: 1 / -1; }
.parada .todas { padding: 0 16px 16px; }
.parada.compacta > header { cursor: pointer; align-items: center; }
.parada.compacta > header h2 { font-size: 16px; }
.parada .seta { color: var(--suave); transition: transform .15s; }
.parada.aberta .seta { transform: rotate(90deg); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
details.feitas > summary, details.nomes > summary { cursor: pointer; padding: 13px 16px; border: 1px solid var(--linha); border-radius: var(--raio-g); font-weight: 600; background: #fff; }
details.feitas > summary { color: var(--suave); }
details.feitas[open] > summary, details.nomes[open] > summary { margin-bottom: 10px; }
details.nomes { margin: 4px 0 14px; }
details.nomes .lista { max-height: 38vh; overflow-y: auto; }
details.nomes label.item { margin: 0; cursor: pointer; min-height: 50px; }
/* a ação principal da parada da vez fica presa embaixo, ao alcance do polegar */
.acao-fixa { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, #fff 72%, rgba(255, 255, 255, 0)); }
.acao-fixa > div { max-width: 532px; margin: 0 auto; }
.acao-fixa button { box-shadow: 0 8px 20px rgba(79, 70, 229, .28); }
/* folha que sobe de baixo (registro) */
.folha { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; z-index: 41; border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 92vh; overflow-y: auto; box-shadow: var(--sombra); max-width: 560px; margin: 0 auto; }
.opcoes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opcoes button { min-height: 50px; }
.opcoes button[aria-pressed=true] { background: var(--tinta); color: #fff; border-color: var(--tinta); }
.opcoes button.cheio { grid-column: 1 / -1; }
.opcoes button.cheio[aria-pressed=true] { background: var(--ok); border-color: var(--ok); }
img.previa { max-width: 100%; max-height: 180px; border-radius: var(--raio); border: 1px solid var(--linha); display: block; margin-top: 8px; }
/* lista de rotas do entregador (aplicativo) */
.rota-card { display: grid; gap: 12px; padding: 18px; background: #fff; border: 1px solid var(--linha); border-radius: var(--raio-g); text-decoration: none; color: inherit; }
.rota-card.ativa { border: 0; box-shadow: 0 0 0 2px var(--marca), 0 8px 24px rgba(79, 70, 229, .14); }
.rota-card h2 { font-size: 20px; }

@media (max-width: 980px) {
  .topo .dentro { flex-wrap: wrap; height: auto; gap: 0 12px; padding: 10px 16px 0; }
  .topo .abas { order: 3; width: 100%; height: 44px; margin: 6px -4px 0; }
  .topo .conta #conta { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
  .dupla { display: flex; flex-direction: column; height: auto; }
  .dupla > .palco { order: -1; height: 46vh; min-height: 280px; border-bottom: 1px solid var(--linha); }
  .dupla > .coluna { border-right: 0; overflow: visible; padding: 20px 16px 80px; }
}
@media (max-width: 640px) {
  main { padding: 20px 16px 90px; }
  h1 { font-size: 22px; }
  .numero { font-size: 26px; }
  .mapa.grande { height: 420px; }
  .resumo { grid-template-columns: 1fr; justify-items: center; gap: 18px; }
  .resumo .grade { width: 100%; }
  .resumo .grade > div { padding: 4px 10px; text-align: center; }
  .topo select { max-width: 150px; }
}
.topo-fim button { white-space: nowrap; }
