:root {
  --brand: #6d28d9;
  --bg: #0f1020;
  --panel: #181a30;
  --panel-2: #1f2240;
  --text: #eef0ff;
  --muted: #9aa0c7;
  --line: #2b2f57;
  --ok: #22c55e;
  --danger: #ef4444;
  --radius: 16px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* topo */
.topbar { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); background: rgba(15,16,32,.8); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.brand { font-weight: 800; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; }
.brand .dot { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand); font-size: 1.1rem; }
.nav { display: flex; gap: 10px; align-items: center; }

/* botoes e campos */
.btn { border: 0; cursor: pointer; padding: 10px 18px; border-radius: 12px; font-weight: 600; background: var(--brand); color: #fff; transition: transform .1s, filter .2s; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.97); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #a5b4fc; outline-offset: 2px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: .85rem; border-radius: 10px; }
.btn.wa { background: #16a34a; }
input, textarea, select { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
textarea { resize: vertical; min-height: 80px; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 12px 0 6px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.check input { width: auto; }

/* hero */
.hero { padding: 72px 0 48px; background: radial-gradient(900px 400px at 80% -10%, rgba(109,40,217,.45), transparent), radial-gradient(700px 300px at 0% 0%, rgba(14,165,233,.25), transparent); }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.1; margin: 0 0 14px; letter-spacing: -.02em; }
.hero p { color: var(--muted); max-width: 640px; font-size: 1.1rem; }
.hero .cta { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.search { display: flex; gap: 10px; margin-top: 28px; max-width: 640px; }

/* grids e cards */
section.bloco { padding: 36px 0; }
h2 { margin: 0 0 18px; font-size: 1.5rem; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, border-color .2s; }
.card:hover { transform: translateY(-3px); border-color: var(--brand); }
.card .img { aspect-ratio: 4/3; background: var(--panel-2); display: grid; place-items: center; font-size: 3rem; overflow: hidden; }
.card .img img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-size: 1.02rem; }
.muted { color: var(--muted); font-size: .88rem; }
.price { font-weight: 800; font-size: 1.15rem; }
.price s { color: var(--muted); font-weight: 400; font-size: .9rem; margin-right: 6px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.badge.promo { background: #7f1d1d; border-color: #b91c1c; }
.badge.srv { background: #0c4a6e; border-color: #0369a1; }
.card .actions { margin-top: auto; padding-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.store { padding: 18px; display: flex; gap: 14px; align-items: center; }
.store .logo { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 1.6rem; flex: none; }
.promo-strip { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.offer { padding: 18px; border-radius: var(--radius); background: linear-gradient(135deg, var(--brand), #111827); border: 1px solid var(--line); }
.offer h3 { margin: 0 0 4px; }
.coupon { display: inline-block; margin-top: 10px; padding: 4px 10px; border: 1px dashed #fff; border-radius: 8px; font-weight: 700; letter-spacing: .08em; }
.empty { padding: 36px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* loja */
.store-hero { padding: 48px 0 32px; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 55%, #0f1020), var(--bg)); background-size: cover; background-position: center; }
.store-hero .inner { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.store-hero .logo { width: 84px; height: 84px; border-radius: 22px; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 2.6rem; }
.store-hero h1 { margin: 0; }
.share { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.tab.on { background: var(--brand); border-color: var(--brand); }

/* painel */
.auth { max-width: 440px; margin: 56px auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 28px 0 60px; }
@media (max-width: 800px) { .layout { grid-template-columns: 1fr; } }
.side { display: flex; flex-direction: column; gap: 6px; align-self: start; position: sticky; top: 84px; }
@media (max-width: 800px) { .side { flex-direction: row; flex-wrap: wrap; position: static; } }
.side button { text-align: left; padding: 10px 14px; border-radius: 12px; border: 0; background: transparent; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.side button.on, .side button:hover { background: var(--panel-2); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 1.8rem; }
.list-item { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list-item:last-child { border-bottom: 0; }
.linkbox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--panel-2); padding: 10px 14px; border-radius: 12px; word-break: break-all; }
.pill { background: var(--brand); border-radius: 999px; padding: 1px 8px; font-size: .75rem; font-weight: 700; }

/* chat */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 360px; }
.msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--panel-2); border-radius: 12px; max-height: 420px; }
.msg { max-width: 80%; padding: 8px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.eu { align-self: flex-end; background: var(--brand); border-color: var(--brand); }
.msg small { display: block; opacity: .6; font-size: .68rem; }
.chat form { display: flex; gap: 8px; margin-top: 10px; }
.chat-split { display: grid; grid-template-columns: 240px 1fr; gap: 16px; }
@media (max-width: 700px) { .chat-split { grid-template-columns: 1fr; } }
.conv { padding: 10px 12px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; display: block; width: 100%; text-align: left; background: transparent; }
.conv:hover, .conv.on { background: var(--panel-2); border-color: var(--line); }
.fab { position: fixed; right: 20px; bottom: 20px; z-index: 30; }
.widget { position: fixed; right: 20px; bottom: 80px; width: min(360px, calc(100vw - 40px)); z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.widget[hidden] { display: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #111; border: 1px solid var(--line); padding: 10px 18px; border-radius: 12px; z-index: 50; }
.toast.erro { border-color: var(--danger); }
footer { padding: 36px 0; color: var(--muted); text-align: center; border-top: 1px solid var(--line); margin-top: 40px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* checkout e acompanhamento */
.fab-left { right: auto; left: 20px; background: #16a34a; }
.fab[hidden] { display: none; }
dialog.modal { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 0; width: min(680px, calc(100vw - 24px)); max-height: 92vh; }
dialog.modal::backdrop { background: rgba(0,0,0,.65); }
.modal-body { padding: 22px; }
.fs { border: 1px solid var(--line); border-radius: 12px; margin: 14px 0 0; padding: 4px 14px 14px; }
.fs[hidden] { display: none; }
.fs legend { color: var(--muted); font-size: .85rem; padding: 0 6px; }
.opt { padding: 6px 0; }
.qty { display: flex; align-items: center; gap: 10px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 22px 34px; color: var(--muted); }
.timeline li::before { content: ""; position: absolute; left: 8px; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); background: var(--bg); }
.timeline li::after { content: ""; position: absolute; left: 14px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.feito { color: var(--text); }
.timeline li.feito::before { background: var(--ok); border-color: var(--ok); }
.timeline li.atual::before { box-shadow: 0 0 0 5px rgba(34,197,94,.25); }
.timeline li.cancelado::before { background: var(--danger); border-color: var(--danger); }
.pixbox { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; word-break: break-all; background: var(--panel-2); border-radius: 12px; padding: 12px; }
.status-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--panel-2); border: 1px solid var(--line); }
.status-chip.pago, .status-chip.entregue { border-color: var(--ok); color: var(--ok); }
.status-chip.enviado, .status-chip.em_preparo { border-color: #38bdf8; color: #38bdf8; }
.status-chip.cancelado { border-color: var(--danger); color: var(--danger); }

/* estoque: card esgotado na loja */
.card.esgotado { opacity: .72; }
.card.esgotado .img { filter: grayscale(.6); }

/* impulsionamento: planos */
.planos { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 8px; }
.plano { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.plano.on { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 40%, transparent); }
.plano h3 { margin: 0; }
.plano .beneficios { list-style: none; margin: 6px 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.plano .beneficios li { position: relative; padding-left: 22px; font-size: .9rem; color: var(--muted); }
.plano .beneficios li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }
.planos-mini { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-top: 6px; }
.plano-mini { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }

/* manual: passos e figuras */
.passo { display: flex; gap: 16px; align-items: flex-start; }
.passo-num { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; }
.fig { float: right; margin: 0 0 12px 16px; max-width: 220px; text-align: center; }
.fig-img { width: 220px; max-width: 48vw; height: 130px; border-radius: 12px; background: linear-gradient(135deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); display: grid; place-items: center; font-size: 3.4rem; }
@media (max-width: 600px) { .fig { float: none; margin: 10px 0; max-width: 100%; } .fig-img { width: 100%; } }

/* ===== Responsivo / mobile ===== */
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .topbar .wrap { height: auto; min-height: 56px; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
  .brand { font-size: 1rem; }
  .nav { gap: 6px; flex-wrap: wrap; }
  /* botoes/inputs com area de toque confortavel */
  .btn { padding: 11px 16px; }
  .btn.sm { padding: 8px 12px; }
  input, textarea, select { padding: 12px 14px; font-size: 16px; } /* 16px evita zoom no iOS */
  /* grids viram 1 coluna */
  .row { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat b { font-size: 1.4rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .planos, .planos-mini { grid-template-columns: 1fr; }
  /* navegacao lateral do painel vira barra rolavel no topo */
  .side { gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .side button { white-space: nowrap; }
  /* hero e titulos mais compactos */
  .hero { padding: 48px 0 32px; }
  .search { flex-direction: column; }
  /* listas e acoes empilham */
  .list-item { gap: 8px; }
  .panel { padding: 16px; }
  /* modal de checkout ocupa quase a tela toda */
  dialog.modal { width: 100vw; max-height: 100vh; height: 100%; border-radius: 0; }
  .modal-body { padding: 16px; }
  /* chat ocupa largura total */
  .widget { right: 10px; left: 10px; width: auto; }
  /* store hero */
  .store-hero .logo { width: 64px; height: 64px; font-size: 2rem; }
}
@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr; }
}

/* relatorios: grafico de barras simples */
.barras { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding: 8px 0 0; overflow-x: auto; }
.barra-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; min-width: 26px; height: 100%; flex: 1 0 26px; }
.barra { width: 70%; min-height: 2px; background: linear-gradient(180deg, var(--brand), color-mix(in srgb, var(--brand) 40%, transparent)); border-radius: 6px 6px 0 0; transition: height .2s; }
.barra-lbl { font-size: 10px; color: var(--muted); white-space: nowrap; }
