/* ==========================================================================
   Garimpo.ia — design system do painel
   Escuro quente com dourado (padrão) ou claro neutro; dourado = ação principal
   e destaques de dinheiro (custo, lucro). Cores só pra status.
   Tipografia: Manrope (texto e títulos), Geist Mono (códigos). Regras completas
   em CLAUDE.md › "Design do sistema". Sem dependência de build: CSS puro.
   Ordem: tokens → base → shell → componentes → telas específicas.
   ========================================================================== */

:root {
  /* superfícies */
  --bg: #fafafa;
  --card: #ffffff;
  --sunken: #f4f4f5;
  --hover: #f4f4f5;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  /* texto */
  --ink: #09090b;
  --ink-2: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  /* ação principal = tinta (botão preto, como a referência) */
  --primary: #18181b;
  --primary-ink: #fafafa;
  --primary-hover: #27272a;
  /* marca (garimpo = ouro) — usada com parcimônia: logo, destaques, foco */
  --brand: #b7862c;
  --brand-soft: #fbf3e2;
  --brand-ink: #7a5614;
  /* status */
  --ok: #16a34a;      --ok-soft: #f0fdf4;     --ok-ink: #15803d;     --ok-line: #bbf7d0;
  --warn: #d97706;    --warn-soft: #fffbeb;   --warn-ink: #b45309;   --warn-line: #fde68a;
  --danger: #dc2626;  --danger-soft: #fef2f2; --danger-ink: #b91c1c; --danger-line: #fecaca;
  --info: #2563eb;    --info-soft: #eff6ff;   --info-ink: #1d4ed8;   --info-line: #bfdbfe;
  /* compat com nomes antigos usados nos templates/JS */
  --code-bg: var(--sunken);
  --chip-bg: var(--sunken);
  --input-bg: #ffffff;
  --qr-bg: #ffffff; /* QR do Pix: branco nos dois temas, para a câmera ler */
  --btn-hover: var(--sunken);
  --ring: color-mix(in srgb, var(--brand) 45%, transparent);
  --side-bg: #fafafa;
  --side-ink: var(--ink-2);
  --side-dim: var(--muted);
  --side-hover: #f0f0f2;
  --side-line: var(--line);
  --side-active-bg: #ececef;
  --side-active-ink: var(--ink);
  --menu-bg: var(--card);
  --menu-hover: var(--sunken);
  /* profundidade (sombras tintadas no cinza do fundo) */
  --shadow-xs: 0 1px 2px rgba(24, 24, 27, .04);
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, .05), 0 1px 3px rgba(24, 24, 27, .04);
  --shadow: 0 12px 32px -12px rgba(24, 24, 27, .22), 0 2px 6px rgba(24, 24, 27, .05);
  /* forma */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;
  /* gráficos */
  --viz-1: #10b981;
  --viz-2: #f59e0b;
  --viz-3: #0ea5e9;
  --viz-other: #a1a1aa;
  --viz-grid: #ececef;
  --viz-axis: #d4d4d8;
  --viz-tip-bg: #18181b;
  --viz-tip-ink: #fafafa;
  /* layout */
  --side-w: 220px;
  --top-h: 56px;
  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* dourado (as duas pontas do gradiente valem nos dois temas) */
  --gold-1: #ffd75e;
  --gold-2: #f5b000;
  --gold: var(--gold-2);
  --gold-hover: #ffc21f;
  --gold-ink: #0a0a0a;
  --gold-text: #946a00;
  --gold-line: color-mix(in srgb, var(--gold-2) 45%, transparent);
  --gold-wash: color-mix(in srgb, var(--gold-2) 7%, transparent);
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --z-top: 40; --z-side: 50; --z-overlay: 90; --z-menu: 100;
  color-scheme: light;
}

:root[data-theme="dark"] {
  /* escuro: preto puro, cinzas neutros e dourado vivo */
  --bg: #000000;
  --card: #0e0e0e;
  --sunken: #080808;
  --hover: #1a1a1a;
  --line: #222222;
  --line-strong: #333333;
  --ink: #ffffff;
  --ink-2: #e5e5e5;
  --muted: #a3a3a3;
  --faint: #6b6b6b;
  --primary: var(--gold);
  --primary-ink: var(--gold-ink);
  --primary-hover: var(--gold-hover);
  --gold-text: #ffc21f;
  --brand: #f5b000;
  --brand-soft: #2b1f00;
  --brand-ink: #ffd75e;
  --ok: #22c55e;      --ok-soft: #052e16;     --ok-ink: #4ade80;     --ok-line: #166534;
  --warn: #f59e0b;    --warn-soft: #2d1a00;   --warn-ink: #fbbf24;   --warn-line: #92400e;
  --danger: #ef4444;  --danger-soft: #2d0a0a; --danger-ink: #f87171; --danger-line: #991b1b;
  --info: #3b82f6;    --info-soft: #0a1a33;   --info-ink: #60a5fa;   --info-line: #1e40af;
  --input-bg: #0a0a0a;
  --side-bg: #000000;
  --side-hover: #141414;
  --side-active-bg: #1a1a1a;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .7);
  --shadow: 0 16px 40px -12px rgba(0, 0, 0, .9), 0 2px 6px rgba(0, 0, 0, .6);
  --viz-grid: #1c1c1c;
  --viz-axis: #333333;
  --viz-tip-bg: #ffffff;
  --viz-tip-ink: #000000;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
a { color: var(--ink); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
.content a:where(:not(.btn):not(.nav-item):not([class*="pager"])) { text-decoration: underline; }
code, kbd, .mono { font-family: var(--mono); font-size: max(12px, .86em); }
code { background: var(--sunken); border: 1px solid var(--line); padding: 1px 6px; border-radius: var(--radius-xs); color: var(--ink-2); }
.num, .tabular { font-variant-numeric: tabular-nums; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--brand) 28%, transparent); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--ring); outline-offset: 2px;
}

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 200;
  background: var(--primary); color: var(--primary-ink); padding: 8px 12px; border-radius: var(--radius-sm);
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------------ ícones */
.ic { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 14px; height: 14px; }
.ic-lg { width: 20px; height: 20px; }

/* ================================================================== SHELL */

.layout { display: flex; min-height: 100dvh; }

/* --- barra lateral --- */
.sidebar {
  width: var(--side-w); flex: 0 0 auto;
  position: sticky; top: 0; height: 100dvh; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--side-bg); border-right: 1px solid var(--side-line);
  transition: margin-left .28s cubic-bezier(.32, .72, 0, 1);
  z-index: var(--z-side);
}
/* Recolhido: no computador vira faixa de ícones (o texto fica só para leitor de
   tela, e a dica aparece ao lado); no celular sai da tela (ver @media 760px). */
@media (min-width: 761px) {
  :root[data-sidebar="off"] { --side-w: 64px; }
  .sidebar { transition: width .2s ease-out; }
  :root[data-sidebar="off"] .sidebar { overflow: visible; }
  :root[data-sidebar="off"] .workspace { justify-content: center; padding: 0; }
  :root[data-sidebar="off"] .workspace-txt,
  :root[data-sidebar="off"] .nav-label,
  :root[data-sidebar="off"] .botcard-txt,
  :root[data-sidebar="off"] .botcard > :not(.bot) { display: none; }
  :root[data-sidebar="off"] .nav-txt {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  :root[data-sidebar="off"] .sidebar .frente-switch { grid-template-columns: 1fr; margin: 10px 8px 0; }
  :root[data-sidebar="off"] .side-scroll { overflow: visible; padding: 10px 8px 16px; }
  :root[data-sidebar="off"] .nav-group { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--side-line); }
  :root[data-sidebar="off"] .nav-item { justify-content: center; padding: 0; height: 40px; }
  :root[data-sidebar="off"] .nav-count { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; }
  :root[data-sidebar="off"] .nav-item, :root[data-sidebar="off"] .frente-opt { position: relative; }
  :root[data-sidebar="off"] .botcard { justify-content: center; padding: 6px 0; }
  /* dica ao passar o mouse ou focar pelo teclado */
  :root[data-sidebar="off"] [data-tip]:is(:hover, :focus-visible)::after {
    content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    padding: 5px 9px; border-radius: var(--radius-sm); white-space: nowrap; pointer-events: none;
    background: var(--ink); color: var(--bg); font-size: 12.5px; font-weight: 500; box-shadow: var(--shadow-sm);
    z-index: var(--z-menu);
  }
}
@media (max-width: 760px) {
  :root[data-sidebar="off"] .sidebar { margin-left: calc(-1 * var(--side-w)); }
}

.workspace {
  display: flex; align-items: center; gap: 10px;
  height: var(--top-h); padding: 0 14px; border-bottom: 1px solid var(--side-line);
  flex: 0 0 auto;
}
/* Marca: o mesmo desenho do favicon (static/favicon.svg) — quadrado escuro
   com o diamante dourado, igual no tema claro e no escuro. */
.logo {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 7px;
  display: grid; place-items: center;
  background: #18181b; color: #e0b04a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .09), 0 1px 2px rgba(0, 0, 0, .18);
}
.logo svg { width: 19px; height: 19px; stroke-width: 2.1; }
.workspace-txt { min-width: 0; flex: 1; line-height: 1.2; }
.workspace-name { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-sub { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-sub .mono { font-size: 12px; }

/* Seletor de guia (Afiliado | Vendas): controle segmentado no topo da barra.
   `.sidebar` no seletor para vencer o `.sidebar nav` (menu em coluna). */
.sidebar .frente-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px; flex: 0 0 auto;
  margin: 10px 10px 0; padding: 3px; border-radius: var(--radius-sm);
  background: var(--sunken); border: 1px solid var(--line);
}
.frente-opt {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; border-radius: var(--radius-xs);
  font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none;
  transition: background .15s ease-out, color .15s ease-out;
}
.frente-opt:hover { color: var(--ink); text-decoration: none; }
.frente-opt[aria-current] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-xs); }
.frente-opt[aria-current] .ic { color: var(--brand); }

.side-scroll { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.nav-group { margin-bottom: 14px; }
.nav-label {
  padding: 8px 10px 6px; font-size: 12px; font-weight: 500; letter-spacing: .04em;
  text-transform: uppercase; color: var(--faint);
}
.sidebar nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 10px; border-radius: var(--radius-sm);
  color: var(--side-ink); font-size: 13.5px; font-weight: 450; text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.nav-item .ic { color: var(--muted); transition: color .15s ease; }
.nav-item:hover { background: var(--side-hover); color: var(--ink); text-decoration: none; }
.nav-item:hover .ic { color: var(--ink-2); }
.nav-item.on { background: var(--side-active-bg); color: var(--side-active-ink); font-weight: 600; box-shadow: inset 2px 0 0 var(--gold); }
.nav-item.on .ic { color: var(--gold-text); }
.nav-count {
  margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 5px;
  display: inline-grid; place-items: center;
  font: 500 12px/1 var(--mono); color: var(--muted); background: var(--sunken); border: 1px solid var(--line);
}
.nav-count.is-warn { color: var(--warn-ink); background: var(--warn-soft); border-color: var(--warn-line); }

.side-foot { padding: 10px; border-top: 1px solid var(--side-line); flex: 0 0 auto; }

/* --- topo --- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-top);
  height: var(--top-h); flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 0 20px 0 14px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; color: var(--muted); }
.crumbs .sep { color: var(--faint); }
.crumbs b { color: var(--ink); font-weight: 550; white-space: nowrap; }
.crumbs span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.top-search {
  display: flex; align-items: center; gap: 8px; width: 260px; height: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--muted);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.top-search:focus-within { border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--ring); }
.top-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 13px; }
.top-search kbd { font-size: 10.5px; color: var(--faint); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.icon-btn {
  width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; position: relative;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2);
  cursor: pointer; transition: background .15s ease, color .15s ease, transform .1s ease;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:active { transform: scale(.95); }
.icon-btn .pip { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px var(--bg); }
.avatar {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto;
  background: var(--primary); color: var(--primary-ink); font: 600 12px/1 var(--font); letter-spacing: .02em;
}
.avatar-btn { display: flex; align-items: center; gap: 8px; padding: 2px; border: 0; background: none; cursor: pointer; border-radius: 9px; color: var(--ink); }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 3px var(--ring); }

.theme-ic-light, .theme-ic-dark { display: contents; }
.theme-ic-dark, :root[data-theme="dark"] .theme-ic-light { display: none; }
:root[data-theme="dark"] .theme-ic-dark { display: contents; }

/* --- conteúdo --- */
.content { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 26px 28px 72px; overflow-x: clip; }

/* cabeçalho de página */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1, h1 { font-size: 28px; font-weight: 700; line-height: 1.2; margin: 0; }
.page-desc { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; max-width: 72ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
h2 { font-size: 17px; font-weight: 600; margin: 0; }
h3 { font-size: 13.5px; font-weight: 600; margin: 0; }

/* sidebar no celular: overlay */
.side-scrim { display: none; }
.side-open { display: none; } /* legado: o botão de abrir agora fica no topo */
@media (max-width: 900px) {
  .top-search { display: none; }
  .content { padding: 20px 16px 64px; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; box-shadow: var(--shadow); }
  :root:not([data-sidebar="off"]) .side-scrim {
    display: block; position: fixed; inset: 0; z-index: calc(var(--z-side) - 1);
    background: rgba(9, 9, 11, .45); backdrop-filter: blur(2px);
  }
}
@media (prefers-reduced-motion: reduce) { .sidebar, html { transition: none; scroll-behavior: auto; } }

/* ============================================================ COMPONENTES */

/* --- botões --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: 500 13px/1 var(--font); white-space: nowrap; text-decoration: none;
  cursor: pointer; box-shadow: var(--shadow-xs);
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--hover); border-color: var(--line-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn .ic { width: 15px; height: 15px; }
/* Ação principal: dourado sólido (nos dois temas), texto escuro para contraste AA. */
.btn-primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 600; }
.btn-primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--hover); border-color: transparent; color: var(--ink); }
.btn-danger { color: var(--danger-ink); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink); }
.btn-ok, .btn.btn-ok { color: var(--ok-ink); border-color: var(--ok-line); background: var(--ok-soft); }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover { filter: brightness(1.06); background: var(--brand); }
.btn.small, .btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn.small .ic, .btn-sm .ic { width: 14px; height: 14px; }
.btn-icon { width: 28px; padding: 0; }
.btn-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-block { width: 100%; }
a.btn { text-decoration: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --- dourado (utilitários) --- */
.text-gold { color: var(--gold-text); }
.bg-gold { background: var(--gold); color: var(--gold-ink); }
.inline { display: inline; }
form.inline { display: inline-flex; }

/* --- badges (substituem os "chips" antigos; as classes antigas continuam) --- */
.badge, .chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font: 500 12px/1 var(--font); white-space: nowrap;
  color: var(--ink-2); background: var(--sunken); border: 1px solid var(--line);
}
.badge .ic { width: 12px; height: 12px; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok, .chip-live, .chip-sent, .chip-sent_dm { color: var(--ok-ink); background: var(--ok-soft); border-color: var(--ok-line); }
.badge-warn, .chip-skipped_rate_limit, .chip-skipped_cooldown { color: var(--warn-ink); background: var(--warn-soft); border-color: var(--warn-line); }
.badge-danger, .chip-failed, .chip-off { color: var(--danger-ink); background: var(--danger-soft); border-color: var(--danger-line); }
.badge-gold { color: var(--gold-text); background: var(--gold-wash); border-color: var(--gold-line); font-weight: 600; }
/* Etiqueta pequena ao lado de um rótulo ("do fornecedor", "falta"). */
.chip-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: var(--radius-xs); font-size: 11px; font-weight: 600; color: var(--muted); background: var(--sunken); border: 1px solid var(--line); }
.chip-tag.is-danger { color: var(--danger-ink); background: var(--danger-soft); border-color: var(--danger-line); }
/* Campo de dinheiro com o "R$" dentro da borda. */
.input-money { position: relative; display: block; }
.input-money > span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--muted); pointer-events: none; }
.content .input-money > input:not([type]) { width: 100%; padding-left: 34px; font-variant-numeric: tabular-nums; }
.badge-info, .chip-shadow { color: var(--info-ink); background: var(--info-soft); border-color: var(--info-line); }
.badge-brand { color: var(--brand-ink); background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip b { margin-left: 2px; font-weight: 600; }

/* --- cartões --- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 18px 20px; margin-bottom: 16px; min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head, .card-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px;
}
.card.flush > .card-head, .card.flush > .card-header { padding: 16px 20px 0; }
.card-title { font-size: 16px; font-weight: 600; margin: 0; }
.card-desc { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.card-body { padding: 0 20px 18px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--sunken) 50%, transparent); }
.card-highlight { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 12%, transparent), var(--shadow-sm); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }

/* grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 1100px) { .grid-main { grid-template-columns: minmax(0, 1fr); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

/* --- alertas / banners --- */
.alert, .banner {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; margin-bottom: 16px; border-radius: var(--radius-md);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-xs);
  font-size: 13px; line-height: 1.55;
}
.alert-ic {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center;
  background: var(--sunken); color: var(--ink-2);
}
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.alert-text { color: var(--muted); margin-top: 1px; }
.alert-actions { flex: 0 0 auto; align-self: center; }
.alert-warn .alert-ic, .banner.warn .alert-ic { background: var(--warn-soft); color: var(--warn); }
.alert-ok .alert-ic { background: var(--ok-soft); color: var(--ok); }
.alert-danger .alert-ic { background: var(--danger-soft); color: var(--danger); }
.alert-info .alert-ic { background: var(--info-soft); color: var(--info); }
.alert-brand .alert-ic { background: var(--brand-soft); color: var(--brand); }
.banner.warn { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn-ink); }

/* aviso curto de ação (?msg=) */
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; margin-bottom: 16px; border-radius: var(--radius-md);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  font-size: 13px; color: var(--ink);
  animation: flash-in .35s cubic-bezier(.32, .72, 0, 1);
}
.flash::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
  background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft);
}
.flash.is-error::before { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } }


/* --- estado vazio --- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 40px 20px; color: var(--muted);
}
.empty-ic {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 6px;
  background: var(--sunken); border: 1px solid var(--line); color: var(--ink-2);
}
.empty-ic .ic { width: 20px; height: 20px; }
.empty-title { font-weight: 600; color: var(--ink); font-size: 14px; }
.empty-text { font-size: 13px; max-width: 46ch; }
.empty .btn { margin-top: 10px; }

/* --- formulários --- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--muted); }
.content input[type="text"], .content input[type="url"], .content input[type="search"],
.content input[type="number"], .content input[type="password"], .content input[type="email"],
.content input[type="datetime-local"], .content input:not([type]), .content select, .content textarea, .input {
  height: 34px; padding: 0 10px; width: auto; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--ink);
  font: inherit; font-size: 13px; box-shadow: var(--shadow-xs);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.content textarea { height: auto; padding: 8px 10px; line-height: 1.5; resize: vertical; }
.content select {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 16px;
}
.content input::placeholder, .content textarea::placeholder { color: var(--faint); }
.content input:focus-visible, .content select:focus-visible, .content textarea:focus-visible, .input:focus-visible {
  outline: none; border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--ring);
}
.content input[type="file"] { height: auto; padding: 0; border: 0; box-shadow: none; color: var(--muted); font-size: 13px; background: none; }
.content input[type="file"]::file-selector-button {
  height: 32px; padding: 0 12px; margin-right: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink); font: 500 13px var(--font); cursor: pointer;
}
.content input[type="file"]::file-selector-button:hover { background: var(--hover); }
:root[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(1); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.chk[hidden] { display: none; }

/* switch (checkbox com cara de chave) */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; flex: 0 0 auto;
  transition: background .2s ease;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .22s cubic-bezier(.32, .72, 0, 1);
}
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
:root[data-theme="dark"] .switch input:checked + .switch-track::after { background: var(--primary-ink); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--ring); }

.filters, .toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 220px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 16px; align-items: start; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.form-grid label .small, .form-grid label .hint { font-weight: 400; }
.form-grid label input, .form-grid label select, .form-grid label textarea { width: 100%; }
.form-grid.compact { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-top: 10px; min-width: min(560px, 80vw); }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; grid-column: 1 / -1; }
.cfg { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cfg label { font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.targets-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* --- tabelas --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card:not(.flush) > .table-wrap:last-child { margin-bottom: -18px; }
table { border-collapse: collapse; width: 100%; }
table.data th, table.data td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th {
  font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .02em; text-transform: uppercase;
  padding-top: 9px; padding-bottom: 9px; background: color-mix(in srgb, var(--sunken) 55%, transparent); white-space: nowrap;
}
table.data tbody tr { transition: background .12s ease; }
table.data tbody tr:hover td { background: color-mix(in srgb, var(--sunken) 60%, transparent); }
table.data tbody tr:last-child td { border-bottom: 0; }
.card.flush table.data th:first-child, .card.flush table.data td:first-child { padding-left: 20px; }
.card.flush table.data th:last-child, .card.flush table.data td:last-child { padding-right: 20px; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.txt { max-width: 100%; overflow-wrap: break-word; word-break: break-word; }
.ellipsis-cell { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-title { font-weight: 500; color: var(--ink); }
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.tiny { font-size: 12px; color: var(--muted); }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }

/* --- KPIs (estilo da referência: rótulo, número grande, variação + sparkline) --- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-height: 118px;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.kpi-icon { display: none; }
/* Ícone no canto do indicador e a variação dourada (número financeiro de destaque). */
.kpi-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--sunken); color: var(--muted); }
.kpi.is-gold { border-color: var(--gold-line); }
.kpi.is-gold .kpi-value { color: var(--gold-text); }
.kpi.is-gold .kpi-ic { background: var(--gold-wash); color: var(--gold-text); }
.kpi-value { font-size: 28px; font-weight: 600; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpi-of { font-size: 15px; font-weight: 500; color: var(--muted); }
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-delta {
  display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 6px; border-radius: 5px;
  font: 500 12px/1 var(--font); font-variant-numeric: tabular-nums;
  background: var(--sunken); color: var(--muted); border: 1px solid var(--line);
}
.kpi-delta svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.kpi-delta-up { color: var(--ok-ink); background: var(--ok-soft); border-color: var(--ok-line); }
.kpi-delta-down { color: var(--danger-ink); background: var(--danger-soft); border-color: var(--danger-line); }
.kpi-spark { width: 64px; height: 24px; flex: 0 0 auto; pointer-events: none; }
.kpi-spark svg { display: block; width: 100%; height: 100%; }

/* barra de progresso / medidor */
.meter { height: 6px; border-radius: 999px; background: var(--sunken); overflow: hidden; margin: 10px 0 4px; border: 1px solid var(--line); }
.meter-fill { display: block; height: 100%; background: var(--ok); border-radius: inherit; transition: width .6s cubic-bezier(.32, .72, 0, 1); }
.meter-fill.meter-warn { background: var(--warn); }
.meter-fill.meter-danger { background: var(--danger); }

/* lista de chave/valor */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 12px 0 0; align-items: center; }
.kv dt { font-size: 12.5px; color: var(--muted); }
.kv dd { margin: 0; min-width: 0; }
.token-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.token { word-break: break-all; user-select: all; font-family: var(--mono); }

/* linha de lista (ex.: fila, timeline) */
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-ic { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center; background: var(--sunken); color: var(--ink-2); }
.list-main { flex: 1; min-width: 0; }
.list-end { text-align: right; flex: 0 0 auto; }

/* passos numerados (instalação) */
.steps { list-style: none; counter-reset: s; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.steps > li { counter-increment: s; position: relative; padding-left: 40px; line-height: 1.55; color: var(--ink-2); }
.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; font: 600 12px/1 var(--mono); color: var(--ink); background: var(--sunken); border: 1px solid var(--line);
}
.steps > li.is-done::before { content: "✓"; color: var(--ok-ink); background: var(--ok-soft); border-color: var(--ok-line); }

/* tabs / segmentado */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-sm); background: var(--sunken); border: 1px solid var(--line); }
.segmented a, .segmented button {
  height: 26px; padding: 0 10px; border-radius: 5px; border: 0; background: transparent; color: var(--muted);
  font: 500 12.5px/26px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.segmented .on, .segmented [aria-current="page"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-xs); }

/* detalhes "editar" que abrem um popover */
.inline-details { display: inline-block; position: relative; }
.inline-details > summary { list-style: none; cursor: pointer; }
.inline-details > summary::-webkit-details-marker { display: none; }
.inline-details[open] > form {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow);
}

/* paginação */
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 14px; }
.pager-btn {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); color: var(--ink); box-shadow: var(--shadow-xs);
}
a.pager-btn:hover { background: var(--hover); }
.pager-btn[disabled] { opacity: .4; pointer-events: none; }
.pager-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pager-current { min-width: 32px; height: 32px; padding: 0 10px; border-radius: var(--radius-sm); display: inline-grid; place-items: center; background: var(--primary); color: var(--primary-ink); font: 600 12.5px/1 var(--mono); }

/* ============================================================ MASCOTE DO ROBÔ
   O "garimpeiro": rosto quadrado, antena com uma pepita.
   .is-run    garimpando  → olhos piscam, pepita brilha, feixe de varredura
   .is-sleep  dormindo    → olhos fechados, respira devagar, "z" sobem
   .is-pause  pausado     → olhos em traço, âmbar
   .is-new    aguardando  → contorno tracejado
   ======================================================================== */
.bot { --bot-c: var(--muted); --bot-face: var(--card); --bot-lamp: var(--bot-c); position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto; }
.bot svg { width: 100%; height: 100%; overflow: visible; }
.bot .b-head, .bot .b-helmet { fill: var(--bot-face); stroke: var(--bot-c); stroke-width: 1.6; stroke-linejoin: round; }
.bot .b-ear { fill: var(--bot-face); stroke: var(--bot-c); stroke-width: 1.4; }
.bot .b-ant { stroke: var(--bot-c); stroke-width: 1.6; stroke-linecap: round; }
.bot .b-ridge { fill: none; stroke: var(--bot-c); stroke-width: 1.2; stroke-linecap: round; opacity: .55; }
.bot .b-brim { stroke: var(--bot-c); stroke-width: 2; stroke-linecap: round; }
.bot .b-lamp-ring { fill: var(--bot-face); stroke: var(--bot-c); stroke-width: 1.4; }
.bot .b-gem { fill: var(--bot-lamp); transform-box: fill-box; transform-origin: center; }  /* a lanterna */
.bot .b-lamp-bars { stroke: var(--bot-face); stroke-width: .9; stroke-linecap: round; opacity: 0; }
.bot .b-beam { fill: var(--brand); opacity: 0; transform-box: fill-box; transform-origin: center; }
.bot .b-cone { fill: url(#bot-cone-grad); opacity: 0; display: none; }
.bot .b-eye { fill: var(--bot-c); transform-box: fill-box; transform-origin: center; }
.bot .b-lid, .bot .b-flat { fill: none; stroke: var(--bot-c); stroke-width: 1.6; stroke-linecap: round; opacity: 0; }
.bot .b-scan { fill: url(#bot-scan-grad); opacity: 0; }
/* selo do canto: só um aparece por estado */
/* picareta: gira em torno da ponta do cabo (32.2, 8.6), como quem cava */
.bot .b-pick { opacity: 0; transform-box: view-box; transform-origin: 32.2px 8.6px; }
.bot .b-pick-handle { stroke: var(--bot-c); stroke-width: 1.5; stroke-linecap: round; }
.bot .b-pick-head { fill: none; stroke: var(--bot-c); stroke-width: 1.7; stroke-linecap: round; }
.bot .b-z { fill: var(--bot-c); font: 700 7px var(--font); opacity: 0; }
.bot .b-bars { stroke: var(--bot-c); stroke-width: 1.8; stroke-linecap: round; opacity: 0; }
.bot-lg { width: 56px; height: 56px; }
.bot-sm { width: 28px; height: 28px; }

/* garimpando: verde, lanterna dourada acesa, engrenagem girando */
.bot.is-run { --bot-c: var(--ok); --bot-lamp: var(--brand); }
.bot.is-run .b-lamp-ring { stroke: var(--brand); }
.bot.is-run .b-gem { animation: gem-glow 1.8s ease-in-out infinite; }
.bot.is-run .b-beam { animation: lamp-beam 1.8s ease-in-out infinite; }
.bot.is-run .b-eye { animation: eye-blink 4.2s infinite; }
.bot.is-run .b-scan { opacity: 1; animation: scan-sweep 2.4s cubic-bezier(.45, 0, .55, 1) infinite; }
.bot.is-run .b-pick { opacity: 1; animation: pick-swing 1.6s cubic-bezier(.5, 0, .3, 1) infinite; }
.bot-lg.is-run .b-cone { display: inline; animation: cone-glow 2.4s ease-in-out infinite; }
/* dormindo: cinza, lanterna apagada, zz */
.bot.is-sleep { --bot-c: var(--faint); }
.bot.is-sleep .b-eye { opacity: 0; }
.bot.is-sleep .b-lid { opacity: 1; }
.bot.is-sleep svg { animation: bot-breathe 3.6s ease-in-out infinite; transform-origin: 50% 90%; }
.bot.is-sleep .b-z { animation: z-float 3s ease-in infinite; }
.bot.is-sleep .b-z2 { animation-delay: 1s; }
.bot.is-sleep .b-z3 { animation-delay: 2s; }
/* pausado: laranja, olhos retos, "||" no canto e na lanterna */
.bot.is-pause { --bot-c: var(--warn); }
.bot.is-pause .b-eye { opacity: 0; }
.bot.is-pause .b-flat { opacity: 1; }
.bot.is-pause .b-bars, .bot.is-pause .b-lamp-bars { opacity: 1; }
/* nunca rodou: tracejado, lanterna apagada */
.bot.is-new { --bot-c: var(--faint); }
.bot.is-new .b-head { stroke-dasharray: 3 3; fill: transparent; }
.bot.is-new .b-eye { opacity: .45; }
/* tema escuro: os estados ativos brilham */
:root[data-theme="dark"] .bot.is-run svg { filter: drop-shadow(0 0 3px color-mix(in srgb, var(--ok) 55%, transparent)); }
:root[data-theme="dark"] .bot.is-pause svg { filter: drop-shadow(0 0 3px color-mix(in srgb, var(--warn) 50%, transparent)); }

@keyframes lamp-beam { 0%, 100% { opacity: .1; transform: scale(.75); } 50% { opacity: .32; transform: scale(1.05); } }
@keyframes lamp-beam-soft { 0%, 100% { opacity: .1; } 50% { opacity: .3; } }
@keyframes cone-glow { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes pick-swing { 0%, 100% { transform: rotate(-28deg); } 45% { transform: rotate(-32deg); } 62% { transform: rotate(12deg); } 70% { transform: rotate(6deg); } 78% { transform: rotate(10deg); } }
@keyframes eye-blink { 0%, 44%, 50%, 100% { transform: scaleY(1); } 47% { transform: scaleY(.1); } }
@keyframes gem-glow { 0%, 100% { filter: drop-shadow(0 0 0 transparent); transform: scale(1); } 50% { filter: drop-shadow(0 0 3px var(--brand)); transform: scale(1.18); } }
@keyframes scan-sweep { 0% { transform: translateX(-14px); opacity: 0; } 15% { opacity: .9; } 85% { opacity: .9; } 100% { transform: translateX(14px); opacity: 0; } }
@keyframes bot-breathe { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(1px) rotate(-6deg) scale(.98); } }
@keyframes z-float { 0% { opacity: 0; transform: translate(0, 0) scale(.7); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -12px) scale(1.15); } }
/* "Reduzir movimento" do sistema (no Windows: Efeitos de animação desligado):
   o robozinho é o indicador de estado, então segue vivo — mas só com brilho,
   piscar e esmaecer, sem nada se deslocando, girando ou crescendo. */
@media (prefers-reduced-motion: reduce) {
  .bot *, .bot svg { animation: none !important; }
  .bot.is-run .b-gem { animation: gem-glow-soft 2.4s ease-in-out infinite !important; }
  .bot.is-run .b-beam { animation: lamp-beam-soft 2.4s ease-in-out infinite !important; }
  .bot.is-run .b-eye { animation: eye-blink 4.2s infinite !important; }
  .bot-lg.is-run .b-cone { animation: cone-glow 2.4s ease-in-out infinite !important; }
  .bot.is-run .b-pick { animation: pick-swing-soft 2.2s ease-in-out infinite !important; }
  .bot.is-sleep .b-z { animation: z-fade 3s ease-in-out infinite !important; }
  .bot.is-sleep .b-z2 { animation-delay: 1s !important; }
  .bot.is-sleep .b-z3 { animation-delay: 2s !important; }
}
@keyframes gem-glow-soft { 0%, 100% { filter: drop-shadow(0 0 0 transparent); } 50% { filter: drop-shadow(0 0 3px var(--brand)); } }
@keyframes pick-swing-soft { 0%, 100% { transform: rotate(-14deg); } 55% { transform: rotate(6deg); } }
@keyframes z-fade { 0%, 100% { opacity: 0; } 40% { opacity: 1; } }

/* cartão de status do robô (rodapé da barra lateral) */
.botcard {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 11px; border-radius: var(--radius-md);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-xs);
}
.botcard-txt { flex: 1; min-width: 0; line-height: 1.3; }
.botcard-state { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.botcard-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.botcard-sub a { color: var(--brand-ink); font-weight: 500; }
.botcard-name {font: 500 12px/1 var(--mono); color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); position: relative; flex: 0 0 auto; }
.live-dot::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; background: var(--ok); opacity: .35; animation: live-pulse 1.8s ease-out infinite; }
@keyframes live-pulse { 0% { transform: scale(.6); opacity: .5; } 100% { transform: scale(2.2); opacity: 0; } }
.botcard + .botcard { margin-top: 8px; }
.botcard .icon-btn { width: 30px; height: 30px; color: var(--muted); }
.botcard .icon-btn:hover { color: var(--ink); }
.bots-more { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.bot-mini { display: flex; align-items: center; gap: 8px; padding: 4px 6px; font-size: 12px; color: var(--ink-2); }
.bot-mini .bot { width: 22px; height: 22px; }

/* cartão grande de status (Visão geral / Robôs) */
.bot-hero { display: flex; align-items: center; gap: 16px; }
.bot-hero .bot { width: 64px; height: 64px; }
.bot-hero-title { font-size: 16px; font-weight: 600; }
.bot-hero-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ============================================================ CONTA (drawer) */
.dw-overlay { position: fixed; inset: 0; z-index: var(--z-overlay); background: rgba(9, 9, 11, .42); backdrop-filter: blur(3px); opacity: 0; transition: opacity .3s ease; }
.dw-overlay.open { opacity: 1; }
.dw {
  position: fixed; top: 12px; right: 12px; bottom: auto; left: auto; z-index: calc(var(--z-overlay) + 1);
  width: min(380px, calc(100vw - 24px));
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden;
  transform: translateY(-8px) scale(.98); opacity: 0; transform-origin: top right;
  transition: transform .28s cubic-bezier(.32, .72, 0, 1), opacity .2s ease;
}
.dw.open { transform: none; opacity: 1; }
.dw-grip { display: none; }
.dw-sheet { overflow: hidden; transition: height .3s cubic-bezier(.32, .72, 0, 1); }
.dw-view { padding: 14px; }
.dw-view[hidden] { display: none; }
.dw-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 32px; margin-bottom: 10px; }
.dw-head h2, .dw-view > h2 { font-size: 14.5px; font-weight: 600; margin: 0 0 4px; }
.dw-who { display: flex; align-items: center; gap: 10px; padding: 4px 4px 12px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.dw-who .avatar { width: 36px; height: 36px; font-size: 13px; }
.dw-who b { display: block; font-size: 13.5px; }
.dw-who span { font-size: 12px; color: var(--muted); }
.dw-x, .dw-back {
  width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; padding: 0;
  border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.dw-x:hover, .dw-back:hover { background: var(--hover); color: var(--ink); }
.dw-x svg, .dw-back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dw-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  height: 38px; padding: 0 10px; margin: 0; border-radius: var(--radius-sm);
  background: transparent; border: 0; color: var(--ink); font: 450 13.5px var(--font); cursor: pointer;
  transition: background .12s ease;
}
.dw-row:hover { background: var(--hover); }
.dw-row .ic { width: 16px; height: 16px; color: var(--muted); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dw-row > span { flex: 1; }
.dw-row .dw-caret { width: 15px; height: 15px; fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dw-sep { height: 1px; background: var(--line); margin: 6px 0; }
.dw-check input { width: 15px; height: 15px; }
.dw-row.dw-danger { color: var(--danger-ink); }
.dw-row.dw-danger .ic { color: var(--danger); }
.dw-subhead { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); margin: 10px 0 6px; }
.dw-view p { font-size: 13px; line-height: 1.55; color: var(--muted); margin: 0 0 14px; }
.dw-actions { display: flex; gap: 8px; justify-content: flex-end; }
.dw-inline { display: contents; }
.dw-btn {
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm); cursor: pointer;
  font: 500 13px var(--font); border: 1px solid var(--line); background: var(--card); color: var(--ink); box-shadow: var(--shadow-xs);
}
.dw-btn:hover { background: var(--hover); }
.dw-btn.ghost { box-shadow: none; }
.dw-btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.dw-btn.primary:hover { background: var(--primary-hover); }
.dw-btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.dw-btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.dw-form { display: flex; flex-direction: column; gap: 8px; }
.dw-form input {
  height: 36px; padding: 0 11px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--input-bg); color: var(--ink); font: inherit; font-size: 13.5px;
}
.dw-form input:focus-visible { outline: none; border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--ring); }
.dw-form .dw-actions { margin-top: 6px; }
.dw-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 5px; background: var(--sunken); border: 1px solid var(--line); color: var(--muted); font: 500 11px/1 var(--mono); }
.dw-users { list-style: none; margin: 0 0 12px; padding: 0; }
.dw-users li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13.5px; }
.dw-users li:hover { background: var(--hover); }
.dw-me { font-size: 12px; font-weight: 500; color: var(--brand-ink); background: var(--brand-soft); padding: 2px 6px; border-radius: 5px; margin-left: 6px; }
@media (prefers-reduced-motion: reduce) { .dw, .dw-sheet, .dw-overlay { transition: none; } }

/* ================================================================ LOGIN */
/* Nebulosa (static/login-sky.js) atrás da página inteira; o cartão de login
   fica em vidro fosco com um halo embaçado em volta. As cores da nebulosa são
   as mesmas nos dois temas — é a "vitrine" da marca, não uma tela de trabalho. */
.login-body {
  --nebula-void: #05040c;
  --nebula-violet: rgba(110, 50, 170, .34);
  --nebula-magenta: rgba(170, 60, 150, .22);
  --nebula-teal: rgba(20, 110, 140, .24);
  --nebula-ink: #fafafa;
  --nebula-muted: #b9b4cc;
  position: relative; min-height: 100dvh; display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background:
    radial-gradient(60vw 50vh at 20% 25%, var(--nebula-violet), transparent 70%),
    radial-gradient(50vw 45vh at 75% 70%, var(--nebula-magenta), transparent 70%),
    radial-gradient(45vw 40vh at 60% 15%, var(--nebula-teal), transparent 70%),
    var(--nebula-void);
}
.login-sky {
  position: fixed; inset: 0; z-index: 0; display: block; width: 100%; height: 100%;
  opacity: 0; transition: opacity .8s ease; pointer-events: none;
}
.has-sky > .login-sky { opacity: 1; }
/* Versão leve (login-sky.js escolhe quando o PC não tem aceleração de vídeo ou
   a animação fica lenta): a mesma nebulosa em gradientes, só deslizando —
   o navegador move a camada pronta, sem recalcular nada por pixel. */
.login-body::before, .login-body::after {
  content: ""; position: fixed; z-index: 0; pointer-events: none; opacity: 0; transition: opacity .8s ease;
}
.login-body::before {
  inset: -15%;
  background:
    radial-gradient(38% 30% at 30% 35%, rgba(130, 60, 200, .55), transparent 70%),
    radial-gradient(34% 28% at 70% 62%, rgba(190, 70, 165, .42), transparent 70%),
    radial-gradient(30% 24% at 58% 28%, rgba(25, 125, 155, .40), transparent 70%),
    radial-gradient(26% 22% at 22% 75%, rgba(80, 40, 160, .35), transparent 70%);
}
.login-body::after {
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 27% 64%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 41% 33%, #fff, transparent), radial-gradient(1px 1px at 55% 81%, #fff, transparent),
    radial-gradient(1px 1px at 68% 12%, #fff, transparent), radial-gradient(1.5px 1.5px at 83% 47%, #fff, transparent),
    radial-gradient(1px 1px at 91% 76%, #fff, transparent), radial-gradient(1px 1px at 6% 52%, #fff, transparent);
  background-size: 420px 420px;
}
.sky-lite::before { opacity: 1; animation: nebula-drift 40s ease-in-out infinite alternate; will-change: transform; }
.sky-lite::after { opacity: .7; animation: stars-twinkle 6s ease-in-out infinite alternate; }
@keyframes nebula-drift {
  from { transform: translate3d(-4%, -3%, 0) scale(1.04) rotate(-2deg); }
  to { transform: translate3d(4%, 3%, 0) scale(1.14) rotate(3deg); }
}
@keyframes stars-twinkle { from { opacity: .45; } to { opacity: .85; } }
@media (prefers-reduced-motion: reduce) { .sky-lite::before, .sky-lite::after { animation: none; } }
.login-aside {
  position: relative; z-index: 1; overflow: hidden; display: flex; flex-direction: column;
  justify-content: space-between; padding: 40px; color: var(--nebula-ink);
}
/* Legibilidade do texto sobre o céu: escurece a faixa da esquerda e some até
   a borda do painel (nada de emenda reta no meio da página). */
.login-aside::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(5, 4, 12, .72) 0%, rgba(5, 4, 12, .35) 55%, rgba(5, 4, 12, 0) 100%),
    radial-gradient(70% 40% at 0% 100%, rgba(5, 4, 12, .55), rgba(5, 4, 12, 0));
}
.login-aside > * { position: relative; z-index: 1; }
.login-logo { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.login-logo .logo { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.login-quote { max-width: 42ch; }
.login-quote h2 { font-size: 26px; line-height: 1.2; font-weight: 600; margin: 0 0 12px; color: var(--nebula-ink); }
.login-quote p { margin: 0; color: var(--nebula-muted); font-size: 14px; line-height: 1.6; }
.login-stats { display: flex; gap: 28px; }
.login-stats b { display: block; font: 600 20px/1.2 var(--font); }
.login-stats span { font-size: 12px; color: var(--nebula-muted); }
.login-main { position: relative; z-index: 1; display: grid; place-items: center; padding: 32px 20px; }
/* Halo: em volta do cartão o céu fica desfocado e esmaecido ("vista embaçada"),
   sumindo aos poucos — o olho vai para o login sem um recorte duro. */
.login-main::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: min(720px, 120%); height: min(760px, 110%);
  transform: translate(-50%, -50%); pointer-events: none;
  -webkit-backdrop-filter: blur(30px) saturate(1.2); backdrop-filter: blur(30px) saturate(1.2);
  background: radial-gradient(closest-side, rgba(150, 90, 210, .16), rgba(5, 4, 12, .25) 60%, rgba(5, 4, 12, 0));
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
}
/* Cartão de login: vidro escuro (igual nos dois temas, como a nebulosa),
   luz correndo pela borda, campos com ícone e inclinação 3D leve seguindo o
   mouse (static/login-card.js). Efeitos ficam em .lc-fx, sem pegar clique. */
.login-card {
  --lc-ink: #fafafa; --lc-muted: rgba(250, 250, 250, .6); --lc-faint: rgba(250, 250, 250, .4);
  position: relative; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px;
  padding: 30px 26px 24px; border-radius: calc(var(--radius-lg) + 4px); color: var(--lc-ink);
  background: rgba(8, 6, 18, .52);
  border: 1px solid rgba(255, 255, 255, .07);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .05);
  -webkit-backdrop-filter: blur(20px) saturate(1.3); backdrop-filter: blur(20px) saturate(1.3);
  transform: perspective(1500px) rotateX(var(--lc-rx, 0deg)) rotateY(var(--lc-ry, 0deg));
  transition: transform .5s cubic-bezier(.2, .8, .2, 1);
  animation: lc-in .8s cubic-bezier(.2, .8, .2, 1) both;
}
.login-card.is-tilting { transition: transform .12s linear; }
.login-card > :not(.lc-fx) { position: relative; z-index: 1; }
@keyframes lc-in { from { opacity: 0; translate: 0 20px; } to { opacity: 1; translate: 0 0; } }

.lc-fx { position: absolute; inset: -1px; border-radius: inherit; overflow: hidden; pointer-events: none; z-index: 0; }
.lc-grid {
  position: absolute; inset: 0; opacity: .035;
  background-image: linear-gradient(135deg, #fff .5px, transparent .5px), linear-gradient(45deg, #fff .5px, transparent .5px);
  background-size: 30px 30px;
}
.lc-beam { position: absolute; opacity: .7; filter: blur(1.5px); animation: 3.5s ease-in-out infinite; }
.lc-beam-t, .lc-beam-b { height: 2px; width: 50%; background: linear-gradient(90deg, transparent, #fff, transparent); }
.lc-beam-r, .lc-beam-l { width: 2px; height: 50%; background: linear-gradient(180deg, transparent, #fff, transparent); }
.lc-beam-t { top: 0; left: 0; animation-name: lc-run-x; }
.lc-beam-b { bottom: 0; right: 0; animation-name: lc-run-x-rev; animation-delay: 1.2s; }
.lc-beam-r { top: 0; right: 0; animation-name: lc-run-y; animation-delay: .6s; }
.lc-beam-l { bottom: 0; left: 0; animation-name: lc-run-y-rev; animation-delay: 1.8s; }
@keyframes lc-run-x { 0% { transform: translateX(-100%); opacity: .2; } 35% { opacity: .75; } 71%, 100% { transform: translateX(200%); opacity: .2; } }
@keyframes lc-run-x-rev { 0% { transform: translateX(100%); opacity: .2; } 35% { opacity: .75; } 71%, 100% { transform: translateX(-200%); opacity: .2; } }
@keyframes lc-run-y { 0% { transform: translateY(-100%); opacity: .2; } 35% { opacity: .75; } 71%, 100% { transform: translateY(200%); opacity: .2; } }
@keyframes lc-run-y-rev { 0% { transform: translateY(100%); opacity: .2; } 35% { opacity: .75; } 71%, 100% { transform: translateY(-200%); opacity: .2; } }
.lc-dot { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .5); filter: blur(1.5px); animation: lc-pulse 2.2s ease-in-out infinite alternate; }
.lc-dot-tl { top: 0; left: 0; }
.lc-dot-tr { top: 0; right: 0; animation-delay: .5s; }
.lc-dot-br { bottom: 0; right: 0; animation-delay: 1s; }
.lc-dot-bl { bottom: 0; left: 0; animation-delay: 1.5s; }
@keyframes lc-pulse { from { opacity: .2; } to { opacity: .5; } }

.lc-head { text-align: center; display: grid; justify-items: center; gap: 4px; }
.lc-mark {
  width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 8px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .1);
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, .12), transparent 70%);
  animation: lc-pop .8s cubic-bezier(.3, 1.5, .5, 1) both;
}
.lc-mark .logo { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.lc-head h1 {
  margin: 0; font-size: 21px; font-weight: 600;
  background: linear-gradient(180deg, #fff, rgba(255, 255, 255, .78)); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: lc-in .6s .15s cubic-bezier(.2, .8, .2, 1) both;
}
.lc-head p { margin: 0; font-size: 13px; color: var(--lc-muted); animation: lc-in .6s .25s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes lc-pop { from { opacity: 0; scale: .5; } to { opacity: 1; scale: 1; } }

.lc-fields { display: grid; gap: 12px; }
.lc-field { position: relative; display: block; transition: transform .25s cubic-bezier(.3, 1.4, .5, 1); }
.lc-field:hover { transform: scale(1.01); }
.lc-field:focus-within { transform: scale(1.02); z-index: 2; }
.lc-field > .lc-ic {
  position: absolute; left: 13px; top: 50%; translate: 0 -50%; z-index: 1; width: 16px; height: 16px;
  color: var(--lc-faint); pointer-events: none; transition: color .25s ease;
}
.lc-field:focus-within > .lc-ic { color: var(--lc-ink); }
.login-card .lc-field input {
  width: 100%; height: 42px; padding: 0 14px 0 40px; border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, .06); background: rgba(255, 255, 255, .05);
  color: var(--lc-ink); font: inherit; font-size: 14px;
  transition: background .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.login-card .lc-field input::placeholder { color: rgba(250, 250, 250, .34); }
.login-card .lc-field input:hover { border-color: rgba(255, 255, 255, .12); }
.login-card .lc-field input:focus-visible {
  outline: none; background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .24);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .08);
}
/* autocompletar do navegador pinta o campo de amarelo/branco: mantém o vidro */
.login-card .lc-field input:-webkit-autofill {
  -webkit-text-fill-color: var(--lc-ink); caret-color: var(--lc-ink);
  -webkit-box-shadow: 0 0 0 40px #1a1726 inset; transition: background-color 9999s;
}
.login-card .lc-field .pw-wrap > input[type] { padding-right: 44px; }
.login-card .pw-eye { color: var(--lc-faint); }
.login-card .pw-eye:hover { color: var(--lc-ink); }
.login-card .pw-eye:focus-visible { box-shadow: 0 0 0 3px rgba(255, 255, 255, .14); }

.login-btn {
  position: relative; height: 42px; width: 100%; margin-top: 2px; display: grid; place-items: center;
  border: 0; border-radius: var(--radius-md); cursor: pointer; overflow: hidden;
  background: #fafafa; color: #0a0a0a; font: 600 14px/1 var(--font);
  transition: transform .2s cubic-bezier(.3, 1.4, .5, 1), box-shadow .3s ease;
}
.login-btn:hover { transform: scale(1.02); box-shadow: 0 8px 28px -6px rgba(255, 255, 255, .35); }
.login-btn:active { transform: scale(.98); }
.login-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.login-btn > * { grid-area: 1 / 1; }
.lc-btn-text { display: inline-flex; align-items: center; gap: 6px; transition: opacity .2s ease; }
.lc-btn-text .ic { width: 14px; height: 14px; transition: transform .3s ease; }
.login-btn:hover .lc-btn-text .ic { transform: translateX(3px); }
.lc-spin {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(10, 10, 10, .7); border-top-color: transparent;
  opacity: 0; animation: lc-spin .8s linear infinite;
}
.login-btn::after {
  content: ""; position: absolute; inset: 0; opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .08), transparent);
}
.login-btn.is-loading { cursor: progress; }
.login-btn.is-loading .lc-btn-text { opacity: 0; }
.login-btn.is-loading .lc-spin { opacity: 1; }
.login-btn.is-loading::after { opacity: 1; animation: lc-sheen 1.5s ease-in-out infinite; }
@keyframes lc-spin { to { transform: rotate(360deg); } }
@keyframes lc-sheen { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.login-erro { display: flex; gap: 8px; align-items: center; background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .3); color: #fecaca; padding: 10px 12px; border-radius: var(--radius-md); font-size: 13px; }
.login-hint { font-size: 12px; color: var(--lc-faint); text-align: center; margin: 0; line-height: 1.6; }
@media (prefers-reduced-motion: reduce) {
  .login-card, .lc-mark, .lc-head h1, .lc-head p, .lc-beam, .lc-dot { animation: none; }
  .lc-beam { opacity: 0; }
  .login-card, .lc-field, .login-btn { transition: none; }
  .lc-field:hover, .lc-field:focus-within, .login-btn:hover { transform: none; }
}
.login-bot { margin-bottom: 22px; }
.login-aside .bot { --bot-face: #141417; }
@media (prefers-reduced-transparency: reduce) {
  .login-card { background: #0c0a16; }
  .login-main::before { display: none; }
}
.login-stats > div { min-width: 0; }
.login-erro .ic { flex: 0 0 auto; }
@media (max-width: 860px) {
  .login-body { grid-template-columns: minmax(0, 1fr); }
  .login-aside { display: none; }
}

/* ====================================================== TELAS ESPECÍFICAS */

/* tenant (superadmin "vendo como") */
.tenant-banner {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 16px; border-radius: var(--radius-md);
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); color: var(--brand-ink); font-size: 13px;
}
.brand-tenant { display: block; }

/* --- gráfico de linhas (chart.js) --- */
.viz { position: relative; margin: 4px 0 0; }
.viz svg { display: block; }
.viz-empty { padding: 40px 0; text-align: center; }
.viz-legend { display: flex; gap: 14px; flex-wrap: wrap; }
.viz-key { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.viz-key i { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; stroke-dasharray: 3 4; }
.viz-baseline { stroke: var(--viz-axis); stroke-width: 1; }
.viz-axis { fill: var(--faint); font: 12px var(--mono); font-variant-numeric: tabular-nums; }
.viz-cross { stroke: var(--viz-axis); stroke-width: 1; stroke-dasharray: 3 3; }
.viz-dot { stroke: var(--card); stroke-width: 2; }
.viz-tip {
  position: absolute; top: 8px; pointer-events: none; z-index: 5;
  background: var(--viz-tip-bg); color: var(--viz-tip-ink);
  border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12px; min-width: 128px; box-shadow: var(--shadow);
}
.viz-tip-h { font-weight: 600; margin-bottom: 4px; }
.viz-tip-r { display: flex; align-items: center; gap: 6px; line-height: 1.7; }
.viz-tip-r i { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.viz-tip-r b { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.viz-table-toggle { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.viz-table-toggle summary { cursor: pointer; }
.viz-table-toggle table { margin-top: 8px; }

/* --- donut --- */
.donut { margin: 4px 0 0; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-svg { width: 132px; height: 132px; flex: 0 0 auto; }
.donut-seg { transition: opacity .18s ease, stroke-width .18s ease; cursor: pointer; }
.donut.has-focus .donut-seg:not(.on) { opacity: .18; }
.donut.has-focus .donut-seg.on { stroke-width: 15; }
.donut-center-big { font: 600 15px var(--font); fill: var(--ink); }
.donut-center-sub { font-size: 10px; fill: var(--muted); } /* unidades do viewBox 100: ~12px na tela */
.donut-legend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; }
.donut-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; padding: 5px 8px; border-radius: 6px; list-style: none; transition: background .15s ease; }
.donut-legend li:hover, .donut-legend li.on { background: var(--hover); }
.donut-legend li.on { font-weight: 550; }
.donut.has-focus .donut-legend li:not(.on) { color: var(--muted); }
.donut-legend .dot2 { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.donut-legend .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend .pct { color: var(--muted); font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }
.donut-empty { padding: 30px 0; color: var(--muted); }

/* --- barras divergentes --- */
.dbars { margin: 6px 0 0; display: flex; flex-direction: column; gap: 8px; }
.dbars-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.dbars-lbl { flex: 0 0 34%; max-width: 220px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.dbars-track { position: relative; flex: 1; height: 16px; border-radius: 4px; background: var(--sunken); }
.dbars-track::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--viz-axis); }
.dbars-neg, .dbars-pos { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; min-width: 0; }
.dbars-neg { right: 50%; }
.dbars-pos { left: 50%; }
.dbars-val { flex: 0 0 auto; min-width: 22px; font: 12px var(--mono); color: var(--muted); }

/* --- funil de etapas --- */
.stage-funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.stage-funnel li { display: grid; grid-template-columns: minmax(0, 12rem) 1fr 3rem 3rem; align-items: center; gap: 12px; font-size: 13px; }
.stage-funnel a { color: var(--ink-2); text-decoration: none !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-funnel a:hover { color: var(--ink); }
.stage-funnel b { text-align: right; font: 600 12.5px var(--mono); }
.stage-bar { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.stage-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--faint); }
.stage-bar .stage-respondido { background: var(--ok); }
.stage-bar .stage-shadow { background: var(--info); }
.stage-bar .stage-com_produto, .stage-bar .stage-na_fila { background: var(--viz-3); }
.stage-bar .stage-limite { background: var(--warn); }
.stage-bar .stage-falhou, .stage-bar .stage-reprovado_ia { background: var(--danger); }
@media (max-width: 640px) { .stage-funnel li { grid-template-columns: minmax(0, 8rem) 1fr 2.4rem; } .stage-funnel li > .small { display: none; } }

/* --- Pedidos --- */
#pedidos-table { table-layout: fixed; min-width: 980px; }
.conf { font: 600 12px var(--mono); }
.conf-hi { color: var(--ok-ink); }
.conf-mid { color: var(--warn-ink); }
.conf-lo { color: var(--danger-ink); }
.llm-tag { margin-top: 6px; font-size: 12px; color: var(--muted); padding: 2px 7px; border-radius: 5px; background: var(--sunken); border: 1px solid var(--line); display: inline-block; }
.llm-tag b { color: var(--ink); font-weight: 550; }
.llm-tag.llm-diff { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.llm-tag.llm-diff b { color: var(--warn-ink); }
.status-line { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--faint); display: inline-block; }
.dot-none { background: var(--line-strong); }
.dot-shadow { background: var(--info); }
.dot-queued, .dot-sending { background: var(--warn); }
.dot-sending { animation: dot-pulse 1s ease-in-out infinite; }
.dot-sent, .dot-sent_dm { background: var(--ok); }
.dot-failed { background: var(--danger); }
.dot-skipped_rate_limit, .dot-skipped_cooldown { background: var(--warn); }
@keyframes dot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.reply-txt { font-size: 12.5px; color: var(--muted); margin-top: 4px; max-width: 100%; overflow-wrap: break-word; word-break: break-word; }
.reply-err { font-size: 12px; color: var(--danger-ink); margin-top: 4px; max-width: 280px; }
.reply-edit { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.reply-edit[hidden] { display: none; }
.reply-edit textarea { width: 100%; font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--ink); resize: vertical; }
.reply-edit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ctx-menu { position: fixed; z-index: var(--z-menu); min-width: 220px; max-width: 320px; max-height: 70vh; overflow-y: auto; background: var(--menu-bg); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow); padding: 4px; }
.ctx-menu[hidden] { display: none; }
.ctx-head { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); padding: 6px 8px 2px; }
.ctx-item { display: block; width: 100%; text-align: left; background: none; border: 0; color: inherit; font: inherit; font-size: 13px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.ctx-item:hover, .ctx-item:focus-visible { background: var(--hover); outline: none; }
.ctx-row { display: flex; align-items: center; }
.ctx-row .ctx-item:first-child { flex: 1; }
.ctx-del { width: auto; color: var(--muted); padding: 7px 10px; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* --- Respostas: venda --- */
.sale-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sale-form input { width: 7rem; }

/* --- Grupos (cartões) --- */
.glist { display: flex; flex-direction: column; gap: 10px; }
.gcard { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px 16px; background: var(--card); box-shadow: var(--shadow-xs); transition: border-color .15s ease; }
.gcard[hidden] { display: none; }
.gcard:hover { border-color: var(--line-strong); }
.gcard-head { display: flex; align-items: center; gap: 16px; }
.gcard-main { flex: 1 1 auto; min-width: 0; }
.gcard-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.gcard-title b { font-size: 14px; font-weight: 600; }
.gcard-sub { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.gcard-sub a { color: var(--muted); }
.gcard-stats { display: flex; gap: 22px; margin: 0; flex: 0 0 auto; }
.gcard-stats div { text-align: right; min-width: 56px; }
.gcard-stats dt { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.gcard-stats dd { margin: 2px 0 0; font: 600 15px var(--font); font-variant-numeric: tabular-nums; }
.gcard-stats dd.small { font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.gcard-toggle { flex: 0 0 auto; }
.gcard-cfg { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.gcard-cfg[hidden] { display: none; }
.gcard-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.gcard-label { font-size: 12px; font-weight: 500; color: var(--muted); min-width: 120px; }
.gcard-remove { margin-left: auto; }
@media (max-width: 720px) {
  .gcard-head { flex-wrap: wrap; }
  .gcard-main { flex-basis: 100%; }
  .gcard-stats div { text-align: left; min-width: 0; }
  .gcard-toggle { margin-left: auto; }
  .gcard-sub { white-space: normal; word-break: break-all; }
}

/* --- seletor de grupos (Publicitária) --- */
.group-picker { position: relative; display: inline-block; }
.group-picker > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink); font: 500 13px var(--font); box-shadow: var(--shadow-xs);
}
.group-picker > summary::-webkit-details-marker, .group-picker > summary::marker { display: none; content: ""; }
.group-picker > summary:hover { background: var(--hover); }
.group-picker > summary::after { content: ""; width: 14px; height: 14px; background: currentColor; opacity: .5;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") center/contain no-repeat; }
.group-list { min-width: 260px; max-width: 90vw; max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); }
.group-list .chk { padding: 6px 8px; border-radius: 6px; }
.group-list .chk:hover { background: var(--hover); }
.group-list > div { display: flex; flex-direction: column; gap: 2px; }
.group-picker-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; box-shadow: var(--shadow); }

/* --- Publicitária: mídia e fila --- */
.tsteps { display: flex; flex-direction: column; gap: 2px; min-width: 180px; }
.tstep { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12.5px; }
.tstep-ic { width: 18px; height: 18px; flex: 0 0 auto; border-radius: 6px; display: grid; place-items: center; }
.tstep-ic svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tstep-ic.is-pending::before { content: ""; width: 5px; height: 5px; border-radius: 2px; background: var(--faint); }
.tstep-ic.is-done { background: var(--ok-soft); color: var(--ok); animation: tstep-pop .3s cubic-bezier(.34, 1.56, .64, 1); }
.tstep-ic.is-error { background: var(--danger-soft); color: var(--danger); animation: tstep-pop .3s cubic-bezier(.34, 1.56, .64, 1); }
.tstep-spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--ink); animation: tstep-spin .8s linear infinite; }
.tstep-label { flex: 1; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tstep.is-done .tstep-label { color: var(--ink); }
.tstep.is-error .tstep-label { color: var(--danger-ink); font-weight: 500; }
.tstep.is-active .tstep-label { font-weight: 500; background: linear-gradient(90deg, var(--muted) 38%, var(--ink) 50%, var(--muted) 62%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: tstep-shimmer 1.6s linear infinite; }
.tstep-meta { flex: 0 0 auto; font-size: 12px; color: var(--muted); }
.tstep-extra { padding: 0 0 4px 26px; }
@keyframes tstep-spin { to { transform: rotate(360deg); } }
@keyframes tstep-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes tstep-pop { 0% { transform: scale(.5); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .tstep-spin, .tstep.is-active .tstep-label, .tstep-ic.is-done, .tstep-ic.is-error { animation: none; } }

/* barras horizontais simples */
.bars td { padding: 4px 8px; border: 0; }
.bars .barcell { width: 60%; }
.bars .barcell i { display: block; height: 8px; background: var(--ink); border-radius: 999px; min-width: 2px; }
.bars .num { color: var(--muted); }

/* entrada escalonada do conteúdo */
/* `backwards` (não `both`): terminada a entrada, nenhum transform fica no bloco
   — senão ele vira a referência de qualquer `position: fixed` lá dentro (a
   folha de formulário do celular grudava na seção em vez da tela). */
.content > * { animation: rise .4s cubic-bezier(.32, .72, 0, 1) backwards; }
.content > *:nth-child(2) { animation-delay: .03s; }
.content > *:nth-child(3) { animation-delay: .06s; }
.content > *:nth-child(4) { animation-delay: .09s; }
.content > *:nth-child(n+5) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
/* O `transform` da animação (fill `both`) cria uma camada por bloco, e cada
   bloco seguinte pinta por cima do anterior: o formulário "Adicionar grupo"
   (e outros popovers do cabeçalho) abria por baixo dos cartões. O cabeçalho
   sobe uma camada — abaixo do topo fixo (--z-top), acima do conteúdo. */
.content > .page-head { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .content > * { animation: none; } }

/* --- Pedidos (redesign) --- */
.pedido-txt { margin: 8px 0 10px; color: var(--ink-2); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.ellipsis-line { display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-sub .ic { color: var(--faint); vertical-align: -2px; }
.product-link { display: block; font-weight: 500; color: var(--ink); line-height: 1.4; overflow-wrap: anywhere; }
.product-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.price { font: 600 13px var(--font); font-variant-numeric: tabular-nums; color: var(--ok-ink); }
#pedidos-table { min-width: 1000px; }
.segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.tiny .ic { vertical-align: -2px; color: var(--ok); }
.content .top-search input { height: auto; padding: 0; border: 0; box-shadow: none; background: transparent; }
.content .top-search input:focus-visible { box-shadow: none; }
.content a.product-link { text-decoration: none; }
.content a.product-link:hover { text-decoration: underline; }
#pedidos-table .reply-txt { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.content .segmented a { text-decoration: none; }

/* tabela que vira cartões no celular: <table class="data data-cards"> + td[data-label] */
@media (max-width: 760px) {
  table.data-cards, table.data-cards tbody, table.data-cards tr, table.data-cards td { display: block; width: 100%; }
  table.data-cards { min-width: 0 !important; table-layout: auto !important; }
  table.data-cards colgroup, table.data-cards thead { display: none; }
  table.data-cards tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  table.data-cards tbody tr:hover td { background: none; }
  table.data-cards td { border: 0 !important; padding: 6px 0 !important; min-width: 0 !important; }
  table.data-cards td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 3px;
    font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--faint);
  }
  table.data-cards td.nowrap { white-space: normal; }
  table.data-cards td.ellipsis-cell { max-width: none; white-space: normal; overflow: visible; }
}
.toolbar .top-search { display: flex; }
.form-grid label.chk, .form-grid label.switch { flex-direction: row; align-items: center; font-weight: 450; }
.form-grid .targets-group .chk { gap: 6px; }
.content .gcard-sub a { text-decoration: none; }
.content .gcard-sub a:hover { text-decoration: underline; }
.gcard-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); align-items: start; gap: 8px 14px; }
.gcard-row > .gcard-label { padding-top: 7px; }
.gcard-row-body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; }
.gcard-row-body > .form-grid { flex: 1 1 100%; }
@media (max-width: 640px) { .gcard-row { grid-template-columns: minmax(0, 1fr); } .gcard-row > .gcard-label { padding-top: 0; } }


/* ============================================================ ABAS (sublinhadas) */
.tabs {
  display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.content .tabs a { text-decoration: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto;
  height: 46px; padding: 0 10px; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: color .15s ease;
}
button.tab { background: none; border: 0; border-radius: 0; font-family: inherit; cursor: pointer; }
button.tab:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px var(--ring); }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); }
.tab.on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--gold); }
.tab-n {
  min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  font: 500 12px/1 var(--mono); color: var(--muted); background: var(--sunken); border: 1px solid var(--line);
}
.tab.on .tab-n { color: var(--ink); background: var(--card); border-color: var(--line-strong); }
.tab-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; background: var(--faint); display: inline-block; }
.tone-ok { background: var(--ok); } .tone-info { background: var(--info); } .tone-warn { background: var(--warn); }
.tone-danger { background: var(--danger); } .tone-brand { background: var(--brand); }

/* ============================================================ PEDIDOS (caixa de entrada) */
.inbox-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--sunken) 40%, transparent); }
.inbox-bar .top-search { display: flex; min-width: 220px; background: var(--card); }
.inbox-bar select { max-width: 240px; }
.btn-active { border-color: var(--line-strong); background: var(--sunken); }
.filters-pop > summary { list-style: none; }
.filters-pop > summary::-webkit-details-marker { display: none; }
.filters-pop .pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 280px;
  display: flex; flex-direction: column; gap: 14px; padding: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.filters-pop .pop input[type="number"] { width: 100%; }

.req-list { list-style: none; margin: 0; padding: 0; }
.req {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) 250px 176px; gap: 6px 18px; align-items: start;
  padding: 18px 20px; border-bottom: 1px solid var(--line); transition: background .15s ease;
}
.req:hover { background: color-mix(in srgb, var(--sunken) 45%, transparent); }
.req:last-child { border-bottom: 0; }

.req-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font: 600 14px/1 var(--font); color: #fff; background: #71717a;
}
.av-0 { background: #0f766e; } .av-1 { background: #7c3aed; } .av-2 { background: #c2410c; }
.av-3 { background: #2563eb; } .av-4 { background: #be185d; } .av-5 { background: #4d7c0f; }

.req-main { min-width: 0; }
.req-head { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.req-name { font-weight: 600; font-size: 14px; white-space: nowrap; }
.req-group { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.req-time { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 2px; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.req-quote {
  margin: 10px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--line-strong);
  font-size: 14px; line-height: 1.55; color: var(--ink); overflow-wrap: anywhere;
}
.req-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.tag .ic { color: var(--faint); }
.tag-strong { font-weight: 600; color: var(--ink); }
.content a.tag-link { text-decoration: none; color: var(--ink-2); }
.content a.tag-link:hover { background: var(--hover); color: var(--ink); }
.tag.llm-tag { margin: 0; background: var(--sunken); }
.tag.llm-diff { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.tag.conf { font-family: var(--mono); font-weight: 600; }
.conf-bar { width: 28px; height: 4px; border-radius: 999px; background: var(--sunken); overflow: hidden; display: inline-block; }
.conf-bar > span { display: block; height: 100%; border-radius: inherit; background: currentColor; }

.prod {
  display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow-xs);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.content a.prod { text-decoration: none; color: var(--ink); }
a.prod:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.prod-label { font-size: 12px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--faint); }
.prod-title { font-size: 13px; font-weight: 500; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod .price { font-size: 15px; }
.prod-none { background: transparent; border-style: dashed; box-shadow: none; }
.prod-none .prod-title { color: var(--muted); font-weight: 400; }

.req-status { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); white-space: nowrap;
}
.status-pill.st-sent, .status-pill.st-sent_dm { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-ink); }
.status-pill.st-shadow { background: var(--info-soft); border-color: var(--info-line); color: var(--info-ink); }
.status-pill.st-queued, .status-pill.st-sending, .status-pill.st-skipped_rate_limit, .status-pill.st-skipped_cooldown { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.status-pill.st-failed { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink); }
.status-pill.st-none { color: var(--muted); }
.req-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.req-actions .btn-icon { width: 30px; height: 30px; }

.req-reply { grid-column: 2 / -1; display: flex; flex-direction: column; gap: 8px; margin-top: 6px; min-width: 0; }
.req-reply .reply-err { max-width: none; display: flex; gap: 6px; align-items: flex-start; }
.reply-box { border: 1px solid var(--line); border-radius: var(--radius-md); background: color-mix(in srgb, var(--sunken) 55%, transparent); min-width: 0; }
.reply-box > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 8px 12px; font-size: 12.5px; color: var(--ink-2);
}
.reply-box > summary::-webkit-details-marker { display: none; }
.reply-box > summary .ic { color: var(--faint); flex: 0 0 auto; }
.reply-preview { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-chev { transition: transform .2s ease; }
.reply-box[open] .reply-chev { transform: rotate(180deg); }
.reply-box[open] .reply-preview { visibility: hidden; }
.reply-box .reply-txt { margin: 0; padding: 0 12px 12px 34px; font-size: 13px; color: var(--ink-2); line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; }
.req .reply-edit { margin: 0; }
.req .reply-edit-actions { justify-content: flex-end; }

@media (max-width: 1100px) {
  .req { grid-template-columns: 36px minmax(0, 1fr) 220px; }
  .req-status { grid-column: 2 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; text-align: left; }
  .req-actions { margin: 0 0 0 auto; }
}
@media (max-width: 760px) {
  .req { grid-template-columns: 32px minmax(0, 1fr); padding: 16px; gap: 10px 12px; }
  .req-avatar { width: 32px; height: 32px; font-size: 13px; }
  .req-product, .req-status, .req-reply { grid-column: 1 / -1; }
  .inbox-bar select { max-width: none; flex: 1; }
  .inbox-bar .top-search { flex-basis: 100%; }
  .tabs { padding: 0 8px; }
}
.tag.conf-hi { color: var(--ok-ink); } .tag.conf-mid { color: var(--warn-ink); } .tag.conf-lo { color: var(--danger-ink); }
.content a.tab, .content a.prod, .content a.tag-link { text-decoration: none; }

/* ============================================================ GRUPOS (lista + ajustes) */
.add-pop > summary { list-style: none; }
.add-pop > summary::-webkit-details-marker { display: none; }
.add-pop .pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: min(380px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 14px; padding: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.add-pop .pop input { width: 100%; }
/* No celular o cabeçalho quebra e o botão fica colado na esquerda: aberto
   para a esquerda (right: 0), o formulário saía da tela e ficava inutilizável. */
@media (max-width: 760px) {
  .page-actions .add-pop .pop,
  .page-actions .inline-details[open] > form { left: 0; right: auto; }
  /* Com mais de um botão na linha (Buscar grupos + Adicionar grupo), o segundo
     fica deslocado e o pop ancorado nele estourava a tela: ancora na linha toda. */
  .page-actions { position: relative; }
  .page-actions .add-pop { position: static; }
}
.add-pop .pop h3 { font-size: 14.5px; }

.stat-strip {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden;
}
.stat { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-sub { font-size: 12px; color: var(--faint); }
@media (max-width: 900px) {
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}

.list-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--sunken) 40%, transparent); }
.list-bar .top-search { display: flex; background: var(--card); }

.glist { gap: 0; }
.gcard { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 16px 20px; background: transparent; }
.gcard:last-child { border-bottom: 0; }
.gcard:hover { border-color: var(--line); background: color-mix(in srgb, var(--sunken) 45%, transparent); }
.gcard.is-open { background: color-mix(in srgb, var(--sunken) 55%, transparent); }
.gcard-head { gap: 14px; }
.g-avatar {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center;
  font: 600 15px/1 var(--font); color: #fff;
}
.gcard-title b { font-size: 14px; }
.gcard-sub { font-size: 12.5px; color: var(--muted); }
.content .gcard-sub a { color: var(--muted); }
.g-note { display: flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 12px; color: var(--ink-2); }
.g-note .ic { color: var(--faint); }
.gcard-stats { gap: 26px; }
.gcard-stats div { min-width: 60px; }
.gcard-stats dt { font-size: 12px; letter-spacing: .03em; }
.gcard-stats dd { font-size: 15px; }
.g-rate dd { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.rate-bar { width: 52px; height: 4px; border-radius: 999px; background: var(--sunken); overflow: hidden; display: block; }
.rate-bar > span { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.g-last dd { white-space: nowrap; color: var(--ink-2); }

.gcard-cfg { margin-top: 16px; padding: 0; border-top: 0; gap: 12px; }
.set-list { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); overflow: hidden; }
.set-head { padding: 12px 16px 4px; font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--line); }
.set-head + .set-row, .set-list > .set-row:first-child { border-top: 0; }
.set-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-txt b { font-size: 13.5px; font-weight: 550; }
.set-txt span { font-size: 12.5px; color: var(--muted); }
.set-ctl { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.content .set-ctl select { min-width: 160px; }
.content input.num-in { width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
.set-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--sunken) 50%, transparent); }
.gcard-cfg > .set-foot { border: 1px solid var(--line); border-radius: var(--radius-md); }

@media (max-width: 900px) {
  .gcard-head { flex-wrap: wrap; }
  .gcard-main { flex: 1 1 calc(100% - 60px); }
  .gcard-stats { order: 3; flex-basis: 100%; padding-left: 52px; gap: 18px; }
  .gcard-stats div { text-align: left; min-width: 0; }
  .g-rate dd { align-items: flex-start; }
  .gcard-toggle { order: 2; }
}
@media (max-width: 640px) {
  .gcard { padding: 14px 16px; }
  .gcard-stats { padding-left: 0; }
  .gcard-toggle { margin-left: 52px; }
  .set-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .set-ctl { justify-content: flex-start; }
}
.g-avatar:not([class*="av-"]) { background: #71717a; }
.list-bar .top-search, .inbox-bar .top-search { flex: 1 1 260px; }
@media (max-width: 760px) {
  .content .inbox-bar select { flex: 1 1 100%; max-width: none; }
  .inbox-bar .filters-pop, .inbox-bar > .btn { flex: 1 1 0; }
  .inbox-bar .filters-pop > summary { width: 100%; }
  .inbox-bar .filters-pop .pop { left: 0; right: auto; }
  .gcard-head { align-items: flex-start; }
}

/* ======================================================= Anúncios (redesign)
   Compositor com área de foto + barra da IA; anúncios em galeria, a imagem
   em primeiro plano. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* barra "Sugerir produto" — estados: idle / offline / busy / done / error */
.ai-bar {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; margin-bottom: 18px; border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
  background: linear-gradient(100deg, var(--brand-soft), color-mix(in srgb, var(--brand-soft) 35%, var(--card)) 70%);
  transition: border-color .25s ease, background .25s ease;
}
.ai-bar-ic {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--card); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line));
  box-shadow: var(--shadow-xs);
}
.ai-bar-ic .ic { width: 18px; height: 18px; }
.ai-bar-text { flex: 1; min-width: 0; }
.ai-bar-title { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.ai-bar-sub { font-size: 12.5px; color: var(--brand-ink); margin-top: 1px; text-wrap: pretty; }
.ai-bar .btn { flex: 0 0 auto; }
.ai-bar-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; opacity: 0; transition: opacity .2s ease; }
.ai-bar-progress::before {
  content: ""; position: absolute; inset: 0; width: 35%;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  animation: ai-sweep 1.4s cubic-bezier(.45, 0, .55, 1) infinite;
}
.ai-bar[data-state="busy"] .ai-bar-progress { opacity: 1; }
.ai-bar[data-state="busy"] .ai-bar-ic .ic { animation: ai-twinkle 1.6s ease-in-out infinite; }
.ai-bar[data-state="offline"] { background: var(--sunken); border-color: var(--line); }
.ai-bar[data-state="offline"] .ai-bar-ic { color: var(--muted); border-color: var(--line); }
.ai-bar[data-state="offline"] .ai-bar-sub { color: var(--muted); }
.ai-bar[data-state="done"] { border-color: var(--ok-line); background: var(--ok-soft); }
.ai-bar[data-state="done"] .ai-bar-ic { color: var(--ok); border-color: var(--ok-line); }
.ai-bar[data-state="done"] .ai-bar-sub { color: var(--ok-ink); }
.ai-bar[data-state="error"] { border-color: var(--danger-line); background: var(--danger-soft); }
.ai-bar[data-state="error"] .ai-bar-ic { color: var(--danger); border-color: var(--danger-line); }
.ai-bar[data-state="error"] .ai-bar-sub { color: var(--danger-ink); }
@keyframes ai-sweep { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@keyframes ai-twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(.82) rotate(-12deg); } }

/* compositor: foto à esquerda, campos à direita */
.composer-grid {
  display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 20px 24px;
  grid-template-areas: "media fields" "foot foot";
}
.composer-media { grid-area: media; display: flex; flex-direction: column; gap: 10px; }
.composer-fields { grid-area: fields; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; align-content: start; }
.composer-fields .span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field > span { display: flex; align-items: baseline; gap: 6px; }
.field .hint { font-weight: 400; font-size: 12px; }
.field input, .field textarea { width: 100%; }
.composer-foot {
  grid-area: foot; display: flex; align-items: center; gap: 12px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.composer-foot-hint { margin-left: auto; }
.field input.is-filled, .field textarea.is-filled { animation: field-fill 1.2s ease-out; }
@keyframes field-fill { 0% { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); } }

.dropzone {
  position: relative; display: grid; place-items: center; aspect-ratio: 1 / 1; overflow: hidden; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--sunken);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.dropzone:hover, .dropzone.is-over { border-color: color-mix(in srgb, var(--brand) 60%, var(--line-strong)); background: color-mix(in srgb, var(--brand-soft) 60%, var(--sunken)); }
.dropzone:focus-within { box-shadow: 0 0 0 3px var(--ring); border-color: var(--line-strong); }
.dropzone.is-over { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.dropzone-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 16px; color: var(--muted); }
.dropzone-ic {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 6px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2); box-shadow: var(--shadow-xs);
}
.dropzone-ic .ic { width: 20px; height: 20px; }
.dropzone-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.dropzone-sub { font-size: 12px; }
.dropzone-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 10px; }
.dropzone-img[hidden] { display: none; }
.dropzone.has-image { border-style: solid; border-color: var(--line); }
.dropzone.has-image .dropzone-empty { visibility: hidden; }
.dropzone-swap, .dropzone-tag {
  position: absolute; display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 500;
}
.dropzone-swap {
  right: 8px; bottom: 8px; color: #fafafa; background: rgba(9, 9, 11, .72); backdrop-filter: blur(6px);
  opacity: 0; transform: translateY(4px); transition: opacity .15s ease, transform .15s ease; pointer-events: none;
}
.dropzone.has-image .dropzone-swap { opacity: 1; transform: none; }
.dropzone-tag { left: 8px; top: 8px; color: var(--brand-ink); background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); }
.dropzone-tag[hidden] { display: none; }
.dropzone-sm { aspect-ratio: auto; height: 68px; place-items: center start; }
.dropzone-sm .dropzone-empty { flex-direction: row; text-align: left; gap: 12px; padding: 0 12px; }
.dropzone-sm .dropzone-empty > span:last-child { display: flex; flex-direction: column; gap: 1px; }
.dropzone-sm .dropzone-ic { width: 36px; height: 36px; margin: 0; border-radius: 10px; }
.dropzone-sm .dropzone-ic .ic { width: 17px; height: 17px; }
.dropzone-sm .dropzone-img { object-fit: cover; padding: 0; }
.dropzone-sm .dropzone-swap { top: 50%; bottom: auto; transform: translateY(-50%); }

/* galeria de anúncios */
.ads-section { margin-top: 28px; }
.ads-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.ads-title { font-size: 17px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.ads-title .count {
  font: 500 12px/20px var(--font); font-variant-numeric: tabular-nums; padding: 0 7px; border-radius: 999px;
  background: var(--sunken); border: 1px solid var(--line); color: var(--muted);
}
.seg-n { font-variant-numeric: tabular-nums; color: var(--muted); margin-left: 2px; }
.seg-n.is-danger { color: var(--danger-ink); }
.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 16px; }
.ad-grid-empty { text-align: center; padding: 28px 0; }

.ad-card {
  display: flex; flex-direction: column; min-width: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s cubic-bezier(.2, .8, .2, 1);
}
/* Só com mouse: no toque o :hover fica "preso" depois do toque e o transform
   prendia a folha de formulário (position: fixed) dentro do cartão. */
@media (hover: hover) {
  .ad-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
}
.ad-card[hidden] { display: none; }
.ad-card-media {
  position: relative; aspect-ratio: 4 / 3; border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
  overflow: hidden; background: var(--sunken); border-bottom: 1px solid var(--line);
}
.ad-card-media img, .ad-card-img-link { display: block; width: 100%; height: 100%; }
.ad-card-media.is-generated img { object-fit: cover; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.ad-card:hover .ad-card-media.is-generated > a > img { transform: scale(1.03); }
.ad-card-media.is-product { background: #fff; }
.ad-card-media.is-product > img { object-fit: contain; padding: 18px; }
.ad-card-original {
  position: absolute; right: 10px; bottom: 10px; width: 52px; height: 52px; border-radius: 10px; overflow: hidden;
  background: #fff; border: 2px solid #fff; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .45);
}
.ad-card-media .ad-card-original img { object-fit: contain; padding: 3px; transform: none; }
.ad-card-status {
  position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--ink-2);
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--line); box-shadow: var(--shadow-xs);
}
.ad-card-status { z-index: 2; }
.ad-card-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.ad-card-status.is-ready::before { background: var(--brand); }
.ad-card-status.is-done::before, .ad-card-status.is-partial::before { background: var(--ok); }
.ad-card-status.is-live::before { background: var(--info); animation: dot-pulse 1.2s ease-in-out infinite; }
.ad-card-status.is-generating::before { background: var(--info); animation: dot-pulse 1.2s ease-in-out infinite; }
.ad-card-status.is-failed { color: var(--danger-ink); }
.ad-card-status.is-failed::before { background: var(--danger); }
.ad-card-veil {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  font-size: 12.5px; font-weight: 500; color: var(--ink);
  background: color-mix(in srgb, var(--card) 70%, transparent); backdrop-filter: blur(3px);
}
.ad-card-body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 12px; min-width: 0; }
.ad-card-title { font-size: 14.5px; font-weight: 600; line-height: 1.35; margin: 0; text-wrap: balance;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ad-card-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-top: -4px; }
.ad-card-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ad-card-chips a.badge { text-decoration: none; }
.ad-card-chips a.badge:hover { text-decoration: none; border-color: var(--line-strong); color: var(--ink); }
.ad-card-error {
  display: flex; gap: 7px; align-items: flex-start; font-size: 12px; line-height: 1.45; color: var(--danger-ink);
  padding: 8px 10px; border-radius: var(--radius-sm); background: var(--danger-soft); border: 1px solid var(--danger-line);
}
.ad-card-error .ic { flex: 0 0 auto; margin-top: 1px; }
.ad-card-groups { margin-top: auto; }
.ad-card-groups > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 8px 0 2px;
  font-size: 12.5px; color: var(--ink-2); border-top: 1px dashed var(--line);
}
.ad-card-groups > summary::-webkit-details-marker { display: none; }
.ad-card-groups > summary b { color: var(--ink); font-variant-numeric: tabular-nums; }
.ad-card-groups > summary .ic { margin-left: auto; color: var(--muted); transition: transform .2s ease; }
.ad-card-groups[open] > summary .ic { transform: rotate(180deg); }
.ad-card-groups .tsteps { margin-top: 6px; min-width: 0; }
.ad-progress { flex: 0 0 auto; width: 44px; height: 6px; border-radius: 999px; background: var(--sunken); border: 1px solid var(--line); overflow: hidden; position: relative; }
.ad-progress::after { content: ""; position: absolute; inset: 0; width: var(--p, 0%); background: var(--ok); border-radius: inherit; }
a.tstep-meta { color: var(--info-ink); }
.ad-card-foot {
  display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--sunken) 45%, transparent); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.ad-card-foot-gap { flex: 1; }
.ad-card-foot .btn-icon .ic { width: 15px; height: 15px; }
form.is-busy .btn { pointer-events: none; opacity: .65; }
.inline-details:not(.align-right)[open] > form.pop-form { left: 0; right: auto; }
.pop-form { display: flex; flex-direction: column; gap: 10px; min-width: 250px; }
.pop-title { font-weight: 600; font-size: 13px; }
.pop-form .group-list { border: 0; padding: 0; max-height: 220px; min-width: 0; }

@media (max-width: 860px) {
  .composer-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "media" "fields" "foot"; }
  .dropzone:not(.dropzone-sm) { aspect-ratio: 16 / 10; }
}
@media (max-width: 560px) {
  .composer-fields { grid-template-columns: minmax(0, 1fr); }
  .composer-fields .span-2 { grid-column: auto; }
  .ai-bar { flex-wrap: wrap; }
  .ai-bar .btn { width: 100%; justify-content: center; }
  .composer-foot { flex-wrap: wrap; }
  .composer-foot-hint { display: none; }
  .composer-foot .btn-primary { margin-left: auto; }
  .ads-head .segmented { width: 100%; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .ai-bar-progress::before, .ai-bar[data-state="busy"] .ai-bar-ic .ic, .field .is-filled { animation: none; }
  .ad-card, .ad-card-media img { transition: none; }
  .ad-card:hover { transform: none; }
}

/* --- Visão geral do dono: servidores e robôs conectados --- */
.srv-total { display: flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: 12px;
  border-radius: var(--radius-md); background: var(--ok-soft); color: var(--ok-ink); font-size: 13.5px; }
.srv-total b { font-size: 18px; }
.srv-total .ic { width: 16px; height: 16px; }
.srv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 900px) { .srv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .srv-grid { grid-template-columns: minmax(0, 1fr); } }
.srv-tile { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-md); background: var(--card); min-width: 0; }
.srv-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.srv-dot.is-on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.srv-dot.is-off { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.srv-dot.is-idle { background: var(--muted); }
.srv-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-count { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.srv-count .ic { width: 14px; height: 14px; color: var(--muted); }
.srv-card .card-title .ic { width: 16px; height: 16px; vertical-align: -2px; }
.srv-tile { flex-wrap: wrap; }
.srv-tile.is-warn { border-color: var(--warn-line); background: var(--warn-soft); }
.srv-meta { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  font-size: 12.5px; color: var(--muted); }
.srv-mem, .srv-note { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.srv-mem .ic, .srv-note .ic { width: 13px; height: 13px; }
.srv-tile.is-warn .srv-mem { color: var(--warn-ink); font-weight: 600; }
.srv-action { margin-left: auto; }

/* ======================================================= Clientes (redesign)
   Lista com busca/filtro; editar abre um painel lateral (<dialog>) com seções,
   no lugar do popover apertado. Referência: Stripe/Attio/Linear. */
.cl-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
}
.cl-stat { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; min-width: 0; }
.cl-stat + .cl-stat { border-left: 1px solid var(--line); }
.cl-stat-k { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-stat-v { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.cl-stat-v small { font-size: 13px; font-weight: 450; color: var(--muted); letter-spacing: 0; }

.cl-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cl-search { position: relative; flex: 1 1 260px; max-width: 360px; }
.cl-search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.content .cl-search input { width: 100%; padding-left: 32px; }

table.data.cl-table td { vertical-align: middle; }
.cl-row { cursor: pointer; transition: background .12s ease; }
.cl-row:hover { background: color-mix(in srgb, var(--hover) 70%, transparent); }
.cl-row:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.cl-row[hidden] { display: none; }
.cl-who { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.cl-who-text { display: flex; flex-direction: column; min-width: 0; }
.cl-who-text .cell-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.cl-avatar {
  --h: 38; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600; letter-spacing: .01em;
  color: hsl(var(--h) 55% 32%); background: hsl(var(--h) 70% 93%); border: 1px solid hsl(var(--h) 45% 84%);
}
.cl-avatar[data-hue="1"] { --h: 205; } .cl-avatar[data-hue="2"] { --h: 152; } .cl-avatar[data-hue="3"] { --h: 268; }
.cl-avatar[data-hue="4"] { --h: 345; } .cl-avatar[data-hue="5"] { --h: 182; }
:root[data-theme="dark"] .cl-avatar { color: hsl(var(--h) 70% 78%); background: hsl(var(--h) 35% 16%); border-color: hsl(var(--h) 30% 26%); }
.cl-avatar.is-lg { width: 44px; height: 44px; border-radius: 12px; font-size: 15px; }
.cl-avatar.is-new { color: var(--ink-2); background: var(--sunken); border-color: var(--line); }
.cl-avatar .ic { width: 18px; height: 18px; }
.cl-plan { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.cl-plan .ic { color: var(--muted); }
.cl-plan.is-nuvem .ic { color: var(--brand); }
.cl-usage { display: flex; flex-direction: column; gap: 5px; min-width: 120px; }
.cl-usage .num { font-size: 13px; font-variant-numeric: tabular-nums; }
.cl-meter { display: block; height: 5px; border-radius: 999px; background: var(--sunken); overflow: hidden; max-width: 140px; }
.cl-meter i { display: block; height: 100%; border-radius: inherit; background: var(--ink-2); }
.cl-meter.is-mid i { background: var(--warn); }
.cl-meter.is-high i { background: var(--danger); }
.cl-bots { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cl-bots b { color: var(--ink); font-weight: 600; }
.cl-off-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.cl-actions { text-align: right; white-space: nowrap; }
.cl-actions .btn + .btn, .cl-actions form + .btn { margin-left: 4px; }
.cl-empty { padding: 8px 0 18px; }
.cl-section-title { font-size: 15px; font-weight: 600; margin: 28px 0 12px; }

.cl-release { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.cl-file {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; cursor: pointer; min-width: 0;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--sunken);
  transition: border-color .15s ease, background .15s ease;
}
.cl-file:hover { border-color: var(--brand); background: var(--brand-soft); }
.cl-file:focus-within { box-shadow: 0 0 0 3px var(--ring); }
.cl-file-ic .ic { width: 15px; height: 15px; color: var(--muted); }
.cl-file > span:last-child { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 12.5px; }
.cl-file b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-file .hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-file.has-file { border-style: solid; border-color: var(--ok-line); background: var(--ok-soft); }

/* painel lateral */
dialog.sheet {
  position: fixed; inset: 0 0 0 auto; margin: 0; width: min(480px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  padding: 0; border: 0; border-left: 1px solid var(--line); background: var(--card); color: var(--ink);
  box-shadow: -24px 0 60px -24px rgba(9, 9, 11, .35);
}
dialog.sheet[open] { animation: sheet-in .32s cubic-bezier(.32, .72, 0, 1); }
dialog.sheet.is-closing { animation: sheet-out .2s ease-in forwards; }
dialog.sheet::backdrop { background: rgba(9, 9, 11, .38); backdrop-filter: blur(2px); animation: fade-in .25s ease; }
@keyframes sheet-in { from { transform: translateX(32px); opacity: 0; } }
@keyframes sheet-out { to { transform: translateX(32px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
.sheet-form { display: flex; flex-direction: column; height: 100%; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.sheet-head-text { flex: 1; min-width: 0; }
.sheet-head h2 { font-size: 16px; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.sheet-x {
  flex: 0 0 auto; width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.sheet-x:hover { background: var(--hover); color: var(--ink); }
.sheet-x .ic { width: 17px; height: 17px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 6px 20px 24px; overscroll-behavior: contain; }
.sheet-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0 4px; }
.sheet-kpis > div { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--sunken); border: 1px solid var(--line); min-width: 0; }
.sheet-kpis span { font-size: 12px; color: var(--muted); }
.sheet-kpis b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-kpis b small { font-size: 12px; font-weight: 450; color: var(--muted); }
.sheet-kpis b.small-b { font-size: 13px; font-weight: 500; }
.sheet-sec { border: 0; margin: 0; padding: 18px 0 2px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sheet-sec + .sheet-sec { border-top: 1px solid var(--line); margin-top: 16px; }
.sheet-sec legend { float: left; width: 100%; padding: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 0; }
.sheet-sec legend + * { clear: both; }
.sheet-sec-desc { margin: -6px 0 0; font-size: 12.5px; color: var(--muted); }
.sheet-sec .field select { width: 100%; }
.sheet-foot {
  display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--sunken) 55%, var(--card));
}
.sheet-foot-gap { flex: 1; }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body {
  display: flex; flex-direction: column; gap: 3px; height: 100%; padding: 10px 12px 11px; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow-xs);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.choice:hover .choice-body { border-color: var(--line-strong); }
.choice-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.choice-title .ic { color: var(--muted); }
.choice-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }
.choice input:checked + .choice-body { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink), var(--shadow-xs); }
.choice input:checked + .choice-body .choice-title .ic { color: var(--brand); }
.choice.is-danger input:checked + .choice-body { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); background: var(--danger-soft); }
.choice.is-danger input:checked + .choice-body .choice-title { color: var(--danger-ink); }
.choice input:focus-visible + .choice-body { box-shadow: 0 0 0 3px var(--ring); }

@media (max-width: 900px) {
  .cl-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cl-stat:nth-child(3) { border-left: 0; }
  .cl-stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .cl-table th:nth-child(6), .cl-table td:nth-child(6) { display: none; }
}
@media (max-width: 720px) {
  .cl-table thead { display: none; }
  .cl-table, .cl-table tbody { display: block; }
  .cl-table tr.cl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .card.flush table.data.cl-table tr.cl-row td { padding: 0; border: 0; }
  .cl-table td:nth-child(1) { grid-column: 1 / -1; }
  .cl-table td:nth-child(2), .cl-table td:nth-child(3) { display: inline-flex; }
  .cl-table td:nth-child(4) { grid-column: 1 / -1; }
  .cl-table td:nth-child(5) { grid-column: 1; }
  .cl-table td:nth-child(7) { grid-column: 1 / -1; text-align: left; }
  .cl-search { max-width: none; }
  .cl-toolbar .segmented { width: 100%; overflow-x: auto; }
  .cl-release { grid-template-columns: minmax(0, 1fr); }
  .choice-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  dialog.sheet[open], dialog.sheet.is-closing, dialog.sheet::backdrop { animation: none; }
}

/* ================================================== Notificações (sino)
   Caixa de entrada no topo (avisos guardados + alertas do momento), faixa
   para "importante" e avisos de pedido novo no canto (toasts). */
.np-wrap { position: relative; }
.np-toggle { position: relative; }
.np-count {
  position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  display: grid; place-items: center; font: 600 10px/1 var(--font); font-variant-numeric: tabular-nums;
  color: #fff; background: var(--danger); box-shadow: 0 0 0 2px var(--bg);
}
.np-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 2px var(--bg); }
.np {
  position: absolute; right: -6px; top: calc(100% + 8px); z-index: var(--z-menu); width: min(390px, calc(100vw - 24px));
  display: flex; flex-direction: column; max-height: min(620px, calc(100dvh - 80px));
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  transform-origin: top right; animation: np-in .18s cubic-bezier(.2, .8, .2, 1);
}
.np[hidden] { display: none; }
@keyframes np-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.np-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.np-head b { font-size: 14px; font-weight: 600; }
.np-link {
  display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 4px 6px; border-radius: 6px;
  font: 500 12px var(--font); color: var(--muted); cursor: pointer;
}
.np-link:hover { color: var(--ink); background: var(--hover); }
.np-list { overflow-y: auto; overscroll-behavior: contain; padding: 4px 0; }
.np-sec { padding: 10px 14px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.np-item {
  position: relative; display: flex; gap: 12px; padding: 10px 34px 10px 14px; color: inherit; text-decoration: none;
  transition: background .12s ease;
}
.np-item:hover { background: var(--hover); text-decoration: none; }
.np-item.is-unread { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.np-item.is-unread:hover { background: color-mix(in srgb, var(--brand-soft) 75%, transparent); }
.np-ic {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--sunken); color: var(--ink-2);
}
.np-ic .ic { width: 15px; height: 15px; }
.np-ic.is-novidade { color: var(--brand-ink); background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.np-ic.is-aviso { color: var(--warn-ink); background: var(--warn-soft); border-color: var(--warn-line); }
.np-ic.is-importante { color: var(--danger-ink); background: var(--danger-soft); border-color: var(--danger-line); }
.np-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.np-title { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.np-body { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.np-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 3px; font-size: 12px; color: var(--muted); }
.np-item.is-alert .np-meta { color: var(--ink-2); font-weight: 500; }
.np-meta .ic { width: 12px; height: 12px; }
.np-cta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; color: var(--ink); text-decoration: none; }
.np-cta:hover { text-decoration: underline; text-underline-offset: 2px; }
.np-cta[hidden] { display: none; }
.np-unread {
  position: absolute; right: 12px; top: 16px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer; display: grid; place-items: center;
}
.np-unread::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); transition: transform .15s ease; }
.np-unread:hover::before { transform: scale(1.3); }
.np-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 30px 20px 34px; text-align: center; color: var(--muted); font-size: 12.5px; }
.np-empty b { color: var(--ink); font-size: 13.5px; }
.np-empty-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 6px; background: var(--sunken); border: 1px solid var(--line); }
.np-empty-ic .ic { width: 18px; height: 18px; }
.np-foot { display: flex; flex-direction: column; gap: 2px; padding: 8px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--sunken) 50%, var(--card)); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.np-switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.np-switch:hover { background: var(--hover); }
.np-switch > span { display: inline-flex; align-items: center; gap: 8px; }
.np-switch .ic { color: var(--muted); }
.np-switch input {
  appearance: none; -webkit-appearance: none; width: 30px; height: 18px; margin: 0; border-radius: 999px; cursor: pointer; flex: 0 0 auto;
  background: var(--line-strong); position: relative; transition: background .15s ease;
}
.np-switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .18s cubic-bezier(.2, .8, .2, 1);
}
.np-switch input:checked { background: var(--ok); }
.np-switch input:checked::after { transform: translateX(12px); }
.np-switch input:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

/* faixa de aviso importante */
.np-banner {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 10px 12px; border-radius: var(--radius-md);
  border: 1px solid var(--danger-line); background: var(--danger-soft);
}
.np-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.np-banner-text b { color: var(--danger-ink); }
.np-banner-text span { color: var(--ink-2); }

/* avisos de pedido novo (canto inferior direito) */
.toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: var(--z-menu); width: min(360px, calc(100vw - 32px));
  display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto; position: relative; overflow: hidden; display: flex; gap: 12px; padding: 12px 36px 12px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  animation: toast-in .35s cubic-bezier(.2, .8, .2, 1);
}
.toast.is-leaving { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
.toast-ic { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--ok-ink); background: var(--ok-soft); border: 1px solid var(--ok-line); }
.toast-ic .ic { width: 16px; height: 16px; }
.toast-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.toast-kicker { font-size: 12px; color: var(--muted); }
.toast-title { font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast-sub { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast-more { font-size: 12px; color: var(--muted); margin-top: 2px; }
.toast-actions { display: flex; gap: 6px; margin-top: 8px; }
.toast-x { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.toast-x:hover { background: var(--hover); color: var(--ink); }
.toast-x .ic { width: 14px; height: 14px; }
.toast-timer { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--ok); transform-origin: left; animation: toast-timer linear forwards; }
.toast:hover .toast-timer { animation-play-state: paused; }
@keyframes toast-timer { to { transform: scaleX(0); } }

/* Clientes > Notificações enviadas */
.nt-list { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px solid var(--line); }
.nt-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px 12px 20px; }
.nt-item + .nt-item { border-top: 1px solid var(--line); }
.nt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.nt-title { font-size: 13.5px; font-weight: 600; }
.nt-body { font-size: 12.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nt-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.nt-meta b { color: var(--ink); font-variant-numeric: tabular-nums; }
.nt-preview { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--card); }
.nt-preview .np-item { border-radius: 0; }
.choice-grid.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; }
#notificacoes { margin-top: 16px; }

@media (max-width: 560px) {
  .np { position: fixed; left: 12px; right: 12px; top: 60px; width: auto; }
  .choice-grid.is-3, .field-row { grid-template-columns: minmax(0, 1fr); }
  .np-banner { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .np, .toast, .toast.is-leaving { animation: none; }
  .toast-timer { display: none; }
}

/* ================================================== Tela de erro (404/403/500)
   Número gigante que some em degradê (máscara), texto curto e duas saídas. */
.err-body {
  min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg);
  background-image: radial-gradient(ellipse 60% 45% at 50% 38%, var(--brand-soft), transparent 70%);
}
.err-top { padding: 20px 24px; }
.err-brand {
  display: inline-flex; align-items: center; gap: 8px; color: var(--ink);
  font-weight: 600; font-size: 14px; text-decoration: none;
}
.err-brand .logo { color: var(--brand); width: 22px; height: 22px; }
.err-main {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0 16px 12vh;
}
.err-num {
  margin: 0; font: 800 160px/1 var(--font);
  color: var(--ink); font-variant-numeric: tabular-nums; user-select: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 20%, transparent 82%);
  mask-image: linear-gradient(to bottom, #000 20%, transparent 82%);
  animation: err-in .5s cubic-bezier(.2, .7, .2, 1) both;
}
.err-title {
  position: relative; margin: -.55em 0 0; font-size: 20px; font-weight: 600; color: var(--ink);
}
.err-text { margin: 8px 0 0; max-width: 42ch; color: var(--muted); font-size: 14px; text-wrap: balance; }
.err-ref {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 3px 4px 3px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
  font-size: 12.5px; color: var(--muted); box-shadow: var(--shadow-xs);
}
.err-ref code { font: 500 12.5px/1 var(--mono); color: var(--ink); background: none; border: 0; padding: 0; }
.err-ref .btn.is-done { color: var(--ok-ink); }
.err-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
@keyframes err-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 600px) { .err-num { font-size: 112px; } }
@media (prefers-reduced-motion: reduce) { .err-num { animation: none; } }

/* =================================================== CELULAR (≤ 640px)
   Nada cortado nem escondido de lado: abas e filtros quebram linha, nomes
   longos quebram em vez de virar "…", tabelas viram cartões. O computador
   não muda. Conferido com tests/test_panel_layout.py. */
/* Texto que depende do aparelho: "passe o mouse" × "toque". */
.on-touch { display: none; }
@media (hover: none) { .on-mouse { display: none; } .on-touch { display: inline; } }
@media (max-width: 640px) {
  .crumb-tenant, .crumb-frente { display: none; }                 /* a conta já aparece no menu lateral */
  .tabs { flex-wrap: wrap; overflow: visible; padding: 4px 8px 0; }
  .tabs .tab { height: 40px; }
  .segmented { display: flex; flex-wrap: wrap; overflow: visible; }
  .segmented a, .segmented button { flex: 1 1 auto; text-align: center; }
  .req-group, .tstep-label, .cl-stat-k, .stage-funnel a { white-space: normal; overflow: visible; text-overflow: clip; }
  .reply-preview { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .dbars-row { flex-wrap: wrap; row-gap: 4px; }
  .dbars-lbl { flex: 1 1 100%; max-width: none; text-align: left; white-space: normal; overflow: visible; }
  .stage-funnel li { grid-template-columns: minmax(0, 1fr) 2.5rem 3rem; row-gap: 4px; }
  .stage-funnel li .stage-bar { grid-column: 1 / -1; grid-row: 2; }
  /* aviso com botão: o botão desce para baixo do texto (antes espremia o texto) */
  .alert, .banner { flex-wrap: wrap; }
  .alert-actions { flex: 1 1 100%; padding-left: calc(30px + 12px); }  /* alinha com o texto, após o ícone */
  .bot-hero { flex-wrap: wrap; }
  .cl-file > span:last-child { flex-direction: column; align-items: flex-start; gap: 0; }
  .cl-file b, .cl-file .hint { white-space: normal; overflow: visible; }
  /* Formulários que abrem de um botão dentro de cartão (agendar, publicar em
     mais grupos…): no celular viram uma folha presa embaixo da tela — preso
     ao botão, abriam fora da tela. */
  .content .inline-details[open] > form.pop-form {
    position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(12px + env(safe-area-inset-bottom));
    min-width: 0; max-height: 70vh; overflow-y: auto; z-index: var(--z-overlay);
  }
  .content .inline-details[open]:has(> form.pop-form)::before {
    content: ""; position: fixed; inset: 0; z-index: calc(var(--z-overlay) - 1); background: rgba(9, 9, 11, .42);
  }
  /* Tabela do "Ver em tabela" dos gráficos: cabe na largura do cartão. */
  .viz-table-toggle table { width: 100%; table-layout: fixed; font-size: 12px; }
  .viz-table-toggle th, .viz-table-toggle td { padding-left: 4px; padding-right: 4px; overflow-wrap: anywhere; }
}
/* Robô na nuvem: cada serviço com o seu selo, sem quebrar no meio. */
.svc-list { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.svc { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

/* Toque: alvos de pelo menos 40px (DESIGN.md), sem mudar o mouse. */
@media (pointer: coarse) {
  .btn, .btn-sm { min-height: 40px; }
  .icon-btn, .avatar-btn { min-width: 40px; min-height: 40px; }
  .avatar-btn { justify-content: center; }
  .segmented a, .segmented button {
    min-height: 40px; display: inline-flex; align-items: center; justify-content: center; line-height: 1;
  }
  .btn-icon { min-width: 40px; }
  /* só caixas visíveis (o input escondido dos interruptores fica como está) */
  input[type="checkbox"]:not(.switch input):not(.np-switch input), input[type="radio"] { width: 20px; height: 20px; }
}

/* Campo de senha com olho (pw-toggle.js): o botão fica por dentro do campo,
   à direita. O olho nativo do Edge sai para não aparecerem dois. */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap > input[type] { width: 100%; padding-right: 44px; }
.pw-eye {
  position: absolute; top: 50%; right: 2px; transform: translateY(-50%);
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  border-radius: var(--radius-sm);
}
.pw-eye:hover { color: var(--ink); }
.pw-eye:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
input[type="password"]::-ms-reveal, input[type="password"]::-ms-clear { display: none; }

/* Folha "Conectar Facebook / Mercado Livre" (templates/_conectar.html) */
.cx .sheet-body { padding-top: 16px; }
.cx-brand {
  flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius-md);
  background: var(--brand-soft); color: var(--brand-ink);
}
.cx-brand .ic { width: 18px; height: 18px; }
.cx-progress { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.cx-progress li {
  display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); padding-top: 9px;
  border-top: 2px solid var(--line); transition: border-color .2s ease, color .2s ease;
}
.cx-progress li span {
  width: 20px; height: 20px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%;
  font: 600 11px/1 var(--mono); background: var(--sunken); border: 1px solid var(--line); color: var(--muted);
}
.cx-progress li.is-current { color: var(--ink); border-top-color: var(--ink); font-weight: 500; }
.cx-progress li.is-current span { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.cx-progress li.is-done { color: var(--ink-2); border-top-color: var(--ok); }
.cx-progress li.is-done span { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-ink); }
.cx-live section { display: flex; flex-direction: column; gap: 14px; }
.cx-live section[hidden] { display: none; }
.cx-form { display: flex; flex-direction: column; gap: 14px; }
.cx-form .field input { width: 100%; height: 40px; font-size: 15px; }
.cx-main { height: 40px; width: 100%; justify-content: center; }
.cx-form .field input.cx-code { font: 600 20px/1 var(--mono); letter-spacing: .3em; text-align: center; height: 48px; }
.cx-note { display: flex; gap: 8px; margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.cx-note .ic { flex: 0 0 auto; margin-top: 2px; }
.cx-alt {
  align-self: center; min-height: 40px; padding: 0 12px; border: 0; background: transparent; color: var(--ink-2);
  font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; border-radius: var(--radius-sm);
}
.cx-alt:hover { color: var(--ink); }
.cx-alt:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.cx-wait {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: var(--radius-md);
  background: var(--sunken); border: 1px solid var(--line);
}
.cx-wait b { display: block; font-size: 14px; font-weight: 600; }
.cx-wait p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.cx-wait.is-soft { background: transparent; border-style: dashed; padding: 12px 14px; align-items: center; }
.cx-wait.is-soft p { margin: 0; }
.cx-spin {
  flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--ink); animation: cx-spin .8s linear infinite;
}
@keyframes cx-spin { to { transform: rotate(360deg); } }
.cx-hero {
  width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%;
  background: var(--sunken); color: var(--ink-2); border: 1px solid var(--line);
}
.cx-hero .ic { width: 24px; height: 24px; }
.cx-hero.is-ok { background: var(--ok-soft); color: var(--ok-ink); border-color: var(--ok-line); }
.cx-hero.is-warn { background: var(--warn-soft); color: var(--warn-ink); border-color: var(--warn-line); }
.cx-hero.is-pulse { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; animation: cx-pulse 2s ease-in-out infinite; }
@keyframes cx-pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--brand) 14%, transparent); } }
.cx-h { margin: 0; font-size: 17px; font-weight: 600; }
.cx-p { margin: -6px 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.cx-erro { margin: 0; }
@media (prefers-reduced-motion: reduce) {
  .cx-spin { animation-duration: 2.4s; }
  .cx-hero.is-pulse { animation: none; }
}

/* --- Vendas > Integrações: conta de vendedor conectada --- */
.vd-account { align-items: flex-start; flex-wrap: wrap; }
.vd-account-main { flex: 1 1 280px; min-width: 0; }
.vd-account-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.vd-account-actions select { max-width: 220px; }
.vd-howto { margin-top: 10px; font-size: 13px; }
.vd-howto > summary { cursor: pointer; color: var(--ink-2); font-weight: 500; }
.vd-howto .steps { margin-top: 12px; }
@media (max-width: 760px) {
  .vd-account-actions { justify-content: flex-start; width: 100%; }
  .vd-account-actions select { max-width: 100%; }
}

/* --- Vendas > Produtos: filtros e grade de cartões --- */
.vd-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; }
.vd-search { max-width: none; }
.vd-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.vd-count { margin: 0 0 12px; }
.vd-grid { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.vd-prod {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: border-color .15s ease;
}
.vd-prod:hover { border-color: var(--gold-line); }
.vd-prod-img { position: relative; aspect-ratio: 1; display: grid; place-items: center; background: var(--sunken); border-bottom: 1px solid var(--line); color: var(--faint); }
.vd-prod-img img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.vd-prod-img .ic { width: 32px; height: 32px; }
.vd-prod-stock { position: absolute; top: 12px; left: 12px; backdrop-filter: blur(6px); }
.vd-prod-stock:not(.badge-danger) { background: color-mix(in srgb, var(--card) 85%, transparent); }
.vd-prod-body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 18px; flex: 1; }
.vd-prod-title {
  margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vd-prod-title a { color: inherit; text-decoration: none; }
.vd-prod-title a:hover { text-decoration: underline; text-decoration-color: var(--gold-line); }
.vd-prod-meta { margin: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vd-prod-money { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 12px; }
.vd-prod-label { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.vd-prod-cost { display: block; font-size: 26px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.vd-prod-sug { text-align: right; }
.vd-prod-sug-val { display: block; font-weight: 600; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.vd-prod-cta { width: 100%; height: 42px; margin-top: 12px; font-size: 14px; }
.vd-prod-edit { align-self: flex-start; margin-top: 4px; }
.vd-grid-note { margin: 0 0 20px; }
.vd-pager { justify-content: center; margin-bottom: 16px; }
tr.is-muted td { color: var(--muted); }
@media (max-width: 600px) { .vd-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; } }

/* Vendas > Produtos > Anunciar: coluna principal + painel lateral de 320 px */
.vd-crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0 0 16px; font-size: 13px; color: var(--muted); }
.vd-crumbs a { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); text-decoration: none; flex: 0 0 auto; }
.vd-crumbs a:hover { color: var(--ink); }
.vd-crumbs-here { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.vd-alert { align-items: center; margin-bottom: 16px; }
.vd-alert .alert-text + .alert-text { margin-top: 4px; }
.vd-alert-btn { flex: 0 0 auto; margin-left: auto; }

.vd-ad { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.vd-ad-main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.vd-ad-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(var(--top-h) + 16px); }

.vd-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; padding: 20px; }
.vd-gallery { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.vd-gallery-main { aspect-ratio: 1; border-radius: var(--radius-md); background: var(--sunken); overflow: hidden; display: grid; place-items: center; }
.vd-gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.vd-gallery-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--faint); font-size: 13px; }
.vd-gallery-empty .ic { width: 32px; height: 32px; }
/* 4 miniaturas à vista; mais fotos rolam para o lado. */
.vd-thumbs { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 24px) / 4); gap: 8px; overflow-x: auto; scrollbar-width: thin; padding: 2px; }
.vd-thumb { aspect-ratio: 1; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--sunken); overflow: hidden; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.vd-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vd-thumb:hover { border-color: var(--line-strong); }
.vd-thumb.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.vd-thumb:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--ring); }

.vd-buy { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.vd-buy-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.vd-buy-chips .badge-gold { text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.vd-buy-title { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.25; }
.vd-buy-meta { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
.vd-seller { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--sunken); font-size: 13px; color: var(--ink-2); }
.vd-seller .ic { color: var(--muted); }
.vd-cost { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border: 1px solid var(--gold-line); border-radius: var(--radius-md); background: var(--gold-wash); }
.vd-cost-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.vd-cost-value { font-size: 44px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.vd-cost-sug { margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.vd-cost-sug b { color: var(--ink); font-variant-numeric: tabular-nums; }
.vd-stock-line { margin: 0; }
.vd-types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding: 0; border: 0; }
.vd-type { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.vd-type:hover { border-color: var(--line-strong); }
.vd-type input { position: absolute; opacity: 0; pointer-events: none; }
.vd-type:has(input:checked) { border-color: var(--gold); background: var(--gold-wash); }
.vd-type:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--ring); }
.vd-type-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.vd-type-desc { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.vd-type-fee { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--gold-text); }

.vd-tabs-wrap { min-width: 0; }
.vd-tabs { margin-bottom: 20px; }
.vd-tab-panel[hidden] { display: none; }
.vd-ficha, .vd-sobre { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
.vd-sobre { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.vd-ficha-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.vd-sec-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; font-weight: 600; }
.vd-sec-desc { margin: -6px 0 0; font-size: 12.5px; color: var(--muted); }
.vd-attr-label { display: flex; align-items: center; gap: 6px; }
.vd-attr.is-missing input { border-color: var(--danger); }
.vd-howto .field { margin: 10px 0 8px; }
.vd-desc { max-width: 68ch; font-size: 14px; line-height: 1.65; color: var(--ink-2); white-space: pre-line; max-height: 15em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 75%, transparent); mask-image: linear-gradient(#000 75%, transparent); }
.vd-desc.is-open { max-height: none; -webkit-mask-image: none; mask-image: none; }
.vd-desc-more { margin-top: 8px; }
.vd-sobre .vd-sec-title { margin-bottom: 12px; }
.vd-specs { margin: 0; display: flex; flex-direction: column; }
.vd-spec { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 0 4px 0 12px; border-radius: var(--radius-sm); }
.vd-spec:nth-child(odd) { background: var(--sunken); }
.vd-spec dt { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.vd-spec dd { display: flex; align-items: center; gap: 4px; margin: 0; min-width: 0; font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.vd-spec dd > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vd-spec-copy { width: 32px; height: 32px; }
.vd-spec-copy .ic { width: 14px; height: 14px; }

.vd-side-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.vd-result { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; transition: border-color .2s ease; }
.vd-result-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 14px 14px 12px; transition: background .2s ease; }
.vd-result-value { font-size: 28px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.vd-result-margin { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Lucro em verde, prejuízo em vermelho: a cor diz o resultado (o texto também). */
.vd-result.is-gain { border-color: var(--ok-line); }
.vd-result.is-gain .vd-result-head { background: var(--ok-soft); }
.vd-result.is-gain .vd-result-value { color: var(--ok-ink); }
.vd-result.is-loss { border-color: var(--danger-line); }
.vd-result.is-loss .vd-result-head { background: var(--danger-soft); }
.vd-result.is-loss .vd-result-value { color: var(--danger-ink); }
.vd-result.is-empty { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; }
.vd-result-rows { margin: 0; padding: 6px 14px; }
.vd-result-rows > div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13px; }
.vd-result-rows dt { color: var(--muted); }
.vd-result-rows dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.vd-result-note:empty { display: none; }
.vd-result-note { margin: 0; padding: 0 14px 12px; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.vd-result.is-empty .vd-result-note { padding: 0; }
.vd-result.is-loss .vd-result-note { color: var(--danger-ink); }
.vd-floor { margin: 0; font-size: 13px; color: var(--ink-2); }
.vd-floor b { color: var(--ink); font-variant-numeric: tabular-nums; }
.vd-src { margin: -6px 0 0; font-size: 12px; }
.vd-missing-note { display: flex; gap: 8px; margin: 0; padding: 10px 12px; border: 1px solid var(--danger-line); border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger-ink); font-size: 12.5px; line-height: 1.45; }
.vd-missing-note .ic { margin-top: 2px; }
.vd-publish { height: 44px; font-size: 14px; transition: background .15s ease, transform .15s ease, opacity .15s ease; }
.vd-publish:not(:disabled):hover { transform: scale(1.015); }
.vd-publish:disabled, .vd-publish[aria-disabled="true"] { opacity: .4; }
.vd-publish-hint { margin: -4px 0 0; font-size: 12px; text-align: center; }

.vd-ship .vd-sec-title .ic { color: var(--muted); }
.vd-addr { display: flex; flex-direction: column; gap: 2px; font-style: normal; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.vd-addr b { color: var(--ink); }
.vd-ship .btn-sm { align-self: flex-start; }
.vd-facts { list-style: none; margin: 4px 0 0; padding: 4px 0 0; border-top: 1px solid var(--line); }
.vd-facts li { display: flex; gap: 12px; padding: 10px 0; }
.vd-facts li + li { border-top: 1px solid var(--line); }
.vd-facts li > .ic { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; color: var(--muted); }
.vd-facts span { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.vd-facts b { font-size: 13px; font-weight: 600; color: var(--ink); }

/* Vendas > Anunciar > Imagens do anúncio (criadas pela IA, aprovadas uma a uma) */
.vd-imgs { display: flex; flex-direction: column; gap: 16px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.vd-imgs .vd-alert { margin: 0; }
.vd-imgs .vd-sec-desc { margin-top: 4px; max-width: 72ch; }
.vd-imgs-act { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.vd-imgs-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.vd-img { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); min-width: 0; }
.vd-img.is-approved { border-color: var(--ok-line); }
.vd-img-pic { display: block; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--sunken); }
.vd-img-pic img { width: 100%; height: 100%; object-fit: contain; }
.vd-img-pic:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--ring); }
.vd-img-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; min-height: 24px; }
.vd-img-kind { font-size: 13px; font-weight: 600; }
.vd-img-btns { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vd-img-btns .btn { flex: 1; justify-content: center; }

@media (max-width: 1180px) {
  .vd-ad { grid-template-columns: minmax(0, 1fr); }
  .vd-ad-side { position: static; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
@media (max-width: 760px) {
  .vd-hero { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .vd-ficha, .vd-sobre { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .vd-ad-side { grid-template-columns: minmax(0, 1fr); }
  .vd-buy-title { font-size: 20px; }
  .vd-cost-value { font-size: 36px; }
  .vd-alert { flex-wrap: wrap; }
  .vd-alert-btn { margin-left: 0; }
  .vd-imgs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
@media (max-width: 400px) { .vd-types { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .vd-publish:not(:disabled):hover { transform: none; } }

/* Vendas > Meus anúncios */
.vd-listings td { vertical-align: middle; }
.vd-listings .num { white-space: nowrap; }
.vd-listing-prod { display: flex; align-items: center; gap: 12px; min-width: 0; }
.vd-listing-prod img, .vd-listing-noimg { flex: 0 0 48px; width: 48px; height: 48px; border-radius: var(--radius-sm); background: var(--sunken); object-fit: contain; }
.vd-listing-noimg { display: grid; place-items: center; color: var(--faint); }
.vd-listing-prod > div { min-width: 0; }
.vd-listing-title { font-weight: 600; color: var(--ink); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vd-listing-profit { font-weight: 700; color: var(--gold-text); }
.vd-listing-why { margin-top: 4px; max-width: 36ch; color: var(--danger-ink); line-height: 1.4; }
.vd-listing-note { margin-top: 4px; max-width: 36ch; line-height: 1.4; }
.vd-listing-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: flex-start; }
.vd-price-edit > summary { list-style: none; }
.vd-price-edit > summary::-webkit-details-marker { display: none; }
.vd-price-edit[open] > summary { color: var(--ink); }
.vd-price-edit[open] { flex-basis: 100%; display: flex; flex-direction: column; align-items: flex-end; }
.vd-price-edit .vd-inline-form { margin-top: 6px; }
.vd-price-edit input { width: 96px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--ink); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; }
.vd-price-edit input:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
@media (max-width: 720px) { .vd-listing-actions { justify-content: flex-start; } .vd-price-edit[open] { align-items: flex-start; } }

/* Vendas > Pedidos (lista e painel de detalhe) */
.vd-orders td { vertical-align: middle; }
.vd-orders .num { white-space: nowrap; }
dialog.sheet.vd-order { width: min(520px, 100vw); }
.vd-order .sheet-body { display: flex; flex-direction: column; gap: 16px; }
.vd-order .sheet-sec h3 { margin: 0 0 8px; font-size: 14px; }
.vd-order-prod { display: flex; gap: 12px; align-items: flex-start; padding-top: 12px; }
.vd-order-prod img { flex: 0 0 56px; width: 56px; height: 56px; border-radius: var(--radius-sm); background: var(--sunken); object-fit: contain; }
.vd-order-prod > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.vd-handoff { padding: 14px; border: 1px solid var(--gold-line); border-radius: var(--radius-md); background: var(--gold-wash); }
.vd-handoff-steps { margin: 0 0 12px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.vd-order-money { padding: 0; border: 1px solid var(--line); border-radius: var(--radius-md); }
.vd-order-money > div { padding: 7px 12px; }
.vd-order-money > div + div { border-top: 1px solid var(--line); }
.vd-order-money .is-total dt, .vd-order-money .is-total dd { font-weight: 700; color: var(--gold-text); }
.vd-inline-form { display: flex; gap: 8px; }
.vd-order .vd-inline-form input { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--ink); font: inherit; font-size: 13px; }
.vd-timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.vd-timeline li { position: relative; }
.vd-timeline li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid var(--line-strong); }
.vd-timeline li:first-child::before { border-color: var(--gold); background: var(--gold); }
.vd-problem { font-size: 13px; }
.vd-problem > summary { cursor: pointer; color: var(--danger-ink); font-weight: 600; }
.vd-problem form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.vd-order .field textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--ink); font: inherit; font-size: 13px; }

/* Vendas > Painel de vendas */
.eyebrow { margin: 0 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-text); }
.vd-dash-head { align-items: flex-end; }
.vd-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 32px; }
.vd-kpis .kpi-value { font-size: 30px; font-weight: 700; }

.vd-first { margin-bottom: 32px; }
.vd-first-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.vd-first-head p { margin: 4px 0 0; }
.vd-progress { height: 6px; margin: 16px 0 20px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.vd-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--gold); transition: width .3s ease-out; }
.vd-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.vd-steps > li { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.vd-step-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 13px; font-weight: 700; border: 1px solid var(--line); color: var(--muted); }
.vd-step-mark .ic { width: 15px; height: 15px; stroke-width: 2.4; }
.vd-step-title { font-size: 14px; font-weight: 600; color: var(--ink-2); line-height: 1.4; }
.vd-steps .is-done .vd-step-mark { color: var(--ok-ink); background: var(--ok-soft); border-color: var(--ok-line); }
.vd-steps .is-done .vd-step-title { color: var(--muted); }
.vd-steps .is-next { border-color: var(--gold-line); }
.vd-steps .is-next .vd-step-mark { color: var(--gold-ink); background: var(--gold); border-color: var(--gold); }
.vd-steps .is-next .vd-step-title { color: var(--ink); }
.vd-steps .is-later { opacity: .7; }

.vd-perf { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 0; margin-bottom: 32px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.vd-perf-main { min-width: 0; padding: 24px 24px 24px 0; }
.vd-perf-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.vd-perf-head p { margin: 4px 0 0; }
.vd-perf-tabs { border-bottom: 0; }
.vd-perf-tabs .tab { height: 36px; }
.vd-chart { position: relative; height: 260px; }
.vd-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.vd-chart .grid line { stroke: var(--viz-grid); stroke-width: 1; }
.vd-chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.vd-chart .bar { fill: var(--gold); }
.vd-chart .hover { fill: var(--hover); }
.vd-chart-tip { position: absolute; top: 0; pointer-events: none; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--viz-tip-bg); color: var(--viz-tip-ink); font-size: 12px; line-height: 1.4; white-space: nowrap; transform: translateX(-50%); box-shadow: var(--shadow-sm); }
.vd-chart-tip b { display: block; font-size: 13px; font-variant-numeric: tabular-nums; }
.vd-perf-main .empty { padding: 48px 16px; }

.vd-op { display: flex; flex-direction: column; gap: 16px; padding: 24px 0 24px 24px; border-left: 1px solid var(--line); }
.vd-op h2 { font-size: 16px; }
.vd-op-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.vd-op-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; border-bottom: 1px solid var(--line); }
.vd-op-label { font-size: 13px; color: var(--muted); }
.vd-op-val { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; font-variant-numeric: tabular-nums; }
.content a.vd-op-val { text-decoration: none; }
a.vd-op-val:hover { color: var(--gold-text); }
.vd-op-val.is-ok { color: var(--ok-ink); }
.vd-op-val.is-bad { color: var(--danger-ink); }
.vd-op-val.is-warn { color: var(--warn-ink); }

.vd-start-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.content a.vd-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--gold-text); text-decoration: none; }
.content a.vd-link:hover { text-decoration: underline; }
.vd-start-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.content a.vd-start-item { display: flex; align-items: center; gap: 12px; height: 100%; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); text-decoration: none; color: var(--ink); transition: border-color .15s ease; }
.content a.vd-start-item:hover { border-color: var(--gold-line); }
.vd-start-img { flex: 0 0 56px; width: 56px; height: 56px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--sunken); overflow: hidden; color: var(--faint); }
.vd-start-img img { width: 100%; height: 100%; object-fit: contain; }
.vd-start-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vd-start-title { font-size: 13px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vd-start-cost { font-size: 12px; color: var(--muted); }
.vd-start-cost b { color: var(--gold-text); font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) {
  .vd-perf { grid-template-columns: minmax(0, 1fr); }
  .vd-perf-main { padding-right: 0; }
  .vd-op { padding: 24px 0; border-left: 0; border-top: 1px solid var(--line); }
  .vd-start-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .vd-kpis { grid-template-columns: minmax(0, 1fr); }
  .vd-steps { grid-template-columns: minmax(0, 1fr); }
  .vd-steps > li { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .vd-steps .vd-step-title { flex: 1 1 160px; }
  .vd-chart { height: 200px; }
  .vd-dash-head .page-actions { width: 100%; }
}
@media (max-width: 480px) { .vd-start-list { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .vd-progress > span { transition: none; } }

/* Afiliado > Contas */
.card-alert { margin: 12px 0 0; }
.card-list { padding: 0 20px; }
.pairing-code { letter-spacing: .08em; }
.af-meta { margin-top: 4px; }
.af-note { margin: 8px 0 0; }

/* Afiliado > Gerar link / Meus links */
.af-gen { display: flex; flex-direction: column; gap: 12px; }
.af-gen-input { min-height: 132px; font-family: var(--mono); font-size: 12.5px; }
.af-gen-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.af-origin { display: flex; flex-wrap: wrap; gap: 16px; border: 0; margin: 0; padding: 0; }
.af-table .af-src { max-width: 0; width: 46%; }
.af-table .af-src > * { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-why { margin-top: 4px; }
.af-foot { margin-top: 12px; }

/* Afiliado > Contas > Instalar extensão */
.ext-step-action { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 8px; }
.ext-url { padding: 4px 8px; border-radius: var(--radius-sm); background: var(--sunken); border: 1px solid var(--line); color: var(--ink); }
.ext-done { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.ext-done p { margin: 0; color: var(--ink-2); }
.ext-notes { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--ink-2); line-height: 1.55; }
@media (max-width: 760px) { .af-table .af-src { max-width: none; width: auto; } }

/* Assinaturas (dono): formulário de oferta. */
.as-form { display: grid; gap: 14px; }
.as-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.as-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.as-link { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.as-link .mono { word-break: break-all; font-size: 12px; }
@media (max-width: 720px) { .as-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* Plano e consumo: assinatura do cliente (Applyfy). */
.my-sub { display: grid; gap: 14px; margin-bottom: 16px; }
.my-sub__facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.my-sub__facts dt { font-size: 12px; color: var(--muted); }
.my-sub__facts dd { margin: 2px 0 0; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.my-sub .btn { justify-self: start; }
.my-sub__help { margin: 0; }
@media (max-width: 520px) { .my-sub__facts { grid-template-columns: minmax(0, 1fr); } }

/* Anunciar: aba Título e descrição. */
.vd-texto { display: grid; gap: 14px; }
.vd-texto-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.vd-texto textarea { min-height: 220px; resize: vertical; }

.vd-competitor { display: flex; gap: 8px; align-items: flex-start; }
.vd-competitor svg { width: 16px; height: 16px; flex: none; margin-top: 3px; color: var(--gold-text); }

/* Pedidos: pagar o fornecedor (Pix direto para a GoBoox). */
.vd-pay-rows { margin: 8px 0 12px; }
.vd-pix { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 16px; align-items: start; }
.vd-pix-qr { width: 168px; height: 168px; border-radius: var(--radius-md); background: var(--qr-bg); padding: 6px; }
.vd-pix-value { font-size: 24px; font-weight: 800; color: var(--gold-text); font-variant-numeric: tabular-nums; }
.vd-pix-code textarea { width: 100%; font-family: var(--mono, ui-monospace, monospace); font-size: 12px; resize: none;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--ink); padding: 8px; }
.vd-pix-info { display: grid; gap: 10px; min-width: 0; }
.vd-pix-form input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--input-bg); color: var(--ink); font: inherit; }
@media (max-width: 520px) { .vd-pix { grid-template-columns: minmax(0, 1fr); } .vd-pix-qr { justify-self: center; }
  .vd-pix-form { flex-direction: column; } }

/* Financeiro: crédito no fornecedor (G4) */
.vd-credit > .card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px 24px; }
.vd-credit-balance { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.vd-credit-balance b { font-size: 24px; font-weight: 800; color: var(--gold-text); font-variant-numeric: tabular-nums; }
.vd-credit-in { color: var(--ok-ink); }
.vd-credit-out { color: var(--muted); }
.vd-gb-queue .vd-inline-form input { max-width: 160px; }
@media (max-width: 640px) { .vd-credit-balance { align-items: flex-start; } }

/* Financeiro: totais do mês (Fase 5 do PLANO-VENDAS) */
.vd-fin-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.vd-fin-kpis .kpi-value { font-size: 24px; }
.vd-fin-note { margin: 0 0 16px; }
.vd-month-form { display: flex; gap: 8px; align-items: center; }
.vd-month-form select { min-width: 200px; }
.vd-credit { margin-top: 24px; }
@media (max-width: 1100px) { .vd-fin-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.vd-fin-table tr.is-muted td, .vd-fin-table tr.is-muted .vd-listing-profit { color: var(--muted); }
.vd-fin-table tr.is-muted .vd-listing-profit { text-decoration: line-through; }
@media (max-width: 640px) {
  .vd-fin-kpis { grid-template-columns: minmax(0, 1fr); }
  /* Cada valor numa linha só: rótulo à esquerda, valor à direita. */
  table.vd-fin-table td[data-label] { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0 !important; }
  table.vd-fin-table td[data-label]::before { margin: 0; }
  .vd-month-form, .vd-month-form select { flex: 1 1 100%; min-width: 0; }
}

/* Indique e ganhe (/indique e /indicacoes) */
.ind-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ind-link { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ind-link input { flex: 1 1 280px; min-width: 0; }
.ind-how { margin-top: 24px; }
.ind-pix { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.ind-pix .field { flex: 1 1 280px; margin: 0; }
.ind-pixline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ind-cancel { color: var(--muted); text-decoration: line-through; }
@media (max-width: 760px) { .ind-kpis { grid-template-columns: minmax(0, 1fr); } }

/* Demonstração (conta das lives): controles da simulação */
.demo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; align-items: end; }
.demo-grid .field, .demo-inline .field { margin: 0; }
.demo-inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.demo-inline .field { flex: 0 1 160px; }
.demo-weight { width: 72px; text-align: right; font-variant-numeric: tabular-nums; }
a.dw-row { text-decoration: none; }

/* Conexões com marketplaces (Afiliado › Contas, Vendas › Integrações) */
:root {
  --mk-ml: #ffe600;        --mk-ml-ink: #2d3277;
  --mk-shopee: #ee4d2d;    --mk-shopee-ink: #ffffff;
  --mk-tiktok: #000000;    --mk-tiktok-ink: #ffffff;
  --mk-bling: #92f473;     --mk-bling-ink: #002726;
  --mk-nuvemshop: #0050c3; --mk-nuvemshop-ink: #ffffff;
}
.mk-hero {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px;
  padding: 24px; margin-bottom: 32px; border-radius: var(--radius-md);
  background: var(--primary); color: var(--primary-ink); border: 1px solid var(--primary);
}
:root[data-theme="dark"] .mk-hero { background: var(--card); color: var(--ink); border-color: var(--line); }
.mk-hero-main { flex: 1 1 340px; min-width: 0; }
.mk-hero-ic {
  display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 16px; border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent); background: color-mix(in srgb, currentColor 8%, transparent);
}
.mk-hero-ic .ic { width: 18px; height: 18px; }
:root[data-theme="dark"] .mk-hero-ic { color: var(--gold); border-color: var(--gold-line); background: var(--gold-wash); }
.mk-eyebrow { display: block; margin: 0; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.mk-hero-title { margin: 6px 0 0; font-size: 24px; font-weight: 700; line-height: 1.25; max-width: 26ch; }
.mk-hero-text { margin: 8px 0 0; font-size: 13px; line-height: 1.55; opacity: .75; max-width: 56ch; }
.mk-stats { display: flex; gap: 10px; margin: 0; }
.mk-stat {
  display: flex; flex-direction: column; justify-content: space-between; min-width: 104px; padding: 12px 14px;
  border-radius: var(--radius-md); border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
  background: color-mix(in srgb, currentColor 6%, transparent);
}
.mk-stat dd { margin: 0; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.mk-stat dt { margin-top: 6px; font-size: 12px; opacity: .75; }
.mk-stat.is-on { background: var(--primary-ink); color: var(--primary); border-color: var(--primary-ink); }
:root[data-theme="dark"] .mk-stat.is-on { background: var(--gold-wash); color: var(--gold-text); border-color: var(--gold-line); }

.mk-section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 24px; margin: 0 0 12px; }
.mk-section-head .mk-eyebrow { color: var(--muted); opacity: 1; }
.mk-section-head h2 { margin: 4px 0 0; font-size: 18px; font-weight: 600; }
.mk-section-head p { margin: 0; max-width: 52ch; }
.mk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 32px; align-items: stretch; }
.mk-grid-soon { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.mk-card {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
}
.mk-card.is-wide { grid-column: 1 / -1; }
.mk-card-in { flex: 1; padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mk-top { display: flex; align-items: flex-start; gap: 14px; }
/* Logo oficial (static/marcas/*.svg): o quadrado com a cor da marca já vem no arquivo. */
.brand-logo { display: block; flex: 0 0 auto; object-fit: cover; }
.mk-logo { width: 48px; height: 48px; border-radius: var(--radius-md); box-shadow: 0 0 0 1px var(--line); }
.mk-name { flex: 1; min-width: 0; }
.mk-name .mk-eyebrow { color: var(--muted); opacity: 1; letter-spacing: .04em; }
.mk-name h3 { margin: 2px 0 0; font-size: 17px; font-weight: 700; line-height: 1.3; }
.mk-desc { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55; }
.mk-accounts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mk-account { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--sunken); border: 1px solid var(--line); }
.mk-account .cell-title { font-weight: 600; }
.mk-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 2px; }
.mk-actions > .btn, .mk-actions > form.inline { flex: 1 1 140px; }
.mk-actions > .btn { justify-content: center; }
.mk-actions form.inline .btn { width: 100%; justify-content: center; }
.mk-foot {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--sunken); border-top: 1px solid var(--line);
}
.mk-foot .ic { width: 15px; height: 15px; }
.mk-card.is-on .mk-foot { background: var(--mk-bg); color: var(--mk-ink); border-top-color: var(--mk-bg); }
.mk-card.is-bad .mk-foot { background: var(--danger-soft); color: var(--danger-ink); border-top-color: var(--danger-line); }
.mk-card.is-soon .mk-logo { opacity: .75; }
.mk-card.is-soon .mk-card-in { gap: 10px; }
.mk-ml { --mk-bg: var(--mk-ml); --mk-ink: var(--mk-ml-ink); }
.mk-shopee { --mk-bg: var(--mk-shopee); --mk-ink: var(--mk-shopee-ink); }
.mk-tiktok { --mk-bg: var(--mk-tiktok); --mk-ink: var(--mk-tiktok-ink); }
.mk-bling { --mk-bg: var(--mk-bling); --mk-ink: var(--mk-bling-ink); }
.mk-nuvemshop { --mk-bg: var(--mk-nuvemshop); --mk-ink: var(--mk-nuvemshop-ink); }
.mk-card .alert { margin: 0; }

.mk-next { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: stretch; }
.mk-next .vd-steps > li { background: var(--card); }
.mk-step-text { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.mk-note { padding: 18px 20px; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--sunken); display: flex; flex-direction: column; gap: 8px; }
.mk-note .mk-eyebrow { color: var(--muted); opacity: 1; }
.mk-note h3 { margin: 0; font-size: 15px; font-weight: 600; }
.mk-note p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.mk-note .btn { align-self: flex-start; margin-top: auto; }
@media (max-width: 1100px) {
  .mk-next { grid-template-columns: minmax(0, 1fr); }
  .mk-grid-soon { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .mk-hero { padding: 20px 16px; }
  .mk-hero-title { font-size: 20px; }
  .mk-stats { width: 100%; }
  .mk-stat { flex: 1; min-width: 0; }
  .mk-grid, .mk-grid-soon { grid-template-columns: minmax(0, 1fr); }
  .mk-card-in { padding: 16px; }
}
.mk-slots { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mk-account .vd-howto, .mk-account .alert { margin-top: 12px; }
/* Selo de status desce de linha quando o nome do marketplace não cabe ao lado. */
.mk-top { flex-wrap: wrap; row-gap: 8px; }
.mk-name { flex: 1 1 170px; }
@media (max-width: 760px) { .mk-top > .badge { margin-left: 62px; } }
