/* HandFlow — design tokens
   Revisado em 2026-10-21 com a skill apple-design (.claude/skills/apple-design),
   a partir das Human Interface Guidelines da Apple.

   Ideia central: o HandFlow é um FLUXO — o contrato anda de etapa em etapa.
   A assinatura visual é a linha de fluxo (marca e login), em laranja Hand
   Talk; o resto da interface fica quieto para não competir com ela
   (branding.md › "Apply your app's accent color judiciously").

   Regras dos tokens:
   - Laranja = marca e ação principal. Nunca usado como "informação" — avisos
     informativos são azuis (uma cor, um significado).
   - Todo texto passa 4,5:1 contra a superfície onde aparece, nos dois temas
     (accessibility.md › "Strive to meet color contrast minimum standards").
     Os valores medidos estão ao lado de cada token.
   - --brand (#f2803a) dá 2,65:1 sobre branco: só aparece como preenchimento
     decorativo ou ao lado de um rótulo, nunca como cor de texto no tema claro.
     Texto laranja usa --accent-ink. */
:root {
  color-scheme: light;

  --canvas: #f4f5f7;          /* fundo da janela, atrás dos cards */
  --bg: var(--canvas);
  --surface: #ffffff;
  --surface-sunken: #eef0f3;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --border: #e2e4e9;
  --border-strong: #cfd2d9;

  --text: #15161a;            /* 18,1:1 em --surface */
  --text-muted: #5b5d66;      /* 6,6:1 em --surface, 5,7:1 em --surface-sunken */
  --text-faint: #676973;      /* 5,5:1 em --surface, 4,8:1 em --surface-sunken */

  /* Laranja Hand Talk. */
  --brand: #f2803a;           /* preenchimento decorativo; nunca texto no claro */
  --brand-line: #d9621c;      /* linha de fluxo: 3,4:1, acima do 3:1 de gráfico */
  --accent: #c2501a;          /* botão principal: branco por cima dá 4,7:1 */
  --accent-hover: #a8430f;    /* 6,0:1 */
  --accent-ink: #b0470f;      /* links e texto de destaque: 5,6:1 */
  --accent-soft: #fdede2;
  --accent-text: #ffffff;

  --info: #1b55c4;            /* 5,9:1 em --info-soft */
  --info-soft: #eaf1fd;
  --danger: #b42318;          /* 5,8:1 em --danger-soft */
  --danger-soft: #fdecea;
  --success: #156c43;         /* 5,6:1 em --success-soft */
  --success-soft: #e5f3eb;
  --warning: #7f5200;         /* 6,0:1 em --warning-soft */
  --warning-soft: #fcf1d9;

  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --border-w: 1px;
  --shadow-card: 0 1px 2px rgba(16, 18, 24, 0.04), 0 4px 16px -6px rgba(16, 18, 24, 0.08);
  --shadow-float: 0 1px 1px rgba(16, 18, 24, 0.04), 0 12px 32px -12px rgba(16, 18, 24, 0.18);
  --ring: 0 0 0 3px rgba(194, 80, 26, 0.28);

  --font-ui: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: var(--font-ui);
  --font-mono: "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Escala de espaçamento e largura de conteúdo (repaginada 2026-10-21). */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  /* Sem teto desde 2026-11-11: em monitor grande o teto de 1320px deixava
     ~40% da tela em branco à direita (pedido do responsável). */
  --content-max: none;

  /* Cor por etapa do funil — usada em badges e no kanban.
     Semânticas de status, não fazem parte da identidade visual da marca.
     Sempre acompanhadas do nome da etapa — nunca só a cor. */
  --st-registrado: #6b7280;
  --st-contrato: #b7791f;
  --st-aguardando_carga: #5b6b8c;
  --st-onboarding: #2f7d6d;
  --st-enviado_sensedata: #7c4dcc;
  --st-financeiro: #0e7fa3;
  --st-concluido: #1a8a4c;
  --st-inativo: #98a0ad;

  /* --st-aguardando_juridico e --st-contrato_criado NÃO são resíduo do enum
     antigo — dashboard.js/detalhe.js as reaproveitam para o badge
     Produção/Revisão (tipo_atuacao_juridica), um conceito independente do
     status do domínio. Nunca remover nem renomear (ver pipeline-status-v2.md,
     seção "Risco não-óbvio"). --st-contrato acima é a cor do status real. */
  --st-aguardando_juridico: #b7791f;
  --st-contrato_criado: #3a5bd9;
}

/* Tema escuro: grafite neutro, não preto puro — o laranja da marca é quente e
   precisa de um fundo que não o faça "brilhar". Mesmos papéis, mesma regra
   de 4,5:1 (dark-mode.md › "Aim for sufficient color contrast in all
   appearances"). Um bloco só, aplicado pela preferência do sistema OU pela
   escolha manual (js/theme.js) — antes eram duas cópias que podiam divergir. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --canvas: #0d0e11;
    --surface: #16171b;
    --surface-sunken: #1e2025;
    --surface-glass: rgba(26, 27, 32, 0.72);
    --border: #2b2d33;
    --border-strong: #3a3d45;
    --text: #f3f4f6;           /* 16,3:1 */
    --text-muted: #a3a6ae;     /* 7,4:1 */
    --text-faint: #8d909a;     /* 5,6:1 em surface, 5,1:1 em sunken */
    --brand-line: #f2803a;     /* 6,8:1 */
    --accent: #c2501a;
    --accent-hover: #d65d22;
    --accent-ink: #ff9a5c;     /* 8,6:1 */
    --accent-soft: #33210f;
    --info: #93b8ff;
    --info-soft: #15233b;
    --danger: #ff9a8f;
    --danger-soft: #3a1a17;
    --success: #6fd39b;
    --success-soft: #132d20;
    --warning: #f0c060;
    --warning-soft: #2f2610;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px -10px rgba(0, 0, 0, 0.6);
    --shadow-float: 0 1px 1px rgba(0, 0, 0, 0.3), 0 16px 40px -14px rgba(0, 0, 0, 0.8);
    --ring: 0 0 0 3px rgba(255, 154, 92, 0.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0d0e11;
  --surface: #16171b;
  --surface-sunken: #1e2025;
  --surface-glass: rgba(26, 27, 32, 0.72);
  --border: #2b2d33;
  --border-strong: #3a3d45;
  --text: #f3f4f6;
  --text-muted: #a3a6ae;
  --text-faint: #8d909a;
  --brand-line: #f2803a;
  --accent: #c2501a;
  --accent-hover: #d65d22;
  --accent-ink: #ff9a5c;
  --accent-soft: #33210f;
  --info: #93b8ff;
  --info-soft: #15233b;
  --danger: #ff9a8f;
  --danger-soft: #3a1a17;
  --success: #6fd39b;
  --success-soft: #132d20;
  --warning: #f0c060;
  --warning-soft: #2f2610;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px -10px rgba(0, 0, 0, 0.6);
  --shadow-float: 0 1px 1px rgba(0, 0, 0, 0.3), 0 16px 40px -14px rgba(0, 0, 0, 0.8);
  --ring: 0 0 0 3px rgba(255, 154, 92, 0.35);
}

/* Aumentar contraste (accessibility.md: "ensure it at least provides a higher
   contrast color scheme when the system setting Increase Contrast is turned
   on"): bordas visíveis e o texto mais apagado sobe para o nível do muted. */
@media (prefers-contrast: more) {
  /* :root triplicado: precisa vencer :root[data-theme="dark"] (0,2,0). */
  :root:root:root {
    --border: var(--border-strong);
    --text-faint: var(--text-muted);
  }
}

* { box-sizing: border-box; }
/* `hidden` sempre vence: `.field { display:flex }` anulava o atributo e
   campos que deviam estar ocultos (uploads, receitas de adicionais
   desmarcados) apareciam no formulário de venda. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--canvas);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Inter: "1" e "l" distinguíveis, e algarismos de largura fixa — em tela de
     contrato, valor e CNPJ alinham coluna com coluna. */
  font-feature-settings: "cv11", "ss01";
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { margin: 0 0 4px; }
h1, h2 { font-family: var(--font-display); font-weight: 700; color: var(--text); }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -0.022em; }
h2 { font-size: 17px; line-height: 1.3; letter-spacing: -0.012em; }
/* h3 é rótulo de seção (eyebrow), não título: pequeno, caixa alta, apagado. */
h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; }
p { margin: 0 0 8px; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
code, .mono { font-family: var(--font-mono); font-size: 12.5px; }

button, input, select, textarea { font-family: inherit; font-size: 13.5px; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); color: var(--text); }

/* ---------- App shell ---------- */
#app { display: flex; min-height: 100vh; }
.app-shell { display: flex; width: 100%; align-items: flex-start; }

/* Barra lateral flutuante, em material translúcido: é a camada de
   NAVEGAÇÃO, separada do conteúdo (sidebars.md: "sidebars can float above
   content in the Liquid Glass layer"). O conteúdo continua sólido —
   materials.md: "Don't use Liquid Glass in the content layer." */
.sidebar {
  position: sticky; top: 12px;
  width: 236px; height: calc(100vh - 24px);
  margin: 12px 0 12px 12px;
  flex-shrink: 0;
  background: var(--surface-glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-float);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
}
/* Marca (js/brand.js): símbolo em SVG + nome em texto. */
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-mark { flex-shrink: 0; display: block; filter: drop-shadow(0 4px 10px rgba(217, 83, 26, 0.28)); }
.brand-name { font-size: 20px; font-weight: 800; letter-spacing: -0.035em; color: var(--text); line-height: 1; }
.brand-name span { color: var(--accent-ink); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  min-height: 34px; padding: 7px 10px; border-radius: var(--radius);
  color: var(--text-muted); text-decoration: none; font-weight: 500;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; }
.nav a:hover { background: var(--surface-sunken); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
/* Marcador da seção atual — um traço da mesma linha de fluxo do tracker. */
.nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand-line);
}

.demo-banner {
  margin-top: auto;
  background: var(--surface-sunken);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.demo-banner strong { color: var(--text); }

.role-switcher { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.role-switcher label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); font-weight: 600; }
.role-switcher select { min-height: 32px; padding: 6px 8px; border-radius: var(--radius); border: var(--border-w) solid var(--border); background: var(--surface); color: var(--text); }

.main { flex: 1; min-width: 0; padding: 32px 32px 64px; }
/* Largura máxima comum a TODAS as telas. Antes não havia teto: em 1920px um
   campo de CEP chegava a 900px e cada tela tinha uma largura diferente
   (layout.md › "Layout follows available space" — mas com medida de leitura). */
/* Encostado no menu, não centralizado: em tela larga o centro deixava uma
   faixa vazia entre o menu e o conteúdo. */
.main > * { max-width: var(--content-max); margin-inline: 0; }
.main > .pagina-larga { max-width: none; }

/* Menu recolhido (main.js): só os ícones, com o nome no title. */
.brand { position: relative; }
.sidebar-toggle {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border: none; border-radius: var(--radius);
  background: transparent; color: var(--text-muted); cursor: pointer;
}
.sidebar-toggle svg { width: 18px; height: 18px; stroke: currentColor; transition: transform 0.15s var(--ease); }
.sidebar-toggle:hover { background: var(--surface-sunken); color: var(--text); }
.menu-recolhido .sidebar { width: 64px; padding: 18px 8px; }
.menu-recolhido .brand { flex-direction: column; gap: 12px; padding: 0; }
.menu-recolhido .brand-name, .menu-recolhido .nav-label,
.menu-recolhido .role-switcher, .menu-recolhido .demo-banner { display: none; }
.menu-recolhido .sidebar-toggle { margin-left: 0; }
.menu-recolhido .sidebar-toggle svg { transform: rotate(180deg); }
.menu-recolhido .nav a { justify-content: center; padding: 7px 0; }
.menu-recolhido .nav a.active::before { left: -8px; }
.menu-recolhido .nav a .badge { position: absolute; top: 2px; right: 2px; min-width: 16px; padding: 0 4px; font-size: 10px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
/* 34px de altura: acima do padrão de 28pt de desktop (accessibility.md ›
   "Offer sufficiently sized controls"). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 7px 14px; border-radius: var(--radius);
  border: var(--border-w) solid var(--border); background: var(--surface);
  color: var(--text); font-weight: 600; cursor: pointer;
  text-decoration: none; line-height: 1.2;
  box-shadow: 0 1px 1px rgba(16, 18, 24, 0.04);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.08s var(--ease);
}
.btn:hover { background: var(--surface-sunken); border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 2px rgba(120, 40, 0, 0.25);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { min-height: 28px; padding: 4px 10px; font-size: 12.5px; }
.btn-lg { min-height: 44px; padding: 10px 18px; font-size: 14.5px; border-radius: 12px; }
/* Botão do Google: neutro, como pedem as diretrizes de marca do Sign-In —
   o "G" colorido é quem identifica, não a cor do botão. */
.btn-google { gap: 10px; background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-google:hover { background: var(--surface-sunken); }

/* ---------- Cards / tables ---------- */
.card {
  background: var(--surface); border: var(--border-w) solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  padding: 22px;
  margin-bottom: 16px;
}
.card + .card { margin-top: 0; }

/* ---------- Modal (ex.: gerar contrato) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 11, 14, 0.45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 100;
}
.modal-box {
  background: var(--surface); border: var(--border-w) solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-float);
  padding: 26px; width: 100%; max-width: 640px; max-height: 90vh;
  overflow-y: auto;
}

/* Modal de geração de contrato: 25 campos, vários com rótulo longo. Em 640px
   e duas colunas (~285px cada) o rótulo quebrava em 3 linhas e o formulário
   virava uma parede. Largura maior + coluna única deixa cada campo legível. */
.modal-box.modal-wide { max-width: 900px; }

/* Agrupamento do formulário de contrato: o jurídico só precisa tocar nos
   campos SEM origem — os outros o sistema preenche do cadastro. Separar os
   dois evita revisar 25 campos quando 6 importam. */
.campo-grupo { margin: 0 0 20px; }
.campo-grupo > h4 {
  font-size: 13.5px; margin: 0 0 4px; color: var(--text);
}
.campo-grupo > .campo-grupo-hint {
  font-size: 12.5px; color: var(--text-muted); margin: 0 0 12px;
}
.campo-auto .field input { background: var(--surface-sunken); }
.campo-auto .field label::after {
  content: "automático"; margin-left: 6px; padding: 1px 7px;
  font-size: 10.5px; font-weight: 600; border-radius: 10px;
  background: var(--surface-sunken); color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Cinco colunas — uma por etapa (STATUSES em rbac.js). Eram seis, e a última
   ficava vazia esticando o grid. */
.kanban { display: grid; grid-template-columns: repeat(var(--kanban-cols, 5), minmax(160px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.kanban-col { background: var(--surface-sunken); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); padding: 12px; min-width: 160px; }
.kanban-col h3 { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.kanban-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kanban-card {
  background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius);
  padding: 9px 11px; margin-bottom: 8px; font-size: 13px; cursor: pointer; display: block; text-decoration: none; color: var(--text);
  box-shadow: 0 1px 1px rgba(16, 18, 24, 0.04);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.15s var(--ease);
}
.kanban-card:hover { border-color: var(--brand-line); box-shadow: var(--shadow-card); transform: translateY(-1px); }
.kanban-card { display: flex; flex-direction: column; gap: 6px; }
.kanban-card .op { color: var(--text-muted); font-size: 12px; }
.kanban-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kanban-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 600; margin-top: 2px; }
.kanban-col h3 .tab-count { margin-left: auto; }
.filtro-ativo { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; color: var(--text-muted); }
.kanban-empty { font-size: 12px; color: var(--text-faint); padding: 6px 2px; }

/* ---------- Andamento do contrato (breadcrumb) ----------
   No lugar das bolinhas ligadas por linha (2026-11-03, a pedido do
   responsável). Etapas em sequência separadas por chevron; a atual em
   destaque laranja, as concluídas com ✓. O estado nunca depende só da cor: o
   ✓ e o texto "(concluída)" para leitor de tela marcam as percorridas, e a
   atual tem aria-current="step" (accessibility.md). */
.stage-crumbs { margin: 14px 0 22px; }
.stage-crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; row-gap: var(--space-2); }
.stage-crumbs li { display: inline-flex; align-items: center; font-size: 13px; font-weight: 500; color: var(--text-faint); }
.stage-crumbs li + li::before,
.pipeline-step + .pipeline-step::before {
  content: ""; flex-shrink: 0; width: 6px; height: 6px; margin: 0 10px 0 6px;
  border-top: 2px solid var(--border-strong); border-right: 2px solid var(--border-strong); transform: rotate(45deg);
}
.stage-crumbs .crumb { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; line-height: 1.2; }
.stage-crumbs li.done { color: var(--text-muted); }
.stage-crumbs li.done svg { color: var(--success); }
.stage-crumbs li.current .crumb { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; box-shadow: inset 0 0 0 1px var(--brand-line); }
@keyframes fluxo { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-sunken); color: var(--text-muted);
  border: var(--border-w) solid var(--border);
  white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.form-grid.full { grid-template-columns: 1fr; }

/* .main não tem mais teto de largura geral (a tabela de Domínios precisa do
   espaço extra pra rolar menos — ver .dominios-table-wrap). Em vez disso,
   cada seção do formulário que NÃO é a tabela larga usa esta classe pra
   manter a largura confortável de campo que tinha antes; a seção de
   Domínios fica de fora de propósito, sem essa classe. */
.fieldset-narrow { max-width: 1080px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.span-2 { grid-column: span 2; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.field .hint { font-size: 12px; color: var(--text-faint); }
.field input, .field select, .field textarea {
  min-height: 36px; padding: 8px 11px; border: var(--border-w) solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); width: 100%;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--border-strong); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent-ink); box-shadow: var(--ring);
}
.field input[type="checkbox"] { min-height: 0; width: 16px; height: 16px; accent-color: var(--accent); }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: var(--surface-sunken); color: var(--text-faint); }
.field textarea { resize: vertical; min-height: 72px; }
.field.invalid input, .field.invalid select { border-color: var(--danger); }
.field .error { font-size: 12px; color: var(--danger); }
/* min-width: 0 desfaz o comportamento padrão de <fieldset> de nunca encolher
   abaixo da largura do conteúdo — sem isso, uma tabela larga lá dentro
   (.dominios-table-wrap) força a página inteira a alargar em vez de deixar
   só o wrapper da tabela rolar horizontalmente. */
fieldset { border: none; padding: 0; margin: 0 0 24px; min-width: 0; }
legend { padding: 0; margin-bottom: 12px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--accent); }

.dominio-block {
  border: var(--border-w) solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; margin-bottom: 16px; background: var(--surface-sunken);
}
.dominio-block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

/* overflow-x: scroll (não "auto") + scrollbar sempre visível e mais grossa —
   a tabela de domínios tem muitas colunas e passa da largura da tela quase
   sempre; com "auto" a barra fina do Windows/trackpad é fácil de não notar. */
.dominios-table-wrap {
  overflow-x: scroll; border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); margin-bottom: 10px;
  background: var(--surface);
  scrollbar-width: auto; scrollbar-color: var(--brand-line) var(--surface-sunken);
}
.dominios-table-wrap::-webkit-scrollbar { height: 14px; }
.dominios-table-wrap::-webkit-scrollbar-track { background: var(--surface-sunken); }
.dominios-table-wrap::-webkit-scrollbar-thumb { background: var(--brand-line); border-radius: 7px; border: 3px solid var(--surface-sunken); min-width: 60px; }
.dominios-table-wrap::-webkit-scrollbar-thumb:hover { background: var(--accent); }
/* Sem isso o Chrome/Edge no Windows desenha setinhas de avançar/voltar nas
   pontas em vez de só a barra — ficava parecendo "2 setinhas" soltas em vez
   de uma barra de rolagem reconhecível. */
.dominios-table-wrap::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.dominios-table-wrap::-webkit-scrollbar-corner { background: transparent; }
.dominios-table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 13px; }
.dominios-table th, .dominios-table td { padding: 9px 11px; border-bottom: var(--border-w) solid var(--border); white-space: nowrap; }
.dominios-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); background: var(--surface-sunken); position: sticky; top: 0; }
.dominios-table tbody tr:last-child td { border-bottom: none; }
.dominios-table input, .dominios-table select {
  min-height: 32px; padding: 6px 8px; border: var(--border-w) solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); min-width: 110px;
}
.dominios-table input:focus, .dominios-table select:focus { outline: none; border-color: var(--accent-ink); box-shadow: var(--ring); }
.dominios-table input[type="date"] { min-width: 130px; }
.dominios-table input[type="checkbox"] { width: 16px; min-width: 0; min-height: 0; accent-color: var(--accent); }
.dominios-table input[type="number"] { min-width: 100px; }
.dominios-table td:first-child input { min-width: 140px; }
.dominio-row-actions { display: flex; gap: 4px; white-space: nowrap; }

/* Primeira Venda, passo 2: um <tbody> por domínio — a linha principal e a
   sublinha de add-ons logo abaixo (como os subitens do Monday). */
.wizard[data-passo="2"] { grid-template-columns: minmax(0, 1fr); }
.wizard[data-passo="2"] .wizard-summary { display: none; }
.dominios-rodape { display: flex; align-items: center; gap: var(--space-5); margin-top: var(--space-3); color: var(--text-muted); font-size: 13px; }
.dominios-rodape #btn-add-dominio { margin-right: auto; }
.dominios-rodape strong { color: var(--text); margin-left: 4px; }
.dominios-linhas td { vertical-align: top; padding: 8px 6px; }
.dominios-linhas th { padding: 9px 6px; }
.dominios-linhas input, .dominios-linhas select { min-width: 0; }
.dominios-linhas [data-key="dominio"] { width: 150px; min-width: 0; }
.dominios-linhas [data-key="tipo"] { width: 112px; }
.dominios-linhas [data-key="operacao"] { width: 132px; }
.dominios-linhas [data-key="plano"] { width: 140px; }
.dominios-linhas input[type="date"] { width: 128px; min-width: 0; }
.dominios-linhas [data-key="receita_plugin"] { width: 112px; min-width: 0; }
.dominios-linhas [data-role="plano-desc"] { white-space: normal; max-width: 140px; }
.dominios-linhas .dominio-num-cell { padding-top: 14px; }
.dominios-linhas .dominio-linha + .dominio-linha > tr:first-child > td { border-top: 2px solid var(--border); }
.cell-hint { display: block; margin-top: 3px; font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.subdominios-cell { width: 220px; min-width: 200px; max-width: 300px; white-space: normal !important; }
.subdominios-cell .tags-input { min-height: 32px; padding: 3px 6px; }
.dominios-table .tags-input input { flex: 1 1 60px; border: none; box-shadow: none; min-width: 60px; min-height: 24px; padding: 2px; background: transparent; }
.subdominios-cell .error { display: block; font-size: 11.5px; color: var(--danger); white-space: normal; }
.dominio-sub > td { background: var(--surface-sunken); white-space: normal; padding-top: 6px; padding-bottom: 8px; }
/* contain: a sublinha não alarga as colunas; sticky: fica à vista quando a
   tabela rola para o lado. (.addons.addons-linhas vence o .addons dos cards.) */
.addons.addons-linhas { margin: 0; padding: 0; border-top: none; grid-template-columns: 1fr; gap: 6px; contain: inline-size; position: sticky; left: 42px; width: 840px; max-width: calc(100vw - 620px); min-width: 560px; }
/* Número e domínio ficam fixos na rolagem horizontal — sempre se vê de qual
   domínio é a linha. */
.dominios-linhas tr > :nth-child(1), .dominios-linhas tr > :nth-child(2) { position: sticky; z-index: 1; background: var(--surface); }
.dominios-linhas tr > :nth-child(1) { left: 0; width: 36px; }
.dominios-linhas tr > :nth-child(2) { left: 36px; box-shadow: 1px 0 0 var(--border); }
.dominios-linhas thead th:nth-child(1), .dominios-linhas thead th:nth-child(2) { z-index: 2; background: var(--surface-sunken); }
.dominios-linhas .dominio-sub > td { position: static; box-shadow: none; }
.addons.addons-linhas .addons-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; }
/* Um add-on por linha: nome · quantidade · receita · tabela/desconto · remover. */
.addons.addons-linhas .addon { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 5px 10px; }
.addons.addons-linhas .addon > .flex-between { display: contents; }
.addons.addons-linhas .addon strong { flex: 1 1 200px; font-weight: 600; }
.addons-linhas .addon [data-action="remover-adicional"] { order: 2; margin-left: auto; }
.addons.addons-linhas .addon-valor { flex-direction: row; align-items: center; gap: 8px; }
.addons-linhas .addon-valor input { width: 120px; min-width: 0; }
.addons-linhas .addon-valor input[data-campo="quantidade"] { width: 72px; }
.addons-linhas .addon-desc { white-space: nowrap; }
.addons-linhas select { max-width: 360px; }

.field-computed {
  min-height: 36px; padding: 8px 11px; border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface-sunken); color: var(--text); font-weight: 600;
}

/* Avisos: cor de fundo suave + filete à esquerda. O tipo também está no
   texto ("Atenção", o próprio conteúdo), nunca só na cor. */
.alert {
  position: relative;
  border-radius: var(--radius); padding: 11px 14px 11px 16px; font-size: 13px; margin-bottom: 14px;
  border: var(--border-w) solid var(--border); background: var(--surface-sunken); color: var(--text);
}
.alert::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: currentColor; opacity: 0.85;
}
.alert-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.alert-info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.alert-success { background: var(--success-soft); border-color: transparent; color: var(--success); }
/* Era usada em 6 telas sem estar definida — os avisos de "atenção" saíam
   cinza, iguais a um aviso neutro. */
.alert-warning { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.alert strong { color: inherit; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: var(--border-w) solid var(--border); }
.table th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.table tbody tr:hover td { background: var(--surface-sunken); }

/* Linhas clicáveis do dashboard (montadas com estilo inline em dashboard.js). */
.table-row-link > div { transition: background 0.12s var(--ease); }
.table-row-link:hover > div { background: var(--surface-sunken); }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: var(--border-w) solid var(--border); }
.timeline-item:last-child { border-bottom: none; }
.timeline-item .who { font-weight: 600; }
.timeline-item .when { color: var(--text-faint); font-size: 12px; }
.timeline-item .diff { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.timeline-item .diff .old { text-decoration: line-through; color: var(--text-faint); }

/* ---------- Login ----------
   O único momento de marca da aplicação (branding.md › "consider displaying a
   welcome ... screen that incorporates your branding"). Duas colunas: à
   esquerda o painel da marca, sempre escuro nos dois temas, com as etapas
   reais da esteira ligadas pela linha de fluxo; à direita o card de entrada,
   sólido e legível. Contraste no painel: texto #f3f4f6 e #b9bcc4 sobre
   #111216 = 17,6:1 e 9,9:1; laranja #ff9a5c = 8,2:1. */
.login-shell {
  min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: var(--canvas);
}
.login-split {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: stretch; padding: 0;
}
.login-hero {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: 44px 56px; color: #f3f4f6;
  background:
    radial-gradient(55% 45% at 85% 12%, rgba(242, 128, 58, 0.30), transparent 70%),
    radial-gradient(45% 40% at 10% 95%, rgba(242, 128, 58, 0.16), transparent 70%),
    radial-gradient(circle, rgba(255, 255, 255, 0.07) 1px, transparent 1.3px) 0 0 / 24px 24px,
    linear-gradient(160deg, #17181d, #0d0e11);
}
.brand-on-dark { padding: 0; }
.brand-on-dark .brand-name { color: #fff; font-size: 22px; }
.brand-on-dark .brand-name span { color: #ff9a5c; }
.login-hero-copy { max-width: 520px; }
.login-eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: #ff9a5c; margin-bottom: 14px;
}
.login-headline {
  font-size: clamp(30px, 3.4vw, 46px); line-height: 1.08; letter-spacing: -0.035em;
  font-weight: 800; color: #fff; margin-bottom: 16px;
}
.login-sub { font-size: 16px; line-height: 1.55; color: #b9bcc4; max-width: 440px; }

/* A esteira: os nós são as etapas de verdade (STATUSES), e a linha que os liga
   enche uma vez ao abrir. */
.login-flow {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, 1fr); position: relative;
}
.login-flow::before, .login-flow::after {
  content: ""; position: absolute; top: 8px; left: 10%; right: 10%; height: 3px; border-radius: 3px;
}
.login-flow::before { background: rgba(255, 255, 255, 0.12); }
.login-flow::after {
  background: linear-gradient(90deg, #d9531a, #ff9d52);
  transform-origin: left center; animation: fluxo 1.6s var(--ease) 0.2s both;
}
.login-flow li { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.login-flow .node {
  width: 19px; height: 19px; border-radius: 50%;
  background: #111216; border: 3px solid #ff9d52;
  box-shadow: 0 0 0 5px rgba(242, 128, 58, 0.16);
}
.login-flow li:last-child .node { background: #ff9d52; }
.login-flow .name { font-size: 12.5px; font-weight: 600; color: #d6d8de; line-height: 1.25; }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border: var(--border-w) solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-float); padding: 34px;
}
.login-title { font-size: 24px; letter-spacing: -0.025em; margin-bottom: 6px; }
.login-card #login-error:not(:empty) { margin-top: 12px; }
.login-card .btn-lg { margin-top: 18px; }
.login-foot { margin: 16px 0 0; font-size: 12.5px; color: var(--text-faint); text-align: center; }
.login-role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 4px; }
.role-tile {
  border: var(--border-w) solid var(--border); border-radius: var(--radius); padding: 12px 11px;
  background: var(--surface); color: var(--text); cursor: pointer; text-align: left;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.role-tile:hover { border-color: var(--brand-line); }
.role-tile.selected { border-color: var(--accent-ink); background: var(--accent-soft); box-shadow: var(--ring); }
.role-tile .name { font-weight: 700; display: block; }
.role-tile .desc { font-size: 12px; color: var(--text-muted); }

.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-state .btn { margin-top: var(--space-3); }

/* ---------- Formulário em passos (Primeira Venda) ----------
   Três colunas no desktop: passos | formulário | resumo fixo. Abaixo de
   1180px o resumo desce para baixo dos passos; no celular, tudo empilha. */
/* Passos numa linha no topo (antes, coluna à esquerda): a largura toda fica
   para o conteúdo do passo. */
.wizard { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--space-4) var(--space-5); align-items: start; }
.wizard-steps { grid-column: 1 / -1; }
.wizard-steps ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.wizard-steps li.is-issue button::after { margin-left: 8px; }
.wizard-steps li button {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  min-height: 40px; padding: 6px 10px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--text-muted); font-weight: 600; cursor: pointer;
}
.wizard-steps li button:hover { background: var(--surface-sunken); color: var(--text); }
.wizard-num {
  display: inline-grid; place-items: center; flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--border-strong); font-size: 12.5px; font-weight: 700; background: var(--surface); color: var(--text-muted);
}
.wizard-steps li.is-current button { background: var(--accent-soft); color: var(--accent-ink); }
.wizard-steps li.is-current .wizard-num { border-color: var(--brand-line); color: var(--accent-ink); }
.wizard-steps li.is-done .wizard-num { background: var(--success); border-color: var(--success); color: var(--surface); }
.wizard-steps li.is-issue .wizard-num { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.wizard-steps li.is-issue button::after { content: "pendente"; margin-left: auto; font-size: 11px; font-weight: 600; color: var(--danger); }
.wizard-body { min-width: 0; }
.wizard-step-title { display: flex; align-items: center; gap: 10px; font-size: 20px; margin: 0 0 var(--space-4); }
.wizard-step-title:focus { outline: none; }
.wizard-step .card h3 { margin-bottom: var(--space-3); }

.wizard-summary {
  position: sticky; top: var(--space-5);
  background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); padding: var(--space-5);
}
.summary-eyebrow { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 0 0 6px; }
.summary-cliente { font-size: 16px; font-weight: 700; margin: 0 0 var(--space-4); overflow-wrap: anywhere; }
.wizard-summary dl { margin: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.wizard-summary dl > div { display: flex; justify-content: space-between; gap: var(--space-3); align-items: baseline; padding-bottom: var(--space-3); border-bottom: var(--border-w) solid var(--border); }
.wizard-summary dl > div:last-child { border-bottom: none; padding-bottom: 0; }
.wizard-summary dt { color: var(--text-muted); font-size: 13px; }
.wizard-summary dd { margin: 0; font-weight: 700; white-space: nowrap; }
.wizard-summary .summary-total { font-size: 18px; color: var(--text); }
.summary-hint { font-size: 12px; color: var(--text-faint); margin: var(--space-4) 0 0; }

/* Barra de ações sempre à vista no pé da tela. */
.wizard-actions {
  position: sticky; bottom: 12px; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-3);
  margin-top: var(--space-4); padding: var(--space-3) var(--space-4);
  background: var(--surface-glass); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
  border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-float);
}
.wizard-actions-right { display: flex; gap: var(--space-2); }

/* Grid de 12 colunas: cada campo com a largura do dado (CEP 3, UF 2...). */
.form-grid.cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-4); }
.form-grid.cols-12 > * { grid-column: span 12; }
.form-grid.cols-12 > .col-2 { grid-column: span 2; }
.form-grid.cols-12 > .col-3 { grid-column: span 3; }
.form-grid.cols-12 > .col-4 { grid-column: span 4; }
.form-grid.cols-12 > .col-5 { grid-column: span 5; }
.form-grid.cols-12 > .col-6 { grid-column: span 6; }
.form-grid.cols-12 > .col-7 { grid-column: span 7; }
.form-grid.cols-12 > .col-8 { grid-column: span 8; }
.input-with-action { display: flex; gap: var(--space-2); }
.input-with-action input { flex: 1; min-width: 0; }

/* Domínio como cartão — no lugar da tabela de 19 colunas com rolagem lateral. */
.dominio-cards { display: flex; flex-direction: column; gap: var(--space-4); margin-bottom: var(--space-4); }
.dominio-card { margin: 0; }
.dominio-card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.dominio-card-head h3 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; text-transform: none; letter-spacing: -0.01em; color: var(--text); }
.dominio-num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 700;
}
.addons { margin-top: var(--space-4); padding-top: var(--space-4); border-top: var(--border-w) solid var(--border); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.addons-title { grid-column: 1 / -1; margin: 0; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.addon { border: var(--border-w) solid var(--border); border-radius: var(--radius); padding: var(--space-3); background: var(--surface-sunken); display: flex; flex-direction: column; gap: var(--space-2); transition: border-color 0.15s var(--ease), background 0.15s var(--ease); }
.addon.is-on { border-color: var(--brand-line); background: var(--surface); }
.addon-toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; min-height: 28px; }
.addon-toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
.addon-valor { display: flex; flex-direction: column; gap: 4px; }
.addon-valor input { min-height: 34px; padding: 6px 10px; border: var(--border-w) solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); width: 100%; }
.addon-valor input:disabled { background: transparent; color: var(--text-faint); }
.addon-valor input:focus { outline: none; border-color: var(--accent-ink); box-shadow: var(--ring); }
.addon-desc { font-size: 12px; color: var(--text-faint); }

/* Subdomínios: tags dentro de um campo que parece um input (subdominios.js). */
.tags-input { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 38px; padding: 5px 8px; border: var(--border-w) solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tags-input:focus-within { border-color: var(--accent-ink); box-shadow: var(--ring); }
.tags-input.is-invalid { border-color: var(--danger); }
.tags-input.is-disabled { background: transparent; }
.tags-input input { flex: 1 1 160px; min-width: 120px; border: none; outline: none; background: transparent; color: var(--text); padding: 4px 2px; min-height: 0; box-shadow: none; }
.tag-removivel { gap: 4px; color: var(--text); font-weight: 500; }
.tag-removivel button { border: none; background: none; padding: 0 2px; font-size: 14px; line-height: 1; color: var(--text-muted); cursor: pointer; border-radius: 4px; }
.tag-removivel button:hover, .tag-removivel button:focus-visible { color: var(--text); background: var(--border); }
.dominio-card-foot { display: flex; justify-content: flex-end; gap: var(--space-5); margin-top: var(--space-4); padding-top: var(--space-3); border-top: var(--border-w) solid var(--border); color: var(--text-muted); font-size: 13px; }
.dominio-card-foot strong { color: var(--text); margin-left: 4px; }

/* Escolha com explicação (radio em cartão). */
.choice-group { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.choice-group legend { grid-column: 1 / -1; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: var(--space-3); border: var(--border-w) solid var(--border); border-radius: var(--radius); cursor: pointer; }
.choice input { margin-top: 3px; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent-ink); background: var(--accent-soft); }
.choice span { display: flex; flex-direction: column; gap: 2px; }
.choice small { color: var(--text-muted); font-size: 12.5px; }
.details-summary { cursor: pointer; font-weight: 700; }

/* Pendências da revisão: bloqueia (vermelho) e pede atenção (âmbar). */
.pendencias { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.pendencia { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: 10px 12px; border-radius: var(--radius); font-size: 13.5px; }
.pendencia.is-bloqueio { background: var(--danger-soft); color: var(--danger); }
.pendencia.is-atencao { background: var(--warning-soft); color: var(--warning); }
.pendencia .btn { flex-shrink: 0; }
.pendencias-ok { margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--success-soft); color: var(--success); font-weight: 600; }

@media (max-width: 1180px) {
  .wizard { grid-template-columns: minmax(0, 1fr); }
  .wizard-summary { grid-column: 1; position: static; }
}

/* ---------- Tela de detalhe (cliente) ----------
   Uma tela só para o contrato. No topo, a etapa e o próximo passo com a
   ação; abaixo, os dados à esquerda e contratos + histórico à direita. */
.next-step { padding: var(--space-5); }
.next-step .stage-crumbs { margin: 0 0 var(--space-4); }
.next-step #tracker-card > h2 { display: none; }  /* o cabeçalho já diz qual é a tela */
.next-step-row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; padding-top: var(--space-4); border-top: var(--border-w) solid var(--border); }
.next-step-eyebrow { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 0 0 2px; }
.next-step.is-mine .next-step-eyebrow { color: var(--accent-ink); }
.next-step-text { font-size: 17px; font-weight: 700; margin: 0; }
.next-step-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--space-5); align-items: start; }
.detail-main { min-width: 0; }
.detail-side { position: sticky; top: var(--space-5); max-height: calc(100vh - 2 * var(--space-5)); overflow-y: auto; }
.detail-side .timeline-item { flex-direction: column; gap: 2px; }
.dominios-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--space-4); margin-top: var(--space-4); }
.dominio-bloco { border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4); background: var(--surface-sunken); min-width: 0; }
.dominio-bloco-titulo { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin: 0 0 var(--space-3); font-size: 14.5px; text-transform: none; letter-spacing: -0.01em; color: var(--text); }

/* Barra de salvar: só aparece quando há alteração (js/pages/clienteDetalhe.js). */
.save-bar {
  position: sticky; bottom: 12px; z-index: 5; margin-top: var(--space-4);
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg);
  background: var(--surface-glass); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
  border: var(--border-w) solid var(--brand-line); box-shadow: var(--shadow-float); font-weight: 600;
}

/* Quem só pode ler vê TEXTO, não dezenas de campos cinza desabilitados. */
.is-readonly .field input:disabled,
.is-readonly .field select:disabled,
.is-readonly .field textarea:disabled {
  border-color: transparent; background: transparent; padding-left: 0; min-height: 0;
  color: var(--text); -webkit-text-fill-color: var(--text); opacity: 1;
  appearance: none; -webkit-appearance: none; cursor: default; resize: none;
}
.is-readonly .field label { font-weight: 500; }
.is-readonly .field.is-empty input,
.is-readonly .field.is-empty select,
.is-readonly .field.is-empty textarea { display: none; }
.is-readonly .field.is-empty::after { content: "—"; color: var(--text-faint); }

@media (max-width: 1180px) {
  .detail-layout { grid-template-columns: minmax(0, 1fr); }
  .detail-side { position: static; max-height: none; }
}

/* ---------- Renovação e cancelamento ---------- */
.oque-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); margin-top: var(--space-3); }
.oque-card {
  display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer;
  padding: var(--space-4); border-radius: var(--radius-lg); border: var(--border-w) solid var(--border);
  background: var(--surface); color: var(--text);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.oque-card strong { font-size: 15.5px; }
.oque-card span { color: var(--text-muted); font-size: 13px; }
.oque-card:hover { border-color: var(--brand-line); }
.oque-card.is-selected { border-color: var(--accent-ink); background: var(--accent-soft); box-shadow: var(--ring); }
.oque-card:focus-visible { outline: none; box-shadow: var(--ring); }

.renov-lista { display: flex; flex-direction: column; gap: var(--space-3); }
.renov-item {
  display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: var(--space-3) var(--space-4); align-items: end;
  padding: var(--space-4); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); background: var(--surface-sunken);
}
.renov-item.is-on { border-color: var(--brand-line); background: var(--surface); }
.renov-item:not(.is-on) .renov-valor, .renov-item:not(.is-on) .renov-mais { opacity: 0.5; }
.renov-check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.renov-check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.renov-check span { display: flex; flex-direction: column; gap: 2px; }
.renov-check small { color: var(--text-muted); font-size: 12.5px; }
.renov-mais { grid-column: 1 / -1; }
.renov-mais summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-muted); }

@media (max-width: 760px) {
  .oque-grid { grid-template-columns: 1fr; }
  .renov-item { grid-template-columns: 1fr; }
}

/* Confirmação dentro da tela (no lugar de prompt/confirm nativos). */
.inline-confirm { margin-top: var(--space-4); padding: var(--space-4); border-radius: var(--radius-lg); border: var(--border-w) solid var(--brand-line); background: var(--accent-soft); }
.inline-confirm-title { font-weight: 700; margin: 0 0 4px; }

/* Quadro-resumo do contrato (2026-11-03): rótulo à esquerda, valor à direita,
   como o quadro do documento — é o que o jurídico confere antes de gerar. */
.quadro-resumo { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; margin: 0; border: var(--border-w) solid var(--border); border-radius: var(--radius); overflow: hidden; }
.quadro-resumo dt, .quadro-resumo dd { margin: 0; padding: 8px 12px; border-top: var(--border-w) solid var(--border); }
.quadro-resumo dt:first-of-type, .quadro-resumo dd:first-of-type { border-top: 0; }
.quadro-resumo dt { font-weight: 600; color: var(--text-muted); background: var(--surface-sunken); }
@media (max-width: 640px) {
  .quadro-resumo { grid-template-columns: 1fr; }
  .quadro-resumo dd { border-top: 0; padding-top: 0; }
}

/* Rodadas da negociação com o cliente. */
.rodada { border: var(--border-w) solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-top: 10px; }
.pedido-cliente { margin: 6px 0 0; padding: 8px 10px; border-left: 3px solid var(--brand-line); background: var(--surface-sunken); border-radius: 4px; }
.inline-confirm .field textarea { background: var(--surface); }
.inline-confirm-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-3); }

/* ---------- Peças de js/ui.js ---------- */
.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; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.page-header h1 { margin: 0; }
.page-subtitle { color: var(--text-muted); margin: 6px 0 0; font-size: 14.5px; }
.page-back { display: inline-block; margin-bottom: var(--space-2); font-size: 13px; font-weight: 600; text-decoration: none; color: var(--text-muted); }
.page-back:hover { color: var(--accent-ink); }
.page-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.search-field { width: min(420px, 100%); margin: 0; }

.section { margin-bottom: var(--space-6); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.section-head h2 { margin: 0; }

/* Selo de etapa: a cor vem de --st, o nome está sempre escrito. */
.badge-status .dot { background: var(--st); }
/* Selo neutro — operação, perfil. Cor é só para etapa (color.md). */
.tag {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  background: var(--surface-sunken); border: var(--border-w) solid var(--border); white-space: nowrap;
}

/* Tabela de dados: <table> de verdade, linha inteira clicável. */
.table-wrap { background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); background: var(--surface-sunken); padding: 10px 16px; border-bottom: var(--border-w) solid var(--border);
}
.data-table td { padding: 13px 16px; border-bottom: var(--border-w) solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tr.is-link { position: relative; cursor: pointer; transition: background 0.12s var(--ease); }
.data-table tr.is-link:hover td { background: var(--surface-sunken); }
.data-table .row-link { color: var(--text); font-weight: 600; text-decoration: none; }
.data-table .row-link::after { content: ""; position: absolute; inset: 0; }
.data-table .row-link:focus-visible { outline: none; }
.data-table tr.is-link:focus-within td { background: var(--accent-soft); }
.data-table .num { text-align: right; white-space: nowrap; }
.data-table .muted { color: var(--text-muted); }
.cell-sub { display: block; font-size: 12.5px; font-weight: 400; color: var(--text-muted); margin-top: 2px; }

/* Abas de filtro. */
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-sunken); border: var(--border-w) solid var(--border); border-radius: 11px; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 12px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); font-weight: 600; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 18, 24, 0.08); }
.tab-count { font-size: 11.5px; padding: 0 6px; border-radius: 999px; background: var(--surface-sunken); color: var(--text-muted); }
.tab.is-active .tab-count { background: var(--accent-soft); color: var(--accent-ink); }

/* A esteira como resumo, em breadcrumb (2026-11-03): etapa + quantidade, na
   ordem do fluxo, com o mesmo chevron do andamento do contrato. Cada etapa
   filtra; a selecionada fica na pílula laranja. Etapa vazia fica apagada,
   mas continua clicável. */
.pipeline {
  list-style: none; margin: 0 0 var(--space-5); padding: var(--space-3) var(--space-4);
  display: flex; flex-wrap: wrap; align-items: center; row-gap: var(--space-2);
  background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.pipeline-step { display: inline-flex; align-items: center; }
.pipeline-step button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 8px 6px 12px;
  background: none; border: 0; border-radius: 999px; cursor: pointer;
  color: var(--text-muted); font-size: 13.5px; font-weight: 600;
}
.pipeline-count {
  min-width: 24px; padding: 2px 8px; border-radius: 999px; text-align: center;
  background: var(--surface-sunken); color: var(--text); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.pipeline-step:not(.has-items) button { color: var(--text-faint); font-weight: 500; }
.pipeline-step:not(.has-items) .pipeline-count { background: transparent; color: var(--text-faint); box-shadow: inset 0 0 0 1px var(--border); }
.pipeline-step button:hover { background: var(--surface-sunken); color: var(--text); }
.pipeline-step.is-active button { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--brand-line); }
.pipeline-step.is-active .pipeline-count { background: var(--surface); color: var(--accent-ink); }

/* Atraso por etapa: neutro, atenção, e vermelho só quando passou muito. */
.aging { font-size: 12.5px; font-weight: 600; white-space: nowrap; color: var(--text-muted); }
.aging.is-warn { color: var(--warning); }
.aging.is-late { color: var(--danger); }


/* Movimento só onde explica algo (a linha de fluxo enchendo, o card
   levantando ao passar o mouse) — e nada disso com Reduzir Movimento. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Reduzir Transparência: a barra lateral e o fundo dos modais ficam sólidos. */
@media (prefers-reduced-transparency: reduce) {
  .sidebar { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .modal-backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(10, 11, 14, 0.6); }
}

@media (max-width: 760px) {
  #app, .app-shell { flex-direction: column; align-items: stretch; }
  .sidebar {
    position: static; width: auto; height: auto; margin: 8px; padding: 10px 12px;
    flex-direction: row; align-items: center; gap: 12px; overflow-x: auto;
  }
  .sidebar > * { flex-shrink: 0; }
  .sidebar .brand-mark { width: 28px; height: 28px; }
  .sidebar .brand-name { font-size: 17px; }
  .login-split { grid-template-columns: 1fr; }
  .login-hero { padding: 28px 22px; gap: 26px; }
  .login-flow .name { font-size: 11px; }
  .login-panel { padding: 24px 16px 40px; }
  .login-card { padding: 24px; }
  .nav { flex-direction: row; }
  .nav a { white-space: nowrap; }
  .role-switcher { flex-direction: row; align-items: center; white-space: nowrap; }
  .nav a.active::before { display: none; }
  .demo-banner { margin-top: 0; min-width: 240px; }
  /* No celular o menu já é uma faixa no topo: não recolhe. */
  .sidebar-toggle { display: none; }
  .menu-recolhido .sidebar { width: auto; padding: 10px 12px; }
  .menu-recolhido .brand { flex-direction: row; }
  .menu-recolhido .brand-name, .menu-recolhido .nav-label { display: inline; }
  .menu-recolhido .role-switcher { display: flex; }
  .menu-recolhido .demo-banner { display: block; }
  .menu-recolhido .nav a { padding: 7px 10px; }
  .main { padding: 18px 16px 40px; }
  h1 { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: span 1; }
  .kanban { grid-template-columns: 1fr; }
  /* minmax(0, 1fr): sem isso a coluna cresce até caber a faixa de passos
     (que rola na horizontal) e o formulário vaza da tela. */
  .wizard { grid-template-columns: minmax(0, 1fr); }
  .wizard-steps { position: static; }
  .wizard-steps ol { flex-direction: row; overflow-x: auto; }
  .wizard-steps li button span:last-child { white-space: nowrap; }
  .wizard-summary { grid-column: 1; }
  .form-grid.cols-12 > * { grid-column: span 12 !important; }
  .addons, .choice-group { grid-template-columns: 1fr; }
}

/* Pendências: o que chegou e você ainda não abriu. Cor + palavra, nunca só a cor. */
.badge.badge-novo { background: var(--warning-soft); color: var(--warning); border-color: transparent; font-weight: 700; }

/* Dashboard: alternância Lista | Colunas (antes eram duas telas). */
.visao-toggle { display: inline-flex; border: var(--border-w) solid var(--border); border-radius: var(--radius); overflow: hidden; }
.visao-toggle button { background: var(--surface); border: 0; padding: 6px 12px; font: inherit; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.visao-toggle button + button { border-left: var(--border-w) solid var(--border); }
.visao-toggle button[aria-pressed="true"] { background: var(--surface-sunken); color: var(--text); font-weight: 600; }

/* ---------- Carregando (js/carregando.js) ----------
   O botão clicado ganha uma bolinha girando enquanto a ação não volta, e uma
   barra fina anda no topo da tela. Antes o botão só ficava cinza e não dava
   para saber se algo estava acontecendo. */
@keyframes girar { to { transform: rotate(360deg); } }
@keyframes barra-andando { from { left: -40%; } to { left: 100%; } }

.is-loading::before {
  content: ""; flex: none; display: inline-block;
  width: 1em; height: 1em; margin-right: 0.45em; vertical-align: -0.15em;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: girar 0.7s linear infinite;
}
.btn.is-loading::before { margin-right: 0; } /* .btn já tem gap */
/* Ocupado não é "proibido": sem o cinza de desabilitado e com cursor de espera. */
.btn.is-loading:disabled, button.is-loading:disabled { opacity: 0.85; cursor: progress; }
html.is-carregando, html.is-carregando * { cursor: progress; }

.barra-carregando {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 10000;
  overflow: hidden; pointer-events: none; opacity: 0; transition: opacity 0.2s var(--ease);
}
.barra-carregando.ativa { opacity: 1; }
.barra-carregando::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%;
  background: var(--accent); border-radius: 0 2px 2px 0;
  animation: barra-andando 1.1s ease-in-out infinite;
}

/* Com Reduzir Movimento o resto do app para (regra acima), mas "está
   carregando" é estado, não enfeite: o indicador continua, mais devagar. */
@media (prefers-reduced-motion: reduce) {
  .is-loading::before { animation: girar 1.6s linear infinite !important; }
  .barra-carregando::after { animation: none !important; left: 0; width: 100%; opacity: 0.6; }
}

/* Dashboard: Vendas | Renovações e cancelamentos (2026-11-11). */
.segmento-toggle { margin-bottom: 16px; }
.segmento-toggle .tab-count { margin-left: 6px; }

/* Renovação: lista "Em andamento" acima da escolha do cliente. */
.em-andamento-lista { margin-top: 10px; }
.em-andamento-linha {
  display: grid; grid-template-columns: minmax(0, 2fr) auto auto minmax(0, 2fr) auto;
  gap: 12px; align-items: center; padding: 8px 6px; color: inherit; text-decoration: none;
  border-top: var(--border-w) solid var(--border);
}
.em-andamento-linha:hover { background: var(--surface-sunken); }
@media (max-width: 760px) {
  .em-andamento-linha { grid-template-columns: 1fr auto; }
  .em-andamento-linha > :nth-child(4), .em-andamento-linha > :nth-child(5) { display: none; }
}

/* Renovação: confirmação do registro (2026-11-11). */
.registro-ok { display: flex; gap: 16px; align-items: flex-start; border-color: var(--success, #2e7d32); }
.registro-ok-icone {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--success, #2e7d32); color: #fff;
}
.registro-ok-acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* Por que a ação está travada, ao lado do botão (ex.: "gere o documento"). */
.acao-motivo { align-self: center; font-size: 12.5px; max-width: 280px; }

/* Renovação numa tela só (2026-11-11): domínio que não renovou fica discreto. */
.renov-item.is-off { background: var(--surface-sunken); }
.renov-item .visao-toggle button[aria-pressed="true"][data-acao="cancelar"] { color: var(--danger); }
/* O item agora é cabeçalho (domínio + Renovou/Não renovou) e corpo
   (plano, valores, add-ons ou motivo): bloco, não a grade de duas colunas. */
.renov-lista .renov-item { display: block; }
.renov-item:not(.is-on) .renov-mais { opacity: 1; }
