:root {
  --red: #d90429;
  --red-dark: #a30021;
  --red-light: #ffe5e9;
  --white: #ffffff;
  --gray-bg: #f7f7f9;
  --gray-border: #e5e5ea;
  --text: #222226;
  --text-muted: #74747c;
  --green: #2e7d32;
  --yellow: #b8860b;

  /* Tema visual (customizável em Configurações) */
  --primary: #ff6b35;
  --primary-dark: #e85a2a;
  --primary-light: #ffe4d6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* Controles de formulário não herdam a fonte do body por padrão. */
button, input, select, textarea, code { font-family: inherit; }
code { font-weight: 600; }

body {
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--gray-bg);
  overflow: hidden;
}

.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  background: var(--white);
  border-right: 1px solid var(--gray-border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.brand {
  font-size: 22px;
  font-weight: 700;
  padding: 0 20px 20px 20px;
  color: var(--text);
  border-bottom: 1px solid var(--gray-border);
  margin-bottom: 10px;
}
.brand span { color: var(--primary); }

nav { display: flex; flex-direction: column; gap: 4px; padding: 0 10px; flex: 1; }

.nav-btn {
  text-align: left;
  padding: 12px 14px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}
.nav-btn:hover { background: var(--gray-bg); }
.nav-btn.active { background: var(--primary); color: var(--white); font-weight: 600; }

.cash-indicator {
  margin: 10px 14px 0 14px;
  padding: 10px;
  border-radius: 8px;
  background: var(--gray-bg);
  font-size: 12px;
  text-align: center;
  color: var(--text-muted);
}
.cash-indicator.aberto { background: #e8f5e9; color: var(--green); font-weight: 600; }

/* ---------- Content ---------- */
.content { flex: 1; overflow-y: auto; padding: 24px 32px; }
.view { display: none; }
.view.active { display: block; }

h1 { font-size: 22px; margin-bottom: 4px; }
h2 { font-size: 17px; margin: 18px 0 10px; }
.subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }

.card {
  background: var(--white);
  border: 1px solid var(--gray-border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  transition: filter 0.15s;
}
.btn:hover { filter: brightness(0.95); }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-secondary { background: var(--gray-bg); color: var(--text); border: 1px solid var(--gray-border); }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--gray-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
}
textarea { resize: vertical; min-height: 70px; }
label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; margin-top: 10px; font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--gray-border); }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.badge { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-red { background: var(--red-light); color: var(--red-dark); }
.badge-green { background: #e8f5e9; color: var(--green); }
.badge-yellow { background: #fff8e1; color: var(--yellow); }
.badge-gray { background: var(--gray-bg); color: var(--text-muted); }
.badge-blue { background: #e3f2fd; color: #1565c0; }

/* ---------- PDV ---------- */
.pdv-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; height: calc(100vh - 110px); }
.pdv-catalog { overflow-y: auto; padding-right: 6px; }
.item-tile {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--gray-border); border-radius: 8px; padding: 10px;
  margin-bottom: 8px; cursor: pointer; background: var(--white);
}
.item-tile:hover { border-color: var(--primary); }
.item-tile img { width: 72px; height: 72px; flex: none; object-fit: cover; border-radius: 8px; background: var(--gray-bg); }
.item-tile img:not([src]), .item-tile img[src=""] { visibility: hidden; }
.item-tile .info { flex: 1; }
.item-tile .info .nome { font-weight: 600; font-size: 14px; }
.item-tile .info .preco { color: var(--primary); font-weight: 700; font-size: 13px; }

.pdv-cart { display: flex; flex-direction: column; }
.cart-items { flex: 1; overflow-y: auto; }
.cart-line { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--gray-border); font-size: 13px; }
.cart-total { font-size: 20px; font-weight: 700; text-align: right; padding: 14px 0; border-top: 2px solid var(--text); margin-top: 10px; }

/* ---------- Pedidos board ---------- */
/* Colunas com largura mínima confortável; se a tela for estreita, rola na horizontal. */
.pedidos-board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr);
  gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 10px;
}
.pedido-col { background: var(--white); border: 1px solid var(--gray-border); border-radius: 10px; padding: 12px; min-height: 160px; }
.pedido-col h3 {
  font-size: 12px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.pedido-col .col-contador { background: var(--gray-bg); color: var(--text); border-radius: 20px; padding: 1px 8px; font-size: 11px; }
.pedido-col .pedido-card { background: var(--gray-bg); }
.historico-filtros { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.historico-filtros input { min-width: 180px; }
.pedido-card { background: var(--white); border: 1px solid var(--gray-border); border-left: 4px solid var(--primary); border-radius: 8px; padding: 12px; margin-bottom: 10px; font-size: 13px; }
.pedido-card .cliente { font-weight: 700; margin-bottom: 4px; }
.pedido-card .itens { color: var(--text-muted); font-size: 12px; margin-bottom: 6px; }
.pedido-card .acoes { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* ---------- WhatsApp ---------- */
.wa-painel { padding: 0; margin-bottom: 14px; overflow: hidden; }
.wa-frame { display: block; width: 100%; height: calc(100vh - 230px); min-height: 460px; border: 0; }
.wa-frame[hidden] { display: none; }
.wa-painel-aviso { padding: 18px 20px; font-size: 13px; line-height: 1.5; }
.wa-painel-aviso[hidden] { display: none; }
.wa-painel-aviso ol { margin: 8px 0 8px 18px; padding: 0; }
.wa-layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; height: calc(100vh - 190px); min-height: 360px; }
.wa-layout > * { min-height: 0; } /* sem isso o cartão cresce com as mensagens e a rolagem interna não acontece */
.wa-conversas { overflow-y: auto; }
.wa-conversa-item { padding: 10px; border-radius: 8px; cursor: pointer; margin-bottom: 4px; }
.wa-conversa-item:hover, .wa-conversa-item.active { background: var(--gray-bg); }
.wa-mensagens { overflow-y: auto; flex: 1; min-height: 0; padding: 10px; background: var(--gray-bg); border-radius: 10px; }
.wa-msg { max-width: 70%; padding: 8px 12px; border-radius: 10px; margin-bottom: 8px; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.wa-msg.entrada { background: var(--white); border: 1px solid var(--gray-border); }
.wa-msg.saida { background: var(--primary); color: var(--white); margin-left: auto; }
.wa-qr-box { text-align: center; padding: 40px; }
.wa-codigo { font-size: 40px; font-weight: 700; letter-spacing: 6px; font-family: inherit; font-variant-numeric: tabular-nums; padding: 12px 20px; display: inline-block; background: var(--gray-bg); border-radius: 8px; }
.wa-por-codigo { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--gray-border); }
.wa-por-codigo input { max-width: 220px; margin-right: 8px; }
.wa-qr-box img { width: 220px; height: 220px; border: 8px solid var(--white); box-shadow: 0 0 0 1px var(--gray-border); }

.empty-state { color: var(--text-muted); text-align: center; padding: 40px 20px; font-size: 13px; }

#toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 999; }
.toast { background: var(--text); color: var(--white); padding: 10px 16px; border-radius: 8px; font-size: 13px; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.toast.error { background: var(--red-dark); }
.toast.success { background: var(--green); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 500; }
.modal { background: var(--white); border-radius: 12px; padding: 24px; width: 480px; max-height: 85vh; overflow-y: auto; }
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }


/* ---------- Sidebar: logomarca ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.brand-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Mesas ---------- */
.mesas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 12px; }
.mesas-grid .empty-state { grid-column: 1 / -1; text-align: left; }
.mesa-card {
  position: relative;
  background: var(--white); border: 1px solid var(--gray-border); border-radius: 10px;
  padding: 16px 12px; text-align: center; cursor: pointer; transition: box-shadow 0.15s;
}
.mesa-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.mesa-card.ocupada { border-color: var(--primary); background: var(--primary-light); }
.mesa-numero { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.mesa-total { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.mesa-remover {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; padding: 0;
  border-radius: 50%; line-height: 1; display: flex; align-items: center; justify-content: center;
}

/* ---------- Painel de Comanda (Mesa / Cliente) ---------- */
.comanda-panel {
  background: var(--white); border-radius: 12px; width: 920px; max-width: 95vw; height: 82vh;
  display: flex; overflow: hidden;
}
.comanda-catalogo { flex: 1.3; overflow-y: auto; padding: 16px; border-right: 1px solid var(--gray-border); }
.comanda-lado { flex: 1; display: flex; flex-direction: column; padding: 16px; }
.comanda-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.comanda-titulo { font-size: 18px; font-weight: 700; }
#comanda-itens { flex: 1; overflow-y: auto; }

/* ---------- Seletor de Tema ---------- */
.tema-opcoes { display: flex; gap: 10px; margin-top: 6px; }
.tema-opcao {
  flex: 1; border: 2px solid var(--gray-border); border-radius: 8px; padding: 10px 8px;
  background: var(--white); cursor: pointer; font-size: 11px; font-weight: 600; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.tema-opcao.ativo { border-color: var(--text); }
.tema-amostra { width: 100%; height: 22px; border-radius: 4px; display: block; }
.tema-laranja .tema-amostra { background: linear-gradient(90deg, #ffffff 50%, #ff6b35 50%); border: 1px solid var(--gray-border); }
.tema-azul .tema-amostra { background: linear-gradient(90deg, #e2e8f0 50%, #2563eb 50%); }
.tema-vermelho .tema-amostra { background: linear-gradient(90deg, #ffffff 50%, #dc2626 50%); border: 1px solid var(--gray-border); }


/* ---------- Autenticacao / Auth Gate ---------- */
.hidden { display: none !important; }
.auth-screen {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at top, var(--primary-light), var(--gray-bg) 70%);
}
.user-indicator {
  margin: 10px 14px 0 14px; font-size: 12px; color: var(--text-muted); text-align: center;
}

/* ---------- Barra de progresso ---------- */
.barra-progresso { height: 10px; background: var(--gray-bg); border-radius: 6px; overflow: hidden; margin: 12px auto 0; max-width: 360px; }
.barra-progresso > div { height: 100%; background: var(--primary); transition: width 0.3s; }

.update-banner {
  margin: 10px 14px 0; padding: 10px; border-radius: 8px; text-align: center; font-size: 12px;
  background: var(--primary-light); color: var(--text); border: 1px solid var(--primary);
}
.update-banner .btn { margin-top: 6px; width: 100%; }

/* ---------- Ajuda / Manual ---------- */
.ajuda-flutuante { position: fixed; left: 16px; bottom: 16px; z-index: 750; box-shadow: 0 2px 10px rgba(0,0,0,0.12); }
.sidebar-rodape { display: flex; gap: 8px; margin: 8px 14px 14px; }
.sidebar-rodape .btn { flex: 1; }
.ajuda-painel {
  background: var(--white); border-radius: 12px; width: 980px; max-width: 95vw; height: 86vh;
  display: flex; overflow: hidden;
}
.ajuda-indice {
  flex: 0 0 250px; background: var(--gray-bg); padding: 16px 10px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.ajuda-indice-titulo { font-weight: 700; font-size: 15px; padding: 0 10px 12px; }
.ajuda-indice button {
  text-align: left; border: none; background: transparent; padding: 9px 10px; border-radius: 8px;
  cursor: pointer; font-size: 13px; color: var(--text);
}
.ajuda-indice button:hover { background: var(--white); }
.ajuda-indice button.ativo { background: var(--primary); color: var(--white); font-weight: 600; }
.ajuda-conteudo { flex: 1; overflow-y: auto; padding: 24px 32px; position: relative; font-size: 14px; line-height: 1.6; }
.ajuda-fechar { position: sticky; top: 0; float: right; }
.ajuda-conteudo h2 { margin-top: 0; }
.ajuda-conteudo h3 { font-size: 15px; margin: 18px 0 6px; }
.ajuda-conteudo p, .ajuda-conteudo ul, .ajuda-conteudo ol, .ajuda-conteudo dl { margin-bottom: 10px; }
.ajuda-conteudo ul, .ajuda-conteudo ol { padding-left: 22px; }
.ajuda-conteudo dt { font-weight: 700; margin-top: 10px; }
.ajuda-conteudo dd { margin-left: 0; color: var(--text-muted); }
.ajuda-conteudo code { font-family: inherit; font-weight: 600; background: var(--gray-bg); border: 1px solid var(--gray-border); padding: 0 5px; border-radius: 4px; font-size: 13px; }
.ajuda-dica {
  background: var(--primary-light); border-left: 4px solid var(--primary); padding: 10px 12px;
  border-radius: 6px; margin: 12px 0; font-size: 13px;
}

/* ---------- Quadro de pedidos: detalhes ---------- */
.pedido-card .itens .obs { color: var(--red-dark, #b71c1c); font-weight: 700; }
.pedido-card .entrega-info { font-size: 12px; margin: 4px 0 6px; padding: 6px 8px; background: var(--white); border-radius: 6px; }
.pedido-card.atrasado { border-left-color: var(--red, #d32f2f); box-shadow: 0 0 0 1px var(--red, #d32f2f) inset; }

/* Mensagens longas (erros, caminhos) não podem alargar os cartões */
.card { min-width: 0; }
.card .subtitle, #atualizacao-status, #ai-modelos-info, #ai-teste-resultado { overflow-wrap: anywhere; }

/* ---------- Cardápio por categoria (PDV e comanda) ---------- */
.catalogo-abas {
  position: sticky; top: 0; z-index: 2; display: flex; gap: 6px; flex-wrap: wrap;
  padding: 6px 0 10px; background: inherit;
}
.pdv-catalog .catalogo-abas { background: var(--gray-bg); }
.comanda-catalogo .catalogo-abas { background: var(--white); }
.catalogo-aba {
  border: 1px solid var(--gray-border); background: var(--white); color: var(--text);
  border-radius: 20px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.catalogo-aba span { color: var(--text-muted); font-weight: 400; margin-left: 2px; }
.catalogo-aba.ativa { background: var(--primary); border-color: var(--primary); color: var(--white); }
.catalogo-aba.ativa span { color: var(--white); }
.catalogo-secao h2 { margin: 14px 0 8px; }
.catalogo-secao:first-of-type h2 { margin-top: 4px; }
.item-tile .info .descricao { font-size: 12px; color: var(--text-muted); margin: 1px 0 2px; }
.pdv-catalog, .comanda-catalogo { position: relative; }
.comanda-catalogo .catalogo-abas { top: -16px; margin-top: -16px; padding-top: 16px; }

/* Coluna Pagamento: selo indica se o comprovante já chegou */
.selo-pagamento { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; margin-bottom: 6px; background: var(--gray-bg); color: var(--text-muted); display: inline-block; }
.selo-pagamento.comprovante { background: #fff3cd; color: #8a5a00; }
.pedido-card.destaque { box-shadow: 0 0 0 2px #f0b400 inset; }

/* Caixa: demonstrativo e histórico */
.caixa-resumo { width: 100%; border-collapse: collapse; margin: 8px 0 4px; font-size: 14px; }
.caixa-resumo td { padding: 6px 4px; border-bottom: 1px solid var(--gray-border); }
.caixa-resumo td.valor, table td.valor { text-align: right; white-space: nowrap; }
.caixa-resumo tr.sub td { font-size: 12px; color: var(--text-muted); border-bottom: none; padding-top: 2px; padding-bottom: 2px; }
.caixa-resumo tr.total td { font-weight: 700; font-size: 16px; border-top: 2px solid var(--text, #222); border-bottom: none; }
.caixa-resumo tr.ok td { color: var(--green, #15803d); font-weight: 700; }
.caixa-resumo tr.erro td, .dif-erro { color: var(--red); font-weight: 700; }
.abas-periodo { display: flex; gap: 6px; }
.caixa-hist-totais { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.caixa-hist-totais > div { background: var(--gray-bg); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.caixa-hist-totais span { font-size: 12px; color: var(--text-muted); }
.muted { color: var(--text-muted); font-size: 12px; }

/* Foto do produto no cadastro */
.foto-campo { display: flex; gap: 14px; align-items: flex-start; border: 2px dashed transparent; border-radius: 10px; padding: 4px; }
.foto-campo.arrastando { border-color: var(--primary); background: var(--primary-light, #ffe4d6); }
.foto-previa { width: 120px; height: 120px; flex: none; border-radius: 10px; overflow: hidden; background: var(--gray-bg); border: 1px solid var(--gray-border); display: flex; align-items: center; justify-content: center; text-align: center; color: var(--text-muted); font-size: 12px; }
.foto-previa img { width: 100%; height: 100%; object-fit: cover; }
.foto-acoes { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.foto-dica { font-size: 11px; color: var(--text-muted); margin: 2px 0 0; line-height: 1.4; }
.foto-info { font-size: 12px; color: var(--green, #15803d); margin: 0; }

/* Biblioteca de ícones */
.icones-sugeridos { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.icones-sugeridos > span { width: 100%; }
.icone-opcao { width: 48px; height: 48px; padding: 6px; border: 1px solid var(--gray-border); border-radius: 10px; background: var(--white); cursor: pointer; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; }
.icone-opcao:hover { border-color: var(--primary); background: var(--primary-light, #ffe4d6); }
.icone-opcao img { width: 100%; height: 100%; object-fit: contain; }
.icone-opcao.grande { width: 92px; height: 92px; gap: 4px; }
.icone-opcao.grande img { width: 48px; height: 48px; flex: none; }
.icone-opcao.grande small { font-size: 10.5px; line-height: 1.15; color: var(--text); text-align: center; }
.icones-lista { max-height: 60vh; overflow-y: auto; margin-top: 10px; }
.icones-lista h3 { margin: 12px 0 6px; font-size: 13px; }
.icones-grade { display: flex; flex-wrap: wrap; gap: 8px; }

/* Janelas do sistema e código de recuperação */
.janela-msg { margin: 4px 0 12px; line-height: 1.45; white-space: pre-line; }
.codigo-recuperacao { font-size: 30px; font-weight: 700; letter-spacing: 4px; text-align: center; padding: 14px; margin: 8px 0 10px; background: var(--gray-bg); border: 2px dashed var(--primary); border-radius: 10px; font-variant-numeric: tabular-nums; user-select: all; }
.check-linha { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-top: 10px; }
.check-linha input { width: auto; }
.btn-danger { background: var(--red); color: #fff; border: none; }
.btn-danger:hover { background: var(--red-dark); }
.link-botao { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; font-size: 13px; text-decoration: underline; }

/* Mesas: transferir e dividir */
.mesas-destino { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; max-height: 50vh; overflow-y: auto; }
.mesa-destino { display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; border: 2px solid var(--gray-border); border-radius: 10px; background: var(--white); cursor: pointer; }
.mesa-destino small { color: var(--text-muted); font-size: 11px; }
.mesa-destino.ocupada { border-color: #f5a25d; background: #fff7ed; }
.mesa-destino:hover { border-color: var(--primary); }
.dividir-abas { display: flex; gap: 6px; margin-bottom: 12px; }
.dividir-resultado { margin: 12px 0 6px; padding: 10px 12px; background: var(--gray-bg); border-radius: 8px; font-size: 15px; }
.dividir-itens { max-height: 40vh; overflow-y: auto; border: 1px solid var(--gray-border); border-radius: 8px; }
.dividir-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--gray-border); }
.dividir-item small { color: var(--text-muted); }
.dividir-item .qtd { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

/* ---------- Versão web ---------- */
.wa-previa {
  font-family: inherit; font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--gray-bg); border-radius: 8px; padding: 12px; max-height: 420px; overflow-y: auto; margin: 0;
}
.modal { max-width: 94vw; }
.sidebar { overflow-y: auto; }

/* Tablet: barra lateral mais estreita. */
@media (max-width: 1100px) {
  .sidebar { width: 200px; }
  .content { padding: 20px 20px; }
}

/* Celular / tablet em pé: a barra lateral vira uma faixa no topo, com rolagem lateral. */
@media (max-width: 820px) {
  .app-shell { flex-direction: column; height: 100dvh; }
  .sidebar { width: 100%; flex: none; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 8px 8px 4px; border-right: 0; border-bottom: 1px solid var(--gray-border); max-height: 40vh; }
  .brand { padding: 0 8px; margin: 0; border-bottom: 0; font-size: 18px; display: flex; align-items: center; gap: 6px; }
  .brand-logo { width: 28px; height: 28px; }
  nav { flex-direction: row; flex: 1 1 100%; order: 3; overflow-x: auto; padding: 4px 0 6px; gap: 4px; }
  .nav-btn { white-space: nowrap; padding: 9px 12px; flex: none; }
  .cash-indicator, .user-indicator { margin: 0 4px; padding: 6px 8px; font-size: 11px; }
  .sidebar-rodape { flex-direction: row; margin-left: auto; padding: 0 4px; gap: 4px; }
  .update-banner { display: none; }
  .content { padding: 14px 12px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .pdv-layout { grid-template-columns: 1fr; height: auto; }
  .pdv-catalog { max-height: 55vh; }
  .card { overflow-x: auto; }
  .content table { display: block; overflow-x: auto; white-space: nowrap; }
  .modal { padding: 16px; }
  .ajuda-flutuante { bottom: 8px; left: 8px; }
}


/* Créditos (revenda): fixos em todas as telas, discretos, sem atrapalhar os botões. */
.creditos {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 6px; z-index: 900; white-space: nowrap;
  font-size: 11px; line-height: 1; color: var(--text-muted, #6b6b6b); text-decoration: none;
  background: rgba(255,255,255,0.88); border: 1px solid rgba(0,0,0,0.08); border-radius: 999px;
  padding: 5px 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.creditos:hover, .creditos:focus-visible { color: #128c4a; border-color: #25d366; }
@media (max-width: 600px) { .creditos { font-size: 10px; } }
@media print { .creditos { display: none; } }
