:root {
  --bg: #0f1115;
  --surface: #1a1d24;
  --surface-2: #232733;
  --border: #2c3140;
  --text: #f2f3f5;
  --muted: #9aa3b2;
  --accent: #ff5c8a;
  --accent-2: #7c5cff;
  --green: #2ecc71;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  overscroll-behavior-y: contain;
}

body { padding-bottom: 84px; }

button { font-family: inherit; cursor: pointer; }

/* Cabeçalho */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
  padding: 16px 16px 8px;
}
.app-header h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.app-header .subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Busca */
.search-row { display: flex; align-items: center; gap: 8px; margin: 8px 16px 0; }
.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
}
.search input {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  width: 100%;
  outline: none;
}

/* Botão de filtros */
.filter-btn {
  position: relative;
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.filter-btn svg { display: block; }
.filter-btn.on { border-color: var(--accent); background: rgba(124,92,255,0.12); }
.filter-btn .badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px;
  border-radius: 999px; text-align: center;
}

/* Chips de categoria — rolagem horizontal */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Chips de filtros ativos (abaixo da busca) */
.active-filters { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px 0; }
.achip {
  border: 1px solid var(--accent);
  background: rgba(124,92,255,0.12);
  color: var(--text);
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
}
.achip.clear { border-color: var(--border); background: transparent; color: var(--muted); }

/* Chips dentro do painel de filtros */
.fchips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.fchip {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  padding: 8px 14px; border-radius: 999px; font-size: 14px;
}
.fchip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Faixa de preço no painel de filtros */
.price-range { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.price-range input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14px;
}
.price-range input:focus { outline: none; border-color: var(--accent); }
.price-range-sep { color: var(--muted); }

main { padding: 8px 16px 16px; }

/* Lista de produtos */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.load-more {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 18px 0 6px;
}
.load-more .count { font-size: 13px; color: var(--muted); }
.load-more .btn { width: auto; min-width: 200px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}
.card .thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--surface-2);
  display: block;
}
.card .thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}
.card .info { padding: 10px 12px 12px; }
.card .name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.card .brand { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card .price { margin-top: 8px; font-size: 15px; font-weight: 700; color: var(--green); }
.card .price small { color: var(--muted); font-weight: 400; font-size: 11px; display: block; }
.card .price.none { color: var(--muted); font-weight: 500; font-size: 13px; }
.card .uso { margin-top: 6px; font-size: 11px; color: var(--muted); line-height: 1.3; }
.card .badges {
  position: absolute; top: 8px; right: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.card .fav, .card .inlist {
  background: rgba(0,0,0,0.45); border: 0; border-radius: 999px;
  width: 34px; height: 34px; font-size: 17px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.card .inlist { font-size: 15px; opacity: 0.55; }
.card .inlist.on { opacity: 1; background: var(--accent); }

.empty { text-align: center; color: var(--muted); padding: 48px 24px; }
.empty .big { font-size: 48px; margin-bottom: 8px; }

/* Botão de configurações (topo direito, fixo sobre o conteúdo).
   Ícone direto, sem painel/borda — parte da interface, não um chip à parte. */
.settings-btn {
  position: fixed; z-index: 24;
  top: calc(14px + env(safe-area-inset-top)); right: 14px;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1;
  background: none; border: 0; color: var(--text);
}
.settings-btn:active { opacity: 0.55; }

/* Navegação inferior */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex; align-items: center; justify-content: space-around;
  background: rgba(20, 22, 28, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 8px 4px env(safe-area-inset-bottom);
}
.tabbar button[data-tab] {
  background: none; border: 0; color: var(--muted);
  font-size: 10.5px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 4px; flex: 1; min-width: 0;
}
.tabbar button[data-tab] .ic { font-size: 20px; }
.tabbar button[data-tab].active { color: var(--accent); }

/* Botão de câmera central, elevado (ação principal: escanear produto) */
.scan-btn {
  flex: 0 0 auto;
  width: 62px; height: 62px; margin: -22px 6px 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 4px solid var(--bg); color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px rgba(124, 92, 255, 0.5);
}
.scan-btn:active { transform: scale(0.94); }
.scan-btn svg { display: block; }

/* ===== Scanner ao vivo (câmera + moldura) ===== */
.scanner-layer { background: #000; }
.scanner-layer .page-head {
  position: absolute; left: 0; right: 0; top: 0;
  background: transparent; border: 0; z-index: 3;
}
/* Sobre a câmera ao vivo: ícone branco com sombra pra manter legibilidade sem painel. */
.scanner-layer .page-back { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,0.7); }
.scanner-layer .page-body { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

.scan-view { position: relative; flex: 1; min-height: 0; background: #000; overflow: hidden; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* moldura: cantos em L sobre um vão central */
.scan-frame {
  position: absolute; left: 10%; right: 10%; top: 22%; bottom: 22%;
  pointer-events: none;
}
.scan-frame span {
  position: absolute; width: 34px; height: 34px;
  border: 3px solid rgba(255,255,255,0.92); border-radius: 4px;
}
.scan-frame span:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.scan-frame span:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.scan-frame span:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.scan-frame span:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.scan-hint {
  position: absolute; left: 0; right: 0; bottom: 16px; text-align: center;
  color: rgba(255,255,255,0.9); font-size: 14px; padding: 0 24px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}
.scan-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  color: var(--muted); text-align: center; padding: 32px; font-size: 14px; line-height: 1.5;
}
.scan-fallback .big { font-size: 46px; }
/* estado "lendo a foto" sobre o vídeo congelado */
.scan-busy {
  position: absolute; inset: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 15px;
}
.scan-spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.25); border-top-color: #fff;
  animation: scan-spin 0.8s linear infinite;
}
@keyframes scan-spin { to { transform: rotate(360deg); } }

.scan-controls {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-around;
  padding: 18px 24px calc(22px + env(safe-area-inset-bottom));
  background: #000;
}
.scan-side {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: rgba(255,255,255,0.12); border: 0; color: #fff;
}
.scan-side:active { background: rgba(255,255,255,0.22); }
.scan-shutter {
  width: 72px; height: 72px; border-radius: 50%;
  background: #fff; border: 4px solid rgba(255,255,255,0.4);
  background-clip: padding-box;
}
.scan-shutter:active { transform: scale(0.94); }
.scan-shutter:disabled { opacity: 0.5; }

/* Lojas */
.list-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.list-item .t { font-weight: 600; }
.list-item .s { color: var(--muted); font-size: 13px; margin-top: 2px; }
.icon-btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 8px 10px; font-size: 14px; }

/* Modal / folha inferior */
.sheet-bg {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,0);
  display: flex; align-items: flex-end;
  transition: background 0.28s ease;
}
.sheet-bg.show { background: rgba(0,0,0,0.55); }
.sheet-bg.closing { background: rgba(0,0,0,0); }
/* folha que não está no topo da pilha não escurece (evita backdrops somados) */
.sheet-bg.under.show { background: rgba(0,0,0,0); }

/* ===== Páginas empurradas (navegação na hierarquia) ===== */
/* Opacas, deslizam da direita, ‹ voltar + swipe da borda — sem arrastar-pra-baixo. */
.page-layer {
  position: fixed; inset: 0;
  background: var(--bg);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.page-layer.show { transform: translateX(0); }
.page-layer.closing { transform: translateX(100%); }
.page { display: flex; flex-direction: column; height: 100%; }
.page-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.page-back {
  width: 38px; height: 38px; flex-shrink: 0;
  background: none; border: 0;
  color: var(--text); font-size: 26px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.page-back:active { opacity: 0.55; }
.page-title {
  font-size: 17px; font-weight: 700; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.page-body {
  flex: 1; overflow-y: auto;
  padding: 14px 16px calc(28px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}
.sheet {
  background: var(--surface); width: 100%;
  border-radius: 20px 20px 0 0;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow-y: auto;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.4);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.sheet-bg.show .sheet { transform: translateY(0); }
.sheet-bg.closing .sheet { transform: translateY(100%); }

/* Cabeçalho fixo da folha: [espaçador | alça centralizada | botão fechar] */
.sheet-head {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 10px;
  margin: 0 -16px 6px;
  cursor: grab;
  touch-action: none;
}
.sheet-head:active { cursor: grabbing; }
/* zonas laterais de largura igual: mantêm a alça centralizada ao lado do ✕ */
.sh-side { flex: 1 1 0; display: flex; align-items: center; min-width: 0; }
.sh-left { justify-content: flex-start; }
.sh-right { justify-content: flex-end; }
.sheet .grabber { flex: 0 0 auto; width: 44px; height: 5px; background: var(--border); border-radius: 999px; }
/* Fechar: ícone direto, sem painel/borda — integrado ao cabeçalho da folha. */
.sheet-close {
  width: 34px; height: 34px;
  background: none; border: 0; color: var(--muted); font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.sheet-close:active { opacity: 0.55; }
.sheet h2 { margin: 4px 0 16px; font-size: 19px; }

label.field, div.field { display: block; margin-bottom: 14px; }
label.field > span, div.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 12px; padding: 12px 14px; font-size: 15px; outline: none;
}
textarea.input { resize: vertical; min-height: 64px; }
/* campo que abre um seletor (marca): parece input, comporta-se como botão */
.select-like {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  text-align: left; cursor: pointer; font: inherit;
}
.select-like .ph { color: var(--muted); }
.select-like .chev { color: var(--muted); flex: 0 0 auto; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* Captura de foto */
.photo-pick {
  width: 100%; aspect-ratio: 4 / 3; border-radius: 14px;
  border: 1.5px dashed var(--border); background: var(--surface-2);
  overflow: hidden; margin-bottom: 14px;
}
.photo-inner {
  position: relative;
  width: 100%; height: 100%;
  display: flex; align-items: stretch;
}
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.photo-change {
  position: absolute; bottom: 10px; right: 10px;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border: 0; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: #fff;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(2px);
}
.photo-change:active { background: rgba(0,0,0,0.78); }
.photo-opt {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: var(--muted); background: none; border: 0; cursor: pointer; font-size: 14px;
}
.photo-opt:active { background: rgba(255,255,255,0.05); }
.photo-opt .ic { font-size: 32px; }
.photo-divider { width: 1px; background: var(--border); margin: 20px 0; flex-shrink: 0; }

.btn {
  width: 100%; border: 0; border-radius: 12px; padding: 14px;
  font-size: 16px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.btn.secondary { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: #3a1f28; border: 1px solid #6b2740; color: #ff90ab; }
.btn-ghost { background: none; border: 0; color: var(--accent); font-size: 15px; padding: 6px; }

.ai-fill { margin-bottom: 8px; }
.ai-fill:disabled { opacity: .5; }
.ai-hint { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 16px; cursor: pointer; }
.ai-hint:active { color: var(--text); }

/* Detalhe do produto */
.detail-hero { width: 100%; aspect-ratio: 1/1; max-height: 320px; object-fit: cover;
  border-radius: var(--radius); background: var(--surface-2); }
.detail-hero.placeholder { display: flex; align-items: center; justify-content: center; font-size: 64px; }
.detail h2 { margin: 14px 0 2px; }
.detail .brand { color: var(--muted); }
.detail .tag { display: inline-block; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--muted); font-size: 12px; padding: 4px 10px; border-radius: 999px; margin: 8px 8px 0 0; }

.price-table { margin-top: 16px; }
.price-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
}
.price-row.best { border-color: var(--green); background: rgba(46, 204, 113, 0.08); }
.price-row .store { font-weight: 600; }
.price-row .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.price-row .val { font-weight: 700; font-size: 16px; }
.price-row .best-tag { color: var(--green); font-size: 11px; font-weight: 700; }

.section-title { font-size: 14px; color: var(--muted); margin: 22px 0 10px; text-transform: uppercase; letter-spacing: 0.5px; }

.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 12px 18px; border-radius: 999px; z-index: 60; font-size: 14px;
  box-shadow: var(--shadow); opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

.muted-note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.muted { color: var(--muted); }

/* ---------- Listas de desejos ---------- */
.list-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
}
.list-card .lc-main { flex: 1; min-width: 0; }
.list-card .lc-name { font-weight: 600; }
.list-card .lc-meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.list-card .lc-total { font-weight: 700; font-size: 15px; white-space: nowrap; }

/* Linha de item dentro da lista */
.li-list { margin-top: 6px; }
.li-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.li-thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; }
.li-thumb.placeholder { display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); font-size: 22px; }
.li-info { flex: 1; min-width: 0; }
.li-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-price { font-size: 13px; margin-top: 2px; }
.li-qty { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.qbtn {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font-size: 17px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.qval { min-width: 20px; text-align: center; font-weight: 600; }
.li-del { background: none; border: 0; font-size: 16px; flex: 0 0 auto; padding: 4px; }
.li-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; padding-top: 12px; border-top: 2px solid var(--border);
}
.li-total span { color: var(--muted); }
.li-total strong { font-size: 20px; }

/* Seletor de produtos */
.pick-list { max-height: 50vh; overflow-y: auto; }
.pick-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px; border-radius: 12px; border: 1px solid transparent;
}
.pick-row.on { border-color: var(--accent); background: rgba(124,92,255,0.10); }
.pick-check {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border); font-weight: 700;
}
.pick-row.on .pick-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.pick-row.create .li-name { color: var(--accent); font-weight: 600; }
.pick-row[data-create] .pick-check { color: var(--accent); }

/* ---------- Lojas: toggle Lista/Mapa + mapa ---------- */
.seg {
  display: flex; gap: 4px; margin: 8px 16px 0;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 4px;
}
.seg-btn {
  flex: 1; background: none; border: 0; color: var(--muted);
  padding: 9px 0; border-radius: 9px; font-size: 14px; font-weight: 600;
}
.seg-btn.on { background: var(--accent); color: #fff; }

.store-map {
  height: 62vh; min-height: 320px; width: 100%;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2);
}
.map-hint { color: var(--muted); font-size: 13px; margin-top: 10px; line-height: 1.5; }
.map-fail { display: flex; align-items: center; justify-content: center; text-align: center;
  height: 100%; padding: 24px; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* Editor de localização: o mapa é o herói, controles flutuam por cima.
   Padrão "pino fixo" — o pino mora no centro e o usuário move o mapa. */
.pick-wrap {
  position: relative; width: 100%; margin-top: 4px;
  height: 46vh; min-height: 340px; max-height: 520px;
  border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2);
}
.pick-map { position: absolute; inset: 0; width: 100%; height: 100%; }

/* seletor fullscreen: o mapa é o herói (ocupa a página), a barra de confirmar
   fica embaixo. Sem cantos/borda — o mapa vaza até as bordas da tela. */
.page-body.picker-body { padding: 0; display: flex; flex-direction: column; }
.pick-wrap.full {
  flex: 1; min-height: 0; height: auto; max-height: none;
  margin: 0; border: 0; border-radius: 0;
}
.pick-confirmbar {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 10px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.pick-readout-line {
  color: var(--muted); font-size: 13px; font-weight: 600; min-height: 18px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pick-readout-line.on { color: var(--green); }
.pick-confirmbar .btn { margin: 0; }

/* campo de localização no form: resume o ponto e abre o seletor ao tocar */
.loc-field {
  display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 4px;
  padding: 13px 14px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; color: var(--muted);
  font-family: inherit; font-size: 14px; text-align: left;
}
.loc-field:active { background: var(--surface); }
.loc-field.on { color: var(--green); }
.loc-field .loc-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc-field .loc-chev { flex: 0 0 auto; opacity: 0.55; font-size: 18px; }

/* barra de região (aba Mapa): escolhe o enquadramento das lojas */
.region-bar { display: flex; align-items: center; margin: 10px 0; }
.region-select {
  flex: 1; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; font-family: inherit; font-size: 14px;
}

/* pino centralizado: a ponta fica exatamente no centro do mapa */
.pick-pin {
  position: absolute; left: 50%; top: 50%; z-index: 500;
  transform: translate(-50%, -100%); pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.4));
  transition: transform 0.18s cubic-bezier(.2,.8,.3,1);
}
.pick-pin-shadow {
  position: absolute; left: 50%; top: 50%; z-index: 499;
  width: 14px; height: 6px; margin: -3px 0 0 -7px;
  background: rgba(0,0,0,0.35); border-radius: 50%;
  pointer-events: none; transition: all 0.18s cubic-bezier(.2,.8,.3,1);
}
.pick-wrap.dragging .pick-pin { transform: translate(-50%, -100%) translateY(-10px); }
.pick-wrap.dragging .pick-pin-shadow { width: 18px; opacity: 0.55; transform: scale(1.1); }

/* controles flutuantes */
.map-overlay { position: absolute; z-index: 600; display: flex; gap: 8px; }
.map-overlay.top-left { top: 10px; left: 10px; right: 56px; }
.map-overlay.top-right { top: 10px; right: 10px; flex-direction: column; gap: 1px; }

/* caixa de busca dentro do mapa (autocomplete estilo Google Maps) */
.map-search {
  position: relative; display: flex; align-items: center; gap: 6px;
  width: 100%; height: 42px; padding: 0 6px 0 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
}
.map-search .ic { flex: 0 0 auto; font-size: 14px; opacity: 0.8; }
.map-search-input {
  flex: 1; min-width: 0; height: 100%;
  background: none; border: 0; outline: none;
  color: var(--text); font-family: inherit; font-size: 14px;
}
.map-search-input::placeholder { color: var(--muted); }
.map-search-clear {
  flex: 0 0 auto; display: none; background: none; border: 0;
  color: var(--muted); font-size: 13px; padding: 8px;
}
.map-search.has-text .map-search-clear { display: block; }
.map-suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  max-height: 240px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
}
.map-suggest button {
  display: flex; gap: 9px; align-items: flex-start; width: 100%;
  padding: 11px 12px; background: none; border: 0;
  border-bottom: 1px solid var(--border); text-align: left;
  color: var(--text); font-family: inherit;
}
.map-suggest button:last-child { border-bottom: 0; }
.map-suggest button:active { background: var(--surface-2); }
.map-suggest .pin { flex: 0 0 auto; opacity: 0.7; font-size: 13px; margin-top: 1px; }
.map-suggest .lbl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.map-suggest .ttl { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.map-suggest .sub {
  color: var(--muted); font-size: 12px; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.map-fab {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.map-fab.gps {
  position: absolute; z-index: 600; right: 10px; bottom: 48px;
  width: 46px; height: 46px; border-radius: 50%; font-size: 20px;
}
.map-fab.gps:active { background: var(--surface-2); }
.map-fab.sm { width: 36px; height: 36px; font-size: 20px; font-weight: 600; line-height: 1; }
.map-overlay.zoom .map-fab.sm:first-child { border-radius: 10px 10px 0 0; }
.map-overlay.zoom .map-fab.sm:last-child { border-radius: 0 0 10px 10px; border-top: 0; }
.map-fab.sm:active { background: var(--surface-2); }

.li-actions { display: flex; gap: 8px; align-items: center; }
.list-item .s.loc { color: var(--green); }
.list-item .s.noloc { color: var(--muted); opacity: 0.7; }

/* Leaflet dentro do tema escuro: garante que os controles fiquem legíveis */
/* Isola o stacking context de TODO mapa Leaflet: seus panes/controles internos
   (z-index até ~1000) ficam contidos no container e não vazam por cima da tabbar,
   da FAB central nem dos botões flutuantes do seletor. */
.leaflet-container { font: inherit; isolation: isolate; }
.leaflet-popup-content { font-size: 13px; line-height: 1.5; }
.leaflet-popup-content a { color: var(--accent); font-weight: 600; text-decoration: none; }
