:root,
html[data-theme="dark"] {
  --bg: #0f1115;
  --panel: #1a1d24;
  --panel-2: #21252e;
  --accent: #ff6b35;
  --accent-2: #ffa14a;
  --text: #f2f4f8;
  --muted: #9aa3b2;
  --border: #2c313c;
  --ok: #34c759;
}

html[data-theme="light"] {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #eef1f6;
  --accent: #ff6b35;
  --accent-2: #f08a2e;
  --text: #1a1d24;
  --muted: #687385;
  --border: #d9dee7;
  --ok: #2ba84a;
}

* { box-sizing: border-box; }

body { transition: background .25s, color .25s; }

/* ── Botão flutuante de tema (todas as telas) ── */
.theme-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1500;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .3);
  transition: transform .15s, border-color .15s, background .25s;
}
.theme-toggle-btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.theme-toggle-btn:active { transform: translateY(0); }
.theme-toggle-btn .tt-icon { font-size: 15px; line-height: 1; }

@media (max-width: 600px) {
  .theme-toggle-btn { padding: 10px; border-radius: 50%; }
  .theme-toggle-btn .tt-label { display: none; }
}

/* ── Ajustes de tema claro para cores fixas ── */
html[data-theme="light"] .topbar { background: linear-gradient(90deg, #ffffff, #f4f6fa); }
html[data-theme="light"] .vehicle-card.selected,
html[data-theme="light"] .open-order-card.selected { background: #fff3ec; }
html[data-theme="light"] .route-cta { background: linear-gradient(135deg, #fff3ec, #ffe8d6); border-color: #ff9f0a; }
html[data-theme="light"] .time-estimate { background: var(--panel-2); }
html[data-theme="light"] .est-alert { background: #fdecec; border-color: #f3b4b4; color: #c0392b; }
html[data-theme="light"] .audio-error { background: #fdecec; border-color: #f3b4b4; color: #c0392b; }
html[data-theme="light"] .audio-dropzone:hover,
html[data-theme="light"] .audio-dropzone.dragover { background: #fff3ec; }
html[data-theme="light"] .btn-accent { background: #e7f7ec; }
html[data-theme="light"] .btn-accent:hover { background: #d8f0df; }
html[data-theme="light"] .badge-ok { background: #e3f7ea; }
html[data-theme="light"] .badge-busy { background: #fff2d6; color: #b87400; }
html[data-theme="light"] .dip-queue { background: #fff6e0; color: #b87400; }
html[data-theme="light"] .btn-whatsapp { background: #e7f9ee; }
html[data-theme="light"] .btn-whatsapp:hover { background: #d6f3e2; }
html[data-theme="light"] .audio-drop-hint { color: var(--muted); }
html[data-theme="light"] .marker-dot,
html[data-theme="light"] .driver-avatar { border-color: #fff; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 24px;
  background: linear-gradient(90deg, #14161c, #1a1d24);
  border-bottom: 1px solid var(--border);
}
.brand { font-size: 22px; font-weight: 800; letter-spacing: .3px; }
.brand-sub { color: var(--muted); font-size: 14px; }

/* ── Layout ── */
.layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: calc(100vh - 57px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

/* ── Indicador de etapas ── */
.step-bar {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  flex-shrink: 0;
}
.step-item {
  display: flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  padding: 0;
  cursor: pointer;
  transition: color .15s;
}
.step-item:hover { color: var(--text); }
.step-item.active { color: var(--text); font-weight: 600; }
.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.step-item.active .step-num { background: var(--accent); color: #fff; }
.step-item.done .step-num  { background: var(--ok); color: #fff; }
.step-connector { flex: 1; height: 1px; background: var(--border); }

/* ── Painéis das etapas ── */
.panel {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.panel.hidden { display: none; }
.panel h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin: 22px 0 10px;
}
.panel h2:first-child { margin-top: 0; }
.panel2-title { font-size: 14px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 0 0 12px; }

/* ── Campos genéricos ── */
.field {
  width: 100%;
  padding: 11px 12px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
}

/* ── Veículos ── */
.vehicle-list { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.vehicle-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--panel-2);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, transform .05s;
}
.vehicle-card:hover { border-color: var(--accent-2); }
.vehicle-card:active { transform: scale(.99); }
.vehicle-card.selected { border-color: var(--accent); background: #2a1f1a; }
.vehicle-emoji { font-size: 30px; }
.vehicle-info { flex: 1; }
.vehicle-name { font-weight: 700; font-size: 16px; }
.vehicle-desc { color: var(--muted); font-size: 13px; }
.vehicle-rate { color: var(--accent-2); font-size: 13px; font-weight: 600; }

/* ── Textos auxiliares ── */
.hint { color: var(--muted); font-size: 13px; line-height: 1.4; }
.hint.hidden { display: none; }

/* ── CTA do circuito no painel ── */
.route-cta {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #2a1c10, #1f1710);
  border: 1px solid var(--accent);
  border-radius: 10px;
  margin-bottom: 10px;
}
.route-cta.hidden { display: none; }
.route-cta-icon { font-size: 22px; flex-shrink: 0; }
.route-cta strong { font-size: 14px; display: block; margin-bottom: 3px; }
.route-cta-sub { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* ── Overlay flutuante sobre o mapa ── */
.map-cta {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  background: var(--accent);
  color: #fff;
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(255,107,53,.45);
  animation: pulse-cta 2.2s ease-in-out infinite;
}
.map-cta.hidden { display: none; }
@keyframes pulse-cta {
  0%, 100% { transform: translateX(-50%) scale(1);    opacity: 1; }
  50%       { transform: translateX(-50%) scale(1.04); opacity: .85; }
}

/* ── Botões do circuito ── */
.route-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
}
.btn-secondary:hover { color: var(--text); border-color: var(--muted); }
.btn-block { width: 100%; margin-top: 8px; }

/* ── Card de Audiência da Rota — compacto ── */
.audience-card {
  margin: 12px 0;
  background: linear-gradient(135deg, rgba(52,199,89,.07) 0%, rgba(10,132,255,.05) 100%);
  border: 1px solid rgba(52,199,89,.28);
  border-radius: 14px;
  padding: 12px 14px;
  animation: audPop .3s cubic-bezier(.34,1.56,.64,1);
}
.audience-card.hidden { display: none; }

@keyframes audPop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.aud-loading { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; padding: 4px 0; }
.aud-pulse { width: 8px; height: 8px; border-radius: 50%; background: #34c759; animation: audPulse 1.2s infinite; flex-shrink: 0; }
@keyframes audPulse { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:.35; transform:scale(.6); } }

/* Linha topo: label + badge de confiança */
.aud-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.aud-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.aud-conf { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.conf-alta { background: rgba(52,199,89,.15); color: #34c759; }
.conf-est  { background: rgba(255,159,10,.15); color: #ff9f0a; }

/* Número hero */
.aud-numero {
  font-size: 34px; font-weight: 800; color: #34c759;
  line-height: 1.1; margin: 2px 0 4px;
  display: flex; align-items: baseline; gap: 5px;
}
.aud-unidade { font-size: 14px; font-weight: 600; color: var(--muted); }

/* Zona detectada */
.aud-zona {
  font-size: 11px; font-weight: 600; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 10px; display: inline-flex; gap: 5px;
  margin-bottom: 10px;
}

/* 3 células compactas */
.aud-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.aud-g3-item {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 8px; text-align: center;
}
.aud-g3-val { font-size: 12px; font-weight: 700; color: var(--text); }
.aud-g3-lbl { font-size: 10px; color: var(--muted); margin-top: 1px; }

/* Barra de ocupação */
.aud-barra-wrap { height: 4px; background: var(--panel-2); border-radius: 2px; overflow: hidden; margin-bottom: 8px; }
.aud-barra-fill { height: 100%; background: linear-gradient(90deg, #34c759, #0a84ff); border-radius: 2px; transition: width .5s ease; }

/* Tags de fonte */
.aud-fontes { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.aud-tag { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; }
.aud-tag-ibge   { background: rgba(255,159,10,.12); color: #ff9f0a; }
.aud-tag-google { background: rgba(10,132,255,.12);  color: #0a84ff; }
.aud-tag-meta   { background: rgba(24,119,242,.12);  color: #1877f2; }
.aud-tag-metasim{ background: rgba(24,119,242,.07);  color: #1877f2; opacity: .8; }
.aud-tag-off    { background: var(--panel-2); color: var(--muted); }
.aud-tag-osm    { background: rgba(126,87,194,.14); color: #9b6dd6; }
.aud-tag-nota   { font-size: 9px; color: var(--muted); }
.aud-tag-nota a { color: var(--accent); }
.aud-metodo     { font-size: 10px; color: var(--accent); margin-left: auto; text-decoration: underline; }

/* ── Aceite de Termos no pedido ── */
.terms-accept-box {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.terms-accept-label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}
.terms-accept-label input[type="checkbox"] {
  width: 18px; height: 18px; flex-shrink: 0;
  margin-top: 1px; accent-color: var(--accent); cursor: pointer;
}
.terms-accept-label a { color: var(--accent); text-decoration: underline; }
.terms-accept-label strong { color: var(--text); }

.btn-accent {
  background: #1e2a1a;
  color: var(--ok);
  border: 1px solid var(--ok);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.btn-accent:hover { background: #263320; }
.btn-accent.hidden { display: none; }

#close-circuit:not(.hidden) {
  animation: pulse-fechar 1.4s ease-in-out infinite;
}
@keyframes pulse-fechar {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, .55); transform: scale(1); }
  50%       { box-shadow: 0 0 0 7px rgba(52, 199, 89, 0);  transform: scale(1.04); }
}

.btn-primary {
  width: 100%;
  margin-top: 14px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #1a1207;
  font-weight: 800;
  font-size: 16px;
  border: none;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }

/* ── Horário e duração ── */
.time-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.time-group label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}

/* ── Estimativa de tempo ── */
.time-estimate {
  margin-top: 16px;
  padding: 12px 14px;
  background: #161b22;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
}
.time-estimate.hidden { display: none; }
.est-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px dashed var(--border);
  color: var(--muted);
}
.est-row:last-of-type { border-bottom: none; }
.est-row span:last-child { color: var(--text); font-weight: 600; }
.est-ok  { color: var(--ok) !important; }
.est-warn { color: #ff453a !important; }
.est-alert {
  margin-top: 10px;
  padding: 10px;
  background: #2a1515;
  border: 1px solid #ff453a55;
  border-radius: 8px;
  color: #ff6b6b;
  font-size: 12px;
  line-height: 1.5;
}

/* ── Resumo do pedido ── */
.summary {
  margin-top: 24px;
  padding: 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.summary.hidden { display: none; }
.summary-lines { list-style: none; padding: 0; margin: 0 0 14px; }
.summary-lines li {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}
.summary-lines li span:first-child { color: var(--muted); }
.price-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
}
.price-box strong { font-size: 24px; color: var(--ok); }

/* ── Marcadores numerados no mapa ── */
.marker-dot {
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
}
.marker-start {
  background: var(--ok);
  width: 32px;
  height: 32px;
  font-size: 14px;
}

/* ── Mapa ── */
.map-wrap { position: relative; }
#map { width: 100%; height: 100%; }

/* ══════════════════════════════════════
   ETAPA 2 — Motoristas
══════════════════════════════════════ */

/* Tab bar */
.driver-tab-bar {
  display: flex;
  gap: 4px;
  background: var(--panel-2);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.driver-tab {
  flex: 1;
  padding: 8px 6px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.driver-tab.active { background: var(--panel); color: var(--text); }

/* Carrossel */
.carousel-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.carousel-viewport {
  flex: 1;
  overflow: hidden;
  border-radius: 16px;
}
.carousel-track {
  display: flex;
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
}
.carousel-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .15s;
}
.carousel-btn:disabled { opacity: .3; cursor: not-allowed; }
.carousel-btn:not(:disabled):hover { border-color: var(--accent); }

/* Dots */
.carousel-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 10px 0 12px;
}
.carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  border: none;
  cursor: pointer;
  transition: width .2s, background .2s;
}
.carousel-dot.active { width: 18px; background: var(--accent); }

/* ── Card do motorista ── */
.driver-card {
  flex-shrink: 0;
  width: 100%;            /* ocupa toda a largura do viewport */
  border-radius: 16px;
  overflow: visible;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .2s;
}
.driver-card.selected { border-color: var(--accent); }
.driver-card.driver-busy { opacity: .7; cursor: default; }

/* 65% superior: fundo gradiente + emoji do veículo */
.driver-card__vehicle {
  height: 165px;
  border-radius: 14px 14px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.dc-vehicle-emoji {
  font-size: 72px;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,.6));
  line-height: 1;
}
.dc-vehicle-foto {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 35% inferior: info com avatar sobreposto */
.driver-card__info {
  background: var(--panel-2);
  border-radius: 0 0 14px 14px;
  padding: 32px 14px 14px;
  text-align: center;
  position: relative;
}
.driver-avatar {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--panel);
  border: 3px solid var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.driver-avatar--foto { object-fit: cover; }
.driver-name  { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.driver-stars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin-bottom: 5px;
  font-size: 13px;
}
.driver-nota  { color: var(--muted); font-size: 12px; }
.driver-nota small { opacity: .7; }
.star.full  { color: #ffd700; }
.star.half  { color: #ffd70099; }
.star.empty { color: var(--muted); }
.driver-price { font-size: 15px; font-weight: 700; color: var(--accent-2); margin-bottom: 4px; }
.driver-price span { font-size: 12px; font-weight: 400; color: var(--muted); }
.driver-status { font-size: 11px; }
.status-ok   { color: var(--ok); }
.status-busy { color: #ff9f0a; }

.no-drivers {
  width: 100%;
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: var(--panel-2);
  border-radius: 14px;
}

/* ── Pedido aberto ── */
.open-order-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 20px;
  text-align: center;
  margin-bottom: 12px;
}
.open-order-icon  { font-size: 44px; margin-bottom: 10px; }
.open-order-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.open-order-desc  { color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 16px; }
.open-order-meta  { font-size: 13px; color: var(--muted); }
.open-order-meta strong { color: var(--text); }

/* ── Badge "média" no card de veículo ── */
.avg-badge {
  display: inline-block;
  font-size: 9px;
  background: var(--border);
  color: var(--muted);
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .4px;
  vertical-align: middle;
  margin-right: 3px;
}

/* ── Overlay "Na fila" no card ocupado ── */
.dc-busy-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #ff9f0acc;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}
.driver-card__vehicle { position: relative; }

/* ── Pedido Aberto selecionado ── */
.open-order-card {
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.open-order-card.selected {
  border-color: var(--accent);
  background: #2a1f1a;
}

/* ── Painel de info do motorista ── */
.driver-info-panel {
  margin-top: 10px;
  padding: 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
}
.driver-info-panel.hidden { display: none; }
.dip-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.dip-avatar {
  font-size: 28px;
  width: 44px;
  height: 44px;
  background: var(--panel);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dip-avatar--foto { object-fit: cover; }
.dip-meta { flex: 1; }
.dip-name { font-weight: 700; font-size: 14px; }
.dip-price { font-weight: 700; color: var(--accent-2); font-size: 14px; flex-shrink: 0; }

.badge-ok   { display: inline-block; font-size: 11px; color: var(--ok);    background: #0d2d18; padding: 2px 7px; border-radius: 20px; margin-top: 2px; }
.badge-busy { display: inline-block; font-size: 11px; color: #ff9f0a; background: #2d1f00; padding: 2px 7px; border-radius: 20px; margin-top: 2px; }

.dip-queue {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #2d2200;
  border: 1px solid #ff9f0a44;
  border-radius: 8px;
  color: #ff9f0a;
  font-size: 12px;
  margin-bottom: 10px;
}
.dip-queue-icon { font-size: 16px; }

.btn-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  background: #0d3d1e;
  color: #25d366;
  border: 1px solid #25d36644;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s;
}
.btn-whatsapp:hover { background: #143d22; }

/* ── Upload de áudio ── */
.audio-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.audio-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0 0 10px;
}
.audio-dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.audio-dropzone:hover,
.audio-dropzone.dragover {
  border-color: var(--accent);
  background: #1f1814;
}
.audio-drop-icon { font-size: 28px; margin-bottom: 6px; }
.audio-drop-text { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.audio-drop-hint { font-size: 11px; color: var(--border); }

.audio-error {
  margin-top: 10px;
  padding: 10px 12px;
  background: #2a1515;
  border: 1px solid #ff453a55;
  border-radius: 8px;
  color: #ff6b6b;
  font-size: 12px;
  line-height: 1.5;
}
.audio-error.hidden { display: none; }
.audio-dropzone.hidden { display: none; }
.audio-compress-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--ok);
  display: flex;
  align-items: center;
  gap: 6px;
}
.audio-compress-note.hidden { display: none; }

.audio-preview { margin-top: 2px; }
.audio-preview.hidden { display: none; }
.audio-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.audio-icon { font-size: 22px; }
.audio-file-meta { flex: 1; min-width: 0; }
.audio-fname { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-fsize { font-size: 11px; color: var(--muted); }
.audio-remove {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
}
.audio-remove:hover { color: #ff453a; border-color: #ff453a; }

/* ── Busca de cidade ── */
.city-search-wrap { position: relative; }
.city-search-row { display: flex; gap: 8px; }
.city-search-input { flex: 1; }
.city-detect-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s;
}
.city-detect-btn:hover { border-color: var(--accent); }
.city-detect-btn:disabled { opacity: .5; cursor: not-allowed; }

.city-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  z-index: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.city-dropdown.hidden { display: none; }
.city-result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background .12s;
}
.city-result-item:last-child { border-bottom: none; }
.city-result-item:hover { background: var(--panel-2); }
.city-result-loading { padding: 10px 14px; color: var(--muted); font-size: 13px; }

.city-detected-badge { margin-top: 7px; font-size: 12px; line-height: 1.5; }
.city-detected-badge.hidden { display: none; }
.city-detecting { color: var(--muted); }
.city-detected-ok { color: var(--ok); }
.city-detected-err { color: #ff453a; }
.city-badge-change {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

/* ── Identificação do cliente ── */
.client-type-toggle {
  display: flex;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  margin-bottom: 12px;
}
.ctt-btn {
  flex: 1;
  padding: 8px 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.ctt-btn.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.client-fields { display: flex; flex-direction: column; gap: 8px; }
.client-fields.hidden { display: none; }
.client-field-group {
  position: relative;
}
.client-field-group label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.client-field-group input.invalid {
  border-color: #ff453a !important;
  background-color: rgba(255, 69, 58, 0.08);
}
.client-field-group .invalid-hint {
  display: none;
  font-size: 11px;
  color: #ff453a;
  margin-top: 3px;
}
.client-field-group input.invalid ~ .invalid-hint {
  display: block;
}

/* ── Responsivo ── */
/* ══════════════════════════════════════════════════════════
   RESPONSIVIDADE — Celular · Tablet · Paisagem
══════════════════════════════════════════════════════════ */

/* ── Controles sobrepostos no mapa (mobile) ── */
.map-mobile-controls {
  position: absolute;
  bottom: 58px;  /* fica acima do map-cta (que tem ~40px de altura) */
  left: 50%; transform: translateX(-50%);
  z-index: 600;  /* acima do map-cta (z-index: 500) */
  display: flex; gap: 8px;
}
.map-ctrl-btn {
  padding: 11px 18px;
  border-radius: 24px;
  border: none;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  transition: transform .15s;
}
.map-ctrl-btn:active { transform: scale(.96); }
.map-ctrl-limpar  { background: var(--panel); color: var(--text); border: 1px solid var(--border); }
.map-ctrl-fechar  { background: var(--accent); color: #1a1207; }

@media (min-width: 768px) {
  .map-mobile-controls { display: none !important; }
}

/* ── Abas mobile (Configurar / Mapa) — só aparece em mobile ── */
.mobile-tab-bar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: var(--panel);
  border-top: 1px solid var(--border);
  height: 56px;
}
.mobile-tab {
  flex: 1; border: none; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 700;
  cursor: pointer; transition: color .15s;
}
.mobile-tab.active { color: var(--accent); border-top: 2px solid var(--accent); }

/* ── Tablet: 768–1023px ── */
@media (min-width: 768px) and (max-width: 1023px) {
  .layout { grid-template-columns: 320px 1fr; }
  .sidebar { font-size: 14px; }
  h2 { font-size: 14px; }
}

/* ── Celular + paisagem estreita: ≤ 767px ── */
@media (max-width: 767px) {
  /* Topbar */
  .topbar { padding: 10px 16px; }
  .brand { font-size: 18px; }
  .brand-sub { display: none; }

  /* Layout: abas separadas em vez de coluna */
  .layout {
    display: block;
    height: auto;
    padding-bottom: 56px; /* espaço para .mobile-tab-bar */
  }
  .sidebar {
    border-right: none;
    border-bottom: none;
    max-height: none;
    overflow: visible;
    display: none; /* escondido até aba "form" estar ativa */
  }
  .sidebar.mobile-visible { display: flex; }
  .map-wrap { height: calc(100vh - 56px - 113px); display: none; position: relative; }
  .map-wrap.mobile-visible { display: block; }
  #map { height: 100%; min-height: 300px; }

  /* Aba mobile visível */
  .mobile-tab-bar { display: flex; }

  /* Step bar */
  .step-bar { padding: 10px 12px; gap: 6px; }
  .step-num { width: 26px; height: 26px; font-size: 12px; }
  .step-label { font-size: 11px; }

  /* Panel */
  .panel { padding: 14px 14px 20px; }
  h2 { font-size: 13px; margin: 14px 0 8px; }

  /* Vehicle grid: 1 coluna */
  .vehicle-list { grid-template-columns: 1fr 1fr; gap: 8px; }

  /* Campos */
  .time-fields { grid-template-columns: 1fr 1fr; gap: 8px; }
  .field { font-size: 15px; padding: 11px 12px; }

  /* Client tipo */
  .ctt-btn { font-size: 13px; padding: 8px 12px; }

  /* Summary */
  .summary { padding: 12px; }
  .price-box { padding: 10px 14px; }

  /* Botão tema: sobe acima da nav mobile */
  .theme-toggle-btn { bottom: 68px; }

  /* CTA do mapa: topo e menor no mobile */
  .map-cta {
    bottom: auto !important;
    top: 10px;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 20px;
    animation: none;
  }

  /* Resumo driver (panel 2) */
  .driver-info-panel { font-size: 13px; }
  .audio-section { padding: 10px 0; }
}

/* ── Celular retrato pequeno: ≤ 480px ── */
@media (max-width: 480px) {
  .vehicle-list { grid-template-columns: 1fr; }
  .client-field-group { margin-bottom: 10px; }
  .price-box strong { font-size: 20px; }
  .step-label { display: none; } /* só o número */
}

/* ── Paisagem celular: altura pequena ── */
@media (max-width: 812px) and (orientation: landscape) {
  .layout { display: grid; grid-template-columns: 300px 1fr; padding-bottom: 0; }
  .sidebar { display: flex !important; overflow-y: auto; max-height: calc(100vh - 57px); }
  .map-wrap { display: block !important; height: calc(100vh - 57px); }
  .mobile-tab-bar { display: none; }
  .theme-toggle-btn { bottom: 20px; }
}

/* ── Etapa 3: Acompanhar pedido (panel-3) ── */
.track-loading.hidden,
#track-content.hidden,
.track-waiting.hidden,
.track-driver.hidden,
.track-cancelado.hidden,
.track-finalizado.hidden,
#track-progress-wrap.hidden,
.confirm-state.hidden,
#rating-form.hidden,
#chamado-form.hidden,
.rating-overlay.hidden { display: none; }

.track-loading { text-align: center; padding: 40px 0; color: var(--muted); }

.track-waiting { text-align: center; padding: 30px 10px; }
.track-pulse-dot {
  width: 18px; height: 18px; border-radius: 50%; background: var(--accent);
  margin: 0 auto 16px; animation: audPulse 1.2s infinite;
}
.track-waiting h2 { margin: 0 0 8px; font-size: 18px; }

.track-driver-card {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; text-align: center; margin-bottom: 16px;
}
.track-driver-title { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.track-driver-name { font-size: 18px; font-weight: 700; margin-bottom: 12px; }

.metric-bar-label { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.metric-bar-track { height: 10px; background: var(--panel-2); border-radius: 5px; overflow: hidden; margin-bottom: 8px; }
.metric-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 5px; transition: width .5s ease; }
.metric-bar-nums { display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; color: var(--muted); }

.track-cancelado, .track-finalizado { text-align: center; padding: 30px 10px; }
.track-summary { margin-top: 16px; }

.rating-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px;
}
.rating-box {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 24px; max-width: 380px; width: 100%; text-align: center;
}
.rating-box h2 { margin: 0 0 16px; font-size: 18px; }
.rating-box .driver-stars { justify-content: center; font-size: 32px; gap: 8px; margin-bottom: 16px; cursor: pointer; }
.rating-box .star { cursor: pointer; transition: color .15s; }
.rating-box #rating-comentario { width: 100%; min-height: 70px; margin-bottom: 12px; resize: vertical; }
.rating-box .btn-primary, .rating-box .btn-secondary { width: 100%; margin-bottom: 8px; }

.btn-ajuda {
  display: block; width: 100%; margin-top: 16px; padding: 10px;
  background: transparent; border: 1px dashed var(--border); border-radius: 10px;
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-ajuda:hover { color: var(--text); border-color: var(--muted); }

/* ── Estado de confirmação (chamado enviado / avaliação enviada) ── */
.confirm-state { text-align: center; padding: 6px 0; }
.confirm-icon {
  width: 56px; height: 56px; border-radius: 50%; background: rgba(52,199,89,.15);
  color: #34c759; font-size: 28px; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; animation: confirmPop .35s ease;
}
.confirm-state h2 { margin: 0 0 6px; font-size: 17px; }
.confirm-state .hint { margin: 0; }
@keyframes confirmPop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── Pix na tela de acompanhamento do cliente ── */
.pix-cobranca {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 6px; padding: 14px 4px 4px; margin-top: 14px; border-top: 1px solid var(--border);
}
.pix-valor { font-size: 26px; font-weight: 800; color: var(--text); }
.pix-qr-canvas { border-radius: 12px; background: #fff; padding: 10px; max-width: 100%; }
.pix-copia-row { display: flex; gap: 8px; width: 100%; margin-top: 10px; }
.pix-copia-row input { flex: 1; font-size: 11px; font-family: monospace; }
.btn-config-salvar-valor {
  padding: 9px 14px; background: var(--accent); border: none; border-radius: 10px;
  color: #1a1207; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn-config-salvar-valor:hover { filter: brightness(1.08); }

#track-pix-wrap.hidden { display: none; }
#btn-cancelar-pedido { margin-top: 18px; }

/* ── Áudio: animação de carregando/compactando ── */
.audio-carregando.hidden { display: none; }
.audio-carregando {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 26px 12px; background: var(--panel-2); border: 1px dashed var(--border);
  border-radius: 10px;
}
.audio-spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: audioSpin .8s linear infinite;
}
@keyframes audioSpin { to { transform: rotate(360deg); } }
.audio-carregando-texto { font-size: 13px; color: var(--muted); margin: 0; }

/* ─── Acompanhamento ao vivo (com atraso, por segurança do motorista) ─── */
.track-ao-vivo {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: rgba(52,199,89,.08); border: 1px solid rgba(52,199,89,.3);
  border-radius: 10px; padding: 10px 12px; margin: 12px 0;
  font-size: 12px; line-height: 1.45; color: var(--text);
}
.track-ao-vivo.hidden { display: none; }
.track-ao-vivo span { flex: 1; min-width: 180px; }
.track-ao-vivo-mapa {
  display: none; border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 700; cursor: pointer;
}
@media (max-width: 767px) { .track-ao-vivo-mapa { display: inline-block; } }
.track-carro {
  width: 36px; height: 36px; border-radius: 50%; background: #fff; border: 3px solid #34c759;
  display: flex; align-items: center; justify-content: center; font-size: 19px;
  box-shadow: 0 0 0 6px rgba(52,199,89,.25), 0 2px 8px rgba(0,0,0,.4);
}

/* Cidade sem licença (o GiroSom ainda não atende) */
.cidade-fora-aviso {
  margin-top: 8px; padding: 10px 12px; border-radius: 10px; font-size: 12px; line-height: 1.5;
  background: rgba(255,159,10,.10); border: 1px solid rgba(255,159,10,.4); color: var(--text);
}
.cidade-fora-aviso.hidden { display: none; }
.cidade-fora-aviso a { color: var(--accent); font-weight: 700; }

.vehicle-rate-sub { font-size: 11px; opacity: .7; font-weight: 500; }
