/* Promo Insana — painel. Identidade: etiqueta de preço amarela, preto, "olhos" no %. */
@font-face { font-family: "Archivo"; src: url("/static/brand/fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
:root {
  --bg: #EEF1F4;
  --surface: #FFFFFF;
  --surface-2: #F6F8FA;
  --ink: #18202C;
  --muted: #5F6B7A;
  --line: #DCE2E8;
  --tag: #FFD400;
  --tag-ink: #000000;
  --ok: #16855C;
  --ok-soft: #E3F4EC;
  --bad: #C8402F;
  --bad-soft: #FBE9E6;
  --warn: #9A6A00;
  --warn-soft: #FFF5D6;
  --focus: #2C6BED;
  --radius: 10px;
  --radius-sm: 6px;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* lojas no painel de vendas (cor fixa por loja, validada para daltonismo) */
  --pf-mercadolivre: #2a78d6; --pf-shopee: #eb6834; --pf-amazon: #1baf7a; --grid: #E6EAEE;
  --viz-1: #2a78d6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151B; --surface: #181E26; --surface-2: #1E252F; --ink: #E5EAF0; --muted: #96A1AE;
    --line: #2A323D; --tag: #FFD400; --tag-ink: #000000; --ok: #3CC48C; --ok-soft: #173327;
    --bad: #F0725F; --bad-soft: #3A1D19; --warn: #F2C04B; --warn-soft: #352B12; --focus: #6EA0FF;
    --pf-mercadolivre: #3987e5; --pf-shopee: #d95926; --pf-amazon: #199e70; --grid: #252C36;
    --viz-1: #3987e5;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[x-cloak] { display: none !important; }
a { color: var(--focus); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num { font-stretch: 75%; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- estrutura ---------- */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.shell > main { min-width: 0; }
.side {
  border-right: 1px solid var(--line); background: var(--surface); padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
.brand-mark { width: 46px; height: auto; flex: none; }
.brand-name { font-weight: 900; font-stretch: 62%; text-transform: uppercase; font-size: 24px; line-height: 1; letter-spacing: -0.01em; }
.login-card .brand-mark { width: 64px; }
.login-card .brand-name { font-size: 32px; }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 8px; }
.brand-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.brand-row img { border-radius: 50%; flex: none; }
.brand-row-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.brand-row select { max-width: 48%; }
.linkbox { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 14px; overflow-wrap: anywhere; }
.coupon-art { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.coupon-art figure { margin: 0; display: grid; gap: 6px; justify-items: start; }
.coupon-art img { width: 140px; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.coupon-art figcaption { display: grid; line-height: 1.3; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }
.brand-tag {
  width: 30px; height: 22px; background: var(--tag); color: var(--tag-ink); border-radius: 4px 11px 11px 4px;
  display: grid; place-items: center; font-size: 13px; font-weight: 900; position: relative;
}
.brand-tag::after { content: ""; position: absolute; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--surface); }
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--muted); font-weight: 500;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--surface-2); color: var(--ink); font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.side-foot { margin-top: auto; padding: 8px; }

main { padding: 28px 36px 120px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
h1 { font-size: 28px; line-height: 1.15; margin: 0; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 17px; margin: 0 0 4px; font-weight: 700; }
h3 { font-size: 15px; margin: 0; font-weight: 700; }
.lead { color: var(--muted); margin: 6px 0 0; max-width: 62ch; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-pad { padding: 18px 20px; }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.rows > * + * { border-top: 1px solid var(--line); }

/* ---------- cupom do bot (o elemento memorável) ---------- */
.coupon {
  display: grid; grid-template-columns: 1fr auto; align-items: stretch; border-radius: 14px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); position: relative;
}
.coupon.on { background: var(--tag); border-color: var(--tag); color: var(--tag-ink); }
.coupon-main { padding: 22px 26px; display: flex; flex-direction: column; gap: 6px; }
.coupon-state { font-size: 40px; line-height: 1; font-weight: 900; font-stretch: 75%; letter-spacing: -0.01em; }
.coupon-sub { font-size: 14px; opacity: .8; max-width: 52ch; }
.coupon-stub {
  border-left: 2px dashed currentColor; border-left-color: color-mix(in srgb, currentColor 35%, transparent);
  padding: 22px 26px; display: grid; place-items: center; position: relative; min-width: 210px;
}
.coupon-stub::before, .coupon-stub::after {
  content: ""; position: absolute; left: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--bg);
}
.coupon-stub::before { top: -11px; } .coupon-stub::after { bottom: -11px; }
.coupon-btn {
  border: 0; border-radius: 999px; padding: 13px 26px; font-weight: 800; font-size: 16px; cursor: pointer;
  background: var(--ink); color: var(--surface);
}
.coupon.on .coupon-btn { background: var(--tag-ink); color: var(--tag); }
.coupon-btn:disabled { opacity: .6; cursor: progress; }
@media (prefers-reduced-motion: no-preference) {
  .coupon { transition: background-color .25s ease, color .25s ease; }
}

/* ---------- conexões e números ---------- */
.health { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-top: 16px; }
.health > div { padding: 14px 18px; display: flex; gap: 10px; align-items: flex-start; }
.health > div + div { border-left: 1px solid var(--line); }
.health .dot { margin-top: 7px; }
.stats { display: flex; gap: 34px; flex-wrap: wrap; margin-top: 18px; }
.stat b { display: block; font-size: 30px; line-height: 1.05; font-weight: 800; font-stretch: 75%; font-variant-numeric: tabular-nums; }

/* ---------- feed / fila ---------- */
.feed { max-height: 520px; overflow: auto; }
.feed-item { padding: 11px 16px; display: grid; grid-template-columns: 54px 1fr; gap: 10px; }
.feed-time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.feed-title { font-weight: 600; overflow-wrap: anywhere; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.tag { background: var(--tag); color: var(--tag-ink); }
.empty { padding: 26px 18px; color: var(--muted); }

/* ---------- formulários ---------- */
.field { display: grid; gap: 5px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); }
input[type=text], input[type=date], input[type=datetime-local], input[type=password], input[type=number], input[type=tel], input[type=url], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 9px 11px;
}
input[type=date] { width: auto; }
textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px 18px; align-items: end; }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 14px; }

.btn {
  border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: var(--radius-sm);
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.link-btn { border: 0; background: none; padding: 0; color: var(--focus); cursor: pointer; font-weight: 600; }

.switch { position: relative; display: inline-block; vertical-align: middle; width: 40px; height: 23px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(17px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- categorias ---------- */
.cat { padding: 16px 18px; display: grid; grid-template-columns: auto 1fr; gap: 14px; }
.cat.off .cat-body { opacity: .55; }
.cat-name { font-weight: 700; font-size: 16px; border: 0; background: transparent; padding: 2px 0; width: 100%; }
.cat-name:focus { outline: 2px solid var(--focus); border-radius: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.chip button { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 0 4px; font-size: 15px; line-height: 1; }
.chip.missing { border-style: dashed; color: var(--bad); }

/* ---------- tabela simples ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }

/* ---------- WhatsApp ---------- */
.number-row { padding: 14px 18px; display: grid; grid-template-columns: auto 1fr auto; gap: 8px 14px; align-items: center; }
.number-main { min-width: 0; }
.number-qr { grid-column: 1 / -1; padding: 10px 0 4px 22px; }
.number-actions { justify-content: flex-end; }
.radio-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.radio-row input { margin-top: 4px; }
details > summary { cursor: pointer; }
@media (max-width: 900px) { .number-row { grid-template-columns: auto 1fr; } .number-actions { grid-column: 1 / -1; justify-content: flex-start; } }
.qr { width: 260px; height: 260px; background: #fff; border-radius: var(--radius); padding: 10px; border: 1px solid var(--line); }
.qr img { width: 100%; height: 100%; }
.wa-bubble {
  background: #DCF8C6; color: #111; border-radius: 10px 10px 10px 2px; padding: 9px 11px; max-width: 360px;
  white-space: pre-wrap; overflow-wrap: anywhere; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14.5px;
  box-shadow: 0 1px .5px rgba(0,0,0,.13);
}
.wa-bubble a { color: #027EB5; }
.wa-wall { background: #E5DDD5; border-radius: var(--radius); padding: 18px; }
@media (prefers-color-scheme: dark) { .wa-wall { background: #0B141A; } .wa-bubble { background: #005C4B; color: #E9EDEF; } .wa-bubble a { color: #53BDEB; } }

/* ---------- barra de salvar, modal, toast ---------- */
.savebar {
  position: fixed; left: 220px; right: 0; bottom: 0; background: var(--ink); color: var(--surface);
  padding: 12px 36px; display: flex; align-items: center; justify-content: space-between; gap: 12px; z-index: 20;
}
.savebar .btn { background: transparent; color: var(--surface); border-color: color-mix(in srgb, var(--surface) 35%, transparent); }
.savebar .btn:hover { background: color-mix(in srgb, var(--surface) 12%, transparent); }
.savebar .btn.primary { background: var(--tag); color: var(--tag-ink); }
.modal-back { position: fixed; inset: 0; background: rgba(10, 14, 20, .45); display: grid; place-items: center; z-index: 30; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; width: min(520px, 100%); max-height: 82vh; display: flex; flex-direction: column; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 8px 20px; overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.check-row { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.check-row:last-child { border-bottom: 0; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 40; }
.toast { background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 8px; max-width: 380px; font-size: 14px; }
.toast.bad { background: var(--bad); color: #fff; }
.notice { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.notice.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
pre.log { margin: 0; padding: 12px 16px; font-size: 12.5px; line-height: 1.5; max-height: 420px; overflow: auto; white-space: pre-wrap; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(380px, 100%); }
.login-card .brand { padding: 0 0 18px; font-size: 22px; }

/* ---------- responsivo ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; height: auto; flex-direction: row; overflow-x: auto; padding: 10px 12px; z-index: 10; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 4px 8px; }
  .brand .brand-name { display: none; }
  .nav-item { width: auto; }
  .side-foot { display: none; }
  main { padding: 20px 16px 120px; }
  .grid-2 { grid-template-columns: 1fr; }
  .health { grid-template-columns: 1fr; }
  .health > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .coupon { grid-template-columns: 1fr; }
  .coupon-stub { border-left: 0; border-top: 2px dashed color-mix(in srgb, currentColor 35%, transparent); min-width: 0; }
  .coupon-stub::before, .coupon-stub::after { display: none; }
  .savebar { left: 0; padding: 12px 16px; }
}

.ml-api { border-top: 1px solid var(--line); padding-top: 16px; }
code { font-size: 13px; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; overflow-wrap: anywhere; }

.problems { border-left: 4px solid var(--bad); margin-bottom: 16px; }
.modal.wide { width: min(640px, 100%); }
.gm-pic { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.bulkbar { border-left: 4px solid var(--tag); }
[x-cloak] { display: none !important; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; max-height: 260px; overflow: auto; }

/* ---------- vendas ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow-x: auto; max-width: 100%; background: var(--surface); scrollbar-width: none; }
.seg button { white-space: nowrap; }
.seg button { border: 0; background: none; padding: 7px 13px; cursor: pointer; font-size: 14px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); font-weight: 600; }
.pf-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.12); min-width: 150px; z-index: 5; }
.chart-tip b { display: block; margin-bottom: 4px; }
.chart-tip .row { display: flex; justify-content: space-between; gap: 12px; }
.stat.hero b { color: var(--ink); }
.stat.hero { padding-right: 34px; border-right: 1px solid var(--line); }
.table td.num, .table th.num { white-space: nowrap; }
@media (max-width: 640px) { .stat.hero { border-right: 0; padding-right: 0; } .stats { gap: 18px 28px; } }
