/* Direto Direct - design system preto e branco.
   Regras: formas sólidas (nunca cor sobre cor), linhas de 1px no lugar de sombras, sem filetes de destaque,
   sem bordas pontilhadas, vermelho só pra falha e exclusão. */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --ink: #0a0a0a;
  --ink-2: #404040;
  --muted: #737373;
  --faint: #a3a3a3;
  --line: #e5e5e5;
  --line-soft: #f0f0f0;
  --hover: #f5f5f5;
  --solid: #0a0a0a;
  --solid-hover: #2b2b2b;
  --on-solid: #ffffff;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --ok: #15803d;
  --radius: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #111111;
  --ink: #fafafa;
  --ink-2: #d4d4d4;
  --muted: #8c8c8c;
  --faint: #5e5e5e;
  --line: #262626;
  --line-soft: #1b1b1b;
  --hover: #181818;
  --solid: #fafafa;
  --solid-hover: #d9d9d9;
  --on-solid: #0a0a0a;
  --danger: #f87171;
  --danger-soft: #261212;
  --ok: #4ade80;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.02em; font-weight: 600; text-wrap: balance; }
::selection { background: var(--solid); color: var(--on-solid); }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 0 28px; height: 60px; display: flex; align-items: center; gap: 32px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -0.03em; white-space: nowrap; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--solid); color: var(--on-solid);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-mark svg { width: 14px; height: 14px; }
.topnav { display: flex; align-items: center; gap: 2px; flex: 1; }
.nav-link {
  display: inline-flex; align-items: center; height: 34px; padding: 0 13px; border-radius: 999px;
  text-decoration: none; font-size: 13.5px; font-weight: 500; color: var(--muted); transition: background .15s, color .15s;
}
.nav-link:hover { color: var(--ink); background: var(--hover); }
.nav-link.active { background: var(--solid); color: var(--on-solid); }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 999px; border: 1px solid transparent; background: none; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }
.theme-toggle-btn {
  width: 34px; height: 34px; border-radius: 999px; border: none; background: none; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.theme-toggle-btn:hover { background: var(--hover); color: var(--ink); }
.theme-toggle-btn svg { width: 16px; height: 16px; }
.theme-toggle-label { display: none; }
.account-chip {
  display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 12px 0 4px; margin-left: 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 500;
}
.account-chip img, .avatar-fallback {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  background: var(--solid); color: var(--on-solid); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}
.account-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.logout-form { margin: 0; }
.menu-toggle { display: none; }

/* ---------- Página ---------- */
main.page { max-width: 1120px; margin: 0 auto; padding: 44px 28px 96px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; flex-wrap: wrap; }
.page-header h1 { font-size: 34px; line-height: 1.1; letter-spacing: -0.035em; font-weight: 600; }
.page-header p { margin: 8px 0 0; color: var(--muted); font-size: 14.5px; max-width: 560px; text-wrap: pretty; }
.page-header-actions { display: flex; gap: 8px; align-items: center; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; margin-bottom: 16px;
}
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.card-header h2 { font-size: 15.5px; font-weight: 600; letter-spacing: -0.015em; }
.muted { color: var(--muted); font-size: 13px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.two-col > .card { margin-bottom: 0; }
.split-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: stretch; margin-bottom: 16px; }
.split-2-1 > .card { margin-bottom: 0; }
.mt-16 { margin-top: 16px; }

.notice { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--solid); color: var(--on-solid); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 24px; }
.notice-title { font-weight: 600; font-size: 14px; }
.notice-text { font-size: 13px; opacity: .72; margin-top: 2px; }
.notice .btn { background: var(--on-solid); color: var(--solid); border-color: var(--on-solid); }
.notice .btn:hover { opacity: .88; background: var(--on-solid); border-color: var(--on-solid); }
@media (max-width: 860px) { .notice { flex-direction: column; align-items: flex-start; } }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: var(--radius-md); border: 1px solid var(--solid); background: var(--solid); color: var(--on-solid);
  font: 500 14px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
}
.btn:hover { background: var(--solid-hover); border-color: var(--solid-hover); }
.btn:active { transform: scale(0.985); }
.btn svg { width: 15px; height: 15px; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--hover); border-color: var(--faint); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--line); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.small { height: 32px; padding: 0 13px; font-size: 13px; border-radius: var(--radius-sm); }

/* ---------- Formulários ---------- */
label { display: block; font-weight: 500; font-size: 13px; margin: 20px 0 7px; color: var(--ink); }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%; padding: 0 13px; height: 40px; border: 1px solid var(--line); border-radius: var(--radius-md);
  font: 400 14px var(--font); color: var(--ink); background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 96px; padding: 11px 13px; resize: vertical; line-height: 1.55; }
select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; }
input[type=text]::placeholder, input[type=email]::placeholder, input[type=password]::placeholder, textarea::placeholder { color: var(--faint); }
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 9%, transparent); }

/* ---------- Switch ---------- */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-slider { position: absolute; cursor: pointer; inset: 0; background: var(--line); border-radius: 999px; transition: background .18s; }
.switch-slider::before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: var(--surface);
  border-radius: 50%; transition: transform .18s; box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.switch input:checked + .switch-slider { background: var(--solid); }
.switch input:checked + .switch-slider::before { transform: translateX(16px); background: var(--on-solid); box-shadow: none; }
:root[data-theme="dark"] .switch-slider { background: #333; }

/* ---------- Chips e tags ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--ink-2); background: var(--surface); white-space: nowrap;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.tag svg { display: none; }
.tag.inactive, .tag.no_match { color: var(--muted); }
.tag.inactive::before, .tag.no_match::before { background: var(--faint); }
.tag.failed { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.tag.failed::before { background: var(--danger); }
.meta-pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: 999px; background: var(--hover);
  color: var(--muted); font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
code.token { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--hover); padding: 3px 9px; border-radius: 6px; font-size: 12.5px; color: var(--ink); }

/* ---------- Estatísticas ---------- */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 16px; overflow: hidden; }
.stats-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stat-card { padding: 22px 26px; border-right: 1px solid var(--line); }
.stat-card:last-child { border-right: none; }
.stat-card .label { font-size: 12.5px; color: var(--muted); font-weight: 500; order: -1; }
.stat-card { display: flex; flex-direction: column; gap: 10px; }
.stat-card .value { font-family: var(--font-display); font-size: 40px; line-height: 1; font-weight: 600; letter-spacing: -0.04em; }

/* ---------- Linhas de campos (configurações e listas curtas) ---------- */
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: inherit; }
.field-row:last-child { border-bottom: none; padding-bottom: 0; }
.card > .field-row:first-of-type, .card-header + .field-row { padding-top: 0; }
a.field-row { transition: opacity .15s; }
a.field-row:hover { opacity: .65; }
.field-label { font-size: 14px; font-weight: 500; }
.field-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-shrink: 0; }
.actions form { display: inline; margin: 0; }
.token-copy { display: flex; align-items: center; gap: 6px; }
.copy-btn { width: 30px; height: 30px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.copy-btn:hover { color: var(--ink); border-color: var(--faint); }
.copy-btn.copied { background: var(--solid); color: var(--on-solid); border-color: var(--solid); }
.copy-btn svg { width: 13px; height: 13px; }
.danger-zone-input { max-width: 150px; height: 32px; }

/* ---------- Tabelas ---------- */
.table-scroll { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 0 12px 12px; border-bottom: 1px solid var(--line); font-weight: 500; }
td { padding: 14px 12px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--hover); }
.user-cell { display: flex; align-items: center; gap: 10px; }
.avatar-initial { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--solid); color: var(--on-solid); font-size: 11.5px; font-weight: 600; }
.post-cell { display: flex; align-items: center; gap: 10px; }

/* ---------- Estado vazio ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 56px 20px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.empty-state .icon { width: 44px; height: 44px; margin: 0 0 16px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--line); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.empty-state .icon svg { width: 18px; height: 18px; }
.empty-state-steps { display: inline-flex; flex-direction: column; gap: 12px; margin: 24px auto 0; text-align: left; max-width: 340px; }
.empty-state-step { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink); }
.step-num { width: 22px; height: 22px; border-radius: 50%; background: var(--solid); color: var(--on-solid); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }

/* ---------- Checklist ---------- */
.checklist-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.checklist-progress-bar { flex: 1; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.checklist-progress-fill { height: 100%; border-radius: 4px; background: var(--solid); transition: width .3s; }
.checklist-progress-label { font-size: 12px; font-weight: 600; color: var(--ink); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.checklist-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.checklist-item:last-child { border-bottom: none; padding-bottom: 0; }
.check { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.check.done { background: var(--solid); color: var(--on-solid); }
.check.pending { border: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 600; }
.check svg { width: 12px; height: 12px; }
.checklist-item .text { font-size: 13.5px; font-weight: 500; }
.checklist-item .text.done { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.checklist-item .sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ---------- Gráfico ---------- */
.area-chart-wrap { width: 100%; }
.area-chart { width: 100%; height: 150px; display: block; overflow: visible; color: var(--ink); }
.area-chart .ac-line { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.area-chart .ac-dot { fill: var(--surface); stroke: currentColor; stroke-width: 1.5; }
.area-chart .ac-val { fill: var(--muted); font-size: 11px; font-weight: 500; font-family: var(--font); }
.area-chart-labels { display: flex; justify-content: space-between; margin-top: 8px; }
.area-chart-labels span { font-size: 11px; color: var(--muted); }

/* ---------- Imagens (esqueleto enquanto carrega) ---------- */
@keyframes shimmer { 0% { background-position: 0% 50%; } 100% { background-position: 100% 50%; } }
.post-grid-item img, .automation-row-media img, .post-thumb, .post-preview-card img {
  background-image: linear-gradient(90deg, var(--line-soft) 25%, var(--line) 37%, var(--line-soft) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
}

/* ---------- Grade de posts ---------- */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; max-height: 340px; overflow-y: auto; }
.post-grid.strip { grid-template-columns: repeat(6, 1fr); max-height: none; }
.post-grid-item { position: relative; cursor: pointer; border-radius: var(--radius-md); overflow: hidden; }
.post-grid-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border: 2px solid transparent; border-radius: var(--radius-md); transition: transform .25s, border-color .15s; }
.post-grid-item:hover img { transform: scale(1.04); }
.post-grid-item .check-badge { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--solid); color: var(--on-solid); display: none; align-items: center; justify-content: center; }
.post-grid-item .check-badge svg { width: 11px; height: 11px; }
.post-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }

/* ---------- Lista de automações ---------- */
.list-toolbar { display: flex; gap: 10px; margin-bottom: 8px; }
.search-input-wrap { position: relative; flex: 1; max-width: 340px; }
.search-input-wrap svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search-input-wrap input { padding-left: 37px; }
#automation-status-filter { width: auto; min-width: 130px; }
.automation-rows { display: flex; flex-direction: column; }
.automation-row { display: flex; align-items: center; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.automation-row:last-child { border-bottom: none; padding-bottom: 4px; }
.automation-row-media { flex-shrink: 0; width: 48px; height: 48px; border-radius: var(--radius-md); overflow: hidden; }
.automation-row-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.automation-row-icon { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--solid); color: var(--on-solid); }
.automation-row-icon svg { width: 20px; height: 20px; }
.automation-row-main { flex: 1; min-width: 0; }
.automation-row-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.automation-row-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.status-toggle { display: inline-flex; align-items: center; gap: 12px; flex-shrink: 0; margin: 0; }

/* ---------- Variações e barra de mensagem ---------- */
.variant-list { display: flex; flex-direction: column; gap: 8px; }
.variant-item { display: flex; gap: 8px; align-items: flex-start; }
.variant-item textarea { min-height: 64px; }
.variant-remove { flex-shrink: 0; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; margin-top: 3px; }
.variant-remove:hover { color: var(--danger); border-color: var(--danger); }
.variant-remove svg { width: 14px; height: 14px; }
.add-variant-btn { margin-top: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; width: 100%; height: 38px; background: none; border: 1px solid var(--line); color: var(--ink-2); border-radius: var(--radius-md); font: 500 13px var(--font); cursor: pointer; }
.add-variant-btn:hover { background: var(--hover); border-color: var(--faint); }
.add-variant-btn svg { width: 14px; height: 14px; }
.msg-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.msg-tool-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; font: 500 12px var(--font); cursor: pointer; white-space: nowrap; }
.msg-tool-btn:hover { background: var(--solid); color: var(--on-solid); border-color: var(--solid); }
.msg-tool-btn svg { width: 12px; height: 12px; }
.emoji-quick-row { display: flex; gap: 1px; }
.emoji-btn { width: 26px; height: 26px; border: none; background: none; border-radius: 6px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.emoji-btn:hover { background: var(--hover); }
.char-counter { font-size: 11px; color: var(--muted); text-align: right; margin-top: 5px; }
.char-counter.warn { color: var(--danger); }
.delay-row { display: flex; align-items: center; gap: 8px; }
.delay-row input { width: 76px !important; }
.delay-row span { font-size: 13px; color: var(--muted); }

/* ---------- Construtor de fluxo (tela cheia) ---------- */
body.fullscreen-mode { height: 100vh; overflow: hidden; }
main.fullscreen { height: 100vh; display: flex; flex-direction: column; }
.builder-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 20px; flex-shrink: 0; }
.builder-body { flex: 1; display: flex; min-height: 0; }
.builder-panel { width: 328px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.builder-panel-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; text-align: center; padding: 0 36px; gap: 12px; }
.builder-panel-empty svg { width: 26px; height: 26px; opacity: .45; }
.panel-section { display: none; padding: 22px; }
.panel-section.active { display: block; }
.panel-section > label:first-of-type { margin-top: 0; }
.panel-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.panel-header h3 { font-size: 15px; font-weight: 600; }
.panel-toggle-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 13px; font-weight: 500; }
.panel-stat { display: flex; align-items: center; gap: 8px; background: var(--hover); border-radius: var(--radius-md); padding: 10px 12px; font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.panel-stat svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--ink); }
.panel-stat b { color: var(--ink); }
.builder-canvas-wrap { flex: 1; min-width: 0; position: relative; background: var(--bg); }
.builder-canvas-wrap .flow-canvas-interactive { height: 100%; border-radius: 0; border: none; }
.editor-breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.editor-breadcrumb a { color: var(--muted); text-decoration: none; font-weight: 500; flex-shrink: 0; }
.editor-breadcrumb a:hover { color: var(--ink); }
.editor-breadcrumb .sep { color: var(--faint); flex-shrink: 0; }
.editor-breadcrumb .pencil-icon { width: 13px; height: 13px; color: var(--faint); flex-shrink: 0; }
.breadcrumb-name-input { border: 1px solid transparent !important; background: none !important; height: 34px !important; font: 600 15px var(--font-display) !important; letter-spacing: -0.01em; padding: 0 8px !important; border-radius: 8px !important; min-width: 140px; width: auto !important; max-width: 320px; }
.breadcrumb-name-input:hover { background: var(--hover) !important; }
.breadcrumb-name-input:focus { background: var(--hover) !important; box-shadow: none !important; }
.editor-topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.canvas-hint { font-size: 12px; color: var(--muted); }
.save-status { font-size: 12px; color: var(--muted); font-weight: 500; display: inline-flex; align-items: center; gap: 7px; }
.save-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.save-status.dirty { color: var(--ink); }
.save-status.dirty::before { background: var(--ink); }
.save-status.clean::before { background: var(--ok); }

.flow-canvas-interactive { position: relative; width: 100%; height: 520px; overflow: auto; background-color: var(--bg); background-image: radial-gradient(circle, var(--line) 1px, transparent 1px); background-size: 20px 20px; border: 1px solid var(--line); border-radius: var(--radius); }
.canvas-inner { position: relative; width: 1400px; height: 900px; }
.canvas-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.canvas-node { position: absolute; width: 264px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); z-index: 2; transition: border-color .15s, box-shadow .15s; }
.canvas-node:hover { border-color: var(--faint); }
.canvas-node.selected { border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 8%, transparent); }
.canvas-node.randomizer-node { width: 200px; }
.node-drag-handle { cursor: grab; padding: 11px 13px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-soft); user-select: none; border-radius: var(--radius) var(--radius) 0 0; }
.node-drag-handle:active { cursor: grabbing; }
.node-icon { width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--solid); color: var(--on-solid); }
.node-icon svg { width: 13px; height: 13px; }
.panel-header .node-icon { width: 30px; height: 30px; }
.panel-header .node-icon svg { width: 15px; height: 15px; }
.node-title { font-size: 12.5px; font-weight: 600; flex: 1; letter-spacing: -0.01em; }
.node-content { padding: 13px; }
.node-content select, .node-content input[type=text] { margin-top: 0; font-size: 13px; height: 36px; }
.node-content textarea { margin-top: 0; font-size: 12.5px; min-height: 70px; }
.node-preview-text { font-size: 12.5px; color: var(--ink); line-height: 1.45; max-height: 56px; overflow: hidden; word-wrap: break-word; white-space: pre-wrap; }
.node-preview-text.muted-preview { color: var(--muted); }
.node-preview-caption { display: flex; align-items: center; gap: 10px; }
.node-preview-caption img { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; flex-shrink: 0; }
.node-remove { width: 20px; height: 20px; border-radius: 6px; border: none; background: none; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.node-remove:hover { color: var(--danger); }
.node-remove svg { width: 12px; height: 12px; }
.node-post-btn { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); font: 400 13px var(--font); color: var(--muted); cursor: pointer; display: flex; align-items: center; gap: 10px; text-align: left; min-height: 40px; }
.node-post-btn:hover { border-color: var(--ink); color: var(--ink); }
.node-post-btn img { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.randomizer-node .node-content { padding: 8px 13px 12px; }
.randomizer-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; font-weight: 500; }
.randomizer-row:last-child { border-bottom: none; }
.randomizer-row .pct { color: var(--muted); }
.add-node-btn { position: absolute; width: 34px; height: 34px; border-radius: 50%; background: var(--solid); color: var(--on-solid); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 3; transition: background .15s, transform .1s; }
.add-node-btn:hover { background: var(--solid-hover); transform: scale(1.06); }
.add-node-btn svg { width: 16px; height: 16px; }
.node-floating-actions { position: absolute; display: none; gap: 4px; z-index: 4; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.node-floating-actions.visible { display: flex; }
.node-floating-actions button { width: 28px; height: 28px; border: none; background: none; border-radius: 7px; color: var(--ink-2); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.node-floating-actions button:hover { background: var(--hover); color: var(--ink); }
.node-floating-actions button.danger:hover { background: var(--danger-soft); color: var(--danger); }
.node-floating-actions svg { width: 13px; height: 13px; }

/* ---------- Modais ---------- */
.canvas-modal-overlay { position: fixed; inset: 0; background: rgba(10,10,10,.5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 60; }
.canvas-modal { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px; width: 520px; max-width: 92vw; max-height: 82vh; overflow-y: auto; }
.canvas-modal h3 { margin: 0 0 16px; font-size: 17px; }

/* ---------- Login ---------- */
.login-split { display: grid; grid-template-columns: 1.15fr 1fr; min-height: 100vh; }
.login-art { background: #0a0a0a; color: #fafafa; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art .brand { color: #fafafa; }
.login-art .brand-mark { background: #fafafa; color: #0a0a0a; }
.login-headline { font-family: var(--font-display); font-size: clamp(34px, 4.2vw, 56px); line-height: 1.04; letter-spacing: -0.04em; font-weight: 600; max-width: 520px; text-wrap: balance; }
.login-headline span { color: #737373; }
.login-demo { display: flex; flex-direction: column; gap: 10px; margin: 36px 0 0; max-width: 360px; }
.bubble { padding: 11px 16px; border-radius: 20px; font-size: 14px; line-height: 1.45; max-width: 86%; }
.bubble.in { align-self: flex-start; border: 1px solid #333; color: #d4d4d4; border-bottom-left-radius: 6px; }
.bubble.out { align-self: flex-end; background: #fafafa; color: #0a0a0a; border-bottom-right-radius: 6px; }
.bubble-label { font-size: 11px; color: #737373; margin: 4px 6px 0; }
.bubble-label.right { align-self: flex-end; }
.login-art-foot { font-size: 12px; color: #737373; display: flex; gap: 18px; flex-wrap: wrap; }
.login-art-foot a { text-decoration: none; }
.login-art-foot a:hover { color: #fafafa; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px 32px; background: var(--surface); }
.login-box { width: 100%; max-width: 372px; }
.login-box h1 { font-size: 30px; letter-spacing: -0.035em; margin-bottom: 8px; }
.login-box > p { color: var(--muted); font-size: 14.5px; margin: 0 0 28px; text-wrap: pretty; }
.login-instagram-btn { width: 100%; height: 48px; font-size: 15px; border-radius: 12px; }
.login-instagram-btn svg { width: 17px; height: 17px; }
.login-perms { margin: 32px 0 0; border-top: 1px solid var(--line); }
.login-perms-title { font-size: 12px; color: var(--muted); margin: 18px 0 4px; font-weight: 500; }
.login-perm { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.login-perm:last-child { border-bottom: none; }
.login-perm-ico { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--solid); color: var(--on-solid); display: flex; align-items: center; justify-content: center; }
.login-perm-ico svg { width: 14px; height: 14px; }
.login-perm b { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 1px; }
.login-perm span span, .login-perm > span:last-child { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.login-form label:first-of-type { margin-top: 0; }
.login-submit { width: 100%; height: 48px; font-size: 15px; border-radius: 12px; margin-top: 24px; }
.login-error { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-md); padding: 12px 14px; font-size: 13.5px; font-weight: 500; margin: 0 0 20px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 46px; }
.password-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: none; color: var(--muted); border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.password-toggle:hover { color: var(--ink); background: var(--hover); }
.password-toggle svg { width: 17px; height: 17px; }
.flash { background: var(--solid); color: var(--on-solid); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 24px; font-size: 13.5px; font-weight: 500; }
.account-line { display: flex; align-items: center; gap: 14px; min-width: 0; }
.account-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.account-avatar.fallback { background: var(--solid); color: var(--on-solid); display: flex; align-items: center; justify-content: center; font-weight: 600; }
.password-form { padding-top: 16px; max-width: 420px; }
.password-form .field-desc { margin-bottom: 4px; }
.password-submit { margin-top: 22px; }
.card .login-perm:first-of-type { padding-top: 0; }
.login-box > p.login-hint { font-size: 12px; color: var(--muted); margin: 22px 0 0; line-height: 1.7; }
.login-hint a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); }
.login-hint a:hover { color: var(--ink); }

/* ---------- Páginas legais ---------- */
.legal-wrap { max-width: 720px; margin: 0 auto; padding: 36px 24px 96px; }
.legal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 40px; }
.legal-top .back { font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none; }
.legal-top .back:hover { color: var(--ink); }
.legal-doc h1 { font-size: 38px; letter-spacing: -0.04em; line-height: 1.08; margin: 14px 0 8px; }
.legal-doc h2 { font-size: 17px; margin: 36px 0 10px; }
.legal-doc p, .legal-doc li { font-size: 14.5px; color: var(--ink-2); line-height: 1.75; }
.legal-doc ul { padding-left: 20px; }
.legal-doc a { text-decoration: underline; text-underline-offset: 3px; }
.legal-doc code { background: var(--hover); padding: 2px 8px; border-radius: 6px; font-size: 12.5px; }
.legal-doc .tag { margin-bottom: 4px; }
.legal-doc .callout { background: var(--hover); border-radius: var(--radius-md); padding: 14px 16px; margin: 20px 0; }
.legal-doc .en { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }

/* ---------- Responsivo ---------- */
@media (max-width: 860px) {
  .topbar-inner { padding: 0 16px; gap: 12px; height: 56px; }
  .topnav { display: none; position: absolute; top: 56px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 2px; padding: 10px 12px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .topnav.open { display: flex; }
  .topnav .nav-link { height: 40px; padding: 0 14px; border-radius: 10px; font-size: 14px; }
  .menu-toggle { display: inline-flex; margin-left: auto; }
  .brand { order: 0; }
  .topbar-actions { margin-left: 0; }
  .account-chip .acc-name { display: none; }
  .account-chip { padding: 0 8px 0 4px; }
  main.page { padding: 28px 16px 72px; }
  .page-header { margin-bottom: 24px; }
  .page-header h1 { font-size: 27px; }
  .stats-row, .stats-row.cols-3 { grid-template-columns: 1fr 1fr; }
  .stat-card { border-bottom: 1px solid var(--line); padding: 18px 18px; }
  .stat-card:nth-child(2n) { border-right: none; }
  .stat-card:nth-last-child(-n+2) { border-bottom: none; }
  .stats-row.cols-3 .stat-card:nth-last-child(2) { border-bottom: 1px solid var(--line); }
  .stat-card .value { font-size: 32px; }
  .two-col, .split-2-1 { grid-template-columns: 1fr; }
  .card { padding: 20px 18px; }
  .post-grid.strip { grid-template-columns: repeat(3, 1fr); }
  .automation-row { flex-wrap: wrap; gap: 12px 14px; }
  .automation-row-main { flex-basis: calc(100% - 70px); }
  .login-split { grid-template-columns: 1fr; }
  .login-art { padding: 24px 20px 32px; min-height: 0; gap: 28px; }
  .login-demo { display: none; }
  .login-art-foot { display: none; }
  .login-headline { font-size: 30px; }
  .login-panel { padding: 32px 20px 48px; align-items: flex-start; }
  .field-row { flex-wrap: wrap; }
  .legal-doc h1 { font-size: 30px; }
}
