:root {
  --preto: #111111;
  --amarelo: #FFC400;
  --cinza: #f2f2f0;
  --borda: #dcdcd8;
  --vermelho: #d63c2f;
  --verde: #2e9e44;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--cinza);
  color: var(--preto);
  padding-bottom: 40px;
}

/* topo */
.topbar {
  background: var(--preto);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { font-size: 18px; white-space: nowrap; }
.brand strong { color: var(--amarelo); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.top-actions select {
  font-size: 15px; padding: 8px; border-radius: 8px; border: none;
  background: #2a2a2a; color: #fff; max-width: 130px;
}
.printer-chip {
  font-size: 14px; padding: 8px 10px; border-radius: 999px; border: none;
  background: #2a2a2a; color: #fff; cursor: pointer; white-space: nowrap;
}
.printer-chip.on { background: var(--verde); }

/* abas */
.tabs {
  display: flex; background: #fff; border-bottom: 2px solid var(--borda);
  position: sticky; top: 52px; z-index: 19;
}
.tab {
  flex: 1; padding: 14px 4px; font-size: 17px; font-weight: 600;
  background: none; border: none; border-bottom: 4px solid transparent;
  color: #777; cursor: pointer;
}
.tab.active { color: var(--preto); border-bottom-color: var(--amarelo); }

.tabpane { display: none; padding: 14px; max-width: 900px; margin: 0 auto; }
.tabpane.active { display: block; }

/* busca */
#searchBox {
  width: 100%; font-size: 18px; padding: 14px; border-radius: 12px;
  border: 2px solid var(--borda); margin-bottom: 14px; background: #fff;
}

/* grid de produtos */
.group-title {
  font-size: 14px; font-weight: 700; text-transform: uppercase;
  color: #888; margin: 18px 4px 8px; letter-spacing: .5px;
}
.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.prod-btn {
  background: #fff; border: 2px solid var(--borda); border-radius: 14px;
  padding: 16px 10px; font-size: 17px; font-weight: 700; color: var(--preto);
  cursor: pointer; text-align: center; min-height: 78px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
}
.prod-btn:active { background: var(--amarelo); }
.prod-btn small { font-weight: 500; color: #888; font-size: 12px; }

/* lista de produtos (aba cadastro) */
#productList { margin-top: 14px; }
.prod-row {
  background: #fff; border: 1px solid var(--borda); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px; display: flex;
  justify-content: space-between; align-items: center; cursor: pointer;
}
.prod-row .info strong { font-size: 16px; }
.prod-row .info div { color: #888; font-size: 13px; }
.prod-row .edit { font-size: 20px; }

/* cards ajustes */
.card {
  background: #fff; border: 1px solid var(--borda); border-radius: 14px;
  padding: 16px; margin-bottom: 14px;
}
.card h3 { margin: 0 0 12px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > label { flex: 1; }
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 10px; }
input[type=text], input[type=number], input[type=search], select {
  width: 100%; font-size: 17px; padding: 12px; margin-top: 4px;
  border: 2px solid var(--borda); border-radius: 10px; background: #fff;
}
.muted { color: #888; font-size: 14px; margin-top: 8px; }
.center { text-align: center; }

/* botões */
.big-btn {
  display: block; width: 100%; font-size: 18px; font-weight: 800;
  padding: 16px; border-radius: 14px; border: none; cursor: pointer;
  background: var(--preto); color: #fff; margin-top: 10px;
}
.big-btn.yellow { background: var(--amarelo); color: var(--preto); }
.big-btn.slim { padding: 12px; font-size: 16px; font-weight: 600; width: auto; flex: 1; }
.big-btn.danger { background: var(--vermelho); }
.big-btn:disabled { opacity: .5; }

/* responsáveis */
.op-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 4px; border-bottom: 1px solid var(--borda); font-size: 16px;
}
.op-row button { background: none; border: none; font-size: 18px; cursor: pointer; }

/* modal */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: 14px;
}
.modal.hidden { display: none; }
.modal-box {
  background: #fff; border-radius: 18px; padding: 20px;
  width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute; top: 10px; right: 10px; font-size: 18px;
  background: var(--cinza); border: none; border-radius: 50%;
  width: 38px; height: 38px; cursor: pointer;
}
.modal-box h2 { margin: 4px 0 14px; padding-right: 40px; }

.pm-dates { font-size: 16px; line-height: 1.7; margin-bottom: 12px; }
.pm-val strong { font-size: 20px; }

.label-preview {
  width: 100%; border: 2px dashed var(--borda); border-radius: 8px;
  image-rendering: pixelated; background: #fff;
}

.qty-row {
  display: flex; align-items: center; justify-content: center;
  gap: 20px; margin: 14px 0 4px;
}
.qty-btn {
  width: 64px; height: 64px; font-size: 30px; font-weight: 800;
  border-radius: 50%; border: 2px solid var(--borda); background: #fff; cursor: pointer;
}
.qty-btn:active { background: var(--amarelo); }
.qty-value { font-size: 34px; font-weight: 800; min-width: 60px; text-align: center; }

/* toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--preto); color: #fff; padding: 14px 22px;
  border-radius: 999px; font-size: 16px; z-index: 99; max-width: 90vw;
}
.toast.ok { background: var(--verde); }
.toast.err { background: var(--vermelho); }
.toast.hidden { display: none; }
.hidden { display: none !important; }
