:root {
  --brand: #E4572E;
  --bg: #F6F4F1;
  --card: #FFFFFF;
  --ink: #1D1B19;
  --ink-2: #5C5751;
  --ink-3: #8F8982;
  --line: #E7E2DC;
  --ok: #1F9D55;
  --err: #D93F3F;
  --wa: #1FA855;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(29,27,25,.06), 0 4px 16px rgba(29,27,25,.05);
  --brand-soft: color-mix(in srgb, var(--brand) 12%, white);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100dvh; line-height: 1.45; }
body.no-scroll { overflow: hidden; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; }
.grow { flex: 1; width: 100%; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap, .row-end.wrap { flex-wrap: wrap; }
.row-end { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 8px; }
.row-center { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ic { display: inline-flex; }
.ic svg { width: 20px; height: 20px; }
.link { color: var(--brand); text-decoration: none; font-weight: 600; }

/* ---------- botões ---------- */
.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;
  font-weight: 650; font-size: .95rem; text-decoration: none; white-space: nowrap;
  transition: transform .08s ease, background .15s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-ghost { background: var(--card); border-color: var(--line); }
.btn-ghost:hover { background: #FBFAF8; }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, white); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .85rem; border-radius: 10px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:disabled { opacity: .35; }
.icon-btn.danger { color: var(--err); }

/* ---------- formulários ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: .85rem; font-weight: 650; color: var(--ink-2); }
.field-hint { font-size: .8rem; color: var(--ink-3); }
.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; font: inherit; font-size: 16px; color: var(--ink);
}
textarea.input { resize: vertical; min-height: 64px; }
.input:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
.input:disabled { background: #F3F1EE; color: var(--ink-3); }
.input-sm { min-height: 36px; padding: 6px 10px; font-size: .9rem; }
.input.color { padding: 4px; height: 44px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: center; font-size: .95rem; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.form-err { color: var(--err); font-size: .9rem; min-height: 1em; margin: 0; }
.notice { background: #FFF6E5; border: 1px solid #F3DDB0; color: #7A5300; padding: 10px 12px; border-radius: 12px; margin: 0; }

.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: #D6D1CB; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(18px); }

/* ---------- loading / vazio ---------- */
.loading { min-height: 60vh; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; color: var(--ink-3); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-page { min-height: 80vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px; }
.empty-page p { margin: 0; color: var(--ink-2); max-width: 360px; }
.big-ic { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.big-ic svg { width: 32px; height: 32px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 32px 16px; }
.empty p { margin: 0; }

/* ---------- toast ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: .9rem; box-shadow: var(--shadow); animation: up .2s ease; transition: opacity .4s; }
.toast-err { background: var(--err); }
.toast.out { opacity: 0; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* ---------- modal / sheet ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20,18,16,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.overlay.out { opacity: 0; transition: opacity .18s; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 92dvh; border-radius: 22px 22px 0 0; display: flex; flex-direction: column; animation: sheet .22s cubic-bezier(.2,.8,.2,1); }
.sheet-wide { max-width: 760px; }
@keyframes sheet { from { transform: translateY(40px); opacity: .4; } }
@media (min-width: 640px) { .overlay { align-items: center; } .sheet { border-radius: 22px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 8px 20px; }
.sheet-head h3 { font-size: 1.1rem; }
.sheet-body { padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; }
.confirm-text { margin: 0 0 12px; }

/* =====================================================================
   PÁGINA PÚBLICA
   ===================================================================== */
.store { max-width: 640px; margin: 0 auto; padding-bottom: 32px; }
.store.has-cart { padding-bottom: 110px; }
.cover { height: 190px; background: var(--brand); position: relative; overflow: hidden; }
@media (min-width: 640px) { .cover { border-radius: 0 0 22px 22px; height: 220px; } }
.cover-plain { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #1d1b19)); height: 130px; }
.cover-img { width: 100%; height: 100%; object-fit: cover; }
.profile { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 20px; margin-top: -52px; position: relative; gap: 6px; }
.logo { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; border: 4px solid var(--bg); background: #fff; box-shadow: var(--shadow); }
.logo-letter { display: grid; place-items: center; font-size: 2.6rem; font-weight: 800; color: var(--brand); }
.store-name { font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; margin-top: 6px; }
.tagline { margin: 0; color: var(--ink-2); max-width: 460px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: .85rem; font-weight: 650; padding: 5px 11px; border-radius: 99px; margin-top: 4px; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.is-open { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, white); }
.status.is-closed { color: var(--ink-2); background: #ECE8E3; }
.table-chip { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--brand); background: var(--brand-soft); border-radius: 99px; padding: 4px 12px 4px 8px; font-size: .9rem; }
.table-chip svg { width: 16px; height: 16px; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 20px 16px 4px; }
.actions.odd > :first-child { grid-column: 1 / -1; }
.action { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 54px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); text-decoration: none; font-weight: 700; box-shadow: var(--shadow); transition: transform .08s; }
.action:active { transform: scale(.98); }
.action-wa { background: var(--wa); color: #fff; border-color: var(--wa); }
.action-review { background: #FFF8E1; border-color: #F4DE9A; color: #6E4E00; }
.action-review svg { fill: #F5B400; stroke: #C98F00; }

.section-title { font-size: 1.25rem; font-weight: 800; padding: 28px 16px 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px 12px; position: sticky; top: 0; background: var(--bg); z-index: 5; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 8px 14px; font-weight: 650; font-size: .9rem; }
.chip:active { background: var(--brand-soft); }
.cat-group { scroll-margin-top: 60px; }
.cat-title { font-size: 1rem; font-weight: 750; color: var(--ink-2); padding: 14px 16px 8px; text-transform: none; }
.products { display: flex; flex-direction: column; gap: 10px; padding: 0 16px; }
.product { display: flex; gap: 12px; background: var(--card); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); cursor: pointer; min-height: 96px; }
.product:focus-visible { outline: 2px solid var(--brand); }
.product.unavailable { opacity: .55; }
.product-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.product h4 { font-size: 1rem; font-weight: 700; }
.product-desc { margin: 0; color: var(--ink-2); font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-foot { margin-top: auto; display: flex; gap: 8px; align-items: center; }
.price { font-weight: 800; color: var(--ink); }
.tag-off { font-size: .75rem; font-weight: 700; color: var(--err); background: color-mix(in srgb, var(--err) 10%, white); padding: 2px 8px; border-radius: 99px; margin: 0; display: inline-block; }
.product-img { position: relative; width: 96px; height: 96px; flex: none; border-radius: 12px; overflow: visible; }
.product-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; background: #EEE; }
.product-img.no-img { width: 44px; height: auto; }
.add-btn { position: absolute; right: -4px; bottom: -4px; width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--card); background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.no-img .add-btn { position: static; margin-top: auto; }
.add-btn svg { width: 18px; height: 18px; stroke-width: 2.6; }
.product-img.no-img { display: flex; align-items: flex-end; }

.product-detail { display: flex; flex-direction: column; gap: 12px; }
.detail-img { width: 100%; max-height: 320px; object-fit: cover; border-radius: 14px; }
.detail-desc { margin: 0; color: var(--ink-2); white-space: pre-line; }
.detail-price { margin: 0; font-size: 1.3rem; font-weight: 800; }
.detail-actions { display: flex; gap: 10px; align-items: center; }
.detail-actions .btn { justify-content: space-between; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; height: 44px; flex: none; }
.stepper button { width: 42px; height: 100%; border: 0; background: none; display: grid; place-items: center; color: var(--brand); }
.stepper svg { width: 18px; height: 18px; stroke-width: 2.4; }
.qty-n { min-width: 24px; text-align: center; font-weight: 750; }
.stepper.small { height: 36px; }
.stepper.small button { width: 34px; }

.info { padding-bottom: 8px; }
.info > p, .info .hours { margin: 0 16px 12px; }
.desc { white-space: pre-line; color: var(--ink-2); }
.info-line { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); }
.info-line .ic { color: var(--brand); flex: none; margin-top: 1px; }
.info-line a { text-decoration: underline; text-underline-offset: 3px; }
.hours table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); font-size: .92rem; }
.hours td { padding: 9px 14px; border-bottom: 1px solid var(--line); }
.hours tr:last-child td { border-bottom: 0; }
.hours td:last-child { text-align: right; color: var(--ink-2); }
.hours tr.today td { font-weight: 750; color: var(--ink); background: var(--brand-soft); }

.foot { text-align: center; padding: 28px 16px 8px; font-size: .8rem; color: var(--ink-3); }
.foot a { text-decoration: none; }

.cart-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); width: min(608px, calc(100% - 28px)); z-index: 20;
  display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 0 18px; border: 0; border-radius: 16px; background: var(--brand); color: #fff; font-weight: 700; font-size: 1rem; box-shadow: 0 8px 24px rgba(0,0,0,.22); animation: up .2s; }
.cart-bar > span:nth-child(2) { flex: 1; text-align: left; }
.cart-count { background: rgba(255,255,255,.25); border-radius: 99px; min-width: 28px; height: 28px; display: grid; place-items: center; font-size: .9rem; }

.checkout { display: flex; flex-direction: column; gap: 14px; }
.cart-lines { display: flex; flex-direction: column; }
.cart-line { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-line-name { display: flex; flex-direction: column; min-width: 0; }
.cart-line-name span { font-weight: 650; }
.cart-line-name small { color: var(--ink-3); }
.cart-line-total { font-weight: 700; min-width: 76px; text-align: right; }
.cart-total { display: flex; justify-content: space-between; font-size: 1.1rem; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg-opt { flex: 1; min-width: 130px; }
.seg-opt input { position: absolute; opacity: 0; }
.seg-opt span { display: block; text-align: center; padding: 11px 10px; border: 1px solid var(--line); border-radius: 12px; font-weight: 650; font-size: .9rem; cursor: pointer; }
.seg-opt input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--brand); }

/* ---------- landing / login ---------- */
.landing { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 14px; }
.landing h1 { font-size: 2rem; font-weight: 850; }
.lead { max-width: 440px; color: var(--ink-2); margin: 0 0 8px; font-size: 1.05rem; }
.landing-ic { width: 76px; height: 76px; border-radius: 24px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.landing-ic svg { width: 40px; height: 40px; }
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.login { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 28px 24px; }
.login h1 { font-size: 1.5rem; font-weight: 800; }
.login .muted { margin: -8px 0 6px; }
.login .link { text-align: center; }

/* =====================================================================
   PAINEL / ADMIN
   ===================================================================== */
.app-shell { max-width: 820px; margin: 0 auto; padding-bottom: 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; }
.topbar-title { display: flex; flex-direction: column; min-width: 0; }
.topbar-title strong { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title small { color: var(--ink-3); }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 10; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; border: 0; background: none; padding: 12px 12px; font-weight: 650; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-body { padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.tab-body > h2, .card > h2, .form > h2 { font-size: 1.15rem; font-weight: 800; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.panel-head p { margin: 2px 0 0; }
.meter { height: 6px; width: 180px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

.cat-manager summary { font-weight: 700; cursor: pointer; }
.cat-manager[open] summary { margin-bottom: 8px; }
.cat-manager p { margin: 0 0 10px; }
.cat-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.cat-row { display: flex; gap: 6px; align-items: center; }
.cat-row .input { min-height: 38px; padding: 6px 10px; }
.prod-group { display: flex; flex-direction: column; gap: 8px; }
.prod-group .cat-title { padding: 6px 2px 0; }
.prod-row { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px; padding: 10px; box-shadow: var(--shadow); }
.prod-row.off .prod-info, .prod-row.off .prod-thumb { opacity: .5; }
.prod-thumb { width: 52px; height: 52px; border-radius: 10px; background: #F0EDE9; display: grid; place-items: center; color: var(--ink-3); flex: none; overflow: hidden; }
.prod-thumb img { width: 100%; height: 100%; object-fit: cover; }
.prod-info { flex: 1; min-width: 0; display: flex; flex-direction: column; cursor: pointer; }
.prod-info strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod-actions { display: flex; gap: 4px; }
@media (max-width: 480px) { .prod-actions .icon-btn:not(:last-child) { display: none; } }

.img-field { display: flex; gap: 12px; align-items: center; }
.img-pick { background: #F0EDE9; display: grid; place-items: center; color: var(--ink-3); overflow: hidden; flex: none; cursor: pointer; position: relative; }
.img-pick img { width: 100%; height: 100%; object-fit: cover; }
.img-pick.busy::after { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.7) center/28px no-repeat; }
.img-pick.busy::before { content: ""; position: absolute; width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; z-index: 1; }
.img-square { width: 96px; height: 96px; border-radius: 14px; }
.img-round { width: 88px; height: 88px; border-radius: 50%; }
.img-wide { width: 150px; height: 84px; border-radius: 12px; }
.img-empty svg { width: 28px; height: 28px; }

.hours-edit { display: flex; flex-direction: column; gap: 8px; }
.hour-row { display: grid; grid-template-columns: 130px 1fr auto 1fr; gap: 8px; align-items: center; }
@media (max-width: 420px) { .hour-row { grid-template-columns: 1fr 1fr auto 1fr; font-size: .9rem; } .hour-row .check { grid-column: 1 / -1; } }

.tag-card { display: flex; flex-direction: column; gap: 12px; }
.tag-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag-head strong { font-size: 1.1rem; }

.store-card { display: flex; flex-direction: column; gap: 12px; }
.store-card.off { opacity: .7; }
.store-card-head { display: flex; justify-content: space-between; gap: 12px; }
.store-card-head > div { display: flex; flex-direction: column; gap: 2px; }
.store-card-head p { margin: 0; }
.store-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; color: var(--ink-2); }
.creds { background: #F6F4F1; border-radius: 12px; padding: 14px; white-space: pre-wrap; word-break: break-all; font-size: .88rem; margin: 0; max-height: 50vh; overflow: auto; }
.seg.compact { gap: 4px; background: #ECE8E3; padding: 4px; border-radius: 12px; }
.seg-btn { border: 0; background: none; padding: 7px 12px; border-radius: 9px; font-weight: 650; font-size: .88rem; color: var(--ink-2); }
.seg-btn.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.tag-table { display: flex; flex-direction: column; gap: 8px; }
.tag-row { display: grid; grid-template-columns: 1fr 200px auto; gap: 10px; align-items: center; background: var(--card); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow); }
.tag-row p { margin: 2px 0 0; }
@media (max-width: 560px) { .tag-row { grid-template-columns: 1fr auto; } .tag-row select { grid-column: 1 / -1; grid-row: 2; } }
