:root {
  --bg: #FBF5EE;
  --card: #FFFFFF;
  --ink: #3A2621;
  --ink2: #7A625A;
  --line: #EEDFD3;
  --brand: #D6456B;
  --brand-d: #B8335A;
  --brand-l: #FCE7EC;
  --wa: #1FA855;
  --ok: #2E9A6B;
  --warn: #C98A12;
  --err: #C8423A;
  --r: 16px;
  --sh: 0 1px 2px rgba(58, 38, 33, .06), 0 6px 20px rgba(58, 38, 33, .06);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 96px;
}
a { color: var(--brand-d); }
h1, h3, h4 { margin: 0; }
h1 { font: 700 30px/1.15 Fraunces, Georgia, serif; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.muted { color: var(--ink2); margin: 4px 0 10px; }
.hint { color: var(--ink2); font-size: 13px; margin: 6px 0 10px; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--brand-d); text-transform: uppercase; letter-spacing: .06em; }
.mt { margin-top: 22px; }

/* topo */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px; background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.marca .logo { width: 38px; height: 38px; display: grid; place-items: center; background: var(--brand-l); border-radius: 12px; font-size: 20px; flex: none; }
.marca b { display: block; font: 700 18px/1.1 Fraunces, Georgia, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marca small { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #D9C3B5; display: inline-block; }
.dot.ok { background: var(--ok); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: #fff; border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 12px; font-weight: 600; color: var(--ink2); text-decoration: none; border-radius: 12px; }
.tabbar a span { font-size: 19px; line-height: 1; }
.tabbar a.ativo { color: var(--brand-d); background: var(--brand-l); }
.tabbar a.novo span { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 18px; font-weight: 700; }

main { max-width: 980px; margin: 0 auto; padding: 18px 16px; }
#banner .banner { max-width: 980px; margin: 12px auto 0; padding: 10px 14px; border-radius: 12px; background: #FFF4DB; color: #6B4E0E; font-size: 13.5px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; width: calc(100% - 32px); }
#banner .banner.erro { background: #FDE5E2; color: #7A231D; }

.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 6px 0 18px; }
.hero .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.voltar { display: inline-block; margin-bottom: 6px; font-weight: 600; text-decoration: none; font-size: 14px; }

/* botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; border: 1px solid transparent;
  font: 600 14.5px/1 Inter, system-ui, sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .06s, background .15s, box-shadow .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .7; cursor: wait; }
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(214, 69, 107, .28); }
.btn.primary:hover { background: var(--brand-d); }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: #DCC4B4; }
.btn.wa { background: var(--wa); color: #fff; }
.btn.perigo { background: var(--err); color: #fff; }
.perigo-txt { color: var(--err) !important; }
.btn.sm { padding: 8px 12px; font-size: 13.5px; border-radius: 10px; }
.btn.bloco { width: 100%; margin-top: 12px; }
.btn img { display: block; }
.x { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink2); font-size: 20px; line-height: 1; cursor: pointer; flex: none; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--card); border-radius: var(--r); padding: 14px; box-shadow: var(--sh); }
.stat span { display: block; font-size: 12.5px; color: var(--ink2); font-weight: 500; }
.stat strong { font: 700 22px/1.2 Fraunces, Georgia, serif; }

.busca input { width: 100%; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 13px Inter, sans-serif; cursor: pointer; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* lista */
.dia { display: flex; align-items: center; gap: 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink2); margin: 20px 2px 8px; }
.dia span { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.dia.atraso { color: var(--err); }
.card { display: block; background: var(--card); border-radius: var(--r); padding: 13px 14px; box-shadow: var(--sh); color: var(--ink); text-decoration: none; margin-bottom: 10px; border-left: 4px solid var(--line); transition: transform .08s; }
.card:hover { transform: translateY(-1px); }
.pedido .l1 { display: flex; align-items: center; gap: 10px; }
.pedido .l1 strong { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15.5px; }
.pedido .hora { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand-d); }
.pedido .itens { color: var(--ink2); font-size: 13.5px; margin: 4px 0 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pedido .l3 { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.pedido .valor { margin-left: auto; font-weight: 700; }

.pill, .pay { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-novo { background: #EEE9FB; color: #5B45A8; }
.st-confirmado { background: #E3EEFD; color: #2459B0; }
.st-producao { background: #FFF1D1; color: #8A5D00; }
.st-pronto { background: #DDF4E8; color: #1C7A4E; }
.st-entregue { background: #EEEAE7; color: #6A5A54; }
.st-cancelado { background: #FBE2E0; color: #A3322A; }
.st-borda-novo { border-left-color: #8E7CD8; }
.st-borda-confirmado { border-left-color: #4F86DB; }
.st-borda-producao { border-left-color: #E8B23A; }
.st-borda-pronto { border-left-color: #3FB57D; }
.st-borda-entregue { border-left-color: #C9BBB4; }
.st-borda-cancelado { border-left-color: #E28C85; }
.pay-pago { background: #DDF4E8; color: #1C7A4E; }
.pay-sinal { background: #FFF1D1; color: #8A5D00; }
.pay-pend { background: #FBE2E0; color: #A3322A; }

.vazio { text-align: center; padding: 48px 16px; color: var(--ink2); }
.vazio .emoji { font-size: 44px; }
.carregando { display: grid; place-items: center; padding: 80px; }

/* painéis */
.painel { background: var(--card); border-radius: var(--r); padding: 18px; box-shadow: var(--sh); margin-bottom: 14px; }
.painel.destaque { background: linear-gradient(135deg, #fff, #FFF3F6); }
.lado { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.lado h3 { margin: 0; }
.cols { display: grid; gap: 14px; }
.cols .painel { margin: 0; }
.cols + .painel { margin-top: 14px; }
.grande { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.obs { margin-top: 12px; padding: 10px 12px; background: #FFF8EC; border-radius: 10px; font-size: 14px; }
.painel .btn.sm { margin-top: 6px; }

.stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; position: relative; }
.step { background: none; border: 0; padding: 4px 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; font: 600 11.5px/1.2 Inter, sans-serif; color: var(--ink2); text-align: center; }
.step .bolinha { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #F4ECE5; color: var(--ink2); font-weight: 700; transition: .15s; }
.step.feito .bolinha { background: #DDF4E8; color: var(--ok); }
.step.atual { color: var(--ink); }
.step.atual .bolinha { background: var(--brand); color: #fff; box-shadow: 0 0 0 4px var(--brand-l); }
.step:hover .bolinha { transform: scale(1.06); }

.itens-t { width: 100%; border-collapse: collapse; font-size: 14px; }
.itens-t td { padding: 6px 0; border-bottom: 1px dashed var(--line); vertical-align: top; }
.itens-t td:first-child { width: 44px; color: var(--ink2); font-weight: 600; }
.itens-t td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.itens-t .sub td { color: var(--ink2); }
.itens-t .tot td { font-weight: 700; border-bottom: 0; padding-top: 10px; }
.itens-t .falta td { font-weight: 700; color: var(--err); border-bottom: 0; }
.receber { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.receber input { flex: 1; min-width: 120px; }
.receber .btn { margin: 0; }

.wa-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wa-chip { border-color: #BFE6CD; background: #F1FBF4; color: #146B38; }
.wa-chip::before { content: '💬 '; }
.hist { list-style: none; padding: 0; margin: 14px 0 0; font-size: 12.5px; color: var(--ink2); }
.hist li { padding: 4px 0; border-top: 1px solid var(--line); }
.hist span { font-variant-numeric: tabular-nums; font-weight: 600; margin-right: 4px; }

.acoes { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.acoes.fim { justify-content: flex-start; }
.acoes.sticky { position: sticky; bottom: 76px; background: linear-gradient(transparent, var(--bg) 30%); padding: 14px 0 4px; margin: 0; }
.acoes-l { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.acoes-l .btn.sm { margin-top: 0; }

/* formulários */
.form fieldset { border: 0; background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--sh); margin: 0 0 14px; }
.form legend { font-weight: 700; font-size: 15px; padding: 0; float: left; width: 100%; margin-bottom: 10px; }
.form legend + * { clear: both; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink2); margin-bottom: 12px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #FFFCF9; color: var(--ink); font: 400 15px/1.35 Inter, system-ui, sans-serif;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-l); background: #fff; }
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.span2 { grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; color: var(--ink); font-size: 14px; margin-top: 8px; }
.check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--brand); }

.item-head, .item-row { display: grid; grid-template-columns: 58px 1fr 92px 34px; gap: 8px; align-items: center; }
.item-head { font-size: 12px; font-weight: 600; color: var(--ink2); margin-bottom: 4px; }
.item-row { margin-bottom: 8px; }
.item-row input { margin: 0; }
.card-row { display: grid; grid-template-columns: 1fr 100px 34px; gap: 8px; margin-bottom: 8px; align-items: center; }
.card-row input { margin: 0; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.seg.tres { grid-template-columns: repeat(3, 1fr); }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 44px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.seg input:checked + span { border-color: var(--brand); background: var(--brand-l); color: var(--brand-d); }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-l); }

.resumo { background: #FFF8F2; border-radius: 12px; padding: 10px 14px; }
.resumo div { display: flex; justify-content: space-between; padding: 3px 0; font-size: 14px; }
.resumo .falta { color: var(--err); }

.aviso { background: #FFF4DB; color: #6B4E0E; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; }
.ok-t { color: var(--ok); font-weight: 600; }
.erro-t { color: var(--err); font-weight: 600; word-break: break-word; }
.qr { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.qr img { width: 220px; height: 220px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }

/* agenda */
.prod { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; }
.prod li { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.prod b { color: var(--brand-d); margin-right: 6px; }
.semana { display: grid; gap: 10px; }
.dia-card { background: var(--card); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--sh); }
.dia-card.hoje { outline: 2px solid var(--brand); }
.dia-card.livre { background: transparent; box-shadow: none; border: 1px dashed var(--line); padding: 8px 14px; }
.dia-t { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink2); margin-bottom: 6px; }
.dia-card.livre .dia-t { margin: 0; }
.dia-t b { color: var(--ink); }
.livre-t { display: none; }
.mini { display: block; padding: 7px 10px; border-left: 3px solid var(--line); margin-top: 6px; border-radius: 4px 8px 8px 4px; background: #FFFAF6; text-decoration: none; color: var(--ink); font-size: 14px; font-weight: 600; }
.mini span { color: var(--brand-d); font-variant-numeric: tabular-nums; }
.mini em { display: block; font-style: normal; font-weight: 400; color: var(--ink2); font-size: 12.5px; }

/* modal */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(40, 24, 20, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: #fff; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); animation: sobe .2s ease-out; }
.sheet h3 { font: 700 20px/1.2 Fraunces, Georgia, serif; margin: 2px 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.sheet .msg { font-size: 14.5px; line-height: 1.5; background: #F3FBF5; border-color: #CDEBD7; }
.lista-wa { display: grid; gap: 8px; }
.lista-wa .btn { margin: 0; justify-content: flex-start; }
.lista-wa .btn.feito { opacity: .5; }
@keyframes sobe { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* toasts */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 88px; z-index: 60; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--ink); color: #fff; padding: 12px 14px; border-radius: 12px; font-size: 14px; display: flex; align-items: center; gap: 12px; justify-content: space-between; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); animation: sobe .2s; transition: opacity .3s; }
.toast.erro { background: #8E2B24; }
.toast.sai { opacity: 0; }
.toast button { background: rgba(255, 255, 255, .15); color: #fff; border: 0; border-radius: 8px; padding: 6px 10px; font-weight: 600; cursor: pointer; }

.spin { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: gira .7s linear infinite; }
.carregando .spin { width: 32px; height: 32px; color: var(--brand); }
@keyframes gira { to { transform: rotate(360deg); } }

.hide-m { display: none; }
[hidden] { display: none !important; }

@media (min-width: 760px) {
  body { padding-bottom: 40px; }
  .hide-m { display: inline-flex; }
  .tabbar { position: static; display: flex; gap: 4px; background: none; border: 0; padding: 0; }
  .tabbar a { flex-direction: row; gap: 8px; padding: 9px 14px; font-size: 14px; }
  .tabbar a span { font-size: 16px; }
  .tabbar a.novo { background: var(--brand); color: #fff; }
  .tabbar a.novo span { width: auto; height: auto; background: none; font-size: 16px; }
  .tabbar a.novo.ativo { background: var(--brand-d); color: #fff; }
  .topbar { padding: 12px 28px; background: rgba(251, 245, 238, .92); backdrop-filter: blur(10px); }
  main { padding: 24px 28px; }
  h1 { font-size: 36px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .cols { grid-template-columns: 1fr 1fr; }
  .backdrop { align-items: center; }
  .sheet { border-radius: 20px; }
  .acoes.sticky { bottom: 0; }
  #toasts { bottom: 24px; }
  .semana { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .seg.tres span { font-size: 12px; }
  .item-head, .item-row { grid-template-columns: 50px 1fr 76px 34px; gap: 6px; }
}
