/* OLX no celular — mesmo tema escuro da dashboard da extensão */
:root {
  --bg: #080c14; --surface: #0d1220; --surface2: #111827; --border: #1e2d45;
  --accent: #00e5a0; --accent2: #0ea5e9; --red: #ef4444; --yellow: #f59e0b;
  --text: #e2e8f0; --muted: #7c8ba1;
  --topo: calc(52px + env(safe-area-inset-top));
  --abas: calc(60px + env(safe-area-inset-bottom));
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
/* Só a área #tela rola (entre o topo e as abas). Com a página inteira rolando,
   o iPhone às vezes deixava o menu de baixo "parado" no meio da tela. */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font: 15px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text); background: var(--bg);
}
#tela {
  position: fixed; top: var(--topo); bottom: var(--abas); left: 0; right: 0;
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 0 12px 16px;
}
a { color: var(--accent2); }
b { font-weight: 700; }

/* ── Topo e abas ── */
.topo {
  position: fixed; inset: 0 0 auto; z-index: 20;
  height: var(--topo); padding: env(safe-area-inset-top) 12px 0;
  display: flex; align-items: center; gap: 8px;
  background: rgba(13, 18, 32, .95); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topo h1 { flex: 1; font-size: 18px; font-weight: 800; letter-spacing: .2px; }
.topo-voltar { background: none; border: 0; color: var(--text); font-size: 30px; line-height: 1; padding: 0 6px 4px 0; }
.pill {
  display: flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface2); color: var(--muted); font-size: 12px; font-weight: 600;
}
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.ok { color: var(--accent); } .pill.ok i { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.pill.aviso { color: var(--yellow); } .pill.aviso i { background: var(--yellow); }
.pill.erro { color: var(--red); } .pill.erro i { background: var(--red); }
.abas {
  position: fixed; inset: auto 0 0; z-index: 20;
  height: var(--abas); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: rgba(13, 18, 32, .97); border-top: 1px solid var(--border);
}
.abas a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600;
}
.abas a { position: relative; }
.abas a span { font-size: 20px; }
.abas a i { position: absolute; top: 8px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--bg); }
.abas a.ativa { color: var(--accent); }

/* ── Blocos ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; margin-top: 12px; }
.pad { padding: 14px; }
.sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.sub.ok { color: var(--accent); }
.centro { text-align: center; }
.vazio { text-align: center; color: var(--muted); padding: 40px 12px; }
.secao { margin: 20px 2px 4px; font-weight: 800; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.det-titulo { font-size: 18px; font-weight: 800; }
.det-titulo.pequeno { font-size: 15px; }
.det-preco { font-size: 24px; font-weight: 800; color: var(--accent); margin: 4px 0 6px; }
.passos { margin: 10px 0 0 20px; color: var(--muted); }
.passos li { margin-bottom: 6px; }
.aviso { margin-top: 10px; padding: 10px; border-radius: 10px; font-size: 13px; }
.aviso.erro { background: rgba(239, 68, 68, .12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .3); }
.oculto { display: none; }
.desc { white-space: pre-wrap; color: var(--text); font-size: 14px; margin-top: 4px; }

/* ── Botões ── */
.acoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font: inherit; font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer;
}
.btn.prim { background: var(--accent); border-color: var(--accent); color: #062018; }
.btn.perigo { color: var(--red); border-color: rgba(239, 68, 68, .4); background: rgba(239, 68, 68, .08); }
.btn.grande { width: 100%; padding: 14px; font-size: 16px; margin-top: 8px; }
.btn.mini { padding: 5px 9px; font-size: 12px; margin: 6px 6px 0 0; }
.btn:disabled { opacity: .5; }

/* ── Filtros ── */
.filtros { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 10px 0 6px; margin: 0 -12px; padding-inline: 12px; }
.filtros input[type=search] {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font: inherit;
}
/* Dentro do anúncio o deslize horizontal é do app (voltar); o carrossel de
   fotos continua deslizando pro lado */
#tela.tela-anuncio { touch-action: pan-y; }
#tela.tela-anuncio .fotos { touch-action: pan-x pan-y; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
}
.chip.on { background: rgba(0, 229, 160, .14); border-color: var(--accent); color: var(--accent); }
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); padding-top: 4px; }

/* ── Lista de anúncios ── */
.lista { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.anuncio {
  display: flex; gap: 10px; padding: 8px; border-radius: 14px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border);
}
.anuncio .foto {
  flex: none; width: 104px; height: 104px; border-radius: 10px; overflow: hidden; background: var(--surface2);
  display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.anuncio .foto img { width: 100%; height: 100%; object-fit: cover; }
.anuncio .info { min-width: 0; flex: 1; }
.anuncio .t { font-weight: 700; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.anuncio .preco { color: var(--accent); font-weight: 800; font-size: 17px; margin-top: 2px; }
.anuncio .sub { font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selos { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.selo { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.selo.novo { background: var(--accent); border-color: var(--accent); color: #062018; }
.selo.vermelho { color: #fca5a5; border-color: rgba(239, 68, 68, .5); background: rgba(239, 68, 68, .1); }
.selo.amarelo { color: #fcd34d; border-color: rgba(245, 158, 11, .5); background: rgba(245, 158, 11, .1); }
.selo.verde { color: var(--accent); border-color: rgba(0, 229, 160, .4); background: rgba(0, 229, 160, .08); }
.selo.azul { color: #7dd3fc; border-color: rgba(14, 165, 233, .45); background: rgba(14, 165, 233, .08); }

/* ── Detalhe ── */
.fotos { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 12px -12px 0; padding: 0 12px; scrollbar-width: none; }
.fotos::-webkit-scrollbar { display: none; }
.fotos img, .fotos .sem-foto {
  flex: none; width: 86%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; scroll-snap-align: center;
  background: var(--surface2); display: flex; align-items: center; justify-content: center; font-size: 40px;
}
.fotos img { cursor: zoom-in; }
/* Fotos em tela cheia */
#galeria { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.gal-topo {
  display: flex; align-items: center; justify-content: space-between; padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  color: #fff; font-weight: 700; font-size: 15px;
}
.gal-x { background: rgba(255, 255, 255, .14); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 18px; }
.gal-trilho { flex: 1; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: env(safe-area-inset-bottom); }
/* O arrasto vertical é do app (fecha a foto): sem isso o iPhone assume o gesto
   como rolagem e cancela os eventos de toque — a foto não acompanhava o dedo. */
#galeria { touch-action: none; }
/* cada foto (.gal-slide tem overflow) conta como área de rolagem própria — a
   regra precisa estar nela e na imagem, não só no trilho */
.gal-trilho, .gal-slide, .gal-slide img { touch-action: pan-x; }
.gal-slide.zoom, .gal-slide.zoom img { touch-action: pan-x pan-y; }
.gal-trilho::-webkit-scrollbar { display: none; }
.gal-slide { flex: none; width: 100%; height: 100%; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gal-slide img { max-width: 100%; max-height: 100%; object-fit: contain; }
.gal-slide.zoom { overflow: auto; display: block; }
.gal-slide.zoom img { max-width: none; max-height: none; width: 250%; }
.compra .dica { margin-top: 12px; font-size: 12px; }
.status { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--border); font-weight: 600; }
.status > span { font-size: 20px; line-height: 1.2; }
.status.st-sucesso { border-color: var(--accent); color: var(--accent); }
.status.st-reservado, .status.st-forcando { border-color: rgba(245, 158, 11, .5); color: #fcd34d; }
.status.st-erro, .status.st-vendido, .status.st-cancelado { border-color: rgba(239, 68, 68, .5); color: #fca5a5; }
.reserva-box { margin-top: 10px; padding: 12px; border-radius: 12px; border: 1px dashed var(--accent); }
.reserva-box .conta, .reserva .conta { color: var(--accent2); font-weight: 700; font-size: 13px; margin: 2px 0 4px; }
/* Liga/desliga a compra automática do PC */
.auto-toggle { display: flex; align-items: center; gap: 12px; }
.auto-toggle .info { flex: 1; min-width: 0; }
.auto-toggle.on { border-color: rgba(0, 229, 160, .45); }
.auto-toggle.on b { color: var(--accent); }
.auto-toggle.off b { color: var(--muted); }
.auto-toggle .btn { flex: none; }
/* Compras automáticas em andamento (aba Reservas) */
.auto-compra { display: flex; align-items: flex-start; gap: 8px; text-decoration: none; color: inherit; }
.auto-compra .info { flex: 1; min-width: 0; }
.lixeira { flex: none; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, .4); background: rgba(239, 68, 68, .08); font-size: 17px; cursor: pointer; }
/* Aba 🔔 Avisos (histórico de notificações da dashboard) */
.notif { border-left: 3px solid var(--muted); }
.notif .rotulo { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 800; letter-spacing: .4px; }
.notif .rotulo span:last-child { color: var(--muted); font-weight: 600; white-space: nowrap; }
.notif .t { font-weight: 700; margin-top: 4px; overflow-wrap: anywhere; }
.notif .m { color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.notif.nova { background: var(--surface2); }
.decisao { display: flex; gap: 8px; }
/* Reservas → "Reservado por outra pessoa": pergunta Sim/Não do forçar compra */
.reservado-outro { border-color: rgba(245, 158, 11, .5); }
.reservado-outro .st { margin-top: 8px; font-weight: 700; color: #fcd34d; font-size: 14px; }
.reservado-outro .pergunta { margin-top: 10px; font-weight: 800; font-size: 15px; }
.reservado-outro .decisao .btn { flex: 1; margin-top: 8px; }
.reservado-outro .link-anuncio { display: inline-block; margin-top: 10px; color: var(--accent2); }
.decisao .btn { flex: 1; min-width: 0; margin-top: 8px; padding-inline: 8px; }
.auto-compra .st { margin-top: 8px; font-weight: 700; font-size: 14px; }
.auto-compra .st.andando { color: var(--accent); }
.auto-compra .st.parou { color: #fca5a5; }
.det-titulo .selo { vertical-align: middle; font-size: 11px; }
/* Card da aba Reservas: Copiar Pix · Ver anúncio · Cancelar numa linha só */
.reserva .acoes { flex-wrap: nowrap; gap: 6px; }
.reserva .acoes > * { flex: 1 1 0; min-width: 0; padding: 9px 6px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reserva .acoes > .sub { display: flex; align-items: center; justify-content: center; margin: 0; font-size: 12px; text-align: center; white-space: normal; }

/* ── Reservas e pedidos ── */
.cron { font-size: 26px; font-weight: 800; color: var(--accent); margin-top: 6px; font-variant-numeric: tabular-nums; }
.cron.expirado { color: var(--red); font-size: 18px; }
.topo-pedidos { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.topo-pedidos .sub { margin: 0; min-width: 0; }
.topo-pedidos .btn { margin: 0; flex: none; }
.pedido { display: flex; gap: 10px; }
.pedido img { flex: none; width: 64px; height: 64px; border-radius: 10px; object-fit: cover; }
.pedido .info { min-width: 0; flex: 1; }
.pedido { position: relative; }
.pedido .lixeira { order: 3; align-self: flex-start; }
.pedido .conta { color: var(--accent2); font-weight: 700; font-size: 13px; margin-top: 2px; }

/* ── Formulário ── */
.campo { display: block; margin-top: 12px; font-size: 13px; color: var(--muted); font-weight: 600; }
.campo input { display: block; width: 100%; margin-top: 6px; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font: inherit; }
details summary { cursor: pointer; font-weight: 600; }

/* ── Toast ── */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--abas) + 14px); transform: translate(-50%, 20px); z-index: 30;
  background: #1f2937; color: var(--text); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: .2s; max-width: 90vw; text-align: center; border: 1px solid var(--border);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }
/* Sem zoom na página (pinça nem dois toques) — evita ampliar sem querer no
   celular. O iPhone ignora o user-scalable=no do viewport; isto e o bloqueio
   dos eventos "gesture*" no app.js cobrem ele. Nas fotos em tela cheia o zoom
   é do próprio app (dois toques ou pinça, ver pincaNaFoto). */
html, body { touch-action: pan-x pan-y; }
