/* Mesa — cardápio por QR, cozinha (KDS) e salão */

/* ---------- Apresentação ---------- */
.ms-mark { display: inline-grid; place-items: center; vertical-align: middle; }
.ms-hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 48px; align-items: center; padding-block: 56px 72px; }
.ms-hero .kd-h1 em { font-family: var(--f-serif); font-style: italic; font-weight: 400; }
.ms-lead { max-width: 56ch; margin-block: 16px 28px; font-size: 17px; line-height: 1.6; }
.ms-shortcuts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.ms-shortcut { display: grid; gap: 4px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--fg); text-decoration: none; transition: border-color .25s, transform .25s var(--ease); }
.ms-shortcut:hover { border-color: var(--fg); transform: translateY(-2px); }
.ms-shortcut span { font-size: 24px; }
.ms-shortcut small { color: var(--muted); font-size: 13px; }
.ms-qr-card { display: grid; justify-items: center; gap: 14px; padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.ms-qr-card figcaption { display: grid; gap: 4px; }
.ms-qr-card figcaption small { color: var(--muted); font-size: 13px; max-width: 30ch; }
.ms-qr { width: 220px; aspect-ratio: 1; display: grid; place-items: center; background: #fff; border-radius: 12px; }
.ms-qr img { width: 100%; height: auto; image-rendering: pixelated; }

/* ---------- Cliente (mobile-first) ---------- */
.ms-client { padding-bottom: 96px; }
.ms-c-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 16px 12px; max-width: 720px; margin-inline: auto; }
.ms-c-place { font-family: var(--f-display); font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.ms-c-table { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--fg); color: var(--bg); font-family: var(--f-display); font-weight: 700; font-size: 20px; flex: none; }
.ms-cats { position: sticky; top: 0; z-index: 20; display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.ms-cats::-webkit-scrollbar { display: none; }
.ms-cats a { flex: none; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--fg); font-size: 14px; text-decoration: none; white-space: nowrap; }
.ms-cats a:hover { border-color: var(--fg); }
.ms-c-main { max-width: 720px; margin-inline: auto; padding: 8px 16px 24px; }
.ms-c-cat { padding-top: 24px; scroll-margin-top: 64px; }
.ms-c-cat__title { font-family: var(--f-display); font-size: 20px; margin-bottom: 10px; }
.ms-item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ms-item.is-off { opacity: .45; pointer-events: none; }
.ms-item__emoji { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: var(--soft); font-size: 30px; }
.ms-item__body { display: grid; gap: 3px; min-width: 0; }
.ms-item__body small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.ms-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; margin-top: 2px; }
.ms-tag { padding: 2px 8px; border-radius: 999px; background: var(--soft); font-size: 11px; color: var(--muted); }
.ms-time { color: var(--muted); font-size: 12px; }
.ms-add { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--fg); color: var(--bg); font-size: 22px; line-height: 1; cursor: pointer; transition: transform .2s var(--ease); }
.ms-add:hover { transform: scale(1.06); }
.ms-add.is-bump { transform: scale(1.2); }
.ms-cartbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.ms-cartbar__btn { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 688px; margin-inline: auto; padding: 16px 20px; border: 0; border-radius: 999px; background: var(--fg); color: var(--bg); font: inherit; font-size: 15px; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.ms-cartbar__btn span:last-child { margin-left: auto; font-weight: 600; }
.ms-client .kd-sign { transition: bottom .3s var(--ease); }
.ms-client:has(.ms-cartbar:not([hidden])) .kd-sign { bottom: 92px; }
.ms-client:has(.ms-cartbar:not([hidden])) .ms-toast { bottom: 150px; }
.ms-cart { width: min(560px, calc(100vw - 24px)); }
.ms-cart__list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 14px; max-height: 50vh; overflow-y: auto; }
.ms-cart__item { display: grid; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.ms-cart__row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.ms-cart__emoji { font-size: 22px; }
.ms-cart__price { font-weight: 600; white-space: nowrap; }
.ms-qty { display: inline-flex; align-items: center; gap: 12px; }
.ms-qty button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-size: 18px; cursor: pointer; }
.ms-qty span { min-width: 2ch; text-align: center; font-weight: 600; }
.ms-note { font-size: 14px; }
.ms-cart__total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; font-size: 18px; }
.ms-track { display: grid; gap: 10px; margin-bottom: 14px; }
.ms-track__order { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.ms-track__order small { color: var(--muted); }
.ms-track__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ms-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.ms-steps i { height: 4px; border-radius: 4px; background: var(--line); transition: background .4s; }
.ms-steps i.is-done { background: var(--fg); }
.ms-track__order--pronto .ms-steps i.is-done { background: var(--ok); }
.ms-pill { padding: 3px 10px; border-radius: 999px; font-size: 12px; background: var(--soft); white-space: nowrap; }
.ms-pill--preparando { background: #fff4dc; color: var(--warn); }
.ms-pill--pronto { background: #e3f4ea; color: var(--ok); }
.ms-pill--cancelado { background: #fde8e6; color: var(--danger); }
.ms-bill { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px; margin-bottom: 14px; border-radius: var(--radius); background: var(--fg); color: var(--bg); }
.ms-bill strong { font-size: 20px; }
.ms-help { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }

.ms-toast { position: fixed; left: 50%; bottom: 84px; z-index: 60; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px; background: var(--fg); color: var(--bg); font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: msToast .3s var(--ease); }
.ms-toast.is-bad { background: var(--danger); color: #fff; }
@keyframes msToast { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- Cozinha (KDS) ---------- */
.ms-kds-main { padding: 24px clamp(16px, 3vw, 32px) 40px; }
.ms-kds-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.ms-kds-tools { display: flex; align-items: center; gap: 14px; }
.ms-clock { font-family: var(--f-display); font-size: 28px; font-variant-numeric: tabular-nums; }
.ms-kds-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.ms-kds-col { min-height: 60vh; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft); }
.ms-kds-col h2 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-family: var(--f-display); font-size: 16px; text-transform: uppercase; letter-spacing: .06em; }
.ms-kds-col h2 span { display: grid; place-items: center; min-width: 28px; height: 28px; padding-inline: 8px; border-radius: 999px; background: var(--fg); color: var(--bg); font-size: 14px; }
.ms-kds-col > div { display: grid; gap: 12px; }
.ms-empty { padding: 24px 8px; text-align: center; color: var(--muted); font-size: 14px; }
.ms-ticket { display: grid; gap: 10px; width: 100%; padding: 14px; text-align: left; font: inherit; color: var(--fg); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .25s, transform .2s var(--ease); }
.ms-ticket:hover { transform: translateY(-2px); border-color: var(--fg); }
.ms-ticket:disabled { opacity: .5; cursor: wait; }
.ms-ticket.is-warn { border-left-color: #e0a100; }
.ms-ticket.is-late { border-left-color: #e5484d; }
.ms-ticket.is-new { animation: msNew 1.2s ease-out 2; }
@keyframes msNew { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.5); } 100% { box-shadow: 0 0 0 14px rgba(255,255,255,0); } }
.ms-ticket__head { display: flex; align-items: baseline; gap: 10px; }
.ms-ticket__table { font-family: var(--f-display); font-size: 20px; }
.ms-ticket__head span { color: var(--muted); }
.ms-ticket__timer { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.ms-ticket.is-warn .ms-ticket__timer { color: #e0a100; }
.ms-ticket.is-late .ms-ticket__timer { color: #e5484d; }
.ms-ticket__items { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ms-ticket__items li { display: grid; grid-template-columns: 2.4em minmax(0, 1fr); gap: 4px 6px; font-size: 15px; }
.ms-ticket__note { grid-column: 2; font-style: normal; font-family: var(--f-body); font-size: 13px; color: #e0a100; }
.ms-ticket__action { font-size: 13px; color: var(--muted); }
.ms-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.ms-dot--ok { background: var(--ok); }
.ms-dot--warn { background: #e0a100; }
.ms-dot--late { background: #e5484d; }
.ms-kds-legend { margin-top: 16px; }
.ms-kds .ms-dot--ok, .ms-kds .ms-ticket { --ok: #3fb97a; }

/* ---------- Salão ---------- */
.ms-floor-main { padding-block: 28px 48px; }
.ms-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ms-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 20px; }
.ms-table { display: grid; gap: 8px; align-content: start; min-height: 168px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .3s; }
.ms-table__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ms-table__n { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--soft); font-family: var(--f-display); font-size: 18px; }
.ms-table__total { font-family: var(--f-display); font-size: 24px; font-weight: 700; }
.ms-table__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.ms-table--ocupada .ms-table__n { background: var(--fg); color: var(--bg); }
.ms-table--chamando { border-color: #e0a100; box-shadow: 0 0 0 3px rgba(224,161,0,.15); }
.ms-table--chamando .ms-table__n { background: #e0a100; color: #fff; }
.ms-table--conta { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(31,122,77,.12); }
.ms-table--conta .ms-table__n { background: var(--ok); color: #fff; }
.ms-table--livre { border-style: dashed; background: transparent; }
.ms-st { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; background: var(--soft); color: var(--muted); }
.ms-st--ocupada { background: var(--fg); color: var(--bg); }
.ms-st--chamando { background: #fff4dc; color: var(--warn); }
.ms-st--conta { background: #e3f4ea; color: var(--ok); }
.ms-billbox { display: grid; gap: 8px; margin: 14px 0; padding: 14px; border-radius: 12px; background: var(--soft); }
.ms-billbox div { display: flex; justify-content: space-between; gap: 12px; }
.ms-billbox dt { color: var(--muted); }
.ms-billbox dd { margin: 0; font-weight: 600; }
.ms-billbox div:last-child { padding-top: 8px; border-top: 1px solid var(--line); font-size: 18px; }
.ms-pay { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.ms-pay label { position: relative; display: grid; place-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 500; }
.ms-pay input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.ms-pay label:has(input:checked) { border-color: var(--fg); background: var(--fg); color: var(--bg); }
.ms-pay label:has(input:focus-visible) { outline: 2px solid var(--fg); outline-offset: 2px; }
.ms-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.ms-floor .ms-toast { bottom: 24px; }

/* ---------- QR Codes ---------- */
.ms-qrs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 20px; }
.ms-qr-card--print { padding: 22px; }
.ms-qr-card--print .ms-qr { width: 160px; }
.ms-qr-card--print figcaption { display: grid; gap: 2px; }
.ms-qr-card--print figcaption span { font-family: var(--f-display); font-size: 28px; font-weight: 700; }
.ms-qr-card--print small { color: var(--muted); font-size: 12px; }

@media print {
  .kd-topbar, .kd-sign, .kd-cookie, .kd-help, [data-print], .ms-qr-card--print a, .kd-eyebrow { display: none !important; }
  body { background: #fff; }
  .ms-qrs { grid-template-columns: repeat(2, 1fr); }
  .ms-qr-card--print { break-inside: avoid; box-shadow: none; border: 2px dashed #999; }
}

/* ---------- Responsivo ---------- */
@media (max-width: 960px) {
  .ms-hero { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-block: 32px 48px; }
  .ms-kds-board { grid-template-columns: minmax(0, 1fr); }
  .ms-kds-col { min-height: 0; }
}
@media (max-width: 640px) {
  .ms-shortcuts { grid-template-columns: minmax(0, 1fr); }
  .ms-shortcut { grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; }
  .ms-shortcut span { grid-row: span 2; align-self: center; }
  .ms-qr { width: 180px; }
  .ms-tables { grid-template-columns: minmax(0, 1fr); }
  .ms-help { grid-template-columns: minmax(0, 1fr); }
  .ms-clock { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .ms-ticket.is-new, .ms-toast { animation: none; }
}
