/* Kakau Bistrô: vitrine de chocolate, pedido em papel creme. */
:root {
  --choco-950: #2A160B;
  --choco-900: #3A2013;
  --choco-800: #4A2A18;
  --choco-700: #66391F;   /* marrom do logo */
  --choco-600: #7E4B2C;
  --cream: #F1E6D0;       /* creme do logo */
  --cream-2: #E4D3B4;
  --cream-dim: #C9B393;
  --cacau: #E8A93A;       /* cacau maduro: ações e estoque */
  --cacau-ink: #2A160B;
  --ok: #A9CC7E;
  --bad: #F08E6E;
  --paper: #FBF5EA;
  --paper-line: #E6D8C0;
  --ink: #2B170C;
  --ink-2: #6A513E;
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --font-d: 'Fredoka', ui-rounded, system-ui, sans-serif;
  --font-b: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--choco-900);
  color: var(--cream);
  font: 16px/1.5 var(--font-b);
}
img { max-width: 100%; display: block; }
a { color: var(--cacau); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--cacau); outline-offset: 2px; border-radius: 6px; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---------- topo ---------- */
.top { background: var(--choco-700); border-bottom: 1px solid var(--choco-600); }
.top-in { display: flex; gap: 14px; align-items: center; padding-top: 14px; padding-bottom: 14px; }
.mark { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--cream-dim); }
.brand { font: 600 28px/1 var(--font-d); letter-spacing: -0.02em; margin: 0; color: var(--cream); }
.tag { margin: 4px 0 0; color: var(--cream-2); font-size: 14px; }

/* ---------- status da loja ---------- */
.status {
  display: flex; gap: 14px; align-items: center;
  margin: 22px 0 6px; padding: 16px 18px;
  border-radius: var(--r-lg);
  background: var(--choco-800);
  border: 1px solid var(--choco-600);
}
.status .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; background: var(--cream-dim); }
.status.is-open .dot { background: var(--ok); box-shadow: 0 0 0 6px rgb(169 204 126 / .18); animation: pulse 2.4s ease-in-out infinite; }
.status.is-closed .dot { background: var(--bad); }
.status-title { margin: 0; font: 600 22px/1.15 var(--font-d); }
.status-sub { margin: 2px 0 0; color: var(--cream-2); font-size: 15px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgb(169 204 126 / 0); } }

.section-title { font: 500 34px/1.1 var(--font-d); letter-spacing: -0.02em; margin: 28px 0 16px; }
.empty { color: var(--cream-2); }

/* ---------- vitrine ---------- */
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.grid { gap: 12px; }

.card {
  background: var(--choco-800);
  border-radius: 18px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 104px 1fr;
  border: 1px solid rgb(241 230 208 / .06);
}
@media (min-width: 620px) { .card { grid-template-columns: 1fr; } }

.photo { position: relative; background: var(--choco-700); aspect-ratio: 1 / 1; }
@media (min-width: 620px) { .photo { aspect-ratio: 16 / 11; } }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.soldtag {
  display: none; position: absolute; inset: auto 10px 10px auto;
  background: var(--cream); color: var(--choco-900);
  font: 600 14px/1 var(--font-d); padding: 8px 12px; border-radius: 999px;
}
.card.sold-out .photo img { filter: grayscale(.85) brightness(.6); }
.card.sold-out .soldtag { display: block; }

.info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.info h3 { margin: 0; font: 500 17px/1.2 var(--font-d); }
.desc {
  margin: 0; color: var(--cream-2); font-size: 13px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.meter { height: 6px; border-radius: 99px; background: rgb(241 230 208 / .12); overflow: hidden; margin-top: 4px; }
.meter span { display: block; height: 100%; width: var(--fill, 0%); background: var(--cacau); border-radius: inherit; transition: width .6s ease; }
.left { margin: 0; font-size: 12px; color: var(--cream-dim); font-weight: 600; }
.card.sold-out .left { color: var(--bad); }

.buy { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 6px; }
.price { font: 600 17px/1 var(--font-d); color: var(--cream); white-space: nowrap; }
.card .step button { width: 36px; height: 40px; font-size: 19px; }
.card .step output { min-width: 18px; }
@media (max-width: 619px) { .buy { flex-wrap: wrap; } }

.add {
  background: var(--cacau); color: var(--cacau-ink);
  border: 0; border-radius: 999px; padding: 8px 14px; min-height: 40px;
  font-weight: 700; font-size: 14px;
}
.add:active { transform: scale(.97); }
.step { display: inline-flex; align-items: center; background: var(--cream); color: var(--ink); border-radius: 999px; }
.step button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 22px; font-weight: 600; color: var(--ink); border-radius: 50%; }
.step button:disabled { opacity: .3; cursor: not-allowed; }
.step output { min-width: 24px; text-align: center; font-weight: 700; }
.step.sm button { width: 36px; height: 36px; font-size: 18px; }

.foot { margin: 48px 0 120px; color: var(--cream-dim); font-size: 14px; }
.foot p { margin: 4px 0; }

/* ---------- barra da sacola ---------- */
.bag-bar {
  position: fixed; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border: 0; border-radius: 999px;
  background: var(--cacau); color: var(--cacau-ink);
  font-weight: 700; font-size: 17px;
  box-shadow: 0 12px 30px rgb(20 10 4 / .45);
  animation: rise .35s ease-out;
}
.bag-bar[hidden] { display: none; }
.bag-bar .count { display: inline-grid; place-items: center; min-width: 26px; height: 26px; margin-left: 6px; border-radius: 99px; background: var(--choco-900); color: var(--cream); font-size: 14px; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }

/* ---------- sacola / checkout: papel creme ---------- */
.sheet {
  border: 0; padding: 0; margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92dvh;
  border-radius: 24px 24px 0 0; background: var(--paper); color: var(--ink);
  color-scheme: light;
}
.sheet::backdrop { background: rgb(26 13 6 / .6); }
.sheet[open] { animation: up .28s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@media (min-width: 760px) {
  .sheet { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: 460px; border-radius: 24px 0 0 24px; }
  .sheet[open] { animation: side .28s ease-out; }
  @keyframes side { from { transform: translateX(40px); opacity: .4; } }
}
.sheet-in { padding: 0 20px 24px; }
.sheet-head { position: sticky; top: 0; z-index: 2; background: var(--paper); display: flex; justify-content: space-between; align-items: center; padding: 18px 0 10px; }
.sheet-head h2 { margin: 0; font: 500 28px/1 var(--font-d); }
.x { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--paper-line); background: #fff; font-size: 24px; line-height: 1; color: var(--ink); }

.lines { list-style: none; margin: 0 0 8px; padding: 0; }
.lines li { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 12px 0; border-bottom: 1px dashed var(--paper-line); }
.lines .ln { font-weight: 600; grid-column: 1 / -1; }
.lines .lp { text-align: right; font-weight: 700; white-space: nowrap; }
.lines .step { justify-self: start; }
.lines .step { background: #fff; border: 1px solid var(--paper-line); }
.lines .none { display: block; color: var(--ink-2); }

fieldset { border: 0; margin: 18px 0 0; padding: 0; }
legend { font: 500 19px/1.2 var(--font-d); margin-bottom: 8px; padding: 0; }
label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 10px 0 0; }
input:not([type=radio]):not([type=checkbox]), textarea, select {
  display: block; width: 100%; margin-top: 4px; padding: 12px 14px; min-height: 48px;
  border: 1px solid var(--paper-line); border-radius: var(--r-sm);
  background: #fff; color: var(--ink); font-size: 16px; font-weight: 500;
}
input:focus, textarea:focus, select:focus { border-color: var(--choco-700); outline: 2px solid rgb(102 57 31 / .25); outline-offset: 0; }
.row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.fee { margin: 12px 0 0; padding: 12px 14px; background: #fff; border-radius: var(--r-sm); border: 1px solid var(--paper-line); font-size: 14px; color: var(--ink-2); }
.fee.bad { border-color: var(--bad); color: #9A3412; }
.pay { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 14px; border: 1px solid var(--paper-line); background: #fff; border-radius: var(--r-sm); color: var(--ink); font-size: 16px; }
.pay small { flex-basis: 100%; padding-left: 30px; color: var(--ink-2); font-weight: 500; font-size: 13px; }
.pay input { width: 20px; height: 20px; accent-color: var(--choco-700); }
.pay:has(input:checked) { border-color: var(--choco-700); box-shadow: inset 0 0 0 1px var(--choco-700); }

.sum { margin-top: 20px; padding-top: 12px; border-top: 2px solid var(--ink); }
.sum p { display: flex; justify-content: space-between; margin: 6px 0; }
.sum .tot { font: 600 22px/1.2 var(--font-d); }
.err { background: #FDE7DF; color: #8A2C0D; padding: 12px 14px; border-radius: var(--r-sm); font-weight: 600; }
.cta {
  width: 100%; margin-top: 14px; min-height: 56px; border: 0; border-radius: 999px;
  background: var(--choco-700); color: var(--cream); font: 600 19px/1 var(--font-d);
}
.cta:disabled { opacity: .6; cursor: progress; }

/* ---------- página do pedido ---------- */
.ticket { max-width: 560px; margin: 24px auto 64px; background: var(--paper); color: var(--ink); border-radius: var(--r-lg); padding: 24px 20px; color-scheme: light; }
.ticket h1 { font: 500 30px/1.1 var(--font-d); margin: 0 0 4px; }
.ticket .code { font-weight: 700; color: var(--choco-700); }
.ticket .muted { color: var(--ink-2); }
.qr { display: grid; place-items: center; margin: 20px auto 8px; padding: 14px; width: min(280px, 100%); background: #fff; border-radius: var(--r-md); border: 1px solid var(--paper-line); }
.qr img, .qr canvas, .qr svg { width: 100%; height: auto; image-rendering: pixelated; }
.copy { display: flex; gap: 8px; margin-top: 10px; }
.copy input { font-family: ui-monospace, monospace; font-size: 13px !important; }
.copy button, .btn {
  border: 0; border-radius: 999px; padding: 12px 18px; min-height: 48px; font-weight: 700;
  background: var(--choco-700); color: var(--cream); white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.btn.wa { background: #1F7A4D; color: #fff; width: 100%; margin-top: 16px; font-size: 17px; }
.btn.ghost { background: transparent; color: var(--choco-700); border: 1px solid var(--paper-line); }
.items { list-style: none; padding: 0; margin: 16px 0; }
.items li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--paper-line); }
.items li > :last-child { white-space: nowrap; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--cream-2); color: var(--ink); }
.badge.aguardando_pagamento, .badge.novo { background: #FCE3B0; color: #6B3F00; }
.badge.confirmado { background: #DDEBC8; color: #2F4A12; }
.badge.saiu { background: #D6E4F5; color: #173A66; }
.badge.entregue { background: #E5E5E5; color: #333; }
.badge.cancelado { background: #F8D4C8; color: #7A230A; }

/* ---------- microinterações (resposta ao toque/ponteiro) ---------- */
html { touch-action: manipulation; }
.sheet { overscroll-behavior: contain; }
.photo { overflow: hidden; }
.photo img { transition: transform .35s ease; }
.add, .cta, .btn, .bag-bar, .copy button, .switch, .x, .step button {
  transition: transform .15s ease, background-color .2s ease, box-shadow .2s ease, filter .2s ease;
}
@media (hover: hover) {
  .card:hover .photo img { transform: scale(1.025); }
  .add:hover, .cta:hover:not(:disabled), .btn:hover:not(:disabled), .copy button:hover, .switch:hover { transform: translateY(-1px); filter: brightness(1.06); }
  .bag-bar:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgb(20 10 4 / .5); }
  .step button:hover:not(:disabled), .x:hover { background: rgb(0 0 0 / .06); }
  a:hover { text-decoration-thickness: 2px; }
}
.add:active, .cta:active:not(:disabled), .btn:active:not(:disabled), .bag-bar:active, .copy button:active, .switch:active, .step button:active:not(:disabled) {
  transform: translateY(0) scale(.97);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- revisão de diretrizes de interface ---------- */
html { -webkit-tap-highlight-color: rgb(232 169 58 / .2); }
h1, h2, h3, .status-title { text-wrap: balance; }
.desc, .tag, .status-sub { text-wrap: pretty; }
.price, .lp, .sum, .items, .ototal, .kpis strong, .counts dd, .big-left strong, .bag-bar strong { font-variant-numeric: tabular-nums; }
.info h3, .lines .ln { overflow-wrap: anywhere; }
