/* Sistema de design — base da loja e do painel.
   A cor da marca (--marca), a tinta (--tinta) e a fonte de título (--fonte-titulo) vêm dos ajustes de cada restaurante.
   Padrão: Mestre dos Lanches (brasa #FF5A1F, carvão #141110, Alfa Slab One + Figtree). */
:root {
  --marca: #ff5a1f; --marca-texto: #141110; --marca-escura: color-mix(in srgb, var(--marca) 78%, #000);
  --tinta: #141110; --tinta-2: #5c554f; --tinta-3: #8a827b;
  --fundo: #ffffff; --superficie: #f6f4f1; --superficie-2: #efece8; --linha: #e6e1db; --linha-forte: #cdc6be;
  --ok: #2f7d4a; --ok-suave: #e7f3eb; --alerta: #a35a00; --alerta-suave: #fff3df; --erro: #c0262d; --erro-suave: #fdecec;
  --destaque: #ffc23d;
  --marca-suave: color-mix(in srgb, var(--marca) 12%, #fff);
  --fonte-titulo: "Alfa Slab One", Georgia, serif;
  --fonte: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --r-1: 8px; --r-2: 12px; --r-3: 18px;
  --sombra-dura: 3px 3px 0 var(--tinta);
  --sombra: 0 1px 2px rgba(20,17,16,.06), 0 6px 20px rgba(20,17,16,.07);
  --foco: 0 0 0 3px var(--fundo), 0 0 0 5px var(--tinta);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fundo); color: var(--tinta); font: 16px/1.5 var(--fonte); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--foco); border-radius: var(--r-1); }
.titulo-marca { font-family: var(--fonte-titulo); font-weight: 400; letter-spacing: .01em; }
.mudo { color: var(--tinta-2); } .pequeno { font-size: .875rem; } .forte { font-weight: 700; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ícones */
.ic { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; }
.ic svg { width: 100%; height: 100%; }

/* botões */
.bt { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .6rem 1.1rem; border-radius: var(--r-2);
  border: 2px solid var(--tinta); background: var(--fundo); color: var(--tinta); font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none;
  transition: transform .12s, box-shadow .12s, background .12s; white-space: nowrap; }
.bt:hover { background: var(--superficie); }
.bt:active { transform: translate(1px, 1px); }
.bt:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.bt.primario { background: var(--marca); color: var(--marca-texto); box-shadow: var(--sombra-dura); }
.bt.primario:hover { background: var(--marca); filter: brightness(1.05); }
.bt.primario:active { box-shadow: 1px 1px 0 var(--tinta); transform: translate(2px, 2px); }
.bt.leve { border-color: var(--linha-forte); }
.bt.leve:hover { border-color: var(--tinta); background: var(--fundo); }
.bt.texto { border-color: transparent; background: none; padding-left: .6rem; padding-right: .6rem; }
.bt.texto:hover { background: var(--superficie); }
.bt.perigo { border-color: color-mix(in srgb, var(--erro) 45%, #fff); color: var(--erro); }
.bt.perigo:hover { background: var(--erro-suave); }
.bt.pequeno { min-height: 36px; padding: .35rem .8rem; font-size: .875rem; border-radius: var(--r-1); }
.bt.icone { width: 44px; padding: 0; }
.bt.icone.pequeno { width: 36px; }
.bt.cheio { width: 100%; }
.bt .carregando { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: gira .7s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

/* campos */
.campo { display: grid; gap: .35rem; align-content: start; }   /* ao lado de um campo com ajuda, não estica */
.campo > label, .rotulo { font-size: .875rem; font-weight: 700; color: var(--tinta); }
.campo .ajuda { font-size: .8rem; color: var(--tinta-2); }
.campo .erro-campo { font-size: .82rem; color: var(--erro); font-weight: 600; }
.campo .erro-campo:empty { display: none; }
.entrada, select.entrada, textarea.entrada { width: 100%; min-height: 46px; padding: .65rem .85rem; border: 1.5px solid var(--linha-forte); border-radius: var(--r-2); background: var(--fundo);
  transition: border-color .12s, box-shadow .12s; }
.entrada::placeholder { color: var(--tinta-3); }
.entrada:hover { border-color: var(--tinta-2); }
.entrada:focus { outline: none; border-color: var(--tinta); box-shadow: 0 0 0 3px var(--marca-suave); }
.campo.com-erro .entrada { border-color: var(--erro); background: var(--erro-suave); }
textarea.entrada { min-height: 92px; resize: vertical; line-height: 1.45; }
select.entrada { appearance: none; padding-right: 2.4rem; cursor: pointer;
  background: var(--fundo) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%23141110' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 5 4 4 4-4'/%3E%3C/svg%3E") no-repeat right .9rem center; }
.dinheiro { position: relative; }
.dinheiro .entrada { padding-left: 2.6rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.dinheiro::before { content: 'R$'; position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--tinta-2); font-weight: 600; font-size: .95rem; pointer-events: none; }
.contador { font-size: .75rem; color: var(--tinta-3); justify-self: end; margin-top: -.15rem; }
.grade-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 520px) { .grade-2 { grid-template-columns: 1fr; } }

/* interruptor (liga/desliga) */
.chave { display: inline-flex; align-items: center; gap: .65rem; cursor: pointer; user-select: none; font-weight: 600; font-size: .92rem; }
.chave input { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 99px; background: var(--linha-forte); position: relative; margin: 0; cursor: pointer; flex: none; transition: background .15s; }
.chave input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.chave input:checked { background: var(--ok); }
.chave input:checked::after { transform: translateX(18px); }
.chave input:focus-visible { box-shadow: var(--foco); }

/* caixas de marcar e escolher */
.marca-caixa { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; flex: none; margin: 0; border: 2px solid var(--linha-forte); border-radius: 6px; background: var(--fundo); display: grid; place-items: center; cursor: pointer; }
.marca-caixa[type=radio] { border-radius: 50%; }
.marca-caixa:checked { background: var(--tinta); border-color: var(--tinta); }
.marca-caixa[type=checkbox]:checked::after { content: ''; width: 5px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.marca-caixa[type=radio]:checked::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.marca-caixa:disabled { opacity: .35; cursor: not-allowed; }

/* selos e etiquetas */
.selo { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 700; background: var(--superficie-2); color: var(--tinta-2); white-space: nowrap; }
.selo.ok { background: var(--ok-suave); color: var(--ok); }
.selo.alerta { background: var(--alerta-suave); color: var(--alerta); }
.selo.erro { background: var(--erro-suave); color: var(--erro); }
.selo.marca { background: var(--destaque); color: var(--tinta); }

/* avisos */
.aviso { display: flex; gap: .65rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--r-2); background: var(--alerta-suave); color: #5b3500; font-size: .92rem; }
.aviso.info { background: var(--superficie); color: var(--tinta); }
.aviso.erro { background: var(--erro-suave); color: #7a1418; }
.aviso .ic { width: 18px; height: 18px; margin-top: 1px; }

/* janela (modal) e confirmação */
.veu { position: fixed; inset: 0; z-index: 60; background: rgba(20,17,16,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 1rem 2rem; overflow-y: auto; animation: aparece .15s ease; }
.janela { width: 100%; max-width: 560px; background: var(--fundo); border-radius: var(--r-3); border: 2px solid var(--tinta); box-shadow: 6px 6px 0 var(--tinta); animation: sobe .2s ease; }
.janela.larga { max-width: 760px; }
.janela > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--linha); }
.janela > header h2 { font-size: 1.2rem; font-weight: 800; }
.janela > .corpo { padding: 1.25rem; display: grid; gap: 1.1rem; }
.janela > footer { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem 1.25rem; border-top: 1px solid var(--linha); flex-wrap: wrap; }
.janela > footer .esquerda { margin-right: auto; }
@media (max-width: 600px) {
  .veu { padding: 0; align-items: flex-end; }
  .janela { max-height: 94vh; overflow-y: auto; border-radius: var(--r-3) var(--r-3) 0 0; box-shadow: none; border-bottom: 0; }
  .janela > footer { position: sticky; bottom: 0; background: var(--fundo); }
}

/* aviso flutuante */
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 90; display: flex; gap: .6rem; align-items: center; padding: .75rem 1.1rem; border-radius: var(--r-2);
  background: var(--tinta); color: #fff; font-weight: 600; box-shadow: var(--sombra); max-width: calc(100vw - 2rem); animation: sobeMeio .2s ease; }
@keyframes sobeMeio { from { opacity: 0; transform: translate(-50%, 10px); } }
.toast.erro { background: var(--erro); }
.toast .ic { width: 18px; height: 18px; }

@keyframes aparece { from { opacity: 0; } }
@keyframes sobe { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- mapa (pino fixo no centro, o cliente arrasta o mapa) ---------- */
.mapa { position: relative; height: 280px; border: 2px solid var(--tinta); border-radius: 14px; overflow: hidden; background: #e9e5df; touch-action: none; cursor: grab; user-select: none; }
.mapa:active { cursor: grabbing; }
.mapa .azulejos { position: absolute; inset: 0; }
.mapa .azulejos img { position: absolute; width: 256px; height: 256px; max-width: none; pointer-events: none; }
.mapa .pino { position: absolute; left: 50%; top: 50%; width: 34px; height: 46px; transform: translate(-50%, -100%); pointer-events: none; filter: drop-shadow(0 3px 2px rgba(0,0,0,.35)); }
.mapa .pino::after { content: ''; position: absolute; left: 50%; bottom: -4px; width: 10px; height: 5px; border-radius: 50%; background: rgba(0,0,0,.3); transform: translateX(-50%); }
.mapa .zoom { position: absolute; right: .5rem; top: .5rem; display: grid; gap: .3rem; }
.mapa .zoom button { width: 36px; height: 36px; border: 2px solid var(--tinta); border-radius: 9px; background: var(--fundo); font-weight: 800; font-size: 1.1rem; cursor: pointer; }
.mapa .credito { position: absolute; right: 0; bottom: 0; background: rgba(255,255,255,.85); font-size: .66rem; padding: .1rem .35rem; border-top-left-radius: 6px; }
.mapa .credito a { color: var(--tinta); }
.mapa .dica-mapa { position: absolute; left: .5rem; top: .5rem; background: var(--tinta); color: #fff; font-size: .75rem; font-weight: 700; padding: .3rem .55rem; border-radius: 7px; }

/* carregando: barrinha no topo (só aparece se demorar) e botão travado enquanto a ação vai ao servidor */
.progresso-global { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200; overflow: hidden; pointer-events: none; background: color-mix(in srgb, var(--marca) 25%, transparent); }
.progresso-global i { display: block; height: 100%; width: 40%; background: var(--marca); animation: progressoAnda 1.1s ease-in-out infinite; }
@keyframes progressoAnda { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
button[aria-busy=true], input[aria-busy=true] { cursor: progress; }
/* troca de tela suave (quem pediu menos movimento no aparelho não vê animação) */
@keyframes telaEntra { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .progresso-global i { width: 100%; animation: none; } }
