:root {
  --brand: #E8590C;
  --brand-dark: color-mix(in srgb, var(--brand) 78%, black);
  --brand-soft: color-mix(in srgb, var(--brand) 9%, white);
  --brand-line: color-mix(in srgb, var(--brand) 30%, white);
  --bg: #f4f4f2; --surface: #fff; --line: #e6e4e1;
  --ink: #1c1917; --ink2: #44403c; --muted: #78716c;
  --ok: #16a34a; --warn: #d97706; --bad: #dc2626; --idle: #a8a29e; --credit: #facc15;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button { font: inherit; color: inherit; }

.bar { display: flex; align-items: center; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; flex: none; gap: 10px; background: var(--brand); color: #fff; }
.bar-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar-l img { width: 34px; height: 34px; border-radius: 9px; background: #fff; padding: 2px; }
.bar-shop { font-size: 11px; opacity: .85; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-name { font-size: 15px; font-weight: 500; margin-top: 1px; }
.bar-name b { font-weight: 800; }
.bar-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.sig { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); display: inline-block; flex: none; }
.bar .dot { box-shadow: 0 0 0 2px #fff; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }

main { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.screen { flex: 1; overflow: auto; padding: 20px 16px; display: flex; flex-direction: column; gap: 14px; }
.center { justify-content: center; text-align: center; }
.big-name { font-size: 36px; font-weight: 800; letter-spacing: -.03em; margin: 0; line-height: 1.05; }
.label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; align-self: flex-start; }
.center .chip { align-self: center; }
.box { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: #fff; }
.box h3 { margin: 0 0 6px; font-size: 17px; }
.muted { color: var(--muted); }
.list { list-style: none; padding: 0; margin: 8px 0 0; }
.list li { padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; display: flex; gap: 10px; }
.list li:first-child { border-top: 0; }
.list .n { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.list .t { min-width: 0; }
.list .t div:nth-child(2) { color: var(--muted); font-size: 13px; }
.list .t .o { color: #b45309; font-size: 12.5px; }

.btn { border: 1px solid #d6d3d1; background: #fff; border-radius: 14px; padding: 16px; font-weight: 700; font-size: 15px; letter-spacing: .03em; cursor: pointer; width: 100%; text-transform: uppercase; color: var(--ink); text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.huge { padding: 22px; font-size: 19px; border-radius: 16px; }
.btn:disabled { opacity: .35; }
.btn.sm { padding: 12px 10px; font-size: 13px; border-radius: 12px; text-transform: none; letter-spacing: 0; font-weight: 600; }
.btn.glow { border-color: var(--brand-line); color: var(--brand-dark); background: var(--brand-soft); }
.btn.danger { color: var(--bad); border-color: #fecaca; background: #fff; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.hint { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.5; margin: 0; }
.warnbox { background: #fef3c7; color: #92400e; border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.45; }
.okbox { background: #dcfce7; color: #166534; border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.45; }

/* GPS contínuo */
.bg { border: 2px solid var(--brand); border-radius: 16px; background: #fff; }
.bg-in { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bg-in h3 { margin: 0; font-size: 15px; }
.bg-in p { margin: 0; font-size: 13px; color: var(--ink2); line-height: 1.45; }
.step { display: flex; gap: 10px; align-items: center; }
.step .sn { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.step .btn { flex: 1; }

/* rota */
.route { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#mmap { height: 36vh; min-height: 190px; flex: none; background: #e5e3df; }
.sheet { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.next-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.eta-big { font-size: 32px; font-weight: 800; letter-spacing: -.03em; line-height: 1; white-space: nowrap; color: var(--brand-dark); }
.eta-big small { font-size: 14px; font-weight: 600; }
.client { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 2px; }
.addr { font-size: 15px; color: var(--ink2); line-height: 1.4; }
.obs { margin-top: 6px; font-size: 14px; color: #92400e; background: #fef3c7; border-radius: 10px; padding: 8px 10px; }
.kv { display: flex; gap: 8px; }
.kv > div { flex: 1; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.kv .k { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kv .v { font-size: 22px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kv .v.hl { color: var(--brand-dark); }
.return-big { font-size: 56px; font-weight: 800; letter-spacing: -.03em; line-height: 1; color: var(--brand-dark); font-variant-numeric: tabular-nums; }

.me { width: 18px; height: 18px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 7px rgba(26, 115, 232, .2), 0 1px 4px rgba(0, 0, 0, .3); }
.mk-stop { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 2.5px solid var(--brand); color: var(--brand-dark); display: grid; place-items: center; font-weight: 800; font-size: 12px; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.mk-stop.next { background: var(--brand); color: #fff; border-color: #fff; }
.mk-shop { width: 32px; height: 32px; border-radius: 9px; background: #1c1917; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }

.mk-host { width: 0; height: 0; }
.leaflet-marker-icon.mk-host { overflow: visible; }
.mk-host > .me, .mk-host > .mk-stop, .mk-host > .mk-shop { position: absolute; transform: translate(-50%, -50%); }

/* crédito: bem discreto, piscando */
.credit { flex: none; text-align: center; padding: 4px 0 calc(4px + env(safe-area-inset-bottom)); background: #1c1917; color: var(--credit); font-size: 9.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; animation: blink 2.6s ease-in-out infinite; }
@keyframes blink { 0%, 100% { color: rgba(250, 204, 21, .25); } 50% { color: rgba(250, 204, 21, .9); } }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(36px + env(safe-area-inset-bottom)); background: #1c1917; color: #fff; padding: 14px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; opacity: 0; transform: translateY(10px); transition: .25s; pointer-events: none; z-index: 9999; text-align: center; border-left: 4px solid var(--brand); }
.toast.show { opacity: 1; transform: none; }
.toast.bad { border-left-color: var(--bad); }
.check-big { width: 80px; height: 80px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 38px; margin: 0 auto; }

.ifood { margin-top: 8px; background: #fee2e2; color: #991b1b; border-radius: 10px; padding: 10px; font-size: 13.5px; display: flex; flex-direction: column; gap: 8px; }
.ifood .btn { background: #fff; border-color: #fecaca; color: #b91c1c; }

/* rodapé: nome escrito na cor do sistema, com lembrete opcional */
.credit { background: #fff; border-top: 1px solid var(--line); color: var(--brand-dark); font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: none; animation: none; padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caret { display: inline-block; width: 2px; height: 1.05em; background: var(--brand); margin-left: 2px; vertical-align: -2px; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
/* escolher a próxima entrega */
.list .go { margin-left: auto; flex: none; align-self: center; border: 1px solid var(--brand-line); background: var(--brand-soft); color: var(--brand-dark); border-radius: 10px; padding: 8px 10px; font-weight: 700; font-size: 12px; }
.ordem { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.copy { display: flex; gap: 6px; align-items: center; background: #f7f6f5; border-radius: 8px; padding: 6px 8px; font-size: 11.5px; word-break: break-all; }
.copy code { flex: 1; }
.copy button { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 8px; font-size: 11px; font-weight: 700; }

.credit .cw { display: inline-block; }
.credit { cursor: default; user-select: none; }

.btn.help { background: #dc2626; border-color: #dc2626; color: #fff; }
.kv .v.hl, .return-big, .eta-big { color: var(--brand); }
#rBack { font-size: 26px; }
