/* Mapa da rua - simplificado, toques fáceis no mobile, multi-rotas e cronômetro */
.mr-wrap {
  position: relative;
  height: calc(100dvh - 180px);
  min-height: 540px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid #e5e9ed;
  background: #e9eef2;
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
}
.mr-mapa {
  position: absolute;
  inset: 0;
  z-index: 1;
  touch-action: pan-x pan-y;
}

/* Topo flutuante */
.mr-topo {
  position: absolute;
  z-index: 500;
  top: 12px;
  left: 12px;
  right: 72px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.mr-topo > * { pointer-events: auto; }

.mr-busca {
  display: flex;
  gap: 6px;
  max-width: 560px;
  align-items: center;
}
.mr-busca input,
.mr-busca select,
.mr-sair {
  border: 0;
  border-radius: 14px;
  height: 44px;
  font: 600 14px 'DM Sans', system-ui, sans-serif;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 4px 16px rgba(15, 23, 42, .16);
}
.mr-busca input {
  flex: 1;
  min-width: 0;
  padding: 0 14px;
}
.mr-busca select {
  max-width: 112px;
  padding: 0 10px;
  cursor: pointer;
}
.mr-busca select.mr-alerta {
  box-shadow: 0 0 0 3px #ef4444, 0 4px 16px rgba(15, 23, 42, .2);
}
.mr-sair {
  display: none;
  flex: none;
  width: 44px;
  font-size: 20px;
  cursor: pointer;
  place-items: center;
}

/* Filtros */
.mr-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.mr-chips::-webkit-scrollbar { display: none; }
.mr-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: #334155;
  font: 700 12.5px 'DM Sans', system-ui, sans-serif;
  box-shadow: 0 3px 10px rgba(15, 23, 42, .14);
  cursor: pointer;
  white-space: nowrap;
}
.mr-chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}
.mr-chip b { color: #64748b; font-weight: 700; }
.mr-chip.ativo {
  background: #0f172a;
  color: #fff;
}
.mr-chip.ativo b { color: #ffca05; }

/* HUD de turno / rota ativa */
.mr-hud {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(15, 23, 42, .92);
  color: #fff;
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(15, 23, 42, .24);
  backdrop-filter: blur(8px);
}
.mr-hud span { white-space: nowrap; }
.mr-hud-btns {
  display: inline-flex;
  gap: 4px;
  margin-left: 2px;
}
.mr-hud-btns button {
  border: 0;
  border-radius: 8px;
  padding: 4px 8px;
  font: 700 11.5px 'DM Sans', system-ui, sans-serif;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  cursor: pointer;
}
.mr-hud-btns button.fim { background: #dc2626; }

.mr-carregando {
  align-self: flex-start;
  background: #1684f8;
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
}

/* Botões laterais */
.mr-botoes {
  position: absolute;
  z-index: 500;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.mr-fab {
  position: relative;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #0f172a;
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, .22);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.mr-fab-sm {
  width: 40px;
  height: 40px;
  font-size: 17px;
}
.mr-fab.ativo {
  background: #1684f8;
  color: #fff;
}
.mr-fab.rodando {
  background: #16a34a;
  color: #fff;
}
.mr-fab.pausado {
  background: #f59e0b;
  color: #fff;
}
.mr-fab.carregando {
  animation: mr-pulso 1s infinite;
}
.mr-fab-rota b {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ffca05;
  color: #0f172a;
  font: 800 11px/20px 'DM Sans', sans-serif;
  border: 2px solid #fff;
}
@keyframes mr-pulso {
  50% { box-shadow: 0 0 0 10px rgba(22, 132, 248, .25); }
}

/* Toast dentro do mapa (visível no mobile!) */
.mr-toast {
  position: absolute;
  z-index: 750;
  left: 50%;
  top: 112px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: #0f172a;
  color: #fff;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .28);
  text-align: center;
  pointer-events: none;
}
.mr-toast[data-tone="error"] { background: #dc2626; }
.mr-toast[data-tone="ok"] { background: #16a34a; }

/* Gaveta lateral (desktop) / inferior (mobile) */
.mr-sheet {
  position: absolute;
  z-index: 600;
  top: auto;
  bottom: 12px;
  right: 72px;
  width: 360px;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  justify-content: flex-end;
}
.mr-sheet > * { pointer-events: auto; }
.mr-alca {
  display: none;
  border: 0;
  padding: 6px 0;
  background: transparent;
  align-self: center;
  width: 64px;
  cursor: pointer;
  flex: none;
}
.mr-alca::before {
  content: '';
  display: block;
  width: 44px;
  height: 5px;
  margin: auto;
  border-radius: 9px;
  background: rgba(15, 23, 42, .35);
}

.mr-resumo {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 0;
  background: #fff;
  border-radius: 16px;
  padding: 13px 16px;
  box-shadow: 0 6px 24px rgba(15, 23, 42, .2);
  font: 700 13.5px 'DM Sans', system-ui, sans-serif;
  color: #0f172a;
  cursor: pointer;
  text-align: left;
}
.mr-resumo span {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mr-resumo b {
  flex: none;
  color: #1684f8;
  font-size: 12.5px;
}
.mr-sheet.min #mrCard,
.mr-sheet.min #mrRotaPainel,
.mr-sheet.min #mrProximos { display: none; }
.mr-sheet.min .mr-resumo { display: flex; }

/* Cartão do comércio */
.mr-card {
  background: #fff;
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, .2);
  color: #0f172a;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mr-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.mr-card-top b {
  font: 800 17px/1.2 Manrope, 'DM Sans', sans-serif;
  letter-spacing: -.02em;
  display: block;
}
.mr-card-top small {
  display: block;
  color: #475569;
  font-size: 12.5px;
  margin-top: 3px;
  line-height: 1.35;
}
.mr-end { color: #64748b !important; font-size: 12px !important; }
.mr-x {
  border: 0;
  background: #f1f5f9;
  color: #334155;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 19px;
  cursor: pointer;
  flex: none;
  display: grid;
  place-items: center;
}
.mr-tag {
  align-self: flex-start;
  background: color-mix(in srgb, var(--c) 14%, #fff);
  color: var(--c);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}
.mr-nota {
  color: #475569;
  font-style: italic;
  font-size: 12px;
}
.mr-aqui {
  background: #1684f8;
  color: #fff;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 700;
}

/* Botões de rota do cartão */
.mr-rota-cta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.mr-btn-pri {
  flex: 1 1 auto;
  border: 0;
  border-radius: 12px;
  padding: 11px 12px;
  background: #1684f8;
  color: #fff;
  font: 700 13.5px 'DM Sans', system-ui, sans-serif;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}
.mr-btn-pri.na-rota {
  background: #0f172a;
}
.mr-btn-sec {
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: #0f172a;
  font: 700 13px 'DM Sans', system-ui, sans-serif;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.mr-btn-zap {
  border-color: #16a34a;
  color: #15803d;
  background: #f0fdf4;
}
.mr-btn-maps {
  width: 100%;
  display: block;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: #16a34a;
  color: #fff;
  font: 800 14px 'DM Sans', system-ui, sans-serif;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.mr-btn-maps.parte2 { background: #1684f8; }

/* Ações rápidas de visita */
.mr-acoes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.mr-acao {
  border: 1.5px solid color-mix(in srgb, var(--c) 38%, #fff);
  background: color-mix(in srgb, var(--c) 9%, #fff);
  color: var(--c);
  border-radius: 12px;
  padding: 10px 4px;
  font: 700 12px 'DM Sans', system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
}
.mr-acao.vendi {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}
.mr-acao:disabled { opacity: .5; }

.mr-obs {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 11px;
  font: 13px 'DM Sans', system-ui, sans-serif;
}
.mr-mais summary {
  cursor: pointer;
  color: #475569;
  font-size: 12.5px;
  font-weight: 700;
  list-style: none;
  padding: 2px 0;
}
.mr-mais summary::-webkit-details-marker { display: none; }
.mr-mais[open] { display: flex; flex-direction: column; gap: 8px; }

.mr-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mr-links a,
.mr-links button {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 999px;
  padding: 7px 11px;
  font: 600 12px 'DM Sans', system-ui, sans-serif;
  color: #0f172a;
  text-decoration: none;
  cursor: pointer;
}

/* Painel da Rota */
.mr-rota-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.mr-rota-head b { font: 800 16px Manrope, 'DM Sans', sans-serif; }
.mr-rota-resumo {
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 12px;
  padding: 9px 11px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}
.mr-rota-resumo small {
  display: block;
  margin-top: 3px;
  color: #1d4ed8;
  font-weight: 600;
  font-size: 12px;
}
.mr-modo {
  display: flex;
  gap: 6px;
}
.mr-modo button {
  flex: 1;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 10px;
  padding: 8px 10px;
  font: 700 12.5px 'DM Sans', sans-serif;
  cursor: pointer;
}
.mr-modo button.ativo {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.mr-paradas {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 210px;
  overflow-y: auto;
}
.mr-parada {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 7px 9px;
}
.mr-parada.feita { opacity: .62; }
.mr-parada-info {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: #0f172a;
}
.mr-parada-info b {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mr-parada-info small {
  display: block;
  font-size: 11.5px;
  color: #64748b;
}
.mr-parada-ctrl {
  display: flex;
  gap: 3px;
  flex: none;
}
.mr-parada-ctrl button {
  width: 28px;
  height: 28px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-weight: 800;
  cursor: pointer;
  font-size: 12px;
}
.mr-parada-ctrl button:disabled { opacity: .35; }
.mr-rota-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.mr-rota-tools button {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  border-radius: 10px;
  padding: 8px 6px;
  font: 700 12px 'DM Sans', sans-serif;
  cursor: pointer;
}

.mr-salvas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.mr-salva-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  overflow: hidden;
  font-size: 12px;
}
.mr-salva-chip button {
  border: 0;
  background: transparent;
  padding: 5px 9px;
  font: 700 12px 'DM Sans', sans-serif;
  color: #0f172a;
  cursor: pointer;
}
.mr-salva-chip button.del {
  color: #dc2626;
  padding-left: 3px;
}

/* Próximos */
.mr-sub {
  background: #fff;
  padding: 10px 14px 6px;
  font-size: 11.5px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .04em;
}
#mrProximos {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, .16);
  overflow: hidden;
}
#mrProximos:empty { display: none; }
.mr-prox {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-top: 1px solid #f1f5f9;
  background: #fff;
  padding: 10px 14px;
  text-align: left;
  cursor: pointer;
  color: #0f172a;
}
.mr-prox > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.mr-prox b {
  display: block;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mr-prox small {
  color: #64748b;
  font-size: 12px;
}
.mr-prox em {
  font-style: normal;
  font-weight: 700;
  font-size: 12px;
  color: #1684f8;
  flex: none;
}
.mr-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .15);
}

/* Pinos do mapa */
.mr-pin-wrap { background: none; border: 0; }
.mr-pin {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  display: grid;
  place-items: center;
  font: 800 13px 'DM Sans', sans-serif;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.mr-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1684f8;
  color: #fff;
  display: grid;
  place-items: center;
  font: 800 12.5px 'DM Sans', sans-serif;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .35);
  flex: none;
}
.mr-num.prox {
  background: #ffca05;
  color: #0f172a;
}

.mr-eu-wrap { background: none; border: 0; }
.mr-eu {
  position: relative;
  display: block;
  width: 30px;
  height: 30px;
}
.mr-eu::before {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #1684f8;
  border: 3px solid #fff;
  box-shadow: 0 0 0 7px rgba(22, 132, 248, .25), 0 2px 8px rgba(0, 0, 0, .35);
  animation: mr-eu 2s infinite;
}
.mr-eu i {
  position: absolute;
  left: 10px;
  top: -7px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 10px solid #1684f8;
  opacity: 0;
  transform-origin: 5px 22px;
}
@keyframes mr-eu {
  50% { box-shadow: 0 0 0 13px rgba(22, 132, 248, .12), 0 2px 8px rgba(0, 0, 0, .35); }
}

@media (min-width: 821px) {
  body.mr-ativo main { max-width: none; }
  .mr-topo { right: 445px; }
  .mr-alca { display: block; }
}

@media (max-width: 820px) {
  body.mr-ativo .topline,
  body.mr-ativo .topbar,
  body.mr-ativo #mobileNav,
  body.mr-ativo #mobileMoreMenu,
  body.mr-ativo .tabs,
  body.mr-ativo .cn-back-clients { display: none !important; }
  body.mr-ativo { overflow: hidden; }
  body.mr-ativo main { padding: 0 !important; max-width: none; }

  .mr-wrap {
    position: fixed;
    inset: 0;
    height: auto;
    min-height: 0;
    border-radius: 0;
    border: 0;
    z-index: 50;
  }
  .mr-sair { display: grid; }
  .mr-topo {
    top: max(10px, env(safe-area-inset-top));
    left: 10px;
    right: 10px;
  }
  .mr-busca { max-width: none; }
  .mr-busca select { max-width: 88px; padding: 0 6px; font-size: 13px; }
  .mr-botoes {
    top: calc(max(10px, env(safe-area-inset-top)) + 98px);
    right: 10px;
  }
  .mr-fab { width: 48px; height: 48px; }
  #mrGps { width: 52px; height: 52px; font-size: 22px; }

  .mr-sheet {
    left: 0;
    right: 0;
    top: auto;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: auto;
    max-height: 62dvh;
    padding: 0 10px;
  }
  .mr-alca { display: block; }
  .mr-sheet.min { max-height: none; }
  .mr-card { padding: 13px; gap: 9px; }
  .mr-acao { padding: 11px 2px; font-size: 12px; }
  .mr-sheet:has(.mr-card-top) #mrProximos { display: none; }
}
