/* =========================================================
   Bode's Burguer — design system
   Cores da marca: amarelo cheddar sobre carvão (texto escuro sobre o amarelo)
   ========================================================= */
:root {
  --brand: #f6b819;
  --on-brand: #1c1917;
  --brand-600: #e0a200;
  --brand-700: #8a5a00;
  --brand-50: #fff8e1;
  --brand-100: #ffe8a3;
  --accent: #292524;
  --accent-600: #0c0a09;
  --accent-50: #f1ece6;

  --bg: #f7f4f0;
  --surface: #ffffff;
  --surface-2: #f1ece6;
  --border: #e6ded5;
  --text: #1c1917;
  --muted: #6b625a;
  --faint: #9a9088;

  --ok: #16a34a;     --ok-50: #e9f8ee;
  --warn: #d97706;   --warn-50: #fff6e5;
  --danger: #dc2626; --danger-50: #fdecec;
  --info: #2563eb;   --info-50: #eaf1fe;
  --purple: #7c3aed; --purple-50: #f2ecfe;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, .06);
  --shadow: 0 4px 16px rgba(28, 25, 23, .08);
  --shadow-lg: 0 18px 50px rgba(28, 25, 23, .18);
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-700); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.bold { font-weight: 600; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.tnum { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent;
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: background .15s, transform .05s, box-shadow .15s, opacity .15s;
  text-decoration: none; white-space: nowrap; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--brand-100); outline-offset: 2px; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-600); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover:not(:disabled) { background: var(--accent-600); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-warn { background: var(--warn); color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-lg { min-height: 52px; padding: 0 22px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: 42px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }

/* ---------- Formulários ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.input.invalid { border-color: var(--danger); }
.input-money { text-align: right; font-variant-numeric: tabular-nums; }

.check { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }

/* Interruptor */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 52px; height: 30px; border-radius: 999px; background: #cfd8d5; position: relative; transition: background .2s; flex: none;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(22px); }
.switch input:focus-visible + .track { outline: 3px solid var(--brand-100); }
.switch.danger input:checked + .track { background: var(--danger); }
.switch.warn input:checked + .track { background: var(--warn); }

/* Segmentado */
.segmented { display: inline-flex; background: var(--surface-2); padding: 4px; border-radius: 999px; gap: 4px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: transparent; min-height: 36px; padding: 0 14px; border-radius: 999px;
  font-weight: 600; font-size: 14px; cursor: pointer; color: var(--muted);
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented button:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Cartões / blocos ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 16px; }
.card-body { padding: 18px; }
.divider { height: 1px; background: var(--border); margin: 6px 0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge-brand { background: var(--brand-50); color: var(--brand-700); }
.badge-accent { background: var(--accent-50); color: var(--accent-600); }
.badge-ok { background: var(--ok-50); color: var(--ok); }
.badge-warn { background: var(--warn-50); color: var(--warn); }
.badge-danger { background: var(--danger-50); color: var(--danger); }
.badge-info { background: var(--info-50); color: var(--info); }
.badge-purple { background: var(--purple-50); color: var(--purple); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

.alert {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--info-50); color: #1e3a8a; font-size: 14px; border: 1px solid rgba(37, 99, 235, .15);
}
.alert .alert-icon { font-size: 20px; line-height: 1.1; flex: none; }
.alert-warn { background: var(--warn-50); color: #8a4b05; border-color: rgba(217, 119, 6, .25); }
.alert-danger { background: var(--danger-50); color: #8f1d1d; border-color: rgba(220, 38, 38, .2); }
.alert-ok { background: var(--ok-50); color: #14532d; border-color: rgba(22, 163, 74, .2); }
.alert strong { display: block; margin-bottom: 2px; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .empty-icon { font-size: 40px; margin-bottom: 8px; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 25, 21, .5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fade .15s ease;
}
.modal {
  background: var(--surface); border-radius: 20px; width: 100%; max-width: 520px; max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.modal.modal-lg { max-width: 820px; }
.modal.modal-xl { max-width: 1100px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 18px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
@media (max-width: 640px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal, .modal.modal-lg, .modal.modal-xl { max-width: none; border-radius: 20px 20px 0 0; max-height: 94dvh; animation: up .22s ease; }
  .modal-foot .btn { flex: 1; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }

/* ---------- Toast ---------- */
.toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: 20px; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 24px)); pointer-events: none; }
.toast {
  background: #13221e; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg);
  font-size: 14px; display: flex; gap: 10px; align-items: center; animation: up .2s ease; pointer-events: auto;
}
.toast.error { background: var(--danger); }
.toast.ok { background: var(--brand-700); }

/* ---------- Spinner ---------- */
.spinner { width: 22px; height: 22px; border: 3px solid var(--brand-100); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
.loading { display: flex; justify-content: center; padding: 40px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Status de pedido ---------- */
.st-recebido { background: var(--accent-50); color: var(--accent-600); }
.st-confirmado { background: var(--info-50); color: var(--info); }
.st-preparo { background: var(--warn-50); color: var(--warn); }
.st-pronto { background: var(--ok-50); color: var(--ok); }
.st-saiu_entrega { background: var(--purple-50); color: var(--purple); }
.st-entregue, .st-fechado { background: var(--surface-2); color: var(--muted); }
.st-aberto { background: var(--brand-50); color: var(--brand-700); }
.st-cancelado { background: var(--danger-50); color: var(--danger); }

/* Quantidade */
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface); }
.qty button { width: 40px; height: 40px; border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--brand-700); font-weight: 700; }
.qty button:hover { background: var(--surface-2); }
.qty span { min-width: 30px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.qty.qty-sm button { width: 32px; height: 32px; font-size: 17px; }

/* Barra de progresso */
.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* Logo */
.logo-round { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px #fff, var(--shadow-sm); flex: none; }

/* Comanda térmica: tamanho, negrito, largura e destaques vêm de Configurações → Impressão (print.js aplica as variáveis).
   Na tela a comanda fica fora da área visível (mas com layout) para o print.js medir a altura e ajustar o
   @page ao tamanho exato do conteúdo — assim a impressora não avança papel em branco. */
.print-area {
  position: fixed; left: -10000px; top: 0; visibility: hidden; pointer-events: none;
  box-sizing: border-box; width: var(--pr-width, 72mm); margin: 0; padding: 0 1mm;
  font-family: 'Courier New', Courier, monospace; font-size: var(--pr-size, 14px); line-height: var(--pr-lh, 1.3);
  color: #000; background: #fff; overflow-wrap: break-word; word-break: normal; hyphens: none;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.print-area:empty { display: none; }
.print-area * { color: #000 !important; }
.print-area hr { border: 0; border-top: 1px dashed #000; margin: .4em 0; }
.print-area.pr-bold { font-weight: 700; }
.print-area.pr-bold b, .print-area.pr-bold .pr-total, .print-area.pr-bold .pr-num { font-weight: 900; }
.print-area .pr-center { text-align: center; }
.print-area .pr-store { font-weight: 700; }
/* Nome do produto ocupa a linha; se não couber junto com o valor, o valor desce para a linha de baixo (nada é cortado) */
.print-area .pr-line { display: flex; flex-wrap: wrap; column-gap: .4em; align-items: baseline; }
.print-area .pr-name { flex: 1 1 55%; min-width: 0; }
.print-area .pr-r { margin-left: auto; white-space: nowrap; padding-left: .4em; }
.print-area .pr-add { display: flex; flex-wrap: wrap; padding-left: 1.2em; }
.print-area .pr-sub, .print-area .pr-obs { padding-left: 1.2em; }
.print-area .pr-item { margin-bottom: .35em; }
.print-area .pr-total { font-weight: 700; }
.print-area .pr-small { font-size: .8em; }
.print-area .pr-split { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .2em .4em; font-size: .85em; text-align: center; }
.print-area .pr-end { color: #fff !important; height: 6mm; }
/* Destaques: número do pedido, quantidade e nome dos produtos, adicionais e observações */
.print-area.pr-emph .pr-num { font-size: 1.6em; font-weight: 900; margin: .15em 0; }
.print-area.pr-emph .pr-qty, .print-area.pr-emph .pr-name { font-size: 1.15em; font-weight: 900; }
.print-area.pr-emph .pr-add { font-weight: 700; }
.print-area.pr-emph .pr-obs { font-weight: 900; text-decoration: underline; }
.print-area.pr-emph .pr-total { font-size: 1.3em; }
.print-area.pr-emph .pr-title { font-weight: 900; font-size: 1.1em; }
@media print {
  /* Só a comanda entra na impressão: o resto da página sai do layout (antes ficava só invisível e ainda
     ocupava altura, gerando várias páginas em branco = papel picado) */
  html, body { margin: 0 !important; padding: 0 !important; height: auto !important; min-height: 0 !important; background: #fff !important; overflow: visible !important; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { position: static; left: auto; visibility: visible; display: block; }
}

/* Nenhuma tela rola na horizontal (listas com rolagem própria, como categorias, continuam rolando) */
html, body { max-width: 100%; overflow-x: clip; }

/* ---------- Seletor de adicionais (delivery e Novo Pedido) ---------- */
.addon-picker { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.addon-picker .ap-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.addon-picker .ap-head h4 { margin: 0; font-size: 15px; }
.addon-picker .ap-hint { font-size: 12px; color: var(--muted); }
.addon-picker .ap-hint.req { color: var(--brand-700); font-weight: 600; }
.addon-picker .ap-row { display: flex; align-items: center; gap: 12px; padding: 8px 14px; min-height: 52px; border-bottom: 1px solid var(--border); }
.addon-picker .ap-row:last-child { border-bottom: 0; }
.addon-picker .ap-row.sel { background: var(--brand-50); }
.addon-picker .ap-row.off { opacity: .55; }
.addon-picker .ap-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.addon-picker .ap-name { font-weight: 600; }
.addon-picker .ap-price { font-size: 13px; color: var(--muted); }
.addon-picker .ap-out { color: var(--danger); font-weight: 600; }
.addon-picker .ap-check { display: flex; padding: 6px; cursor: pointer; }
.addon-picker .ap-check input { width: 22px; height: 22px; accent-color: var(--brand); cursor: pointer; }
.addon-picker .qty button:disabled { opacity: .35; cursor: not-allowed; }

/* ---------- Pizza meio a meio ---------- */
.half-picker { display: flex; flex-direction: column; gap: 10px; }
.half-picker .hp-mode { width: 100%; }
.half-picker .hp-mode button { flex: 1; }
.half-picker .hp-body { display: flex; flex-direction: column; gap: 10px; }
.hp-visual { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.hp-pizza { position: relative; flex: none; width: 76px; height: 76px; border-radius: 50%; overflow: hidden; border: 4px solid #e7b25a; background: #f5d27a; box-shadow: inset 0 0 0 3px rgba(0,0,0,.05); }
.hp-pizza span { position: absolute; top: 0; bottom: 0; width: 50%; transition: background .2s; }
.hp-pizza .hp-left { left: 0; background: var(--brand); }
.hp-pizza .hp-right { right: 0; background: repeating-linear-gradient(45deg, #f5d27a 0 6px, #ecc463 6px 12px); border-left: 2px dashed #fff; }
.hp-pizza.two .hp-right { background: var(--accent); }
.hp-names { display: grid; gap: 6px; font-size: 13px; line-height: 1.3; min-width: 0; }
.hp-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.hp-dot.l { background: var(--brand); } .hp-dot.r { background: var(--accent); }
.hp-list { display: flex; flex-direction: column; max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; }
.hp-opt { display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 46px; border-bottom: 1px solid var(--border); cursor: pointer; }
.hp-opt:last-child { border-bottom: 0; }
.hp-opt:has(input:checked) { background: var(--accent-50); font-weight: 600; }
.hp-opt.off { opacity: .6; }
.hp-opt input { width: 20px; height: 20px; accent-color: var(--accent); }
.hp-opt .hp-price { color: var(--muted); font-size: 14px; white-space: nowrap; }

/* Totais (resumo de valores): também no painel e na tela do garçom */
.totals { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.totals .row { display: flex; justify-content: space-between; gap: 8px; }
.totals .grand { font-size: 18px; font-weight: 700; padding-top: 6px; border-top: 1px solid var(--border); }
