:root {
  --madeira: #2b1a10;
  --madeira-2: #3d2617;
  --creme: #fbefd9;
  --creme-2: #e9d6b4;
  --papel: #fffaf1;
  --cerveja: #f4b324;
  --cerveja-escura: #c98a0b;
  --vermelho: #d64535;
  --verde: #27ae60;
  --texto: #2b1a10;
  --suave: #7a5a3d;
  --raio: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Rubik', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--madeira); color: var(--texto); min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
#painel-app {
  max-width: 720px; margin: 0 auto; min-height: 100vh; background: var(--creme);
  padding: max(16px, env(safe-area-inset-top)) 16px 40px;
}
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-weight: 900; font-size: 1.5rem; }
h2 { font-weight: 800; font-size: 1.15rem; }
p { margin: 0; line-height: 1.45; }
a { color: inherit; }

.cabecalho { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.cabecalho .quem { font-size: .8rem; color: var(--suave); }
.marca { display: flex; align-items: center; gap: 10px; }
.marca img { width: 36px; height: 36px; }

.cartao {
  background: var(--papel); border-radius: var(--raio); padding: 16px;
  box-shadow: 0 3px 0 rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px;
}
.linha { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.linha > * { flex: 1 1 140px; }
.dica { color: var(--suave); font-size: .85rem; }
.vazio { color: var(--suave); text-align: center; padding: 20px 0; }

label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .9rem; }
input[type=text], input[type=email], input[type=password], input[type=url], textarea, select {
  font: inherit; font-size: 1rem; padding: 12px 14px; border-radius: 12px;
  border: 2px solid var(--creme-2); background: #fff; color: var(--texto); width: 100%;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--cerveja); }
input[type=color] { width: 100%; height: 48px; border: 2px solid var(--creme-2); border-radius: 12px; padding: 4px; background: #fff; }
.marcar { flex-direction: row; align-items: center; gap: 10px; font-weight: 600; }
.marcar input { width: 22px; height: 22px; accent-color: var(--cerveja-escura); }

.btn {
  font: inherit; font-weight: 800; font-size: 1rem; border: 0; border-radius: 12px; padding: 12px 18px;
  cursor: pointer; text-decoration: none; text-align: center; display: inline-block;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn-principal { background: var(--cerveja); color: var(--madeira); box-shadow: 0 4px 0 var(--cerveja-escura); }
.btn-secundario { background: var(--madeira); color: var(--creme); box-shadow: 0 4px 0 #120a05; }
.btn-perigo { background: #fff; color: var(--vermelho); border: 2px solid var(--vermelho); }
.btn-texto { background: none; border: 0; font: inherit; font-weight: 700; color: var(--suave); cursor: pointer; padding: 8px 4px; }
.btn:active { transform: translateY(3px); box-shadow: none; }
.btn-pequeno { padding: 8px 12px; font-size: .85rem; }

.abas { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px 4px; scrollbar-width: none; }
.abas button {
  font: inherit; font-weight: 700; white-space: nowrap; border: 0; border-radius: 99px; padding: 9px 14px; cursor: pointer;
  background: var(--papel); color: var(--suave);
}
.abas button.ativa { background: var(--madeira); color: var(--creme); }

.selo { font-size: .7rem; font-weight: 800; padding: 3px 8px; border-radius: 99px; background: var(--creme-2); color: var(--madeira); white-space: nowrap; }
.selo-ok { background: #d4f5df; color: #145c31; }
.selo-off { background: #f6d7d3; color: #8a2216; }
.selo-alcool { background: #fde3b3; color: #7a4a00; }

/* Lista de comércios / promoções */
.item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 2px solid var(--creme); }
.item:first-child { border-top: 0; padding-top: 0; }
.item .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item .info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .info small { color: var(--suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .acoes { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.miniatura { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--creme-2); flex: 0 0 56px; }

/* Prévia da mesa */
.previa {
  border-radius: 40% / 30%; border: 8px solid #c9d2d8; aspect-ratio: 16 / 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px;
  box-shadow: inset 0 0 30px rgba(0,0,0,.35); text-align: center;
}
.previa img { max-height: 54px; max-width: 50%; object-fit: contain; }
.previa .nome { font-weight: 900; font-size: 1.4rem; text-transform: uppercase; transform: rotate(-6deg); }
.previa .frase { font-style: italic; font-size: .8rem; opacity: .8; transform: rotate(-6deg); }
.logo-atual { display: flex; align-items: center; gap: 12px; }
.logo-atual img { max-width: 120px; max-height: 60px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; }

/* Números */
.numeros-grade { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.numero { background: var(--papel); border-radius: 14px; padding: 14px; box-shadow: 0 3px 0 rgba(0,0,0,.08); }
.numero b { display: block; font-size: 1.8rem; font-weight: 900; }
.numero span { color: var(--suave); font-size: .85rem; }
.barras { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.barras div { flex: 1; background: var(--cerveja); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.barras div:hover::after {
  content: attr(data-rotulo); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--madeira); color: var(--creme); font-size: .7rem; padding: 3px 6px; border-radius: 6px; white-space: nowrap;
}
.eixo { display: flex; justify-content: space-between; color: var(--suave); font-size: .7rem; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 4px; border-top: 2px solid var(--creme); }
th { color: var(--suave); font-weight: 700; font-size: .8rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.qr-link { word-break: break-all; font-weight: 700; background: #fff; padding: 10px 12px; border-radius: 10px; border: 2px dashed var(--creme-2); }

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, calc(100% + 60px)); visibility: hidden;
  background: var(--madeira); color: var(--creme); border: 2px solid var(--cerveja);
  padding: 12px 18px; border-radius: 14px; font-weight: 600; max-width: calc(100% - 32px);
  transition: transform .25s ease, visibility 0s .25s; z-index: 10; text-align: center;
}
.toast.visivel { transform: translate(-50%, 0); visibility: visible; transition: transform .25s ease; }
.toast.erro { border-color: var(--vermelho); }

.login { max-width: 400px; margin: 10vh auto 0; }
.login .marca { justify-content: center; margin-bottom: 18px; }
.login .marca img { width: 56px; height: 56px; }

@media (min-width: 560px) {
  .numeros-grade { grid-template-columns: repeat(4, 1fr); }
}
span.miniatura { display: grid; place-items: center; font-size: 1.6rem; }
.item.inativa { opacity: .55; }
.miniatura-grande { max-width: 140px; max-height: 140px; object-fit: contain; border-radius: 10px; background: #fff; }
