:root {
  --bg: #F6F4F0;
  --surface: #FFFFFF;
  --ink: #1D1B20;
  --muted: #5F5A63;
  --line: #E6E1DA;
  --field: #DAD3CA;
  --accent: #8A5A1F;
  --accent-ink: #7A4F17;
  --accent-soft: #F3E9DA;
  --ok: #2D6A3E;
  --ok-soft: #E4F0E6;
  --warn: #B4441C;
  --warn-ink: #8A2C0D;
  --warn-soft: #FBE9E4;
  --info: #1F4E86;
  --info-soft: #E3ECF7;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font-family: inherit; font-size: 16px; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

/* ---------- moldura de celular (como no wireframe) ---------- */
body.celular {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #E7E2DB;
}
.aparelho {
  position: relative;
  width: 390px;
  height: min(844px, calc(100dvh - 48px));
  min-height: 560px;
  border: 10px solid #1D1B20;
  border-radius: 46px;
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(29, 27, 32, 0.22), 0 2px 6px rgba(29, 27, 32, 0.12);
  /* isola o conteúdo para que menus fixos e avisos fiquem dentro da tela */
  transform: translateZ(0);
}
/* No próprio celular a moldura ocupa a tela inteira, mantendo borda e cantos arredondados */
@media (max-width: 440px) {
  body.celular { padding: 0; background: #1D1B20; }
  .aparelho {
    width: 100vw;
    height: 100dvh;
    min-height: 0;
    border-width: 4px;
    border-radius: 30px;
    box-shadow: none;
  }
}

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.app > .login, .app > .sucesso { overflow-y: auto; }

/* ---------- comuns ---------- */
.btn {
  height: 52px; border: none; border-radius: var(--radius); padding: 0 20px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 700;
}
.btn:disabled { background: #A79C8F; cursor: not-allowed; }
.btn.secundario { background: var(--surface); color: var(--ink); border: 1.5px solid var(--field); }
.btn.bloco { width: 100%; }
.btn-icone {
  width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.campo { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.campo input, .campo textarea, .campo select {
  min-height: 50px; border-radius: 12px; border: 1px solid var(--field); background: var(--surface);
  padding: 12px 14px; font-weight: 500;
}
.campo textarea { min-height: 80px; resize: vertical; }
.muted { color: var(--muted); }
.erro { color: var(--warn-ink); background: var(--warn-soft); padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.tela { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.topo { padding: 20px 20px 10px; display: flex; flex-direction: column; gap: 14px; }
.topo-linha { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.titulo { font-size: 22px; font-weight: 800; margin: 0; }
.subtitulo { font-size: 14px; color: var(--muted); }
.conteudo { flex: 1; overflow-y: auto; padding: 8px 20px 24px; display: flex; flex-direction: column; gap: 10px; }
.rodape-acao {
  position: sticky; bottom: 0; padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 10px;
}
.linha-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.linha-total strong { font-size: 20px; }
.vazio { padding: 56px 12px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* ---------- logo ---------- */
.logo { height: 56px; max-width: 200px; object-fit: contain; display: block; }
.logo-pequeno { height: 32px; max-width: 120px; object-fit: contain; display: block; }
.logo-texto { font-size: 20px; font-weight: 800; letter-spacing: 0.02em; color: var(--accent-ink); }

/* ---------- login ---------- */
.login { flex: 1; display: flex; flex-direction: column; gap: 28px; padding: 56px 28px 32px; }
.sobretitulo { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 800; }
.login h1 { margin: 10px 0 0; font-size: 30px; line-height: 1.15; font-weight: 800; }
.login form { display: flex; flex-direction: column; gap: 16px; }

/* ---------- catálogo ---------- */
.busca {
  display: flex; align-items: center; gap: 10px; height: 48px; border-radius: 12px;
  border: 1px solid var(--field); background: var(--surface); padding: 0 14px;
}
.busca input { flex: 1; border: none; outline: none; background: transparent; min-width: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px; padding: 0 20px 2px; scrollbar-width: none; }
.chip {
  flex: none; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--field);
  background: var(--surface); font-size: 14px; font-weight: 700;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card {
  display: flex; flex-direction: column; text-align: left; padding: 0; border: 1px solid var(--line);
  border-radius: 16px; background: var(--surface); overflow: hidden;
}
.foto { height: 140px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); }
.foto img { width: 100%; height: 100%; object-fit: cover; }
.foto.grande { height: 320px; position: relative; }
.card-info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.ref { font-size: 12px; color: var(--muted); font-weight: 700; }
.nome { font-size: 14px; font-weight: 700; line-height: 1.25; }
.preco { font-size: 16px; font-weight: 800; color: var(--accent-ink); margin-top: 4px; }

/* ---------- produto ---------- */
.voltar-flutuante { position: absolute; top: 16px; left: 16px; border: none; }
.detalhe { padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.detalhe h2 { margin: 4px 0 6px; font-size: 24px; line-height: 1.2; }
.opcoes { display: flex; gap: 8px; flex-wrap: wrap; }
.opcao {
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1.5px solid var(--field);
  background: var(--surface); font-size: 15px; font-weight: 700;
}
.opcao[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--field); border-radius: 12px; background: var(--surface); }
.stepper button { width: 44px; height: 44px; border: none; background: transparent; font-size: 22px; }
.stepper output { min-width: 36px; text-align: center; font-weight: 800; font-size: 17px; }
.stepper.vertical { flex-direction: column; border-radius: 10px; }
.stepper.vertical button { height: 34px; font-size: 18px; }

/* ---------- pedido ---------- */
.item {
  display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); align-items: center;
}
.miniatura { width: 56px; height: 56px; flex: none; border-radius: 10px; background: var(--accent-soft); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.miniatura img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- clientes ---------- */
.cliente {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px; text-align: left; border-radius: var(--radius);
  border: 1.5px solid var(--field); background: var(--surface);
}
.cliente[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.avatar { width: 44px; height: 44px; flex: none; border-radius: 999px; background: #EDE7DF; display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--muted); }
.credito { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.credito-linha { display: flex; justify-content: space-between; font-size: 12px; }
.barra { height: 6px; border-radius: 999px; background: #EDE7DF; overflow: hidden; }
.barra > span { display: block; height: 100%; border-radius: 999px; background: var(--ok); }
.barra > span.alto { background: var(--warn); }
.ok { color: var(--ok); }
.ruim { color: var(--warn); }
.alerta {
  display: flex; gap: 10px; padding: 12px; border-radius: 12px; background: var(--warn-soft);
  color: var(--warn-ink); font-size: 13px; line-height: 1.4;
}

/* ---------- enviado / pedidos ---------- */
.sucesso { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 32px 28px; text-align: center; }
.selo { width: 84px; height: 84px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: var(--ok-soft); color: var(--ok); }
.selo.aviso { background: var(--warn-soft); color: var(--warn-ink); }
.pedido-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.status { font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.st-RECEBIDO { background: var(--info-soft); color: var(--info); }
.st-EM_APROVACAO { background: var(--warn-soft); color: var(--warn-ink); }
.st-EM_SEPARACAO, .st-FATURADO { background: var(--accent-soft); color: var(--accent-ink); }
.st-ENVIADO { background: var(--ok-soft); color: var(--ok); }
.st-REPROVADO, .st-CANCELADO { background: #ECEAEA; color: #4A4548; }

/* ---------- menu inferior ---------- */
.menu {
  position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line); background: var(--surface); padding-bottom: env(safe-area-inset-bottom);
}
.menu button {
  height: 64px; border: none; background: transparent; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 700; position: relative;
}
.menu button[aria-current="page"] { color: var(--accent); }
.badge {
  position: absolute; top: 8px; left: 50%; margin-left: 6px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(88px + env(safe-area-inset-bottom));
  width: min(480px, calc(100% - 40px)); padding: 14px 16px; border-radius: 12px; background: var(--ink);
  color: #fff; font-size: 14px; font-weight: 600; z-index: 10;
}

/* dentro da moldura o aviso fica preso à tela do celular */
.aparelho .toast {
  position: absolute;
  left: 16px;
  right: 16px;
  width: auto;
  transform: none;
  bottom: 84px;
}

:focus-visible { outline: 3px solid #C99A55; outline-offset: 2px; }
