/* ============================================================================
   IATech · Prospecção ativa — Grupo Reis | Divisão de Tecnologia e Gestão
   Folha de estilo do módulo interno de gestão de leads.
   Herdada de `assets/gestor.css` da landing page de referência:
   Navy #0F172A, dourado #D97706, esmeralda #10B981 sobre off-white #F8FAFC.
   Convenção de cor:
     dourado  → atenção, lead quente, pendência
     esmeralda→ ação primária, progresso, positivo
     azul     → informação neutra
   ========================================================================== */

/* ─── tokens ─────────────────────────────────────────────────────────────── */
:root {
  --bg:        #F8FAFC;
  --surface:   #FFFFFF;
  --surface-2: #F1F5F9;
  --fg:        #0F172A;
  --muted:     #55607A;
  --border:    #E4E9F2;
  --accent:    #D97706;
  --action:    #10B981;
  --navy:      #0B1220;
  --navy-2:    #131E33;

  --ok:     #10B981;
  --warn:   #D97706;
  --danger: #DC2626;
  --info:   #2563EB;
  --violet: #7C3AED;

  /* tintas de texto — cada uma é par legível sobre o seu fundo suave */
  --action-ink: color-mix(in oklch, var(--action) 58%, black);
  --accent-ink: color-mix(in oklch, var(--accent) 74%, black);
  --ok-ink:     color-mix(in oklch, var(--ok) 60%, black);
  --danger-ink: color-mix(in oklch, var(--danger) 78%, black);
  --info-ink:   color-mix(in oklch, var(--info) 74%, black);
  --violet-ink: color-mix(in oklch, var(--violet) 74%, black);
  --on-action:  oklch(23% 0.045 165);
  --on-accent:  oklch(24% 0.045 62);
  --ink-on-navy: #FFFFFF;
  --plate: #FFFFFF;
  --row-hover: var(--bg);

  --accent-soft: color-mix(in oklch, var(--accent) 15%, transparent);
  --action-soft: color-mix(in oklch, var(--action) 16%, transparent);
  --ok-soft:     color-mix(in oklch, var(--ok) 16%, transparent);
  --warn-soft:   color-mix(in oklch, var(--warn) 16%, transparent);
  --danger-soft: color-mix(in oklch, var(--danger) 13%, transparent);
  --info-soft:   color-mix(in oklch, var(--info) 12%, transparent);
  --violet-soft: color-mix(in oklch, var(--violet) 13%, transparent);
  --fg-soft:     color-mix(in oklch, var(--fg) 6%, transparent);

  --on-navy:     color-mix(in oklch, var(--ink-on-navy) 84%, transparent);
  --on-navy-dim: color-mix(in oklch, var(--ink-on-navy) 56%, transparent);
  --line-navy:   color-mix(in oklch, var(--ink-on-navy) 13%, transparent);

  --shadow-sm: 0 1px 2px color-mix(in oklch, var(--fg) 9%, transparent);
  --shadow-md: 0 14px 32px -16px color-mix(in oklch, var(--fg) 34%, transparent);
  --shadow-lg: 0 34px 66px -30px color-mix(in oklch, var(--fg) 48%, transparent);

  --font-display: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:    ui-monospace, 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --sidebar-w: 296px;
}

/* tema escuro corporativo — a moldura continua mais escura que o conteúdo */
[data-theme="dark"] {
  --bg:        #0B1120;
  --surface:   #121B2E;
  --surface-2: #1A2438;
  --fg:        #E9EFF9;
  --muted:     #98A6C0;
  --border:    #26324B;
  --navy:      #060A14;
  --navy-2:    #101A2D;

  --action-ink: color-mix(in oklch, var(--action) 82%, white);
  --accent-ink: color-mix(in oklch, var(--accent) 84%, white);
  --ok-ink:     color-mix(in oklch, var(--ok) 78%, white);
  --danger-ink: color-mix(in oklch, var(--danger) 72%, white);
  --info-ink:   color-mix(in oklch, var(--info) 76%, white);
  --violet-ink: color-mix(in oklch, var(--violet) 78%, white);
  --ink-on-navy: #EEF3FB;
  --row-hover: var(--surface-2);

  --shadow-sm: 0 1px 2px #04070E;
  --shadow-md: 0 16px 34px -18px #02050A;
  --shadow-lg: 0 32px 60px -26px #02050A;
}

/* ─── base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
p { margin: 0; text-wrap: pretty; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }

/* ─── tipografia ─────────────────────────────────────────────────────────── */
.t-h1 { font-family: var(--font-display); font-size: clamp(24px, 2.6vw, 32px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.t-h2 { font-family: var(--font-display); font-size: clamp(19px, 2vw, 23px); font-weight: 700; letter-spacing: -0.015em; }
.t-h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.t-lead { color: var(--muted); font-size: 15.5px; max-width: 68ch; }
.t-muted { color: var(--muted); }
.t-mono { font-family: var(--font-mono); }
.t-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-ink); }
.t-xs { font-size: 12.5px; }
.t-sm { font-size: 13.5px; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: clamp(20px, 4vw, 40px); }

/* ─── shell ──────────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-content { padding: clamp(20px, 2.6vw, 34px); width: 100%; max-width: 1440px; margin-inline: auto; }
.app-foot { padding: 16px clamp(20px, 2.6vw, 34px) 28px; color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.app-side {
  background: var(--navy);
  color: var(--on-navy);
  display: flex; flex-direction: column;
  padding: 16px 14px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 4px 14px; }
.brand-plate { background: var(--plate); border-radius: 11px; padding: 7px 11px; display: inline-flex; box-shadow: var(--shadow-sm); }
.brand-plate img { height: 30px; width: auto; }
.side-product { display: flex; align-items: baseline; gap: 8px; padding: 0 6px 4px; }
.side-product b { font-family: var(--font-display); font-size: 19px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink-on-navy); }
.side-product b i { font-style: normal; color: color-mix(in oklch, var(--accent) 82%, white); }
.side-sys { display: flex; flex-direction: column; gap: 2px; padding: 0 6px 14px; border-bottom: 1px solid var(--line-navy); }
.side-sys span { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--on-navy-dim); }

.side-group { margin-top: 12px; }
.side-label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--on-navy-dim); padding: 6px 12px; }
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  color: var(--on-navy);
  transition: background 0.15s ease, color 0.15s ease;
}
.side-link svg { width: 18px; height: 18px; flex: 0 0 auto; }
.side-link:hover { background: color-mix(in oklch, var(--ink-on-navy) 9%, transparent); color: var(--ink-on-navy); }
.side-link.is-active { background: var(--action-soft); color: var(--ink-on-navy); font-weight: 600; }
.side-link.is-active svg { color: color-mix(in oklch, var(--action) 68%, white); }
.side-tag { margin-left: auto; font-family: var(--font-mono); font-size: 10px; padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: color-mix(in oklch, var(--accent) 80%, white); }
.side-foot { margin-top: auto; padding-top: 18px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-top: 1px solid var(--line-navy); }
.side-user b { display: block; font-size: 13.5px; color: var(--ink-on-navy); font-weight: 600; }
.side-user span { display: block; font-size: 11.5px; color: var(--on-navy-dim); }
.side-logout { margin-left: auto; width: 34px; height: 34px; flex: 0 0 auto; border: 0; border-radius: 9px; background: transparent; color: var(--on-navy-dim); display: grid; place-items: center; transition: background 0.15s ease, color 0.15s ease; }
.side-logout:hover { background: color-mix(in oklch, var(--ink-on-navy) 12%, transparent); color: var(--ink-on-navy); }
.side-logout svg { width: 17px; height: 17px; }

.app-top { position: sticky; top: 0; z-index: 30; background: color-mix(in oklch, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.app-top-inner { display: flex; align-items: center; gap: 14px; justify-content: space-between; padding: 10px clamp(20px, 2.6vw, 34px); }
.top-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.top-title h1 { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -0.015em; }
.top-title span { font-size: 12.5px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.hide-sm { display: inline-flex; }
.icon-btn {
  width: 40px; height: 40px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); color: var(--fg);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-2); border-color: color-mix(in oklch, var(--fg) 22%, transparent); }
.icon-btn svg { width: 18px; height: 18px; }
.side-toggle { display: none; }
.top-mark { display: inline-flex; align-items: center; gap: 9px; }
.top-mark .mark-plate { background: var(--plate); border-radius: 9px; padding: 4px 7px; box-shadow: var(--shadow-sm); flex: 0 0 auto; }
.top-mark .mark-plate img { height: 20px; width: auto; }
.top-mark b { font-family: var(--font-display); font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }
.top-mark b i { font-style: normal; color: var(--accent-ink); }

/* chips de status do sistema (Tela 1) */
.sys-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; min-height: 40px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.sys-chip .sys-name { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.sys-chip .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.sys-chip .dot.live { background: var(--ok); animation: pulse 2.2s ease-out infinite; }
.sys-chip .dot.ready { background: var(--ok); }
.sys-chip .dot.attention { background: var(--warn); }
.sys-chip svg { width: 15px; height: 15px; color: var(--muted); flex: 0 0 auto; }

/* ─── botões ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius); min-height: 44px;
  border: 1px solid transparent;
  font-size: 14px; font-weight: 600; letter-spacing: -0.005em;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.06s ease;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; flex: 0 0 auto; }
.btn-primary { background: var(--action); color: var(--on-action); border-color: var(--action); }
.btn-primary:hover { background: color-mix(in oklch, var(--action) 88%, black); border-color: color-mix(in oklch, var(--action) 88%, black); color: var(--on-action); }
.btn-dark { background: var(--navy); color: var(--ink-on-navy); border-color: var(--navy); }
.btn-dark:hover { background: var(--navy-2); color: var(--ink-on-navy); }
.btn-secondary { background: var(--surface); color: var(--fg); border-color: var(--border); }
.btn-secondary:hover { border-color: color-mix(in oklch, var(--fg) 26%, transparent); background: var(--surface-2); color: var(--fg); }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { color: var(--fg); background: var(--fg-soft); }
.btn-danger { background: transparent; color: var(--danger-ink); border-color: color-mix(in oklch, var(--danger) 34%, transparent); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger-ink); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 14px 22px; font-size: 15.5px; border-radius: 14px; min-height: 52px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: 0.62; pointer-events: none; }

/* ação de linha: proposta em PDF + WhatsApp */
.btn-wa {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 12px; min-height: 44px; border-radius: 10px;
  border: 1px solid color-mix(in oklch, var(--action) 36%, transparent);
  background: var(--action-soft); color: var(--action-ink);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.06s ease;
}
.btn-wa:hover { background: color-mix(in oklch, var(--action) 26%, transparent); border-color: color-mix(in oklch, var(--action) 56%, transparent); }
.btn-wa:active { transform: translateY(1px); }
.btn-wa svg { width: 16px; height: 16px; flex: 0 0 auto; }
.btn-wa.is-sent { background: var(--ok-soft); border-color: color-mix(in oklch, var(--ok) 40%, transparent); color: var(--ok-ink); }
.btn-wa.is-busy { opacity: 0.7; pointer-events: none; }

/* ─── superfícies ────────────────────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { font-family: var(--font-display); font-size: 15.5px; font-weight: 700; }
.panel-head h2 { font-size: 16.5px; }
.panel-head p { font-size: 12.5px; color: var(--muted); }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }
.panel-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-flat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }

/* ─── grids utilitários ──────────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-2-1 { grid-template-columns: 1.6fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 1.6fr; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-top { display: flex; align-items: flex-start; gap: 12px; }
.row-wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.spacer { flex: 1 1 auto; }
.fields-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

/* ─── badges / pills ─────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.badge-ok     { background: var(--ok-soft);     color: var(--ok-ink); }
.badge-warn   { background: var(--warn-soft);   color: var(--accent-ink); }
.badge-danger { background: var(--danger-soft); color: var(--danger-ink); }
.badge-info   { background: var(--info-soft);   color: var(--info-ink); }
.badge-neutral{ background: var(--surface-2);   color: var(--muted); }
.badge-gold   { background: var(--accent);      color: var(--on-accent); }
.badge-action { background: var(--action-soft); color: var(--action-ink); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in oklch, var(--ok) 60%, transparent); animation: pulse 2.2s ease-out infinite; }
.dot-idle { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--ok) 55%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ─── KPI ────────────────────────────────────────────────────────────────── */
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-mark { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }
.kpi-mark svg { width: 20px; height: 20px; }
.kpi-mark.is-action { background: var(--action-soft); color: var(--action-ink); }
.kpi-mark.is-info { background: var(--info-soft); color: var(--info-ink); }
.kpi-mark.is-violet { background: var(--violet-soft); color: var(--violet-ink); }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-val { font-family: var(--font-display); font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.kpi-val small { font-size: 0.5em; color: var(--muted); font-weight: 600; }
.kpi-delta { font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.kpi-delta.up { color: var(--ok-ink); }
.kpi-delta.down { color: var(--danger-ink); }

/* ─── faixa de métricas compacta ─────────────────────────────────────────── */
.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.metric-cell { padding: 14px 16px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.metric-cell:last-child { border-right: 0; }
.metric-cell b { font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.metric-cell span { font-size: 12px; color: var(--muted); }

/* ─── gráfico de linha (SVG) ─────────────────────────────────────────────── */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-family: var(--font-mono); font-size: 10.5px; }
.chart .series-line { fill: none; stroke: var(--action); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart .series-area { fill: color-mix(in oklch, var(--action) 16%, transparent); }
.chart .series-line-2 { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-dasharray: 5 5; stroke-linecap: round; }
.chart .point { fill: var(--surface); stroke: var(--action); stroke-width: 2.6; }
.chart-foot { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--action); flex: 0 0 auto; }
.legend-swatch.gold { background: var(--accent); }
.legend-swatch.navy { background: var(--fg); }
.legend-swatch.info { background: var(--info); }

/* ─── barras ─────────────────────────────────────────────────────────────── */
.bars { display: flex; flex-direction: column; gap: 13px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 160px) 1fr 54px; gap: 12px; align-items: center; font-size: 13.5px; }
.bar-row .bar-label { color: var(--fg); font-weight: 500; }
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--action); }
.bar > i.gold { background: var(--accent); }
.bar > i.navy { background: var(--fg); }
.bar > i.info { background: var(--info); }
.bar-val { text-align: right; color: var(--muted); font-family: var(--font-mono); font-size: 12.5px; }

/* ─── tabela ─────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); font-weight: 500; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--row-hover); }
.table .num { text-align: right; }
.table .cell-actions { text-align: right; }
.table-wrap { overflow-x: auto; }
.table-empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 13.5px; }
.table-empty b { display: block; color: var(--fg); font-size: 14.5px; margin-bottom: 4px; }

/* células compostas */
.cell-lead { display: flex; flex-direction: column; gap: 1px; min-width: 190px; }
.cell-lead b { font-size: 13.5px; font-weight: 600; }
.cell-lead span { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.wa-link { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 12.5px; color: var(--fg); }
.wa-link svg { width: 15px; height: 15px; color: var(--action-ink); }
.wa-link:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }

/* ─── formulários ────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--fg); }
.hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; min-height: 44px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--fg); font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.select { appearance: none; background-image: none; padding-right: 36px; }
.select-wrap { position: relative; }
.select-wrap svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.input::placeholder, .textarea::placeholder { color: color-mix(in oklch, var(--muted) 82%, transparent); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 3px var(--action-soft); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.textarea { min-height: 84px; resize: vertical; }
.input-affix { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 12px; background: var(--surface); min-height: 44px; }
.input-affix:focus-within { border-color: var(--action); box-shadow: 0 0 0 3px var(--action-soft); }
.input-affix svg { width: 17px; height: 17px; color: var(--muted); flex: 0 0 auto; }
.input-affix .prefix { font-family: var(--font-mono); font-size: 13.5px; color: var(--muted); }
.input-affix input { border: 0; outline: none; background: transparent; padding: 10px 0; width: 100%; font-size: 14px; color: var(--fg); font-family: var(--font-mono); }
.field-error { font-size: 12.5px; font-weight: 600; color: var(--danger-ink); }
.field-error[hidden] { display: none; }

/* ─── seletores: multi (chips) e segmentado ──────────────────────────────── */
.pick-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 13px; min-height: 44px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-size: 13.5px; font-weight: 600; color: var(--muted);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pick input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.pick .pick-box { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--border); background: var(--surface); display: grid; place-items: center; color: transparent; flex: 0 0 auto; transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
.pick .pick-box svg { width: 11px; height: 11px; }
.pick:hover { color: var(--fg); border-color: color-mix(in oklch, var(--fg) 24%, transparent); }
.pick:has(input:checked) { color: var(--fg); background: var(--accent-soft); border-color: color-mix(in oklch, var(--accent) 40%, transparent); }
.pick:has(input:checked) .pick-box { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pick:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

.pick-grid.is-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 10px; }
.pick-card {
  position: relative; display: flex; flex-direction: column; gap: 3px;
  padding: 13px 40px 13px 14px; min-height: 44px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  text-align: left; transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.pick-card input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.pick-card b { font-size: 13.5px; font-weight: 600; }
.pick-card span { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.pick-card .pick-tick { position: absolute; top: 12px; right: 12px; width: 19px; height: 19px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--surface); display: grid; place-items: center; color: transparent; transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
.pick-card .pick-tick svg { width: 11px; height: 11px; }
.pick-card:hover { background: var(--surface-2); border-color: color-mix(in oklch, var(--fg) 22%, transparent); }
.pick-card:has(input:checked) { border-color: var(--action); background: var(--action-soft); box-shadow: 0 0 0 1px var(--action); }
.pick-card:has(input:checked) .pick-tick { background: var(--action); border-color: var(--action); color: var(--on-action); }
.pick-card:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px; }
.seg-opt {
  position: relative; flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; min-height: 44px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; color: var(--muted); white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.seg-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg-opt:hover { color: var(--fg); background: color-mix(in oklch, var(--surface) 70%, transparent); }
.seg-opt:has(input:checked) { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-sm); }
.seg-opt:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ─── switch ─────────────────────────────────────────────────────────────── */
.switch { position: relative; display: inline-flex; flex: 0 0 auto; width: 48px; height: 28px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: color-mix(in oklch, var(--muted) 34%, var(--surface)); border: 1px solid var(--border); transition: background 0.18s ease; pointer-events: none; }
.switch .thumb { position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform 0.18s ease; pointer-events: none; }
.switch input:checked ~ .track { background: var(--action); border-color: var(--action); }
.switch input:checked ~ .thumb { background: var(--on-action); transform: translateX(20px); }
.switch input:focus-visible ~ .track { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ─── abas ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 10px 14px; min-height: 44px; font-size: 13.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; background: transparent; border-inline: 0; border-top: 0; }
.tab:hover { color: var(--fg); }
.tab.is-active { color: var(--fg); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ─── feed / log / console ───────────────────────────────────────────────── */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: 0; }
.feed-mark { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.feed-mark svg { width: 17px; height: 17px; }
.feed-item b { font-size: 13.5px; font-weight: 600; }
.feed-item p { font-size: 13px; color: var(--muted); }
.feed-time { margin-left: auto; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.log { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; display: flex; flex-direction: column; gap: 2px; max-height: 420px; overflow-y: auto; }
.log-line { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; padding: 6px 9px; border-radius: 8px; }
.log-line:hover { background: var(--surface-2); }
.log-line .log-time { color: var(--muted); }

.console { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; background: var(--navy); color: var(--on-navy); border-radius: 14px; padding: 14px 15px; max-height: 264px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line-navy); }
.console-line { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; }
.console-line .c-time { color: var(--on-navy-dim); }
.console-line.ok .c-msg { color: color-mix(in oklch, var(--action) 74%, white); }
.console-line.warn .c-msg { color: color-mix(in oklch, var(--accent) 80%, white); }
.console-line.info .c-msg { color: color-mix(in oklch, var(--info) 62%, white); }

.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--action); transition: width 0.45s ease; }

/* ─── lista de fila / integração / nota ──────────────────────────────────── */
.integration { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); display: flex; flex-direction: column; }
.integration-head { display: flex; align-items: flex-start; gap: 13px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.integration-mark { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--fg); }
.integration-mark svg { width: 22px; height: 22px; }
.integration-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }

.note { display: flex; gap: 11px; padding: 13px 15px; border-radius: var(--radius); background: var(--surface-2); color: var(--muted); font-size: 13px; border: 1px solid var(--border); }
.note svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--accent-ink); }
.note b { color: var(--fg); }
.note.warn { background: var(--warn-soft); border-color: color-mix(in oklch, var(--warn) 26%, transparent); color: var(--accent-ink); }
.note.warn b { color: var(--accent-ink); }
.note.ok { background: var(--ok-soft); border-color: color-mix(in oklch, var(--ok) 26%, transparent); color: var(--ok-ink); }
.note.ok b { color: var(--ok-ink); }

/* lista de definições (resumo de parâmetros) */
.summary { display: flex; flex-direction: column; margin: 0; }
.summary-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.summary-row:last-child { border-bottom: 0; }
.summary-row dt { color: var(--muted); font-weight: 500; flex: 0 0 auto; }
.summary-row dd { margin: 0; font-weight: 600; text-align: right; min-width: 0; }
.summary-row dd.is-empty { color: var(--muted); font-weight: 500; }

/* ─── avatar ─────────────────────────────────────────────────────────────── */
.avatar { width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: 14px; flex: 0 0 auto; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.action { background: var(--action-soft); color: var(--action-ink); }

/* ─── toast / modal ──────────────────────────────────────────────────────── */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 10px; background: var(--navy); color: var(--on-navy); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500; animation: toast-in 0.2s ease; }
.toast svg { width: 18px; height: 18px; color: color-mix(in oklch, var(--action) 70%, white); flex: 0 0 auto; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.modal-scrim { position: fixed; inset: 0; z-index: 70; background: color-mix(in oklch, var(--navy) 62%, transparent); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-scrim.is-open { display: flex; }
.modal { position: relative; background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: 88vh; overflow: auto; }
.modal-head { padding: 22px 22px 0; display: flex; flex-direction: column; gap: 4px; }
.modal-head h2 { font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.modal-body { padding: 16px 22px 22px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.modal-close { position: absolute; top: 14px; right: 14px; }

/* ─── mapa de calor ──────────────────────────────────────────────────────── */
.heat-legend { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.heat-scale { display: inline-flex; gap: 3px; }
.heat-scale i { width: 26px; height: 10px; border-radius: 3px; display: block; }
.heat-scale .h1 { background: color-mix(in oklch, var(--accent) 14%, var(--surface)); }
.heat-scale .h2 { background: color-mix(in oklch, var(--accent) 28%, var(--surface)); }
.heat-scale .h3 { background: color-mix(in oklch, var(--accent) 46%, var(--surface)); }
.heat-scale .h4 { background: color-mix(in oklch, var(--accent) 68%, var(--surface)); }
.heat-scale .h5 { background: color-mix(in oklch, var(--accent) 88%, var(--surface)); }
.heat-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 12px; }
.heat-tile { border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--border); color: var(--fg); }
.heat-tile .heat-name { font-size: 13px; font-weight: 600; color: var(--fg); }
.heat-tile .heat-val { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; color: var(--fg); }
.heat-tile .heat-sub { font-size: 12px; color: var(--muted); }
.heat-tile.is-hot { background: color-mix(in oklch, var(--accent) 28%, var(--surface)); border-color: color-mix(in oklch, var(--accent) 46%, transparent); }
.heat-tile.is-warm { background: color-mix(in oklch, var(--accent) 15%, var(--surface)); }
.heat-tile.is-cool { background: var(--surface-2); }
.heat-subs { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.heat-subs span { font-size: 11.5px; color: var(--fg); opacity: 0.84; font-family: var(--font-mono); }

/* cartograma por bairro — 12 colunas; q5 = maior concentração */
.carto { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; }
.carto-tile {
  grid-column: span 3; min-height: 100px;
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  padding: 11px 12px; border-radius: 13px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--fg); font: inherit;
  transition: transform 0.12s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.carto-tile.w2 { grid-column: span 6; }
.carto-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in oklch, var(--fg) 20%, transparent); }
.carto-tile[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--fg) inset; }
.carto-tile .ct-name { font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.carto-tile .ct-val { font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; margin-top: auto; }
.carto-tile .ct-sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }
.carto-tile.q5 { background: color-mix(in oklch, var(--accent) 88%, var(--surface)); border-color: color-mix(in oklch, var(--accent) 62%, transparent); }
.carto-tile.q4 { background: color-mix(in oklch, var(--accent) 68%, var(--surface)); border-color: color-mix(in oklch, var(--accent) 48%, transparent); }
.carto-tile.q3 { background: color-mix(in oklch, var(--accent) 46%, var(--surface)); }
.carto-tile.q2 { background: color-mix(in oklch, var(--accent) 28%, var(--surface)); }
.carto-tile.q1 { background: color-mix(in oklch, var(--accent) 14%, var(--surface)); }
.carto-tile.q4 .ct-sub, .carto-tile.q5 .ct-sub { color: color-mix(in oklch, var(--fg) 84%, var(--accent)); }
.map-readout { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); flex-wrap: wrap; }
.map-readout .ro-name { font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.map-readout .ro-sub { font-size: 12px; color: var(--muted); }
.map-readout .ro-val { margin-left: auto; font-family: var(--font-display); font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.map-readout .ro-val small { font-size: 0.55em; color: var(--muted); font-weight: 600; }

/* ─── timeline de conversas (monitor da IA) ──────────────────────────────── */
.wa { display: grid; grid-template-columns: 320px minmax(0, 1fr); }
.wa-list { border-right: 1px solid var(--border); overflow-y: auto; max-height: 600px; }
.wa-item {
  display: flex; gap: 11px; align-items: flex-start; width: 100%; text-align: left;
  padding: 12px 14px; border: 0; border-bottom: 1px solid var(--border); background: transparent; font: inherit; color: inherit; cursor: pointer;
  transition: background 0.15s ease;
}
.wa-item:hover { background: var(--surface-2); }
.wa-item.is-active { background: var(--action-soft); }
.wa-item b { font-size: 13.5px; }
.wa-item p { font-size: 12.5px; color: var(--muted); }
.wa-thread { display: flex; flex-direction: column; min-width: 0; }
.wa-head { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.wa-body { flex: 1 1 auto; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 9px; background: var(--bg); min-height: 320px; max-height: 470px; }
.wa-day { align-self: center; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 10.5px; font-family: var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; border-radius: 999px; padding: 5px 12px; }
.wa-msg { max-width: 80%; display: flex; flex-direction: column; gap: 3px; }
.wa-msg .wa-text { padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; }
.wa-msg .wa-meta { display: flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); padding-inline: 3px; }
.wa-msg .wa-bot { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--action-ink); display: inline-flex; align-items: center; gap: 4px; }
.wa-msg .wa-bot svg { width: 12px; height: 12px; }
.wa-ticks { width: 15px; height: 15px; color: var(--action-ink); }
.wa-msg.in { align-self: flex-start; }
.wa-msg.in .wa-text { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.wa-msg.out { align-self: flex-end; }
.wa-msg.out .wa-text { background: color-mix(in oklch, var(--action) 22%, var(--surface)); border: 1px solid color-mix(in oklch, var(--action) 34%, transparent); border-bottom-right-radius: 5px; }
.wa-msg.out .wa-meta { justify-content: flex-end; }
.wa-system { align-self: center; max-width: 88%; text-align: center; font-size: 11.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 6px 13px; }
.wa-typing { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 10px 15px; }
.wa-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: block; animation: typing 1.1s ease-in-out infinite; }
.wa-typing i:nth-child(2) { animation-delay: 0.16s; }
.wa-typing i:nth-child(3) { animation-delay: 0.32s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
.wa-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: center; }
.wa-form .input { flex: 1 1 auto; }

/* estado do agente */
.agent-state { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.agent-state .as-mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 auto; background: var(--action-soft); color: var(--action-ink); }
.agent-state .as-mark svg { width: 21px; height: 21px; }
.agent-state.is-off .as-mark { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.agent-state b { display: block; font-size: 14px; }
.agent-state span { font-size: 12.5px; color: var(--muted); display: block; }

.script-preview { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px; font-size: 13px; line-height: 1.65; color: var(--fg); }
.script-preview .sp-label { display: block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.script-preview em { font-style: normal; color: var(--action-ink); font-weight: 600; }

/* ─── estados de foco do mapa / interações ───────────────────────────────── */
.is-hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ─── responsivo ─────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .g-3 { grid-template-columns: repeat(2, 1fr); }
  .g-2-1, .g-1-2 { grid-template-columns: 1fr; }
  .carto-tile { grid-column: span 4; }
  .carto-tile.w2 { grid-column: span 8; }
  .wa { grid-template-columns: 272px minmax(0, 1fr); }
}
@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .app-side { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 60; transform: translateX(-100%); transition: transform 0.22s ease; box-shadow: var(--shadow-lg); }
  .app-side.is-open { transform: none; }
  .side-toggle { display: grid; }
  .scrim { position: fixed; inset: 0; z-index: 55; background: color-mix(in oklch, var(--navy) 55%, transparent); display: none; border: 0; }
  .scrim.is-open { display: block; }
  .heat-grid { grid-template-columns: 1fr; }
  .wa { grid-template-columns: 1fr; }
  .wa-list { display: flex; max-height: none; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .wa-item { min-width: 240px; border-bottom: 0; border-right: 1px solid var(--border); }
  .wa-body { max-height: none; }
}
@media (max-width: 760px) {
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .fields-3 { grid-template-columns: 1fr; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-cell:nth-child(2n) { border-right: 0; }
  .metric-cell:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .bar-row { grid-template-columns: 1fr 48px; }
  .bar-row .bar-label { grid-column: 1 / -1; }
  .bar { grid-column: 1; }
  .carto { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .carto-tile, .carto-tile.w2 { grid-column: span 3; }
  .app-content { padding-inline: 16px; }
}
@media (max-width: 560px) {
  .carto-tile, .carto-tile.w2 { grid-column: span 6; }
  .metric-strip { grid-template-columns: 1fr; }
  .metric-cell { border-right: 0; border-bottom: 1px solid var(--border); }
  .metric-cell:last-child { border-bottom: 0; }
  .toast-wrap { left: 16px; right: 16px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============================================================================
   Complementos das telas internas
   Estados que faltavam para controles já usados na interface. Nenhum token
   novo: tudo deriva dos seis tokens base com color-mix().
   ========================================================================== */

/* Chips clicáveis (filtro de status da tabela de leads).
   O .badge nasceu como rótulo; como botão precisa de reset de borda, altura
   de alvo de toque e um estado de hover que AUMENTA o contraste do texto. */
.badge-btn {
  border: 0;
  min-height: 44px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.badge-btn.badge-neutral:hover {
  background: color-mix(in oklch, var(--muted) 22%, var(--surface));
  color: var(--fg);
}
.badge-btn.badge-action:hover {
  background: color-mix(in oklch, var(--action) 28%, var(--surface));
  color: var(--action-ink);
}
.badge-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Validação dos seletores de parâmetro (Tela 1) */
.pick-grid[aria-invalid="true"] {
  outline: 2px solid color-mix(in oklch, var(--danger) 52%, transparent);
  outline-offset: 5px;
  border-radius: 12px;
}
.input-affix:has(input[aria-invalid="true"]) { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* Rampa do mapa de calor no tema escuro.
   No claro a concentração sobe clareando; no escuro ela precisa subir
   escurecendo, senão o texto navy/luz do tile perde contraste. */
[data-theme="dark"] .heat-scale .h1 { background: color-mix(in oklch, var(--accent) 8%, var(--surface)); }
[data-theme="dark"] .heat-scale .h2 { background: color-mix(in oklch, var(--accent) 17%, var(--surface)); }
[data-theme="dark"] .heat-scale .h3 { background: color-mix(in oklch, var(--accent) 26%, var(--surface)); }
[data-theme="dark"] .heat-scale .h4 { background: color-mix(in oklch, var(--accent) 35%, var(--surface)); }
[data-theme="dark"] .heat-scale .h5 { background: color-mix(in oklch, var(--accent) 46%, var(--surface)); }
[data-theme="dark"] .carto-tile.q1 { background: color-mix(in oklch, var(--accent) 6%, var(--surface)); }
[data-theme="dark"] .carto-tile.q2 { background: color-mix(in oklch, var(--accent) 13%, var(--surface)); }
[data-theme="dark"] .carto-tile.q3 { background: color-mix(in oklch, var(--accent) 22%, var(--surface)); }
[data-theme="dark"] .carto-tile.q4 { background: color-mix(in oklch, var(--accent) 32%, var(--surface)); }
[data-theme="dark"] .carto-tile.q5 { background: color-mix(in oklch, var(--accent) 44%, var(--surface)); }
[data-theme="dark"] .carto-tile.q4 .ct-sub,
[data-theme="dark"] .carto-tile.q5 .ct-sub { color: color-mix(in oklch, var(--fg) 74%, var(--accent)); }

/* Painel com corpo flush (tabela, timeline) não deve estourar o raio */
.panel.clip { overflow: hidden; }

/* Em telas estreitas a barra superior quebra em duas linhas em vez de
   espremer o título da tela contra os chips de status. */
@media (max-width: 760px) {
  .app-top-inner { flex-wrap: wrap; row-gap: 8px; }
  .top-title h1 { font-size: 15.5px; }
  .top-title span { font-size: 12px; }
}
