:root {
  --p: #7c3aed; --p-soft: color-mix(in srgb, var(--p) 12%, white); --p-dark: color-mix(in srgb, var(--p) 80%, black);
  --bg: #f6f6f9; --card: #fff; --text: #1a1a24; --muted: #6b6b7b; --line: #e8e8ef;
  --ok: #16a34a; --warn: #d97706; --bad: #dc2626; --info: #2563eb;
  --r: 14px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(20,20,40,.06);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); min-height: 100vh; }
img { max-width: 100%; display: block; }
a { color: var(--p); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .tiny { font-size: .75rem; }
.center { text-align: center; } .right { text-align: right; }
.row { display: flex; gap: 10px; align-items: center; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; } .stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* layout */
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 560px; margin: 0 auto; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .in { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); min-width: 0; }
.brand img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; }
.brand .mono { width: 38px; height: 38px; border-radius: 10px; background: var(--p); color: #fff; display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.has-nav { padding-bottom: calc(76px + var(--safe-b)); }
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line);
  display: flex; padding-bottom: var(--safe-b); }
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 9px; color: var(--muted); font-size: .72rem; font-weight: 600; position: relative; }
.bottomnav a svg { width: 24px; height: 24px; }
.bottomnav a.on { color: var(--p); }
.badge { position: absolute; top: 3px; left: calc(50% + 6px); background: var(--bad); color: #fff; border-radius: 99px; font-size: .68rem; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; }
@media (min-width: 900px) {
  .bottomnav { left: 50%; transform: translateX(-50%); max-width: 560px; bottom: 14px; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
}

/* cards & forms */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 12px; }
.card h3 { margin-bottom: 12px; }
label { display: block; font-size: .85rem; font-weight: 600; margin: 0 0 5px; color: #333; }
.field { margin-bottom: 12px; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 11px; background: #fff; color: var(--text); outline: none; transition: border .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--p); }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--p); flex-shrink: 0; }
input[type=color] { padding: 3px; height: 46px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.grid3 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 10px; }
.grid2 > *, .grid3 > *, .row > * { min-width: 0; }
input, select, textarea { min-width: 0; }
label { overflow-wrap: anywhere; }
@media (max-width: 380px) { .grid2 { grid-template-columns: 1fr; gap: 0; } }
.pagehead { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.pagehead h1 { margin: 0; font-size: 1.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer;
  background: var(--p); color: #fff; transition: transform .08s, opacity .15s; text-align: center; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn.block { width: 100%; } .btn.lg { padding: 15px 20px; font-size: 1.05rem; }
.btn.sm { padding: 7px 12px; font-size: .85rem; border-radius: 10px; }
.btn.ghost { background: var(--p-soft); color: var(--p-dark); }
.btn.line { background: #fff; color: var(--text); border: 1.5px solid var(--line); }
.btn.ok { background: var(--ok); } .btn.danger { background: var(--bad); } .btn.wa { background: #25d366; }
.iconbtn { border: 0; background: transparent; padding: 8px; border-radius: 10px; cursor: pointer; color: var(--text); display: grid; place-items: center; }
.iconbtn svg { width: 22px; height: 22px; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 13px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; margin-bottom: 8px; }
.option { font-size: .95rem; font-weight: 400; color: var(--text); line-height: 1.35; }
.option b { font-weight: 700; } .option .small { margin-top: 2px; }
.option:has(input:checked) { border-color: var(--p); background: var(--p-soft); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; border: 1.5px solid var(--line); background: #fff; border-radius: 99px; padding: 7px 14px; font-weight: 600; font-size: .88rem; cursor: pointer; color: var(--text); }
.chip.on { background: var(--p); border-color: var(--p); color: #fff; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: .75rem; font-weight: 700; background: #eee; color: #444; white-space: nowrap; }
.pill.novo { background: #dbeafe; color: #1d4ed8; } .pill.pago { background: #dcfce7; color: #15803d; }
.pill.separando { background: #fef3c7; color: #b45309; } .pill.enviado { background: #ede9fe; color: #6d28d9; }
.pill.entregue { background: #d1fae5; color: #047857; } .pill.cancelado { background: #fee2e2; color: #b91c1c; }
.pill.pendente { background: #fff7ed; color: #c2410c; } .pill.aprovado { background: #dcfce7; color: #15803d; }

/* produtos */
.pgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .pgrid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .pgrid { grid-template-columns: repeat(4, 1fr); } }
.pcard { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; color: var(--text); position: relative; }
.pcard .img { aspect-ratio: 1; background: #f0f0f4 center/cover no-repeat; position: relative; }
.pcard .info { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.pcard .name { font-size: .9rem; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.price { font-weight: 800; font-size: 1.05rem; color: var(--text); }
.old { text-decoration: line-through; color: var(--muted); font-size: .8rem; font-weight: 500; }
.tag { position: absolute; top: 8px; left: 8px; background: var(--bad); color: #fff; font-weight: 800; font-size: .72rem; padding: 3px 7px; border-radius: 7px; }
.tag.out { background: #333; }
.addfab { position: absolute; right: 8px; bottom: 8px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--p); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 3px 10px rgba(0,0,0,.2); }
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: var(--r); background: #f0f0f4; }
.gallery::-webkit-scrollbar { display: none; }
.gallery img { flex: 0 0 100%; aspect-ratio: 1; object-fit: cover; scroll-snap-align: center; }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #ccc; } .dots i.on { background: var(--p); width: 18px; border-radius: 9px; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.stepper button { width: 38px; height: 38px; border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--p); }
.stepper span { min-width: 30px; text-align: center; font-weight: 700; }
.thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: #f0f0f4; flex-shrink: 0; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.sumrow { display: flex; justify-content: space-between; padding: 4px 0; }
.sumrow.total { font-size: 1.15rem; font-weight: 800; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.stickybar { position: sticky; bottom: calc(66px + var(--safe-b)); z-index: 10; background: var(--card); padding: 12px 16px; border-top: 1px solid var(--line); margin: 12px -16px -16px; }

/* timeline de rastreio */
.timeline { position: relative; padding-left: 30px; }
.timeline .step { position: relative; padding-bottom: 18px; }
.timeline .step::before { content: ""; position: absolute; left: -22px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: #d4d4dd; box-shadow: 0 0 0 4px #fff; }
.timeline .step::after { content: ""; position: absolute; left: -16px; top: 22px; bottom: -4px; width: 2px; background: #e2e2ea; }
.timeline .step:last-child::after { display: none; }
.timeline .step.done::before { background: var(--ok); } .timeline .step.now::before { background: var(--p); box-shadow: 0 0 0 4px var(--p-soft); }
.timeline .step.done::after { background: var(--ok); }
.timeline .step.cancel::before { background: var(--bad); }
.progress { display: flex; gap: 4px; margin: 10px 0 4px; } .progress i { flex: 1; height: 6px; border-radius: 3px; background: #e4e4ec; } .progress i.on { background: var(--p); }

/* banner, misc */
.hero { background: linear-gradient(135deg, var(--p), var(--p-dark)); color: #fff; border-radius: 18px; padding: 20px; margin-bottom: 14px; }
.hero h1 { color: #fff; }
/* cabeçalho da loja estilo perfil: capa + logo grande em destaque */
.storehead { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; text-align: center; padding: 0 16px 16px; margin-bottom: 16px; }
.storehead .cover { height: 110px; margin: 0 -16px; background:
  radial-gradient(circle at 15% 20%, rgba(255,255,255,.22) 0 40px, transparent 41px),
  radial-gradient(circle at 88% 85%, rgba(255,255,255,.16) 0 60px, transparent 61px),
  radial-gradient(circle at 70% 10%, rgba(255,255,255,.12) 0 22px, transparent 23px),
  linear-gradient(135deg, var(--p), var(--p-dark)); }
.shop-logo { width: 136px; height: 136px; margin: -72px auto 10px; border-radius: 32px; background: #fff; border: 5px solid #fff;
  box-shadow: 0 12px 32px rgba(0,0,0,.18), 0 0 0 3px color-mix(in srgb, var(--p) 30%, transparent); overflow: hidden; display: grid; place-items: center; position: relative; }
.shop-logo img { width: 100%; height: 100%; object-fit: contain; }
.shop-logo span { font-size: 3.6rem; font-weight: 800; color: var(--p); }
.shop-name { font-size: 1.55rem; font-weight: 800; margin: 0 0 4px; letter-spacing: -.01em; }
.shop-tag { margin: 0 auto 10px; color: var(--muted); font-size: .92rem; max-width: 420px; }
.shop-info { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 8px; }
.shop-info > * { background: var(--p-soft); color: var(--p-dark); font-size: .76rem; font-weight: 700; padding: 5px 10px; border-radius: 99px; }
.shop-info .on { background: #dcfce7; color: #15803d; } .shop-info .off { background: #fee2e2; color: #b91c1c; }
@media (min-width: 700px) { .storehead .cover { height: 150px; } .shop-logo { width: 160px; height: 160px; margin-top: -84px; } }
.hero-row { display: flex; align-items: center; gap: 16px; }
.hero-logo { width: 92px; height: 92px; border-radius: 20px; object-fit: cover; background: #fff; flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(0,0,0,.18); display: grid; place-items: center; font-size: 2.4rem; font-weight: 800; color: var(--p); }
.hero-title { color: #fff; font-size: 1.05rem; font-weight: 700; margin: 0 0 4px; line-height: 1.3; }
.hero-sub { font-size: .85rem; opacity: .92; }
.search { position: relative; } .search input { padding-left: 40px; border-radius: 99px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); } .empty .big { font-size: 3rem; margin-bottom: 8px; }
.banner { padding: 10px 14px; border-radius: 12px; font-size: .9rem; margin-bottom: 12px; display: block; line-height: 1.4; }
.banner.flex { display: flex; gap: 10px; align-items: center; }
.banner a { font-weight: 700; }
/* carrossel de promoções */
.promo { margin-bottom: 16px; }
.promo-track { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-top: 8px; scroll-behavior: smooth; }
.promo-track::-webkit-scrollbar { display: none; }
.promo-slide { flex: 0 0 100%; scroll-snap-align: start; display: flex; background: var(--card); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); color: var(--text); border: 2px solid color-mix(in srgb, var(--p) 25%, white); }
@media (min-width: 700px) { .promo-slide { flex-basis: calc(50% - 5px); } }
.promo-slide .pimg { width: 44%; aspect-ratio: 1; background: #f0f0f4 center/cover no-repeat; position: relative; flex-shrink: 0; }
.promo-slide .pinfo { padding: 12px; flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.promo-slide .pname { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.promo-slide .price { font-size: 1.35rem; color: var(--p-dark); }
.promo-slide .btn { margin-top: 6px; align-self: flex-start; }
.promo-badge { display: inline-block; background: var(--bad); color: #fff; font-weight: 800; font-size: .7rem; padding: 2px 6px; border-radius: 6px; }
.banner.warn { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.banner.bad { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.banner.info { background: var(--p-soft); color: var(--p-dark); }
.wa-fab { position: fixed; right: 16px; bottom: calc(84px + var(--safe-b)); width: 54px; height: 54px; border-radius: 50%; background: #25d366; color: #fff; display: grid; place-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 25; }
.wa-fab svg { width: 30px; height: 30px; }
.qr { width: 240px; max-width: 100%; margin: 8px auto; border-radius: 12px; border: 1px solid var(--line); }
.code-box { font-family: ui-monospace, monospace; font-size: .78rem; word-break: break-all; background: #f4f4f8; padding: 10px; border-radius: 10px; max-height: 90px; overflow: auto; }
.skeleton { background: linear-gradient(90deg, #eee, #f6f6f6, #eee); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r); }
@keyframes sk { to { background-position: -200% 0; } }
.spinner { width: 28px; height: 28px; border: 3px solid var(--p-soft); border-top-color: var(--p); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toast & sheet */
#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: #1f1f2b; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-weight: 500; animation: tin .2s ease-out; }
.toast.ok { background: var(--ok); } .toast.bad { background: var(--bad); }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }
.overlay { position: fixed; inset: 0; background: rgba(10,10,20,.45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + var(--safe-b)); animation: up .2s ease-out; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: #ddd; margin: -6px auto 12px; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 20px; } }

/* admin */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 800px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); }
.stat .v { font-size: 1.35rem; font-weight: 800; margin-top: 2px; } .stat .l { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 130px; padding-top: 10px; }
.bars div { flex: 1; background: var(--p); border-radius: 5px 5px 0 0; min-height: 3px; position: relative; opacity: .85; }
.bars div:hover { opacity: 1; }
.barlabels { display: flex; gap: 4px; font-size: .62rem; color: var(--muted); margin-top: 4px; } .barlabels span { flex: 1; text-align: center; }
.imgs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.imgs .slot { aspect-ratio: 1; border-radius: 12px; background: #f0f0f4 center/cover; position: relative; border: 2px dashed transparent; }
.imgs .slot.add { border-color: #cfcfdc; display: grid; place-items: center; color: var(--muted); font-size: 28px; cursor: pointer; background: #fafafc; }
.imgs .slot button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; cursor: pointer; font-size: 14px; line-height: 1; }
.imgs .slot .first { position: absolute; bottom: 4px; left: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: .62rem; padding: 2px 6px; border-radius: 6px; }
.switch { position: relative; width: 46px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d4d4dd; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { 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 + span { background: var(--ok); } .switch input:checked + span::before { transform: translateX(18px); }
.menu a { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); color: var(--text); font-weight: 600; }
.menu a:last-child { border-bottom: 0; } .menu a .ico { width: 38px; height: 38px; border-radius: 11px; background: var(--p-soft); display: grid; place-items: center; font-size: 18px; }
.tabs { display: flex; background: #ececf2; border-radius: 12px; padding: 4px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; font-size: .88rem; padding-left: 10px !important; padding-right: 10px !important; border: 0; background: transparent; padding: 9px; border-radius: 9px; font: inherit; font-weight: 700; cursor: pointer; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
table { width: 100%; border-collapse: collapse; } td, th { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: left; font-size: .9rem; }
