:root {
  color-scheme: light;

  /* Tokens do Design System X1 (docs/X1_ESPECIFICACAO_TECNICA_DESIGN.md §2-3) —
     nomes mantidos (--accent, --muted, --radius-*, --shadow-*) para não quebrar
     nenhuma regra existente neste arquivo; só os VALORES e as poucas variáveis
     novas (abaixo de "Design System X1 — adições") vêm do spec.
     Fundo um pouco mais escuro que o #f7f8fa do spec (pedido do dono, 2026-11-14: os dois brancos
     ficavam parecidos demais); o trilho/realce (--surface-sunken-2) desceu junto pra não sumir. */
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface-sunken: #f0f2f5;
  --surface-sunken-2: #e6e9ee;
  --border: #e1e4ea;
  --border-strong: #c9cedb;
  --text: #14171c;
  --muted: #676e7a;
  --muted-2: #9098a4;

  --accent: #16a34a;
  --accent-hover: #34b464;
  --accent-pressed: #128a3e;
  --accent-soft: #dcfce7;
  --accent-text: #0f6b2f;
  --on-accent: #010a04;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fde2e2;
  --danger-text: #b91c1c;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --warning-text: #92400e;
  --orange: #ea580c;
  --on-warning: #ffffff;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --info-text: #1d4ed8;

  /* Design System X1 §2.1: uma única família sans em toda a interface (sem tipo de
     "display" separado) — --font-display mantido só pra não obrigar a mudar toda
     regra que já usa var(--font-display), mas aponta pra mesma pilha. */
  --font-display: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Geist", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --font-body: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Geist", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  /* Spec X1, critério 6: nenhuma fonte monoespaçada na interface — códigos, números e nomes
     técnicos usam a mesma família com números tabulares (font-variant-numeric). O nome do token
     ficou só pra não mexer em cada regra que o usa. */
  --font-mono: var(--font-body);

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(20, 23, 28, 0.06);
  --shadow-md: 0 6px 16px -4px rgba(20, 23, 28, 0.10), 0 1px 3px rgba(20, 23, 28, 0.06);

  /* Design System X1 — adições (conceitos que não existiam antes) */
  --accent-strong: #107a37; --on-accent-strong: #ffffff;
  --human: #14171c; --on-human: #ffffff;
  /* Etiquetas de atendimento humano ("Pausada" no cartão, "Você atende" na conversa) e a barra
     "Conversas pausadas" do Início: no claro saíram do preto (pedido do dono, 2026-11-14) —
     etiqueta em verde suave, barra em cinza claro. Avatar e toast continuam no --human. */
  --human-tag: #dcfce7; --on-human-tag: #0f6b2f;
  --paused-bar: #c5cbd5;
  --bubble-in: #ffffff; --bubble-in-border: #e1e4ea;
  --bubble-out: #107a37; --on-bubble-out: #ffffff; --bubble-out-meta: rgba(255, 255, 255, .9); --bubble-out-soft: rgba(255, 255, 255, .18);
  --hover-fill: linear-gradient(rgba(22, 163, 74, .07), rgba(22, 163, 74, .07));
  --pressed-fill: linear-gradient(rgba(22, 163, 74, .16), rgba(22, 163, 74, .16));
  --hover-border: rgba(22, 163, 74, .35);
  --pressed-border: rgba(22, 163, 74, .6);
  --focus-ring: 0 0 0 3px rgba(22, 163, 74, .32);
  --radius-xl: 20px;
  --card-shadow: 0 1px 0 rgba(20, 23, 28, .05), 0 3px 8px -3px rgba(20, 23, 28, .14), inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(20, 23, 28, .06);
  --card-shadow-hover: 0 1px 0 rgba(20, 23, 28, .05), 0 8px 18px -6px rgba(20, 23, 28, .18), inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(20, 23, 28, .06);
  --lift-shadow: 0 18px 36px -14px rgba(20, 23, 28, .28);
  --hairline: rgba(20, 23, 28, .06);
  --app-bg: none;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in-out: cubic-bezier(.4, 0, .2, 1);
  /* x1-tokens.css: vidro (menus, barra de ações em lote) e sombra de menu/diálogo */
  --glass-bg: linear-gradient(#ffffff, #ffffff); --glass-border: rgba(20, 23, 28, .10);
  /* Casca (menu lateral + barra do topo). No escuro é mais escura que os cartões, como na referência
     do dono (#090C12 x #111418); no claro, branca como os cartões. */
  --shell-bg: #ffffff;
  --hover-tint: rgba(22, 163, 74, .07);
  --sh-3: 0 24px 48px -12px rgba(20, 23, 28, .22), 0 2px 6px rgba(20, 23, 28, .06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}
[data-theme="dark"] { color-scheme: dark; }

/* Tema escuro: pelo sistema (prefers-color-scheme, sem escolha manual) OU pelo botão do topo
   (data-theme="dark", que também força o escuro no login). Os dois blocos precisam ter os MESMOS
   tokens: um [data-theme="dark"] só dentro do @media não vale com o sistema em modo claro (bug
   real até 2026-11-14 — escolher "escuro" no botão não fazia nada). tests/test_fase102_x1_shell.py
   confere que os dois continuam idênticos.
   Grafite-verde (7ª rodada, 2026-11-14): nem o fundo verde saturado do protótipo nem o cinza-azul
   neutro da 6ª rodada — o dono mandou 3 referências de harmonia entre verde e cinza (widget de
   bateria, painel "LittleBee", espelho com vidro) e as cores daqui saem delas (amostra de pixel):
   - base quase preta com um toque de verde (#070B09), superfícies grafite-verde (#0D1411 colunas,
     #121B16 cartões, #1A2520 realce), bordas e texto apagado cinza-esverdeados;
   - o verde aparece como LUZ: brilho suave no fundo (verde no alto à esquerda, verde-água embaixo
     à direita, como nas refs) e um verde luminoso (#2FD86F, texto escuro em cima, como os botões
     limão da ref) só nos destaques; #12854A pros sólidos com texto branco (balão, "N novas").
   Versões anteriores: verde do protótipo até 6aaa164, cinza-azul em 0dac666/ac37b8d. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070B09;
    --surface: #121B16;
    --surface-sunken: #0D1411;
    --surface-sunken-2: #1A2520;
    --border: #1F2C25;
    --border-strong: #33463B;
    --text: #F1F7F3;
    --muted: #94A69C;
    --muted-2: #6A7C72;

    --accent: #2FD86F;
    --accent-hover: #4FE288;
    --accent-pressed: #25B85C;
    --accent-soft: #0F2A1B;
    --accent-text: #5CE896;
    --on-accent: #03130A;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-soft: #341414;
    --danger-text: #f87171;
    --warning: #fbbf24;
    --warning-soft: #2e2208;
    --warning-text: #fbbf24;
    --orange: #fb923c;
    --on-warning: #1a1204;
    --info: #60a5fa;
    --info-soft: #0f1f38;
    --info-text: #60a5fa;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .04);

    --accent-strong: #12854A; --on-accent-strong: #ffffff;
    --human: #F1F7F3; --on-human: #08100C;
    --human-tag: #F1F7F3; --on-human-tag: #08100C;
    --paused-bar: #F1F7F3;
    --bubble-in: #121B16; --bubble-in-border: #1F2C25;
    --bubble-out: #12854A; --on-bubble-out: #ffffff; --bubble-out-meta: rgba(255, 255, 255, .9); --bubble-out-soft: rgba(255, 255, 255, .18);
    --hover-fill: linear-gradient(rgba(47, 216, 111, .07), rgba(47, 216, 111, .07));
    --pressed-fill: linear-gradient(rgba(47, 216, 111, .18), rgba(47, 216, 111, .18));
    --hover-border: rgba(47, 216, 111, .35);
    --pressed-border: rgba(47, 216, 111, .6);
    --focus-ring: 0 0 0 3px rgba(47, 216, 111, .32);
    --card-shadow: 0 1px 0 rgba(0, 0, 0, .55), 0 4px 10px -4px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .06), inset 0 -1px 0 rgba(0, 0, 0, .4);
    --card-shadow-hover: 0 1px 0 rgba(0, 0, 0, .55), 0 10px 22px -8px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .08), inset 0 -1px 0 rgba(0, 0, 0, .4);
    --lift-shadow: 0 18px 40px -14px rgba(0, 0, 0, .7);
    --glass-bg: linear-gradient(180deg, #15201A 0%, #111914 100%); --glass-border: rgba(170, 220, 190, .10);
    --shell-bg: #0A0F0C;
    --hover-tint: rgba(47, 216, 111, .07);
    --sh-3: 0 28px 56px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06);
    --hairline: rgba(170, 220, 190, .10);
    --app-bg:
      radial-gradient(ellipse 70% 55% at 22% 0%, rgba(47, 216, 111, .13) 0%, rgba(47, 216, 111, 0) 70%),
      radial-gradient(ellipse 55% 50% at 100% 100%, rgba(14, 195, 160, .08) 0%, rgba(14, 195, 160, 0) 70%),
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='1' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .58 0 0 0 0 .66 0 0 0 0 .61 0 0 0 .12 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070B09;
  --surface: #121B16;
  --surface-sunken: #0D1411;
  --surface-sunken-2: #1A2520;
  --border: #1F2C25;
  --border-strong: #33463B;
  --text: #F1F7F3;
  --muted: #94A69C;
  --muted-2: #6A7C72;

  --accent: #2FD86F;
  --accent-hover: #4FE288;
  --accent-pressed: #25B85C;
  --accent-soft: #0F2A1B;
  --accent-text: #5CE896;
  --on-accent: #03130A;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #341414;
  --danger-text: #f87171;
  --warning: #fbbf24;
  --warning-soft: #2e2208;
  --warning-text: #fbbf24;
  --orange: #fb923c;
  --on-warning: #1a1204;
  --info: #60a5fa;
  --info-soft: #0f1f38;
  --info-text: #60a5fa;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .04);

  --accent-strong: #12854A; --on-accent-strong: #ffffff;
  --human: #F1F7F3; --on-human: #08100C;
  --human-tag: #F1F7F3; --on-human-tag: #08100C;
  --paused-bar: #F1F7F3;
  --bubble-in: #121B16; --bubble-in-border: #1F2C25;
  --bubble-out: #12854A; --on-bubble-out: #ffffff; --bubble-out-meta: rgba(255, 255, 255, .9); --bubble-out-soft: rgba(255, 255, 255, .18);
  --hover-fill: linear-gradient(rgba(47, 216, 111, .07), rgba(47, 216, 111, .07));
  --pressed-fill: linear-gradient(rgba(47, 216, 111, .18), rgba(47, 216, 111, .18));
  --hover-border: rgba(47, 216, 111, .35);
  --pressed-border: rgba(47, 216, 111, .6);
  --focus-ring: 0 0 0 3px rgba(47, 216, 111, .32);
  --card-shadow: 0 1px 0 rgba(0, 0, 0, .55), 0 4px 10px -4px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .06), inset 0 -1px 0 rgba(0, 0, 0, .4);
  --card-shadow-hover: 0 1px 0 rgba(0, 0, 0, .55), 0 10px 22px -8px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .08), inset 0 -1px 0 rgba(0, 0, 0, .4);
  --lift-shadow: 0 18px 40px -14px rgba(0, 0, 0, .7);
  --glass-bg: linear-gradient(180deg, #15201A 0%, #111914 100%); --glass-border: rgba(170, 220, 190, .10);
  --shell-bg: #0A0F0C;
  --hover-tint: rgba(47, 216, 111, .07);
  --sh-3: 0 28px 56px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06);
  --hairline: rgba(170, 220, 190, .10);
  --app-bg:
    radial-gradient(ellipse 70% 55% at 22% 0%, rgba(47, 216, 111, .13) 0%, rgba(47, 216, 111, 0) 70%),
    radial-gradient(ellipse 55% 50% at 100% 100%, rgba(14, 195, 160, .08) 0%, rgba(14, 195, 160, 0) 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='1' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .58 0 0 0 0 .66 0 0 0 0 .61 0 0 0 .12 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  /* Especificação técnica do design X1.md §2: corpo 16/24, suavização, legibilidade e números
     tabulares (o app estava em 15px com altura de linha "normal" — achado no diff de estilos
     computados contra o protótipo renderizado). */
  font-size: 16px;
  line-height: 24px;
  background: var(--app-bg), var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}
/* x1-tokens.css (base): controles de formulário herdam a fonte da página. Sem isto o navegador
   desenha todo <button>/<select> sem fonte própria em Arial (achado real: menu "Mostrar colunas
   até" saindo em Arial em vez de Geist). Regras de componente mais abaixo sobrescrevem tamanho/peso. */
button, input, textarea, select { font: inherit; color: inherit; }
::placeholder { color: var(--muted-2); opacity: 1; }
::selection { background: var(--accent-soft); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Seleção de texto (pedido do dono, 2026-11-15): a padrão saía da cor da tela e não dava pra ver
   o que foi selecionado. Escuro: fundo branco; claro: o inverso (branco sumiria no fundo branco). */
::selection { background: #1f2a24; color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) ::selection { background: #fff; color: #0b1310; }
}
:root[data-theme="dark"] ::selection { background: #fff; color: #0b1310; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* x1-icons.js: todo ícone Lucide do protótipo usa traço 1.75 (o padrão do Lucide é 2) — exceto
   os do menu lateral, que o protótipo desenha com traço 2 (spec §3.3). */
svg.lucide { stroke-width: 1.75; }
.sidebar-link svg.lucide, .sidebar-collapse svg.lucide { stroke-width: 2; }

.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

/* Troca de tela suave (pedido do dono, 2026-11-15: "travamento quando muda de uma página para
   outra"): o navegador mantém a tela atual até a próxima estar pronta e passa de uma pra outra
   num esmaecer curto, em vez do clarão + montagem em pedaços. Menu lateral, barra do topo e barra
   de abas do celular ficam parados (mesmo nome nas duas telas). Navegador sem suporte: igual a
   antes. Quem pede menos movimento no sistema não ganha transição nenhuma. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  /* Linha fina no topo enquanto a próxima tela não chega — só aparece se demorar mais que 0,15 s. */
  .x1-nav-progress {
    position: fixed; top: 0; left: 0; right: 0; z-index: 2000; height: 2px; pointer-events: none;
    background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); visibility: hidden;
  }
  html.is-navigating .x1-nav-progress { visibility: visible; animation: x1-nav-progress 6s cubic-bezier(.1, .7, .2, 1) .15s both; }
  @keyframes x1-nav-progress { from { transform: scaleX(0); } to { transform: scaleX(.92); } }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 140ms; }
  .sidebar { view-transition-name: x1-sidebar; }
  .topbar { view-transition-name: x1-topbar; }
  .mobile-tabbar { view-transition-name: x1-tabbar; }
}

/* Menu lateral — Dashboard X1.dc.html linhas 24-71 (estilos computados a 1440×900): 288px aberto,
   80px recolhido (forçado entre 641 e 1023px), fundo de vidro, itens de 46px. */
/* sticky + altura da janela: no protótipo o menu fica parado e só o conteúdo rola (antes o menu
   subia junto com a página). A rolagem continua sendo a da janela — agent_form.html salva e
   restaura window.scrollY. */
.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  height: 100dvh;
  z-index: 20;
  width: 288px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px;
  background: var(--shell-bg);
  border-right: 1px solid var(--glass-border);
  transition: width var(--dur-slow, 320ms) var(--ease-in-out, ease);
}

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; }
.sidebar-logo { width: 36px; height: 36px; flex-shrink: 0; border-radius: 9px; display: grid; place-items: center; overflow: hidden; }
.sidebar-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sidebar-brand-text { flex: 1; display: grid; min-width: 0; }
.sidebar-brand-name { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand-sub { font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-divider { flex-shrink: 0; height: 1px; margin: 8px 4px; background: var(--border); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.sidebar-section { padding: 18px 13px 8px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.sidebar-link {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 46px;
  padding: 0 13px;
  border-radius: 11px;
  font: 500 16px/1 var(--font-body);
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.sidebar-link:hover { background-image: var(--hover-fill); color: var(--text); text-decoration: none; }
.sidebar-link:active { background-image: var(--pressed-fill); color: var(--text); }
.sidebar-icon { position: relative; display: inline-flex; flex-shrink: 0; }
.sidebar-link svg { flex-shrink: 0; width: 22px; height: 22px; }
.sidebar-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sidebar-link.is-active { background: var(--surface-sunken-2, var(--surface-sunken)); color: var(--text); font-weight: 600; }
/* Barra verde de 3px encostada na borda do menu (left:-10px = o padding do menu). Antes ficava
   cortada pelo overflow:hidden do link e nunca aparecia. */
.sidebar-link.is-active::before {
  content: ""; position: absolute; left: -10px; top: 11px; bottom: 11px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.sidebar-link .nav-alert-dot { margin-left: auto; }
.nav-new-badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px;
  background: var(--accent-strong); color: var(--on-accent-strong); font: 600 12px/1 var(--font-body); white-space: nowrap;
}
.nav-new-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--on-accent-strong); }
.nav-live-dot { width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: var(--accent); animation: x1-pulse 2.4s var(--ease-out, ease) infinite; }
.sidebar-count {
  display: none; position: absolute; top: -6px; right: -9px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--accent-strong); color: var(--on-accent-strong);
  font: 600 11px/16px var(--font-body); text-align: center;
}

.sidebar-collapse {
  display: flex; align-items: center; gap: 14px; height: 46px; padding: 0 13px; margin-top: 6px;
  border: 0; border-radius: 11px; background: transparent; color: var(--muted);
  font-size: 16px; font-weight: 500; cursor: pointer; white-space: nowrap; overflow: hidden; text-align: left;
}
.sidebar-collapse:hover { background-image: var(--hover-fill); color: var(--text); }
.sidebar-collapse-icon { display: inline-flex; flex-shrink: 0; }
.sidebar-collapse svg { flex-shrink: 0; width: 22px; height: 22px; }

/* Recolhido (botão "Recolher menu" ou tela de 641 a 1023px): só ícones; a seção "Conta" vira uma
   divisória e o selo "N novas" vira o contador sobre o ícone (protótipo). */
.sidebar.is-collapsed { width: 80px; }
.sidebar.is-collapsed .sidebar-brand-text, .sidebar.is-collapsed .sidebar-label,
.sidebar.is-collapsed .nav-new-badge, .sidebar.is-collapsed .nav-live-dot { display: none; }
.sidebar.is-collapsed .sidebar-section { height: 1px; margin: 10px 8px; padding: 0; overflow: hidden; background: var(--border); color: transparent; }
.sidebar.is-collapsed .sidebar-count { display: block; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.mobile-tabbar { display: none; }

@media (max-width: 1023px) and (min-width: 641px) {
  .sidebar { width: 80px; }
  .sidebar-brand-text, .sidebar-label, .nav-new-badge, .nav-live-dot { display: none; }
  .sidebar-section { height: 1px; margin: 10px 8px; padding: 0; overflow: hidden; background: var(--border); color: transparent; }
  .sidebar-count { display: block; }
  .sidebar-collapse { display: none; }
}

@media (max-width: 640px) {
  .sidebar { display: none; }
  .app-main { padding-bottom: 88px; }
  /* Barra de abas flutuante (protótipo): a 8px das bordas, 64px, raio 18, vidro com borda e sombra. */
  .mobile-tabbar {
    display: flex; position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 30;
    height: 64px; border-radius: 18px; border: 1px solid var(--glass-border);
    background: var(--glass-bg); box-shadow: var(--shadow-md); overflow: hidden;
  }
  .mobile-tabbar-link {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 1px 6px; color: var(--muted); text-decoration: none; font: 500 12px/12px var(--font-body); text-align: center;
  }
  .mobile-tabbar-link:hover { text-decoration: none; background-image: var(--hover-fill); }
  .mobile-tabbar-link.is-active { color: var(--text); font-weight: 600; }
  .mobile-tabbar-icon { position: relative; display: inline-flex; }
  .mobile-tabbar-link svg { width: 24px; height: 24px; }
  .mobile-tabbar-count {
    position: absolute; top: -4px; right: -10px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
    background: var(--accent-strong); color: var(--on-accent-strong); font: 600 11px/16px var(--font-body); text-align: center;
  }
.mobile-tabbar-more { border: 0; background: transparent; font-family: inherit; padding: 0; }
  .topbar { padding: 0 16px; }

  .mais-sheet-backdrop {
    position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .45);
  }
  .mais-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--border-strong);
    border-radius: 16px 16px 0 0; box-shadow: var(--shadow-md);
    display: grid; gap: 4px;
  }
  .mais-sheet-handle {
    width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong);
    margin: 0 auto 10px;
  }
  .mais-sheet-account {
    display: flex; align-items: center; gap: 12px; padding: 4px 6px 14px;
    border-bottom: 1px solid var(--border); margin-bottom: 4px;
  }
  .mais-sheet-avatar { cursor: default; flex-shrink: 0; }
  .mais-sheet-avatar:hover { opacity: 1; }
  .mais-sheet-account-text { display: grid; gap: 2px; min-width: 0; }
  .mais-sheet-account-name { font-size: 15px; font-weight: 600; color: var(--text); }
  .mais-sheet-account-plan { font-size: 13px; color: var(--muted); }
  .mais-sheet-item {
    display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 10px;
    border-radius: 9px; color: var(--text); text-decoration: none; font-size: 15px;
  }
  .mais-sheet-item:hover { background-image: var(--hover-fill); }
  .mais-sheet-item svg { width: 18px; height: 18px; flex-shrink: 0; }
  .mais-sheet[hidden], .mais-sheet-backdrop[hidden] { display: none; }
}

@media (min-width: 641px) {
  .mais-sheet, .mais-sheet-backdrop { display: none !important; }
}

/* Barra do topo — protótipo: 56px, vidro com desfoque (blur 20px, saturate 1.4), padding 0 28px. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 28px;
  background: var(--shell-bg);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.topbar-spacer { flex: 1; }
.topbar-logo { display: none; width: 38px; height: 38px; object-fit: contain; flex-shrink: 0; }
.topbar-title { margin: 0; font-size: 18px; line-height: 24px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; flex-shrink: 0; }
/* Conversas: o título é o nome do agente — nome comprido encolhe com reticências em vez de
   empurrar a busca/seletor pra fora da barra. */
.topbar-title.conv-agent-title { flex-shrink: 1; min-width: 0; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }

/* padding 0: a regra global de button (10px 18px) empurrava o ícone ~8px pra direita. */
.icon-button {
  width: 36px; height: 36px; padding: 0; border-radius: 10px; border: 0; background: transparent;
  color: var(--muted); display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
}
.icon-button:hover { background-image: var(--hover-fill); color: var(--text); }
.icon-button svg { width: 20px; height: 20px; }

.user-menu { position: relative; flex-shrink: 0; }
/* Protótipo: 34×34, fundo --human e letra --on-human (claro: grafite/branco; escuro: quase branco/verde escuro). */
.user-avatar {
  width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 0; background: var(--human); color: var(--on-human);
  display: grid; place-items: center; font: 600 13px/1 var(--font-body); cursor: pointer;
}
.user-avatar:hover { opacity: .85; }
.user-dropdown {
  position: absolute; right: 0; top: 44px; width: 220px; z-index: 60; padding: 6px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
}
.user-dropdown-label {
  padding: 8px 10px 10px; font-size: 14px; font-weight: 600; color: var(--text);
  border-bottom: 1px solid var(--border); margin-bottom: 4px; word-break: break-all;
}
.user-dropdown form { margin: 0; }
.user-dropdown-item {
  width: 100%; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px;
  border: 0; border-radius: 9px; background: transparent; font-size: 14px; color: var(--text);
  cursor: pointer; text-align: left;
}
.user-dropdown-item:hover { background-image: var(--hover-fill); }
/* "Sair" é um <button type="submit">: a regra global button[type="submit"] (0,1,1) pintava ele de
   verde cheio, diferente de "Informações" logo acima. */
.user-dropdown .user-dropdown-item { background-color: transparent; color: var(--text); }
.user-dropdown .user-dropdown-item:hover { background-color: transparent; background-image: var(--hover-fill); color: var(--text); }
.user-dropdown-item svg { width: 17px; height: 17px; flex-shrink: 0; }
button.mais-sheet-item { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; }

/* Janela "Informações" do perfil (pedido do dono, 2026-11-14): pequena e simples — prévia da foto,
   nome de exibição, sigla, cor de fundo da foto e moeda. Seletores com .profile-form na frente
   porque as regras globais de label/input/button (0,1,1) ganhariam de uma classe só. */
.profile-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .55); animation: x1-fade .18s ease-out; }
.profile-modal {
  position: fixed; z-index: 91; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(400px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 20px; border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: var(--sh-3); display: grid; gap: 16px; animation: x1-modal-in .2s var(--ease-out);
}
.profile-backdrop[hidden], .profile-modal[hidden] { display: none; }
@keyframes x1-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes x1-modal-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%); } }
.profile-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.profile-form { display: grid; gap: 16px; margin: 0; }
.profile-preview {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface-sunken); border: 1px solid var(--border);
}
.profile-preview .profile-preview-avatar { width: 52px; height: 52px; font-size: 19px; cursor: default; flex-shrink: 0; }
.profile-preview .profile-preview-avatar:hover { opacity: 1; }
.profile-preview-text { display: grid; gap: 2px; min-width: 0; }
.profile-preview-name { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-preview-sub { font-size: 13px; color: var(--muted); }
.profile-form .profile-field { display: grid; gap: 6px; margin: 0; font-size: 14px; color: var(--text); font-weight: 400; }
.profile-form .profile-label { font-size: 14px; font-weight: 500; color: var(--text); }
.profile-form .profile-hint { font-size: 13px; line-height: 18px; color: var(--muted); }
.profile-form input[type="text"], .profile-form select {
  width: 100%; height: 42px; margin: 0; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 15px;
}
.profile-form input[type="text"]:focus, .profile-form select:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.profile-select-wrap { position: relative; display: block; }
.profile-form .profile-select-wrap select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer; }
.profile-select-wrap svg { position: absolute; right: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.profile-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-form .profile-swatch { position: relative; margin: 0; display: grid; place-items: center; width: 32px; height: 32px; cursor: pointer; }
.profile-swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.profile-swatch-dot {
  width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out);
}
.profile-swatch-dot.is-default { background: var(--human); }
.profile-swatch:hover .profile-swatch-dot { transform: scale(1.08); }
.profile-swatch input:checked + .profile-swatch-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.profile-swatch input:focus-visible + .profile-swatch-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent), var(--focus-ring); }
.profile-error { margin: 0; font-size: 14px; color: var(--danger-text); }
.profile-error[hidden] { display: none; }
/* Aviso ao trocar de moeda (2026-11-15). [hidden] precisa da regra própria: o display:grid abaixo
   ganharia do [hidden] do navegador. */
.profile-currency-note {
  display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--warning-soft);
  font-size: 13px; line-height: 18px; color: var(--text);
}
.profile-currency-note[hidden] { display: none; }
.profile-currency-note-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; margin-top: 2px; }
.profile-currency-note-title svg { width: 15px; height: 15px; color: var(--warning-text); }
.profile-actions { display: flex; justify-content: flex-end; gap: 8px; }
.profile-form .profile-cancel, .profile-form .profile-save {
  height: 40px; padding: 0 16px; border-radius: 10px; font: 500 14px/1 var(--font-body); display: inline-flex; align-items: center;
}
.profile-form .profile-cancel { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.profile-form .profile-cancel:hover { background-image: var(--hover-fill); }
.profile-form .profile-save { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.profile-form .profile-save:hover { background: var(--accent-hover); }
.profile-form .profile-save:disabled { opacity: .6; cursor: progress; }
@media (prefers-reduced-motion: reduce) { .profile-backdrop, .profile-modal { animation: none; } }

.container {
  /* Design System X1 §4: a largura útil cresce com a tela e centraliza sozinha acima de
     2000px, só com padding (sem max-width nem margin) — o termo calc((100% - 2000px) / 2) é
     o que faz esse efeito, crescendo exatamente o suficiente pra sobrar 2000px de conteúdo no
     meio. SEM margin:auto de propósito: .container é item flex dentro de .app-main (coluna) —
     margin:auto ali faria encolher pro conteúdo em vez de esticar (o padding simétrico sozinho
     já centraliza, não precisa dos dois). */
  max-width: none;
  padding: 28px max(clamp(28px, 6.5vw, 240px), calc((100% - 2000px) / 2)) 72px;
}
@media (min-width: 1920px) {
  .container { padding-top: 36px; }
}
/* Celular (protótipo): recuo lateral de 16px e o logo antes do título na barra do topo. Fica
   depois das regras gerais de .container/.topbar-logo pra valer sobre elas. */
@media (max-width: 640px) {
  .container { padding: 16px 16px 24px; }
  .topbar { padding: 0 16px; } /* a regra antiga do celular ficava antes da geral e nunca valia */
  .topbar-logo { display: block; }
}

#prompt, #flow_instruction, #important_info {
  resize: both;
}

/* Escala tipografica real do X1 (DS1 Fundamentos §1.4): h1 30/34 -.02em, h2 24/30 -.015em,
   h3 18/26 -.01em — cada nivel inteiro, nao aproximado. */
h1 {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}

h2 {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 30px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}

h3 {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 16px 0 8px;
}

.center-card {
  max-width: 420px;
  margin: 60px auto 0;
  text-align: center;
}
.center-card h1 { justify-content: center; }
.center-card form { text-align: left; }

.container.container-login {
  max-width: none;
  padding: 0;
  display: flex;
  min-height: 100vh;
}

.login-box {
  width: 100%;
  max-width: 432px; /* 400px úteis (protótipo) + 16px de respiro de cada lado */
  margin: auto;
  padding: 48px 16px;
  display: grid;
  gap: 28px;
  text-align: center;
}

.login-logo { width: min(260px, 64%); margin: 0 auto; display: block; }

.login-footer {
  display: flex; justify-content: center; gap: 16px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted-2);
}
.login-footer a { color: var(--muted); }

.login-forgot { font-size: 14px; color: var(--muted); margin-top: -12px; }
.login-forgot summary { cursor: pointer; color: var(--accent-text); font-weight: 500; list-style: none; }
.login-forgot summary::-webkit-details-marker { display: none; }
.login-forgot p { margin: 8px 0 0; line-height: 1.5; }

.account-password-form { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.account-password-form input { width: 160px; margin: 0; }

.login-heading h1 { font-size: 30px; line-height: 36px; letter-spacing: -0.025em; font-weight: 600; margin: 0 0 6px; }
.login-heading p { font-size: 16px; color: var(--muted); margin: 0; }

.login-alert {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--danger-soft);
  color: var(--danger-text);
  font-size: 14px;
  text-align: left;
}

.login-box form { display: grid; gap: 16px; text-align: left; }
.login-box form label + input, .login-box form label + .login-code { margin-top: -10px; } /* rótulo a 6px do campo, como no protótipo */
.login-box label { font-size: 14px; font-weight: 500; color: var(--text); margin: 0; }
/* .login-box form input: a regra global de input (mesma especificidade, declarada depois) vencia
   e deixava o campo com 14px, raio 8 e borda fraca. */
.login-box form input {
  width: 100%;
  margin: 0;
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
}
.login-box form input:focus-visible { border-color: var(--accent); box-shadow: var(--focus-ring); outline: none; }
.login-box .login-code { text-align: center; font-size: 24px; letter-spacing: .3em; font-family: var(--font-mono); }
.login-box button[type="submit"] {
  height: 50px;
  border-radius: 12px;
  background: #ffffff;
  color: #04110a;
  font: 600 16px/1 var(--font-body);
  margin-top: 4px;
}
.login-box button[type="submit"]:hover { background: #e6e9ec; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px; /* DS2 §2.2 "Campos": padding:24px;border-radius:var(--r-lg) — valor real do cartao padrao */
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label { font-size: 13px; color: var(--muted); margin-top: 16px; font-weight: 500; }
label:first-child { margin-top: 0; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

textarea { resize: vertical; }

.textarea-card {
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}
.textarea-card:focus-within { border-color: var(--accent); }
.textarea-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-sunken);
}
.textarea-toolbar-spacer { flex: 1; }
.textarea-expand-btn {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.textarea-expand-btn:hover { background: var(--surface-sunken-2); color: var(--text); }
.textarea-card textarea {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 14px 16px;
  min-height: 180px;
  max-height: 220px;
}
.textarea-card textarea:focus { border: 0; }
.textarea-card.is-expanded textarea { max-height: 60vh; }

input[type="file"] { padding: 6px; font-size: 13px; color: var(--muted); }
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  height: 28px;
  margin-right: 10px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

input[type="text"][readonly], input[type="number"][readonly] {
  background: var(--surface-sunken);
  color: var(--muted-2);
  cursor: not-allowed;
}

/* Campo técnico manual ignorado porque um nível de inteligência está ativo (resolve_agent_runtime
   sobrescreve o valor em tempo de execução) — continua editável/enviado no form de propósito (não
   usa readonly/disabled, pra nunca apagar o valor manual do dono ao salvar com um nível ativo), só
   fica visualmente esmaecido pra não parecer que está em uso. */
input.tier-overridden, select.tier-overridden {
  background: var(--surface-sunken);
  color: var(--muted-2);
}

#chat_model, #transcription_model, #tts_model, #tts_voice, #emergency_number {
  font-family: var(--font-mono);
  font-size: 13px;
}

.field-row { display: flex; gap: 16px; }
.field-row > div { flex: 1; }

.hint { font-size: 12.5px; color: var(--muted-2); margin: 14px 0 0; line-height: 1.5; }

.form-actions { display: flex; gap: 10px; margin-top: 24px; }

button, .button, .button-secondary {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

button[type="submit"], .button {
  background: var(--accent);
  color: var(--on-accent);
}
button[type="submit"]:hover, .button:hover { background: var(--accent-hover); }

.button-secondary, button.button-secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.button-secondary:hover, button.button-secondary:hover { color: var(--text); border-color: var(--border-strong); }
.button-secondary.danger, button.button-secondary.danger { color: var(--danger-text); border-color: var(--danger-soft); }
.button-secondary.danger:hover, button.button-secondary.danger:hover { background: var(--danger-soft); border-color: var(--danger); }

/* --- Assinatura por estado + pagamento (checkout.js), página de vendas 2026-11-16 --- */
.sub-state h2 { margin-top: 0; }
.sub-state details { margin-top: 4px; }
.sub-state details > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500; color: var(--muted); padding: 8px 0;
}
.sub-state details > summary::-webkit-details-marker { display: none; }
.sub-state details > summary::after { content: "›"; transition: transform 0.15s ease; }
.sub-state details[open] > summary::after { transform: rotate(90deg); }
.sub-state details > summary:hover { color: var(--text); }
.sub-cancel > summary { color: var(--danger-text); }
.sub-plans { display: grid; gap: 10px; margin: 8px 0 16px; }

.x1co { display: grid; gap: 14px; margin-top: 16px; }
.x1co-methods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.x1co-method {
  display: flex; align-items: flex-start; gap: 10px; text-align: left;
  padding: 14px; border-radius: var(--radius-md);
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border); min-width: 0;
}
.x1co-method:hover { border-color: var(--border-strong); }
.x1co-method.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.x1co-method-text { display: grid; gap: 2px; min-width: 0; }
.x1co-method-title { font-size: 15px; }
.x1co-method-sub { font-size: 12px; color: var(--muted); line-height: 1.35; }
.x1co-method-icon { width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; }
.x1co-method-icon svg { width: 20px; height: 20px; }
.x1co-method.is-active .x1co-method-icon { background: var(--accent); color: var(--on-accent); }
.x1co-element { min-height: 8px; }
.x1co-element.is-loading { min-height: 120px; border-radius: var(--radius-md); background: var(--surface-sunken); }
.x1co-error { margin: 0; color: var(--danger-text); font-size: 14px; }
.x1co-pay { background: var(--accent); color: var(--on-accent); font-size: 16px; font-weight: 600; padding: 14px 18px; border-radius: var(--radius-md); }
.x1co-pay:hover { background: var(--accent-hover); }
.x1co-pay:disabled { opacity: 0.55; cursor: not-allowed; }
.x1co-pay.is-busy { cursor: progress; }
.x1co-note { margin: 0; font-size: 12px; color: var(--muted-2); }

button.link-button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  text-decoration: underline;
}
a.link-button { color: var(--muted); font-size: inherit; text-decoration: underline; }
a.link-button:hover { color: var(--text); }
button.link-button:hover { color: var(--text); background: none; }
button.link-button.danger { color: var(--danger-text); }
button.link-button.danger:hover { color: var(--danger-text); }

.inline { display: inline; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { margin: 0; }

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.table th, .table td {
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--hairline);
  font-size: 14px;
}

.table th { color: var(--muted); font-weight: 500; background: var(--surface-sunken); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background-image: var(--hover-fill); }
.table a { color: var(--text); font-weight: 600; font-size: 15px; }
.table-actions { display: flex; gap: 12px; }

.mono { font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
code { font-family: inherit; font-size: .95em; font-variant-numeric: tabular-nums; padding: 1px 6px; border-radius: 6px; background: var(--surface-sunken-2); color: var(--text); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}
.badge-active { background: var(--accent-soft); color: var(--accent-text); }
.badge-inactive { background: var(--surface-sunken-2); color: var(--muted); }

.empty { color: var(--muted); }
.error { color: var(--danger-text); font-size: 14px; }
.success { color: var(--accent); font-size: 14px; }
.success-hint { color: var(--accent) !important; }
.warning-hint { color: var(--danger-text) !important; }

/* Abas — protótipo (Configurações): 46px, ícone 17 + rótulo 15/500, 22px entre abas, a ativa
   na cor do texto com uma barra de 2px embaixo. */
.tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.tab-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 46px;
  margin: 0 0 -1px;
  padding: 0 4px;
  border: 0;
  background: none;
  font: 500 15px/15px var(--font-body);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease;
}
.tab-button svg { width: 17px; height: 17px; flex-shrink: 0; }
.tab-button:hover { color: var(--text); background: none; }
.tab-button.active { color: var(--text); }
.tab-button.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--text); }

/* Configurações: títulos de seção dentro dos cartões no tamanho do protótipo (17px/600). */
.container-settings .card h2 { margin: 6px 0 2px; font-size: 17px; line-height: 24px; font-weight: 600; letter-spacing: 0; }

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tab-panel[hidden] {
  display: none;
}

.subtabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.subtab-button {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.subtab-button:hover { color: var(--text); }
.subtab-button.active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--accent);
  font-weight: 600;
}

.subtab-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.subtab-panel[hidden] { display: none; }

/* Fica logo abaixo das sub-abas (Conversas/Pausadas/.../qtd.) — precisa de um respiro próprio,
   senão cola direto nos botões das sub-abas. */
.conv-select-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 12px;
}

.instances-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.instance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}
.instance-row.disabled { opacity: 0.55; }

/* Apelido em negrito, nome tecnico pequeno/mono embaixo (X1 §7.7) — não lado a lado. */
.instance-name-group { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; min-width: 0; }
.instance-label { font-weight: 600; }
.instance-name-group .hint { margin: 0; }

.qr-image { max-width: 260px; display: block; margin: 12px 0; border-radius: var(--radius-sm); }
.qr-image[hidden] { display: none; }

.meta-row { margin-top: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.meta-row-main { display: flex; gap: 8px; align-items: center; }
.meta-row-token { margin-top: 6px; }

.instance-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  flex: 1;
  font-size: 14px;
  color: var(--text);
}
.instance-check input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
.instance-check span:first-of-type { font-family: var(--font-mono); font-size: 13px; }

.webhook-status { font-size: 12px; color: var(--muted); }
.webhook-status.success { color: var(--accent); }
.webhook-status.error { color: var(--danger-text); }

.divider {
  border-top: 1px solid var(--border);
  margin: 20px 0 4px;
}

.credit-bar-track {
  position: relative;
  height: 8px;
  border-radius: 4px; /* DS2 §2.6 "Medidor de uso": 8px alto, 4px de raio — nao e um pill */
  background: var(--surface-sunken);
  margin: 8px 0 4px;
}
.credit-bar-track::after {
  content: "";
  position: absolute;
  left: 80%;
  top: -3px;
  bottom: -3px;
  width: 2px;
  border-radius: 1px;
  background: var(--border-strong);
}
.credit-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.credit-bar-fill.is-warn { background: var(--warning); }
.credit-bar-fill.is-full { background: var(--danger); }

.card + .card {
  margin-top: 16px;
}

.files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.file-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.file-row-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.file-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.file-edit-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.file-edit-form[hidden] { display: none; }
.file-row .hint { margin: 4px 0 0; }

.conversations-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.conversation-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.conversation-row .hint { margin: 4px 0 0; }
.conversation-info { flex: 1 1 auto; min-width: 0; }

.conversation-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Marcar várias conversas na lista e apagar de uma vez (em vez de uma a uma pelo menu). As caixas
   só aparecem depois de clicar em "Selecionar" (botão em .conv-select-row). */
.conv-select-box { display: none; align-items: center; flex: none; padding-top: 2px; cursor: pointer; }
.tab-panel.selecting .conv-select-box { display: flex; }

.badge-pending { background: var(--warning-soft); color: var(--warning); }

.file-upload-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.file-upload-form button { align-self: flex-start; margin-top: 6px; }

/* Switch-style toggle, replacing the bare browser checkbox for on/off settings */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-top: 16px;
  cursor: pointer;
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.switch-ui {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--border-strong);
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(20, 23, 28, 0.3);
  transition: transform 0.15s ease;
}
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-label { font-size: 14px; color: var(--text); font-weight: 500; }

/* Caixa de marcar quadrada (DS2 §2.2) — pra casos de aceite/confirmação, distinta do interruptor
   (.switch, liga/desliga) e da bolinha de seleção em massa (.round-check). */
.checkbox-row { display: inline-flex; align-items: flex-start; gap: 10px; margin-top: 16px; cursor: pointer; user-select: none; }
.checkbox-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.checkbox-box {
  position: relative;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.checkbox-input:checked + .checkbox-box { background: var(--accent); border-color: var(--accent); }
.checkbox-input:checked + .checkbox-box::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 44%;
  width: 5px;
  height: 9px;
  border: solid var(--on-accent);
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}
.checkbox-input:focus-visible + .checkbox-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.checkbox-label { font-size: 14px; color: var(--text); font-weight: 500; }

/* Linha de opção única (assinatura: "Escolha um nível") — bordered row com indicador de radio,
   em vez de reusar o interruptor (.switch), que implica liga/desliga, não escolha única. */
.tier-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.tier-option:hover { border-color: var(--border-strong); }
.tier-option.is-disabled { opacity: 0.6; cursor: not-allowed; }
.tier-option-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tier-option-dot {
  position: relative;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
}
.tier-option-input:checked + .tier-option-dot { border-color: var(--accent); }
.tier-option-input:checked + .tier-option-dot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
}
.tier-option-input:focus-visible + .tier-option-dot { outline: 2px solid var(--accent); outline-offset: 2px; }
.tier-option:has(.tier-option-input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.tier-option-text { display: flex; flex-direction: column; gap: 2px; }
.tier-option-text strong { font-size: 15px; }
.tier-option-text .hint { margin: 0; }

/* Caixa de marcar redonda, compartilhada com a lista de Conversas (.conv-check) */
.round-check {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong); /* protótipo: inset 0 0 0 1.5px var(--border-strong) */
  background: var(--surface);
  cursor: pointer;
  position: relative;
}
.round-check:checked { background: var(--accent); border-color: var(--accent); }
.round-check:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: 5px;
  height: 9px;
  border: solid var(--on-accent); /* protótipo: marca na cor --on-brand (escura), não branca */
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}
.round-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Menu de ações de cada conversa (Histórico) */
.conversation-action-select {
  width: auto;
  min-width: 190px;
  padding: 6px 10px;
  font-size: 13px;
}
.conversation-actions form[hidden] { display: none; }
.badge-completed { background: rgba(34, 160, 80, 0.14); color: var(--accent); }

/* O que o usuário ainda não viu (Histórico) */
.badge-new { background: var(--accent); color: var(--on-accent); }
.badge-updated { background: rgba(34, 160, 80, 0.14); color: var(--accent); border: 1px solid var(--accent); }
.conversation-row.is-unseen { border-left: 3px solid var(--accent); }
.subtab-new { margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; }
.inline-form { margin: 8px 0 0; }

/* Tela "Conversas" no nível principal — medidas e regras tiradas do Dashboard X1.dc.html
   renderizado (estilos computados) e da Especificação técnica do design X1.md §6. Quadro de
   trabalho de altura total, encostado no menu e na barra do topo (spec §3.3: Conversas não rola a
   página, só por dentro das colunas). */
@keyframes x1-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes x1-pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
@keyframes x1-bump { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 65% { transform: scale(.94); } 100% { transform: scale(1); } }

.container.container-conversas { padding: 0; gap: 0; }
.conversas-filter select { height: 34px; padding: 0 30px 0 12px; border-radius: 9px; font-size: 14px; }

.conversas-page { flex: 1 1 auto; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden; }
.conversas-list-col { flex: 0 0 auto; height: 100%; min-height: 0; }
#conversasLists { height: 100%; }
.conversas-panel-col { flex: 1 1 0; min-width: 440px; min-height: 0; display: flex; flex-direction: column; }
.conversas-page.has-open-conversation .conversas-panel-col { position: relative; background: var(--surface-sunken); }
.conv-no-selection { flex: 1 1 auto; display: grid; place-items: center; padding: 24px; }
.conv-empty-state { display: grid; justify-items: center; gap: 10px; text-align: center; max-width: 320px; }
.conv-empty-state-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); display: grid; place-items: center; }
.conv-empty-state-icon svg { width: 30px; height: 30px; stroke-width: 1.5; }
.conv-empty-state h3 { margin: 0; font-size: 18px; font-weight: 600; }
.conv-empty-state p { margin: 0; font-size: 15px; color: var(--muted); }
.conv-no-rows { padding: 24px 28px; }
.conv-tabbed { display: none; }

/* Pontos de cor por coluna (spec §6.1): Conversas = marca, Pausadas = humano, Pendentes = âmbar,
   Concluídas = texto terciário (nessa ordem desde 2026-11-15). */
.conv-coldot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.conv-coldot-conversas { background: var(--accent); }
.conv-coldot-pausadas { background: var(--human); }
.conv-coldot-concluidas { background: var(--muted-2); }
.conv-coldot-pendentes { background: var(--warning); }

/* Baralho de camadas (spec §6.1): LK colunas expandidas (1 a 4, padrão 1, localStorage['x1-layers']
   espelhado no cookie x1_layers), cada uma position:absolute. Desde 2026-11-15 (noite) a posição sai
   daqui, de --conv-lk (no quadro, vindo do servidor) × --i (índice da coluna) — antes era calculada
   pelo script no fim da página e as colunas apareciam empilhadas na 1ª até ele rodar. */
.conv-board {
  --conv-lk: 1; position: relative; flex-shrink: 0; height: 100%; --conv-lw: 360px; --conv-pk: 18px;
  width: calc(var(--conv-lk) * var(--conv-lw) + (4 - var(--conv-lk)) * var(--conv-pk));
  transition: width 320ms var(--ease-in-out);
}
.conv-board.is-instant, .conv-board.is-instant .conv-column { transition: none !important; }
@media (max-width: 1023px) {
  .conv-board { --conv-lw: 320px; --conv-pk: 16px; }
}
.conv-column {
  --conv-past: max(0, var(--i, 0) - var(--conv-lk) + 1); /* 0 = aberta; 1, 2… = recolhida, de trás pra frente */
  position: absolute; width: var(--conv-lw); min-height: 0;
  left: calc(min(var(--i, 0), var(--conv-lk) - 1) * var(--conv-lw) + var(--conv-past) * var(--conv-pk));
  top: calc(var(--conv-past) * 8px); bottom: calc(var(--conv-past) * 8px); z-index: calc(40 - var(--i, 0));
  display: flex; flex-direction: column;
  background: var(--surface-sunken); border-right: 1px solid var(--border); border-radius: 0;
  transition: left 320ms var(--ease-in-out), top 320ms var(--ease-in-out), bottom 320ms var(--ease-in-out), box-shadow 320ms;
}
/* Sombra lateral só na última coluna aberta (quando ainda há camadas atrás) e nas recolhidas —
   valores literais iguais nos dois temas, como no protótipo. */
.conv-column.is-front { box-shadow: 12px 0 24px -12px rgba(0, 0, 0, .45); }
.conv-column.is-collapsed { border-radius: 0 16px 16px 0; box-shadow: 8px 0 18px -8px rgba(0, 0, 0, .35); }
.conv-column-sliver { display: none; }
.conv-column.is-collapsed .conv-column-sliver {
  display: block; position: absolute; inset: 0; z-index: 20; padding: 0; border: 0;
  background: transparent; cursor: pointer; border-radius: inherit;
}
.conv-sliver-dot { display: none; }
.conv-column.is-collapsed .conv-sliver-dot {
  display: block; position: absolute; right: 5px; top: 22px; z-index: 21;
  width: 8px; height: 8px; border-radius: 50%; pointer-events: none;
}

.conv-column-head { position: relative; display: flex; align-items: center; gap: 6px; padding: 10px 10px 6px 8px; }
.conv-expand-menu { position: relative; flex: 1 1 0; min-width: 0; }
.conv-titlebtn {
  list-style: none; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px;
  border-radius: 10px; cursor: pointer; color: var(--text); min-width: 0;
}
.conv-titlebtn::-webkit-details-marker { display: none; }
.conv-titlebtn:hover, .conv-expand-menu[open] .conv-titlebtn { background-image: var(--hover-fill); }
.conv-titlebtn:active { background-image: var(--pressed-fill); }
.conv-column-title { font-size: 16px; font-weight: 600; white-space: nowrap; }
.conv-column-count { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.conv-new-pill {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px;
  background: var(--accent-strong); color: var(--on-accent-strong); font: 600 12px/1 var(--font-body); white-space: nowrap;
}
.conv-new-pill.is-bump { animation: x1-bump 650ms var(--ease-out); }
.conv-new-pill-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--on-accent-strong); }
.conv-titlebtn-spacer { flex: 1 1 0; }
.conv-titlebtn-chev { display: inline-flex; color: var(--muted); }
.conv-titlebtn-chev svg { width: 16px; height: 16px; }

.conv-layer-menu {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 40; width: 260px; padding: 6px;
  border-radius: 14px; background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: var(--sh-3); animation: x1-pop 140ms var(--ease-out);
}
.conv-layer-menu-label { padding: 6px 10px 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.conv-expand-option {
  width: 100%; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px;
  border: 0; border-radius: 9px; background: transparent; cursor: pointer; text-align: left;
  color: var(--text); font-size: 14px; font-weight: 400;
}
.conv-expand-option:hover { background-image: var(--hover-fill); }
.conv-expand-num { width: 12px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.conv-expand-label { flex: 1 1 0; font-weight: 500; }
.conv-expand-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.conv-expand-checkslot { width: 16px; display: inline-flex; color: var(--accent-text); }
.conv-expand-check { width: 16px; height: 16px; }
.conv-expand-check[hidden] { display: none; } /* CSS de autor vence [hidden] do navegador por origem, não só especificidade — achado real */

.conv-notify-bell {
  width: 38px; height: 38px; flex-shrink: 0; padding: 0; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted-2); display: grid; place-items: center; cursor: pointer;
}
.conv-notify-bell svg { width: 18px; height: 18px; }
.conv-notify-bell:hover { background-image: var(--hover-fill); }
.conv-notify-bell.is-on { color: var(--warning); }
.conv-notify-bell.is-on svg { fill: currentColor; }
.conv-mark-seen-btn {
  width: 30px; height: 30px; flex-shrink: 0; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer;
}
.conv-mark-seen-btn svg { width: 17px; height: 17px; }
.conv-mark-seen-btn:hover { background-image: var(--hover-fill); color: var(--text); }

.conv-column-actions { display: flex; align-items: center; gap: 8px; padding: 2px 18px 12px; }
.conv-select-toggle {
  height: 32px; padding: 0 12px; border: 0; border-radius: 9px; box-shadow: inset 0 0 0 1px var(--border-strong);
  background: var(--surface); color: var(--text); font: 500 13px/1 var(--font-body);
  display: flex; align-items: center; gap: 6px; cursor: pointer;
}
.conv-select-toggle svg { width: 15px; height: 15px; }
.conv-select-toggle:hover { background-image: var(--hover-fill); }
.conv-select-toggle:active { background-image: var(--pressed-fill); }
.conv-select-toggle.is-on { background: var(--surface-sunken-2); }

.conv-column-body { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 4px 10px 120px; display: flex; flex-direction: column; gap: 10px; }
.conv-col-empty { padding: 40px 16px; display: grid; justify-items: center; gap: 10px; text-align: center; }
/* "Mostrar mais" no fim de cada coluna (Conversas leve, 2026-11-15): mesma família do "Selecionar". */
.conv-more {
  display: block; width: 100%; height: 40px; margin: 4px 0 10px; padding: 0 12px; border: 0; border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--border-strong); background: var(--surface); color: var(--text);
  font: 500 14px/1 var(--font-body); cursor: pointer;
}
.conv-more:hover { background-image: var(--hover-fill); }
.conv-more:disabled { opacity: .6; cursor: progress; }
.conv-col-empty-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); color: var(--muted); display: grid; place-items: center; }
.conv-col-empty-icon svg { width: 26px; height: 26px; stroke-width: 1.5; }
.conv-col-empty p { margin: 0; font-size: 15px; color: var(--muted); max-width: 240px; }

/* Cartão de conversa (spec §6.2): grade [ponto 10px][conteúdo][hora/contagens]; o link de abrir
   (.conv-card-link) cobre o cartão por baixo e estrela/caixa/menu ficam por cima dele. */
.conv-card {
  position: relative; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px;
  padding: 12px 12px 12px 10px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--card-shadow); color: var(--text);
  transition: box-shadow 140ms, transform 140ms;
}
.conv-card.is-fresh { background-image: var(--hover-fill); border-color: var(--hover-border); }
.conv-card:hover { background-image: var(--hover-fill); border-color: var(--hover-border); box-shadow: var(--card-shadow-hover); }
.conv-card:active { background-image: var(--pressed-fill); border-color: var(--pressed-border); transform: translateY(1px); }
.conv-card.is-open { background-color: var(--surface-sunken-2); border-color: var(--accent); }
.conv-card-link { position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
/* Arrastar a conversa pra outra coluna (sem transparência, pedido do dono 2026-11-15, noite): uma
   cópia sólida do cartão segue o mouse (conversas.html), no lugar de origem fica só o contorno, e a
   coluna onde ela vai cair ganha contorno verde (na coluna recolhida, a fresta também acende). */
.conv-card.is-dragging { background: transparent; background-image: none; box-shadow: none; border: 1px dashed var(--border-strong); transform: none; }
.conv-card.is-dragging > * { visibility: hidden; }
.conv-drag-clone {
  position: fixed; left: 0; top: 0; z-index: 1000; margin: 0; pointer-events: none;
  border-color: var(--hover-border); box-shadow: var(--card-shadow-hover), 0 18px 36px -14px rgba(0, 0, 0, .5);
  transition: none; will-change: transform;
}
.conv-column.is-drop-target { box-shadow: inset 0 0 0 2px var(--accent); background-image: var(--hover-fill); }
.conv-column.is-collapsed.is-drop-target .conv-column-sliver { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.conv-card-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.conv-card .conv-dot { grid-column: 1; grid-row: 1; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: transparent; }
.conv-card .conv-dot.is-fresh { background: var(--accent); }
.conv-card .conv-select-box { grid-column: 1; grid-row: 1; position: relative; z-index: 1; align-self: start; padding-top: 0; }
.conv-card .round-check { width: 22px; height: 22px; border-width: 1.5px; }
.conversas-page.selecting .conv-select-box { display: flex; }
.conversas-page.selecting .conv-card { grid-template-columns: 22px minmax(0, 1fr) auto; }
.conversas-page.selecting .conv-card .conv-dot { display: none; }
.conversas-page.selecting .conv-card:has(.conv-check:checked) { border-color: var(--accent); }

.conv-card-main { grid-column: 2; display: grid; gap: 3px; min-width: 0; align-content: start; }
.conv-card-top { display: flex; align-items: center; gap: 4px; min-width: 0; }
.conv-card-name {
  min-width: 0; font-size: 15px; font-weight: 400; line-height: 24px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums;
}
.conv-card.is-fresh .conv-card-name { font-weight: 600; }
.conv-card.is-done .conv-card-name { color: var(--muted); }
.conv-fav-form { position: relative; z-index: 1; display: inline-flex; flex-shrink: 0; margin: 0; }
.conv-card .conv-fav-btn {
  display: inline-grid; place-items: center; width: 24px; height: 24px; margin: -3px 0; padding: 0;
  border: 0; border-radius: 7px; background: transparent; color: var(--muted-2); cursor: pointer;
}
.conv-card .conv-fav-btn svg { width: 15px; height: 15px; }
.conv-card .conv-fav-btn:hover { background: transparent; background-image: var(--hover-fill); color: var(--text); }
.conv-card .conv-fav-btn.is-favorite { color: var(--warning); }
.conv-card .conv-fav-btn.is-favorite svg { fill: currentColor; }
/* Subtítulo, hora e contagens: no protótipo vêm de um atalho `font:` que zera a altura de linha
   pra "normal" (só nome e prévia herdam os 24px do corpo) — copiado igual, senão o cartão cresce. */
.conv-card-sub { font-size: 13px; line-height: normal; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.conv-card-preview {
  font-size: 14px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.conv-card-preview:empty { display: none; }
.conv-card-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.conv-card-badges:empty { display: none; }

/* Selos (protótipo, badge()): 20px de altura, 12/500, ícone 12px traço 2.25. */
.conv-badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border: 0;
  border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap;
}
.conv-badge svg { width: 12px; height: 12px; stroke-width: 2.25; }
.conv-badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.conv-badge.badge-new { background: var(--accent-soft); color: var(--accent-text); }
.conv-badge.badge-new .conv-badge-dot { background: var(--accent); }
.conv-badge.badge-updated { background: transparent; color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent); }
.conv-badge.badge-updated .conv-badge-dot { border: 1.5px solid var(--accent); }
.conv-badge.badge-paused { background: var(--human-tag); color: var(--on-human-tag); }
.conv-badge.badge-completed { background: var(--surface-sunken-2); color: var(--muted); }
.conv-badge.badge-pending { background: var(--warning-soft); color: var(--warning-text); }
.conv-badge.badge-blocked { background: var(--danger-soft); color: var(--danger-text); }
/* Janela grátis de anúncio (fase 1, 2026-11-15): verde enquanto aberta, âmbar enquanto dá pra
   abrir (falta a 1ª resposta), vermelho se a Meta não abriu (24h sem resposta), apagado depois. */
.conv-badge.badge-fep { background: var(--accent-soft); color: var(--accent-text); }
.conv-badge.badge-fep.is-aguardando { background: var(--warning-soft); color: var(--warning-text); }
.conv-badge.badge-fep.is-perdida { background: var(--danger-soft); color: var(--danger-text); }
.conv-badge.badge-fep.is-encerrada { background: var(--surface-sunken-2); color: var(--muted); }

/* padding-bottom: o ⋯ fica preso no canto de baixo (position: absolute, abaixo) e não ocupa espaço —
   num cartão baixo (prévia de 1 linha, sem selos) ele subia por cima dos contadores. A coluna da
   direita reserva a altura dele (30px + folga). */
.conv-card-side { grid-column: 3; display: grid; justify-items: end; align-content: start; gap: 6px; padding-bottom: 28px; }
.conv-card-time { font-size: 13px; font-weight: 500; line-height: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.conv-card.is-fresh .conv-card-time { color: var(--text); }
.conv-card-counts { display: flex; gap: 8px; font-size: 12px; line-height: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.conv-count { display: flex; align-items: center; gap: 3px; }
.conv-count svg { width: 13px; height: 13px; }

/* 7px (não 8): no protótipo o ⋯ se posiciona pelo invólucro sem borda; aqui pelo cartão, que
   tem 1px de borda — 7 + 1 = os mesmos 8px da borda externa. */
/* z-index auto (não 1): com z-index o .conv-menu vira um contexto de empilhamento e prende a
   lista aberta (z 30) no nível 1 — a estrela e o ⋯ do cartão seguinte pintavam por cima do menu
   aberto (achado real no navegador). Sem z-index ele ainda fica acima do link do cartão, que vem
   antes no HTML. */
.conv-menu { position: absolute; right: 7px; bottom: 7px; }
.conv-menu summary {
  list-style: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  color: var(--muted); cursor: pointer;
}
.conv-menu summary::-webkit-details-marker { display: none; }
.conv-menu summary svg { width: 19px; height: 19px; }
.conv-menu summary:hover { background-image: var(--hover-fill); color: var(--text); }
.conv-menu-list {
  position: absolute; right: -2px; top: calc(100% + 2px); z-index: 30; width: 230px; padding: 6px;
  border-radius: 14px; background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: var(--sh-3); display: grid; animation: x1-pop 140ms var(--ease-out);
}
.conv-menu-list a, .conv-menu-list button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 14px;
  font-weight: 400; text-align: left; text-decoration: none; cursor: pointer;
}
.conv-menu-list svg { width: 17px; height: 17px; flex-shrink: 0; }
.conv-menu-list a:hover, .conv-menu-list button:hover { background: transparent; background-image: var(--hover-fill); text-decoration: none; }
.conv-menu-list form { margin: 0; }
.conv-menu-list button.danger { color: var(--danger-text); }
.conv-menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* Barra de ações em lote (protótipo BS): flutuante, centralizada embaixo, vidro. */
.conv-bulk-bar {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 75;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center;
  padding: 8px 8px 8px 16px; border-radius: 16px; background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--glass-border); box-shadow: var(--sh-3); max-width: calc(100vw - 24px);
  animation: x1-in 220ms var(--ease-out);
}
.conv-bulk-bar[hidden] { display: none; }
.conv-bulk-count { margin-right: 6px; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.conv-bulk-action {
  height: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent;
  color: var(--text); font: 500 14px/1 var(--font-body); display: flex; align-items: center; gap: 6px; cursor: pointer;
}
.conv-bulk-action svg { width: 16px; height: 16px; }
.conv-bulk-action:hover { background-image: var(--hover-fill); }
.conv-bulk-action:disabled { opacity: .45; cursor: default; background-image: none; }
.conv-bulk-action.is-danger { color: var(--danger-text); }
.conv-bulk-action.is-danger:hover:not(:disabled) { background: var(--danger-soft); background-image: none; }
.conv-bulk-cancel {
  height: 36px; padding: 0 12px; border: 0; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--border-strong);
  background: var(--surface); color: var(--text); font: 500 14px/1 var(--font-body); cursor: pointer;
}
.conv-bulk-cancel:hover { background-image: var(--hover-fill); }

/* Avisos: toast simples (fundo "humano", embaixo no centro) e cartão de chegada de mensagem
   (canto inferior direito) — protótipo, toast / push. */
.conv-toast-simple {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px;
  background: var(--human); color: var(--on-human); box-shadow: var(--sh-3);
  animation: x1-in 220ms var(--ease-out); width: max-content; max-width: calc(100vw - 24px); font-size: 15px;
}
.conv-toast-simple svg { width: 17px; height: 17px; }
a.conv-toast, a.conv-toast:hover { text-decoration: none; cursor: pointer; }
.conv-toast {
  position: fixed; right: 16px; bottom: 20px; z-index: 79; width: min(300px, calc(100vw - 32px));
  display: grid; grid-template-columns: 8px minmax(0, 1fr) 24px; gap: 10px; align-items: start;
  padding: 12px 10px 12px 14px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-md); animation: x1-in 220ms var(--ease-out);
  text-align: left; color: var(--text);
}
.conv-toast-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; }
.conv-toast-body { display: grid; gap: 2px; min-width: 0; }
.conv-toast-kicker { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.conv-toast-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-toast-text { font-size: 14px; line-height: 19px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.conv-toast-close {
  width: 24px; height: 24px; padding: 0; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted-2); display: grid; place-items: center; cursor: pointer;
}
.conv-toast-close svg { width: 14px; height: 14px; }
.conv-toast-close:hover { background-image: var(--hover-fill); color: var(--text); }

/* Busca (protótipo: barra do topo no desktop, cabeçalho da lista no celular). */
.conv-topbar-actions { display: flex; align-items: center; gap: 10px; }
.conv-search { position: relative; display: block; width: min(320px, 32vw); margin: 0; font-size: 16px; font-weight: 400; color: var(--text); }
.conv-search-icon { position: absolute; left: 11px; top: 9px; display: inline-flex; color: var(--muted); pointer-events: none; }
.conv-search-icon svg { width: 17px; height: 17px; }
.conv-search input {
  width: 100%; height: 34px; margin: 0; padding: 0 10px 0 34px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); font-size: 14px; color: var(--text);
}
.conv-search input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.conv-card[hidden] { display: none; } /* .conv-card define display:grid, que venceria o [hidden] da busca */
.conv-mobile-head { display: none; }

/* Abas do celular (protótipo): grade de 4, rótulo 500 14/16, contagem + pílula embaixo, sublinhado
   de 2px na atual. */
.conv-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.conv-tab {
  position: relative; display: grid; justify-items: center; gap: 4px; min-width: 0; padding: 8px 2px 9px;
  border: 0; border-radius: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.conv-tab:hover { background-image: var(--hover-fill); }
.conv-tab:active { background-image: var(--pressed-fill); }
.conv-tab.active { color: var(--text); }
.conv-tab.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--text); }
.conv-tab-label { max-width: 100%; font: 500 14px/16px var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-tab-meta { display: flex; align-items: center; gap: 5px; height: 18px; }
.conv-tab-count { font: 500 12px var(--font-body); color: var(--muted); font-variant-numeric: tabular-nums; }
.conv-tab-new {
  display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 6px; border-radius: 999px;
  background: var(--accent-strong); color: var(--on-accent-strong); font: 600 11px/1 var(--font-body); font-variant-numeric: tabular-nums;
}
.conv-tab-new-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--on-accent-strong); }

/* Celular (< 640px, spec §9): sem quadro de colunas — lista com sub-abas; conversa aberta em
   tela cheia; sem sino. Cabeçalho e abas fixos, só a lista rola (protótipo). */
@media (max-width: 639px) {
  .conv-board { display: none; }
  .conv-tabbed { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
  .conv-notify-bell { display: none; }
  .conv-topbar-actions { display: none; }
  .conversas-page { overflow: hidden; }
  .conversas-list-col { flex: 1 1 100%; display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: var(--surface); }
  #conversasLists { flex: 1 1 auto; height: auto; min-height: 0; display: flex; flex-direction: column; }
  .conv-mobile-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px 0; }
  .conv-search-mobile { flex: 1 1 auto; width: auto; }
  .conv-search-mobile .conv-search-icon { left: 10px; top: 10px; }
  .conv-search-mobile .conv-search-icon svg { width: 16px; height: 16px; }
  .conv-search-mobile input { height: 36px; padding: 0 10px 0 32px; background: var(--surface-sunken); font-size: 15px; }
  .conv-mobile-head .conversas-filter select { height: 36px; max-width: 34vw; }
  .conv-mark-all-mobile {
    width: 36px; height: 36px; flex-shrink: 0; padding: 0; border: 0; border-radius: 9px; background: transparent;
    color: var(--muted); display: grid; place-items: center; cursor: pointer;
  }
  .conv-mark-all-mobile svg { width: 20px; height: 20px; }
  .conv-mark-all-mobile:hover { background-image: var(--hover-fill); color: var(--text); }
  .conv-tabs { margin: 10px 16px 0; }
  .conv-tabbed .conv-column-actions { padding: 10px 16px 8px; }
  .conv-tabbed .subtab-panel { flex: 1 1 auto; min-height: 0; overflow-y: auto; gap: 10px; padding: 6px 12px 96px; }
  .conv-tabbed .conv-col-empty { padding: 48px 20px; }
  .conv-tabbed .conv-col-empty-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--surface-sunken-2); box-shadow: none; }
  .conv-tabbed .conv-col-empty-icon svg { width: 28px; height: 28px; }
  .conv-tabbed .conv-col-empty p { max-width: 260px; }
  /* Cartão no celular: prévia numa linha só, selos 3px abaixo, ⋯ a 6px da borda (5 + 1 da borda). */
  .conv-tabbed .conv-card-preview { display: block; white-space: nowrap; text-overflow: ellipsis; }
  .conv-tabbed .conv-card-badges { margin-top: 3px; }
  .conv-tabbed .conv-menu { right: 5px; }
  .conversas-panel-col { display: none; }
  .conversas-page.has-open-conversation .conversas-list-col { display: none; }
  .conversas-page.has-open-conversation .conversas-panel-col { display: flex; flex: 1 1 100%; min-width: 0; }
  .conv-bulk-bar, .conv-toast-simple { bottom: 88px; }
}

/* Conversa aberta — Dashboard X1.dc.html (seção "Conversa") e spec §7. Valores conferidos nos
   estilos computados do protótipo renderizado (1440×900): cabeçalho 60px, mensagens sem moldura
   sobre --surface-2, gaveta "Contexto" de 300px por cima do quadro e compositor de vidro embaixo. */
body:has(.container-chat) { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.container.container-chat { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; gap: 0; padding: 0; }
.container-chat:not(.container-conversas) { position: relative; background: var(--surface-sunken); }

/* Cabeçalho */
.conv-chat-head {
  flex: none; display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.conv-chat-head [hidden] { display: none !important; }
.conv-chat-back {
  display: none; width: 44px; height: 44px; margin-left: -6px; flex-shrink: 0; place-items: center;
  border-radius: 10px; color: var(--text); text-decoration: none;
}
.conv-chat-back svg { width: 26px; height: 26px; }
.conv-chat-back:hover { background-image: var(--hover-fill); }
.conv-chat-who { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
/* O nome e o avatar inteiros abrem a gaveta (no protótipo a área toda é um botão); a estrela fica
   por cima, como botão próprio. */
.conv-chat-who-hit {
  position: absolute; inset: 0; z-index: 0; margin: 0; padding: 0; border: 0; border-radius: 10px;
  background: transparent; cursor: pointer;
}
.conv-chat-who-hit:hover { background-image: var(--hover-fill); }
.conv-chat-avatar {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-sunken-2); color: var(--text); font: 600 14px/1 var(--font-body); pointer-events: none;
}
.conv-chat-avatar svg { width: 19px; height: 19px; color: var(--muted); }
.conv-chat-who-text { display: grid; min-width: 0; pointer-events: none; }
.conv-chat-name-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.conv-chat-name { font-size: 16px; font-weight: 600; line-height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-chat-sub { font: 13px var(--font-body); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-chat-fav {
  position: relative; z-index: 1; pointer-events: auto; display: inline-grid; place-items: center;
  width: 28px; height: 28px; margin: -4px 0; padding: 0; flex-shrink: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted-2); cursor: pointer;
}
.conv-chat-fav svg { width: 17px; height: 17px; }
.conv-chat-fav:hover { background-image: var(--hover-fill); color: var(--warning); }
.conv-chat-fav.is-favorite { color: var(--warning); }
.conv-chat-fav.is-favorite svg { fill: currentColor; }
.conv-chat-pills { display: flex; gap: 6px; flex-shrink: 0; }
.conv-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap;
}
.conv-pill svg { width: 13px; height: 13px; stroke-width: 2.25; }
.conv-pill.is-agent { gap: 7px; background: var(--accent-soft); color: var(--accent-text); }
.conv-pill-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: x1-pulse 2.4s var(--ease-out) infinite; }
.conv-pill.is-human { background: var(--human-tag); color: var(--on-human-tag); }
.conv-pill.is-done { background: var(--surface-sunken-2); color: var(--muted); }
.conv-pill.is-blocked { background: var(--danger-soft); color: var(--danger-text); }
.conv-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--muted); font-size: 13px; line-height: 1; white-space: nowrap;
}
.conv-chip svg { width: 13px; height: 13px; }
.conv-chip.is-warn { color: var(--warning-text); }
.conv-chip.is-closed { color: var(--danger-text); }
.conv-chip-mobile { display: none; }
.conv-chat-icon {
  width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; margin: 0; padding: 0;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none;
}
.conv-chat-icon svg { width: 19px; height: 19px; }
#contact-panel-toggle svg, .conv-chat-close svg { width: 21px; height: 21px; }
.conv-chat-icon:hover { background-image: var(--hover-fill); color: var(--text); }
.conv-chat-icon:active { background-image: var(--pressed-fill); color: var(--text); }
.conv-chat-icon.is-on { background-color: var(--surface-sunken-2); color: var(--text); }
.conv-chat-icon.is-sm { width: 32px; height: 32px; border-radius: 8px; }
.conv-chat-icon.is-sm svg { width: 17px; height: 17px; }

/* Quadro de mensagens */
.chat-body { flex: 1 1 auto; min-height: 0; display: flex; position: relative; }
.chat-main-column { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.chat {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0;
  padding: 18px 24px 12px; display: flex; flex-direction: column; gap: 6px;
}
.chat:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chat > * { flex-shrink: 0; }
.chat-date {
  align-self: center; margin: 6px 0; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-sunken-2); color: var(--muted); font-size: 13px;
}
.new-divider { display: flex; align-items: center; gap: 10px; margin: 10px 0; color: var(--accent-text); font-size: 13px; font-weight: 600; }
.new-divider::before, .new-divider::after { content: ""; flex: 1; height: 1px; background: var(--accent); }
.chat-entry { position: relative; display: flex; border-radius: 12px; transition: background-color .15s, padding .15s; }
.chat-entry.bubble-user { justify-content: flex-start; }
.chat-entry.bubble-assistant { justify-content: flex-end; }
.bubble { max-width: min(72%, 480px); min-width: 0; padding: 8px 12px; display: grid; gap: 6px; }
.bubble-user .bubble { border-radius: 18px 18px 18px 6px; background: var(--bubble-in); color: var(--text); box-shadow: inset 0 0 0 1px var(--bubble-in-border); }
.bubble-assistant .bubble { border-radius: 18px 18px 6px 18px; background: var(--bubble-out); color: var(--on-bubble-out); }
.bubble-text { margin: 0; font-size: 16px; line-height: 21px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-note { margin: 0; font-size: 13px; color: var(--muted); }
.bubble-assistant .bubble-note { color: var(--bubble-out-meta); }
.bubble-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font: 12px var(--font-body); color: var(--muted); }
.bubble-assistant .bubble-meta { color: var(--bubble-out-meta); }
.bubble-meta svg { width: 14px; height: 14px; }
.bubble-time { display: block; }
/* Mensagem que você enviou e o servidor ainda não confirmou (2026-11-15, noite): aparece na hora,
   com "Enviando…" no rodapé do balão; se falhar, "Não enviada" em vermelho com tentar de novo /
   descartar. Sem transparência: o balão é o mesmo de uma mensagem enviada. */
.bubble-status { display: inline-flex; align-items: center; gap: 4px; }
.bubble-status svg { width: 13px; height: 13px; }
.chat-entry.is-failed .bubble { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--danger); }
.chat-entry.is-failed .bubble-meta { color: var(--danger-text); }
.chat-entry.is-failed .bubble-status { display: grid; justify-items: end; gap: 2px; font-weight: 500; }
.bubble-status-line { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px; }
.bubble-status-reason { font-weight: 400; color: var(--muted); text-align: right; }
.bubble-status-reason:empty { display: none; }
.bubble-retry, .bubble-discard {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 0 0 6px; padding: 2px 8px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font: 600 12px/18px var(--font-body); cursor: pointer;
}
.bubble-retry svg { width: 12px; height: 12px; }
.bubble-retry:hover { background: var(--accent-hover); }
.bubble-discard:hover { color: var(--text); }
.bubble-discard { background: transparent; color: inherit; text-decoration: underline; font-weight: 500; }
/* Só imagem/vídeo: balão com 4px de respiro e o texto/hora recuados (protótipo). */
.bubble:has(.bubble-image) { padding: 4px; }
.bubble:has(.bubble-image) > .bubble-text, .bubble:has(.bubble-image) > .bubble-note, .bubble:has(.bubble-image) > .bubble-meta { padding: 0 8px 4px; }
.bubble > a:has(.bubble-image) { display: block; }
.bubble-image { display: block; width: 240px; max-width: 100%; max-height: 320px; object-fit: cover; border-radius: 12px; }
.bubble audio { display: block; width: 260px; max-width: 100%; height: 40px; }
.bubble-file { display: flex; align-items: center; gap: 10px; min-width: 210px; color: inherit; text-decoration: none; }
.bubble-file-icon {
  width: 36px; height: 40px; flex-shrink: 0; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-sunken-2); color: var(--muted);
}
.bubble-assistant .bubble-file-icon { background: var(--bubble-out-soft); color: var(--on-bubble-out); }
.bubble-file-icon svg { width: 20px; height: 20px; }
.bubble-file-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubble-file > svg { width: 17px; height: 17px; flex-shrink: 0; }
.chat-empty { margin: auto; color: var(--muted); font-size: 14px; text-align: center; }

/* Seleção de mensagens (apagar em lote): a bolinha só aparece no modo "Selecionar mensagens",
   à esquerda da linha, e a linha marcada ganha um fundo leve (protótipo). */
.bubble-select { display: none; position: absolute; left: 6px; top: 50%; transform: translateY(-50%); margin: 0; cursor: pointer; }
.bubble-select .round-check { width: 22px; height: 22px; }
.chat.selecting .chat-entry { padding: 3px 0 3px 40px; cursor: pointer; }
.chat.selecting .bubble-select { display: grid; place-items: center; }
.chat.selecting .chat-entry.is-picked { background: var(--hover-tint); }

/* Gaveta "Contexto" (por cima do quadro, à direita) */
.contact-panel {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 5; width: 300px; margin: 0;
  display: flex; flex-direction: column; gap: 18px; padding: 18px; overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.contact-panel[hidden] { display: none; }
.contact-panel [hidden] { display: none !important; }
.contact-panel-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.contact-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--surface-sunken); border: 1px solid var(--border);
}
.contact-card-text { display: grid; flex: 1; min-width: 0; }
.contact-card-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-card-phone { font-size: 13px; color: var(--muted); }
.contact-card-edit {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; flex-shrink: 0; margin: 0;
  border: 0; border-radius: 9px; box-shadow: inset 0 0 0 1px var(--border-strong);
  background: var(--surface); color: var(--text); font: 500 13px/1 var(--font-body); cursor: pointer;
}
.contact-card-edit svg { width: 14px; height: 14px; }
.contact-card-edit:hover { background-image: var(--hover-fill); }
.contact-name-edit { display: grid; gap: 6px; }
.contact-panel-label, .contact-pay-label { font-size: 13px; font-weight: 500; color: var(--text); }
.contact-name-row { display: flex; gap: 8px; }
.contact-name-row input { flex: 1; min-width: 0; height: 42px; margin: 0; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 15px; }
.contact-panel-section { display: grid; gap: 6px; }
.contact-panel-kicker { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
/* "Pagamento pendente" (2026-11-15, noite): no lugar do menu "Nenhuma etapa". Desligado = neutro
   com um anel; ligado = amarelo (cores de aviso do tema), com o ponto cheio. */
.contact-pending-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 42px; margin: 0; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--muted); font: 500 15px/1 var(--font-body); text-align: left; cursor: pointer;
  transition: background-color 160ms, border-color 160ms, color 160ms;
}
.contact-pending-btn:hover { background-image: var(--hover-fill); border-color: var(--hover-border); color: var(--text); }
.contact-pending-btn[hidden] { display: none; }
.contact-pending-btn:disabled { cursor: progress; }
.contact-pending-dot { width: 10px; height: 10px; flex-shrink: 0; border-radius: 50%; border: 1.5px solid currentColor; }
.contact-pending-btn.is-on { background: var(--warning-soft); border-color: var(--warning); color: var(--warning-text); font-weight: 600; }
.contact-pending-btn.is-on:hover { background-image: none; border-color: var(--warning); color: var(--warning-text); }
.contact-pending-btn.is-on .contact-pending-dot { background: var(--warning); border-color: var(--warning); }
.contact-pay-block { display: grid; gap: 8px; }
.contact-pay-btn {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; height: 42px; margin: 0;
  padding: 0 28px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--accent-text); font-size: 14px; font-weight: 500; cursor: pointer;
}
.contact-pay-btn:hover { background-image: var(--hover-fill); border-color: var(--hover-border); }
.contact-pay-btn svg { width: 16px; height: 16px; }
.contact-pay-form {
  display: grid; gap: 8px; padding: 12px; border-radius: 12px; border: 1px solid var(--accent);
  background: var(--surface); animation: x1-in 200ms var(--ease-out);
}
.contact-pay-input { position: relative; display: block; }
.contact-pay-input > span { position: absolute; left: 12px; top: 11px; font-size: 15px; line-height: 20px; color: var(--muted); }
.contact-pay-input input { width: 100%; height: 42px; margin: 0; padding: 0 12px 0 40px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 16px; }
.contact-pay-hint { font-size: 12px; color: var(--muted); }
.contact-pay-actions { display: flex; gap: 8px; justify-content: flex-end; }
.contact-ghost-btn {
  height: 36px; margin: 0; padding: 0 12px; border: 0; border-radius: 10px; background: transparent;
  color: var(--muted); font: 500 14px/1 var(--font-body); cursor: pointer;
}
.contact-ghost-btn:hover { background-image: var(--hover-fill); }
.contact-primary-btn {
  height: 36px; margin: 0; padding: 0 14px; border: 0; border-radius: 10px; background: var(--accent);
  color: var(--on-accent); font: 600 14px/1 var(--font-body); cursor: pointer;
}
.contact-primary-btn:hover { background: var(--accent-hover); }
.contact-name-row .contact-primary-btn { height: 42px; }
.contact-paid { display: flex; align-items: center; gap: 8px; }
.contact-paid-label {
  flex: 1; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-text); font-size: 15px; font-weight: 600;
}
.contact-paid-label svg { width: 17px; height: 17px; }
.contact-link-btn { margin: 0; padding: 0 4px; border: 0; background: transparent; color: var(--muted); font: 500 13px/1 var(--font-body); text-decoration: underline; cursor: pointer; }
.contact-link-btn:hover { color: var(--text); }
.contact-rows { display: grid; gap: 10px; font-size: 14px; }
.contact-row { display: flex; justify-content: space-between; gap: 8px; }
.contact-row > span:first-child { color: var(--muted); }
.contact-row strong { font-weight: 600; }
/* Bloco "Origem e custo" do painel do contato (janela grátis, fase 1) */
.contact-meta-entry { display: grid; gap: 3px; }
.contact-meta-entry strong { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; }
.contact-meta-entry strong svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }
.contact-meta-ad, .contact-meta-state { font-size: 13px; color: var(--muted); }
.contact-meta-state.is-aberta { color: var(--accent-text); }
.contact-meta-state.is-aguardando { color: var(--warning-text); }
.contact-meta-state.is-perdida { color: var(--danger-text); }
.contact-row.contact-meta-split { margin-top: -6px; }
.contact-row.contact-meta-split > span:first-child { font-size: 12px; color: var(--muted-2); }
/* Retomada grátis (janela grátis, fase 2): o valor pode ser uma frase (motivo/erro) — quebra à direita. */
.contact-row.contact-meta-retake { align-items: flex-start; gap: 12px; }
.contact-row.contact-meta-retake > span:first-child { flex: none; white-space: nowrap; }
.contact-row.contact-meta-retake > span:last-child { min-width: 0; text-align: right; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.contact-row.contact-meta-retake.is-enviada > span:last-child { color: var(--accent-text); }
.contact-row.contact-meta-retake.is-falhou > span:last-child { color: var(--danger-text); }
.contact-meta-profit strong { color: var(--accent-text); }
.contact-meta-profit.is-negative strong { color: var(--danger-text); }
.contact-meta-hint { margin: 0; font-size: 12px; line-height: 17px; color: var(--muted); }
.contact-meta-hint a { color: var(--accent-text); }
.contact-panel-feedback { margin: 0; font-size: 13px; color: var(--muted); }
.contact-panel-feedback:empty { display: none; }
.contact-block-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 42px; margin: 0; padding: 0 12px;
  border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--danger-text);
  font: 500 14px/1 var(--font-body); cursor: pointer;
}
.contact-block-btn svg { width: 17px; height: 17px; }
.contact-block-btn:hover { background: var(--danger-soft); }
.contact-block-btn.is-blocked { border-color: var(--danger); background: var(--danger-soft); }

/* Compositor (vidro, colado embaixo) */
.conv-composer {
  flex: none; margin: 0; display: flex; flex-direction: column; gap: 10px; padding: 10px 12px 12px;
  border-top: 1px solid var(--border); background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.conv-composer [hidden] { display: none !important; }
.conv-msg-bulk {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 8px 8px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); animation: x1-in 200ms var(--ease-out);
}
.conv-msg-bulk-count { flex: 1; min-width: 120px; font-size: 15px; font-weight: 600; }
.conv-msg-bulk-delete {
  display: flex; align-items: center; gap: 6px; height: 36px; margin: 0; padding: 0 14px; border: 0; border-radius: 10px;
  background: var(--danger); color: #ffffff; font: 600 14px/1 var(--font-body); cursor: pointer;
}
.conv-msg-bulk-delete svg { width: 16px; height: 16px; }
.conv-msg-bulk-delete:disabled { background: var(--surface-sunken-2); color: var(--muted-2); cursor: not-allowed; opacity: 1; }
.conv-notice {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px;
  background: var(--warning-soft); color: var(--warning-text); font-size: 14px; font-weight: 500; line-height: 20px;
}
.conv-notice svg { width: 16px; height: 16px; flex-shrink: 0; }
.conv-notice > span { flex: 1; }
.conv-notice.is-danger { background: var(--danger-soft); color: var(--danger-text); }
.conv-file-chip { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.conv-file-chip svg { width: 16px; height: 16px; }
.conv-file-chip .reply-file { margin: 0; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-composer-row { order: 1; display: flex; align-items: flex-end; gap: 8px; }
.conv-attach {
  width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border-radius: 12px;
  color: var(--muted); cursor: pointer;
}
.conv-attach svg { width: 23px; height: 23px; }
.conv-attach:hover { background-image: var(--hover-fill); color: var(--text); }
.conv-composer textarea {
  flex: 1; min-width: 0; width: auto; min-height: 44px; max-height: 140px; height: 44px; margin: 0; resize: none;
  padding: 11px 14px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 16px; line-height: 20px;
}
.conv-composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
/* .conv-composer na frente: o botão é type=submit e a regra global button[type="submit"] (0,1,1)
   pintaria ele de verde mesmo vazio. */
.conv-composer .conv-send {
  width: 44px; height: 44px; flex-shrink: 0; margin: 0; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--surface-sunken-2); color: var(--muted-2); cursor: pointer;
  transition: background-color .15s;
}
.conv-composer .conv-send svg { width: 21px; height: 21px; }
.conv-composer .conv-send.is-ready { background: var(--accent); color: var(--on-accent); }
.conv-composer .conv-send:hover { background-image: var(--hover-fill); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.conv-composer-actions { order: 2; display: flex; align-items: center; gap: 8px; margin: 0; }
.conv-act {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 6px; height: 32px; margin: 0;
  padding: 0 12px; border: 0; border-radius: 9px; font: 600 14px/1 var(--font-body); cursor: pointer;
}
.conv-act svg { width: 16px; height: 16px; }
.conv-act:hover { filter: brightness(1.07); }
.conv-act:active { filter: brightness(.92); }
.conv-act-short { display: none; }
#state-pause { background: var(--warning); color: var(--on-warning); }
#state-pause.is-resume { background: #ffffff; color: #14171c; box-shadow: inset 0 0 0 1px var(--border-strong); }
#state-complete { background: var(--accent-strong); color: var(--on-accent-strong); }
.conv-composer-spacer { flex: 1; }
.conv-window-status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.conv-window-status svg { width: 14px; height: 14px; }
.conv-window-status.is-warn { color: var(--warning-text); }
.conv-window-status.is-closed { color: var(--danger-text); }
.conv-composer-feedback { order: 3; margin: 0; font-size: 13px; color: var(--muted); }
.conv-composer-feedback:empty { display: none; }
.conv-composer textarea:disabled, .conv-composer button:disabled { opacity: .5; cursor: not-allowed; }
.conv-composer:has(textarea:disabled) .conv-attach { opacity: .5; pointer-events: none; }

/* Celular (< 640px): a conversa cobre a tela inteira (protótipo: fixed, z 45), "‹" volta, as fichas
   (quem atende, janela de 24h, etapa) descem para uma linha própria e os botões de estado sobem
   acima do campo, com rótulo curto. */
@media (max-width: 639px) {
  .conversas-page.has-open-conversation .conversas-panel-col,
  .container-chat:not(.container-conversas) {
    position: fixed; inset: 0; z-index: 45; min-width: 0;
  }
  body:has(.staging-banner) .conversas-page.has-open-conversation .conversas-panel-col,
  body:has(.staging-banner) .container-chat:not(.container-conversas) { top: var(--staging-banner-h, 44px); }
  .conv-chat-head { flex-wrap: wrap; row-gap: 0; }
  .conv-chat-back { display: grid; }
  .conv-chat-avatar, .conv-desktop-only, .conv-chat-close { display: none; }
  .conv-chat-pills {
    order: 10; flex: 1 0 100%; margin: 8px -12px -8px; padding: 8px 12px; gap: 6px;
    border-top: 1px solid var(--border); overflow-x: auto; scrollbar-width: none;
  }
  .conv-chat-pills::-webkit-scrollbar { display: none; }
  .conv-pill { height: 26px; padding: 0 10px; }
  .conv-chip-mobile { display: inline-flex; }
  .chat { padding: 18px 12px 12px; }
  .bubble { max-width: 84%; }
  .contact-panel { width: 100%; }
  .conv-composer-actions { order: 0; }
  .conv-act { height: 34px; border-radius: 12px; }
  .conv-act-long, .conv-composer-spacer, .conv-window-status { display: none !important; }
  .conv-act-short { display: inline; }
}

/* Agentes — Dashboard X1.dc.html linhas 583-610: cabeçalho com "Criar agente" e grade de cartões
   de vidro (o cartão inteiro abre o agente; estrela/menu/interruptor por cima do link). */
.agents-page { display: grid; gap: 20px; }
.agents-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.agents-head-text { display: grid; gap: 4px; }
.agents-title { margin: 0; font-size: 30px; line-height: 34px; letter-spacing: -0.02em; font-weight: 600; }
.agents-sub { margin: 0; font-size: 15px; color: var(--muted); }
.agents-create {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font: 600 15px/1 var(--font-body); text-decoration: none;
}
.agents-create:hover { background: var(--accent-hover); text-decoration: none; }
.agents-create:active { background: var(--accent-pressed); }
.agents-create svg { width: 17px; height: 17px; }
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.agent-card {
  position: relative; padding: 18px; border-radius: var(--radius-lg); display: grid; gap: 16px;
  background: var(--glass-bg); border: 1px solid var(--glass-border); transition: border-color .15s;
}
.agent-card:hover { background-image: var(--hover-fill), var(--glass-bg); border-color: var(--hover-border); }
.agent-card:active { background-image: var(--pressed-fill), var(--glass-bg); border-color: var(--pressed-border); }
.agent-card-link { position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
.agent-card-top { display: flex; gap: 12px; align-items: flex-start; }
.agent-card-icon {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text);
}
.agent-card-icon svg { width: 23px; height: 23px; }
.agent-card.is-off .agent-card-icon { background: var(--surface-sunken-2); color: var(--muted); }
.agent-card-who { flex: 1; display: grid; gap: 2px; min-width: 0; pointer-events: none; }
.agent-card-name { font-size: 16px; font-weight: 600; }
.agent-card-numbers { font: 13px var(--font-body); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-card-fresh {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  background: var(--accent-strong); color: var(--on-accent-strong); font: 600 12px/1 var(--font-body); white-space: nowrap;
}
.agent-card-fresh-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--on-accent-strong); }
.agent-card-menu { position: relative; z-index: 2; flex-shrink: 0; }
.agent-card-menu > summary {
  list-style: none; width: 26px; height: 22px; display: grid; place-items: center; border-radius: 6px;
  color: var(--muted); cursor: pointer;
}
.agent-card-menu > summary::-webkit-details-marker { display: none; }
.agent-card-menu > summary:hover { background-image: var(--hover-fill); color: var(--text); }
.agent-card-menu > summary svg { width: 18px; height: 18px; }
.agent-card-menu-list {
  position: absolute; right: 0; bottom: 30px; z-index: 10; width: 200px; padding: 6px; display: grid; gap: 2px;
  border-radius: 14px; background: var(--glass-bg); border: 1px solid var(--glass-border); box-shadow: var(--sh-3);
  animation: x1-pop 140ms var(--ease-out);
}
.agent-card-menu-list form { margin: 0; }
.agent-card-menu-list a, .agent-card-menu-list button {
  width: 100%; display: flex; align-items: center; gap: 10px; height: 36px; margin: 0; padding: 0 10px; border: 0;
  border-radius: 9px; background: transparent; color: var(--text); font: 500 14px/1 var(--font-body);
  text-decoration: none; cursor: pointer; text-align: left;
}
.agent-card-menu-list a:hover, .agent-card-menu-list button:hover { background: transparent; background-image: var(--hover-fill); text-decoration: none; }
.agent-card-menu-list svg { width: 16px; height: 16px; }
.agent-card-menu-list .is-danger { color: var(--danger-text); }
.agent-card-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 14px; border-top: 1px solid var(--border);
  color: var(--text); pointer-events: none;
}
.agent-card.is-off .agent-card-stats { color: var(--muted-2); }
.agent-card-stat { display: grid; gap: 2px; }
.agent-card-stat-value { font: 500 18px var(--font-body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.agent-card-stat-label { font-size: 13px; color: var(--muted); }
.agent-card-foot { display: flex; align-items: center; gap: 8px; }
.agent-card-status { flex: 1; display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--accent-text); pointer-events: none; }
.agent-card.is-off .agent-card-status { color: var(--muted); }
.agent-card-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: x1-pulse 2.4s var(--ease-out, ease) infinite; }
.agent-card-status-ring { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--muted-2); }
.agent-switch {
  position: relative; z-index: 2; width: 40px; height: 24px; margin: 0; padding: 0; border: 0; border-radius: 999px;
  background: var(--border-strong); cursor: pointer; transition: background-color .15s;
}
.agent-switch[aria-checked="true"] { background: var(--accent); }
.agent-switch:hover { background-image: var(--hover-fill); }
.agent-switch:disabled { opacity: .6; cursor: progress; }
.agent-switch-knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .15s var(--ease-out, ease);
}
.agent-switch[aria-checked="true"] .agent-switch-knob { left: 18px; }

/* Minha conta — Dashboard X1.dc.html linhas 866-905. */
.mc-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.mc-head { display: grid; gap: 4px; }
.mc-title { margin: 0; font-size: 30px; line-height: 34px; letter-spacing: -0.02em; font-weight: 600; }
.mc-sub { margin: 0; font-size: 16px; color: var(--muted); }
/* Os dois cartões de conexão lado a lado com a MESMA altura (pedido do dono, 2026-11-14). */
.mc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; align-items: stretch; }
.mc-card {
  margin: 0; padding: 22px; border-radius: var(--radius-xl); background: var(--glass-bg); border: 1px solid var(--glass-border);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start;
}
.mc-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mc-card-title { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; }
.mc-card-icon { width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center; background: var(--surface-sunken-2); }
.mc-card-icon svg { width: 18px; height: 18px; }
.mc-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--surface-sunken-2); color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.mc-pill.is-brand { background: var(--accent-soft); color: var(--accent-text); }
.mc-count { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Textos de configuração mais legíveis (pedido do dono, 2026-11-14 — são o passo a passo de
   conectar o número): um pouco maiores, com mais peso e mais contraste que o --muted de antes. */
.mc-desc { margin: 0; font-size: 16px; line-height: 24px; color: color-mix(in srgb, var(--text) 80%, var(--muted)); }
.mc-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; margin: 0; }
.mc-label { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.mc-field input, .mc-readonly {
  width: 100%; height: 44px; margin: 0; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 16px; font-variant-numeric: tabular-nums;
}
.mc-field input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.mc-readonly { background: var(--surface-sunken); font-size: 15px; text-overflow: ellipsis; }
.mc-hint { margin: 0; font-size: 14px; line-height: 21px; font-weight: 500; color: color-mix(in srgb, var(--text) 66%, var(--muted)); }
.mc-hint.error { color: var(--danger-text); }
.mc-hint.success { color: var(--accent-text); }
.mc-secret { position: relative; display: block; }
.mc-secret input { padding-right: 48px; }
.mc-eye {
  position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; margin: 0; padding: 0; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer;
}
.mc-eye:hover { background-image: var(--hover-fill); }
.mc-eye svg { width: 18px; height: 18px; }
.mc-primary {
  justify-self: start; display: flex; align-items: center; justify-content: center; gap: 6px; height: 42px; margin: 0;
  padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent);
  font: 600 15px/1 var(--font-body); cursor: pointer;
}
.mc-primary:hover { background: var(--accent-hover); }
.mc-primary svg { width: 16px; height: 16px; }
.mc-secondary {
  justify-self: start; display: flex; align-items: center; justify-content: center; gap: 6px; height: 42px; margin: 0;
  padding: 0 14px; border: 0; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--border-strong);
  background: var(--surface); color: var(--text); font: 500 15px/1 var(--font-body); cursor: pointer;
}
.mc-secondary:hover { background: var(--surface); background-image: var(--hover-fill); }
.mc-secondary svg { width: 16px; height: 16px; }
.mc-copy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.mc-copy-row { display: flex; gap: 8px; }
.mc-copy-row .mc-readonly { flex: 1; min-width: 0; }
.mc-copy { flex-shrink: 0; height: 44px; }
.mc-qr-area { display: grid; gap: 12px; }
.mc-qr-area[hidden] { display: none; } /* [hidden] do navegador perde pra qualquer display do CSS de autor */
/* Cartão do QR: o miolo (QR de exemplo + passos) ocupa a altura que sobra e o botão fica embaixo,
   na mesma linha do "Conectar número" do cartão ao lado. */
.mc-qr-card { display: flex; flex-direction: column; gap: 18px; }
.mc-qr-card > .mc-secondary { align-self: flex-start; }
.mc-qr-body { flex: 1 0 auto; display: flex; align-items: center; gap: 24px 28px; flex-wrap: wrap; padding: 4px 0 12px; }
.mc-qr-frame {
  position: relative; flex: 0 0 auto; width: 188px; height: 188px; padding: 14px; border-radius: 18px;
  background: var(--surface-sunken); border: 1px solid var(--border); display: grid; place-items: center;
}
.mc-qr-frame::before, .mc-qr-frame::after {
  content: ""; position: absolute; width: 22px; height: 22px; border: 2px solid var(--accent); pointer-events: none;
}
.mc-qr-frame::before { top: 8px; left: 8px; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.mc-qr-frame::after { bottom: 8px; right: 8px; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
.mc-qr-fake { width: 100%; height: 100%; display: block; opacity: .82; }
.mc-qr-fake path { fill: var(--text); }
.mc-qr-real { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; background: #fff; }
.mc-qr-tag {
  position: absolute; left: 50%; bottom: -11px; transform: translateX(-50%); height: 22px; padding: 0 10px; border-radius: 999px;
  display: inline-flex; align-items: center; background: var(--surface); border: 1px solid var(--border-strong);
  font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.mc-qr-tag[hidden] { display: none; }
.mc-qr-steps {
  flex: 1 1 200px; min-width: 0; margin: 0; padding-left: 20px; display: grid; gap: 10px;
  font-size: 15px; line-height: 22px; font-weight: 500; color: color-mix(in srgb, var(--text) 80%, var(--muted));
}
.mc-qr-steps strong { color: var(--text); font-weight: 600; }
.mc-qr-steps li::marker { color: var(--accent-text); font-weight: 700; }
.mc-card .instances-list { margin: 0; }
.mc-card .form-actions { margin-top: 16px; }

/* Notificações: "Ouvir" ao lado do interruptor do som (o botão antigo era inline-block e o ícone
   ficava desalinhado do texto, fora do quadro), colunas com espaço entre um interruptor e outro. */
.mc-notify { display: grid; gap: 12px; margin: 0; }
.mc-notify .switch { margin: 0; }
.mc-notify .switch-label { font-size: 15px; }
.mc-notify-sound { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.mc-listen { height: 38px; }
.mc-divider { height: 1px; margin: 6px 0; background: var(--border); }
.mc-notify-cols { display: flex; flex-wrap: wrap; gap: 14px 32px; }
.mc-notify .mc-primary { margin-top: 6px; }

/* Assinatura (dono) — protótipo: cartão de no máximo 772px com a coroa em fundo verde. */
.page-head-x1 { margin-bottom: 20px; }
.owner-note { max-width: 772px; }
.owner-note-row { display: flex; align-items: center; gap: 16px; }
.owner-note-icon { width: 48px; height: 48px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.owner-note-icon svg { width: 24px; height: 24px; }
.owner-note-text { display: grid; gap: 4px; font-size: 15px; line-height: 24px; color: var(--muted); }
.owner-note-text strong { font-size: 17px; font-weight: 600; color: var(--text); }

/* Agente aberto — cabeçalho do protótipo: trilha, ícone 42, nome 26px/600, status 14px e interruptor. */
.agent-crumbs { display: flex; align-items: center; gap: 6px; margin: 0 0 14px; font-size: 14px; color: var(--muted); }
.agent-crumbs a { color: var(--muted); text-decoration: none; }
.agent-crumbs a:hover { color: var(--text); }
.agent-crumbs svg { width: 14px; height: 14px; }
.agent-crumbs span { color: var(--text); font-weight: 500; }
.agent-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.agent-head .agent-card-icon.is-off-icon { background: var(--surface-sunken-2); color: var(--muted); }
.agent-head-text { display: grid; gap: 0; min-width: 0; }
.agent-head-name { font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -0.02em; }
.agent-head-status { font-size: 14px; color: var(--muted); }
.agent-head .agent-switch { margin-left: 8px; }

/* Ambiente de teste: faixa fixa pra nunca confundir com produção (ver app/staging.py) */
.staging-banner { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 20px; background: var(--warning); color: var(--on-warning); font-weight: 700; letter-spacing: 0.04em; text-align: center; }

/* Segurança: aviso fixo no topo de todo o painel e aba Segurança das Configurações */
.badge-danger { background: var(--danger); color: #fff; }
.security-banner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 24px; padding: 14px 28px; background: var(--danger); color: #fff; border-bottom: 3px solid rgba(0, 0, 0, 0.25); }
.security-banner-main { display: flex; align-items: center; gap: 14px; }
.security-banner-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--danger); font-size: 22px; font-weight: 800; line-height: 1; }
.security-banner-text { display: flex; flex-direction: column; gap: 2px; font-size: 15px; line-height: 1.35; }
.security-banner-text strong { font-size: 17px; letter-spacing: 0.04em; }
.security-banner-action { flex: none; padding: 9px 16px; border-radius: var(--radius-sm); background: #fff; color: var(--danger); font-weight: 700; font-size: 14px; text-decoration: none; }
.security-banner-action:hover { background: rgba(255, 255, 255, 0.88); }
.nav-alert-dot, .tab-alert-dot { display: inline-block; width: 9px; height: 9px; margin-left: 6px; border-radius: 50%; background: var(--danger); vertical-align: middle; box-shadow: 0 0 0 3px var(--danger-soft); }
.security-status { display: flex; gap: 20px; align-items: flex-start; padding: 24px 28px; margin-bottom: 18px; border-radius: var(--radius-lg); border: 2px solid var(--border); background: var(--surface); }
.security-status h2 { margin: 0 0 8px; font-size: 24px; }
.security-status p { margin: 0 0 8px; line-height: 1.5; }
.security-status-big { font-size: 17px; font-weight: 600; }
.security-status-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 56px; height: 56px; border-radius: 50%; font-size: 34px; font-weight: 800; line-height: 1; color: #fff; }
.security-status.alert { border-color: var(--danger); background: var(--danger-soft); }
.security-status.alert h2 { color: var(--danger-text); }
.security-status.alert .security-status-icon { background: var(--danger); }
.security-status.ok { border-color: var(--accent); background: var(--accent-soft); }
.security-status.ok h2 { color: var(--accent-hover); }
.security-status.ok .security-status-icon { background: var(--accent); }
.security-status-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; }
.security-status-actions form { margin: 0; }
.security-card { margin-bottom: 18px; }
.security-card h2 { margin-top: 0; }
.security-steps, .security-notes { margin: 0; padding-left: 22px; line-height: 1.6; }
.security-steps li, .security-notes li { margin-bottom: 8px; }
.security-table-wrap { overflow-x: auto; }
.security-table td, .security-table th { vertical-align: top; }
.security-table tr.is-alert td { background: var(--danger-soft); }
@media (max-width: 640px) {
  .security-banner { padding: 12px 14px; }
  .security-status { padding: 16px; gap: 14px; }
  .security-status-icon { width: 44px; height: 44px; font-size: 26px; }
  .security-status h2 { font-size: 20px; }
}
.nav-links a { white-space: nowrap; }
.inline-check { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; font-weight: 400; color: var(--muted); }

.tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 42px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s ease;
}
.tag-input:focus-within { border-color: var(--accent); }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.tag-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.tag-chip button {
  flex: none;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: none;
  line-height: 1;
  font-size: 15px;
  color: var(--muted-2);
  cursor: pointer;
}
.tag-chip button:hover { color: var(--danger-text); }
.tag-input input.tag-input-field {
  flex: 1;
  min-width: 160px;
  width: auto;
  border: none;
  padding: 6px 2px;
}
.tag-input input.tag-input-field:focus { border-color: transparent; }
.inline-check input { width: auto; margin: 0; }

/* Início (Design System X1 §5) */
@keyframes x1-pulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); }
  70% { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}

.inicio { display: grid; gap: 20px; }

.inicio-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.inicio-date { font-size: 14px; color: var(--muted); display: block; }
.inicio-greeting { font-size: 30px; line-height: 34px; letter-spacing: -0.02em; font-weight: 600; margin: 4px 0 0; }

.period-toggle { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-sunken-2); border-radius: 10px; }
.period-pill { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; }
.period-pill:hover { background-image: var(--hover-fill); }
.period-pill.is-selected { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* "Ao vivo" — Dashboard X1.dc.html linhas 143-163 (desktop): bloco alinhado à esquerda, rótulo de
   24px, número grande à esquerda e, à direita, a frase de 35px + os três contadores. */
.live-section {
  padding: 28px; min-height: 280px; display: grid; grid-template-columns: minmax(0, 1fr);
  align-content: center; justify-items: start; gap: 24px; overflow: hidden;
}
.live-label {
  display: flex; align-items: center; gap: 10px; text-transform: uppercase; letter-spacing: .08em;
  font-weight: 600; font-size: 24px; color: var(--accent-text);
}
.live-label-stopped { gap: 12px; color: var(--danger-text); }
.live-label-stopped svg { width: 40px; height: 40px; }
.live-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); animation: x1-pulse 2.4s var(--ease-out, ease) infinite; }

.live-row { display: flex; align-items: center; justify-content: flex-start; gap: 48px; flex-wrap: wrap; width: 100%; }
.live-counter {
  flex-shrink: 0; font-size: clamp(66px, 4.4vw, 132px); font-weight: 300; line-height: .95; letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.live-right { flex: 1 1 0; min-width: 0; display: grid; gap: 18px; justify-items: start; }
.live-caption { font-size: 35px; line-height: 1.2; color: var(--text); }
.live-counts { display: flex; flex-wrap: wrap; gap: 14px 32px; padding-top: 18px; border-top: 1px solid var(--hairline); width: 100%; }
.live-count {
  display: flex; align-items: center; gap: 10px; font: 300 36px/1 var(--font-body);
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--text);
}
.live-count-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.live-count-dot-brand { background: var(--accent); }
.live-count-dot-warn { background: var(--warning); }
.live-count-dot-muted { background: var(--muted-2); }
.live-count-label { font-size: 21px; font-weight: 400; color: var(--muted); }

@media (max-width: 640px) {
  .live-section { padding: 22px 18px; min-height: 0; justify-items: center; gap: 16px; }
  .live-label { font-size: 20px; }
  .live-dot { width: 10px; height: 10px; }
  .live-row { justify-content: center; gap: 18px; }
  .live-right { flex: 1 1 100%; justify-items: center; text-align: center; }
  .live-caption { font-size: 22px; }
}

/* Cartões de indicadores — protótipo linhas 206-232: vidro, sem "levantar" no hover; só os
   clicáveis (Conversas, Créditos) ganham o preenchimento e a borda de hover. */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; }
.kpi-card {
  padding: 16px 18px; border-radius: var(--radius-lg); background: var(--glass-bg); border: 1px solid var(--glass-border);
  /* 8ª rodada: coluna flexível — rótulo e número no alto, e a última linha (legenda, ou a barra
     no de Créditos) presa no pé. Os cartões da linha têm a altura do mais alto (ex.: legenda em 2
     linhas no "Tempo de resposta"); antes o conteúdo ficava todo no alto e sobrava uma faixa vazia
     embaixo das informações dos outros. */
  display: flex; flex-direction: column; gap: 8px; color: var(--text); text-decoration: none;
}
.kpi-card .kpi-caption { margin-top: auto; }
/* Valor vendido por período (2026-11-16): uma versão por período do seletor de Conversas
   iniciadas; só a escolhida aparece. `:not([hidden])` porque um `display` do autor venceria o
   [hidden] do navegador. */
.sales-variant:not([hidden]) { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.sales-since { display: block; opacity: .8; }
a.kpi-card:hover { background-image: var(--hover-fill), var(--glass-bg); border-color: var(--hover-border); text-decoration: none; }
a.kpi-card:active { background-image: var(--pressed-fill), var(--glass-bg); border-color: var(--pressed-border); }
.kpi-card-strong { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent-strong); box-shadow: var(--card-shadow); }
.kpi-label { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
/* Era --bubble-out-soft (branco a 18%): o rótulo "Valor vendido" ficava quase invisível. */
.kpi-card-strong .kpi-label, .kpi-card-strong .kpi-caption { color: var(--bubble-out-meta); }
.kpi-label svg { width: 16px; height: 16px; }
.kpi-value { font-size: 30px; line-height: 1; font-weight: 500; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi-card-strong .kpi-value { color: var(--on-accent-strong); }
.kpi-caption { font-size: 13px; color: var(--muted); }

.plan-usage-card { padding: 24px 28px; border-radius: var(--radius-xl); background: var(--glass-bg); border: 1px solid var(--glass-border); display: grid; gap: 12px; }
.plan-usage-header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.plan-usage-title { font-size: 18px; font-weight: 600; }
.plan-usage-amount { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plan-bar-track { position: relative; height: 26px; border-radius: 8px; background: var(--surface-sunken-2); box-shadow: inset 0 0 0 1px var(--border); }
.plan-bar-track::after {
  content: ""; position: absolute; left: 80%; top: -3px; bottom: -3px; width: 2px;
  background: var(--border-strong); border-radius: 1px;
} /* Marcador de 80% — X1_ESPECIFICACAO_TECNICA_DESIGN.md §"Uso do plano" */
.plan-bar-fill { height: 100%; background: var(--accent); border-radius: 8px; }
.plan-bar-fill.is-warn { background: var(--warning); }
.plan-bar-fill.is-full { background: var(--danger); }
.plan-usage-caption { font-size: 13px; color: var(--muted); }
.plan-split { display: grid; gap: 10px; margin-top: 4px; }
.plan-split-row { display: grid; grid-template-columns: 90px 1fr 40px; align-items: center; gap: 12px; }
.plan-split-label { font-size: 14px; color: var(--text); }
.plan-split-track { height: 8px; border-radius: 4px; background: var(--surface-sunken-2); overflow: hidden; }
.plan-split-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.plan-split-pct { font-size: 13px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* Início — grade Ao vivo + Conversas iniciadas (§5.4) */
.live-ac-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 16px; }

.ac-section { position: relative; padding: 28px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.ac-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ac-title { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 26px; letter-spacing: -0.015em; }
.ac-title svg { width: 24px; height: 24px; color: var(--muted); flex-shrink: 0; }
.ac-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.ac-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.ac-pill:hover { background-image: var(--hover-fill); color: var(--text); }
.ac-pill.is-selected { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.ac-pill-cal { padding: 0 11px; }
.ac-pill-cal svg { width: 16px; height: 16px; flex-shrink: 0; }
.ac-pill-cal-text:empty { display: none; }

/* "Conversas iniciadas" (5ª rodada, 2026-11-14): traço fino, área em degradê suave, linhas de
   grade só nos rótulos, e as pontas sumindo (máscara 0→12% / 88→100%, como no protótipo). */
.ac-chart { padding-top: 6px; }
.ac-chart[hidden] { display: none; }
.ac-plot-row { display: flex; gap: 14px; }
.ac-ticks { display: flex; flex-direction: column; justify-content: space-between; width: 48px; flex-shrink: 0; height: 160px; text-align: right; }
.ac-tick { font-size: 13px; line-height: 16px; font-weight: 500; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.ac-plot { position: relative; flex: 1; min-width: 0; height: 160px; border-bottom: 1px solid var(--hairline); }
.ac-grid { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--hairline); pointer-events: none; }
.ac-fade {
  position: absolute; inset: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
}
.ac-svg { width: 100%; height: 100%; display: block; overflow: visible; animation: x1-reveal 1.4s var(--ease-out) both; }
.ac-rise { transform-box: view-box; transform-origin: 50% 100%; animation: x1-rise 1.1s var(--ease-out) both; }
/* Linha e área do gráfico mudam de forma devagar quando um ponto muda (atualização ao vivo). */
.ac-rise path { transition: d 600ms var(--ease-out); }
.ac-labels { position: relative; height: 18px; margin: 10px 0 0 62px; }
/* Valor ao passar o mouse (2026-11-15): linha vertical, ponto e dica sobre o ponto mais próximo. */
.ac-plot { cursor: crosshair; }
.ac-hover { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.ac-hover[hidden] { display: none; }
.ac-hover-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-strong); }
.ac-hover-dot {
  position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px var(--surface); transform: translate(-50%, -50%);
}
.ac-hover-tip {
  position: absolute; transform: translate(-50%, calc(-100% - 12px)); padding: 6px 10px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-md);
  font: 500 13px/1.3 var(--font-body); color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.ac-hover-tip.is-below { transform: translate(-50%, 12px); }
.ac-hover-tip.is-left { transform: translate(-8px, calc(-100% - 12px)); }
.ac-hover-tip.is-right { transform: translate(calc(-100% + 8px), calc(-100% - 12px)); }
.ac-hover-tip.is-below.is-left { transform: translate(-8px, 12px); }
.ac-hover-tip.is-below.is-right { transform: translate(calc(-100% + 8px), 12px); }
.ac-xlabel {
  position: absolute; top: 0; transform: translateX(-50%);
  font-size: 13px; line-height: 18px; font-weight: 500; color: var(--muted-2); white-space: nowrap; font-variant-numeric: tabular-nums;
}
/* Todos centrados no próprio ponto (como no protótipo): os das pontas sobram um pouco pra fora,
   no espaço dos números à esquerda e no respiro do cartão à direita. */

/* (celular: "Conversas iniciadas" ficava escondida aqui — agora aparece, ver o bloco do celular) */

/* Início — cartão "Atividade" (pedido do dono, 2026-11-14): barras horizontais por período. Cores
   pedidas: vermelho bloqueados, branco pausadas (no tema claro vira o quase-preto do texto —
   "branco" sumiria no cartão branco), amarelo pendentes, verde mensagens recebidas. 5ª rodada:
   barras finas (6px) que somem nas duas pontas, sobre uma linha-guia de 1px, e crescem do zero ao
   abrir o Início. */
.activity-card {
  position: relative; padding: 24px 28px; border-radius: var(--radius-xl); background: var(--glass-bg); border: 1px solid var(--glass-border);
  display: grid; gap: 18px; min-width: 0;
}
.activity-title { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 26px; letter-spacing: -0.015em; }
.activity-title svg { width: 24px; height: 24px; color: var(--muted); flex-shrink: 0; }
.activity-chart { display: grid; gap: 16px; }
.activity-chart[hidden] { display: none; }
.activity-row { display: grid; grid-template-columns: minmax(120px, 210px) minmax(0, 1fr) 56px; align-items: center; gap: 18px; }
.activity-label { font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-track { position: relative; height: 18px; display: flex; align-items: center; min-width: 0; }
.activity-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--hairline); }
/* 6ª rodada (2026-11-14): 0,5px mais grossas que os 6px da 5ª ("ficou fina demais") e o degradê
   das pontas curto e bem suave — só os últimos ~16px clareiam, começando em 30% (antes sumia por
   inteiro ao longo de até 48px / 35% da barra). A barra de Créditos tinha o mesmo desenho até a
   7ª rodada, quando virou o widget de bateria (mais abaixo). */
.activity-bar {
  position: relative; display: block; height: 6.5px; border-radius: 3.25px;
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, .3) 0, #000 min(16px, 12%), #000 calc(100% - min(16px, 12%)), rgba(0, 0, 0, .3) 100%);
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, .3) 0, #000 min(16px, 12%), #000 calc(100% - min(16px, 12%)), rgba(0, 0, 0, .3) 100%);
}
/* `backwards`, não `both`: depois de crescer, a barra volta a obedecer a largura normal — assim,
   quando a tela se atualiza sozinha e o número muda, ela desliza até a largura nova (transition). */
.activity-bar { animation: x1-grow .95s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 90ms + 120ms); transition: width 600ms var(--ease-out); }
.activity-bar.is-blocked { background: var(--danger); }
.activity-bar.is-paused { background: var(--paused-bar); }
.activity-bar.is-pending { background: #eab308; }
.activity-bar.is-received { background: var(--accent); }
.activity-value { font-size: 16px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .activity-card { padding: 18px; }
  .activity-title { font-size: 20px; }
  .activity-row { grid-template-columns: 1fr 48px; gap: 4px 12px; }
  .activity-label { grid-column: 1 / -1; font-size: 14px; }
  .activity-value { font-size: 15px; }
}

/* Cartão "Créditos" do Início: o que resta, de 100% caindo com o uso — verde; laranja a partir de
   50%; vermelho a partir de 20%, com o aviso de que está acabando. 7ª rodada (2026-11-14): no
   formato do widget de bateria que o dono mandou de referência — "59% · restantes" com o número
   na cor do nível, trilho com contorno fino e o preenchimento em pílula grossa por dentro (com um
   respiro entre os dois), e uma luz da cor do nível no canto de cima à esquerda do cartão. */
.credit-card {
  --credit: var(--accent); --credit-text: var(--accent-text);
  --credit-glow: radial-gradient(130% 110% at 0% 0%, color-mix(in srgb, var(--credit) 16%, transparent) 0%, transparent 62%);
  background-image: var(--credit-glow), var(--glass-bg);
  /* 8ª rodada: coluna flexível com a barra empurrada pro pé — sem a legenda embaixo, o cartão
     tem as mesmas 3 linhas dos outros e, se outro cartão ficar mais alto (legenda em 2 linhas), a
     barra desce pro pé em vez de sobrar espaço embaixo dela (como no widget de referência). */
  display: flex; flex-direction: column;
}
.credit-card .credit-track { margin-top: auto; }
a.kpi-card.credit-card:hover { background-image: var(--hover-fill), var(--credit-glow), var(--glass-bg); }
a.kpi-card.credit-card:active { background-image: var(--pressed-fill), var(--credit-glow), var(--glass-bg); }
.credit-card.is-mid { --credit: var(--orange); --credit-text: var(--orange); }
.credit-card.is-low { --credit: var(--danger); --credit-text: var(--danger-text); }
.credit-headline { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 9px; min-width: 0; }
.credit-value { color: var(--credit-text); }
.credit-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--text); flex-shrink: 0; }
.credit-left { font-size: 18px; line-height: 1; font-weight: 500; letter-spacing: -0.01em; color: var(--text); }
/* O cartão tem ~193px de conteúdo numa tela de 1713px, mas ~145px numa de 1440px (5 cartões
   lado a lado) — "100% · restantes" quebrava a linha. O cartão mede a própria largura: estreito,
   o número e o "restantes" diminuem um pouco; mais estreito ainda (celular), "restantes" desce
   pra linha de baixo sem o ponto. */
.credit-card { container-type: inline-size; }
@container (max-width: 180px) {
  .credit-headline { gap: 4px 6px; }
  .credit-headline .credit-value { font-size: 26px; }
  .credit-left { font-size: 13px; color: var(--muted); }
}
@container (max-width: 139px) {
  .credit-dot { display: none; }
  .credit-headline { flex-direction: column; align-items: flex-start; }
}
.credit-track {
  display: block; height: 26px; padding: 3px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--muted) 55%, transparent);
}
.credit-fill {
  display: block; height: 100%; min-width: 8px; border-radius: 7px; background: var(--credit);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 0 16px -3px color-mix(in srgb, var(--credit) 70%, transparent);
  animation: x1-grow 1.1s var(--ease-out) .2s backwards; transition: width 600ms var(--ease-out);
}
/* Abaixo de 20%: "restantes" vira o aviso "acabando" com o triângulo, na mesma linha do número. */
.credit-left.credit-alert { display: inline-flex; align-items: center; gap: 5px; color: var(--danger-text); }
.credit-alert svg { width: 1em; height: 1em; flex-shrink: 0; }

/* Configurações → Preços da Meta e Minha conta → indicador do webhook novo (janela grátis, fase 1) */
.meta-prices-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.meta-prices-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.meta-prices-table td { padding: 8px; border-bottom: 1px solid var(--hairline); }
.meta-prices-table td:last-child { text-align: right; }
.meta-prices-add, .meta-rate { display: grid; gap: 4px; padding-top: 12px; margin-top: 8px; border-top: 1px solid var(--hairline); }
/* Preços por mercado e conversão por moeda (2026-11-15): tabela larga rola dentro do cartão. */
.meta-prices-scroll { overflow-x: auto; max-width: 100%; margin: 4px 0 8px; }
.meta-market-table { min-width: 620px; }
.meta-market-table td, .meta-fx-table td { vertical-align: middle; }
.meta-market-cell { min-width: 170px; }
.meta-market-name { display: block; font-weight: 500; }
.meta-market-sub { display: block; font-size: 12px; color: var(--muted); line-height: 1.35; }
.meta-fx-table td .meta-market-sub { display: inline; }
.meta-prices-table.meta-fx-table td:last-child { text-align: left; }
/* Mais específico que o input[type="text"] geral (que põe width: 100%). */
.meta-prices-table input.meta-price-input { width: 96px; max-width: 100%; height: 34px; padding: 5px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.meta-market-table td { padding: 5px 8px; }
.meta-fx-title { margin: 20px 0 4px; font-size: 15px; }
.meta-data-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
/* Minha conta: nome e botões na 1ª linha; "Recebendo dados" e a conferência embaixo, uma por linha. */
.instance-row .meta-data-status { order: 9; flex: 1 1 100%; min-width: 0; }
.meta-data-status svg { width: 15px; height: 15px; flex-shrink: 0; }
.meta-data-status.is-on { color: var(--accent-text); }
/* Conferência automática da Meta (Minha conta, 2026-11-15): linha inteira abaixo do número. */
.meta-check { order: 10; flex: 1 1 100%; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; line-height: 19px; color: var(--muted); }
.meta-check-text { display: inline-flex; align-items: flex-start; gap: 6px; flex: 1 1 260px; min-width: 0; }
.meta-check-text svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; }
.meta-check.is-ok { color: var(--accent-text); }
.meta-check.is-other, .meta-check.is-missing { color: var(--warning-text); }
.meta-check.is-error { color: var(--danger-text); }
.meta-check-actions { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.meta-check-actions [hidden] { display: none; }
.mc-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 15px; line-height: 22px; font-weight: 500; color: color-mix(in srgb, var(--text) 80%, var(--muted)); }
.mc-steps strong { color: var(--text); font-weight: 600; }
.mc-steps li::marker { color: var(--accent-text); font-weight: 700; }

/* Janela de entrada (janela grátis, fase 1, 2026-11-15): Janela grátis (7 dias) × Janela comum
   (24h) no mês, e a franquia de 1.000 grátis por número — mesma família visual de Atividade. */
.entry-card {
  position: relative; padding: 24px 28px; border-radius: var(--radius-xl); background: var(--glass-bg);
  border: 1px solid var(--glass-border); display: grid; gap: 18px; min-width: 0;
}
.entry-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.entry-sub { font-size: 14px; color: var(--muted); }
.entry-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
/* Seletor de período (2026-11-15): um quadro por período; o [hidden] do navegador perderia pro
   display:grid acima (mesma regra de origem) — por isso a linha própria. */
.entry-cols[hidden] { display: none; }
.entry-intro { margin: 0; font-size: 13px; line-height: 19px; color: var(--muted); max-width: 900px; }
.entry-intro strong { color: var(--text); font-weight: 600; }
.entry-src { font-size: 11.5px; line-height: 15px; color: var(--muted-2); }
.entry-col {
  display: grid; gap: 4px; align-content: start; padding: 16px 18px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--surface-sunken); min-width: 0;
}
.entry-col.is-gratis {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background-image: radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--accent) 12%, transparent) 0%, transparent 60%);
}
.entry-col-title { font-size: 15px; font-weight: 600; }
.entry-col.is-gratis .entry-col-title { color: var(--accent-text); }
.entry-col-sub { font-size: 13px; color: var(--muted); }
.entry-stats { margin: 10px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.entry-stats > div { display: grid; gap: 2px; min-width: 0; }
.entry-stats dt { font-size: 12px; color: var(--muted); }
.entry-stats dd {
  margin: 0; font-size: 20px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.entry-stats dd small { font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.entry-stat-profit dd { color: var(--accent-text); }
.entry-stat-profit.is-negative dd { color: var(--danger-text); } /* prejuízo nunca em verde */
.entry-note { margin: 0; font-size: 13px; color: var(--muted); }
.entry-retakes { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.entry-retakes svg { width: 14px; height: 14px; flex: none; }
.franchise { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.franchise-row {
  --credit: var(--accent); display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr) auto;
  align-items: center; gap: 14px;
}
.franchise-row.is-mid { --credit: var(--orange); }
.franchise-row.is-low { --credit: var(--danger); }
.franchise-name { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.franchise-row .franchise-track { height: 18px; padding: 2px; border-radius: 8px; }
.franchise-row .franchise-track .credit-fill { border-radius: 5px; }
.franchise-text { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Entrada dos gráficos (protótipo: x1-reveal) — toda vez que o Início abre, e de novo ao trocar o
   período (o gráfico escondido volta a animar quando aparece). */
@keyframes x1-reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes x1-rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes x1-grow { from { width: 0; } }
.plan-bar-fill, .plan-split-fill { animation: x1-grow 1.1s var(--ease-out) .25s backwards; transition: width 600ms var(--ease-out); }
@media (prefers-reduced-motion: reduce) {
  .ac-svg, .ac-rise, .activity-bar, .credit-fill { animation: none; }
  .plan-bar-fill, .plan-split-fill { animation: none; }
  .activity-bar, .credit-fill, .plan-bar-fill, .plan-split-fill, .ac-rise path { transition: none; }
}

/* Calendário do seletor de período (último botão): escolhe um intervalo de dias, até 1 ano. */
.x1-cal {
  position: absolute; z-index: 40; width: 304px; max-width: calc(100% - 16px); padding: 14px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--sh-3);
  display: grid; gap: 8px; animation: x1-in .16s var(--ease-out);
}
.x1-cal[hidden] { display: none; }
.x1-cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.x1-cal-month { font-size: 15px; font-weight: 600; }
.x1-cal-month::first-letter { text-transform: uppercase; }
.x1-cal .x1-cal-nav {
  width: 32px; height: 32px; padding: 0; border-radius: 9px; background: transparent; color: var(--muted);
  display: grid; place-items: center;
}
.x1-cal .x1-cal-nav:hover:not(:disabled) { background-image: var(--hover-fill); color: var(--text); }
.x1-cal .x1-cal-nav:disabled { opacity: .35; cursor: default; }
.x1-cal-nav svg { width: 18px; height: 18px; }
.x1-cal-week, .x1-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.x1-cal-week span { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted-2); padding: 2px 0 4px; }
.x1-cal-grid { row-gap: 2px; }
.x1-cal .x1-cal-day {
  height: 36px; padding: 0; border-radius: 10px; background: transparent; color: var(--text);
  font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums;
}
.x1-cal .x1-cal-day:hover:not(:disabled) { background-image: var(--hover-fill); }
.x1-cal .x1-cal-day.is-today { box-shadow: inset 0 0 0 1px var(--border-strong); }
.x1-cal .x1-cal-day.is-in-range { background: var(--accent-soft); color: var(--accent-text); border-radius: 0; }
.x1-cal .x1-cal-day.is-start, .x1-cal .x1-cal-day.is-end { background: var(--accent); color: var(--on-accent); font-weight: 600; box-shadow: none; }
.x1-cal .x1-cal-day:disabled { color: var(--muted-2); opacity: .45; cursor: default; }
.x1-cal-foot { display: grid; gap: 10px; padding-top: 10px; margin-top: 2px; border-top: 1px solid var(--border); }
.x1-cal-range { font-size: 13px; line-height: 18px; color: var(--muted); min-height: 18px; }
.x1-cal-range.is-error { color: var(--danger-text); }
.x1-cal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.x1-cal .x1-cal-cancel, .x1-cal .x1-cal-apply { height: 34px; padding: 0 14px; border-radius: 9px; font-size: 14px; font-weight: 500; }
.x1-cal .x1-cal-cancel { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.x1-cal .x1-cal-cancel:hover { background-image: var(--hover-fill); }
.x1-cal .x1-cal-apply { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.x1-cal .x1-cal-apply:hover:not(:disabled) { background: var(--accent-hover); }
.x1-cal .x1-cal-apply:disabled { opacity: .45; cursor: default; }
@media (prefers-reduced-motion: reduce) { .x1-cal { animation: none; } }

/* =====================================================================================
   Agente aberto — abas internas no formato do protótipo (Dashboard X1.dc.html, `is.agente`,
   linhas 613-863). Pedido do dono (2026-11-14): "as janelas internas dos agentes estão bem
   diferentes do protótipo, preciso que visualmente fique igual, respeitando as funções reais".
   Tudo escopado em .ag-page (0,2,0+) porque as regras globais antigas de label/input/button
   (incl. button[type=submit] e os #ids de campo técnico) ganhariam de uma classe sozinha.
   ===================================================================================== */
.ag-page { display: grid; gap: 18px; padding-bottom: 120px; min-width: 0; }
.ag-page [hidden] { display: none !important; } /* `hidden` perde pra qualquer display de autor */
/* O <form> não pode virar um item da grade: com todas as abas dele escondidas (ex.: aba Mídia, que fica
   fora dele), ele ainda somava um vão de 18px a mais acima do conteúdo. */
.ag-page > #agent-form { display: contents; }
.ag-page label { margin: 0; font-size: inherit; color: inherit; font-weight: inherit; }
.ag-page .agent-crumbs { margin: 0; }
.ag-page .agent-crumbs span { font-weight: 400; }
.ag-page .agent-head { margin: 0; flex-wrap: wrap; }
.ag-page .agent-head .agent-card-icon { width: 44px; height: 44px; }
.ag-page .agent-head .agent-card-icon svg { width: 24px; height: 24px; }
.ag-page .agent-head-name { font-size: 25px; line-height: 24px; letter-spacing: -0.015em; } /* protótipo: herda 24px */
.ag-page .agent-head .agent-switch { width: 44px; height: 26px; margin-left: 6px; }
.ag-page .agent-head .agent-switch-knob { top: 3px; }
.ag-page .error { margin: 0; }

.ag-page .ag-tabs { gap: 20px; margin: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.ag-page .ag-tabs::-webkit-scrollbar { display: none; }
.ag-page .ag-tabs .tab-button { height: 42px; padding: 0 2px; font: 500 15px/1 var(--font-body); white-space: nowrap; text-decoration: none; flex-shrink: 0; }
.ag-page .ag-tabs .tab-button.active::after { bottom: 0; border-radius: 2px; }

.ag-page .ag-panel { display: grid; gap: 22px; max-width: 760px; min-width: 0; }
.ag-page .ag-panel-tight { gap: 12px; }
.ag-page .ag-panel-inner { display: grid; gap: 22px; min-width: 0; }
.ag-page .ag-field { display: grid; gap: 6px; min-width: 0; }
.ag-page .ag-field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; }
.ag-page .ag-narrow { max-width: 420px; }
.ag-page .ag-provider { max-width: 300px; }
/* Rótulos e ajudas herdam a altura de linha de 24px do corpo no protótipo; só os campos com − e +
   usam 20/18 (explícito lá). */
.ag-page .ag-label { font-size: 14px; line-height: 24px; font-weight: 500; color: var(--text); }
.ag-page .ag-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ag-page .ag-help { font-size: 13px; line-height: 24px; color: var(--muted); }
.ag-page .ag-help.is-compact { line-height: 18px; } /* textos de várias linhas que o protótipo não tem */
.ag-page .ag-help code { font-size: 12px; }
.ag-page .ag-counter { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ag-page .ag-lead { margin: 0; font-size: 14px; color: var(--muted); }

.ag-page .ag-input, .ag-page .ag-select {
  width: 100%; height: 42px; margin: 0; padding: 0 12px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--border-strong); font-size: 16px; color: var(--text); outline: none;
}
.ag-page .ag-input-phone { max-width: 320px; font-variant-numeric: tabular-nums; }
.ag-page .ag-input-short { max-width: 160px; }
.ag-page #chat_model, .ag-page #transcription_model, .ag-page #tts_model, .ag-page #tts_voice, .ag-page #emergency_number { font-size: 16px; }
.ag-page .ag-input:focus, .ag-page .ag-select:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.ag-page .ag-input.tier-overridden { background: var(--surface-sunken); color: var(--muted-2); }
.ag-page .ag-select-wrap { position: relative; display: block; }
.ag-page .ag-select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer; }
.ag-page .ag-select-wrap > svg { position: absolute; right: 12px; top: 13px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }

/* Editor das instruções: cabeçalho com dica + "Tela cheia" (protótipo linhas 631-633). */
.ag-page .ag-editor { border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); overflow: hidden; }
.ag-page .ag-editor:focus-within { border-color: var(--accent); box-shadow: var(--focus-ring); }
.ag-page .ag-editor.is-plain { border-radius: 10px; }
.ag-page .ag-editor-bar {
  display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface-sunken); font-size: 14px; color: var(--muted);
}
.ag-page .ag-editor-bar > svg { width: 16px; height: 16px; flex-shrink: 0; }
.ag-page .ag-editor-bar > span { flex: 1; min-width: 0; }
.ag-page .ag-editor textarea {
  display: block; width: 100%; margin: 0; border: 0; border-radius: 0; resize: vertical; padding: 14px 16px;
  font: 16px/23px var(--font-body); background: transparent; color: var(--text); min-height: 520px; outline: none;
}
.ag-page .ag-editor.is-plain textarea { padding: 12px 14px; min-height: 0; }
.ag-page .ag-editor.is-expanded textarea { min-height: calc(100vh - 260px); }
.ag-page #prompt, .ag-page #flow_instruction, .ag-page #important_info { resize: vertical; }
.ag-page .textarea-expand-btn {
  height: 26px; margin: 0; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: transparent;
  color: var(--muted); font: 500 13px/1 var(--font-body); cursor: pointer; flex-shrink: 0;
}
.ag-page .textarea-expand-btn:hover { background: transparent; background-image: var(--hover-fill); color: var(--text); }
.ag-page .ag-expand-mini { height: 22px; padding: 0 8px; border: 0; }

/* Nível de inteligência (protótipo linhas 637-649). */
.ag-page .ag-level-field { gap: 10px; }
.ag-page .ag-level-current { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; }
.ag-page .ag-level-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-sunken-2); transition: background .2s; }
.ag-page .ag-level-dot.is-none { box-shadow: inset 0 0 0 1.5px var(--muted-2); background: transparent; }
.ag-page .ag-level { display: grid; gap: 10px; }
.ag-page .ag-level-bar {
  position: relative; height: 36px; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 4px;
  align-items: center; cursor: pointer; touch-action: none;
}
.ag-page .ag-level-seg { height: 10px; border-radius: 5px; background: var(--surface-sunken-2); transition: background .2s var(--ease-out); }
.ag-page .ag-level-knob {
  position: absolute; top: 7px; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 3px var(--ring, var(--accent)), 0 2px 6px rgba(0, 0, 0, .3); transition: left .2s var(--ease-out); pointer-events: none;
}
.ag-page .ag-level-opts { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 4px; }
.ag-page .ag-level-opt {
  display: grid; justify-items: center; gap: 2px; margin: 0; padding: 6px 4px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.ag-page .ag-level-opt:hover { background: transparent; background-image: var(--hover-fill); }
.ag-page .ag-level-opt.is-current { color: var(--text); }
.ag-page .ag-level-opt-label { font: 500 14px/18px var(--font-body); }
.ag-page .ag-level-opt.is-current .ag-level-opt-label { font-weight: 600; }
.ag-page .ag-level-opt-sub { font-size: 12px; color: var(--accent-text); font-weight: 500; }
.ag-page .ag-note {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px;
  font-size: 14px; line-height: 20px; color: var(--text);
}
.ag-page .ag-note > svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.ag-page .ag-note.is-warn { background: var(--warning-soft); }
.ag-page .ag-note.is-warn > svg { color: var(--warning-text); }
.ag-page .ag-note.is-danger { background: var(--danger-soft); color: var(--danger-text); }
.ag-page .ag-link-btn {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px; height: 36px; margin: 0; padding: 0 12px;
  border: 0; border-radius: 10px; background: transparent; color: var(--accent-text); font: 500 15px/1 var(--font-body);
  cursor: pointer; text-decoration: none;
}
.ag-page .ag-link-btn:hover { background: transparent; background-image: var(--hover-fill); text-decoration: none; }
.ag-page .ag-link-btn svg { width: 17px; height: 17px; }
.ag-page .ag-level-none { font-size: 14px; height: 30px; padding: 0 8px; margin-left: -8px; }

/* Cartões de configuração (protótipo: padding 18, raio 14, borda, superfície). */
.ag-page .ag-card { display: grid; gap: 16px; padding: 18px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); min-width: 0; }
.ag-page .ag-card-head { display: grid; gap: 4px; }
.ag-page .ag-card-title { font-size: 15px; font-weight: 500; }
.ag-page .ag-card-desc { font-size: 13px; line-height: 24px; color: var(--muted); }
.ag-page .ag-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ag-page .ag-hairline { height: 1px; background: var(--hairline); }
.ag-page .ag-subfields { display: grid; gap: 16px; padding-top: 14px; border-top: 1px solid var(--hairline); animation: x1-in 200ms var(--ease-out); }
.ag-page .ag-section-head { display: grid; gap: 4px; }
.ag-page .ag-section-title { font-size: 16px; font-weight: 600; }
.ag-page .ag-section-sub { font-size: 14px; color: var(--muted); }
.ag-page .ag-section-gap { margin-top: 14px; }

/* Interruptor com título e descrição (protótipo: trilho 40×24, bolinha 20, 14px de vão). */
.ag-page .ag-switch-row { position: relative; display: flex; align-items: center; gap: 14px; cursor: pointer; color: var(--text); }
.ag-page .ag-switch-input { position: absolute; left: 0; top: 50%; width: 1px; height: 1px; margin: 0; opacity: 0; }
.ag-page .ag-switch { position: relative; width: 40px; height: 24px; border-radius: 999px; background: var(--border-strong); flex-shrink: 0; transition: background-color .15s; }
.ag-page .ag-switch-knob { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .15s var(--ease-out); }
.ag-page .ag-switch-input:checked + .ag-switch { background: var(--accent); }
.ag-page .ag-switch-input:checked + .ag-switch .ag-switch-knob { left: 18px; }
.ag-page .ag-switch-input:focus-visible + .ag-switch { box-shadow: var(--focus-ring); }
.ag-page .ag-switch-row:hover .ag-switch { background-image: var(--hover-fill); }
.ag-page .ag-switch-text { display: grid; gap: 2px; min-width: 0; }
.ag-page .ag-switch-title { font-size: 15px; font-weight: 500; }
.ag-page .ag-switch-desc { font-size: 13px; line-height: 24px; color: var(--muted); }
.ag-page .ag-panel > .ag-switch-row .ag-switch-text { gap: 0; }
.ag-page .ag-panel > .ag-switch-row .ag-switch-title { font-size: 16px; }
.ag-page .ag-panel > .ag-switch-row .ag-switch-desc { font-size: 14px; line-height: 24px; }

/* Campos com − e + (protótipo linhas 686-691 e 720-722). */
.ag-page .ag-step-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; align-items: start; }
.ag-page .ag-step-grid > .ag-step-field { grid-template-rows: 40px auto auto; }
.ag-page .ag-step-grid > .ag-step-field > .ag-label { align-self: end; line-height: 20px; }
.ag-page .ag-step-grid .ag-help { line-height: 18px; }
.ag-page .ag-step-grid.is-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.ag-page .ag-step-grid.is-3 > .ag-step-field { grid-template-rows: auto; }
.ag-page .ag-step-grid.is-3 .ag-stepper { max-width: 220px; }
.ag-page .ag-step-field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.ag-page .ag-stepper {
  display: flex; height: 42px; width: 100%; max-width: 240px; border-radius: 10px; border: 1px solid var(--border-strong);
  overflow: hidden; background: var(--surface);
}
.ag-page .ag-stepper:focus-within { border-color: var(--accent); box-shadow: var(--focus-ring); }
.ag-page .ag-step-btn {
  width: 42px; flex-shrink: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent;
  display: grid; place-items: center; color: var(--muted); cursor: pointer;
}
.ag-page .ag-step-btn:hover { background: transparent; background-image: var(--hover-fill); color: var(--text); }
.ag-page .ag-step-btn:disabled { opacity: .4; cursor: not-allowed; background-image: none; }
.ag-page .ag-step-btn svg { width: 17px; height: 17px; }
.ag-page .ag-step-value {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; border-left: 1px solid var(--border);
  border-right: 1px solid var(--border); font: 500 15px var(--font-body); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden;
}
.ag-page .ag-step-value input {
  width: 2ch; min-width: 1ch; field-sizing: content; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0;
  background: transparent; font: inherit; color: var(--text); text-align: right; outline: none; -moz-appearance: textfield; appearance: textfield;
}
.ag-page .ag-step-value input::-webkit-inner-spin-button,
.ag-page .ag-step-value input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ag-page .ag-step-value input.is-zero { display: none; }
.ag-page .ag-step-unit { cursor: text; white-space: pre; } /* pre: mantém o espaço de " ms"/" mensagens" (item flex corta espaço inicial) */
.ag-page .ag-stepper.is-readonly .ag-step-value, .ag-page .ag-stepper.is-readonly input { color: var(--muted); }
.ag-page .ag-stepper.is-duration .ag-step-unit { cursor: default; }
.ag-page .ag-step-value { cursor: text; }
.ag-page .ag-stepper.is-readonly .ag-step-value { cursor: default; }
/* Tempo da recuperação digitável (2026-11-17): "45 min", "2h", "90s". */
.ag-page .ag-step-value input.ag-step-text {
  width: 100%; min-width: 0; field-sizing: fixed; height: 100%; margin: 0; padding: 0 6px; border: 0; border-radius: 0; background: transparent;
  font: inherit; color: var(--text); text-align: center; outline: none;
}

/* Balões por resposta (protótipo linhas 695-709). */
.ag-page .ag-bubbles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 20px; align-items: center; }
.ag-page .ag-bubbles-pick { display: grid; gap: 10px; align-content: start; }
.ag-page .ag-bubble-opts { display: flex; gap: 6px; max-width: 362px; }
.ag-page .ag-bubble-opt { position: relative; flex: 1 1 0; min-width: 0; cursor: pointer; }
.ag-page .ag-bubble-opt input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.ag-page .ag-bubble-opt span {
  display: grid; place-items: center; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: 600 16px/1 var(--font-body); font-variant-numeric: tabular-nums;
}
.ag-page .ag-bubble-opt:hover span { background-image: var(--hover-fill); border-color: var(--hover-border); }
.ag-page .ag-bubble-opt input:checked + span { border-color: var(--accent); background-color: var(--accent-soft); color: var(--accent-text); }
.ag-page .ag-bubble-opt input:focus-visible + span { box-shadow: var(--focus-ring); }
.ag-page .ag-bubble-preview {
  display: flex; flex-direction: column; gap: 5px; padding: 14px; border-radius: 14px; background: var(--surface-sunken);
  border: 1px solid var(--border); min-height: 150px; justify-content: flex-end;
}
.ag-page .ag-bubble-in { display: flex; }
.ag-page .ag-bubble-in span {
  max-width: 80%; padding: 7px 11px; border-radius: 16px 16px 16px 5px; background: var(--bubble-in);
  box-shadow: inset 0 0 0 1px var(--bubble-in-border); font-size: 14px; line-height: 19px;
}
.ag-page .ag-bubble-out { display: flex; justify-content: flex-end; animation: x1-in 220ms var(--ease-out); }
.ag-page .ag-bubble-out span { max-width: 84%; padding: 7px 11px; border-radius: 16px; background: var(--bubble-out); color: var(--on-bubble-out); font-size: 14px; line-height: 19px; }
.ag-page .ag-bubble-out.is-last span { border-radius: 16px 16px 5px 16px; }

/* "Quando te chamar": etiquetas e sugestões (protótipo linhas 735-741). */
.ag-page .ag-tags {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 52px; padding: 8px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border-strong);
}
.ag-page .ag-tags:focus-within { border-color: var(--accent); box-shadow: var(--focus-ring); }
.ag-page .ag-tags .tag-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; max-width: 100%; padding: 0 4px 0 12px; border: 0;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 14px; font-weight: 500;
}
.ag-page .ag-tags .tag-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.ag-page .ag-tags .tag-chip button {
  width: 24px; height: 24px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit;
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
}
.ag-page .ag-tags .tag-chip button:hover { background-image: var(--hover-fill); color: inherit; }
.ag-page .ag-tags input.tag-input-field {
  flex: 1; min-width: 180px; width: auto; height: 32px; margin: 0; padding: 0 6px; border: 0; background: transparent;
  font-size: 15px; outline: none; box-shadow: none;
}
.ag-page .ag-sugg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.ag-page .ag-sugg-label { font-size: 13px; color: var(--muted); margin-right: 2px; }
.ag-page .ag-sugg-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; margin: 0; padding: 0 10px; border-radius: 999px;
  border: 1px dashed var(--border-strong); background: transparent; color: var(--muted); font: 500 13px/1 var(--font-body); cursor: pointer;
}
.ag-page .ag-sugg-chip:hover { background: transparent; background-image: var(--hover-fill); color: var(--text); border-color: var(--hover-border); }
.ag-page .ag-info-note {
  display: flex; align-items: flex-start; gap: 10px; margin-left: 54px; padding: 12px 14px; border-radius: 12px; max-width: 520px;
  background: var(--surface-sunken); border: 1px solid var(--border); font-size: 14px; line-height: 20px; color: var(--muted);
}
.ag-page .ag-info-note > svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

/* Áudio: deslizantes da voz e efeito de ambiente (protótipo linhas 807-824). */
.ag-page .ag-slider-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 18px 24px; }
.ag-page .ag-slider { display: grid; gap: 6px; min-width: 0; }
.ag-page .ag-slider-head { display: flex; justify-content: space-between; gap: 8px; }
.ag-page .ag-slider-value { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.ag-page .ag-slider input[type="range"] { width: 100%; height: 24px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.ag-page .ag-slider.is-off { opacity: .5; }
.ag-page .ag-ghost-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; margin: 0; padding: 0 12px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font: 500 13px/1 var(--font-body); cursor: pointer;
}
.ag-page .ag-ghost-btn:hover { background: transparent; background-image: var(--hover-fill); color: var(--text); }
.ag-page .ag-ghost-btn svg { width: 14px; height: 14px; }
.ag-page .ag-fx { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ag-page .ag-fx-opt {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 500 14px/18px var(--font-body); cursor: pointer;
}
.ag-page .ag-fx-opt input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.ag-page .ag-fx-opt svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--muted); }
.ag-page .ag-fx-opt:hover { background-image: var(--hover-fill); border-color: var(--hover-border); }
.ag-page .ag-fx-opt:has(input:checked) { border-color: var(--accent); background-color: var(--accent-soft); }
.ag-page .ag-fx-opt:has(input:checked) svg { color: var(--accent-text); }
.ag-page .ag-fx-opt:has(input:focus-visible) { box-shadow: var(--focus-ring); }

/* Vozes em duas seções menores, por gênero (pedido do dono, 2026-11-14) — mesmo botão das opções
   de efeito de áudio, lado a lado no computador e uma embaixo da outra no celular. */
.ag-page .ag-voices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.ag-page .ag-voice-group {
  display: grid; gap: 10px; align-content: start; padding: 14px; border-radius: 14px;
  background: var(--surface-sunken); border: 1px solid var(--border);
}
.ag-page .ag-voice-title { font-size: 14px; font-weight: 600; color: var(--text); }
.ag-page .ag-voice-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.ag-page .ag-voice-chip {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 40px; margin: 0; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 500 14px/18px var(--font-body); cursor: pointer;
}
.ag-page .ag-voice-chip input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.ag-page .ag-voice-chip svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--muted-2); }
.ag-page .ag-voice-chip:hover { background-image: var(--hover-fill); border-color: var(--hover-border); }
.ag-page .ag-voice-chip:has(input:checked) { border-color: var(--accent); background-color: var(--accent-soft); color: var(--accent-text); }
.ag-page .ag-voice-chip:has(input:checked) svg { color: var(--accent-text); }
.ag-page .ag-voice-chip:has(input:focus-visible) { box-shadow: var(--focus-ring); }

/* Aviso de crédito do nível de inteligência: só aparece depois de trocar pra Médio/Avançado. */
.ag-page .ag-level-warn { animation: x1-in .2s var(--ease-out); }

/* Idioma das respostas: lista com bandeira (SVG — emoji de bandeira não aparece no Windows),
   nome e sigla. O <select> real fica escondido por baixo. */
.ag-page .ag-lang { position: relative; }
.ag-page .ag-lang-btn {
  width: 100%; height: 42px; margin: 0; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-radius: 10px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); font: 400 16px/1 var(--font-body);
  text-align: left; cursor: pointer;
}
.ag-page .ag-lang-btn:hover { background-image: var(--hover-fill); }
.ag-page .ag-lang-btn[aria-expanded="true"], .ag-page .ag-lang-btn:focus-visible { border-color: var(--accent); box-shadow: var(--focus-ring); outline: none; }
.ag-page .ag-lang-btn > svg { width: 17px; height: 17px; color: var(--muted); flex-shrink: 0; }
.ag-page .ag-lang-current, .ag-page .ag-lang-opt { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ag-page .ag-flag { display: inline-flex; flex-shrink: 0; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px var(--border); }
.ag-page .ag-flag svg { display: block; width: 21px; height: 14px; }
.ag-page .ag-lang-auto { display: inline-grid; place-items: center; width: 21px; height: 14px; flex-shrink: 0; color: var(--muted); }
.ag-page .ag-lang-auto svg { width: 16px; height: 16px; }
.ag-page .ag-lang-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-page .ag-lang-code {
  flex-shrink: 0; padding: 2px 6px; border-radius: 6px; background: var(--surface-sunken-2); color: var(--muted);
  font: 600 11px/14px var(--font-body); letter-spacing: .04em;
}
.ag-page .ag-lang-sub { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-page .ag-lang-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--sh-3);
  max-height: 320px; overflow-y: auto; outline: none; animation: x1-in .14s var(--ease-out);
}
.ag-page .ag-lang-opt { height: 42px; padding: 0 10px; border-radius: 9px; font-size: 15px; color: var(--text); cursor: pointer; }
.ag-page .ag-lang-opt.is-active { background-image: var(--hover-fill); }
.ag-page .ag-lang-opt[aria-selected="true"] { color: var(--accent-text); }
.ag-page .ag-lang-check { width: 16px; height: 16px; margin-left: auto; flex-shrink: 0; color: var(--accent-text); visibility: hidden; }
.ag-page .ag-lang-opt[aria-selected="true"] .ag-lang-check { visibility: visible; }

/* Instâncias (protótipo linhas 829-838): uma linha por número, com caixa de marcar 18px. */
.ag-page .ag-inst {
  display: flex; align-items: center; gap: 12px; padding-right: 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); flex-wrap: wrap;
}
.ag-page .ag-inst:hover { background-image: var(--hover-fill); border-color: var(--hover-border); }
.ag-page .ag-inst.is-disabled { opacity: .55; }
.ag-page .ag-inst.is-disabled:hover { background-image: none; border-color: var(--border); }
.ag-page .ag-inst-main { flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 14px; cursor: pointer; }
.ag-page .ag-inst.is-disabled .ag-inst-main { cursor: default; }
.ag-page .ag-check {
  appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; flex-shrink: 0; border-radius: 5px;
  background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--border-strong); cursor: pointer;
}
.ag-page .ag-check:checked {
  box-shadow: none; background: var(--accent) center / 14px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000D06' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.ag-page .ag-check:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ag-page .ag-check:disabled { cursor: not-allowed; }
.ag-page .ag-inst-text { flex: 1; display: grid; min-width: 0; }
.ag-page .ag-inst-name { font-weight: 500; line-height: 21px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-page .ag-inst-sub { font-size: 13px; line-height: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ag-page .ag-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 13px; font-weight: 500; white-space: nowrap;
}
.ag-page .ag-pill svg { width: 13px; height: 13px; }
.ag-page .ag-pill.is-warn { background: var(--warning-soft); color: var(--warning-text); }
.ag-page .ag-secondary-btn {
  height: 34px; margin: 0; padding: 0 12px; border: 0; border-radius: 9px; box-shadow: inset 0 0 0 1px var(--border-strong);
  background: var(--surface); color: var(--text); font: 500 13px/1 var(--font-body); cursor: pointer; flex-shrink: 0;
}
.ag-page .ag-secondary-btn:hover { background: var(--surface); background-image: var(--hover-fill); }
.ag-page .ag-inst .webhook-status:empty { display: none; }

/* Mídia: caixa de ferramentas (protótipo linhas 755-783). */
.ag-page .ag-upload { display: grid; gap: 12px; margin: 0; }
.ag-page .ag-drop {
  position: relative; display: grid; justify-items: center; gap: 8px; padding: 24px 20px; border: 1.5px dashed var(--border-strong);
  border-radius: 14px; background: var(--surface-sunken); text-align: center; color: var(--text); cursor: pointer;
}
.ag-page .ag-drop:hover, .ag-page .ag-drop.is-over { background-image: var(--hover-fill); border-color: var(--hover-border); }
.ag-page .ag-drop-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ag-page .ag-drop-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow-sm); color: var(--muted); }
.ag-page .ag-drop-icon svg { width: 22px; height: 22px; }
.ag-page .ag-drop-title { font-size: 15px; font-weight: 500; }
.ag-page .ag-drop-link { color: var(--accent-text); }
.ag-page .ag-drop-sub { font-size: 13px; color: var(--muted); }
.ag-page .ag-upload-fields { display: grid; gap: 14px; padding: 14px 14px 16px; border-radius: 12px; border: 1px solid var(--accent); background: var(--surface-sunken); animation: x1-in 200ms var(--ease-out); }
.ag-page .ag-upload-chosen { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; min-width: 0; }
.ag-page .ag-upload-chosen svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.ag-page .ag-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.ag-page .ag-actions .ag-ghost-btn { height: 38px; padding: 0 14px; font-size: 14px; }
.ag-page .ag-primary-btn {
  height: 38px; margin: 0; padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent);
  font: 600 14px/1 var(--font-body); cursor: pointer;
}
.ag-page .ag-primary-btn:hover { background: var(--accent-hover); }
.ag-page .ag-primary-btn:active { background: var(--accent-pressed); }
.ag-page .ag-empty { margin: 0; padding: 8px 2px; font-size: 14px; }
.ag-page .ag-file { display: grid; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); overflow: hidden; }
.ag-page .ag-file.is-editing { border-color: var(--accent); }
.ag-page .ag-file-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 10px; }
.ag-page .ag-file-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-sunken-2); display: grid; place-items: center; color: var(--muted); }
.ag-page .ag-file-icon svg { width: 20px; height: 20px; }
.ag-page .ag-file-text { display: grid; gap: 1px; min-width: 0; }
.ag-page .ag-file-name { font-size: 15px; line-height: 22px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-page .ag-file-meta { font-size: 13px; line-height: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.ag-page .ag-file-ctx { display: flex; gap: 5px; align-items: center; min-width: 0; font-size: 13px; color: var(--muted); }
.ag-page .ag-file-ctx span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-page .ag-file-ctx svg { width: 13px; height: 13px; flex-shrink: 0; }
.ag-page .ag-file-ctx.is-warn { color: var(--warning-text); }
.ag-page .ag-file-delete { margin: 0; }
.ag-page .ag-icon-btn {
  width: 34px; height: 34px; margin: 0; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: pointer;
}
.ag-page .ag-icon-btn:hover { background: transparent; background-image: var(--hover-fill); color: var(--text); }
.ag-page .ag-icon-btn.is-danger:hover { background: var(--danger-soft); background-image: none; color: var(--danger-text); }
.ag-page .ag-icon-btn svg { width: 17px; height: 17px; }
.ag-page .ag-file-edit { display: grid; gap: 14px; padding: 14px 14px 16px; border-top: 1px solid var(--border); background: var(--surface-sunken); animation: x1-in 200ms var(--ease-out); }

/* Barra flutuante "Alterações não salvas" (protótipo linhas 858-862). Fica fora de .ag-page. */
.ag-savebar {
  position: fixed; left: 50%; bottom: 24px; z-index: 40; width: min(720px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 14px;
  background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border); box-shadow: var(--sh-3);
  transform: translate(-50%, 140%); opacity: 0; pointer-events: none;
  transition: transform .25s var(--ease-out), opacity .25s;
}
.ag-savebar.is-visible { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.ag-savebar-icon { display: inline-flex; color: var(--warning); }
.ag-savebar-icon svg { width: 17px; height: 17px; }
.ag-savebar-text { flex: 1; min-width: 0; font-size: 15px; }
.ag-savebar .ag-savebar-discard {
  display: inline-flex; align-items: center; height: 36px; margin: 0; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); font: 500 15px/1 var(--font-body); cursor: pointer; text-decoration: none;
}
.ag-savebar .ag-savebar-discard:hover { background: transparent; background-image: var(--hover-fill); color: var(--text); text-decoration: none; }
.ag-savebar .ag-savebar-save {
  height: 36px; margin: 0; padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent);
  font: 600 15px/1 var(--font-body); cursor: pointer; white-space: nowrap;
}
.ag-savebar .ag-savebar-save:hover { background: var(--accent-hover); }
.ag-savebar .ag-savebar-save:active { background: var(--accent-pressed); }

@media (max-width: 640px) {
  .ag-page .ag-info-note { margin-left: 0; }
  .ag-savebar { bottom: 84px; padding-left: 12px; gap: 8px; }
  .ag-savebar-text { font-size: 14px; }
}

/* --- Boas-vindas depois do pagamento (página de vendas, 2026-11-16) --- */
.bv { display: grid; gap: 20px; max-width: 860px; }
.bv-hero {
  display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center;
  padding: 24px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.bv-logo { width: 56px; height: 56px; object-fit: contain; }
.bv-title { margin: 0; font-size: 26px; line-height: 32px; letter-spacing: -0.02em; }
.bv-sub { margin: 4px 0 0; color: var(--accent-text); font-weight: 600; }
.bv-lead { margin: 6px 0 0; color: var(--muted); }
.bv-progress { display: grid; gap: 6px; justify-items: end; min-width: 110px; }
.bv-progress-num { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bv-progress-bar { width: 110px; height: 6px; border-radius: 3px; background: var(--surface-sunken-2); overflow: hidden; }
.bv-progress-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bv-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bv-step {
  display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center;
  padding: 18px 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border);
}
.bv-step.is-done { background: var(--surface-sunken); }
.bv-step-num {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 600; font-size: 17px; background: var(--accent-soft); color: var(--accent-text);
}
.bv-step.is-done .bv-step-num { background: var(--accent); color: var(--on-accent); }
.bv-step-num svg { width: 20px; height: 20px; }
.bv-step-body h3 { margin: 0; font-size: 17px; }
.bv-step-body p { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.bv-step-go { white-space: nowrap; }
.bv-help { margin-top: 0; }

.welcome-reminder {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-lg);
  background: var(--accent-soft); color: var(--accent-text); text-decoration: none; border: 1px solid transparent;
}
.welcome-reminder:hover { border-color: var(--accent); }
.welcome-reminder-icon svg { width: 20px; height: 20px; }
.welcome-reminder-text { flex: 1; font-size: 14px; line-height: 1.45; }
.welcome-reminder-go { font-weight: 600; font-size: 14px; white-space: nowrap; }

/* ============================== Celular: proporção e harmonia ==============================
   Pedido do dono (2026-11-14): no celular estava "tudo desproporcional, fontes grandes, sessões
   que somem, sem harmonia" — deixar tão bom quanto o desktop, preservando gráficos e informações.
   Só vale abaixo de 641px (mesmo ponto da barra de abas de baixo): nada aqui muda o desktop
   (spec §9 / regra 6). Escala do celular: título de página 24, título de janela 18, valor de
   indicador 24, texto 14–15, apoio 12–13; respiro de janela 16. */
@media (max-width: 640px) {
  /* Títulos de página (Agentes, Minha conta, Configurações, Assinatura) e saudação do Início */
  .agents-title, .mc-title, .inicio-greeting { font-size: 24px; line-height: 30px; }
  .agents-sub, .mc-sub { font-size: 14px; line-height: 20px; }
  .inicio { gap: 16px; }
  .inicio-date { font-size: 13px; }
  .period-pill { height: 28px; padding: 0 11px; font-size: 13px; }

  /* "Ao vivo": centralizado e compacto — contador menor, frase de 18 e as três contagens numa
     linha só, centralizadas (antes cada uma ocupava uma linha, alinhadas à esquerda, em 36px). */
  .live-section { padding: 6px 0 2px; gap: 10px; }
  .live-label { font-size: 15px; gap: 8px; }
  .live-dot { width: 8px; height: 8px; }
  .live-row { gap: 6px; }
  .live-counter { font-size: 64px; }
  .live-right { gap: 12px; }
  .live-caption { font-size: 18px; line-height: 1.3; }
  /* tamanhos acompanham a largura pra as três contagens caberem numa linha até em 360px */
  .live-counts { justify-content: center; gap: 8px clamp(12px, 4.6vw, 18px); padding-top: 12px; }
  .live-count { font-size: clamp(19px, 5.64vw, 22px); gap: 5px; }
  .live-count-dot { width: 8px; height: 8px; }
  .live-count-label { font-size: clamp(11.5px, 3.34vw, 13px); }

  /* "Conversas iniciadas" volta a aparecer no celular (antes ficava escondida — o dono quer os
     gráficos): título de 18, pílulas compactas numa linha, gráfico de 130px e eixo estreito. */
  .ac-section { display: grid; padding: 0; gap: 12px; }
  .ac-title { font-size: 18px; gap: 8px; }
  .ac-title svg { width: 18px; height: 18px; }
  .ac-pills { gap: 6px; flex-wrap: nowrap; }
  .ac-pill { height: 30px; padding: 0 10px; font-size: 13px; }
  .ac-pill-cal { padding: 0 8px; }
  .ac-pill-cal svg { width: 15px; height: 15px; }
  .ac-plot-row { gap: 8px; }
  .ac-ticks { width: 24px; height: 130px; }
  .ac-tick { font-size: 11px; line-height: 14px; }
  .ac-plot { height: 130px; }
  .ac-labels { margin-left: 32px; }
  .ac-xlabel { font-size: 11px; }

  /* Indicadores: 2 por linha, "Valor vendido" (o destaque) na largura toda */
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-card { padding: 14px; gap: 6px; }
  .kpi-card-strong { grid-column: 1 / -1; }
  .kpi-label { font-size: clamp(12px, 3.34vw, 13px); gap: 5px; }
  .kpi-label svg { width: 14px; height: 14px; }
  .kpi-value, .credit-headline .credit-value { font-size: 24px; }
  .kpi-caption { font-size: 12px; line-height: 16px; }
  .credit-track { height: 22px; padding: 3px; border-radius: 9px; }
  .credit-fill { border-radius: 6px; }

  /* Atividade e Uso do plano */
  .activity-card { padding: 16px; gap: 14px; }
  .activity-title { font-size: 18px; gap: 8px; }
  .activity-title svg { width: 18px; height: 18px; }
  .activity-chart { gap: 12px; }
  .activity-label { font-size: 13px; }
  .activity-value { font-size: 14px; }
  .plan-usage-card { padding: 16px; gap: 10px; }
  .plan-usage-title { font-size: 16px; }

  /* Abas (agente, Configurações): numa linha só, menores; se ainda faltar espaço, rolam de lado */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 12px; margin-bottom: 16px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-button { flex-shrink: 0; height: 42px; padding: 0 2px; font-size: 13px; gap: 5px; }
  .tab-button svg { width: 15px; height: 15px; }
  /* espaço e fonte acompanham a largura: as 5 abas cabem de 360 a 640px (em 390, 12px/13px) */
  .ag-page .ag-tabs { gap: clamp(7px, 3.07vw, 12px); }
  .ag-page .ag-tabs .tab-button { font-size: clamp(12px, 3.34vw, 13px); }
  .ag-page .ag-tabs .ag-tab-shortcut { display: none; }

  /* Janelas: menos respiro e textos um degrau abaixo */
  .card { padding: 16px; }
  .mc-card { padding: 16px; gap: 14px; }
  .mc-desc { font-size: 14px; line-height: 21px; }
  .mc-label { font-size: 14px; }
  .mc-hint { font-size: 13px; line-height: 19px; }
  .agent-card { padding: 16px; gap: 14px; }

  /* Conversas: o seletor de agente mostra o nome inteiro (o título também mostra) */
  .conv-mobile-head .conversas-filter { flex-shrink: 0; max-width: 44vw; }
  .conv-mobile-head .conversas-filter select { max-width: 100%; }

  /* Janela de entrada: colunas empilhadas, números menores, franquia em duas linhas */
  .entry-card { padding: 16px; gap: 14px; }
  .entry-cols { grid-template-columns: 1fr; gap: 10px; }
  .entry-col { padding: 14px; }
  .entry-stats { gap: 10px 12px; }
  .entry-stats dd { font-size: 18px; }
  .franchise-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; }
  .franchise-name { grid-column: 1 / -1; font-size: 13px; }
  .franchise-text { font-size: 12px; }

  /* Pagamento (checkout.js): as 3 formas uma embaixo da outra */
  .x1co-methods { grid-template-columns: 1fr; }

  /* Boas-vindas: passos em coluna, botão largo */
  .bv-hero { grid-template-columns: 1fr; padding: 18px; }
  .bv-progress { justify-items: start; }
  .bv-title { font-size: 22px; line-height: 28px; }
  .bv-step { grid-template-columns: auto 1fr; padding: 16px; }
  .bv-step-go { grid-column: 1 / -1; text-align: center; }
}
