/* Paleta do sistema antigo (laranja #FCB33F / #F68934, grafite #29313A), claro + escuro.
   Texto sobre laranja é grafite (branco sobre #FCB33F não passa em contraste). */
:root {
  --background: hsl(31 60% 98%);
  --foreground: hsl(205 20% 20%);
  --card: hsl(0 0% 100%);
  --sidebar: hsl(0 0% 100%);
  --primary: hsl(31 90% 60%);
  --primary-fg: hsl(205 20% 16%);
  --accent: hsl(22 85% 58%);
  --accent-fg: hsl(205 20% 12%);
  --muted: hsl(31 90% 95%);
  --muted-fg: hsl(205 15% 42%);
  --border: hsl(31 30% 88%);
  --ring: hsl(22 85% 48%);
  --ok: hsl(152 55% 28%);
  --ok-bg: hsl(152 55% 91%);
  --warn: hsl(28 90% 28%);
  --warn-bg: hsl(41 100% 88%);
  --bad: hsl(0 65% 40%);
  --bad-bg: hsl(0 80% 94%);
  --info-bg: hsl(31 90% 93%);
  --info-fg: hsl(205 25% 28%);
  --radius: 0.75rem;
  --shadow: 0 1px 2px hsl(205 20% 20% / 0.06), 0 4px 16px hsl(31 40% 40% / 0.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --background: hsl(205 20% 11%);
    --foreground: hsl(0 0% 96%);
    --card: hsl(205 20% 15%);
    --sidebar: hsl(205 20% 13%);
    --muted: hsl(205 15% 20%);
    --muted-fg: hsl(205 10% 68%);
    --border: hsl(205 15% 24%);
    --ring: hsl(31 90% 60%);
    --ok: hsl(152 60% 62%);
    --ok-bg: hsl(152 40% 16%);
    --warn: hsl(41 100% 68%);
    --warn-bg: hsl(31 50% 17%);
    --bad: hsl(0 85% 72%);
    --bad-bg: hsl(0 45% 20%);
    --info-bg: hsl(205 15% 22%);
    --info-fg: hsl(31 90% 74%);
    --shadow: 0 1px 2px #0006;
  }
}
:root[data-theme='dark'] {
  --background: hsl(205 20% 11%);
  --foreground: hsl(0 0% 96%);
  --card: hsl(205 20% 15%);
  --sidebar: hsl(205 20% 13%);
  --muted: hsl(205 15% 20%);
  --muted-fg: hsl(205 10% 68%);
  --border: hsl(205 15% 24%);
  --ring: hsl(31 90% 60%);
  --ok: hsl(152 60% 62%);
  --ok-bg: hsl(152 40% 16%);
  --warn: hsl(41 100% 68%);
  --warn-bg: hsl(31 50% 17%);
  --bad: hsl(0 85% 72%);
  --bad-bg: hsl(0 45% 20%);
  --info-bg: hsl(205 15% 22%);
  --info-fg: hsl(31 90% 74%);
  --shadow: 0 1px 2px #0006;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.95rem; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted-fg); }
.small { font-size: 0.85rem; }
code { background: var(--muted); padding: 1px 6px; border-radius: 6px; font-size: 0.85em; }
.hidden { display: none !important; }

/* ---- layout com menu lateral ---- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 12px; background: var(--sidebar); border-right: 1px solid var(--border);
}
.brand { font-weight: 800; font-size: 1.15rem; display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.logo { width: var(--sz, 40px); height: var(--sz, 40px); flex: none; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px hsl(31 40% 40% / 0.25); display: grid; place-items: center; overflow: hidden; }
.logo img { width: 72%; height: 72%; object-fit: contain; }
.brand-txt { display: grid; line-height: 1.15; }
.brand-txt small { font-weight: 500; font-size: 0.72rem; color: var(--muted-fg); }
.side .brand { padding: 4px 10px 14px; }
#nav { display: grid; gap: 2px; align-content: start; flex: 1; }
.nav-group { margin: 14px 10px 4px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-fg); }
#nav button {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: none; border: 0; color: var(--foreground); font: inherit; font-weight: 600; font-size: 0.92rem;
  padding: 9px 12px; border-radius: 10px; cursor: pointer;
}
#nav button svg { width: 18px; height: 18px; flex: none; opacity: 0.75; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#nav button:hover { background: var(--muted); }
#nav button[aria-current='page'] { background: var(--primary); color: var(--primary-fg); }
#nav button[aria-current='page'] svg { opacity: 1; }
.nb { margin-left: auto; min-width: 20px; padding: 0 7px; border-radius: 999px; font-size: 0.72rem; line-height: 20px; text-align: center; background: var(--accent); color: var(--accent-fg); }
.nb:empty { display: none; }
.nb.warn { background: var(--bad); color: #fff; }
.side-foot { border-top: 1px solid var(--border); padding: 12px 6px 0; display: grid; gap: 10px; }
.who { display: grid; line-height: 1.3; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; }
.who b { font-size: 0.9rem; }
.content { min-width: 0; }
main { max-width: 1040px; margin: 0 auto; padding: 32px 24px 80px; display: grid; gap: 20px; }
.mobilebar { display: none; }
.scrim { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.spacer { flex: 1; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); display: grid; gap: 14px;
}
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

/* form */
label { display: grid; gap: 6px; font-weight: 600; font-size: 0.88rem; }
input, select, textarea {
  font: inherit; color: var(--foreground); background: var(--background);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; width: 100%;
}
textarea { min-height: 110px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--ring); outline-offset: 2px;
}
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
label.check input { width: auto; margin-top: 4px; }

button.btn {
  font: inherit; font-weight: 700; border: 0; cursor: pointer;
  background: var(--primary); color: var(--primary-fg);
  padding: 10px 18px; border-radius: 999px;
}
button.btn:hover { filter: brightness(1.06); }
button.btn.accent { background: var(--accent); color: var(--accent-fg); }
button.btn.ghost { background: transparent; color: var(--foreground); border: 1px solid var(--border); }
button.btn.ghost:hover { background: var(--muted); filter: none; }
button.btn.danger { background: var(--bad-bg); color: var(--bad); }
button.btn.sm { padding: 6px 12px; font-size: 0.85rem; }
button.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

/* badges + stats */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info-fg); }
.stat { background: var(--muted); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 1.5rem; line-height: 1.2; }
.stat span { color: var(--muted-fg); font-size: 0.82rem; }

/* tabela */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; color: var(--muted-fg); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }

/* alertas */
.alert { padding: 12px 14px; border-radius: 10px; font-size: 0.9rem; }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.info { background: var(--info-bg); color: var(--info-fg); }

/* passos */
.steps { display: flex; gap: 8px 18px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted-fg); }
.step .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--muted); font-size: 0.8rem; }
.step.on { color: var(--foreground); }
.step.on .n { background: var(--accent); color: var(--accent-fg); }

.drop {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px; text-align: center;
  background: var(--muted); cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); }
.progress { height: 8px; background: var(--muted); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.preview { background: var(--muted); border-radius: var(--radius); padding: 14px; white-space: pre-wrap; font-size: 0.9rem; }
.empty { text-align: center; padding: 28px 12px; display: grid; gap: 10px; justify-items: center; color: var(--muted-fg); }

/* ---- telas estreitas: menu vira gaveta ---- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow); }
  .shell.open .side { transform: none; }
  .shell.open .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: #0007; }
  .mobilebar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 10;
    padding: 10px 16px; background: var(--sidebar); border-bottom: 1px solid var(--border);
  }
  .mobilebar button { background: none; border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; color: var(--foreground); font-size: 1.1rem; cursor: pointer; }
  main { padding: 20px 16px 60px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* janelas de confirmação */
.modal-back { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: #0009; }
.modal { width: min(440px, 100%); background: var(--card); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; display: grid; gap: 14px; box-shadow: 0 20px 60px #0006; }
.modal p { white-space: pre-line; }

/* ---- seletor de perfil no menu ---- */
.perfil-box {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; margin: 0 0 6px;
  background: var(--muted); border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px;
  color: var(--foreground); font: inherit; cursor: pointer;
}
.perfil-box:hover { border-color: var(--accent); }
.perfil-txt { display: grid; line-height: 1.2; min-width: 0; flex: 1; }
.perfil-txt small { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-fg); }
.perfil-txt b { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perfil-box svg { width: 16px; height: 16px; flex: none; opacity: 0.6; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.av { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: linear-gradient(135deg, var(--primary), var(--accent)); color: var(--accent-fg); }
.av.lg { width: 46px; height: 46px; font-size: 1.15rem; border-radius: 14px; }

/* ---- cartões de perfil ---- */
.perfis-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.perfil-card { display: grid; gap: 12px; align-content: start; cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.perfil-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.perfil-card.atual { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent), var(--shadow); }
.perfil-card.off { opacity: 0.6; }
.perfil-card .stats { display: flex; gap: 18px; }
.perfil-card .stats b { font-size: 1.2rem; display: block; line-height: 1.1; }
.perfil-card .stats span { font-size: 0.75rem; color: var(--muted-fg); }

/* ---- editor de automação: linha vertical de passos ---- */
.flow { display: grid; justify-items: stretch; }
.flow-node { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.flow-node.gatilho { border-left: 5px solid var(--accent); }
.flow-node.modelo { border-left: 5px solid var(--ok); }
.flow-node.esperar { border-left: 5px solid var(--primary); background: var(--muted); }
.flow-node.erro { border-left-color: var(--bad); }
.flow-head { display: flex; align-items: center; gap: 12px; }
.flow-head .ic { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--muted); }
.flow-node.esperar .flow-head .ic { background: var(--card); }
.flow-head .ic svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.flow-head .tt { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.flow-head .tt b { font-size: 0.98rem; }
.flow-head .tt span { font-size: 0.82rem; color: var(--muted-fg); }
.flow-line { width: 2px; height: 22px; margin: 0 auto; background: var(--border); position: relative; }
.flow-add { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding-top: 4px; }
.urlbox { display: flex; gap: 8px; align-items: stretch; }
.urlbox code { flex: 1; min-width: 0; padding: 9px 12px; overflow-x: auto; white-space: nowrap; border: 1px solid var(--border); border-radius: 10px; font-size: 0.82rem; }
.varrow { display: grid; grid-template-columns: 52px minmax(130px, 170px) 1fr; gap: 8px; align-items: center; }
@media (max-width: 600px) { .varrow { grid-template-columns: 1fr; } }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 0.75rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--info-bg); color: var(--info-fg); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.switch input { width: auto; }

/* ---- lista suspensa de perfis ---- */
.pop { position: fixed; z-index: 60; background: var(--card); color: var(--foreground); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 48px #0004; overflow: hidden; display: grid; max-height: min(480px, 80vh); grid-template-rows: auto 1fr auto; }
.pop-busca { padding: 10px; border-bottom: 1px solid var(--border); }
.pop-lista { overflow-y: auto; padding: 6px; display: grid; align-content: start; gap: 2px; }
.pop-rodape { border-top: 1px solid var(--border); padding: 6px; display: grid; gap: 2px; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 8px 10px; font: inherit; color: inherit; cursor: pointer; }
.pop-item:hover, .pop-item:focus-visible { background: var(--muted); }
.pop-item.sel { background: var(--info-bg); }
.pop-item .perfil-txt b { font-size: 0.92rem; }

/* ---- Chat (estilo WhatsApp) ---- */
:root { --leitura: hsl(200 85% 45%); --bolha-in: var(--card); --bolha-out: hsl(31 85% 90%); --chat-fundo: hsl(31 35% 94%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { --leitura: hsl(200 85% 65%); --bolha-out: hsl(25 40% 24%); --chat-fundo: hsl(205 20% 12%); } }
:root[data-theme='dark'] { --leitura: hsl(200 85% 65%); --bolha-out: hsl(25 40% 24%); --chat-fundo: hsl(205 20% 12%); }
#app.wide { max-width: 1400px; padding-bottom: 24px; }
.chat { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 64px); min-height: 520px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: var(--shadow); }
.chat-lista { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-right: 1px solid var(--border); min-height: 0; }
.chat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-itens { overflow-y: auto; margin: 0 -6px; display: grid; align-content: start; gap: 2px; min-height: 0; flex: 1; }
.chat-item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-radius: 12px; padding: 9px 10px; font: inherit; color: inherit; cursor: pointer; }
.chat-item:hover { background: var(--muted); }
.chat-item.sel { background: var(--info-bg); }
.chat-item-txt { display: grid; gap: 2px; min-width: 0; flex: 1; }
.chat-item-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.92rem; }
.chat-prev { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 210px; }
.chat-painel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--chat-fundo); }
.chat-vazio { margin: auto; display: grid; gap: 4px; text-align: center; color: var(--muted-fg); padding: 24px; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--border); }
.chat-head .voltar { display: none; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px clamp(10px, 4vw, 48px); display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.dia { text-align: center; margin: 10px 0 6px; }
.dia span { background: var(--card); color: var(--muted-fg); font-size: 0.75rem; font-weight: 700; padding: 3px 12px; border-radius: 999px; box-shadow: var(--shadow); }
.msg { display: flex; flex-direction: column; max-width: min(620px, 82%); }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.bolha { background: var(--bolha-in); border-radius: 12px 12px 12px 3px; padding: 7px 10px 5px; box-shadow: 0 1px 1px hsl(205 20% 20% / 0.12); overflow-wrap: anywhere; display: grid; gap: 4px; }
.msg.out .bolha { background: var(--bolha-out); border-radius: 12px 12px 3px 12px; }
.msg.falha .bolha { background: var(--bad-bg); }
.txt { white-space: pre-wrap; }
.meta { justify-self: end; font-size: 0.68rem; color: var(--muted-fg); display: flex; gap: 4px; align-items: center; }
.tick.lida { color: var(--leitura); font-weight: 700; }
.tick.falha { color: var(--bad); }
.msg-erro { background: var(--bad-bg); color: var(--bad); font-size: 0.8rem; padding: 6px 10px; border-radius: 8px; margin-top: 3px; max-width: 100%; }
.anexo { max-width: 100%; max-height: 280px; border-radius: 8px; display: block; }
.chat-comp { background: var(--card); border-top: 1px solid var(--border); padding: 10px 14px; display: grid; gap: 10px; max-height: 60%; overflow-y: auto; }
.comp-row { display: flex; gap: 8px; align-items: flex-end; }
.comp-row textarea { min-height: 42px; max-height: 140px; resize: none; border-radius: 14px; }
@media (max-width: 900px) {
  .chat { grid-template-columns: 1fr; height: calc(100vh - 100px); }
  .chat-painel { display: none; }
  .chat.on-thread .chat-lista { display: none; }
  .chat.on-thread .chat-painel { display: flex; }
  .chat-head .voltar { display: inline-block; }
  .chat-prev { max-width: 60vw; }
}
.chat-head { flex-wrap: wrap; row-gap: 6px; }
.chat-head .perfil-txt { flex: 1 1 120px; }
.chat-head > b { flex: 1 1 120px; }
.chat-head .chip { flex: none; white-space: nowrap; }

/* ---- marca AdzSend: ícone laranja + nome em índigo, letra arredondada e grossa ---- */
:root { --marca: #5e6bae; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { --marca: #9ba8e6; } }
:root[data-theme='dark'] { --marca: #9ba8e6; }
.marca { gap: 8px; }
.marca-ico { width: 38px; height: 38px; flex: none; object-fit: contain; }
.wordmark {
  color: var(--marca); font-size: 1.55rem; line-height: 1; letter-spacing: -0.02em; font-weight: 800; font-synthesis: none;
  font-family: 'Nunito', 'Varela Round', ui-rounded, 'SF Pro Rounded', 'Arial Rounded MT Bold', 'Segoe UI Variable Display', 'Segoe UI', system-ui, sans-serif;
}
.mobilebar .marca-ico { width: 30px; height: 30px; }
.mobilebar .wordmark { font-size: 1.3rem; }
.marca.grande .marca-ico { width: 54px; height: 54px; }
.marca.grande .wordmark { font-size: 2.1rem; }
.side .brand.marca { padding: 4px 10px 14px; }

/* ---- Guia de uso ---- */
.g-sec h2 { margin-bottom: 2px; }
.g-sec p, .g-corpo p { line-height: 1.55; }
.g-indice { gap: 8px; }
.g-fluxo { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-weight: 700; }
.g-fluxo .chip { font-size: 0.9rem; padding: 6px 14px; }
.g-lista { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.g-passos { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.g-passo { display: flex; gap: 12px; align-items: flex-start; }
.g-passo .small { margin-top: 4px; line-height: 1.5; }
.g-n { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-fg); font-weight: 800; font-size: 0.85rem; margin-top: 1px; }
.g-mod { padding: 0; gap: 0; }
.g-mod > summary { list-style: none; cursor: pointer; padding: 16px 20px; display: grid; gap: 2px; position: relative; padding-right: 44px; }
.g-mod > summary::-webkit-details-marker { display: none; }
.g-mod > summary::after { content: '▾'; position: absolute; right: 18px; top: 50%; transform: translateY(-50%) rotate(-90deg); transition: transform 0.15s; color: var(--muted-fg); }
.g-mod[open] > summary::after { transform: translateY(-50%); }
.g-mod > summary:hover { background: var(--muted); border-radius: var(--radius); }
.g-corpo { padding: 4px 20px 20px; display: grid; gap: 14px; border-top: 1px solid var(--border); padding-top: 16px; }
.g-corpo h3 { margin-bottom: 4px; }
.g-sec table td:first-child { white-space: nowrap; vertical-align: top; }
@media (max-width: 700px) { .g-sec table td:first-child { white-space: normal; } }

/* ---- Formulário de modelos (todas as opções da Meta) ---- */
.card.inset { background: var(--background); box-shadow: none; margin: 0; }
.card.inset h3 { margin: 0 0 8px; }
.modelo-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.modelo-col { display: grid; gap: 14px; min-width: 0; }
.modelo-prev { position: sticky; top: 12px; }
@media (max-width: 900px) { .modelo-grid { grid-template-columns: 1fr; } .modelo-prev { position: static; } }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 6px; }
.cat { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-weight: 500; }
.cat.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.botao-lin { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 10px; }
.botao-campos { display: flex; flex-wrap: wrap; gap: 8px; }
.botao-campos input { flex: 1 1 180px; min-width: 0; }
@media (max-width: 640px) { .botao-lin { grid-template-columns: 1fr; } }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.media-item { display: grid; gap: 4px; justify-items: center; align-content: start; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--foreground); cursor: pointer; font: inherit; text-align: center; }
.media-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.media-item.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.media-ico { display: grid; place-items: center; width: 100%; aspect-ratio: 1; font-size: 1.8rem; background: var(--muted); border-radius: 6px; }
.media-nome { font-size: 0.8rem; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-novo { border-style: dashed; }
.prev-wrap { display: grid; gap: 6px; }
.wa-fundo { background: #e5ddd5; border-radius: var(--radius); padding: 16px 12px; min-height: 220px; }
.wa-bolha { background: #fff; color: #111b21; border-radius: 0 10px 10px 10px; padding: 6px; max-width: 290px; box-shadow: 0 1px 1px rgb(0 0 0 / 0.12); font-size: 0.9rem; overflow-wrap: anywhere; }
.wa-bolha mark { background: #fff3c4; color: inherit; border-radius: 3px; padding: 0 2px; }
.wa-cab-texto { font-weight: 700; padding: 4px 6px; }
.wa-cab-img { display: block; width: 100%; max-height: 200px; object-fit: cover; border-radius: 6px; }
.wa-cab-vazio { display: grid; place-items: center; height: 130px; background: #d1d7db; color: #54656f; border-radius: 6px; font-weight: 600; }
.wa-corpo { padding: 6px; white-space: pre-wrap; }
.wa-corpo .muted { color: #667781; }
.wa-rodape { padding: 0 6px 4px; color: #667781; font-size: 0.78rem; }
.wa-botoes { display: grid; border-top: 1px solid #e9edef; margin-top: 4px; }
.wa-botoes span { padding: 8px; text-align: center; color: #027eb5; font-weight: 600; border-bottom: 1px solid #e9edef; }
.wa-botoes span:last-child { border-bottom: 0; }
.alert.small { padding: 8px 10px; font-size: 0.85rem; }
