:root {
  --bg: #F5F6FB;
  --card: #FFFFFF;
  --ink: #0F172A;
  --ink-2: #475569;
  --ink-3: #94A3B8;
  --line: #E7E9F2;
  --violet: #7C3AED;
  --pink: #EC4899;
  --grad: linear-gradient(135deg, #7C3AED 0%, #C026D3 55%, #EC4899 100%);
  --green: #10B981;
  --red: #EF4444;
  --amber: #F59E0B;
  --ml: #FFE600; --ml-ink: #2D3277;
  --shopee: #EE4D2D;
  --amazon: #FF9900; --amazon-ink: #131921;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; display: flex; background: var(--bg); color: var(--ink);
  font: 14px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.muted { color: var(--ink-2); margin: 2px 0 0; }
.tiny { font-size: 12px; color: var(--ink-3); }
a { color: var(--violet); }

/* ---------- sidebar ---------- */
.sidebar {
  width: 248px; flex: 0 0 248px; height: 100vh; position: sticky; top: 0;
  background: radial-gradient(120% 60% at 0% 0%, #2E1065 0%, #111027 55%, #0B0B18 100%);
  color: #E2E8F0; display: flex; flex-direction: column; padding: 22px 14px;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 22px; }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px;
  background: var(--grad); box-shadow: 0 8px 24px rgba(236,72,153,.35); }
.brand-name { font-weight: 800; font-size: 16px; color: #fff; }
.brand-sub { font-size: 11.5px; color: #A5B4FC; letter-spacing: .3px; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav button {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; cursor: pointer;
  background: none; border: 0; color: #CBD5E1; font: inherit; font-weight: 500; padding: 10px 12px; border-radius: 10px;
  transition: background .15s, color .15s;
}
nav button svg { width: 18px; height: 18px; opacity: .85; }
nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
nav button.on { background: rgba(255,255,255,.10); color: #fff; box-shadow: inset 3px 0 0 #EC4899; }
nav .badge { margin-left: auto; background: rgba(236,72,153,.2); color: #F9A8D4; font-size: 11px; padding: 1px 8px; border-radius: 999px; }
.sidebar-foot { margin-top: auto; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.05); font-size: 12.5px; color: #CBD5E1; }
.sidebar-foot b { color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; background: var(--ink-3); }
.dot.on { background: var(--green); box-shadow: 0 0 0 4px rgba(16,185,129,.18); }
.dot.off { background: var(--red); }

/* ---------- layout ---------- */
.app { flex: 1; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px 32px 18px;
  position: sticky; top: 0; z-index: 5; background: rgba(245,246,251,.86); backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
.topbar h1 { font-size: 24px; font-weight: 800; }
.top-actions { display: flex; gap: 10px; align-items: center; }
main { padding: 6px 32px 48px; max-width: 1360px; }
.grid { display: grid; gap: 18px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.section-gap { margin-top: 18px; }

/* ---------- KPIs ---------- */
.kpi { position: relative; overflow: hidden; }
.kpi .lbl { color: var(--ink-2); font-size: 13px; font-weight: 500; }
.kpi .val { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.kpi .sub { font-size: 12.5px; color: var(--ink-3); }
.kpi .ico { position: absolute; right: 16px; top: 16px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; }
.kpi.hero { background: var(--grad); color: #fff; border: 0; }
.kpi.hero .lbl, .kpi.hero .sub { color: rgba(255,255,255,.85); }
.kpi.hero .ico { background: rgba(255,255,255,.18); }

/* ---------- botões / inputs ---------- */
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; padding: 9px 14px;
  border-radius: 10px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; transition: transform .05s, box-shadow .15s, background .15s; white-space: nowrap; }
.btn:hover { box-shadow: 0 4px 14px rgba(15,23,42,.08); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 6px 18px rgba(192,38,211,.28); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #FECACA; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; outline: none; transition: border .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: #C4B5FD; box-shadow: 0 0 0 4px rgba(124,58,237,.12); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--violet); }
input[type="range"] { padding: 0; border: 0; accent-color: var(--violet); }
label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
label.f small { font-weight: 400; color: var(--ink-3); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px 20px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; cursor: pointer; }

/* toggle */
.toggle { position: relative; width: 42px; height: 24px; flex: 0 0 42px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; background: #CBD5E1; border-radius: 999px; transition: .2s; cursor: pointer; }
.toggle span::after { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked + span { background: var(--violet); }
.toggle input:checked + span::after { transform: translateX(18px); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 12.5px; cursor: pointer; color: var(--ink-2); user-select: none; transition: .15s; }
.chip:hover { border-color: #C4B5FD; }
.chip.on { background: #F5F3FF; border-color: var(--violet); color: var(--violet); }
.chip .n { opacity: .6; margin-left: 4px; }
.day { width: 42px; text-align: center; padding: 8px 0; }

/* marketplace */
.mk { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px; letter-spacing: .2px; white-space: nowrap; }
.mk-ml { background: var(--ml); color: var(--ml-ink); }
.mk-shopee { background: var(--shopee); color: #fff; }
.mk-amazon { background: var(--amazon-ink); color: var(--amazon); }
.mkdot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bg-ml { background: var(--ml); } .bg-shopee { background: var(--shopee); } .bg-amazon { background: var(--amazon); }

/* barras */
.bar { height: 10px; border-radius: 999px; background: #EEF0F6; overflow: hidden; display: flex; }
.bar > i { display: block; height: 100%; }
.mixbar { height: 12px; border-radius: 999px; overflow: hidden; display: flex; background: #EEF0F6; }
.mixbar > i { height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }

/* listas */
.list { display: flex; flex-direction: column; }
.li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.li:last-child { border-bottom: 0; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: contain; background: #F8FAFC; border: 1px solid var(--line); flex: 0 0 44px; }
.li .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .grow { min-width: 0; flex: 1; }
.ok { color: var(--green); font-weight: 700; } .err { color: var(--red); font-weight: 700; }
.log { font-size: 12.5px; padding: 7px 0; border-bottom: 1px dashed var(--line); color: var(--ink-2); }
.log b { color: var(--ink); font-weight: 600; }
.log.erro b { color: var(--red); } .log.aviso b { color: var(--amber); }

/* ofertas */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input[type=search] { max-width: 300px; }
.toolbar select { width: auto; }
.tabs { display: inline-flex; background: #EEF0F6; padding: 4px; border-radius: 12px; gap: 2px; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 600; font-size: 13px; color: var(--ink-2); padding: 7px 12px; border-radius: 9px; cursor: pointer; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15,23,42,.1); }
.offers { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px; }
.offer { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.offer:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(15,23,42,.10); }
.offer .pic { position: relative; height: 170px; background: #F8FAFC; display: grid; place-items: center; }
.offer .pic img { max-width: 86%; max-height: 150px; object-fit: contain; }
.offer .pic .mk { position: absolute; top: 10px; left: 10px; }
.offer .off { position: absolute; top: 10px; right: 10px; background: var(--green); color: #fff; font-weight: 800; font-size: 12px; padding: 3px 8px; border-radius: 8px; }
.offer .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.offer .title { font-weight: 600; font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; }
.price { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.price s { font-size: 12.5px; color: var(--ink-3); font-weight: 500; margin-right: 6px; }
.meta { font-size: 12px; color: var(--ink-2); display: flex; gap: 8px; flex-wrap: wrap; }
.warn { font-size: 12px; color: var(--red); }
.offer .actions { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; }
.offer .actions .btn { flex: 1; justify-content: center; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: #F1F5F9; color: var(--ink-2); }
.empty { text-align: center; padding: 56px 20px; color: var(--ink-2); }
.empty .big { font-size: 40px; }

/* agendamentos */
.sched { display: grid; grid-template-columns: 1fr auto; gap: 14px; }
.sched h3 { font-size: 16px; }
[data-ag] .info { display: flex; flex-wrap: wrap; gap: 18px; color: var(--ink-2); font-size: 13px; margin: 10px 0 12px; }
[data-ag] .info b { color: var(--ink); }
.days-mini { display: flex; gap: 4px; }
.days-mini span { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: #F1F5F9; color: var(--ink-3); }
.days-mini span.on { background: #EDE9FE; color: var(--violet); }
.mixrow { display: grid; grid-template-columns: 130px 1fr 56px; gap: 12px; align-items: center; margin: 8px 0; }
.mixrow output { font-weight: 800; text-align: right; }

/* template */
.tpl-wrap { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: 18px; }
.tpl-wrap textarea { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; min-height: 360px; line-height: 1.55; }
.phone { background: #EFEAE2 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='2' cy='2' r='1' fill='%23d9d2c5'/%3E%3C/svg%3E"); border-radius: 18px; padding: 18px; min-height: 360px; border: 1px solid var(--line); }
.bubble { background: #D9FDD3; border-radius: 10px 0 10px 10px; padding: 9px 11px; white-space: pre-wrap; font-size: 13.5px; box-shadow: 0 1px .5px rgba(0,0,0,.13); max-width: 100%; margin-left: auto; word-break: break-word; }
.bubble .time { display: block; text-align: right; font-size: 11px; color: #667781; margin-top: 4px; }
.ph-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ph-list code { background: #F5F3FF; color: var(--violet); padding: 3px 8px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600; }
.ph-list code:hover { background: #EDE9FE; }

/* contas */
.acc { display: flex; flex-direction: column; gap: 12px; }
.acc .head { display: flex; gap: 12px; align-items: center; }
.acc .logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 900; font-size: 13px; }
.acc .status { font-size: 12.5px; }

/* tabela */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-3); font-weight: 700; padding: 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: #FAFAFE; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(3px); display: none; align-items: flex-start; justify-content: center; z-index: 50; padding: 40px 16px; overflow: auto; }
.modal-bg.on { display: flex; }
.modal { background: #fff; width: min(860px, 100%); border-radius: 20px; box-shadow: 0 30px 80px rgba(15,23,42,.3); padding: 24px; animation: pop .18s ease-out; }
.modal h2 { font-size: 19px; font-weight: 800; }
.modal .foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

.pill { font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.pill.run { background: #F5F3FF; color: var(--violet); border-color: #DDD6FE; }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px); background: #0F172A; color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 500; opacity: 0; pointer-events: none; transition: .2s; z-index: 99; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.on { opacity: 1; transform: translateX(-50%); }
.note { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; padding: 12px 14px; border-radius: 12px; font-size: 13px; }
.note.info { background: #F5F3FF; border-color: #DDD6FE; color: #5B21B6; }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g-side, .tpl-wrap, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .form-grid, .g2 { grid-template-columns: 1fr; } main, .topbar { padding-left: 16px; padding-right: 16px; } }

/* ---------- celular: menu em gaveta ---------- */
.topbar-titulo { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-btn { display: none; width: 42px; height: 42px; padding: 0; flex: none; justify-content: center; align-items: center; }
.menu-btn svg { width: 22px; height: 22px; }
.gaveta-fundo { display: none; }
@media (max-width: 760px) {
  .menu-btn { display: inline-flex; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100dvh; width: min(280px, 84vw); z-index: 40; overflow-y: auto;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: none; }
  body.menu-aberto .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  body.menu-aberto .gaveta-fundo { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(15,23,42,.45); backdrop-filter: blur(2px); }
  body.menu-aberto { overflow: hidden; }
  nav button { padding: 12px; }
  .topbar { padding-top: 12px; padding-bottom: 12px; gap: 10px; }
  .topbar h1 { font-size: 20px; }
  .topbar #pageSub { display: none; }
  .top-actions { gap: 6px; width: 100%; }
  .top-actions .btn { padding: 7px 10px; font-size: 12.5px; }
  #coletaPill { display: none; }
}
a.btn { text-decoration: none; display: inline-block; }

/* primeiros passos (checklist depois do login, sistema web) */
.modal.modal-ck { width: min(640px, 100%); padding: 0; overflow: hidden; }
.ck-cab { display: flex; gap: 14px; align-items: center; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.ck-ico { width: 48px; height: 48px; flex: none; border-radius: 14px; display: grid; place-items: center; font-size: 22px; background: linear-gradient(135deg, #F5F3FF, #FDF2F8); }
.ck-eyebrow { font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ck-cab h2 { margin: 2px 0 0; font-size: 21px; }
.ck-x { width: 38px; height: 38px; padding: 0; justify-content: center; border: 1px solid var(--line); font-size: 15px; color: var(--ink-2); }
.ck-intro { margin: 16px 22px 0; }
.ck-prog { display: flex; align-items: center; gap: 12px; margin: 14px 22px 4px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.ck-barra { flex: 1; height: 8px; border-radius: 99px; background: #EEF0F6; overflow: hidden; }
.ck-barra i { display: block; height: 100%; border-radius: 99px; background: var(--grad); transition: width .4s ease; }
.ck-lista { display: grid; gap: 10px; padding: 14px 22px 22px; max-height: min(62vh, 620px); overflow: auto; }
.ck-passo { display: flex; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.ck-passo.atual { border-color: #C4B5FD; box-shadow: 0 0 0 3px #F5F3FF; }
.ck-passo.feito { background: #F0FBF6; border-color: #BFEBD6; }
.ck-num { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: #F5F3FF; color: var(--violet); }
.ck-passo.feito .ck-num { background: var(--green); color: #fff; }
.ck-num svg { width: 18px; height: 18px; }
.ck-corpo { flex: 1; min-width: 0; }
.ck-tit { font-weight: 700; font-size: 15px; }
.ck-passo.feito .ck-tit { color: var(--ink-2); text-decoration: line-through; text-decoration-color: #94A3B8; }
.ck-opc { font-size: 11px; font-weight: 700; color: var(--ink-3); border: 1px solid var(--line); border-radius: 99px; padding: 1px 7px; margin-left: 4px; text-decoration: none; display: inline-block; }
.ck-txt { color: var(--ink-2); font-size: 13.5px; margin-top: 3px; }
.ck-acoes { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.ck-resumo { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; border-color: #E9D5FF; background: linear-gradient(135deg, #FDFBFF, #FFF7FB); }
.ck-resumo h3 { margin: 0; }
.ck-pill b { color: var(--violet); }
.ck-pill[hidden] { display: none; }
.ck-destaque { animation: ckDestaque 2.6s ease-out; }
@keyframes ckDestaque { 0%, 60% { box-shadow: 0 0 0 4px #C4B5FD, var(--shadow); } 100% { box-shadow: var(--shadow); } }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; } .top-actions { flex-wrap: wrap; }
  .ck-pill-txt { display: none; }
  .modal-bg:has(.modal-ck) { padding: 12px 10px; }
  .ck-cab, .ck-lista { padding-left: 16px; padding-right: 16px; } .ck-intro, .ck-prog { margin-left: 16px; margin-right: 16px; }
  .ck-lista { max-height: none; }
}
