/* Painel do robô — tokens */
:root {
  --side: #16191d;
  --side-2: #22272d;
  --side-3: #2c3239;
  --side-ink: #a7aeb8;

  --paper: #ffffff;
  --ink: #13161a;
  --ink-2: #3c434d;
  --muted: #6c737e;
  --faint: #9aa1ab;
  --line: #e9ebef;
  --line-2: #dcdfe5;
  --tint: #f6f7f9;

  --accent: #0f9468;
  --accent-2: #0b7a55;
  --accent-soft: #e8f6f0;
  --accent-ink: #075c41;

  --violet: #5b53d6;
  --violet-soft: #f1f0fe;
  --violet-ink: #4038b0;

  --red: #d92d20;
  --red-soft: #fef1f0;
  --blue: #2563c9;
  --blue-soft: #eaf1fd;

  --radius: 12px;
  --font: 'Sora', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', Consolas, monospace;

  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
body { margin: 0; display: flex; min-height: 100vh; background: var(--paper); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 26px; letter-spacing: -0.025em; }
h2 { font-size: 17px; letter-spacing: -0.01em; }
h3 { font-size: 14.5px; margin-bottom: 14px; }
h3 small { font-weight: 400; color: var(--muted); margin-left: 6px; font-size: 12.5px; }
button, input, select, textarea { font: inherit; color: inherit; }
strong, b { font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ic { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; background: var(--tint); padding: 1px 6px; border-radius: 5px; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 22px; }
.mt-sm { margin-top: 12px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.hint, .help { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.hint.pad { padding: 0 20px 18px; }
.tip { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.error-text { color: var(--red); font-size: 13px; }
.ok-text { color: var(--accent-2); font-weight: 600; margin: 12px 0 0; }
.failure { color: var(--red); font-size: 12.5px; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); margin: 0; }
.empty.light { color: #667781; }
.empty-big { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 56px 24px; }
.empty-big .ic { width: 30px; height: 30px; color: var(--faint); stroke-width: 1.4; }
.empty-big p { margin: 0; max-width: 300px; }

/* ---------- Barra lateral ---------- */
.side {
  width: 244px; flex-shrink: 0; background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; padding: 22px 14px 18px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 26px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(150deg, #e2e5ea 0%, #a9b0ba 55%, #7e8692 100%);
  color: var(--side); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
}
.brand-mark .ic { width: 21px; height: 21px; stroke-width: 2; }
.brand-title { color: #fff; font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 11px; text-align: left; width: 100%;
  background: none; border: 0; color: var(--side-ink); padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 13.5px;
  transition: background 0.15s, color 0.15s;
}
.nav button span:first-of-type { flex: 1; }
.nav button:hover { background: var(--side-2); color: #fff; }
.nav button.on { background: var(--side-3); color: #fff; }
.nav button.on .ic { color: #3fd39f; }
.count { background: var(--red); color: #fff; font-size: 11px; font-weight: 600; border-radius: 10px; padding: 1px 7px; line-height: 1.5; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.bot-switch {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--side-3); background: var(--side-2);
  color: #fff; border-radius: 11px; padding: 11px 12px; cursor: pointer; font-weight: 500; font-size: 13.5px; text-align: left;
}
.bot-switch .dot { width: 9px; height: 9px; border-radius: 50%; background: #6b7280; }
.bot-switch.is-on .dot { background: #3fd39f; box-shadow: 0 0 0 4px rgba(63, 211, 159, 0.16); }
.bot-switch.is-off .dot { background: #f04438; box-shadow: 0 0 0 4px rgba(240, 68, 56, 0.16); }
.mini-track { width: 30px; height: 18px; border-radius: 9px; background: #3c434d; position: relative; transition: background 0.2s; }
.mini-track span { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.bot-switch.is-on .mini-track { background: var(--accent); }
.bot-switch.is-on .mini-track span { transform: translateX(12px); }
.logout { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--side-ink); padding: 8px 12px; cursor: pointer; font-size: 13px; border-radius: 9px; }
.logout:hover { color: #fff; background: var(--side-2); }
.logout .ic { width: 16px; height: 16px; }

/* ---------- Conteúdo ---------- */
.main { flex: 1; min-width: 0; padding: 34px 40px 64px; max-width: 1280px; }
.page-head { margin-bottom: 26px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.row-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.card.flush { padding: 0; overflow: hidden; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); border-radius: 10px;
  padding: 9px 15px; font-weight: 500; font-size: 13.5px; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn .ic { width: 16px; height: 16px; }
.btn:hover { border-color: #c5cad2; background: var(--tint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn.small { padding: 6px 12px; font-size: 12.5px; }
.btn.full { width: 100%; }
.btn:disabled, button:disabled { opacity: 0.45; cursor: not-allowed; }
.link-btn { background: none; border: 0; color: var(--accent-2); cursor: pointer; padding: 0; font-weight: 500; font-size: 13px; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer; transition: background 0.15s, color 0.15s;
}
.icon-btn:hover:not(:disabled) { background: var(--tint); color: var(--ink); border-color: var(--line); }
.icon-btn.danger:hover:not(:disabled) { color: var(--red); background: var(--red-soft); border-color: transparent; }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm .ic { width: 15px; height: 15px; }
.icon-btn:disabled { opacity: 0.3; }

/* Etiquetas */
.pill { display: inline-block; font-size: 11.5px; font-weight: 500; border-radius: 20px; padding: 2px 10px; white-space: nowrap; }
.pill.green { background: var(--accent-soft); color: var(--accent-ink); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.violet { background: var(--violet-soft); color: var(--violet-ink); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.gray { background: var(--tint); color: var(--ink-2); border: 1px solid var(--line); }
.tag { display: inline-flex; align-items: center; font-size: 11.5px; color: var(--ink-2); background: var(--tint); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; }
.tag.violet { background: var(--violet-soft); color: var(--violet-ink); border-color: #e0ddfc; }
.tag.dark { background: var(--side); color: #fff; border-color: var(--side); }

/* Campos */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .label { font-weight: 500; font-size: 13px; color: var(--ink); }
.field small { font-weight: 400; color: var(--muted); }
.field > span small { margin-left: 4px; }
input, select, textarea { border-radius: 10px; }
.field input, .field textarea, .field select, .inline-form input, .save-as input, .say-file select, .say-file input {
  border: 1px solid var(--line-2); padding: 10px 12px; background: var(--paper); width: 100%; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.radio input, input[type='checkbox'] { accent-color: var(--accent); }

/* Interruptor (liga/desliga) */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-2); flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 38px; height: 22px; border-radius: 11px; background: #cfd4db; position: relative; transition: background 0.2s; flex-shrink: 0; }
.switch-track span { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track span { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle-row { display: flex; gap: 14px; align-items: flex-start; cursor: pointer; padding: 14px 0 0; }
.toggle-row strong { display: block; font-size: 13.5px; }
.toggle-row small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }

/* ---------- Início ---------- */
.todo-card { border: 1px solid #e0ddfc; background: var(--violet-soft); border-radius: 14px; padding: 20px 22px; }
.todo-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.todo-head .ic { color: var(--violet); width: 20px; height: 20px; margin-top: 1px; }
.todo-head h3 { margin: 0; color: var(--violet-ink); }
.todo-head p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.todo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.todo li { display: flex; align-items: center; gap: 12px; background: var(--paper); border-radius: 10px; padding: 10px 10px 10px 14px; font-size: 13.5px; }
.todo-dot { width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--violet); flex-shrink: 0; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.stat-num { font-size: 32px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 12.5px; }
button.stat { cursor: pointer; font: inherit; color: inherit; }
button.stat:hover { border-color: var(--line-2); }
.stat-alert.hot { border-color: #f7c8c3; background: var(--red-soft); }
.stat-alert.hot .stat-num { color: var(--red); }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 36px; gap: 12px; align-items: center; font-size: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: var(--tint); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 6px; }
.bar-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.status-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 13.5px; }
.status-list .pill { min-width: 76px; text-align: center; margin-right: 10px; }
.events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; max-height: 260px; overflow: auto; }
.events li { display: flex; gap: 10px; padding-left: 10px; border-left: 2px solid var(--line-2); }
.events li.alerta { border-color: var(--violet); }
.events li.erro { border-color: var(--red); }
.ev-time { color: var(--faint); white-space: nowrap; }

/* ---------- Conversas ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button, .days button {
  border: 1px solid var(--line-2); background: var(--paper); border-radius: 20px; padding: 6px 13px; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--ink-2);
}
.chips button:hover, .days button:hover { border-color: #c5cad2; }
.chips button.on, .days button.on { background: var(--side); border-color: var(--side); color: #fff; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 12px; min-width: 280px; background: var(--paper); color: var(--faint); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: 0; padding: 9px 0; width: 100%; background: none; color: var(--ink); }
.search input:focus { box-shadow: none; }
.convo { display: grid; grid-template-columns: 350px 1fr; gap: 18px; align-items: start; }
.convo-list, .convo-list.card.flush { max-height: calc(100vh - 220px); overflow-y: auto; }
.convo-more { padding: 14px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
.chat-empty { margin: auto; max-width: 340px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5; padding: 24px 12px; }
.convo-item { display: flex; gap: 12px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: var(--paper); padding: 14px 16px; cursor: pointer; }
.convo-item:last-child { border-bottom: 0; }
.convo-item:hover { background: var(--tint); }
.convo-item.on { background: var(--accent-soft); }
.avatar-sm { width: 36px; height: 36px; border-radius: 50%; background: var(--tint); border: 1px solid var(--line); color: var(--ink-2); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex-shrink: 0; text-transform: uppercase; }
.convo-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.convo-top { display: flex; justify-content: space-between; gap: 8px; }
.convo-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.convo-mid { display: flex; gap: 8px; align-items: center; margin: 5px 0; min-width: 0; }
.convo-mid .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-last { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail { display: flex; flex-direction: column; }
.detail-head { display: flex; gap: 12px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.detail-title { flex: 1; min-width: 0; }
.back { display: none; }
.detail-info { padding: 14px 20px; display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.info-line .muted { display: inline-block; min-width: 110px; }
.answers { margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.answers div { background: var(--tint); border-radius: 10px; padding: 9px 12px; }
.answers dt { font-size: 11.5px; color: var(--muted); }
.answers dd { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 16px 20px 0; border-top: 1px solid var(--line); }

/* Bolhas de mensagem (estilo WhatsApp) */
.chat { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; background: #efeae2; min-height: 220px; max-height: calc(100vh - 400px); overflow: auto; }
.msg { max-width: 80%; padding: 7px 10px 5px; border-radius: 10px; background: #fff; box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13); font-size: 13.5px; align-self: flex-start; word-break: break-word; }
.msg.bot, .msg.humano, .msg.mine { align-self: flex-end; background: #d9fdd3; }
.msg.humano { background: #dbe9ff; }
.phone .msg.bot { align-self: flex-start; background: #fff; }
.msg.sistema { align-self: center; background: #fff; color: var(--ink-2); font-size: 12px; max-width: 92%; white-space: pre-wrap; display: flex; gap: 6px; align-items: flex-start; border-radius: 8px; }
.note-ic { width: 14px; height: 14px; margin-top: 1px; color: var(--accent); }
.msg.ph { background: #fff; border: 1.5px dashed #9fd6a8; box-shadow: none; color: #4b6b53; font-style: italic; }
.msg-who { font-size: 11.5px; font-weight: 600; color: var(--accent-2); margin-bottom: 2px; }
.msg.humano .msg-who { color: var(--blue); }
.msg.in .msg-who { color: #9a4f2a; }
.msg-file { font-weight: 500; margin-bottom: 3px; }
.msg-file a { text-decoration: none; display: inline-flex; gap: 5px; align-items: center; }
.msg-file .ic { width: 14px; height: 14px; }
.msg-doc { display: flex; align-items: center; gap: 8px; background: rgba(0, 0, 0, 0.04); border-radius: 7px; padding: 8px 10px; margin-bottom: 4px; font-weight: 500; font-size: 12.5px; color: var(--ink); text-decoration: none; }
.msg-doc .ic { color: var(--red); width: 20px; height: 20px; }
.msg-doc.missing { color: var(--violet-ink); background: var(--violet-soft); }
.msg-doc.missing .ic { color: var(--violet); }
.msg-error { color: var(--red); font-size: 11.5px; margin-top: 3px; }
.msg-time { font-size: 10.5px; color: #667781; text-align: right; margin-top: 2px; }

/* ---------- Roteiros: lista ---------- */
.how-strip { list-style: none; margin: 0 0 26px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.how-strip li { display: flex; gap: 12px; padding: 16px 18px; align-items: flex-start; }
.how-strip li + li { border-left: 1px solid var(--line); }
.how-num { width: 26px; height: 26px; border-radius: 50%; background: var(--side); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.how-strip strong { display: block; font-size: 13.5px; }
.how-strip span:not(.how-num) { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.flow-tabs { margin-bottom: 8px; }
.flow-tabs button { padding: 8px 14px; font-size: 13px; }
.chip-count { display: inline-block; min-width: 20px; margin-left: 6px; padding: 0 6px; border-radius: 10px; background: var(--tint); color: var(--ink-2); font-size: 11.5px; }
.flow-tabs button.on .chip-count { background: rgba(255, 255, 255, 0.18); color: #fff; }
.tab-hint { margin: 0 0 14px; }
.flow-cards { display: flex; flex-direction: column; gap: 10px; }
.flow-card { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); transition: border-color 0.15s, box-shadow 0.15s; }
.flow-card:hover { border-color: var(--line-2); box-shadow: 0 4px 14px -8px rgba(16, 24, 40, 0.18); }
.flow-card.off { opacity: 0.6; }
.flow-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 16px; text-align: left; border: 0; background: none; padding: 16px 18px; cursor: pointer; }
.flow-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; background: var(--accent-soft); color: var(--accent-2); }
.flow-icon.list { background: var(--side); color: #fff; }
.flow-icon.headset, .flow-icon.reply { background: var(--blue-soft); color: var(--blue); }
.tag.blue { background: var(--blue-soft); color: var(--blue); border-color: #d6e4fb; }
.extra-cond { margin-top: 14px; border: 1px dashed var(--line-2); border-radius: 12px; padding: 10px 14px; }
.extra-cond[open] { padding-bottom: 14px; }
.extra-cond summary { cursor: pointer; font-weight: 500; font-size: 13px; }
.extra-cond summary small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.extra-cond .desc { margin-top: 8px; }
.kw.alt { background: var(--blue-soft); color: var(--blue); }
.flow-icon .ic { width: 20px; height: 20px; }
.flow-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.flow-text strong { font-size: 14.5px; }
.flow-sum { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.flow-edit { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-2); font-weight: 500; font-size: 13px; white-space: nowrap; }
.flow-edit .ic { width: 16px; height: 16px; }
.flow-order { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 8px 10px; border-left: 1px solid var(--line); }

/* ---------- Roteiros: editor ---------- */
.editor { position: relative; }
.back-link { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 0; font-size: 13px; font-weight: 500; margin-bottom: 14px; }
.back-link:hover { color: var(--ink); }
.back-link .ic { width: 16px; height: 16px; }
.editor-title { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.title-input { flex: 1; min-width: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.025em; border: 1px solid transparent; border-radius: 10px; padding: 4px 10px; margin-left: -11px; background: transparent; }
.title-input:hover { border-color: var(--line); }
.title-input:focus { border-color: var(--accent); }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
.editor-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.block { border: 1px solid var(--line); border-radius: 14px; padding: 22px; background: var(--paper); }
.block-head { margin-bottom: 16px; }
.block-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.block-body { display: flex; flex-direction: column; gap: 4px; }
.desc { color: var(--muted); font-size: 12.5px; margin: 2px 0 10px; }
.field-group { display: flex; flex-direction: column; }

.chips-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--line-2); border-radius: 10px; padding: 7px; cursor: text; transition: border-color 0.15s, box-shadow 0.15s; }
.chips-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chips-input input { flex: 1; min-width: 180px; border: 0; padding: 4px 6px; background: none; }
.chips-input input:focus { box-shadow: none; }
.kw { display: inline-flex; align-items: center; gap: 2px; background: var(--accent-soft); color: var(--accent-ink); border-radius: 7px; padding: 3px 4px 3px 10px; font-size: 13px; font-weight: 500; }
.kw button { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 5px; background: none; color: inherit; cursor: pointer; opacity: 0.6; }
.kw button:hover { opacity: 1; background: rgba(7, 92, 65, 0.1); }
.kw .ic { width: 13px; height: 13px; stroke-width: 2.2; }

.menu-number { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 0 2px; margin-top: 12px; border-top: 1px solid var(--line); }
.menu-number .desc { margin-bottom: 0; }
.num-input { width: 64px; height: 48px; text-align: center; font-size: 20px; font-weight: 600; border: 1px solid var(--line-2); flex-shrink: 0; }
.block-body .toggle-row { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 16px; }
.menu-map { display: flex; flex-direction: column; gap: 6px; background: var(--tint); border-radius: 12px; padding: 14px 16px; }
.menu-map .label { margin-bottom: 4px; }
.menu-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.menu-num { width: 24px; height: 24px; border-radius: 7px; background: var(--side); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; }

/* Linha do tempo dos passos */
.timeline { display: flex; flex-direction: column; }
.tl-step { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 14px; position: relative; padding-bottom: 18px; }
.tl-rail { position: relative; display: flex; justify-content: center; }
.tl-rail::after { content: ''; position: absolute; left: 50%; transform: translateX(-50%); top: 46px; bottom: -14px; width: 2px; background: #cfd4db; border-radius: 2px; }
.tl-step:last-child .tl-rail::after { display: none; }
.tl-dot { width: 30px; height: 30px; border-radius: 50%; background: var(--side); color: #fff; display: grid; place-items: center; font-size: 12.5px; font-weight: 600; position: relative; z-index: 1; margin-top: 12px; }
.tl-dot.plus { background: var(--paper); color: var(--accent-2); border: 2px dashed #b9e2d1; margin-top: 4px; }
.tl-dot.plus .ic { width: 15px; height: 15px; stroke-width: 2.2; }
.tl-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px 18px; background: var(--paper); min-width: 0; }
.tl-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tl-head h3 { margin: 0; }
.tl-tools { display: flex; gap: 2px; }
.sub-label { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 6px 0 10px; }
.sub-label .ic { width: 15px; height: 15px; }
.says { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.say { display: flex; gap: 6px; align-items: flex-start; }
.say > .say-text, .say > .say-file { flex: 1; min-width: 0; }
.say-tools { display: flex; flex-direction: column; gap: 1px; padding-top: 4px; }
.say-text { border: 1px solid var(--line-2); border-radius: 4px 14px 14px 14px; background: var(--paper); overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s; }
.say-text:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.say-text textarea { display: block; width: 100%; border: 0; padding: 12px 14px 8px; resize: none; min-height: 56px; background: none; overflow: hidden; }
.say-text textarea:focus { box-shadow: none; }
.say-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 6px 8px; border-top: 1px solid var(--line); background: var(--tint); }
.fmt { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 7px; background: none; color: var(--ink-2); cursor: pointer; }
.fmt:hover { background: var(--paper); box-shadow: 0 0 0 1px var(--line-2); }
.fmt .ic { width: 15px; height: 15px; stroke-width: 2.2; }
.bar-sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 6px; }
.bar-label { font-size: 11.5px; color: var(--muted); margin-right: 2px; }
.var { border: 1px solid var(--line-2); background: var(--paper); border-radius: 6px; padding: 2px 8px; font-size: 11.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.var:hover { border-color: var(--accent); color: var(--accent-2); }
.say-file { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line-2); border-radius: 4px 14px 14px 14px; padding: 12px; background: var(--paper); }
.say-file.missing { border-color: #cfcaf9; background: var(--violet-soft); }
.say-file.missing select { border-color: #c9c3f7; }
.file-badge { width: 36px; height: 36px; border-radius: 9px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; flex-shrink: 0; }
.say-file.missing .file-badge { background: var(--paper); color: var(--violet); }
.say-file-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.upload-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-2); font-size: 12.5px; font-weight: 500; cursor: pointer; align-self: flex-start; }
.upload-inline .ic { width: 15px; height: 15px; }
.add-says { display: flex; gap: 8px; flex-wrap: wrap; }
.add-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px dashed var(--line-2); background: none; border-radius: 9px; padding: 7px 12px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.add-btn:hover { border-color: var(--accent); color: var(--accent-2); background: var(--accent-soft); }
.add-btn .ic { width: 15px; height: 15px; }
.then-options { display: flex; flex-direction: column; gap: 6px; }
.then-opt { display: flex; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line-2); background: var(--paper); border-radius: 10px; padding: 9px 12px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.then-opt .ic { color: var(--faint); width: 17px; height: 17px; }
.then-text { flex: 1; min-width: 0; font-size: 13px; }
.then-opt small { color: var(--muted); font-size: 12px; }
.then-opt small::before { content: '· '; }
.radio-dot { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #c5cad2; flex-shrink: 0; position: relative; background: var(--paper); }
.then-opt:hover { border-color: #c5cad2; }
.then-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.then-opt.on .ic { color: var(--accent-2); }
.then-opt.on .radio-dot { border-color: var(--accent); }
.then-opt.on .radio-dot::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); }
.legend { margin: 10px 0 0 !important; font-size: 12px !important; color: var(--muted); }
.save-as { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font-size: 13px; font-weight: 500; }
.save-as select, .save-as textarea { border: 1px solid var(--line-2); padding: 10px 12px; background: var(--paper); width: 100%; border-radius: 10px; font-weight: 400; }
.save-as .help { font-weight: 400; margin-top: 0; }
.step-extra { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; }
.help.no-top { margin-top: -6px; }
.field .inline-num { width: 64px !important; padding: 3px 6px !important; display: inline-block; margin: 0 4px; font-size: 12.5px; }
.tl-add { padding-bottom: 0; align-items: center; }
.add-step { justify-self: start; border: 1px dashed #b9e2d1; background: var(--paper); color: var(--accent-2); border-radius: 10px; padding: 8px 14px; font-weight: 500; font-size: 13px; cursor: pointer; }
.add-step:hover { background: var(--accent-soft); }

.advanced summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.advanced[open] summary { margin-bottom: 4px; }
.advanced .toggle-row { border-top: 0; margin-top: 4px; }
.advanced .btn { align-self: flex-start; margin-top: 16px; }

/* Prévia */
.editor-preview { position: sticky; top: 24px; }
.preview-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.editor-preview .phone { height: min(640px, calc(100vh - 150px)); }

/* Barra de salvar */
.savebar {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  margin-top: 22px; padding: 14px 0 14px; background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
}
.save-state { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.save-state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.save-state.dirty { color: var(--violet-ink); font-weight: 500; }
.save-state.dirty .dot { background: var(--violet); box-shadow: 0 0 0 4px var(--violet-soft); }

/* ---------- Follow-up ---------- */
.fu-status { display: flex; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; margin-bottom: 18px; flex-wrap: wrap; }
.fu-status-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--tint); color: var(--muted); flex-shrink: 0; }
.fu-status.active .fu-status-icon { background: var(--accent-soft); color: var(--accent-2); }
.fu-status.paused { border-color: #e0ddfc; background: var(--violet-soft); }
.fu-status.paused .fu-status-icon { background: var(--paper); color: var(--violet); }
.fu-status-text { color: var(--muted); }
.fu-status.paused .fu-status-text { color: var(--violet-ink); }
.fu-meter { display: flex; flex-direction: column; gap: 5px; min-width: 130px; }
.fu-meter-bar { height: 6px; border-radius: 4px; background: var(--tint); overflow: hidden; border: 1px solid var(--line); }
.fu-meter-bar span { display: block; height: 100%; background: var(--accent); }
.fu-settings { margin-bottom: 18px; }
.range-pair { display: flex; align-items: center; gap: 8px; }
.range-pair input { width: 90px !important; }
.fu-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-select { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.inline-select select, .mini-select { border: 1px solid var(--line-2); border-radius: 9px; padding: 7px 10px; background: var(--paper); font-size: 13px; color: var(--ink); }
.fu-filters .search { min-width: 200px; }
.fu-list { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.fu-head { padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--tint); }
.fu-head .check { font-size: 13px; font-weight: 500; }
.fu-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.fu-row:last-child { border-bottom: 0; }
.fu-row.on { background: var(--accent-soft); }
.fu-row.queued { opacity: 0.7; }
.fu-pick input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.fu-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fu-info strong { font-size: 13.5px; }
.fu-actions { display: flex; align-items: center; gap: 4px; }
.ic.tiny { width: 12px; height: 12px; }
.fu-compose { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.variant-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 10px 14px 0; }
.say-text.previewing { border-color: #b9e2d1; }
.fu-preview { position: sticky; top: 24px; }
.phone.phone-small { height: 330px; }
.fu-send { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; border-color: #b9e2d1; background: var(--accent-soft); margin: 18px 0; }
.fu-send h2 { margin-bottom: 4px; }
.fu-send p { margin: 0; font-size: 13px; }
.fu-campaigns { display: flex; flex-direction: column; gap: 10px; }
.fu-campaign { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.fu-camp-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fu-camp-actions { display: flex; align-items: center; gap: 4px; }
.progress { height: 6px; border-radius: 4px; background: var(--tint); overflow: hidden; margin: 12px 0 8px; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }
.fu-counts { display: flex; gap: 14px; flex-wrap: wrap; }
.fu-items { margin-top: 12px; border-top: 1px solid var(--line); }
.fu-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fu-item:last-child { border-bottom: 0; }
.fu-item .muted.small { white-space: pre-wrap; }

/* ---------- Catálogos ---------- */
.file-row { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.file-row a { text-decoration: none; color: var(--ink); }
.file-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; flex-shrink: 0; }
.file-icon.img { background: var(--blue-soft); color: var(--blue); }

/* ---------- Simulador ---------- */
.sim { display: grid; grid-template-columns: 330px minmax(0, 420px); gap: 28px; align-items: start; }
.sim-setup { display: flex; flex-direction: column; gap: 14px; }
.sim-setup h3 { margin: 0; }
.suggestions { display: flex; flex-direction: column; gap: 6px; }
.suggestions button { text-align: left; border: 1px solid var(--line-2); background: var(--paper); border-radius: 9px; padding: 8px 11px; cursor: pointer; font-size: 12.5px; }
.suggestions button:hover:not(:disabled) { border-color: var(--accent); }
.phone { border-radius: 28px; border: 8px solid #1b1f24; overflow: hidden; background: #efeae2; box-shadow: 0 24px 48px -24px rgba(16, 24, 40, 0.4); display: flex; flex-direction: column; height: min(720px, calc(100vh - 170px)); }
.phone-head { display: flex; gap: 10px; align-items: center; background: #075e54; color: #fff; padding: 12px 14px; font-size: 13.5px; }
.phone-head .small { opacity: 0.8; font-size: 11.5px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(150deg, #e2e5ea, #8d95a0); color: var(--side); display: grid; place-items: center; flex-shrink: 0; }
.avatar .ic { width: 19px; height: 19px; stroke-width: 2; }
.phone-chat { flex: 1; max-height: none; padding: 14px 12px; }
.phone-input { display: flex; gap: 8px; padding: 8px; background: #f0f2f5; }
.phone-input input { flex: 1; border: 0; border-radius: 20px; padding: 10px 14px; background: #fff; }
.send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center; }
.send .ic { width: 17px; height: 17px; }

/* ---------- Conexão ---------- */
.step-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--side); color: #fff; font-size: 12px; margin-right: 8px; vertical-align: 1px; }
.connected { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.big-ok { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.big-ok .ic { width: 22px; height: 22px; stroke-width: 2.6; }
.qr-area { display: grid; grid-template-columns: 280px 1fr; gap: 28px; align-items: start; }
.qr-box { width: 280px; height: 280px; border: 1px solid var(--line); border-radius: 14px; display: grid; place-items: center; padding: 12px; text-align: center; background: #fff; }
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.qr-steps ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.alt { margin-top: 18px; }
.alt summary { cursor: pointer; font-weight: 500; color: var(--accent-2); }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.code-box { margin-top: 12px; }
.code { font-family: var(--mono); font-size: 28px; font-weight: 700; letter-spacing: 0.15em; background: var(--side); color: #fff; border-radius: 12px; padding: 12px 18px; display: inline-block; }

/* ---------- Configurações ---------- */
.radio { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio input { margin-top: 3px; width: 16px; height: 16px; }
.radio small { display: block; color: var(--muted); font-size: 12.5px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Aviso flutuante ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--side); color: #fff;
  padding: 12px 18px; border-radius: 11px; font-weight: 500; font-size: 13.5px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25); z-index: 50; max-width: calc(100vw - 32px);
}
.toast.error { background: var(--red); }

/* ---------- Telas menores ---------- */
@media (max-width: 1180px) {
  .fu-compose { grid-template-columns: 1fr; }
  .fu-preview { position: static; max-width: 360px; }
  .editor-grid { grid-template-columns: 1fr; }
  .editor-preview { position: static; }
  .editor-preview .phone { height: 520px; max-width: 420px; }
}

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .grid-2, .sim, .qr-area { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; padding: 14px 12px 10px; }
  .brand { padding: 0 4px 12px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 6px; }
  .nav button { width: auto; white-space: nowrap; gap: 8px; }
  .side-foot { flex-direction: row; align-items: center; margin-top: 8px; }
  .bot-switch { flex: 1; }
  .main { padding: 22px 16px 60px; }
  h1 { font-size: 22px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .convo { grid-template-columns: 1fr; }
  .convo.has-current .convo-list { display: none; }
  .convo:not(.has-current) .convo-detail { display: none; }
  .back { display: inline-grid; }
  .detail-head { flex-wrap: wrap; }
  .search { min-width: 0; width: 100%; }
  .how-strip { grid-template-columns: 1fr; }
  .how-strip li + li { border-left: 0; border-top: 1px solid var(--line); }
  .flow-edit { display: none; }
  .flow-sum { white-space: normal; }
  .editor-title { flex-direction: column; align-items: stretch; gap: 10px; }
  .title-input { font-size: 21px; }
  .block { padding: 16px; }
  .tl-step { grid-template-columns: 26px minmax(0, 1fr); gap: 10px; }
  .tl-dot { width: 26px; height: 26px; font-size: 11.5px; }
  .tl-card { padding: 14px; }
  .step-extra { grid-template-columns: 1fr; gap: 0; }
  .then-opt small { display: block; }
  .then-opt small::before { content: ''; }
  .say { flex-direction: column; align-items: stretch; }
  .say-file select, .say-file input { min-width: 0; }
  .say-tools { flex-direction: row; align-self: flex-end; padding-top: 0; }
  .menu-number { flex-direction: column; align-items: flex-start; }
  .qr-box { width: 100%; max-width: 280px; height: auto; aspect-ratio: 1; }
  .bar-row { grid-template-columns: 110px 1fr 30px; }
  .inline-form { flex-direction: column; }
  .fu-row { flex-wrap: wrap; }
  .fu-actions { width: 100%; justify-content: flex-end; }
  .fu-filters, .fu-filters .search { width: 100%; }
  .fu-send .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
