/* Moto Agora - estilos (mobile first) */
:root {
  --cor: #0f766e; --cor-escura: #115e59; --cor-clara: #ccfbf1;
  --destaque: #f59e0b; --perigo: #dc2626; --ok: #16a34a;
  --fundo: #f8fafc; --cartao: #fff; --texto: #0f172a; --muted: #64748b; --borda: #e2e8f0;
  --raio: 14px; --sombra: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .05);
}
@media (prefers-color-scheme: dark) {
  :root { --fundo: #0b1220; --cartao: #131c2e; --texto: #e2e8f0; --muted: #94a3b8; --borda: #23304a; --cor-clara: #134e4a; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px; line-height: 1.45;
  background: var(--fundo); color: var(--texto); padding-bottom: calc(70px + env(safe-area-inset-bottom));
}
a { color: var(--cor); }
h1 { font-size: 1.45rem; margin: .4em 0 .6em; }
h2 { font-size: 1.15rem; margin: 1.2em 0 .5em; }
h3 { margin: 0 0 .3em; }
img { max-width: 100%; }
.muted { color: var(--muted); font-size: .92em; }
.centro { text-align: center; }
.destaque { background: var(--cor-clara); padding: .5em .75em; border-radius: 10px; }
.rotulo { font-weight: 600; margin: .8em 0 .3em; }

/* Topo */
.topo {
  position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 1rem; padding-top: calc(.6rem + env(safe-area-inset-top)); background: var(--cor); color: #fff;
}
.marca { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: .5rem; }
.topo-acoes { display: flex; align-items: center; gap: .9rem; }
.sino { position: relative; text-decoration: none; font-size: 1.3rem; }
.badge { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 99px; background: var(--destaque); color: #000; font-size: .72rem; font-weight: 700; text-align: center; }
.sino .badge { position: absolute; top: -6px; right: -10px; }
.avatar-mini { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; vertical-align: middle; }

.conteudo { max-width: 760px; margin: 0 auto; padding: 1rem; }

/* Navegação inferior (celular) */
.nav-inferior {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; display: flex; justify-content: space-around;
  background: var(--cartao); border-top: 1px solid var(--borda); padding: .35rem 0 calc(.35rem + env(safe-area-inset-bottom));
}
.nav-inferior a { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--texto); font-size: 1.25rem; min-width: 64px; }
.nav-inferior span { font-size: .72rem; color: var(--muted); }

/* Cartões e listas */
.cartao { display: block; background: var(--cartao); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1rem; margin: 0 0 .8rem; box-shadow: var(--sombra); color: inherit; text-decoration: none; }
.lista { display: grid; gap: .1rem; }
.pedido .linha-topo { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .3rem; }
.pedido .linha-topo b, .valor-proposta { font-size: 1.25rem; color: var(--cor); }
.pedido p { margin: .25rem 0; }
.desc { font-weight: 600; }
.end { font-size: .95em; }
.tag { display: inline-block; padding: .15em .6em; border-radius: 99px; background: var(--cor-clara); color: var(--texto); font-size: .8rem; font-weight: 600; }
.st-aberto .tag, .tag.st-aberto { background: #fef3c7; color: #92400e; }
.st-fechado .tag, .tag.st-fechado, .st-coletado .tag, .tag.st-coletado { background: #dbeafe; color: #1e40af; }
.st-entregue .tag, .tag.st-entregue, .tag.st-u-aprovado { background: #dcfce7; color: #166534; }
.st-cancelado .tag, .tag.st-cancelado, .tag.st-u-bloqueado, .tag.st-u-rejeitado { background: #fee2e2; color: #991b1b; }
.tag.st-u-pendente { background: #fef3c7; color: #92400e; }
.grade-2, .grade-3 { display: grid; gap: .6rem; grid-template-columns: repeat(2, 1fr); }
.grade-3 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .grade-3 { grid-template-columns: repeat(3, 1fr); } }
.grade-2 .cartao, .grade-3 .cartao { margin: 0; padding: .7rem; }
.numero { font-size: 1.5rem; font-weight: 700; margin: .1rem 0; color: var(--cor); }
.grade-3 .muted, .grade-2 .muted { margin: 0; }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 0; border-radius: 12px;
  background: var(--cor); color: #fff; font: inherit; font-weight: 600; padding: .75rem 1.1rem; cursor: pointer; text-decoration: none; min-height: 46px;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; }
.btn-sec { background: var(--cartao); color: var(--cor); border: 2px solid var(--cor); }
.btn-perigo { background: var(--perigo); }
.btn-link { background: none; color: var(--cor); padding: .4rem 0; min-height: 0; text-decoration: underline; }
.btn-grande { width: 100%; padding: 1rem; font-size: 1.08rem; margin: .5rem 0; }
.btn-peq { padding: .45rem .8rem; min-height: 38px; font-size: .9rem; }
.botoes { display: grid; gap: .6rem; margin: 1rem 0; }

/* Formulários */
.form { display: grid; gap: .2rem; }
fieldset { border: 1px solid var(--borda); border-radius: var(--raio); padding: .8rem 1rem 1rem; margin: 0 0 1rem; background: var(--cartao); }
legend { font-weight: 700; padding: 0 .4rem; }
label { display: block; margin: .5rem 0; font-weight: 500; }
input:not([type=radio]):not([type=checkbox]):not([type=file]), select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .75rem .8rem; font: inherit; font-size: 16px; /* evita zoom no iPhone */
  border: 1px solid var(--borda); border-radius: 10px; background: var(--fundo); color: var(--texto);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cor); outline-offset: 1px; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; font-size: .95em; }
.check input { margin-top: .25rem; width: 20px; height: 20px; flex: none; }
.opcoes { display: flex; gap: .5rem; flex-wrap: wrap; }
.opcao { flex: 1; min-width: 100px; margin: 0; border: 2px solid var(--borda); border-radius: 12px; padding: .7rem; text-align: center; cursor: pointer; background: var(--cartao); }
.opcao:has(input:checked) { border-color: var(--cor); background: var(--cor-clara); }
.opcao input { margin-right: .3rem; }
.upload { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 110px; border: 2px dashed var(--borda); border-radius: var(--raio); padding: .8rem; cursor: pointer; text-align: center; background: var(--fundo); }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload img { max-height: 200px; border-radius: 10px; margin-top: .5rem; }
.upload.com-foto { border-style: solid; border-color: var(--cor); }
.form-inline { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .3rem 0; }
.form-inline input { flex: 1; min-width: 120px; margin-top: 0 !important; }
.busca { display: flex; gap: .4rem; align-items: stretch; }
.busca input { flex: 1; }
.busca .btn { margin-top: .3rem; }

/* Alertas */
.alerta { padding: .8rem 1rem; border-radius: 12px; margin: 0 0 1rem; border: 1px solid; text-decoration: none; color: inherit; }
.alerta ul { margin: 0; padding-left: 1.1rem; }
.alerta-ok { background: #dcfce7; border-color: #86efac; color: #14532d; }
.alerta-erro { background: #fee2e2; border-color: #fca5a5; color: #7f1d1d; }
.alerta-info { background: #e0f2fe; border-color: #7dd3fc; color: #0c4a6e; }
.bloco { display: block; }

/* Abas */
.abas { display: flex; gap: .3rem; margin: 0 0 1rem; border-bottom: 2px solid var(--borda); }
.abas a, .filtros a { padding: .6rem .9rem; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.abas a.ativa { color: var(--cor); border-color: var(--cor); }
.rolagem, .filtros { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.filtros { display: flex; gap: .3rem; margin-bottom: .8rem; }
.filtros a { border: 1px solid var(--borda); border-radius: 99px; padding: .35rem .8rem; font-size: .85rem; }
.filtros a.ativa { background: var(--cor); color: #fff; border-color: var(--cor); }

/* Mapa */
.mapa { height: 46vh; min-height: 260px; border-radius: var(--raio); margin: .4rem 0 .8rem; border: 1px solid var(--borda); z-index: 1; }
.icone-mapa { background: none; border: 0; line-height: 1; text-align: center; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.seletor-ponto { display: flex; gap: .5rem; }
.btn-ponto { flex: 1; padding: .7rem; border-radius: 12px; border: 2px solid var(--borda); background: var(--cartao); color: var(--texto); font: inherit; font-weight: 600; }
.btn-ponto.ativo { border-color: var(--cor); background: var(--cor-clara); }
.links-mapa { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Pedido */
.cab-pedido { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.etapas { display: flex; list-style: none; padding: 0; margin: 0 0 .5rem; counter-reset: e; }
.etapas li { flex: 1; text-align: center; font-size: .8rem; color: var(--muted); position: relative; padding-top: 1.7rem; }
.etapas li::before { counter-increment: e; content: counter(e); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--borda); line-height: 1.5rem; color: var(--texto); font-weight: 700; }
.etapas li.feito::before { content: "✓"; background: var(--ok); color: #fff; }
.etapas li.atual::before { background: var(--destaque); }
.etapas li.feito, .etapas li.atual { color: var(--texto); font-weight: 600; }
.acoes-pedido { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.acoes-pedido form { margin: 0; }
.acoes-pedido .form-inline, .acoes-pedido .f-proposta { flex: 1 1 220px; display: flex; gap: .4rem; }
.acoes-pedido .f-proposta input { margin-top: 0; min-width: 0; }
.proposta { display: grid; grid-template-columns: 56px 1fr; gap: .7rem; align-items: start; }
.proposta .acoes-pedido { grid-column: 1 / -1; }
.proposta .valor-proposta { margin: .2rem 0 0; font-weight: 700; }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--borda); }
.pessoa { display: flex; gap: .8rem; align-items: flex-start; flex-wrap: wrap; }
.pessoa p { margin: .3rem 0; }
.foto-veiculo { width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; }
.foto-entrega { width: 100%; border-radius: 10px; }
.placa { font-family: ui-monospace, monospace; background: var(--fundo); border: 1px solid var(--borda); padding: 0 .35em; border-radius: 4px; letter-spacing: .05em; }
.estrelas { color: var(--destaque); font-weight: 700; }

/* Chat */
.mensagens { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: .35rem; padding: .3rem 0; }
.msg { max-width: 82%; padding: .45rem .7rem; border-radius: 14px; word-wrap: break-word; }
.msg small { display: block; font-size: .7rem; opacity: .7; margin-top: .1rem; }
.msg.minha { align-self: flex-end; background: var(--cor); color: #fff; border-bottom-right-radius: 4px; }
.msg.dele { align-self: flex-start; background: var(--fundo); border: 1px solid var(--borda); border-bottom-left-radius: 4px; }

/* Avaliação */
.nota-estrelas { display: flex; flex-direction: row-reverse; justify-content: center; gap: .2rem; }
.nota-estrelas input { display: none; }
.nota-estrelas label { font-size: 2.4rem; color: var(--borda); cursor: pointer; margin: 0; }
.nota-estrelas input:checked ~ label, .nota-estrelas label:hover, .nota-estrelas label:hover ~ label { color: var(--destaque); }

/* Admin */
.fotos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.fotos figure { margin: 0; }
.fotos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.fotos figcaption { font-size: .8rem; text-align: center; color: var(--muted); }
.tabela-rolagem { overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; font-size: .9rem; background: var(--cartao); }
.tabela th, .tabela td { padding: .5rem; border-bottom: 1px solid var(--borda); text-align: left; vertical-align: top; }
.acoes-tabela form { margin: 0 0 .3rem; flex-wrap: nowrap; }
.acoes-tabela input { min-width: 90px; }
.citacao { border-left: 4px solid var(--destaque); padding-left: .7rem; }
.destaque-borda { border-color: var(--destaque); }
.notif.nao-lida { border-left: 4px solid var(--cor); }
.notif p { margin: .2rem 0; }
.paginacao { display: flex; justify-content: space-between; }

/* Página inicial */
.hero { text-align: center; padding: 1rem 0; }
.hero h1 { font-size: 1.7rem; }
@media (min-width: 640px) { .botoes { grid-template-columns: 1fr 1fr; } }
.passos { display: grid; gap: .6rem; margin: 1rem 0; }
@media (min-width: 640px) { .passos { grid-template-columns: repeat(3, 1fr); } }
.passos .num { display: inline-flex; width: 2rem; height: 2rem; border-radius: 50%; background: var(--cor); color: #fff; align-items: center; justify-content: center; font-weight: 700; }
.texto { line-height: 1.6; }

/* Bloqueio de GPS */
.gps-bloqueio { position: fixed; inset: 0; z-index: 5000; background: rgba(15, 23, 42, .85); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.gps-bloqueio[hidden] { display: none; }
.gps-bloqueio .cartao { max-width: 420px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(85px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); opacity: 0; transition: .25s; z-index: 6000;
  background: #0f172a; color: #fff; padding: .7rem 1rem; border-radius: 12px; max-width: 90vw; box-shadow: var(--sombra); pointer-events: none; }
.toast.visivel { opacity: 1; transform: translateX(-50%) translateY(0); }

.rodape { max-width: 760px; margin: 1rem auto; padding: 0 1rem; }
.aviso-legal { font-size: .8rem; color: var(--muted); border-top: 1px solid var(--borda); padding-top: .8rem; }
.raio select { display: inline-block; width: auto; margin-left: .3rem; }

/* Sugestões de endereço */
.sugestoes { list-style: none; margin: -.2rem 0 .6rem; padding: 0; background: var(--cartao); border: 1px solid var(--borda); border-radius: 10px; box-shadow: var(--sombra); max-height: 300px; overflow-y: auto; }
.sugestoes li { padding: .7rem .8rem; border-bottom: 1px solid var(--borda); cursor: pointer; font-weight: 400; }
.sugestoes li:last-child { border-bottom: 0; }
.sugestoes li:active, .sugestoes li:hover { background: var(--cor-clara); }
.sugestoes li small { display: block; color: var(--muted); font-size: .78rem; }
.sugestoes li.vazio { color: var(--muted); cursor: default; }
input.buscando { background-image: linear-gradient(90deg, transparent, var(--cor-clara), transparent); background-size: 200% 100%; animation: buscando 1s linear infinite; }
@keyframes buscando { from { background-position: 200% 0; } to { background-position: -200% 0; } }
/* Códigos de segurança */
.codigos { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.codigo-box { text-align: center; background: var(--cor-clara); border-radius: 12px; padding: .7rem; }
.codigo-box b { display: block; font-size: 2rem; letter-spacing: .3em; font-family: ui-monospace, monospace; }
.codigo-grande { text-align: center; font-size: 1.8rem !important; letter-spacing: .4em; font-family: ui-monospace, monospace; }
.stats { display: inline-flex; gap: .6rem; flex-wrap: wrap; font-size: .9em; }
.stats span { background: var(--fundo); border: 1px solid var(--borda); border-radius: 99px; padding: .1em .6em; }
.codigo-box small { display: block; font-size: .75rem; color: var(--muted); }
