* { box-sizing: border-box; }
body {
  margin: 0;
  overscroll-behavior-x: none;
}
:root {
  --bg: #f6f2ea;
  --card: #ffffff;
  --ink: #2c2621;
  --muted: #8b8177;
  --line: #e6ded1;
  --accent: #d9541f;
  --accent-soft: #fdeee6;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(44, 38, 33, .10);
  --sheet: #fdf8ec;
  --rule: #dbe3f0;
  --spine: #b6c6de;
  --lace: #dfa3b3;
  --hand: 'Segoe Script', 'Bradley Hand', 'Patrick Hand', 'Comic Sans MS', cursive;
}
.app {
  min-height: 100vh;
  padding: 18px 16px 96px;
  box-sizing: border-box;
  max-width: 900px;
  margin: 0 auto;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.app *,
.app *::before,
.app *::after { box-sizing: border-box; }
.app-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}
.brand-title {
  margin: 0;
  font-size: 22px;
  letter-spacing: -.02em;
}
.brand-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.cash { display: flex; gap: 8px; }
.cash-box {
  min-width: 104px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.cash-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
}
.cash-value { font-size: 16px; }
/* folha de caderno */
.page {
  position: relative;
  overflow: hidden;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.lace {
  height: 15px;
  background-color: var(--sheet);
  background-image:
    repeating-linear-gradient(45deg, var(--lace) 0 1.5px, transparent 1.5px 12px),
    repeating-linear-gradient(-45deg, var(--lace) 0 1.5px, transparent 1.5px 12px);
}
.page-grid {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
/* só em telas largas a folha fica com duas colunas (no celular, uma mesa por linha) */
@media (min-width: 620px) {
  .page-grid { grid-template-columns: 1fr 1fr; }
}
.mesa {
  display: flex;
  flex-direction: column;
  min-height: 152px;
  padding-left: 10px;
  border-right: 1px solid var(--spine);
  border-bottom: 1px solid var(--spine);
  /* pauta de 36px, casando com a altura das linhas (−/+) */
  background-image: repeating-linear-gradient(to bottom, transparent 0 35px, var(--rule) 35px 36px);
  cursor: default;
  transition: background-color .12s ease;
}
.mesa:last-child { border-bottom: 0; }
@media (min-width: 620px) {
  .mesa:nth-child(even) { border-right: 0; }
  .mesa:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
}
.mesa:hover { background-color: rgba(217, 84, 31, .04); }
.mesa-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  height: 36px;
  padding: 6px 10px 0 0;
}
.mesa-label,
.mesa-num,
.mesa-item,
.mesa-qty { font-family: var(--hand); }
.mesa-label {
  font-size: 14px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: .78;
}
.mesa-num {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}
.mesa-items {
  flex: 1 1 auto;
  margin: 0;
  padding: 0 8px 0 0;
  list-style: none;
}
.mesa-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  height: 36px;
  font-size: 14px;
}
.mesa-item {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-transform: uppercase;
}
/* marcas de quantidade (palitinhos), discretas à direita do nome */
.qty-marks {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  flex: 0 0 auto;
  color: var(--muted);
}
.qty-marks .mesa-qty {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
/* stepper − / + numa pílula só, com alvo grande para o dedo */
.qty-ctl {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  padding: 1px;
  border-radius: 999px;
  background: #f1ebdf;
}
.step-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color .12s ease, color .12s ease, transform .1s ease;
}
.step-btn .ico {
  width: 16px;
  height: 16px;
  stroke-width: 2.6;
}
.step-btn:hover { background: #fff; color: var(--accent); }
.step-btn:active {
  background: #fff;
  color: var(--accent);
  transform: scale(.9);
}
.step-btn.inc {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(44, 38, 33, .12);
}
/* com mouse o alvo pode ser mais compacto */
@media (hover: hover) and (pointer: fine) {
  .step-btn { width: 27px; height: 27px; }
  .step-btn .ico { width: 13px; height: 13px; }
}
.tally {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--ink);
}
/* quadrado com X = 6 unidades, formado traço a traço */
.tsq {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mesa-line .tsq {
  width: 10px;
  height: 10px;
  stroke-width: 2;
}
.mesa-qty {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.mesa-hint {
  flex: 1 1 auto;
  margin: 0;
  padding-right: 10px;
  font-size: 12px;
  line-height: 36px;
  color: var(--muted);
  opacity: .7;
}
.mesa-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 36px;
  padding-right: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--accent);
}
.empty {
  display: none;
  padding: 40px 0;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}
.fab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 60%, rgba(246, 242, 234, 0));
}
.btn {
  padding: 12px 20px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px rgba(217, 84, 31, .28);
}
.btn-ghost { background: #efe9de; color: var(--ink); }
.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
}
.btn-danger { background: #fdeaea; color: #b03b2e; }
.fab-bar .btn {
  width: 100%;
  max-width: 420px;
}
.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  visibility: hidden;
}
.drawer.open { visibility: visible; }
.drawer-bg {
  position: absolute;
  inset: 0;
  background: rgba(30, 25, 20, .42);
  opacity: 0;
  transition: opacity .2s ease;
}
.drawer.open .drawer-bg { opacity: 1; }
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  max-height: 88vh;
  margin: 0 auto;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, .18);
  transform: translateY(102%);
  transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
.drawer.open .sheet { transform: none; }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.sheet-title {
  margin: 0;
  font-size: 17px;
}
.sheet-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #f1ece3;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
/* ações da mesa: os três botões lado a lado, sempre no fundo do card */
.mesa-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: auto;
  padding: 7px 8px 8px 0;
}
.btn-tool {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  line-height: 1;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease, border-color .12s ease, transform .1s ease;
}
.btn-tool:hover {
  border-color: #cfc3ae;
  color: var(--ink);
}
.btn-tool:active { transform: scale(.98); }
.ico {
  display: block;
  width: 17px;
  height: 17px;
}
.btn-tool.success {
  border-color: #b8dfc1;
  background: #e9f7ec;
  color: #2f7d3a;
}
.btn-tool.danger {
  border-color: #f3d3cf;
  background: #fdeaea;
  color: #b03b2e;
}
/* modal "novo item": cardápio + item personalizado */
.sheet-pick { max-height: 86vh; }
.pick-head-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.pick-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.pick-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto;
}
.pick-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pick-menu:empty { display: none; }
.pick-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .12s ease, background-color .12s ease;
}
.pick-item:hover {
  border-color: #cfc3ae;
  background: #fffdf8;
}
/* marcado: ainda não entrou na mesa, só foi selecionado */
.pick-item.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.pick-item.selected .pick-item-name { color: var(--accent); }
/* stepper da quantidade dentro do item marcado */
.pick-step {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pick-step button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid rgba(217, 84, 31, .3);
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.pick-step button:active { transform: scale(.9); }
.pick-step b {
  min-width: 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.pick-item-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.pick-item-price {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
.pick-hint {
  display: none;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.pick-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
}
.pick-sep::before,
.pick-sep::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
}
/* os três campos do personalizado numa linha só (+ botão de montar) */
.pick-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 50px 74px 40px;
  gap: 6px;
}
.pick-form .inp {
  padding: 9px 8px;
  font-size: 13px;
}
.pick-add {
  padding: 0;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.pick-add:active { transform: scale(.95); }
/* personalizados já montados, esperando o lançamento */
.pick-custom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pick-custom:empty { display: none; }
.pick-custom-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fffdf8;
}
.pick-custom-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.pick-custom-qty {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.pick-custom-del {
  padding: 2px 4px;
  border: 0;
  background: none;
  color: #c05548;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.pick-err {
  display: none;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #b03b2e;
}
.pick-foot {
  padding: 10px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--card);
}
.pick-foot .btn {
  width: 100%;
  padding: 13px;
  font-size: 14px;
}
.pick-foot .btn:disabled {
  background: #efe9de;
  color: var(--muted);
  box-shadow: none;
  cursor: default;
}
/* diálogo genérico (nova mesa e confirmações) */
.sheet-ask { max-width: 380px; }
.ask-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
}
.ask-msg {
  display: none;
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}
.ask-input {
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  letter-spacing: .04em;
}
.ask-err {
  display: none;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #b03b2e;
}
.ask-foot {
  display: flex;
  gap: 8px;
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.ask-foot .btn {
  flex: 1 1 0;
  padding: 12px;
  font-size: 14px;
}
.quick {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.quick::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.items {
  flex: 1;
  min-height: 120px;
  margin: 0;
  padding: 4px 18px;
  overflow-y: auto;
  list-style: none;
}
.items-empty {
  padding: 28px 0;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}
.row-del {
  padding: 4px;
  border: 0;
  background: none;
  color: #c05548;
  font-size: 13px;
  cursor: pointer;
}
.qty {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: #f4efe6;
  border-radius: 10px;
}
.qty button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.qty button:active { background: var(--accent-soft); color: var(--accent); }
.qty span {
  min-width: 26px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
}
.price {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #f4efe6;
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted);
}
.price input {
  width: 62px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  text-align: right;
  outline: none;
  -moz-appearance: textfield;
}
.price input::-webkit-outer-spin-button,
.price input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.edit-info .price {
  align-self: flex-start;
  padding: 1px 8px;
  font-size: 12px;
}
.edit-info .price input { width: 54px; font-size: 13px; }
/* ---------- cardápio ---------- */
.sheet-menu { max-height: 86vh; }
.menu-list {
  flex: 1 1 auto;
  min-height: 140px;
  margin: 0;
  padding: 2px 18px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}
.menu-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 32px;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid var(--line);
}
.menu-row:last-child { border-bottom: 0; }
/* o nome parece texto e vira campo só ao tocar */
.menu-name {
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  text-overflow: ellipsis;
}
.menu-name:hover { border-color: var(--line); }
.menu-name:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(217, 84, 31, .12);
}
.menu-price {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.menu-price:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 84, 31, .12);
}
.menu-price input {
  width: 56px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
  outline: none;
  -moz-appearance: textfield;
}
.menu-price input::-webkit-outer-spin-button,
.menu-price input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.menu-del {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #c9b9b0;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}
.menu-del .ico {
  width: 15px;
  height: 15px;
}
.menu-del:hover {
  background: #fdeaea;
  color: #b03b2e;
}
/* adicionar: nome + preço + botão numa única linha */
.menu-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px auto;
  gap: 8px;
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #fbf8f3;
}
.menu-add .inp {
  padding: 10px 12px;
  font-size: 14px;
}
.menu-add .btn {
  padding: 10px 14px;
  font-size: 13px;
  white-space: nowrap;
}
.inp {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
}
.inp:focus {
  outline: 2px solid rgba(217, 84, 31, .22);
  border-color: var(--accent);
}
.btn-finish {
  padding: 12px 18px;
  font-size: 14px;
  white-space: nowrap;
}
.locked { overflow: hidden; }
/* no desktop os modais ficam centralizados na tela, como diálogos */
@media (min-width: 720px) {
  .sheet,
  .sheet-pick {
    top: 50%;
    bottom: auto;
    max-height: 84vh;
    /* raio nos quatro cantos e recorte do conteúdo (footer/form têm fundo próprio) */
    border-radius: 20px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-48%) scale(.97);
    transition:
      transform .22s cubic-bezier(.2, .8, .2, 1),
      opacity .18s ease;
  }
  .sheet .items { overscroll-behavior: contain; }
  .drawer.open .sheet {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
  .pick-body { padding-bottom: 16px; }
  .pick-foot { padding-bottom: 12px; }
  .drawer-bg { background: rgba(30, 25, 20, .5); }
}
/* ---------- desktop: cardápio vira sidebar fixa ---------- */
@media (min-width: 1024px) {
  .app {
    max-width: none;
    margin: 0;
    /* abre espaço para a coluna do cardápio, à esquerda */
    padding: 24px 32px 40px 384px;
  }
  .app-head { margin-bottom: 22px; }
  .brand-title { font-size: 26px; }
  /* o botão só existe no mobile, onde o cardápio é modal */
  #open-menu,
  #menu-close { display: none; }
  #menu {
    position: fixed;
    inset: 0 auto 0 0;
    width: 344px;
    visibility: visible;
    z-index: 40;
    border-right: 1px solid var(--line);
    box-shadow: 14px 0 40px rgba(44, 38, 33, .07);
  }
  #menu .drawer-bg { display: none; }
  #menu .sheet-menu {
    position: static;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    transform: none;
  }
  #menu .sheet-head { padding: 22px 20px 14px; }
  #menu .menu-list { padding: 2px 14px 10px; }
  #menu .menu-add { padding: 14px 16px 18px; }
  /* a sidebar ocupa a esquerda, então a barra de ação fica no espaço restante */
  .fab-bar { left: 344px; }
  .page { box-shadow: 0 8px 32px rgba(44, 38, 33, .09); }
  .page-grid { grid-template-columns: 1fr 1fr; }
  .mesa { min-height: 168px; }
}
.hidden {
  display: none !important;
  /*position: absolute !important;
  z-index: -9999 !important;
  top: -20404px !important;
  opacity: 0 !important;*/
}
