/* Painel LuxLabs · Prospect — ferramenta diária, densa, claro/escuro pelo sistema.
   Mundo: prancha técnica (papel vegetal, cópia heliográfica, letra de normógrafo). O que pede
   decisão humana é marcado a marca-texto; o resto fica quieto, em fios finos.
   Marcas de estado (verdade do produto, não decoração):
     quadrado cheio = feito/ativo · meio quadrado = em andamento/rascunho · contorno = fora de jogo
     triângulo = falha · tracejado = dry-run (simulado) · losango = Claude · círculo = admin.
   Cor com função: azul-da-prússia = ação e seleção; amarelo (marca-texto) só para decisão humana;
   vermelho = erro/perigo; verde só estado entregue/ativo e canal WhatsApp. Barlow para tudo;
   JetBrains Mono só em ids, datas e códigos. Status sempre com texto. */
:root {
  --ground: #f1f3f4;
  --surface: #ffffff;
  --sunken: #f5f7f8;
  --ink: #181c21;
  --ink-2: #363d46;
  --muted: #5b636e;
  --line: #e2e6e9;
  --line-2: #cbd1d6;
  --blue: #1d4f86;
  --blue-text: #1d4f86;
  --blue-ink: #ffffff;
  --blue-soft: #e7eef7;
  --rail: #e3eaf1;
  --rail-ink: #132c48;
  --rail-muted: #566b82;
  --rail-line: #cfdae5;
  --rail-hover: rgb(19 44 72 / .06);
  --yellow: #ffd43b;
  --yellow-ink: #1c1600;
  --yellow-soft: #fff8d9;
  --yellow-line: #ecd27a;
  --yellow-text: #6a5100;
  --red: #b3261e;
  --red-soft: #fcebe9;
  --ok: #17734a;
  --ok-soft: #e4f3eb;
  --claude-bg: #181c21;
  --claude-ink: #ffffff;
  --wa: #10714a;
  --mail: #363d46;
  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgb(17 27 38 / .05), 0 1px 3px -1px rgb(17 27 38 / .04);
  --t: 160ms cubic-bezier(.2, .7, .2, 1);
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", "SFMono-Regular", Menlo, Consolas, monospace;
  --mark: .55rem;
  /* marca-texto: traço inclinado, borda irregular, mais forte embaixo como caneta real */
  --hl: linear-gradient(100deg, transparent 0, var(--yellow) .22em, var(--yellow) calc(100% - .32em), transparent 100%);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0e1114; --surface: #161a1f; --sunken: #12161a;
    --ink: #e6e9ec; --ink-2: #c3c9d0; --muted: #949ca7; --line: #232a31; --line-2: #343c45;
    --blue: #2f6db3; --blue-text: #8fbaf0; --blue-ink: #ffffff; --blue-soft: #15263a;
    --rail: #111a24; --rail-ink: #dbe6f2; --rail-muted: #8ea3ba; --rail-line: #1f2b38; --rail-hover: rgb(255 255 255 / .05);
    --yellow: #ffd43b; --yellow-ink: #1c1600; --yellow-soft: #262007; --yellow-line: #5a4a12; --yellow-text: #f2cc4a;
    --red: #ff8a7e; --red-soft: #3a1714;
    --ok: #5fd39a; --ok-soft: #10281c;
    --claude-bg: #e6e9ec; --claude-ink: #0e1114;
    --wa: #4cc98d; --mail: #c3c9d0;
    --shadow: 0 1px 2px rgb(0 0 0 / .35);
  }
}

* { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; scrollbar-color: var(--line-2) transparent; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 1rem/1.5 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--blue-text); text-decoration: none; text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--blue-text); outline-offset: 2px; }
input, textarea { caret-color: var(--blue-text); }
::selection { background: var(--yellow); color: var(--yellow-ink); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.15; display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; }
h2 { font-size: 1.07rem; font-weight: 600; letter-spacing: -.005em; display: flex; flex-wrap: wrap; gap: .4rem .5rem; align-items: center; margin-bottom: .75rem; }
h2 small { font-weight: 500; font-size: .87rem; color: var(--muted); }
h3 { font-size: .87rem; font-weight: 600; color: var(--ink-2); margin: 1.2rem 0 .5rem; letter-spacing: .01em; }
code, .mono { font-family: var(--mono); font-size: .8em; font-variant-numeric: tabular-nums; }
code { background: var(--sunken); padding: .05rem .3rem; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--line); }
pre code, .copy code { box-shadow: none; }
small { font-size: .87em; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.small { font-size: .9rem !important; }

/* ---------------------------------------------------------------- casca */
body.has-nav { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(90deg, var(--rail) 231px, var(--rail-line) 231px, var(--rail-line) 232px, transparent 232px), var(--ground); }
.nav { background: var(--rail); color: var(--rail-ink); padding: 1.2rem .75rem 1rem; display: flex; flex-direction: column; gap: 1.1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-color: var(--rail-line) transparent; border-right: 1px solid var(--rail-line); }
.brand { display: flex; gap: .55rem; align-items: baseline; color: var(--rail-ink); padding: 0 .55rem; }
.brand:hover { text-decoration: none; }
.wordmark { font-weight: 700; font-size: 1.4rem; line-height: 1; letter-spacing: -.02em; }
.brand small, .auth-brand small { font-size: .8rem; font-weight: 500; letter-spacing: .02em; color: var(--rail-muted); padding-left: .55rem; border-left: 1px solid var(--rail-line); line-height: 1.1; }
.nav nav { display: flex; flex-direction: column; gap: 1px; }
.nav-group { font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: var(--rail-muted); padding: 1rem .55rem .3rem; }
.nav-group:first-child { padding-top: .2rem; }
.nav nav a { position: relative; color: var(--rail-ink); padding: .36rem .55rem .36rem 1.4rem; border-radius: var(--radius); display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-weight: 500; transition: background var(--t), color var(--t), box-shadow var(--t); }
.nav nav a::before { content: ""; position: absolute; left: .58rem; top: 50%; width: .38rem; height: .38rem; margin-top: -.19rem; box-shadow: inset 0 0 0 1px var(--rail-muted); opacity: 0; transition: opacity var(--t); }
.nav nav a:hover { background: var(--rail-hover); text-decoration: none; }
.nav nav a:hover::before { opacity: .7; }
.nav nav a.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow), inset 0 0 0 1px var(--rail-line); }
.nav nav a.on::before { opacity: 1; background: var(--blue); box-shadow: none; }
.count { background: var(--blue); color: var(--blue-ink); border-radius: var(--radius-sm); padding: 0 .38rem; font-size: .76rem; font-weight: 600; min-width: 1.35rem; text-align: center; line-height: 1.45; }
.me { margin-top: auto; display: flex; flex-direction: column; gap: .45rem; align-items: flex-start; font-size: .87rem; padding: .85rem .55rem 0; border-top: 1px solid var(--rail-line); }
.me .actor { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.nav .actor-admin { background: transparent; color: var(--rail-ink); box-shadow: inset 0 0 0 1px var(--rail-line); }
.nav .link { color: var(--rail-muted); font-weight: 500; }
.nav .link:hover { color: var(--rail-ink); }
.main { padding: 1.4rem 2.25rem 4rem; max-width: 1440px; width: 100%; min-width: 0; }
body.bare { min-height: 100vh; display: grid; place-items: center; background: var(--rail); }
body.bare .main { max-width: 420px; margin: 0 auto; padding: 2rem 1rem; }

.head { margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.head > p { margin: 0; max-width: 78ch; line-height: 1.55; }
.head > p.muted { font-size: .97rem; }
.head .actions { margin-top: .4rem; }
.crumb { font-size: .87rem; color: var(--muted); margin: 0; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--blue-text); }
.meta { color: var(--muted); font-size: .92rem; margin: 0; line-height: 1.75; overflow-wrap: anywhere; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.1rem 1.25rem; margin-bottom: 1rem; min-width: 0; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.card.auth { padding: 1.9rem 1.75rem 1.75rem; }
.card.auth h1 { font-size: 1.25rem; letter-spacing: 0; margin-bottom: 1.2rem; }
.card.auth .stack > .btn { align-self: stretch; margin-top: .3rem; }
.auth-brand { display: flex; gap: .55rem; align-items: baseline; margin-bottom: 1.5rem; color: var(--ink); }
.auth-brand .wordmark { font-size: 1.9rem; }
.auth-brand small { color: var(--muted); border-left-color: var(--line-2); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1rem; align-items: start; }
.cols-wide { grid-template-columns: minmax(0, 1fr) 320px; }
.cols > * { min-width: 0; }
.cols > div > h2:first-child { margin-top: .2rem; }

/* ---------------------------------------------------------------- números (uma prancha, divisórias de fio) */
.section-title { font-size: .95rem; font-weight: 600; color: var(--ink-2); margin: 0 0 .5rem; }
.section-title small { color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1.6rem; box-shadow: var(--shadow); }
.tile { position: relative; background: var(--surface); padding: .95rem 1.15rem 1rem; color: var(--ink); display: flex; flex-direction: column; gap: .2rem; min-width: 0; transition: background var(--t); }
a.tile:hover { background: var(--sunken); text-decoration: none; }
a.tile:hover span { color: var(--ink); }
.tile b { align-self: flex-start; font-size: 1.75rem; font-weight: 600; line-height: 1.1; letter-spacing: -.01em; font-variant-numeric: tabular-nums lining-nums; }
.tile span { color: var(--muted); font-size: .9rem; line-height: 1.35; }
.tile.is-zero b { color: var(--muted); font-weight: 400; }
/* a assinatura: o que pede decisão humana sai marcado a marca-texto */
.tile-warn b { color: var(--yellow-ink); background: var(--hl) no-repeat 0 72% / 100% 70%; padding: 0 .16em; margin-left: -.16em; border-radius: .3em .15em .35em .12em; }
.tile-warn span { color: var(--ink); font-weight: 500; }
@media (hover: hover) { a.tile-warn:hover { background: var(--yellow-soft); } }
.tiles-decide .tile { padding: 1.1rem 1.25rem 1.15rem; }
.tiles-decide .tile b { font-size: 2.3rem; }
.tiles-sm { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); margin-bottom: 1.2rem; }
.tiles-sm .tile { padding: .7rem .9rem .75rem; }
.tiles-sm .tile b { font-size: 1.4rem; }
.tiles-sm .tile span { font-size: .82rem; }

/* ---------------------------------------------------------------- tabelas */
.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); font-variant-numeric: tabular-nums; }
.card .grid { background: transparent; }
.card > .grid { margin: 0 -1.25rem; width: calc(100% + 2.5rem); }
.card > .grid:last-child { margin-bottom: -1.1rem; }
.card > .grid th:first-child, .card > .grid td:first-child { padding-left: 1.25rem; }
.card > .grid th:last-child, .card > .grid td:last-child { padding-right: 1.25rem; }
.grid th { text-align: left; font-size: .8rem; font-weight: 600; color: var(--muted); letter-spacing: .02em; padding: .5rem .75rem .45rem; border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap; }
.card .grid th { background: transparent; border-top: 1px solid var(--line); }
.grid td { padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr { transition: background var(--t); }
.grid tbody tr:hover { background: var(--sunken); }
.grid td b { font-weight: 600; }
.grid td small { line-height: 1.35; display: inline-block; }
.grid td.mono { color: var(--ink-2); font-size: .8rem; padding-top: .7rem; }
.grid td small.mono, .grid td .mono.muted { font-size: .76rem; }
.grid.compact td { padding: .4rem .75rem; }
.grid .num { text-align: right; }
.row-active td { background: color-mix(in srgb, var(--ok-soft) 55%, var(--surface)); }
.row-off td { opacity: .55; }
.excerpt { color: var(--muted); max-width: 60ch; }
.contacts span:not(.ck) { display: block; font-family: var(--mono); font-size: .76rem; line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30ch; color: var(--ink-2); }
.contacts .ck { display: inline-block; width: 4.6em; font: 600 .76rem/1 var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
body > .main > .grid { border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
body > .main > .grid thead th { position: sticky; top: 0; z-index: 1; }

/* ---------------------------------------------------------------- autoria e estado */
.actor { display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem; padding: .08rem .45rem .08rem .4rem; border-radius: var(--radius-sm); font-weight: 600; white-space: nowrap; vertical-align: middle; line-height: 1.45; }
.actor::before { content: ""; width: .45rem; height: .45rem; flex: none; }
.actor-claude { background: var(--claude-bg); color: var(--claude-ink); }
.actor-claude::before { background: currentColor; transform: rotate(45deg) scale(.85); }
.actor-admin { background: var(--blue-soft); color: var(--blue-text); }
.actor-admin::before { background: currentColor; border-radius: 50%; }
.actor-system, .actor-none { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-2); }
.actor-system::before, .actor-none::before { height: 1.5px; background: currentColor; }

.pill { --c: var(--muted); --bg: var(--sunken); display: inline-flex; align-items: center; gap: .36rem; font-size: .76rem; line-height: 1.55; padding: .02rem .5rem .02rem .42rem; border-radius: var(--radius-sm); font-weight: 600; white-space: nowrap; vertical-align: middle; color: var(--ink-2); background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.pill::before { content: ""; width: var(--mark); height: var(--mark); flex: none; box-shadow: inset 0 0 0 1.5px var(--c); }
a.pill:hover { text-decoration: none; box-shadow: inset 0 0 0 1px var(--ink-2); }
/* quadrado cheio: feito, ativo, entregue */
.pill-active, .pill-done, .pill-sent, .pill-received, .pill-won, .pill-interested { --c: var(--ok); --bg: var(--ok-soft); box-shadow: none; }
.pill-active::before, .pill-done::before, .pill-sent::before, .pill-received::before, .pill-won::before, .pill-interested::before { background: var(--c); }
/* meio quadrado: em andamento */
.pill-queued, .pill-approved, .pill-sending, .pill-open, .pill-pending { --c: var(--blue-text); --bg: var(--blue-soft); box-shadow: none; }
.pill-queued::before, .pill-approved::before, .pill-sending::before, .pill-open::before, .pill-pending::before { background: linear-gradient(135deg, var(--c) 50%, transparent 50%); }
/* marca-texto: espera decisão humana */
.pill-draft, .pill-replied { --c: var(--yellow-ink); --bg: var(--yellow); color: var(--yellow-ink); box-shadow: none; border-radius: .4em .2em .45em .2em; }
.pill-draft::before { background: linear-gradient(135deg, var(--c) 50%, transparent 50%); }
.pill-replied::before { background: var(--c); box-shadow: none; }
.msg-card .pill-draft { --c: var(--blue-text); --bg: var(--blue-soft); color: var(--blue-text); border-radius: var(--radius-sm); }
.card-decide { background: var(--yellow-soft); border-color: var(--yellow-line); color: var(--ink); }
.card-decide > h2:first-child { align-self: flex-start; display: inline-flex; color: var(--yellow-ink); background: var(--hl) no-repeat 0 80% / 100% 62%; padding: 0 .35em; margin-left: -.35em; border-radius: .35em .2em .4em .15em; }
.card-decide .muted, .card-decide .meta { color: var(--ink-2); }
.card-decide .tag-dry { color: var(--ink-2); outline-color: var(--ink-2); }
.card-decide .flash { color: var(--ink); }
/* contorno: fora de jogo */
.pill-expired, .pill-archived, .pill-cancelled, .pill-skipped, .pill-discarded, .pill-opted_out { --c: var(--muted); --bg: transparent; color: var(--muted); }
/* triângulo: falha */
.pill-revoked, .pill-failed, .pill-undelivered { --c: var(--red); --bg: var(--red-soft); color: var(--red); box-shadow: none; }
.pill-revoked::before, .pill-failed::before, .pill-undelivered::before { background: var(--c); box-shadow: none; clip-path: polygon(50% 4%, 100% 96%, 0 96%); }
/* tracejado: simulado */
.pill-dry_run { --bg: transparent; color: var(--ink-2); box-shadow: none; outline: 1px dashed var(--ink-2); outline-offset: -1px; }
.pill-dry_run::before { box-shadow: none; outline: 1.5px dashed var(--ink-2); outline-offset: -1.5px; }

.score { display: inline-grid; place-items: center; min-width: 1.75rem; height: 1.75rem; padding: 0 .3rem; border-radius: var(--radius-sm); font: 700 .82rem var(--mono); vertical-align: middle; }
h1 .score { font-size: .95rem; min-width: 2rem; height: 2rem; }
.score-hi { background: var(--blue); color: var(--blue-ink); }
.score-mid { color: var(--blue-text); background: var(--blue-soft); }
.score-lo { color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-2); }
.chan { font: 600 .76rem/1.55 var(--font); text-transform: uppercase; letter-spacing: .07em; padding: .02rem .45rem; border-radius: var(--radius-sm); vertical-align: middle; }
.chan-whatsapp { color: var(--wa); background: color-mix(in srgb, var(--wa) 12%, var(--surface)); }
.chan-email { color: var(--mail); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------------------------------------------------------------- formulários */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .87rem; color: var(--ink-2); font-weight: 600; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea { font: inherit; font-size: .97rem; font-weight: 400; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: .42rem .62rem; min-width: 0; min-height: 2.25rem; transition: border-color var(--t), box-shadow var(--t); }
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 1.05rem; height: 1.05rem; accent-color: var(--blue); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .9; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
select { padding-right: 2rem; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235b636e' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right .7rem center; }
@media (prefers-color-scheme: dark) { select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23949ca7' stroke-width='1.5'/%3E%3C/svg%3E"); } }
textarea { resize: vertical; width: 100%; line-height: 1.55; }
textarea.code { font-family: var(--mono); font-size: .84rem; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--blue-text); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-text) 20%, transparent); }
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
.w-num { width: 6.2rem; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.stack > .btn { align-self: flex-start; }
.row { display: flex; gap: .8rem; flex-wrap: wrap; }
.grow { flex: 1; }
.filters { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: .8rem 1rem; box-shadow: var(--shadow); }
.filters .grow { min-width: 220px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .85rem 1rem; align-items: end; }
.grid-form .span { grid-column: 1 / -1; }
.grid-form > .btn { justify-self: start; }
.inline { display: inline-flex; gap: .5rem; align-items: flex-end; }
.inline label { flex-direction: row; align-items: center; gap: .45rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions form { margin: 0; }
.btn { font: inherit; font-size: .93rem; font-weight: 600; line-height: 1.2; cursor: pointer; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); padding: .45rem .9rem; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.25rem; box-shadow: 0 1px 1px rgb(17 27 38 / .04); transition: background var(--t), border-color var(--t), color var(--t); }
.btn:hover { background: var(--sunken); border-color: var(--muted); text-decoration: none; }
.btn:active { background: var(--line); }
.btn:disabled { opacity: .45; cursor: not-allowed; background: var(--surface); border-color: var(--line-2); }
.btn.primary { background: var(--blue); color: var(--blue-ink); border-color: var(--blue); }
.btn.primary:hover { background: color-mix(in srgb, var(--blue) 84%, #000); border-color: color-mix(in srgb, var(--blue) 84%, #000); }
.btn.danger, .btn-mini.danger { color: var(--red); }
.btn.danger:hover { border-color: color-mix(in srgb, var(--red) 50%, transparent); background: var(--red-soft); }
.btn-mini { font: 600 .8rem var(--font); cursor: pointer; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); padding: .12rem .5rem; border-radius: var(--radius-sm); display: inline-flex; align-items: center; gap: .3rem; min-height: 1.7rem; transition: border-color var(--t), background var(--t), color var(--t); }
.btn-mini:hover { border-color: var(--muted); background: var(--sunken); color: var(--ink); text-decoration: none; }
.btn-mini.danger:hover { border-color: color-mix(in srgb, var(--red) 50%, transparent); background: var(--red-soft); color: var(--red); }
.btn-mini.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-soft); }
.link { background: none; border: 0; padding: 0; color: var(--blue-text); cursor: pointer; font: inherit; font-weight: 600; }
.link:hover { text-decoration: underline; }
.copy { display: inline-flex; gap: .4rem; align-items: center; max-width: 100%; }
.copy code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30ch; background: var(--sunken); padding: .15rem .45rem; box-shadow: inset 0 0 0 1px var(--line); }
.pager { display: flex; gap: .8rem; align-items: center; justify-content: center; margin-top: 1.2rem; }
.tabs { display: flex; gap: .2rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line-2); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: .5rem .75rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; white-space: nowrap; transition: color var(--t), border-color var(--t); }
.tabs a:hover { color: var(--ink); text-decoration: none; border-color: var(--line-2); }
.tabs a.on { color: var(--ink); border-color: var(--blue); }
.tabs a small { display: inline-block; min-width: 1.35rem; text-align: center; background: var(--sunken); padding: 0 .35rem; margin-left: .3rem; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.tabs a.on small { background: var(--blue); color: var(--blue-ink); box-shadow: none; }

/* ---------------------------------------------------------------- avisos */
.flash { display: block; padding: .65rem .95rem .65rem 2rem; border-radius: var(--radius); margin: 0 0 1rem; border: 1px solid; line-height: 1.5; position: relative; color: var(--ink); }
.flash::before { content: ""; position: absolute; left: .85rem; top: 1.02em; width: var(--mark); height: var(--mark); margin-top: -.12rem; }
.flash-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.flash-ok::before { background: var(--ok); }
.flash-err { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.flash-err::before { background: var(--red); clip-path: polygon(50% 4%, 100% 96%, 0 96%); }
.flash-warn { background: var(--yellow-soft); border-color: var(--yellow-line); }
.flash-warn::before { background: linear-gradient(135deg, var(--yellow-text) 50%, transparent 50%); box-shadow: inset 0 0 0 1.5px var(--yellow-text); }
.flash a { color: inherit; text-decoration: underline; font-weight: 600; }
.meta .flash-err { background: none; padding: 0; border: 0; color: var(--red); }
.meta .flash-err::before { display: none; }
.empty { color: var(--muted); padding: 1.4rem 1.25rem; border: 1px dashed var(--line-2); border-radius: var(--radius); background: transparent; margin: 0; line-height: 1.6; }
.empty::before { content: ""; display: inline-block; width: var(--mark); height: var(--mark); margin-right: .6rem; box-shadow: inset 0 0 0 1.5px var(--line-2); vertical-align: .05em; }
.task-io .empty, .vars .empty, .empty.sm { padding: .7rem .9rem; background: var(--sunken); border-color: var(--line); }

/* ---------------------------------------------------------------- conteúdo */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; word-break: break-word; }
.reason { white-space: pre-wrap; background: var(--sunken); padding: .75rem .9rem; border-radius: var(--radius); margin: 0; box-shadow: inset 0 0 0 1px var(--line); line-height: 1.6; }
.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
pre.json { font: .78rem/1.55 var(--mono); background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .85rem; overflow: auto; max-height: 340px; margin: .25rem 0; white-space: pre-wrap; word-break: break-word; color: var(--ink-2); }
details { margin-top: .8rem; }
summary { cursor: pointer; color: var(--ink-2); font-size: .92rem; font-weight: 600; padding: .2rem 0; list-style: none; display: flex; align-items: center; gap: .45rem; }
summary::-webkit-details-marker { display: none; }
summary::before { content: ""; width: var(--mark); height: var(--mark); flex: none; box-shadow: inset 0 0 0 1.5px currentColor; }
details[open] > summary::before { background: linear-gradient(135deg, currentColor 50%, transparent 50%); }
summary:hover { color: var(--blue-text); }
details[open] > summary { margin-bottom: .5rem; }
.frame { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.vars { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1rem 1.1rem; position: sticky; top: 1.25rem; box-shadow: var(--shadow); }
.vars h3 { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.vars h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.vars .stack + .plain, .vars #ai-result + .plain { margin-top: .9rem; }
.vars dl { margin: .5rem 0 0; display: flex; flex-direction: column; gap: .15rem; }
.vars dt code { color: var(--blue-text); }
.vars dd { margin: 0 0 .45rem; color: var(--muted); font-size: .87rem; }
.vars .plain li { line-height: 1.5; }
.task-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.task-head .push { margin-left: auto; }
.task-io { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.task-io h3 { margin-top: 0; }
.rendered { margin-top: 1rem; }
.subject { margin: .35rem 0; font-weight: 600; }
.bubble { white-space: pre-wrap; padding: .75rem 1rem; border-radius: var(--radius-lg); max-width: 64ch; line-height: 1.55; overflow-wrap: anywhere; }
.bubble-whatsapp { background: color-mix(in srgb, var(--wa) 6%, var(--sunken)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wa) 22%, var(--line)); }
.bubble-email { background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------------------------------------------------------------- outreach e conversas */
.dry-run { display: block; background: transparent; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius); padding: .35rem .75rem; margin: 0; font-size: .87rem; line-height: 1.55; }
.dry-run:has(+ .dry-run) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.dry-run + .dry-run { border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.dry-run + :not(.dry-run) { margin-top: 1.25rem; }
.dry-run b { font: 700 .76rem/1.6 var(--mono); letter-spacing: .08em; color: var(--ink-2); outline: 1px dashed currentColor; outline-offset: -1px; padding: 0 .4rem; margin: 0 .6rem 0 0; display: inline-block; vertical-align: 1px; border-radius: 2px; }
.dry-run code { font-size: .8rem; background: transparent; box-shadow: none; padding: 0; color: var(--ink-2); }
.tag-dry { display: inline-block; font: 700 .76rem/1.55 var(--mono); letter-spacing: .06em; color: var(--ink-2); outline: 1px dashed var(--ink-2); outline-offset: -1px; padding: 0 .35rem; vertical-align: middle; border-radius: 2px; }
.selbar { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; margin-bottom: .8rem; padding: .5rem .8rem; background: var(--blue-soft); border: 1px solid color-mix(in srgb, var(--blue-text) 22%, transparent); border-radius: var(--radius); }
.msg-card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: .95rem 1.15rem 1.05rem; margin-bottom: .75rem; background: var(--surface); box-shadow: var(--shadow); }
.msg-card header { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; margin-bottom: .6rem; }
.msg-card header b { font-size: 1.07rem; font-weight: 600; }
.msg-card header .push { margin-left: auto; }
.msg-card .hook-form { display: flex; gap: .55rem; align-items: flex-end; margin: .5rem 0 .75rem; padding: 0 0 .85rem; border-bottom: 1px solid var(--line); }
.msg-card .hook-form label { flex: 1; }
.msg-card details { margin-top: .4rem; }
.thread { display: flex; flex-direction: column; gap: 1rem; }
.thread > div { max-width: min(78%, 70ch); display: flex; flex-direction: column; gap: .3rem; }
.thread .in { align-self: flex-start; }
.thread .out { align-self: flex-end; align-items: flex-end; }
.thread .out .meta { text-align: right; }
.thread .bubble { max-width: 70ch; }
.thread .in .bubble { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); border-top-left-radius: var(--radius-sm); }
.thread .out .bubble { background: var(--blue-soft); box-shadow: none; border-top-right-radius: var(--radius-sm); }
.thread .meta { font-size: .84rem; line-height: 1.6; }
.thread .subject { margin: 0; font-size: .97rem; }
.thread .is-draft { align-self: stretch; max-width: none; align-items: stretch; background: var(--yellow-soft); border: 1px solid var(--yellow-line); border-radius: var(--radius-lg); padding: .9rem 1.05rem 1.05rem; }
.thread .is-draft .meta { text-align: left; }
.thread .is-draft .meta::before { content: "Rascunho · revise antes de enviar"; display: table; margin: 0 0 .4rem -.3em; padding: 0 .35em; font: 600 .92rem/1.5 var(--font); color: var(--yellow-ink); background: var(--hl) no-repeat 0 75% / 100% 70%; border-radius: .35em .2em .4em .15em; }
.thread .is-draft > form:last-child { align-self: flex-start; }
.funnel td.num small { color: var(--muted); font-size: .76rem; margin-left: .15rem; }

/* ---------------------------------------------------------------- estreito */
@media (max-width: 860px) {
  html { font-size: 15.5px; }
  body.has-nav { grid-template-columns: minmax(0, 1fr); background: var(--ground); }
  .nav { position: sticky; top: 0; z-index: 10; height: auto; min-width: 0; padding: .65rem .9rem 0; gap: .45rem; flex-direction: row; flex-wrap: wrap; align-items: center; overflow: visible; border-right: 0; border-bottom: 1px solid var(--rail-line); }
  .brand { padding: 0; }
  .wordmark { font-size: 1.25rem; }
  .nav nav { order: 3; flex-basis: 100%; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: .3rem; margin: 0 -.9rem; padding: .25rem .9rem .6rem; mask-image: linear-gradient(90deg, #000 84%, transparent); }
  .nav nav::-webkit-scrollbar { display: none; }
  .nav-group { display: none; }
  .nav nav a { white-space: nowrap; padding: .36rem .75rem; box-shadow: inset 0 0 0 1px var(--rail-line); }
  .nav nav a::before { display: none; }
  .me { margin: 0 0 0 auto; flex-direction: row; align-items: center; gap: .6rem; padding: 0; border: 0; }
  .me .actor { max-width: 15ch; }
  .cols, .cols-wide, .task-io { grid-template-columns: 1fr; }
  .main { padding: 1.1rem .9rem 3rem; }
  h1 { font-size: 1.55rem; }
  .card { padding: 1rem; }
  .card > .grid { margin: 0 -1rem; width: calc(100% + 2rem); }
  .card > .grid:last-child { margin-bottom: -1rem; }
  .card > .grid th:first-child, .card > .grid td:first-child { padding-left: 1rem; }
  .grid { display: block; overflow-x: auto; }
  body > .main > .grid thead th { position: static; }
  .vars { position: static; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { padding: .85rem 1rem .9rem; }
  .tile b { font-size: 1.6rem; }
  .tiles-decide .tile b { font-size: 2rem; }
  .tiles-sm { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles > .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .tiles-sm > .tile:last-child:nth-child(odd) { grid-column: auto; }
  .grid td.excerpt { width: 26ch; min-width: 26ch; }
  .filters > label, .filters .grow { flex: 1 1 140px; min-width: 0; }
  .filters > .btn { flex: 1 1 100%; }
  .bubble { max-width: 100%; }
  .thread > div { max-width: 92%; }
  .thread > .is-draft { max-width: none; }
  .msg-card .hook-form { flex-direction: column; align-items: stretch; }
  .msg-card .hook-form > label { flex: none; width: 100%; }
  .msg-card .hook-form > .btn { align-self: flex-start; }
}
@media (pointer: coarse) {
  .btn-mini { min-height: 2.1rem; padding: .3rem .7rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
