/* Cores da marca Zás (azul do logo). Tema claro é o padrão; o noturno vale quando o usuário escolhe
   (data-theme="dark", ver theme.js) ou, sem escolha, quando o aparelho está em modo escuro. */
:root {
  --brand: #1d63d8;
  --brand-deep: #1449a8;
  --bg: #edf2fb;
  --surface: #ffffff;
  --surface-2: #f3f7fe;
  --text: #0f1b33;
  --muted: #56647f;
  --border: #d3def2;
  --primary: #1d63d8;
  --primary-text: #ffffff;
  --ok: #17803a;
  --warn: #b25b00;
  --danger: #c42b2b;
  --topbar-bg: #1d63d8;
  --topbar-border: #1856c0;
  --topbar-text: #ffffff;
  --topbar-muted: rgba(255, 255, 255, .78);
  --topbar-active: rgba(255, 255, 255, .2);
  --login-bg: linear-gradient(160deg, #2a72e6 0%, #1d63d8 45%, #1449a8 100%);
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 40, 90, .08), 0 4px 14px rgba(15, 40, 90, .06);
  color-scheme: light;
}

/* Modo noturno: azul-marinho derivado do logo. */
:root[data-theme="dark"] {
  --bg: #07101f;
  --surface: #0e1a33;
  --surface-2: #132341;
  --text: #e6edfb;
  --muted: #93a3c3;
  --border: #22375e;
  --primary: #3b7cf2;
  --primary-text: #ffffff;
  --ok: #3fbf6a;
  --warn: #f0a24a;
  --danger: #ff6b6b;
  --topbar-bg: #0b1730;
  --topbar-border: #1c2f55;
  --topbar-text: #e6edfb;
  --topbar-muted: #93a3c3;
  --topbar-active: rgba(59, 124, 242, .22);
  --login-bg: radial-gradient(circle at 30% 0%, #16306a 0%, #0b1730 55%, #07101f 100%);
  --shadow: 0 1px 3px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07101f;
    --surface: #0e1a33;
    --surface-2: #132341;
    --text: #e6edfb;
    --muted: #93a3c3;
    --border: #22375e;
    --primary: #3b7cf2;
    --primary-text: #ffffff;
    --ok: #3fbf6a;
    --warn: #f0a24a;
    --danger: #ff6b6b;
    --topbar-bg: #0b1730;
    --topbar-border: #1c2f55;
    --topbar-text: #e6edfb;
    --topbar-muted: #93a3c3;
    --topbar-active: rgba(59, 124, 242, .22);
    --login-bg: radial-gradient(circle at 30% 0%, #16306a 0%, #0b1730 55%, #07101f 100%);
    --shadow: 0 1px 3px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Toque: sem atraso nem zoom por toque duplo em botões e links. */
button, a, label, select, input, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
a { color: var(--primary); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); min-height: 1.2em; margin: .5rem 0 0; }

/* Formulários */
label { display: block; font-size: .85rem; color: var(--muted); margin: .6rem 0 0; }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: .25rem;
  padding: .6rem .7rem;
  font: inherit;
  font-size: 1rem; /* não herda o tamanho menor do rótulo */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
textarea { resize: vertical; min-height: 60px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .4rem .8rem .8rem; margin: .8rem 0 0; }
legend { font-weight: 600; padding: 0 .3rem; }
.row { display: flex; gap: .5rem; align-items: flex-end; }
.row > * { flex: 1; min-width: 0; }
.row > .btn { flex: 0 0 auto; }

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.big { padding: .9rem 1rem; font-size: 1.05rem; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.btn-row > .btn { flex: 1; }

/* Cartões e listas */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}
.list { display: flex; flex-direction: column; gap: .6rem; }
.item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem .85rem;
}
.item.clickable { cursor: pointer; }
.item.clickable:hover { border-color: var(--primary); }
.item.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.item-head { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.item-title { font-weight: 600; overflow-wrap: anywhere; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

.badge {
  display: inline-block;
  padding: .1rem .55rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid currentColor;
}
.st-disponivel { color: var(--primary); }
.st-aceita { color: var(--warn); }
.st-draft { color: var(--muted); border-style: dashed; }
.block-flag { margin-top: .45rem; padding: .3rem .55rem; border-radius: 8px; background: rgba(196, 43, 43, .1); color: var(--danger); font-size: .8rem; font-weight: 700; overflow-wrap: anywhere; }
.block-banner { padding: .7rem .8rem; border-radius: 8px; background: rgba(196, 43, 43, .1); color: var(--danger); margin-bottom: .6rem; }
.block-banner .small { color: var(--text); }
.block-card { border: 2px solid var(--danger); }
.block-form { margin-top: .4rem; }
.block-form summary, details summary { cursor: pointer; font-weight: 600; color: var(--danger); }
.also-works { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .4rem; margin-top: .45rem; padding-top: .45rem; border-top: 1px dashed var(--border); min-width: 0; }
.company-tag {
  max-width: 100%; padding: .1rem .55rem; border: 1px solid var(--primary); border-radius: 99px;
  color: var(--primary); font-size: .75rem; font-weight: 600; overflow-wrap: anywhere;
}
.zas-history { border-color: var(--primary); }
.history-table tfoot td { font-weight: 700; border-bottom: 0; }
table.data.history-table th, table.data.history-table td { white-space: normal; }
.history-table td .small { display: block; }
.st-em_andamento { color: var(--ok); }
.st-finalizada { color: var(--muted); }
.st-cancelada { color: var(--danger); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .8rem; margin: .6rem 0; }
.kv dt { color: var(--muted); font-size: .85rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: .7rem 1rem; margin: .6rem 0;
}
.code-box strong { font-size: 1.8rem; letter-spacing: .3em; font-variant-numeric: tabular-nums; }

.timeline { list-style: none; padding: 0; margin: .5rem 0; }
.timeline li { padding: .15rem 0 .15rem 1.1rem; position: relative; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; left: 0; top: .6em; width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.timeline li.done::before { background: var(--ok); }

.conn { font-size: .8rem; color: var(--muted); }
.conn::before { content: "●"; margin-right: .3rem; color: var(--danger); }
.conn.on::before { color: var(--ok); }

/* Toasts */
#toasts { position: fixed; z-index: 2000; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; width: min(92vw, 420px); }
body.driver #toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
/* Teclado aberto no celular: a barra inferior some para não cobrir o campo que está sendo digitado. */
body.typing .bottom-nav { display: none; }
body.driver.typing #toasts { bottom: 16px; }
.toast { background: var(--text); color: var(--bg); padding: .7rem 1rem; border-radius: 8px; box-shadow: var(--shadow); }
.toast.warn { background: var(--warn); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* Mapa */
.leaflet-container { background: var(--surface-2); font: inherit; }
.pin-icon span {
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--primary); color: #fff; font-weight: 700; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.pin-icon b { transform: rotate(45deg); }
.drv-icon {
  display: grid; place-items: center; font-size: 20px;
  background: #fff; border-radius: 50%; border: 2px solid var(--ok);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .35);
}
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #1d63d8; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(29, 99, 216, .35); }

/* Marca (logo + nome) */
.brand { display: inline-flex; align-items: center; gap: .55rem; min-width: 0; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto; }
.brand h1, .brand p { margin: 0; }
.brand-lg { display: flex; gap: .8rem; margin-bottom: .6rem; }
.brand-lg .logo { width: 56px; height: 56px; border-radius: 14px; }
.brand-lg h1 { font-size: 1.6rem; }

/* Botão de modo noturno (☀️ / 🌙) */
.theme-toggle {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; padding: 0;
  font-size: 1.05rem; line-height: 1; cursor: pointer; border-radius: 10px;
  background: transparent; border: 1px solid var(--border); color: var(--text);
}
.topbar .theme-toggle { border-color: rgba(255, 255, 255, .35); }
.brand-lg .theme-toggle { margin-left: auto; align-self: flex-start; }

/* Mapa no modo noturno: inverte as cores dos blocos do mapa (ruas claras sobre fundo escuro). */
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) saturate(.8); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) saturate(.8); }
}

/* Login: fundo na cor da marca */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--login-bg); }
.login .card { box-shadow: 0 10px 40px rgba(5, 20, 60, .35); }
.register { background: var(--login-bg); min-height: 100%; }
.login .card { width: min(100%, 360px); }
.login .btn { margin-top: 1rem; width: 100%; }

/* ---------- Painel do admin ---------- */
/* minmax(0, …) e min-width: 0 impedem que um conteúdo largo (ex.: o menu) estique a página além da tela. */
.admin-layout {
  height: 100%;
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top" "side map";
}
.admin-layout > * { min-width: 0; }
.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem;
  background: var(--topbar-bg);
  color: var(--topbar-text);
  border-bottom: 1px solid var(--topbar-border);
}
.topbar .spacer { flex: 1; }
.topbar .logo { box-shadow: 0 0 0 2px rgba(255, 255, 255, .9); }
.topbar .conn { color: var(--topbar-muted); }
.topbar .btn.ghost { color: var(--topbar-text); border-color: rgba(255, 255, 255, .35); }
.topbar .btn.ghost:hover { background: var(--topbar-active); }
.side { grid-area: side; overflow-y: auto; border-right: 1px solid var(--border); padding: 1rem 1rem 1.5rem; }
.map { grid-area: map; min-height: 300px; }

/* Páginas sem mapa ocupam a largura toda */
.admin-layout.full { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "side"; }
.admin-layout.full .map { display: none; }
.admin-layout.full .side { border-right: 0; }
.page-wide { max-width: 1100px; margin: 0 auto; }
.page-wide.narrow { max-width: 560px; }

/* Menu do painel */
.admin-top { flex-wrap: wrap; row-gap: .4rem; }
.main-nav { display: flex; gap: .2rem; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav button {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .45rem .75rem; font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer;
  background: transparent; color: var(--topbar-muted); border: 1px solid transparent; border-radius: 8px;
}
.main-nav button:hover { color: var(--topbar-text); background: var(--topbar-active); }
.main-nav button.active { background: var(--topbar-active); color: var(--topbar-text); border-color: rgba(255, 255, 255, .25); }
.count { background: var(--danger); color: #fff; border-radius: 99px; font-size: .72rem; padding: 0 .45rem; line-height: 1.5; box-shadow: 0 0 0 2px var(--topbar-bg); }

/* Área do entregador: barra inferior com destaque na cor da marca */
.bottom-nav { border-top: 2px solid var(--primary); }

.chips { display: flex; gap: .35rem; flex-wrap: wrap; margin: .2rem 0 .4rem; }
.chips button {
  padding: .35rem .8rem; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--muted); border: 1px solid var(--border); border-radius: 99px;
}
.chips button.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }

.grid-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .6rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.5rem; }
.warn-text { color: var(--warn); }
.section-title h3 { margin: 0; }

.link-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem 1rem; margin: .6rem 0; }
.link-box input { font-size: .85rem; }
.link-box .btn-row { margin-top: .5rem; }

.audit { list-style: none; padding: 0; margin: .4rem 0 0; font-size: .88rem; }
.audit li { padding: .3rem 0; border-bottom: 1px solid var(--border); }
.audit li:last-child { border-bottom: 0; }

/* Fotos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .7rem; margin-top: .5rem; }
.photo-grid figure { margin: 0; }
.photo-grid figcaption { font-size: .82rem; margin-top: .25rem; }
.photo {
  display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; padding: 0; overflow: hidden; cursor: zoom-in;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
}
.photo img { width: 100%; height: 100%; object-fit: cover; }
.lightbox {
  position: fixed; inset: 0; z-index: 3000; background: rgba(0, 0, 0, .85);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 16px;
}
.lightbox img { max-width: 100%; max-height: calc(100% - 70px); object-fit: contain; border-radius: 6px; }

/* Painel Zás (dono) */
.owner-app { min-height: 100%; display: flex; flex-direction: column; }
.owner-app .topbar { position: sticky; top: 0; z-index: 100; }
.owner-main { padding: 1rem 1rem 3rem; }
.slug-input { display: flex; align-items: center; gap: .3rem; margin-top: .25rem; }
.slug-input input { margin-top: 0; }
.slug-input .muted { white-space: nowrap; font-size: .9rem; }
.access-choice { display: flex; flex-direction: column; gap: .2rem; margin-top: .6rem; }
.access-choice .check { align-items: center; }
.inline-num, .inline-date { display: inline-block; width: auto; margin: 0 .3rem; padding: .35rem .5rem; }
.inline-num { width: 4.5rem; }

/* Faixas de aviso no painel da empresa (linha própria no fim da barra do topo) */
.notices { order: 30; width: calc(100% + 2rem); margin: .1rem -1rem -.6rem; }
/* A faixa vai de borda a borda; o recorte evita que ela empurre a página para o lado no celular. */
.topbar:has(.notices) { overflow-x: clip; }
.notices:empty { display: none; }
.notice {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap;
  padding: .6rem 1rem; font-size: .9rem; font-weight: 600;
}
.notice.warn { background: #fff3d6; color: #7a4a00; }
.notice.info { background: #dbe8ff; color: #123a80; }
:root[data-theme="dark"] .notice.warn { background: #3a2a0a; color: #ffd28a; }
:root[data-theme="dark"] .notice.info { background: #13295a; color: #bcd3ff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .notice.warn { background: #3a2a0a; color: #ffd28a; }
  :root:not([data-theme="light"]) .notice.info { background: #13295a; color: #bcd3ff; }
}
.notice .btn { min-height: 34px; padding: .3rem .8rem; }
.company-chip {
  font-size: .85rem; font-weight: 600; padding: .2rem .6rem; border-radius: 99px;
  background: var(--topbar-active); color: var(--topbar-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw;
}
.blocked-screen { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--login-bg); }
.blocked-screen .card { max-width: 420px; text-align: center; }
.qr-box { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: .6rem; }
.qr-box svg, .qr-box img { width: 150px; height: 150px; background: #fff; padding: 8px; border-radius: 8px; }

/* Relatórios */
.report-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 .8rem; align-items: end; }
.report-filters .btn { margin-top: .6rem; }
.stats.stats-wide { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-top: .6rem; }
.table-wrap { overflow-x: auto; margin-top: .5rem; }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th, table.data td { padding: .45rem .5rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.data th { color: var(--muted); font-weight: 600; font-size: .8rem; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .btn { padding: .3rem .6rem; font-size: .82rem; }
.results { display: flex; flex-direction: column; gap: .3rem; margin-top: .4rem; }
.results button {
  text-align: left; font: inherit; font-size: .85rem; padding: .45rem .6rem; cursor: pointer;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
}
.results button:hover { border-color: var(--primary); }
.route-calc { margin: .3rem 0 0; font-weight: 600; }
.route-calc.muted { font-weight: 400; }
.picking .map { cursor: crosshair; }
.picking .leaflet-container { cursor: crosshair; }

/* Celular: a página inteira rola (sem rolagem interna), mapa no topo e menu em linha própria, deslizável. */
@media (max-width: 800px) {
  .admin-layout {
    height: auto;
    min-height: 100%;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 42vh auto;
    grid-template-areas: "top" "map" "side";
  }
  .admin-layout.full { grid-template-rows: auto auto; grid-template-areas: "top" "side"; }
  .admin-top { position: sticky; top: 0; z-index: 1100; gap: .6rem; padding: .5rem .75rem; }
  .side { border-right: 0; overflow: visible; padding: .9rem .75rem 2rem; }
  .map { scroll-margin-top: 110px; } /* não fica escondido atrás da barra do topo fixa */
  .main-nav { order: 10; width: 100%; margin: 0 -.25rem; }
  .main-nav button { padding: .4rem .6rem; }
  #accountBtn { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; padding: .45rem .6rem; }
  .two-col { grid-template-columns: 1fr; }
  .grid-list { grid-template-columns: minmax(0, 1fr); }
  .row { flex-wrap: wrap; }
  .row > label { flex: 1 1 140px; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Telas de toque (celular/tablet): campos com 16px (o iPhone dá zoom sozinho em campos menores)
   e alvos de toque com pelo menos ~40px de altura. */
@media (max-width: 800px), (pointer: coarse) {
  input, select, textarea, .link-box input { font-size: 16px; }
  .code-input { font-size: 1.6rem; }
  .btn, .chips button, .main-nav button, .results button { min-height: 40px; }
  table.data .btn, .map-tools .btn { min-height: 38px; }
}

/* ---------- App do entregador ---------- */
.driver-app { max-width: 640px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.driver-app .topbar { position: sticky; top: 0; z-index: 1000; padding-top: calc(.6rem + env(safe-area-inset-top)); }
.driver-main { padding: 12px 16px calc(88px + env(safe-area-inset-bottom)); flex: 1; }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav button {
  flex: 1; max-width: 214px;
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  padding: .55rem 0 .6rem; font: inherit; font-size: .78rem; font-weight: 600;
  background: none; border: 0; color: var(--muted); cursor: pointer;
}
.bottom-nav button span { font-size: 1.25rem; filter: grayscale(1); opacity: .7; }
.bottom-nav button.active { color: var(--primary); }
.bottom-nav button.active span { filter: none; opacity: 1; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.stat-full { grid-column: 1 / -1; }
.paid { color: var(--ok); font-weight: 600; }

/* Link de acompanhamento do cliente */
.track-page { max-width: 560px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: .8rem; }
.track-head {
  display: flex; align-items: center; gap: .8rem;
  margin: calc(-16px - env(safe-area-inset-top)) -16px 0; padding: calc(.7rem + env(safe-area-inset-top)) 16px .7rem;
  background: var(--topbar-bg); color: var(--topbar-text); border-bottom: 1px solid var(--topbar-border);
}
.track-head .logo { box-shadow: 0 0 0 2px rgba(255, 255, 255, .9); }
.track-head #updatedAt { margin-left: auto; color: var(--topbar-muted); }
.track-head .theme-toggle { border-color: rgba(255, 255, 255, .35); }
.track-page h1 { font-size: 1.3rem; }
.stepper { list-style: none; padding: 0; margin: .8rem 0 0; }
.stepper li { position: relative; padding: .3rem 0 .3rem 1.6rem; color: var(--muted); }
.stepper li::before {
  content: ""; position: absolute; left: .25rem; top: .65em; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border);
}
.stepper li.done { color: var(--text); }
.stepper li.done::before { background: var(--ok); border-color: var(--ok); }
.stepper li.current { color: var(--text); font-weight: 700; }
.stepper li.current::before { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px rgba(29, 99, 216, .2); }
.code-card { text-align: center; }
.code-card strong { display: block; font-size: 2.4rem; letter-spacing: .35em; font-variant-numeric: tabular-nums; margin: .2rem 0; }
.driver-line { display: flex; align-items: center; gap: .8rem; }
.driver-avatar { flex: 0 0 44px; height: 44px; display: grid; place-items: center; font-size: 1.5rem; background: var(--surface-2); border-radius: 50%; }
.plate { margin-left: auto; font-weight: 700; letter-spacing: .08em; padding: .25rem .55rem; border: 2px solid var(--text); border-radius: 6px; }
.zas-cta { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.zas-cta .logo { width: 40px; height: 40px; border-radius: 10px; }
.zas-cta .btn { margin-left: auto; }
.company-invite { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .5rem .7rem; margin: .4rem 0 0; font-size: .9rem; }
.track-map { height: 50vh; min-height: 260px; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }

/* Cadastro do entregador */
.register { padding: 16px; display: flex; justify-content: center; }
.register .card { width: min(100%, 560px); }
.sep { border: 0; border-top: 1px solid var(--border); margin: 1.2rem 0 .4rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; color: var(--text); margin-top: .8rem; }
.check input { width: auto; margin-top: .2rem; flex: 0 0 auto; }
.photo-inputs { display: flex; flex-direction: column; gap: .6rem; margin-top: .4rem; }
.photo-input {
  position: relative; display: flex; align-items: center; gap: .8rem; margin: 0; cursor: pointer; color: var(--text);
  background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius); padding: .6rem .7rem;
}
.photo-input input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.photo-input:focus-within { outline: 2px solid var(--primary); }
.photo-preview {
  flex: 0 0 64px; height: 64px; display: grid; place-items: center; font-size: 1.8rem; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* Situação do cadastro e avisos */
.status-card { text-align: center; padding: 1.5rem 1rem; }
.status-icon { font-size: 2.4rem; }
.status-card .reason { background: var(--surface-2); border-left: 3px solid var(--warn); padding: .6rem .8rem; text-align: left; border-radius: 6px; }
.status-card.rejected h2 { color: var(--warn); }
.banner {
  display: flex; align-items: center; gap: .8rem; justify-content: space-between; margin-bottom: .8rem;
  background: var(--surface); border: 1px solid var(--primary); border-radius: var(--radius); padding: .6rem .8rem; font-size: .9rem;
}
.stat { display: flex; flex-direction: column; gap: .15rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; }
.stat strong { font-size: 1.3rem; }
.driver-map { height: 45vh; min-height: 260px; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.map-wrap { position: relative; }
.map-tools { position: absolute; right: 8px; bottom: 8px; z-index: 500; display: flex; gap: .4rem; }
.map-tools .btn { padding: .4rem .7rem; font-size: .85rem; box-shadow: var(--shadow); background: var(--surface); }
.route-info { margin: .4rem 0 0; font-size: .9rem; }
.stops { list-style: none; margin: .6rem 0; padding: 0; }
.stops li { display: flex; gap: .6rem; padding: .35rem 0; }
.stops .dot { flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .8rem; }
.stops li.done .dot { background: var(--ok); }
.track-state { font-size: .85rem; margin-top: .6rem; }
.value { font-size: 1.15rem; font-weight: 700; }
.code-input { font-size: 1.6rem; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: .4rem 0 .8rem; flex-wrap: wrap; gap: .5rem; }

/* Corridas designadas e saídas com várias paradas */
h4 { font-size: .9rem; margin: .9rem 0 .4rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.assign-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem 1rem; margin: .6rem 0; }
.assign-box .btn-row { margin-top: .4rem; }
.item.compact { padding: .5rem .7rem; }
.item.compact .btn-row { margin-top: .3rem; }
.trip-stops { margin: .3rem 0; padding-left: 1.4rem; }
.trip-stops li { padding: .25rem 0; }
.trip-stops li .small { display: block; }
.stops li.next .dot { background: var(--accent, #ffb547); color: #0b1730; }
.stops li.skip { opacity: .55; text-decoration: line-through; }
.stops li.clickable { cursor: pointer; border-radius: 8px; }
.stops li.selected { background: var(--surface-2); outline: 2px solid var(--primary); outline-offset: 2px; }
.stop-kind { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.trip-summary { display: flex; flex-wrap: wrap; gap: .3rem .8rem; font-size: .9rem; }
.stop-focus { border: 2px solid var(--primary); border-radius: var(--radius); padding: .8rem; margin-top: .6rem; background: var(--surface); }
.my-routes { margin-bottom: 1rem; border-color: var(--primary); }
.plain-list { margin: .2rem 0 .4rem; padding-left: 1.1rem; }
.draft-panel { margin-bottom: 1rem; border: 2px solid var(--primary); }
.draft-panel .item-head a { font-weight: 600; }
.draft-panel .item .btn-row { display: flex; gap: .4rem; }
.draft-panel .item .btn-row .btn { flex: 0 0 auto; width: auto; padding: .25rem .7rem; font-size: .85rem; }
/* Os botões dividem a linha quando cabem; no painel estreito (desktop com mapa) ou no celular, um embaixo do outro. */
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.form-actions .btn { flex: 1 1 13rem; min-width: 0; white-space: normal; line-height: 1.25; text-align: center; }
.order-preview { margin: .5rem 0; padding-left: 1.3rem; }
.order-preview li { padding: .15rem 0; }
.num-pin span { background: var(--primary); }
.num-pin.next span { background: #ffb547; color: #0b1730; }
.num-pin.next b { color: #0b1730; }

/* Coleta com endereço salvo: só leitura */
.saved-pickup{display:flex;flex-direction:column;gap:.15rem;padding:.7rem .85rem;border:1px solid var(--border);border-radius:10px;background:var(--bg);overflow-wrap:anywhere}

/* Rede de empresários: nome da empresa com o contato embaixo */
.company-contact{display:flex;flex-direction:column;gap:.1rem;overflow-wrap:anywhere}
.block-banner li{display:flex;flex-direction:column;gap:.15rem;margin:.35rem 0}

/* Convite "Instale o Zás no celular" (PWA, ver install.js) */
.install-box { border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius); padding: .8rem; margin: .8rem 0; display: flex; flex-direction: column; gap: .6rem; }
.driver-main > .install-box { margin: 0 0 .8rem; }
.install-head { display: flex; gap: .7rem; align-items: center; }
.install-head img { border-radius: 10px; flex: none; }
.install-head b { display: block; }
.install-head span { display: block; font-size: .88rem; color: var(--muted); line-height: 1.35; }
.install-steps { margin: 0; padding-left: 1.3rem; font-size: .92rem; display: flex; flex-direction: column; gap: .3rem; }
.install-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.install-actions .btn { flex: 1 1 auto; }
