/* ============================================
   RUPPEL DRIVER v3 — Design system premium
   Preto profundo, superfícies suaves, tipografia display.
   ============================================ */

:root {
  --ink: #0b0b0c;
  --ink-2: #2b2b2e;
  --mute: #6f6f76;
  --line: #e8e8ec;
  --field: #f4f4f6;
  --paper: #ffffff;
  --ok: #05a357;
  --bad: #d0312d;
  --gold: #f5a623;
  --r: 16px;
  --font-display: 'Plus Jakarta Sans', 'Inter', sans-serif;
  --sh-card: 0 1px 2px rgba(11,11,12,.04), 0 8px 24px rgba(11,11,12,.06);
  --sh-float: 0 12px 34px rgba(11,11,12,.16);
  --sh-cta: 0 10px 24px rgba(11,11,12,.28);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
::selection { background: var(--ink); color: #fff; }
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-thumb { background: #d6d6dc; border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- Ícones ---------- */
.ico { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: -4px; }
.ico.p { width: 17px; height: 17px; vertical-align: -3px; }

/* ---------- Marca ---------- */
.logo {
  font-family: var(--font-display);
  font-weight: 800; letter-spacing: -0.04em; font-size: 20px;
  display: inline-flex; align-items: baseline; gap: 2px; white-space: nowrap;
}
.logo .dot { width: 7px; height: 7px; background: var(--ok); border-radius: 50%; display: inline-block; }
.logo small { font-family: 'Inter'; font-weight: 600; color: var(--mute); font-size: 11px; margin-left: 8px; letter-spacing: .12em; }

/* ---------- Topbar ---------- */
.topbar {
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  background: linear-gradient(180deg, #111113, var(--ink));
  color: #fff;
  position: sticky; top: 0; z-index: 900;
}
.topbar a { color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; opacity: .9; }

/* ---------- Botões ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; min-height: 54px;
  background: var(--ink); color: #fff;
  border: none; border-radius: 13px;
  font-weight: 700; font-size: 16px; cursor: pointer;
  box-shadow: var(--sh-cta);
  transition: transform .12s ease, box-shadow .12s ease, opacity .15s ease;
  text-decoration: none;
}
.btn:active { transform: scale(.975); box-shadow: 0 4px 12px rgba(11,11,12,.24); }
.btn:disabled { opacity: .35; cursor: default; box-shadow: none; }
.btn.ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.btn.ghost:active { background: var(--field); }
.btn.ok { background: var(--ok); box-shadow: 0 10px 24px rgba(5,163,87,.32); }
.btn.danger { background: #fff; color: var(--bad); border: 1.5px solid var(--line); box-shadow: none; }
.btn.mini { min-height: 44px; font-size: 14px; border-radius: 11px; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 2px; }

/* ---------- Campos ---------- */
.campo { margin-bottom: 14px; }
.campo label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; letter-spacing: 0; }
.campo input, .campo select, .campo textarea {
  width: 100%; min-height: 52px;
  background: var(--field);
  border: 1.5px solid transparent; border-radius: 12px;
  padding: 0 15px; font-size: 16px;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.campo textarea { padding: 13px 15px; min-height: 72px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus {
  border-color: var(--ink); background: #fff; outline: none;
  box-shadow: 0 4px 14px rgba(11,11,12,.08);
}

/* ---------- Cartões / texto ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--sh-card); }
.muted { color: var(--mute); font-size: 14px; }
.titulo { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em; }
.erro-box { background: #fdecec; color: var(--bad); border-radius: 12px; padding: 12px 15px; font-size: 14px; font-weight: 600; margin-bottom: 14px; display: none; }
.ok-box { background: #e7f6ee; color: #056e3c; border-radius: 12px; padding: 12px 15px; font-size: 14px; font-weight: 600; margin-bottom: 14px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 5px 11px; border-radius: 999px; background: var(--field); color: var(--ink-2); white-space: nowrap; letter-spacing: 0; }
.badge.ok { background: #e7f6ee; color: #056e3c; }
.badge.warn { background: #fff4e0; color: #8a5b00; }
.badge.bad { background: #fdecec; color: var(--bad); }
.badge.ink { background: var(--ink); color: #fff; }

/* ---------- Preço ---------- */
.preco {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-weight: 800; letter-spacing: -0.045em;
  font-size: 34px; line-height: 1;
}
.preco small { font-size: 15px; font-weight: 700; color: var(--mute); letter-spacing: 0; }

/* ---------- Segmento ---------- */
.seg { display: grid; gap: 7px; background: var(--field); padding: 6px; border-radius: 14px; }
.seg button {
  border: none; background: transparent; border-radius: 10px;
  min-height: 48px; font-weight: 700; font-size: 14px; color: var(--mute); cursor: pointer; padding: 6px 10px;
  display: flex; align-items: center; gap: 9px; text-align: left;
  transition: background .12s, color .12s;
}
.seg button.ativo { background: var(--ink); color: #fff; box-shadow: 0 4px 12px rgba(11,11,12,.22); }

/* ---------- Chips ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 999px;
  padding: 9px 14px; font-size: 13px; font-weight: 700; cursor: pointer;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 1px 2px rgba(11,11,12,.04);
  transition: background .12s, transform .1s;
}
.chip:active { background: var(--field); transform: scale(.97); }
.chip.escuro { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Categorias ---------- */
.cats { display: flex; gap: 9px; overflow-x: auto; padding: 2px 2px 6px; }
.cat {
  flex: 1 0 132px; text-align: left;
  background: #fff; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 12px 13px; cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .1s;
}
.cat:active { transform: scale(.98); }
.cat.ativo { border-color: var(--ink); background: var(--ink); color: #fff; box-shadow: 0 8px 20px rgba(11,11,12,.24); }
.cat b { display: block; font-size: 14px; font-family: var(--font-display); }
.cat span { font-size: 11.5px; color: var(--mute); display: block; margin-top: 1px; }
.cat.ativo span { color: #c9c9cf; }
.cat .cat-preco { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: inherit; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* ---------- Etapas da corrida ---------- */
.steps { display: flex; align-items: center; gap: 0; margin: 14px 2px 2px; }
.steps .st { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: 0 0 auto; }
.steps .st .b { width: 10px; height: 10px; border-radius: 50%; background: var(--line); transition: background .2s, box-shadow .2s; }
.steps .st span { font-size: 9.5px; font-weight: 700; color: var(--mute); letter-spacing: .04em; text-transform: uppercase; }
.steps .st.on .b { background: var(--ink); box-shadow: 0 0 0 4px rgba(11,11,12,.08); }
.steps .st.on span { color: var(--ink); }
.steps .st.done .b { background: var(--ok); }
.steps .tr { flex: 1; height: 2px; background: var(--line); margin: 0 4px 14px; border-radius: 2px; }
.steps .tr.done { background: var(--ok); }

/* ---------- Folha inferior ---------- */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 800;
  background: #fff; border-radius: 24px 24px 0 0;
  box-shadow: 0 -16px 48px rgba(11,11,12,.20);
  padding: 13px 18px calc(18px + env(safe-area-inset-bottom));
  max-height: 76vh; overflow-y: auto;
}
.sheet .alca { width: 40px; height: 4.5px; border-radius: 4px; background: #dcdce2; margin: 0 auto 12px; }

/* ---------- Modal / painéis ---------- */
.veu {
  position: fixed; inset: 0; z-index: 990;
  background: rgba(9,9,10,.5);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: none; align-items: flex-end; justify-content: center;
}
.veu.aberto { display: flex; }
.painel {
  background: #fff; width: 100%; max-width: 520px;
  border-radius: 24px 24px 0 0;
  padding: 15px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 86vh; overflow-y: auto;
  animation: sobe .22s cubic-bezier(.3,1.1,.4,1);
}
.painel .alca { width: 40px; height: 4.5px; border-radius: 4px; background: #dcdce2; margin: 0 auto 12px; }
@keyframes sobe { from { transform: translateY(28px); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------- Conteúdo com fade ---------- */
.fade { animation: surge .22s ease; }
@keyframes surge { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* ---------- Esqueleto de carregamento ---------- */
.skel { position: relative; overflow: hidden; background: var(--field); border-radius: 12px; }
.skel::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent);
  animation: brilha 1.1s infinite;
}
@keyframes brilha { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; font-weight: 700; font-size: 14px;
  padding: 13px 22px; border-radius: 999px; z-index: 1200;
  box-shadow: var(--sh-float);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: 90vw; text-align: center;
}
.toast.mostra { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Autocomplete ---------- */
.sug { position: relative; }
.sug-lista {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 950;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--sh-float); overflow: hidden; display: none;
}
.sug-lista div { padding: 12px 15px; font-size: 14px; cursor: pointer; border-bottom: 1px solid var(--field); }
.sug-lista div:last-child { border-bottom: none; }
.sug-lista div:hover, .sug-lista div:active { background: var(--field); }
.sug-lista b { display: block; font-size: 14px; }
.sug-lista span { color: var(--mute); font-size: 12px; }

/* ---------- Pulso ---------- */
.pulso { width: 78px; height: 78px; margin: 8px auto 14px; position: relative; }
.pulso::before, .pulso::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--ink); opacity: 0;
  animation: pulsar 1.8s ease-out infinite;
}
.pulso::after { animation-delay: .9s; }
.pulso .miolo {
  position: absolute; inset: 22px; border-radius: 50%; background: var(--ink);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
@keyframes pulsar {
  0% { transform: scale(.55); opacity: .9; }
  100% { transform: scale(1.28); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .pulso::before, .pulso::after { animation: none; opacity: .4; }
  .btn, .painel, .fade { transition: none; animation: none; }
}

/* ---------- Trajeto ---------- */
.trajeto { display: grid; grid-template-columns: 14px 1fr; gap: 8px 12px; align-items: center; }
.trajeto .p1 { width: 9px; height: 9px; background: var(--ink); border-radius: 50%; justify-self: center; }
.trajeto .p2 { width: 9px; height: 9px; background: var(--ink); justify-self: center; }
.trajeto .pm { width: 8px; height: 8px; background: #fff; border: 2.5px solid var(--ink); border-radius: 50%; justify-self: center; }
.trajeto .fio { width: 2px; height: 14px; background: var(--line); justify-self: center; }
.trajeto p { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Marcadores do mapa ---------- */
.mk-ponto { width: 15px; height: 15px; background: var(--ink); border: 3.5px solid #fff; border-radius: 50%; box-shadow: 0 2px 8px rgba(11,11,12,.45); }
.mk-quadro { width: 15px; height: 15px; background: var(--ink); border: 3.5px solid #fff; box-shadow: 0 2px 8px rgba(11,11,12,.45); }
.mk-meio { width: 12px; height: 12px; background: #fff; border: 3px solid var(--ink); border-radius: 50%; box-shadow: 0 2px 8px rgba(11,11,12,.35); }
.mk-car {
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; border: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(11,11,12,.35);
}
.mk-car svg { width: 21px; height: 21px; }

/* ---------- Estrelas ---------- */
.estrelas { display: flex; gap: 7px; justify-content: center; }
.estrelas button {
  border: none; background: transparent; cursor: pointer;
  font-size: 35px; line-height: 1; color: #dfdfe5; padding: 2px;
  transition: color .12s, transform .1s;
}
.estrelas button:active { transform: scale(1.15); }
.estrelas button.acesa { color: var(--gold); }
.nota { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 700; }
.nota::before { content: '★'; color: var(--gold); font-size: 13px; }

/* ---------- Listas ---------- */
.item-lista { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 2px; border-bottom: 1px solid var(--field); }
.item-lista:last-child { border-bottom: none; }
.item-lista .tit { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.item-lista .sub { font-size: 12px; color: var(--mute); }
.item-lista .seta { color: #c4c4cc; font-size: 18px; }

/* ---------- Tabelas ---------- */
.tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabela th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--mute); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tabela td { padding: 12px; border-bottom: 1px solid var(--field); vertical-align: middle; }
.tabela tr:last-child td { border-bottom: none; }

/* ---------- Interruptor ---------- */
.switch { position: relative; width: 54px; height: 31px; flex: none; }
.switch input { display: none; }
.switch .pista { position: absolute; inset: 0; background: #c8c8ce; border-radius: 999px; transition: background .18s; cursor: pointer; }
.switch .pista::after { content: ''; position: absolute; top: 3px; left: 3px; width: 25px; height: 25px; background: #fff; border-radius: 50%; box-shadow: 0 2px 5px rgba(11,11,12,.25); transition: left .18s; }
.switch input:checked + .pista { background: var(--ok); }
.switch input:checked + .pista::after { left: 26px; }

/* ---------- QR / Pix ---------- */
.qrbox { display: flex; justify-content: center; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh-card); }
.copia { background: var(--field); border-radius: 12px; padding: 12px 14px; font-family: ui-monospace, Menlo, monospace; font-size: 11px; word-break: break-all; color: var(--ink-2); max-height: 84px; overflow-y: auto; }

/* ---------- Utilidades ---------- */
.linha { display: flex; align-items: center; gap: 10px; }
.entre { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mt8 { margin-top: 8px; } .mt14 { margin-top: 14px; } .mt20 { margin-top: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.centro { text-align: center; }
.divisor { height: 1px; background: var(--line); margin: 16px 0; }
.statusTop { font-size: 11.5px; font-weight: 700; color: var(--mute); text-transform: uppercase; letter-spacing: .1em; }
.link-txt { background: none; border: none; color: var(--mute); font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.foto-motorista { width: 48px; height: 48px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 18px; flex: none; overflow: hidden; box-shadow: 0 3px 10px rgba(11,11,12,.2); }
.foto-motorista img { width: 100%; height: 100%; object-fit: cover; }
.placa { font-family: ui-monospace, Menlo, monospace; background: var(--field); border: 1px solid var(--line); border-radius: 7px; padding: 3px 9px; font-weight: 700; font-size: 13px; letter-spacing: .04em; }

/* ============================================
   v4 — Modo escuro, texto grande, chat, metas
   ============================================ */

html[data-fonte="g"] body { font-size: 18px; }

html[data-tema="escuro"] {
  --ink: #f2f2f4;
  --ink-2: #d6d6dc;
  --mute: #9a9aa3;
  --line: #26262b;
  --field: #1d1d22;
  --paper: #0f0f12;
  --sh-card: 0 1px 2px rgba(0,0,0,.5), 0 8px 22px rgba(0,0,0,.45);
  --sh-float: 0 12px 34px rgba(0,0,0,.6);
  --sh-cta: 0 10px 24px rgba(0,0,0,.55);
}
html[data-tema="escuro"] body { background: var(--paper); }
html[data-tema="escuro"] .card,
html[data-tema="escuro"] .sheet,
html[data-tema="escuro"] .painel,
html[data-tema="escuro"] .sug-lista,
html[data-tema="escuro"] .qrbox,
html[data-tema="escuro"] .chip { background: #17171b; }
html[data-tema="escuro"] .topbar { background: #0e0e11; border-bottom: 1px solid #1f1f24; }
html[data-tema="escuro"] .btn { color: #0b0b0c; }
html[data-tema="escuro"] .btn.ok { color: #fff; }
html[data-tema="escuro"] .btn.ghost { background: #1d1d22; color: var(--ink); }
html[data-tema="escuro"] .btn.danger { background: #1d1d22; color: #ff6b66; }
html[data-tema="escuro"] .seg button.ativo,
html[data-tema="escuro"] .cat.ativo,
html[data-tema="escuro"] .badge.ink,
html[data-tema="escuro"] .foto-motorista { color: #0b0b0c; }
html[data-tema="escuro"] .cat.ativo span { color: #55555c; }
html[data-tema="escuro"] .toast { background: #f2f2f4; color: #0b0b0c; }
html[data-tema="escuro"] .estrelas button { color: #33333a; }
html[data-tema="escuro"] .estrelas button.acesa { color: var(--gold); }
html[data-tema="escuro"] .mk-car { background: #17171b; border-color: #33333a; }
html[data-tema="escuro"] .mk-car svg { fill: #f2f2f4; }
html[data-tema="escuro"] .mk-ponto,
html[data-tema="escuro"] .mk-quadro { border-color: #17171b; }
html[data-tema="escuro"] .switch .pista { background: #3a3a42; }
html[data-tema="escuro"] .erro-box { background: #3a1413; color: #ff8a85; }
html[data-tema="escuro"] .ok-box { background: #0d2b1c; color: #4dd695; }
html[data-tema="escuro"] .badge.ok { background: #0d2b1c; color: #4dd695; }
html[data-tema="escuro"] .badge.warn { background: #33270e; color: #f0b74a; }
html[data-tema="escuro"] .badge.bad { background: #3a1413; color: #ff8a85; }
html[data-tema="escuro"] .placa { border-color: #33333a; }
html[data-tema="escuro"] .skel::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); }

/* ---------- Chat ---------- */
.chat-msgs { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; padding: 4px 2px; }
.balao { max-width: 82%; padding: 10px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.35; word-break: break-word; }
.balao.eu { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 5px; }
html[data-tema="escuro"] .balao.eu { color: #0b0b0c; }
.balao.outro { align-self: flex-start; background: var(--field); border-bottom-left-radius: 5px; }
.balao small { display: block; font-size: 10px; opacity: .55; margin-top: 3px; }
.chat-envio { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.chat-envio input { min-height: 50px; background: var(--field); border: 1.5px solid transparent; border-radius: 12px; padding: 0 14px; font-size: 15px; }
.chat-envio input:focus { border-color: var(--ink); outline: none; }
.chat-envio button { width: 52px; border-radius: 12px; }
.pos-rel { position: relative; }
.badge-num {
  position: absolute; top: -6px; right: -6px;
  background: var(--bad); color: #fff; font-size: 10px; font-weight: 800;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ---------- Barra de meta ---------- */
.meta-barra { height: 7px; background: rgba(255,255,255,.18); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.meta-barra i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .3s; }

/* ---------- Banner vivo (chegando / carro perto) ---------- */
.banner-vivo {
  position: fixed; top: calc(66px + env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 845;
  background: var(--ok); color: #fff; border-radius: 14px; padding: 13px 16px;
  font-weight: 700; font-size: 14px; box-shadow: var(--sh-float);
  display: none; align-items: center; gap: 10px;
}
.banner-vivo.mostra { display: flex; animation: surge .25s ease; }
