:root {
  --bg: #f6f5f2; --surface: #fff; --ink: #1f2328; --muted: #646b74; --line: #e3e1db;
  --brand: #d9480f; --ok: #2b7a4b; --danger: #b42318; --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 1.45rem; margin: 0; } h2 { font-size: 1.1rem; margin: 0 0 .6rem; } h3 { font-size: .95rem; margin: .9rem 0 .4rem; }
p { margin: .35rem 0; }
a { color: var(--brand); }
small, .small { font-size: .84rem; }
.muted { color: var(--muted); } .center { text-align: center; } .right { text-align: right; }
.error { color: var(--danger); } .ok { color: var(--ok); }
.empty { color: var(--muted); padding: .6rem 0; text-align: center; }
.faded { opacity: .55; }

input, select, textarea { width: 100%; padding: .55rem .65rem; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-height: 40px; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--brand); }
input[type=color] { padding: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
label { display: block; font-size: .88rem; font-weight: 500; }
label > input, label > select, label > textarea { margin-top: .2rem; font-weight: 400; }
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
label.check input { margin: 0; }

button, .button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; border: 1px solid transparent; padding: .5rem .9rem; min-height: 40px; text-decoration: none; background: none; color: inherit; }
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--brand); color: #fff; }
.ghost { border-color: var(--line); background: var(--surface); color: var(--ink); }
.link { padding: 0; min-height: 0; border: 0; font-weight: 500; color: var(--brand); text-decoration: underline; }
.danger { color: var(--danger); }
button.small, .button.small { padding: .25rem .6rem; min-height: 32px; font-size: .84rem; }
button.link.small { padding: 0; min-height: 0; }
.wide { width: 100%; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: .75rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.two > .card { margin-bottom: 0; }
.two { margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; align-items: end; }
.inline-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.inline-form label { flex: 1 1 150px; }
.inline-form.tight { flex-wrap: nowrap; align-items: center; }
.inline-form.tight select, .inline-form.tight input { min-width: 120px; }
.top-line { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.qty { width: 80px; flex: none; }
.preview { max-width: 180px; border-radius: 8px; }

.flash { padding: .6rem .8rem; border-radius: 8px; background: #e7f4ec; color: #17603a; }
.flash.erro { background: #fdecea; color: #8f1d13; }

/* Painel */
.app-shell { display: flex; align-items: stretch; min-height: 100dvh; }
.sidebar { flex: 0 0 216px; width: 216px; display: flex; flex-direction: column; gap: 1rem; padding: 1rem .75rem; background: var(--surface); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100dvh; overflow-y: auto; z-index: 5; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; padding: 0 .55rem; overflow-wrap: anywhere; }
.brand small { display: block; font-weight: 400; color: var(--muted); }
.sidebar nav { display: flex; flex-direction: column; gap: .15rem; flex: 1 1 auto; }
.sidebar nav a { padding: .5rem .65rem; border-radius: 7px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.sidebar nav a:hover { background: #f4f2ee; color: var(--ink); }
.sidebar nav a.on { background: #f3e6df; color: var(--brand); font-weight: 600; }
.who { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; font-size: .84rem; padding: .7rem .55rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.wrap { flex: 1 1 auto; min-width: 0; max-width: 1320px; padding: 1rem 1.25rem; }
.bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; align-items: start; margin-bottom: 1rem; }
.bank-grid .card { margin-bottom: 0; }
.bank-head { display: flex; align-items: center; gap: .6rem; }
.bank-head h2 { margin: 0; flex: 1; }
.bank-logo { flex: none; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; overflow: hidden; }
.bank-logo img { width: 100%; height: 100%; object-fit: contain; }
.logo-sicredi { background: #3fa110; padding: 9px; }
.logo-sicoob { background: #003641; padding: 7px; }
.bank-card details form { margin-top: .7rem; }
.bank-card summary { cursor: pointer; }
.pay-box { border: 1px solid var(--line); border-radius: 8px; padding: .8rem; display: flex; flex-direction: column; gap: .5rem; }
.pay-box h2 { margin: 0; }
.pix-qr { align-self: center; max-width: 100%; height: auto; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.head h2, .head h3 { margin: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.head .chips { margin-bottom: 0; }
.chip { padding: .25rem .7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-size: .86rem; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.badge { display: inline-block; padding: .05rem .45rem; border-radius: 5px; background: #eef0f2; font-size: .75rem; font-weight: 600; }
.badge.off { background: #fdecea; color: #8f1d13; }

.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: .8rem; overflow-x: auto; align-items: start; }
.column { background: #ecebe6; border-radius: var(--radius); padding: .6rem; min-height: 200px; }
.column h2 { font-size: .92rem; display: flex; justify-content: space-between; margin-bottom: .5rem; }
.count { background: var(--surface); border-radius: 999px; padding: 0 .5rem; font-size: .8rem; }
.column[data-status=novo]:not([data-count="0"]) { background: #fbe3d6; }
.order { background: var(--surface); border-radius: 8px; padding: .65rem; margin-bottom: .55rem; border: 1px solid var(--line); }
.order header { display: flex; align-items: center; gap: .4rem; }
.order time { margin-left: auto; color: var(--muted); font-size: .82rem; }
.order .name { font-size: .88rem; }
.items { list-style: none; margin: .35rem 0; padding: 0; font-size: .9rem; }
.items small { display: block; color: var(--muted); padding-left: 1.2rem; }
.note, .items small.note { color: #8a4b08; }
.total { font-weight: 700; }
.order-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .4rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; }
th.right { text-align: right; }
th, td { padding: .5rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }

.product-list, .option-list { list-style: none; margin: 0; padding: 0; }
.product-list li { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-top: 1px solid var(--line); }
.product-list img, .thumb-empty { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; background: #eeece6; flex: none; }
.product-list .price { margin-left: auto; font-weight: 600; }
.option-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .9rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.option-list li > :first-child { flex: 1 1 140px; }
.option-list { margin-top: .6rem; }
.group { border: 1px solid var(--line); border-radius: 8px; padding: .7rem; margin-bottom: .7rem; }
.row-line { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .25rem 0; font-weight: 400; }
.row-line input { margin: 0; }
.hours { display: grid; grid-template-columns: auto 1fr 1fr; gap: .4rem .6rem; align-items: center; max-width: 420px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; }
.stats strong { display: block; font-size: 1.4rem; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 .9rem; border-left: 2px solid var(--line); }
.timeline li { padding: .35rem 0; }
.timeline li span { display: block; }

.funnel { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .55rem; }
.funnel li { display: grid; grid-template-columns: minmax(150px, 210px) 1fr 80px; gap: .7rem; align-items: center; }
.funnel .track { height: 14px; display: block; }
.funnel .bar { display: block; height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; }
.funnel .value { text-align: right; }

#wa-qr-img { display: block; background: #fff; border-radius: 8px; max-width: 100%; height: auto; margin: .5rem 0; }
details.card summary { cursor: pointer; }
details.card[open] summary { margin-bottom: .5rem; }
.verify button.link { text-align: left; }
#co-verify-msg:empty { display: none; }

.form-section { border: 0; border-top: 1px solid var(--line); padding: .9rem 0 .2rem; margin: 0 0 .4rem; }
.form-section:first-of-type { border-top: 0; padding-top: 0; }
.form-section legend { font-weight: 700; padding: 0 .5rem 0 0; }
.form-section .segmented { margin-bottom: .7rem; max-width: 520px; }
.form-section .form-grid { align-items: start; }
.form-section label.check { padding-top: 1.6rem; }
.form-section > label { margin-top: .7rem; }
.form-grid .span-2 { grid-column: span 2; }
.fiscal-form { display: block; }
input:disabled { background: #f0efeb; color: var(--muted); }
.status-ativa { background: #dcefff; color: #0b4f8a; }
.status-off-neutral { background: #eef0f2; color: var(--muted); }
.invoice-amount { font-size: 2rem; font-weight: 700; margin: .2rem 0; }
.row-actions { min-width: 150px; }
.row-actions > * { display: block; margin-bottom: .25rem; }
.danger-zone { border-color: #eab8b3; }
.status-teste { background: #e7f4ec; color: #17603a; }
.status-vencido { background: #fdf1d8; color: #7a4d00; }
.status-bloqueada { background: #fdecea; color: #8f1d13; }
.break { overflow-wrap: anywhere; }

/* Entrar e cadastro */
.auth { display: grid; place-items: center; min-height: 100dvh; padding: 16px; }
.narrow { width: 100%; max-width: 400px; }
.narrow h1 { margin-bottom: .6rem; }
.auth .stack { margin: .8rem 0; }

/* Cardápio */
.menu { background: #fafaf8; }
.menu-top { display: flex; align-items: center; gap: .8rem; padding: 1rem; background: var(--surface); }
.menu-top img { border-radius: 12px; object-fit: cover; }
.status { font-size: .85rem; font-weight: 600; margin: .1rem 0 0; }
.status.open { color: var(--ok); } .status.closed { color: var(--danger); }
.tabs { display: flex; gap: .3rem; overflow-x: auto; padding: .45rem 1rem; background: var(--surface); border-block: 1px solid var(--line); position: sticky; top: 0; z-index: 3; scrollbar-width: none; }
.tabs a { white-space: nowrap; padding: .3rem .75rem; border-radius: 999px; background: #f0efeb; color: var(--ink); text-decoration: none; font-size: .9rem; }
.menu-body { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.menu-body section { scroll-margin-top: 56px; margin-bottom: 1.4rem; }
.dish { display: flex; justify-content: space-between; gap: .8rem; width: 100%; text-align: left; font-weight: 400; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; margin-bottom: .55rem; }
.dish-text { display: flex; flex-direction: column; gap: .15rem; min-width: 0; align-items: flex-start; }
.dish-text .muted { font-size: .86rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dish .price { font-weight: 700; margin-top: .15rem; }
.dish img { width: 88px; height: 88px; object-fit: cover; border-radius: 8px; flex: none; background: #eeece6; }
.cart-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom)); width: min(728px, calc(100% - 32px)); justify-content: space-between; background: var(--brand); color: #fff; padding: .85rem 1rem; border-radius: 12px; box-shadow: 0 6px 20px rgb(0 0 0 / .22); z-index: 4; }

.sheet { border: 0; border-radius: 14px; padding: 1rem; width: min(560px, calc(100% - 16px)); max-height: calc(100dvh - 16px); color: inherit; }
.sheet::backdrop { background: rgb(0 0 0 / .45); }
.sheet-close { float: right; }
.sheet-close button { font-size: 1.4rem; min-height: 36px; padding: 0 .6rem; line-height: 1; }
#pd-image { width: 100%; max-height: 240px; object-fit: cover; border-radius: 10px; margin-bottom: .6rem; }
.option-group { border: 0; padding: 0; margin: 0 0 .9rem; }
.option-group legend { font-weight: 700; padding: 0; margin-bottom: .25rem; width: 100%; }
.option-group legend small { display: block; font-weight: 400; }
.option { display: flex; align-items: center; gap: .55rem; padding: .55rem 0; border-bottom: 1px solid var(--line); font-weight: 400; }
.option span:nth-of-type(2) { margin-left: auto; }
.sheet-foot { display: flex; gap: .7rem; margin-top: .9rem; position: sticky; bottom: 0; background: var(--surface); padding-top: .5rem; }
.sheet-foot .primary { flex: 1; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; }
.stepper button { min-width: 40px; padding: 0; }
.stepper span { min-width: 26px; text-align: center; font-weight: 600; }
.stepper.small button { min-width: 30px; min-height: 30px; }
.cart-items { list-style: none; margin: 0 0 .6rem; padding: 0; }
.cart-items li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.cart-items li > span:first-child { flex: 1; min-width: 0; }
.cart-items small { display: block; }
.upsell { display: flex; justify-content: space-between; width: 100%; font-weight: 500; border: 1px dashed var(--brand); margin-bottom: .4rem; }
.segmented { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.segmented legend { font-size: .88rem; font-weight: 500; padding: 0; margin-bottom: .25rem; }
.segmented label { flex: 1 1 90px; display: flex; gap: .4rem; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; padding: .55rem; font-weight: 500; }
.segmented label:has(input:checked) { border-color: var(--brand); background: #fdf1eb; }
.coupon { display: flex; gap: .5rem; align-items: flex-end; }
.coupon label { flex: 1; }
#co-coupon-msg:empty { display: none; }
.nudge { background: #fdf1eb; border-radius: 8px; padding: .5rem .7rem; font-size: .88rem; margin: .7rem 0; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: .2rem .6rem; margin: .7rem 0; }
.totals dd { margin: 0; text-align: right; }
.totals .grand { font-weight: 700; font-size: 1.1rem; padding-top: .3rem; }

/* Rastreio e entregador */
.narrow-page { max-width: 560px; margin: 0 auto; padding: 1rem; }
.tracking .menu-top { background: none; padding: 0 0 1rem; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { position: relative; padding: .4rem 0 .4rem 1.6rem; color: var(--muted); }
.steps li::before { content: ""; position: absolute; left: .2rem; top: .75rem; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.steps li.done { color: var(--ink); }
.steps li.done::before { background: var(--ok); }
.steps li.current { color: var(--ink); font-weight: 700; }
.steps li.current::before { background: var(--brand); box-shadow: 0 0 0 3px #f7d9c9; }
.steps time { font-weight: 400; }

/* Comanda térmica de 80 mm */
.ticket { background: #fff; color: #000; width: 72mm; margin: 0 auto; padding: 2mm; font: 12px/1.35 ui-monospace, Consolas, monospace; }
.ticket h1 { font-size: 15px; text-align: center; }
.ticket p { margin: 1px 0; overflow: hidden; }
.ticket .right { float: right; }
.ticket .big { font-size: 15px; font-weight: 700; }
.ticket .sub { padding-left: 10px; }
.ticket hr { border: 0; border-top: 1px dashed #000; margin: 5px 0; }
@media print {
  @page { size: 80mm auto; margin: 0; }
  .no-print { display: none !important; }
}

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar { flex: none; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; padding: .55rem .75rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { order: 3; flex: 1 0 100%; flex-direction: row; overflow-x: auto; }
  .who { flex-direction: row; align-items: center; margin-left: auto; padding: 0; border-top: 0; }
  .who .muted { display: none; }
  .wrap { padding: 1rem; width: 100%; }
  .bank-grid { grid-template-columns: 1fr; }
  .two, .grid-2 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .form-section label.check { padding-top: 0; }
  .funnel li { grid-template-columns: 1fr 70px; }
  .funnel .label { grid-column: 1 / -1; }
  .board { grid-template-columns: repeat(4, 82vw); }
  .sheet { margin: auto auto 0; width: 100%; max-width: none; border-radius: 14px 14px 0 0; max-height: 92dvh; }
}
