/* ==========================================================================
   SOLUS CRM — identidade visual oficial (manual SOLUS)
   Petróleo #102A30 · Sol #E3A12A · Névoa #E8EEEF · Noite #0C1F24 · Cacto #2F6B5C · Poeira #51666B
   Proporção: muito Petróleo e Névoa, quase nada de Sol.
   Títulos: Bricolage Grotesque 800/600 (sem caixa alta forçada) · Interface: Manrope 400/600
   ========================================================================== */

:root {
  /* Marca */
  --petroleo: #102A30;
  --sol: #E3A12A;
  --nevoa: #E8EEEF;
  --noite: #0C1F24;
  --cacto: #2F6B5C;
  --poeira: #51666B;

  /* Interface — claro (tokens do manual) */
  --bg: #E8EEEF;
  --surface: #F6F9F9;
  --surface-2: #EEF3F4;
  --field: #FFFFFF;
  --ink: #102A30;
  --ink-2: #2E464C;
  --muted: #51666B;
  --line: #C7D4D6;
  --line-soft: #DAE3E4;
  --tint: #DCE6E8;          /* Petróleo translúcido: robô, seleção */
  --tint-2: #EAF0F1;

  --rail: #102A30;
  --rail-ink: #E6EEEF;
  --rail-muted: #9CB0B4;
  --rail-hover: rgba(230, 238, 239, .06);
  --rail-active: rgba(230, 238, 239, .10);

  --primary: #102A30;
  --primary-hover: #1D3D45;
  --on-primary: #F2F6F6;

  --accent: #E3A12A;        /* Sol: destaque raro */
  --on-accent: #102A30;
  --accent-soft: #F6E8CB;
  --accent-ink: #7A5210;    /* texto Sol legível sobre claro */

  --positive: #2F6B5C;      /* Cacto: resultados */
  --positive-soft: #DCEAE5;
  --danger: #B3403A;        /* fora da paleta: só erros/faltas/excluir */
  --danger-soft: #F5E0DD;

  /* Dados (validado: scripts/validate_palette.js) */
  --series: #23875f;
  --series-2: #E3A12A;
  --st-good: #23875f;
  --st-critical: #B3403A;
  --st-serious: #E3A12A;
  --st-neutral: #9CB0B4;
  --grid: #DAE3E4;

  --f-display: "Bricolage Grotesque", "Manrope", system-ui, sans-serif;
  --f-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(16, 42, 48, .05), 0 10px 28px -18px rgba(16, 42, 48, .22);
  --shadow-pop: 0 24px 60px -24px rgba(12, 31, 36, .45);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

/* Interface — escuro (tokens do manual: Noite) */
:root[data-theme="dark"] {
  --bg: #0C1F24;
  --surface: #12292F;
  --surface-2: #163138;
  --field: #0F252A;
  --ink: #E6EEEF;
  --ink-2: #C3D1D4;
  --muted: #9CB0B4;
  --line: #244148;
  --line-soft: #1B363C;
  --tint: #1B3A42;
  --tint-2: #15323A;
  --rail: #081619;
  --primary: #E6EEEF;
  --primary-hover: #FFFFFF;
  --on-primary: #102A30;
  --accent-soft: rgba(227, 161, 42, .16);
  --accent-ink: #EDC06A;
  --positive: #6DB89E;
  --positive-soft: rgba(47, 107, 92, .32);
  --danger: #E47D74;
  --danger-soft: rgba(179, 64, 58, .22);
  --series: #2e9e70;
  --series-2: #b07a1c;
  --st-good: #2e9e70;
  --st-critical: #E47D74;
  --st-serious: #b07a1c;
  --st-neutral: #51666B;
  --grid: #1F3B41;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 12px 32px -20px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1F24; --surface: #12292F; --surface-2: #163138; --field: #0F252A;
    --ink: #E6EEEF; --ink-2: #C3D1D4; --muted: #9CB0B4; --line: #244148; --line-soft: #1B363C;
    --tint: #1B3A42; --tint-2: #15323A; --rail: #081619;
    --primary: #E6EEEF; --primary-hover: #FFFFFF; --on-primary: #102A30;
    --accent-soft: rgba(227, 161, 42, .16); --accent-ink: #EDC06A;
    --positive: #6DB89E; --positive-soft: rgba(47, 107, 92, .32);
    --danger: #E47D74; --danger-soft: rgba(179, 64, 58, .22);
    --series: #2e9e70; --series-2: #b07a1c; --st-good: #2e9e70; --st-critical: #E47D74;
    --st-serious: #b07a1c; --st-neutral: #51666B; --grid: #1F3B41;
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 12px 32px -20px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01";
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--on-accent); }

.display { font-family: var(--f-display); font-weight: 800; letter-spacing: -.025em; line-height: 1.05; }
.eyebrow { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono, .num { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.mono { font-size: 12.5px; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .88em; background: var(--tint-2); padding: 1px 5px; border-radius: 4px; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 999px;
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .18s var(--ease), border-color .18s, color .18s, transform .12s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--surface); border-color: var(--muted); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  transition: background .18s, border-color .18s;
}
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--tint-2); border-color: var(--muted); }
.link-btn { background: none; border: 0; padding: 0; color: var(--ink); font-weight: 600; font-size: 13px; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.link-btn:hover { text-decoration-color: var(--accent); }

/* ---------- campos ---------- */
.field { display: grid; gap: 7px; margin-bottom: 16px; position: relative; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field textarea, .field select,
.login-form input, .tag-form input, .test-row input, #appt-time {
  width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--field); transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus,
.login-form input:focus, .tag-form input:focus, .test-row input:focus, #appt-time:focus,
.record-form textarea:focus, .note-form textarea:focus, .composer textarea:focus,
.inbox-tools input:focus, .funnel-tools input:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--tint);
}
.field textarea { resize: vertical; line-height: 1.55; }
.field textarea[name="system_prompt"] { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.counter { justify-self: end; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.suffix-input { position: relative; }
.suffix-input em { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 13px; }
.form-msg { margin: 0 auto 0 0; font-size: 13.5px; }
.form-msg.is-error { color: var(--danger); }
.form-msg.is-ok { color: var(--positive); }
.field-error { margin: 0; color: var(--danger); font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin: 10px 0 4px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--petroleo); }
.stage-select, .tag-filter, .note-form select, .inline-select {
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--field);
  padding: 5px 8px; font-size: 13px; color: var(--ink);
}
.stage-select { max-width: 160px; }

/* ---------- logotipo (arquivos oficiais, sem alterações) ---------- */
.logo { display: block; height: auto; }
.logo-on-dark { display: none; }
:root[data-theme="dark"] .logo-on-light { display: none; }
:root[data-theme="dark"] .logo-on-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-on-light { display: none; }
  :root:not([data-theme="light"]) .logo-on-dark { display: block; }
}

/* ==========================================================================
   Login
   ========================================================================== */
.login-body {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr);
  min-height: 100%; background: var(--bg);
}
.login-brand {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: clamp(28px, 5vw, 64px); color: #E6EEEF;
  /* Padrão de órbitas do manual como fundo: "cover" garante que as bordas do desenho
     fiquem sempre fora do painel (sem círculos cortados por linhas retas). O degradê
     acalma as órbitas atrás do título. */
  background:
    linear-gradient(100deg, var(--noite) 0%, rgba(12, 31, 36, .92) 38%, rgba(12, 31, 36, .35) 72%, rgba(12, 31, 36, 0) 100%),
    url("brand/padrao-orbitas.svg") 65% 55% / cover no-repeat,
    var(--noite);
}
.login-brand .logo { width: 188px; position: relative; }
.login-brand h1 {
  position: relative; margin: 0; max-width: 15ch;
  font-family: var(--f-display); font-weight: 800; font-size: clamp(34px, 4.2vw, 56px); line-height: 1.02; letter-spacing: -.03em;
}
.login-brand p { position: relative; margin: 14px 0 0; max-width: 38ch; color: #9CB0B4; font-size: 15.5px; }
.login-brand .foot { position: relative; font-size: 12.5px; color: #9CB0B4; }
.login-main { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 380px; animation: rise .5s var(--ease) both; }
.login-card .logo { width: 150px; margin-bottom: 36px; }
.login-card .logo-mobile { display: none; }
.login-title { font-family: var(--f-display); font-weight: 800; font-size: 32px; line-height: 1.08; margin: 0 0 8px; letter-spacing: -.025em; }
.login-sub { margin: 0 0 28px; color: var(--muted); }
.login-form { display: grid; gap: 8px; }
.login-form label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.login-form input { height: 46px; }
.login-form label + input { margin-bottom: 8px; }
.login-form .btn { margin-top: 10px; height: 46px; }
.login-foot { margin: 24px 0 0; font-size: 12.5px; color: var(--muted); }
.alert { padding: 12px 14px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--ink); font-size: 13.5px; margin-bottom: 18px; }

/* ==========================================================================
   Estrutura
   ========================================================================== */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); height: 100vh; height: 100dvh; }

.rail {
  display: flex; flex-direction: column; gap: 2px;
  padding: 22px 12px 18px; background: var(--rail); color: var(--rail-ink);
}
.rail-brand { padding: 2px 10px 26px; }
.rail-brand .logo { width: 128px; }
.rail-brand small { display: block; margin-top: 10px; color: var(--rail-muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rail-link {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--rail-muted); text-decoration: none; font-weight: 600; font-size: 14px;
  transition: background .18s var(--ease), color .18s;
}
.rail-link svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.rail-link:hover { background: var(--rail-hover); color: var(--rail-ink); }
.rail-link.is-active { background: var(--rail-active); color: #FFFFFF; }
.rail-link.is-active::before {  /* o único ponto de Sol no menu */
  content: ""; position: absolute; left: -12px; top: 50%; width: 4px; height: 18px; margin-top: -9px;
  border-radius: 0 4px 4px 0; background: var(--sol);
}
.rail-link-admin { margin-top: 10px; }
.rail-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--sol); color: var(--petroleo); font-size: 11px; font-weight: 600;
  display: grid; place-items: center; font-variant-numeric: tabular-nums;
}
.rail-foot { margin-top: auto; display: grid; gap: 10px; padding: 14px 10px 0; border-top: 1px solid rgba(230, 238, 239, .08); }
.conn { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--rail-muted); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rail-muted); flex: none; }
.conn.is-ok .conn-dot { background: #5FB394; box-shadow: 0 0 0 3px rgba(95, 179, 148, .18); }
.conn.is-bad .conn-dot { background: #E47D74; box-shadow: 0 0 0 3px rgba(228, 125, 116, .18); }
.rail-user { font-size: 12.5px; color: var(--rail-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rail-logout { background: none; border: 0; padding: 0; color: var(--rail-muted); font-size: 13px; font-weight: 600; }
.rail-logout:hover { color: var(--rail-ink); }
.theme-toggle {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(230, 238, 239, .14);
  background: transparent; color: var(--rail-muted); display: grid; place-items: center;
}
.theme-toggle:hover { color: var(--rail-ink); border-color: rgba(230, 238, 239, .3); }
.theme-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.stage { min-width: 0; min-height: 0; overflow: hidden; }
.view { height: 100%; animation: fade .3s var(--ease) both; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head .display { margin: 4px 0 0; font-size: clamp(28px, 3.2vw, 40px); }
.view-agenda, .view-agent, .view-admin, .view-campaigns, .view-dashboard { overflow-y: auto; padding: 32px clamp(16px, 3vw, 44px) 44px; }

/* ==========================================================================
   Conversas
   ========================================================================== */
.view-inbox { display: grid; grid-template-columns: 344px minmax(0, 1fr) auto; min-height: 0; }

.inbox { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface); }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 22px 18px 12px; }
.pane-head .display { margin: 0; font-size: 26px; }
.count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.inbox-tools { padding: 0 14px 12px; display: grid; gap: 10px; border-bottom: 1px solid var(--line-soft); }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; min-width: 0; }
.inbox-tools input, .funnel-tools input {
  height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--field);
}
.tag-filter { height: 40px; max-width: 120px; border-radius: 999px; padding: 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  flex: none; height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  transition: background .15s, border-color .15s;
}
.chip:hover { border-color: var(--muted); }
.chip.is-on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip-count { margin-left: 4px; font-weight: 600; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chip-count:empty { display: none; }

.chat-list { list-style: none; margin: 0; padding: 6px 8px 16px; overflow-y: auto; flex: 1; }
.chat-item {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 3px 12px;
  padding: 12px 10px; border-radius: var(--r); cursor: pointer;
  transition: background .15s;
  animation: rise .35s var(--ease) both;
}
.settled .chat-item { animation: none; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.is-open { background: var(--tint); }
.chat-item .avatar { grid-row: span 3; }
.ci-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-time { font-size: 11.5px; color: var(--muted); align-self: center; font-variant-numeric: tabular-nums; }
.ci-last { grid-column: 2 / 4; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-last .who { color: var(--muted); }
.ci-notes {
  grid-column: 2 / 4; font-size: 12.5px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ci-tags { grid-column: 2 / 4; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 5px; }
.chat-item.is-unread .ci-name { font-weight: 800; }
.chat-item.is-unread .ci-time { color: var(--ink); font-weight: 600; }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--sol); margin-left: 6px; vertical-align: middle; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 9px; border-radius: 999px; white-space: nowrap;
  font-size: 11.5px; font-weight: 600;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-bot { background: var(--tint); color: var(--ink); }
.tag-human { background: var(--accent-soft); color: var(--accent-ink); }
.tag-wait { background: var(--sol); color: var(--petroleo); }
.tag-wait::before { background: var(--petroleo); animation: pulse 1.6s infinite; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--f-display); font-weight: 600; font-size: 14.5px; letter-spacing: -.01em;
  color: var(--ink); background: var(--tint);
  flex: none;
}
.avatar.is-human { background: var(--accent-soft); color: var(--accent-ink); }
.list-empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }

.ci-owner, .card-owner { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-2); }
.ci-owner::before, .card-owner::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--positive); }
.ci-owner.is-pending, .card-owner.is-pending { color: var(--accent-ink); }
.ci-owner.is-pending::before, .card-owner.is-pending::before { background: var(--sol); }
.ci-owner.is-none, .card-owner.is-none { color: var(--muted); }
.ci-owner.is-none::before, .card-owner.is-none::before { background: var(--line); }

/* ---------- conversa ---------- */
.chat { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.chat-inner { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.empty-state { margin: auto; text-align: center; padding: 24px; max-width: 360px; }
.empty-state .logo { width: 64px; margin: 0 auto 18px; }
.empty-state .display { font-size: 24px; margin: 0 0 6px; }

.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; min-height: 68px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.chat-id { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.chat-id strong { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-id .mono { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.back-btn, .dossier-toggle, .dossier-close, .modal-close {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: transparent; flex: none; color: var(--ink);
}
.back-btn { display: none; }
.dossier-toggle { display: none; font-weight: 800; font-family: var(--f-display); }
.dossier-close { display: none; }

/* handoff: o controle mais importante da tela */
.handoff {
  display: inline-flex; align-items: center; gap: 10px; flex: none; white-space: nowrap;
  height: 40px; padding: 0 16px 0 5px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13.5px;
  transition: background .2s var(--ease), border-color .2s;
}
.handoff .h-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; }
.handoff[data-mode="bot"] .h-icon { background: var(--sol); color: var(--petroleo); }
.handoff[data-mode="bot"]:hover { border-color: var(--sol); background: var(--accent-soft); }
.handoff[data-mode="human"] .h-icon { background: var(--primary); color: var(--on-primary); }
.handoff[data-mode="human"]:hover { border-color: var(--ink); background: var(--tint-2); }
.handoff:disabled { opacity: .6; cursor: wait; }

.mode-banner { display: block; padding: 9px 20px; font-size: 13px; border-bottom: 1px solid var(--line-soft); }
.mode-banner.is-bot { background: var(--tint-2); color: var(--ink-2); }
.mode-banner.is-human { background: var(--accent-soft); color: var(--ink); }
.mode-banner.is-off { background: var(--surface-2); color: var(--ink-2); }
.mode-banner strong { font-weight: 600; }

.messages {
  flex: 1; overflow-y: auto; padding: 24px clamp(16px, 4vw, 52px);
  display: flex; flex-direction: column; gap: 4px; background: var(--bg);
}
.day-sep {
  align-self: center; margin: 14px 0 8px; padding: 3px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-soft);
  font-size: 11.5px; font-weight: 600; color: var(--muted);
}
.msg {
  position: relative; max-width: min(560px, 76%); padding: 9px 13px 7px; border-radius: 16px;
  white-space: pre-wrap; word-wrap: break-word; font-size: 14.5px; line-height: 1.5;
  animation: pop .25s var(--ease) both;
}
.msg-in { align-self: flex-start; background: var(--surface); border: 1px solid var(--line-soft); border-bottom-left-radius: 5px; }
.msg-out { align-self: flex-end; border-bottom-right-radius: 5px; }
.msg-bot { background: var(--tint); }
.msg-human { background: var(--accent-soft); }
.msg-campaign { background: var(--surface-2); border: 1px dashed var(--line); }
.msg-meta { display: flex; justify-content: flex-end; gap: 8px; margin-top: 3px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.msg-meta .by { font-weight: 600; color: var(--ink-2); }
.msg-human .by { color: var(--accent-ink); }
.msg.pending { opacity: .55; }
.msg.failed { outline: 1px solid var(--danger); }

.composer {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 12px 20px 4px; background: var(--surface); border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1; resize: none; max-height: 160px; min-height: 44px;
  padding: 11px 16px; border-radius: 22px; border: 1px solid var(--line); background: var(--field); line-height: 1.4;
}
.composer .btn { height: 44px; }
.composer-hint { margin: 0; padding: 4px 22px 12px; font-size: 11.5px; background: var(--surface); }

/* ---------- ficha lateral ---------- */
.dossier {
  width: 312px; border-left: 1px solid var(--line); background: var(--surface);
  overflow-y: auto; padding-bottom: 24px;
}
.dossier.is-wide { width: 384px; }
.dossier-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.dtab { border: 0; background: none; padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--muted); }
.dtab.is-on { background: var(--primary); color: var(--on-primary); }
.dossier-block { padding: 0 20px 20px; }
.block-head { display: flex; align-items: center; justify-content: space-between; }
.ai-notes { margin: 0 16px 20px; padding: 16px; border-radius: var(--r); background: var(--tint-2); border: 1px solid var(--line-soft); }
.ai-notes .eyebrow { color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.ai-notes .eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sol); }  /* centro do símbolo */
.notes-text { margin: 8px 0 0; font-size: 14px; line-height: 1.55; color: var(--ink); }
.facts { margin: 0 20px 20px; display: grid; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--r-sm); overflow: hidden; }
.facts div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.facts .facts-note { display: block; padding: 8px 12px; }
.facts .facts-note:empty { display: none; }
.card-moved, .stage-author { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.card-moved.is-ai, .stage-author.is-ai { color: var(--ink-2); }
.card-moved b, .stage-author b { font-weight: 600; }

/* ficha do veículo */
.record-lgpd { margin: 0 16px 14px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 12px; color: var(--ink-2); }
.record-form { padding: 0 16px 8px; display: grid; gap: 10px; }
.record-form label { display: grid; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.record-form textarea, .note-form textarea {
  width: 100%; resize: vertical; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--field); font-size: 13.5px; line-height: 1.45; font-weight: 400; color: var(--ink);
}
.record-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.record-actions small { color: var(--muted); font-size: 11.5px; }
.record-actions .btn { height: 34px; padding: 0 14px; font-size: 13px; }
.note-form { display: grid; gap: 8px; margin: 10px 0 16px; }
.note-form select { justify-self: start; }
.note-form .btn { height: 36px; justify-self: end; font-size: 13px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line-soft); display: grid; gap: 16px; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink); }
.note-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: 11.5px; color: var(--muted); }
.note-kind { font-weight: 600; color: var(--ink); font-size: 12px; }
.note-body { margin: 3px 0 0; font-size: 13.5px; white-space: pre-wrap; }
.note-del { margin-left: auto; border: 0; background: none; color: var(--muted); font-size: 11.5px; text-decoration: underline; cursor: pointer; }

/* histórico de vistorias */
.appt-history { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.appt-item { padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-soft); display: grid; gap: 5px; font-size: 13px; }
.appt-item.is-past { background: var(--surface-2); }
.appt-when { font-weight: 600; font-variant-numeric: tabular-nums; }
.appt-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.appt-status { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); }
.appt-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--st-neutral); }
.appt-status.s-confirmed::before, .appt-status.s-attended::before { background: var(--st-good); }
.appt-status.s-no_show::before { background: var(--st-critical); }
.appt-status.s-canceled::before { background: var(--st-serious); }
.confirm-flag { font-size: 12px; color: var(--ink-2); }
.confirm-flag.is-wait { color: var(--accent-ink); font-weight: 600; }
.appt-item .stage-select { max-width: none; font-size: 12px; padding: 3px 6px; margin-left: auto; }
.appt-empty { font-size: 12.5px; color: var(--muted); }

/* ==========================================================================
   Agenda
   ========================================================================== */
.week-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.week-nav .btn { height: 36px; padding: 0 14px; }
.week-label { margin: 0 8px; font-family: var(--f-display); font-weight: 600; font-size: 17px; }
.agenda-notice { padding: 16px 18px; border-radius: var(--r); background: var(--accent-soft); margin-bottom: 20px; }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day {
  min-height: 220px; padding: 12px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line-soft);
  animation: rise .4s var(--ease) both;
}
.day.is-today { border-color: var(--ink); box-shadow: inset 0 3px 0 var(--sol); }
.day.is-closed { background: repeating-linear-gradient(-45deg, transparent 0 8px, var(--line-soft) 8px 9px), var(--surface-2); }
.day-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.day-name { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.day-num { font-family: var(--f-display); font-size: 26px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.day-empty { font-size: 12.5px; color: var(--muted); }
.day-add {
  width: 24px; height: 24px; margin-left: auto; margin-right: 8px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  font-size: 15px; line-height: 1; display: grid; place-items: center;
  opacity: 0; transition: opacity .15s, background .15s;
}
.day:hover .day-add, .day-add:focus-visible { opacity: 1; }
.day-add:hover { background: var(--tint-2); }
@media (pointer: coarse) { .day-add { opacity: 1; } }
.appt {
  display: block; width: 100%; text-align: left; margin-bottom: 8px; padding: 9px 10px; border-radius: var(--r-sm);
  background: var(--tint-2); border: 0; border-left: 3px solid var(--ink);
  color: inherit; font-size: 13px; line-height: 1.35;
  transition: transform .15s var(--ease), background .15s;
}
.appt:hover { transform: translateY(-1px); background: var(--tint); }
.appt-time { font-size: 12px; color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.appt-title { display: block; font-weight: 600; margin-top: 2px; }
.appt-who { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.appt.is-linked { cursor: pointer; }
.appt.st-canceled { opacity: .55; text-decoration: line-through; }
.appt-confirm { display: block; margin-top: 4px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.appt-confirm.is-ok { color: var(--positive); }
.appt-confirm.is-wait { color: var(--accent-ink); }
.appt-confirm.is-bad { color: var(--danger); }

/* ==========================================================================
   Agente (configurações)
   ========================================================================== */
.settings { max-width: 860px; display: grid; gap: 16px; }
.card { padding: 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-soft); box-shadow: var(--shadow); }
.card h2 { margin: 0 0 16px; font-family: var(--f-display); font-weight: 600; font-size: 20px; letter-spacing: -.015em; }
.master-switch { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.master-switch h2 { margin-bottom: 4px; }
.master-switch p { margin: 0; font-size: 14px; }
.days { display: flex; flex-wrap: wrap; gap: 8px; }
.day-toggle { position: relative; }
.day-toggle input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.day-toggle span {
  display: grid; place-items: center; width: 54px; height: 44px; border-radius: var(--r-sm);
  border: 1px solid var(--line); font-weight: 600; font-size: 13.5px; transition: all .15s;
}
.day-toggle input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.day-toggle input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.switch { position: relative; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; z-index: 1; }
.switch-track { display: block; width: 52px; height: 30px; border-radius: 999px; background: var(--line); transition: background .2s; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(12, 31, 36, .25); transition: transform .22s var(--ease); }
.switch input:checked + .switch-track { background: var(--cacto); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(22px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--ink); outline-offset: 2px; }
.settings-actions {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: flex-end; gap: 16px;
  padding: 14px 0; background: linear-gradient(transparent, var(--bg) 35%);
}

/* ==========================================================================
   Funil (Kanban)
   ========================================================================== */
.view-funnel { display: flex; flex-direction: column; min-height: 0; padding: 32px clamp(16px, 3vw, 44px) 0; }
.view-funnel .page-head { margin-bottom: 8px; }
.funnel-tools input { width: min(300px, 100%); }
.funnel-hint { margin: 0 0 16px; }
.board { flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 20px; }
.col {
  display: flex; flex-direction: column; min-height: 0; border-radius: var(--r-lg);
  background: var(--surface-2); border: 1px solid var(--line-soft);
  transition: background .15s, border-color .15s; animation: rise .4s var(--ease) both;
}
.col.is-over { background: var(--tint); border-color: var(--ink); border-style: dashed; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; }
.col-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.col-title { font-weight: 600; font-size: 14px; }
.col-count { margin-left: auto; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-body { flex: 1; overflow-y: auto; padding: 0 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.col-empty { margin: 6px 4px; padding: 18px 10px; border: 1px dashed var(--line); border-radius: var(--r-sm); text-align: center; font-size: 12.5px; color: var(--muted); }
.col[data-stage="lead"] .col-dot { background: var(--poeira); }
.col[data-stage="cotacao"] .col-dot { background: var(--sol); }
.col[data-stage="vistoria"] .col-dot { background: var(--ink); }
.col[data-stage="ativo"] .col-dot { background: var(--positive); }
.col[data-stage="perdido"] .col-dot { background: var(--danger); }
.col[data-stage="perdido"] .card { opacity: .78; }
.col .card {
  display: grid; gap: 6px; padding: 12px; border-radius: var(--r); cursor: grab; box-shadow: none;
  transition: transform .15s var(--ease), box-shadow .15s, border-color .15s;
}
.col .card:hover { transform: translateY(-1px); border-color: var(--line); box-shadow: var(--shadow); }
.card.is-dragging { opacity: .4; }
.card-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card .avatar { width: 32px; height: 32px; font-size: 12.5px; }
.card-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-phone { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-notes { margin: 0; font-size: 12.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.card-foot .since { margin-left: auto; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.card .stage-select { display: none; margin-top: 2px; max-width: none; width: 100%; }
@media (pointer: coarse) { .card .stage-select { display: block; } .col .card { cursor: pointer; } }

/* ==========================================================================
   Modais
   ========================================================================== */
.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-pop);
}
.modal[open] { animation: rise .28s var(--ease) both; }
.modal::backdrop { background: rgba(12, 31, 36, .55); backdrop-filter: blur(3px); }
.modal-body { padding: 26px; display: grid; gap: 2px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.modal-head .display { margin: 4px 0 0; font-size: 26px; }
.modal-close { font-size: 18px; }
.modal-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.modal-foot .form-msg { flex: 1 1 100%; }
.modal-foot .btn-ghost { margin-left: auto; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.slot {
  height: 36px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--field);
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; transition: all .12s;
}
.slot:hover { border-color: var(--ink); }
.slot.is-on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.slots.is-disabled { opacity: .4; pointer-events: none; }
#appt-time { margin-top: 6px; width: 140px; }
.notify-text { width: 100%; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-soft); background: var(--tint-2); font-size: 13.5px; resize: vertical; }

/* ==========================================================================
   Configurações (área restrita)
   ========================================================================== */
.eyebrow.restricted { color: var(--accent-ink); display: inline-flex; align-items: center; gap: 6px; }
.admin-lock { min-height: 100%; display: grid; place-items: center; padding: 24px 0; }
.lock-card {
  width: min(420px, 100%); padding: 36px 32px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: rise .4s var(--ease) both; position: relative; overflow: hidden;
}
.lock-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--sol); }
.lock-card .display { margin: 4px 0 6px; font-size: 32px; }
.lock-card > .muted { margin: 0 0 22px; font-size: 14px; }
.lock-card .btn { width: 100%; height: 46px; margin-top: 6px; }
.lock-badge { width: 52px; height: 52px; border-radius: 50%; margin-bottom: 22px; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); }
.lock-badge svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.admin-session { display: flex; align-items: center; gap: 12px; }
.bootstrap-note { margin-bottom: 18px; padding: 14px 16px; border-radius: var(--r); background: var(--accent-soft); font-size: 14px; }
.admin-sections { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.section-card {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  padding: 16px; border-radius: var(--r); border: 1px solid var(--line-soft); background: var(--surface);
  color: inherit; text-decoration: none; transition: border-color .15s, background .15s;
}
.section-card .section-icon { grid-row: span 2; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); color: var(--ink); }
.section-card .section-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.section-card strong { font-size: 15px; font-weight: 600; }
.section-card small { color: var(--muted); font-size: 12.5px; }
.section-card:hover:not(.is-soon) { border-color: var(--muted); }
.section-card.is-on { border-color: var(--ink); background: var(--tint-2); }
.section-card.is-on .section-icon { background: var(--primary); color: var(--on-primary); }
.section-card.is-soon { opacity: .5; cursor: default; }
.admin-panel { padding: 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-soft); box-shadow: var(--shadow); animation: fade .3s var(--ease) both; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { margin: 0 0 4px; font-family: var(--f-display); font-size: 22px; font-weight: 600; letter-spacing: -.015em; }
.panel-head p { margin: 0; max-width: 580px; }

.team-table, .tag-table, .recipients { display: grid; border: 1px solid var(--line-soft); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.team-row {
  display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.4fr) 128px 110px 70px 150px;
  align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-soft); font-size: 14px;
}
.team-row:first-child { border-top: 0; }
.team-row.is-head, .recipient.is-head { background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); }
.team-row.is-inactive { opacity: .55; }
.team-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.team-who .avatar { width: 34px; height: 34px; font-size: 12.5px; }
.team-who div { min-width: 0; }
.team-who strong, .team-who small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-who strong { font-weight: 600; }
.team-who small { color: var(--muted); font-size: 12px; }
.team-you { margin-left: 6px; font-size: 11.5px; font-weight: 600; color: var(--accent-ink); }
.role-badge { display: inline-flex; height: 24px; align-items: center; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; justify-self: start; }
.role-vendedor { background: var(--positive-soft); color: var(--positive); }
.role-suporte { background: var(--tint); color: var(--ink); }
.role-admin { background: var(--primary); color: var(--on-primary); }
.status-toggle { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; padding: 4px 0; font-size: 13px; font-weight: 600; justify-self: start; }
.status-toggle::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.status-toggle.is-on::before { background: var(--positive); }
.status-toggle:hover { text-decoration: underline; text-underline-offset: 3px; }
.team-leads { font-size: 13px; font-variant-numeric: tabular-nums; }
.team-actions { display: flex; gap: 6px; justify-content: flex-end; }
.team-actions button { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-size: 12.5px; font-weight: 600; }
.team-actions button:hover { background: var(--surface-2); }
.team-actions .danger { color: var(--danger); }
.team-empty { padding: 32px 16px; text-align: center; color: var(--muted); }

.dist-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dist-stat { padding: 16px; border-radius: var(--r); background: var(--surface-2); }
.dist-stat .eyebrow { margin-bottom: 6px; }
.dist-stat .big { font-family: var(--f-display); font-size: 30px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.dist-stat .big.next { font-size: 22px; font-weight: 600; }
.dist-mode { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.dist-mode::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--positive); animation: pulse 2s infinite; }
.dist-queue { grid-column: 1 / -1; padding: 16px; border-radius: var(--r); border: 1px solid var(--line-soft); }
.queue { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.queue-item { padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-weight: 600; font-size: 13.5px; }
.queue-item.is-next { background: var(--primary); color: var(--on-primary); box-shadow: 0 0 0 3px var(--sol); }
.queue-arrow { color: var(--muted); }
.dist-pending { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--accent-soft); flex-wrap: wrap; }

/* ==========================================================================
   Tags
   ========================================================================== */
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--tag-bg); color: var(--tag-fg);
}
.tag-chip.sm { height: 19px; padding: 0 8px; font-size: 11px; }
.tag-chip .x { border: 0; background: none; color: inherit; opacity: .7; padding: 0 0 0 2px; font-size: 14px; line-height: 1; cursor: pointer; }
.tag-chip .x:hover { opacity: 1; }
.tag-more { font-size: 11px; color: var(--muted); font-weight: 600; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag-list .empty { font-size: 12.5px; color: var(--muted); }
.tag-picker { position: relative; }
.tag-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 232px; max-height: 280px; overflow-y: auto;
  padding: 6px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop);
  animation: rise .18s var(--ease) both;
}
.tag-menu label { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--r-sm); font-size: 13.5px; cursor: pointer; }
.tag-menu label:hover { background: var(--surface-2); }
.tag-menu input { accent-color: var(--petroleo); }
.tag-menu .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.tag-menu .hint { padding: 8px; font-size: 12.5px; color: var(--muted); }
.tag-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 6px; }
.tag-form input { flex: 1 1 200px; height: 42px; width: auto; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(16, 42, 48, .12); }
.swatch.is-on { border-color: var(--ink); transform: scale(1.1); }
.swatch-custom { position: relative; width: 26px; height: 26px; border-radius: 50%; overflow: hidden; background: conic-gradient(#102A30, #2F6B5C, #E3A12A, #B3403A, #3D5A9E, #102A30); }
.swatch-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tag-table { margin-top: 10px; }
.tag-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line-soft); }
.tag-row:first-child { border-top: 0; }
.tag-row .count { margin-left: auto; font-size: 12.5px; color: var(--muted); }

/* ==========================================================================
   Campanhas
   ========================================================================== */
.campaign-list { display: grid; gap: 12px; max-width: 1000px; }
.campaign-card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 20px; align-items: center;
  padding: 18px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-soft);
  box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s; animation: rise .35s var(--ease) both;
}
.campaign-card:hover { border-color: var(--muted); }
.campaign-card h3 { margin: 0; font-size: 16px; font-weight: 600; }
.campaign-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.campaign-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.campaign-actions .btn { height: 34px; padding: 0 14px; font-size: 13px; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-running { background: var(--positive-soft); color: var(--positive); }
.st-running::before { animation: pulse 1.4s infinite; }
.st-paused { background: var(--accent-soft); color: var(--accent-ink); }
.st-completed { background: var(--tint); color: var(--ink); }
.st-draft { background: var(--surface-2); color: var(--ink-2); }
.st-canceled { background: var(--danger-soft); color: var(--danger); }
.progress { grid-column: 1 / -1; display: grid; gap: 6px; }
.progress-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; display: flex; gap: 2px; }
.progress-bar .sent { background: var(--series); transition: width .4s var(--ease); }
.progress-bar .failed { background: var(--danger); }
.progress-text { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.progress-text b { font-variant-numeric: tabular-nums; font-weight: 600; }
.status-note { grid-column: 1 / -1; margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--ink); font-size: 13px; }
.empty-campaigns { max-width: 520px; padding: 40px 24px; text-align: center; margin: 40px auto; }
.empty-campaigns .display { font-size: 26px; margin: 0 0 8px; }

.campaign-editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.editor-main { display: grid; gap: 16px; }
.editor-side { position: sticky; top: 0; display: grid; gap: 14px; }
.field .inline-select, .inline-select { display: inline-block; width: auto; margin: 0 4px; padding: 2px 6px; font-size: 12.5px; }
.pick-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--field); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.pick .dot { width: 9px; height: 9px; border-radius: 50%; }
.pick.is-on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.pick.is-exclude.is-on { background: var(--danger); border-color: var(--danger); color: #FFFFFF; }
.audience-box { margin-top: 6px; padding: 14px 16px; border-radius: var(--r); background: var(--tint-2); border: 1px solid var(--line-soft); font-size: 14px; }
.audience-box strong { font-family: var(--f-display); font-weight: 800; font-size: 24px; margin-right: 6px; letter-spacing: -.02em; }
.audience-box.is-empty { background: var(--accent-soft); border-color: transparent; }
.audience-sample { display: block; margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.phone-preview { padding: 16px; border-radius: 28px; background: var(--noite); }
.phone-preview .eyebrow { color: #9CB0B4; margin-bottom: 10px; }
.preview-screen { min-height: 180px; padding: 16px 12px; border-radius: 18px; background: #E8EEEF; }
.preview-bubble {
  margin-left: auto; max-width: 92%; padding: 9px 12px 8px; border-radius: 14px 14px 4px 14px; background: #D9FDD3; color: #102A30;
  font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word;
}
.preview-bubble:empty::before { content: "A mensagem aparece aqui."; color: #51666B; }
.test-card { padding: 16px; }
.test-row { display: flex; gap: 8px; margin-top: 8px; }
.test-row input { flex: 1; min-width: 0; height: 38px; width: auto; }
.test-row .btn { height: 38px; padding: 0 14px; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.campaign-detail { max-width: 1000px; display: grid; gap: 16px; }
.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.detail-head h2 { margin: 0; font-family: var(--f-display); font-weight: 800; font-size: 28px; letter-spacing: -.02em; }
.detail-message { padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); white-space: pre-wrap; font-size: 14px; }
.recipient { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 110px minmax(0, 1.4fr); gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.recipient:first-child { border-top: 0; }
.r-status { font-size: 12.5px; font-weight: 600; }
.r-sent { color: var(--positive); } .r-failed { color: var(--danger); } .r-pending, .r-sending { color: var(--ink-2); } .r-skipped { color: var(--muted); }
.r-error { color: var(--muted); font-size: 12px; }

/* ==========================================================================
   Visão geral (Dashboard)
   ========================================================================== */
.segmented { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-soft); }
.segmented button { border: 0; background: none; height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.segmented button.is-on { background: var(--primary); color: var(--on-primary); }
.dash-alert { margin-bottom: 16px; padding: 12px 16px; border-radius: var(--r); background: var(--accent-soft); font-size: 14px; }
.dash-alert a { color: var(--ink); font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; transition: opacity .2s; }
.is-loading .kpis, .is-loading .dash-grid { opacity: .5; }
.kpi { padding: 18px 18px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-soft); box-shadow: var(--shadow); animation: rise .35s var(--ease) both; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.kpi-value { margin: 8px 0 4px; font-family: var(--f-body); font-size: 42px; font-weight: 600; letter-spacing: -.035em; line-height: 1; }
.kpi-value small { font-size: 18px; font-weight: 600; letter-spacing: 0; color: var(--muted); margin-left: 2px; }
.kpi-sub { font-size: 12.5px; color: var(--muted); }
.kpi-meter { height: 6px; margin-top: 14px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.kpi-meter span { display: block; height: 100%; border-radius: 999px; background: var(--series); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; transition: opacity .2s; }
.chart-card { padding: 18px 18px 14px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-soft); box-shadow: var(--shadow); min-width: 0; }
.chart-card.span-2 { grid-column: span 2; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.chart-head h2 { margin: 0; font-family: var(--f-display); font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.chart-head .sub { font-size: 12.5px; color: var(--muted); }
.table-toggle { border: 0; background: none; padding: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-svg text { font-family: var(--f-body); font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart-svg .val { fill: var(--ink); font-weight: 600; }
.chart-svg .hit { fill: transparent; cursor: default; }
.chart-svg .bar { fill: var(--series); transition: opacity .15s; }
.chart-svg g.col:hover .bar, .chart-svg g.col:focus .bar { opacity: .75; }
.chart-svg line { stroke: var(--grid); }
.chart-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.chart-table th, .chart-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.chart-table td.num, .chart-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.split { display: flex; gap: 2px; height: 28px; border-radius: 6px; overflow: hidden; margin-top: 6px; }
.split > div { min-width: 2px; transition: width .4s var(--ease); }
.split-labels { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.split-labels b { font-size: 22px; font-weight: 600; margin-right: 4px; color: var(--ink); letter-spacing: -.02em; }
.chart-empty { padding: 26px 0; text-align: center; font-size: 13px; color: var(--muted); }
.chart-tip { position: fixed; z-index: 60; pointer-events: none; padding: 7px 10px; border-radius: var(--r-sm); background: var(--noite); color: #E6EEEF; font-size: 12.5px; line-height: 1.35; box-shadow: var(--shadow-pop); }
.chart-tip b { font-weight: 600; }
.dash-foot { margin: 16px 0 0; max-width: 820px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 999px;
  background: var(--noite); color: #E6EEEF; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-pop);
  animation: rise .28s var(--ease) both;
}
.toast.is-error { background: var(--danger); color: #FFFFFF; }

/* ---------- movimento ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* ==========================================================================
   Responsivo
   ========================================================================== */
@media (max-width: 1240px) {
  .dossier { position: fixed; top: 0; right: 0; bottom: 0; z-index: 30; width: min(340px, 92vw); box-shadow: var(--shadow-pop); animation: slide .3s var(--ease) both; }
  .dossier.is-wide { width: min(384px, 92vw); }
  .dossier-close, .dossier-toggle { display: grid; place-items: center; }
}
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1000px) {
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  .day-head { justify-content: flex-start; gap: 10px; }
  .campaign-editor { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .admin-sections { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .team-row { grid-template-columns: minmax(0, 1fr) auto; }
  .team-row.is-head { display: none; }
  .team-row > :nth-child(2), .team-row > .team-leads { display: none; }
  .team-row .role-badge, .team-row .status-toggle { justify-self: end; }
  .team-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .dist-grid { grid-template-columns: 1fr; }
  .login-body { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-card .logo-mobile.logo-on-light { display: block; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .rail {
    order: 2; flex-direction: row; justify-content: space-around; align-items: center; gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); overflow-x: auto;
  }
  .rail-brand, .rail-foot { display: none; }
  .rail { justify-content: flex-start; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .rail::-webkit-scrollbar { display: none; }
  .rail-link { flex-direction: column; gap: 3px; padding: 6px 2px; font-size: 10.5px; flex: 0 0 20%; min-width: 0; scroll-snap-align: start; }
  .rail-link span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rail-link.is-active::before { left: 50%; top: auto; bottom: -6px; width: 18px; height: 3px; margin: 0 0 0 -9px; border-radius: 3px 3px 0 0; }
  .rail-link-admin { margin-top: 0; }
  .rail-badge { position: absolute; top: 0; right: 2px; margin: 0; }
  .view-inbox { grid-template-columns: minmax(0, 1fr); }
  .chat-head { padding: 10px 12px; gap: 10px; }
  .chat-head .avatar { display: none; }
  .view-inbox .chat { display: none; }
  .view-inbox.has-chat .inbox { display: none; }
  .view-inbox.has-chat .chat { display: flex; }
  .back-btn { display: grid; place-items: center; }
  .handoff { padding: 0 12px 0 5px; font-size: 12.5px; }
  .handoff .h-label-long { display: none; }
  .msg { max-width: 88%; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .board { grid-auto-columns: 82%; scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .view-funnel { padding-top: 20px; }
  .master-switch { align-items: flex-start; }
  .card { padding: 18px; }
  .view-agenda, .view-agent, .view-admin, .view-campaigns, .view-dashboard { padding: 22px 16px 32px; }
}
@media (max-width: 700px) {
  .kpis, .dash-grid { grid-template-columns: 1fr; }
  .chart-card.span-2 { grid-column: auto; }
  .kpi-value { font-size: 36px; }
  .recipient { grid-template-columns: minmax(0, 1fr) auto; }
  .recipient > :nth-child(2), .recipient > :nth-child(4), .recipient.is-head { display: none; }
  .campaign-card { grid-template-columns: 1fr; }
  .admin-sections { grid-template-columns: 1fr; }
  .search-row .tag-filter { max-width: 96px; }
  .campaign-actions { justify-content: flex-start; }
}

/* Tags em cores escuras (ex.: Petróleo) continuam visíveis sobre o fundo Noite */
:root[data-theme="dark"] .tag-chip, :root[data-theme="dark"] .swatch { box-shadow: inset 0 0 0 1px rgba(230, 238, 239, .18); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag-chip, :root:not([data-theme="light"]) .swatch { box-shadow: inset 0 0 0 1px rgba(230, 238, 239, .18); }
}

/* Login no escuro: o formulário se destaca do painel da marca */
:root[data-theme="dark"] .login-main { background: var(--surface); border-left: 1px solid var(--line); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .login-main { background: var(--surface); border-left: 1px solid var(--line); }
}

/* Login no celular: um único logo, conforme o fundo (positivo no claro, negativo no escuro) */
@media (max-width: 900px) {
  :root[data-theme="dark"] .login-card .logo-mobile.logo-on-light { display: none; }
  :root[data-theme="dark"] .login-card .logo-mobile.logo-on-dark { display: block; }
}
@media (max-width: 900px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .login-card .logo-mobile.logo-on-light { display: none; }
  :root:not([data-theme="light"]) .login-card .logo-mobile.logo-on-dark { display: block; }
}

/* No computador o logo fica só no painel da marca; o do formulário é exclusivo do celular */
@media (min-width: 901px) {
  .login-card .logo-mobile { display: none !important; }
}

/* ==========================================================================
   Follow-ups (cadência)
   ========================================================================== */
.view-followups { overflow-y: auto; padding: 32px clamp(16px, 3vw, 44px) 44px; }
.fu-intro { max-width: 760px; margin: -8px 0 22px; }
.fu-master {
  display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line-soft); cursor: pointer;
}
.fu-master > span:first-child { display: grid; }
.fu-master strong { font-size: 14px; font-weight: 600; }
.fu-master small { font-size: 12px; color: var(--muted); }
.fu-master.is-on { border-color: var(--positive); }
.fu-cadence, .fu-history { max-width: 1000px; margin-bottom: 28px; }
.fu-cadence-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.fu-cadence h2, .fu-history h2 { margin: 0 0 12px; font-family: var(--f-display); font-weight: 600; font-size: 20px; letter-spacing: -.015em; }
.fu-cadence-head h2 { margin: 0; }

/* linha do tempo: cada regra é uma parada da órbita */
.fu-timeline { list-style: none; margin: 0; padding: 0 0 0 26px; position: relative; display: grid; gap: 12px; }
.fu-timeline::before { content: ""; position: absolute; left: 9px; top: 10px; bottom: 10px; width: 2px; background: var(--line); }
.fu-rule {
  position: relative; display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-soft);
  box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s; animation: rise .35s var(--ease) both;
}
.fu-rule:hover { border-color: var(--muted); }
.fu-rule::before {
  content: ""; position: absolute; left: -23px; top: 50%; width: 14px; height: 14px; margin-top: -7px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--ink);
}
.fu-rule.is-off { opacity: .55; }
.fu-rule.is-off::before { border-color: var(--line); }
.fu-when { font-family: var(--f-display); font-weight: 800; font-size: 22px; letter-spacing: -.02em; line-height: 1; }
.fu-when small { display: block; margin-top: 4px; font-family: var(--f-body); font-weight: 600; font-size: 11.5px; color: var(--muted); letter-spacing: 0; }
.fu-rule h3 { margin: 0; font-size: 15px; font-weight: 600; }
.fu-rule-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.fu-rule-prompt { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fu-badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--tint); color: var(--ink); }
.fu-badge.is-ai::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--sol); }
.fu-empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r-lg); }

.fu-log-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 96px minmax(0, 2.2fr) 110px; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.fu-log-row:first-child { border-top: 0; }
.fu-log-row.is-head { background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); }
.fu-log-msg { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fu-st-sent { color: var(--positive); font-weight: 600; } .fu-st-failed { color: var(--danger); font-weight: 600; }
.fu-st-skipped, .fu-st-sending { color: var(--muted); font-weight: 600; }

/* editor */
.modal-wide { width: min(760px, calc(100vw - 32px)); }
.fu-delay { display: flex; align-items: center; gap: 8px; }
.fu-delay input { width: 96px !important; }
.fu-delay select { width: auto !important; }
.fu-mode { justify-self: start; }
.fu-textfield textarea { font-size: 13.5px; line-height: 1.55; }
.fu-vars { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.fu-var {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px;
  border: 1px dashed var(--line); background: var(--field); font-size: 12px; font-weight: 600; color: var(--ink);
}
.fu-var code { background: none; padding: 0; font-size: 12px; }
.fu-var small { font-weight: 400; color: var(--muted); }
.fu-var:hover { border-style: solid; border-color: var(--ink); }
.fu-test { padding: 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line-soft); margin-bottom: 8px; }
.fu-test-row { display: flex; gap: 8px; }
.fu-test-row input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--field); }
.fu-preview { margin-top: 12px; display: grid; gap: 10px; }
.fu-preview .preview-screen { min-height: 0; }
.fu-preview dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 12.5px; }
.fu-preview dt { color: var(--muted); font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.fu-preview dd { margin: 0; color: var(--ink-2); }
.fu-preview details { font-size: 12.5px; color: var(--muted); }
.fu-preview details p { white-space: pre-wrap; color: var(--ink-2); margin: 6px 0 0; }
.fu-loading { font-size: 13px; color: var(--muted); }
.modal-foot .fu-delete { color: var(--danger); margin-left: 0; margin-right: auto; }
.modal-foot .fu-delete + .btn-ghost { margin-left: 0; }

@media (max-width: 760px) {
  .fu-rule { grid-template-columns: 1fr; gap: 8px; }
  .fu-log-row { grid-template-columns: minmax(0, 1fr) auto; }
  .fu-log-row > :nth-child(2), .fu-log-row > :nth-child(4), .fu-log-row > :nth-child(5), .fu-log-row.is-head { display: none; }
  .fu-master { width: 100%; }
}

/* ==========================================================================
   Configurações → WhatsApp
   ========================================================================== */
.wa-box { display: grid; gap: 18px; }
.wa-hero { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: var(--r-lg); background: var(--surface-2); }
.wa-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; background: var(--tint); display: grid; place-items: center; }
.wa-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.wa-hero h3 { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: 20px; letter-spacing: -.01em; }
.wa-hero p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.wa-state { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.wa-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.wa-state.is-connected { background: var(--positive-soft); color: var(--positive); }
.wa-state.is-connecting { background: var(--accent-soft); color: var(--accent-ink); }
.wa-state.is-connecting::before { animation: pulse 1.2s infinite; }
.wa-state.is-disconnected, .wa-state.is-unknown { background: var(--danger-soft); color: var(--danger); }
.wa-facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--r); overflow: hidden; }
.wa-facts div { padding: 12px 14px; background: var(--surface); }
.wa-facts dt { font-size: 12px; color: var(--muted); }
.wa-facts dd { margin: 2px 0 0; font-weight: 600; font-size: 14px; }
.wa-connect { display: grid; gap: 14px; padding: 20px; border-radius: var(--r-lg); border: 1px solid var(--line); }
.wa-connect h3 { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: 18px; }
.wa-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.wa-row input { height: 42px; width: min(260px, 100%); padding: 0 13px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--field); }
.wa-pair { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: center; }
.wa-qr { width: 264px; height: 264px; padding: 12px; border-radius: var(--r); background: #FFFFFF; border: 1px solid var(--line); display: grid; place-items: center; }
.wa-qr img { width: 100%; height: 100%; image-rendering: pixelated; }
.wa-code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 38px; font-weight: 600; letter-spacing: .12em;
  padding: 18px 24px; border-radius: var(--r); background: var(--surface-2); border: 1px dashed var(--line); text-align: center;
}
.wa-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; color: var(--ink-2); }
.wa-steps b { color: var(--ink); }
.wa-waiting { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--accent-ink); font-weight: 600; }
.wa-waiting::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sol); animation: pulse 1.2s infinite; }
.wa-ok { padding: 14px 16px; border-radius: var(--r); background: var(--positive-soft); color: var(--ink); font-size: 14px; }
@media (max-width: 760px) {
  .wa-pair { grid-template-columns: 1fr; justify-items: center; }
  .wa-hero { flex-wrap: wrap; }
  .wa-state { margin-left: 0; }
  .wa-code { font-size: 30px; }
}
.wa-danger { padding: 16px 18px; border-radius: var(--r-lg); border: 1px solid var(--danger-soft); }
.wa-danger-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.wa-danger-head strong { font-size: 14.5px; }
.wa-danger-head p { margin: 2px 0 0; }
.wa-danger-btn { color: var(--danger); border-color: var(--danger-soft); }
.wa-danger-btn:hover:not(:disabled) { border-color: var(--danger); background: var(--danger-soft); }
.wa-danger-panel { display: grid; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); font-size: 14px; }
.wa-danger-panel p { margin: 0; }
.wa-danger-label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.wa-danger-label input { height: 42px; width: min(260px, 100%); padding: 0 13px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--field); font-weight: 600; letter-spacing: .06em; }
.wa-danger-confirm { background: var(--danger); color: #FFFFFF; }
.wa-danger-confirm:disabled { opacity: .35; }
