:root {
  --bg: #f4f6f8;
  --ink: #1a3645;
  --muted: #6C757D;
  --card: #ffffff;
  --line: #DEE2E6;
  --brand: #2C4D5E;
  --brand-escura: #1a3645;
  --brand-2: #1b6ec2;
  --accent: #008B98;
  --accent-2: #3B8EA5;
  --ok: #26b050;
  --warn: #c9a227;
  --err: #dc3545;
  --tap: 48px;
  --pad: max(12px, env(safe-area-inset-left));
  --pad-r: max(12px, env(safe-area-inset-right));
  --nav-h: 64px;
  --cta-h: 72px;
}

* { box-sizing: border-box; }
html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body { margin: 0; padding: 0; }
body {
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
body.is-login { padding-bottom: 0; background: #1a3645; }
body.is-login .page {
  padding: 0;
  max-width: none;
  min-height: 100dvh;
}

img, video { max-width: 100%; height: auto; }
canvas { max-width: 100%; }
h1, h2, h3, .meta, .card, .topbar-user { overflow-wrap: anywhere; word-break: break-word; }

a { color: #0366d6; }
button, select, input, textarea {
  font: inherit;
  font-size: 16px;
  max-width: 100%;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) var(--pad-r) 10px var(--pad);
  background: var(--brand-escura); color: #fff;
}
body.ergon-app .topbar { display: none; }
body.ergon-app .instalar { display: none; }
.topbar-brand { font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.topbar-user {
  text-align: right; font-size: 12px; opacity: .9;
  min-width: 0; max-width: 55%;
}
.topbar-user strong {
  display: block; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-user span { display: block; }
.topbar-logs {
  display: inline-block;
  margin-top: 2px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  opacity: .9;
}

.empresa-bar {
  display: flex; gap: 8px; align-items: center;
  padding: 6px var(--pad-r) 6px var(--pad);
  background: #152c38; color: #c5d6de;
}
.empresa-bar label { font-size: 11px; flex: none; font-weight: 650; }
.empresa-bar select {
  flex: 1; min-width: 0; min-height: 40px;
  border: 0; border-radius: 8px; padding: 0 8px;
  text-overflow: ellipsis;
}

.page {
  padding: 14px var(--pad-r) 20px var(--pad);
  max-width: 1100px; margin: 0 auto; width: 100%;
}
h1 { font-size: clamp(1.15rem, 4.5vw, 1.6rem); margin: 0 0 12px; color: var(--brand); }
h2 { font-size: clamp(0.95rem, 3.5vw, 1.15rem); margin: 20px 0 8px; color: var(--brand); }

.flash { padding: 12px; border-radius: 10px; margin-bottom: 12px; }
.flash.ok { background: #e8f8ee; color: var(--ok); }
.flash.erro { background: #fde8e8; color: var(--err); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px;
  text-decoration: none; color: inherit;
  min-height: 72px; min-width: 0;
}
a.stat { display: block; }
a.stat:active { background: #e9ecef; }
.stat b { display: block; font-size: clamp(1.3rem, 5vw, 1.7rem); color: var(--brand); }
.stat span { color: var(--muted); font-size: 12px; display: block; }

.acoes { display: flex; flex-direction: column; margin-top: 8px; }

.filters { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 12px; }
.filters input, .filters select {
  min-height: var(--tap); width: 100%;
  border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: #fff;
}
.filters .btn-row { grid-column: 1 / -1; }

.tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin: 4px 0 14px;
}
.tabs a, .tabs span {
  text-decoration: none; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  min-height: var(--tap);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 650; padding: 0 8px;
  text-align: center;
}
.tabs a.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.lista { display: grid; grid-template-columns: 1fr; gap: 10px; }
.lista .card { margin-bottom: 0; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px; margin-bottom: 10px;
  display: block; text-decoration: none; color: inherit;
  min-width: 0;
}
.card h3 { margin: 0 0 6px; font-size: 16px; color: var(--brand); }
.meta { color: var(--muted); font-size: 13px; line-height: 1.4; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill { font-size: 11px; padding: 4px 8px; border-radius: 999px; background: #e9ecef; color: var(--brand); }
.pill.ok { background: #e8f8ee; color: var(--ok); }
.pill.warn { background: #fff6db; color: #8a6d12; }
.pill.err { background: #fde8e8; color: var(--err); }
.pill.info { background: #e6f4f6; color: var(--accent); }

.item-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(72px, 92px);
  gap: 8px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.item-row input { min-height: var(--tap); width: 100%; text-align: right; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); width: 100%; border: 0; border-radius: 8px;
  background: #1b6ec2; color: #fff; font-weight: 650; margin-top: 10px;
  text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  padding: 0 10px; text-align: center;
}
.btn.sec { background: #fff; color: var(--brand); border: 1px solid var(--line); }
.btn.accent { background: var(--accent); }
.btn:active { filter: brightness(.92); }

.btn-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.btn-row .btn { margin-top: 0; }

.equipe-lista { display: grid; grid-template-columns: 1fr; gap: 10px; }
.equipe-card { margin-bottom: 0; }
.equipe-label {
  display: block;
  margin: 10px 0 4px;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}
.equipe-card select {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}
.equipe-card[data-papel]:not([data-papel="Entregador"]) .equipe-entregador { display: none; }

.login-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: max(28px, env(safe-area-inset-top)) var(--pad-r) max(24px, env(safe-area-inset-bottom)) var(--pad);
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(0, 139, 152, .45), transparent 58%),
    linear-gradient(165deg, #1a3645 0%, #2C4D5E 52%, #16313e 100%);
}
.login-brand {
  text-align: center;
  color: #fff;
  max-width: 420px;
}
.login-brand h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.6rem, 6vw, 2rem);
  letter-spacing: .01em;
}
.login-brand p {
  margin: 6px 0 0;
  color: #c5d6de;
  font-size: 15px;
  line-height: 1.4;
}
.login-logo {
  display: block;
  width: 84px;
  height: 84px;
  border-radius: 22px;
  margin: 0 auto 12px;
  background: #2C4D5E;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 20px;
  padding: 22px 20px 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}
.login-card h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}
.login-lead {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.login-form .field { margin-bottom: 14px; }
.login-input {
  position: relative;
}
.login-input svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.login-input input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px 0 44px;
  background: #f4f7f8;
  color: var(--ink);
}
.login-input input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
  background: #fff;
}
.login-entrar {
  margin-top: 6px;
  min-height: 52px;
  border-radius: 12px;
  background: var(--accent);
  font-size: 16px;
}
.instalar {
  margin-top: 16px;
  padding: 12px 12px 10px;
  border-radius: 12px;
  background: #f4f7f8;
}
.instalar strong {
  display: block;
  font-size: 13px;
  color: var(--brand);
}
.instalar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.instalar .btn { margin-top: 10px; border-radius: 10px; }
.ios-dica { margin-top: 8px !important; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; margin-bottom: 4px; color: var(--brand); }
.field select { width: 100%; min-height: 52px; border-radius: 8px; border: 1px solid var(--line); padding: 0 12px; background: #fff; }

.sign-box { border: 1px dashed var(--line); border-radius: 10px; background: #fff; touch-action: none; }
.sign-box canvas { width: 100%; height: min(180px, 32vw); min-height: 140px; display: block; }

.fotos-acoes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.fotos-acoes .btn { margin-top: 0; cursor: pointer; }
.fotos-preview {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-top: 10px;
}
.fotos-preview figure { margin: 0; position: relative; min-width: 0; }
.fotos-preview img {
  width: 100%; height: 140px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line); background: #fff;
  display: block;
}
.fotos-preview figcaption { margin-top: 4px; }
.foto-remover {
  position: absolute; top: 6px; right: 6px;
  width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: rgba(26, 54, 69, .82); color: #fff;
  font-size: 20px; line-height: 1; cursor: pointer;
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--card); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
th { font-size: 11px; text-transform: uppercase; color: var(--muted); }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 4px var(--pad-r) calc(4px + env(safe-area-inset-bottom)) var(--pad);
}
.bottom-nav form { flex: 1; display: flex; min-width: 0; }
.nav-btn {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  min-height: 52px; width: 100%;
  background: transparent; color: var(--muted);
  border: 0;
  text-decoration: none; font-size: 11px; font-weight: 650;
  cursor: pointer; padding: 4px 2px;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.1;
}
.nav-btn svg {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.nav-btn svg rect, .nav-btn svg circle { fill: currentColor; stroke: none; }
.nav-btn.on { color: var(--accent); font-weight: 800; }
.nav-btn.sair { color: var(--err); }
.nav-btn:active { background: #f4f6f8; }

.empty { text-align: center; color: var(--muted); padding: 32px 8px; }

body.fullbleed .page { padding: 0; max-width: none; }
.rotas-page { display: flex; flex-direction: column; min-height: calc(100dvh - 140px); }
.mapa-rotas { height: min(38dvh, 320px); min-height: 200px; width: 100%; background: #dbe4ea; z-index: 1; }
.rotas-painel { padding: 14px var(--pad-r) 24px var(--pad); max-width: 820px; width: 100%; margin: 0 auto; }
.rota-bloco { background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; overflow: hidden; }
.rota-bloco summary {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  cursor: pointer; list-style: none; min-height: var(--tap);
}
.rota-bloco summary::-webkit-details-marker { display: none; }
.rota-bloco summary strong { flex: 1; color: var(--brand); min-width: 0; }
.rota-cor { width: 12px; height: 12px; border-radius: 50%; background: var(--rota); flex: none; }
.btn.sm { min-height: 40px; padding: 0 12px; font-size: 13px; }
.leaflet-popup-content { margin: 10px 12px !important; }
.leaflet-popup-content .btn-row { min-width: 160px; margin-top: 8px; }
.leaflet-popup-content .btn { font-size: 13px; }
.rota-bloco > .btn { width: calc(100% - 28px); margin: 0 14px 10px; }
.rota-paradas { margin: 0; padding: 0 8px 10px 20px; }
.rota-paradas li { padding: 8px 8px 8px 0; border-top: 1px solid var(--line); }
.rota-paradas .meta { display: block; }
.rota-paradas b { display: block; font-size: 14px; }
.rota-paradas .btn-row { margin-top: 8px; }
.rota-paradas .btn { width: 100%; }
.pin-rota { background: none !important; border: 0 !important; }
.pin-rota span {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  color: #fff; font-size: 11px; font-weight: 700;
  border: 2px solid #fff;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

.kanban-home { margin-top: 18px; }
.kanban-page { padding: 12px 0 24px; }
.kanban-page-head { padding: 0 var(--pad-r) 0 var(--pad); max-width: 1180px; margin: 0 auto; }
.kanban-filtros { margin: 10px 0 0; }
.kanban-sticky {
  position: sticky; top: calc(env(safe-area-inset-top) + 46px); z-index: 8;
  background: var(--bg);
  padding: 0 0 8px;
}
.kanban-resumo {
  display: flex; flex-wrap: wrap; gap: 8px 14px;
  padding: 0 var(--pad-r) 8px var(--pad);
  color: var(--muted); font-size: 13px;
}
.kanban-resumo b { color: var(--brand); }
.kanban-pessoas {
  display: flex; gap: 6px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 0 var(--pad-r) 8px var(--pad);
  scrollbar-width: none;
}
.kanban-pessoas::-webkit-scrollbar { display: none; }
.kanban-pessoa {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink);
  font-size: 13px; font-weight: 650; white-space: nowrap;
  cursor: pointer;
}
.kanban-pessoa.fila { background: #f3eee4; }
.kanban-pessoa.on {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.kanban-pessoa.on .kanban-qtd { background: #fff; color: var(--brand); }
.kanban-pessoa.is-empty { display: none; }
.kanban-board {
  padding: 0 var(--pad-r) 12px var(--pad);
}
.kanban-col {
  display: none;
  background: #e7eef2;
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 0;
  flex-direction: column;
}
.kanban-col.is-on { display: flex; }
.kanban-col.fila { background: #f3eee4; }
.kanban-col.drop { outline: 2px solid var(--accent); outline-offset: -2px; }
.kanban-col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 12px 8px;
}
.kanban-col-head strong {
  flex: 1; min-width: 0; font-size: 14px; color: var(--brand);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kanban-qtd {
  flex: none;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--brand); color: #fff;
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.kanban-cards {
  padding: 0 8px 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.kanban-vazio { margin: 8px 4px 16px; color: var(--muted); font-size: 13px; }
.kanban-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px;
}
.kanban-card.dragging { opacity: .55; }
.kanban-card-link { text-decoration: none; color: inherit; display: block; }
.kanban-card h3 { margin: 0 0 4px; font-size: 15px; color: var(--brand); }
.kanban-atribuir-lab { display: block; margin-top: 8px; }
.kanban-atribuir {
  width: 100%; min-height: var(--tap);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0 10px; background: #fff; font-size: 16px;
}
.kanban-mais {
  display: block; text-align: center; font-size: 13px; font-weight: 650;
  padding: 8px; color: var(--brand); text-decoration: none;
}

.page .kanban-resumo,
.page .kanban-pessoas,
.page .kanban-board { padding-left: 0; padding-right: 0; }
body.fullbleed .kanban-resumo,
body.fullbleed .kanban-pessoas,
body.fullbleed .kanban-board {
  padding-left: var(--pad); padding-right: var(--pad-r);
}

@media (min-width: 900px) {
  .kanban-pessoas { display: none; }
  .kanban-sticky { position: static; }
  .kanban-board {
    display: flex; gap: 10px;
    overflow-x: auto;
    align-items: flex-start;
  }
  .kanban-col {
    display: flex;
    flex: 0 0 min(300px, 28vw);
    max-width: 340px;
    min-height: 180px;
  }
  .kanban-col.is-empty { display: none; }
  .kanban-col.fila.is-empty { display: flex; }
  .kanban-cards { max-height: min(70dvh, 640px); overflow-y: auto; }
  .kanban-card { cursor: grab; }
  .kanban-atribuir { font-size: 13px; min-height: 40px; }
}

@media (max-width: 380px) {
  .nav-btn { font-size: 9px; min-height: 50px; }
  .nav-btn svg { width: 18px; height: 18px; }
  .btn-row { grid-template-columns: 1fr 1fr; }
  .fotos-preview, .fotos-acoes { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: 1fr; }
  .item-row input { text-align: left; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .mapa-rotas { height: 58dvh; min-height: 140px; }
  .nav-btn { min-height: 40px; flex-direction: row; gap: 6px; font-size: 11px; }
  .bottom-nav { padding-top: 4px; padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  :root { --nav-h: 56px; }
}

@media (min-width: 640px) {
  .page { padding: 20px 20px 28px; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .acoes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .acoes .btn { margin-top: 0; }
  .lista { grid-template-columns: 1fr 1fr; align-items: start; }
  .equipe-lista { grid-template-columns: 1fr 1fr; }
  .empresa-bar, .topbar { padding-left: 20px; padding-right: 20px; }
}

@media (min-width: 720px) {
  .tabs {
    display: flex; grid-template-columns: none;
    overflow-x: auto;
  }
  .tabs a, .tabs span {
    white-space: nowrap; padding: 0 16px; flex: 0 0 auto;
  }
  .lista-mobile { display: none; }
  .lista-desktop { display: block; }
  .nav-btn { font-size: 11px; min-height: 52px; }
  .nav-btn, .bottom-nav form { max-width: none; }
}

@media (min-width: 900px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .filters { grid-template-columns: repeat(4, 1fr); }
  .rotas-page { flex-direction: row; min-height: calc(100dvh - 72px); }
  .mapa-rotas { height: auto; min-height: calc(100dvh - 72px); flex: 1.2; position: sticky; top: 56px; }
  .rotas-painel { flex: 0 0 min(420px, 38vw); max-height: calc(100dvh - 72px); overflow: auto; }
  .bottom-nav { justify-content: center; max-width: 560px; left: 50%; right: auto; transform: translateX(-50%); width: 100%; border-radius: 16px 16px 0 0; }
}

@media (min-width: 1100px) {
  .page { max-width: 1180px; }
  .lista { grid-template-columns: 1fr 1fr 1fr; }
}

.page-head { margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.kicker {
  margin: 0 0 2px;
  font-size: 11px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent);
}
.lede { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.4; }

.stats-3 { grid-template-columns: repeat(3, 1fr); }
.stat.warn b { color: #8a6d12; }
.stat.ok b { color: var(--ok); }

.acoes-rapidas {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin: 12px 0 4px;
}
.acoes-rapidas .btn { margin-top: 0; }

.busca-bar {
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  margin-bottom: 12px;
}
.busca-bar input[type="search"] {
  min-height: var(--tap); width: 100%;
  border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; background: #fff;
}
.busca-bar input[type="date"] {
  min-height: var(--tap); min-width: 0;
  border: 1px solid var(--line); border-radius: 12px; padding: 0 8px; background: #fff;
}
.busca-bar .btn { margin: 0; min-height: var(--tap); }

.chips {
  display: flex; gap: 6px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin: 0 0 14px; padding-bottom: 2px;
}
.chips a {
  flex: none;
  text-decoration: none; color: var(--ink);
  background: #fff; border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 36px; padding: 0 14px;
  display: inline-flex; align-items: center;
  font-size: 13px; font-weight: 650; white-space: nowrap;
}
.chips a.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.lista-qtd { margin: 0 0 8px; }

.bloco-lista { margin-top: 18px; }
.bloco-lista-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin-bottom: 8px;
}
.bloco-lista-head h2 { margin: 0; }
.bloco-lista-head a {
  font-size: 13px; font-weight: 700; text-decoration: none; color: var(--accent);
}
.empty .btn { max-width: 280px; margin: 12px auto 0; }

.entrega-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
}
.entrega-card.com-sel { grid-template-columns: auto minmax(0, 1fr) auto; }
.entrega-card.is-sel { box-shadow: inset 0 0 0 2px var(--accent); }
.entrega-check {
  display: flex; align-items: center; justify-content: center;
  padding: 0 0 0 12px; z-index: 2;
}
.entrega-check input { width: 22px; height: 22px; accent-color: var(--accent); }
.lista-qtd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.link-btn {
  border: 0; background: none; color: var(--accent); font: inherit;
  font-weight: 700; font-size: 13px; padding: 0; cursor: pointer;
}
.lote-bar-txt { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--brand); }
.lote-bar-acoes { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.lote-bar-acoes .btn { margin: 0; }
.lote-entrega { border-top: 1px solid var(--line); padding: 8px 0; }
.lote-entrega:first-of-type { border-top: 0; padding-top: 0; }
.lote-entrega summary { cursor: pointer; list-style: none; }
.lote-entrega summary::-webkit-details-marker { display: none; }
.lote-entrega summary strong { display: block; }
.lote-entrega .entrega-end { margin: 6px 0 8px; }
.entrega-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--accent);
}
.entrega-card.is-partial::before { background: var(--warn); }
.entrega-card.is-route::before { background: var(--brand-2); }
.entrega-card.is-done::before { background: var(--ok); }
.entrega-card-main {
  display: block; text-decoration: none; color: inherit;
  padding: 12px 12px 12px 16px; min-width: 0;
}
.entrega-card h3 { margin: 0 0 4px; font-size: 15px; color: var(--brand); }
.entrega-doc, .entrega-end {
  margin: 0; color: var(--muted); font-size: 13px; line-height: 1.35;
}
.entrega-end { margin-top: 2px; }
.entrega-card .pills { margin-top: 8px; }
.entrega-card-acoes {
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  padding: 8px 10px 8px 0;
}
.icon-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; background: #eef6f7; color: var(--accent);
  text-decoration: none;
}
.icon-btn svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon-btn svg circle { fill: none; }

.voltar {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent); font-weight: 700; font-size: 14px;
  text-decoration: none;
}
.detalhe-head { margin-bottom: 14px; }
.detalhe-head h1 { margin: 0 0 6px; }
.detalhe-acoes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px;
}
.detalhe-acoes .btn { margin-top: 0; }
.form-sec {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 12px 0;
}
.form-sec h2 { margin: 0 0 8px; }
.form-sec > summary {
  font-weight: 700; color: var(--brand); cursor: pointer;
  min-height: 36px; display: flex; align-items: center;
}
.form-sec[open] > summary { margin-bottom: 10px; }
.form-sec .btn { width: auto; }

body.has-cta { padding-bottom: calc(var(--nav-h) + var(--cta-h) + env(safe-area-inset-bottom)); }
.sticky-cta {
  position: fixed; left: 0; right: 0; z-index: 25;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 10px var(--pad-r) 10px var(--pad);
  background: #fff;
  border-top: 1px solid var(--line);
}
.sticky-cta .btn { margin: 0; }

.mais-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(16, 32, 40, .45);
}
.mais-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 8px 8px calc(16px + env(safe-area-inset-bottom));
  max-height: 80dvh;
}
.mais-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px 4px;
}
.mais-head strong { color: var(--brand); }
.mais-fechar {
  width: 40px; height: 40px; border: 0; background: transparent;
  font-size: 28px; line-height: 1; color: var(--muted); cursor: pointer;
}
.mais-lista { display: flex; flex-direction: column; padding: 4px 8px; }
.mais-lista a {
  display: flex; align-items: center;
  min-height: 48px; padding: 0 12px;
  text-decoration: none; color: var(--ink); font-weight: 650;
  border-radius: 10px;
}
.mais-lista a:active { background: #f4f6f8; }
.mais-sair { padding: 4px 8px 0; }
.mais-sair button {
  width: 100%; min-height: 48px;
  border: 0; border-radius: 10px;
  background: #fde8e8; color: var(--err);
  font-weight: 800; cursor: pointer;
}

@media (min-width: 640px) {
  .stats-3 { grid-template-columns: repeat(3, 1fr); }
  .busca-bar { grid-template-columns: 1fr 160px; }
}

.splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  transition: opacity .35s ease;
}
.splash.out { opacity: 0; pointer-events: none; }
html.splash-skip .splash { display: none !important; }
.splash-box {
  display: flex; flex-direction: column; align-items: center;
  width: min(280px, 78vw);
}
.splash-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.splash-mark { width: 42px; height: 42px; flex: none; }
.splash-name {
  font-size: 28px; font-weight: 800; letter-spacing: -.03em;
  color: #24323a; line-height: 1;
}
.splash-bar {
  width: 100%; height: 6px;
  background: #e6eaed;
  border-radius: 999px; overflow: hidden;
}
.splash-fill {
  display: block; height: 100%; width: 0;
  background: #2a3a44;
  border-radius: 999px;
}
.splash-pct {
  margin-top: 10px;
  font-size: 13px; font-weight: 500;
  color: #8b959c;
  letter-spacing: .02em;
}

.offline-bar {
  position: fixed; left: 0; right: 0; z-index: 28;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 8px 12px;
  font-size: 13px; font-weight: 700; text-align: center;
}
.offline-bar.off { background: #fff6db; color: #8a6d12; }
.offline-bar.sync { background: #e6f4f6; color: var(--accent); }
body.is-login .offline-bar { bottom: 0; }
body.has-cta .offline-bar {
  bottom: calc(var(--nav-h) + var(--cta-h) + env(safe-area-inset-bottom));
}
