:root {
  --accent: #C2410C;
  --on-accent: #FFFFFF;
  --ink: #1F1A17;
  --ink-2: #4A423B;
  --muted: #6B625A;
  --ground: #FBF7F2;
  --surface: #FFFFFF;
  --line: #EDE5DB;
  --line-2: #E2D8CC;
  --soft: #F3ECE3;
  --ok: #0F766E;
  --ok-soft: #E3F3F0;
  --warn: #9A3412;
  --warn-soft: #FFF4E5;
  --danger: #B91C1C;
  --danger-soft: #FDECEC;
  --info: #1D4ED8;
  --radius: 16px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesque', var(--font);
  --shadow: 0 10px 30px rgba(31, 26, 23, 0.12);

  /* Cores de função usadas pelos componentes compartilhados.
     Por padrão seguem a cor do restaurante (--accent, ajustada por setAccent),
     então o cardápio público e o acompanhamento do pedido ficam iguais. */
  --ui-primary: var(--accent);
  --ui-on-primary: var(--on-accent);
  --ui-link: var(--accent);
  --ui-focus: var(--accent);
  --ui-focus-ring: color-mix(in srgb, var(--accent) 60%, white);

  /* Paleta MCerve (só declarada aqui; quem usa é o tema data-ui="mcerve"). */
  --mc-grafite: #1B2226;
  --mc-grafite-2: #323D42;
  --mc-linha-escura: #4A565C;
  --mc-texto-suave: #5C666B;
  --mc-texto-sobre-escuro: #B9C2C5;
  --mc-creme: #F4F2EC;
  --mc-superficie: #FFFFFF;
  --mc-linha: #E3E0D7;
  --mc-linha-2: #D3CFC4;
  --mc-suave: #ECEAE3;
  --mc-neutro: #B4BBBE;
  --mc-verde: #8DE1BC;
  --mc-verde-escuro: #1F7A5A;
  --mc-verde-suave: #DDF5EA;
  --mc-sucesso: #1F7A5A;
  --mc-sucesso-suave: #DDF5EA;
  --mc-atencao: #A15C00;
  --mc-atencao-suave: #FCEFD9;
  --mc-erro: #B3261E;
  --mc-erro-suave: #FBE7E5;
  --mc-info: #2A5BD7;
  color-scheme: light;
}

/* Tema MCerve: painel, cozinha e tela de impressão (atributo no <html> dessas páginas).
   Não redefine --accent/--on-accent: a cor do restaurante continua disponível
   (logo do restaurante no menu), mas os componentes passam a usar as cores MCerve.
   Regra do verde: #8DE1BC só como fundo, sempre com texto grafite. */
html[data-ui="mcerve"] {
  --ink: var(--mc-grafite);
  --ink-2: var(--mc-grafite-2);
  --muted: var(--mc-texto-suave);
  --ground: var(--mc-creme);
  --surface: var(--mc-superficie);
  --line: var(--mc-linha);
  --line-2: var(--mc-linha-2);
  --soft: var(--mc-suave);
  --ok: var(--mc-sucesso);
  --ok-soft: var(--mc-sucesso-suave);
  --warn: var(--mc-atencao);
  --warn-soft: var(--mc-atencao-suave);
  --danger: var(--mc-erro);
  --danger-soft: var(--mc-erro-suave);
  --info: var(--mc-info);
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Sora', var(--font);
  --shadow: 0 10px 30px rgba(27, 34, 38, 0.12);
  --ui-primary: var(--mc-verde);
  --ui-on-primary: var(--mc-grafite);
  --ui-link: var(--mc-verde-escuro);
  --ui-focus: var(--mc-verde-escuro);
  --ui-focus-ring: var(--mc-verde-escuro);
}
/* Texto: 16 px nos principais, 14 px nos secundários. */
html[data-ui="mcerve"] body { font-size: 16px; }
html[data-ui="mcerve"] .input { font-size: 16px; }
html[data-ui="mcerve"] label.field,
html[data-ui="mcerve"] .hint,
html[data-ui="mcerve"] .error-text { font-size: 14px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; }
a { color: var(--ui-link); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ui-focus-ring); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  background: var(--ui-primary); color: var(--ui-on-primary); font-weight: 800; cursor: pointer; text-decoration: none;
  transition: transform .06s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.danger { background: var(--surface); color: var(--danger); border-color: #F2C4C4; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); flex-shrink: 0;
}

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface); font-size: 15px; font-weight: 500;
}
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--ui-focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-focus) 20%, transparent); }
.hint { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.error-text { color: var(--danger); font-size: 13px; font-weight: 700; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.chip.new { background: #E8F0FF; color: #1E40AF; }
.chip.soldout { background: #EEE8E2; color: var(--ink-2); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.muted { background: var(--soft); color: var(--ink-2); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 700; font-size: 14px;
  box-shadow: var(--shadow); transition: all .2s ease; z-index: 1000; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }

/* Folhas que sobem de baixo (celular) / modais centralizados (tela grande) */
.overlay { position: fixed; inset: 0; background: rgba(31, 26, 23, .45); z-index: 500; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--ground); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  border-radius: 22px 22px 0 0; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.sheet-head { position: sticky; top: 0; z-index: 2; background: var(--ground); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 10px; }
.sheet-body { padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.sheet-foot { position: sticky; bottom: 0; background: var(--ground); padding: 12px 18px 18px; border-top: 1px solid var(--line); }
@media (min-width: 720px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { border-radius: 22px; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-weight: 600; }
.row { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }
