/* =================================================================
   SONDA — Design System
   SaaS de inteligência comercial B2B (Cognix360 / cognixlab)
   Tema: Deep Slate (escuro premium). Accent: ciano-radar.
   Autora: Nova (direção de arte JM). Mobile-first, CSS puro.
   Contraste alvo: AA. Tokens reversíveis.
   ================================================================= */

/* ---------- Fontes (Google Fonts) ----------
   Carregar no <head> do app:
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=Inter:wght@400;450;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
*/

/* =================================================================
   1. TOKENS
   ================================================================= */
:root {
  /* --- Superfícies / profundidade (do mais fundo ao mais alto) --- */
  --bg:            #0a0e14;   /* fundo absoluto da app (slate quase-preto, levemente azulado) */
  --bg-elevated:   #0e131b;   /* faixas, zonas atrás de cards */
  --surface:       #131923;   /* card / painel padrão */
  --surface-2:     #182230;   /* card elevado / hover de linha / popover */
  --surface-3:     #1f2b3a;   /* estado ativo / seleção */

  /* --- Bordas (a "luz" que separa camadas — técnica Linear) --- */
  --border:        #232e3d;   /* borda padrão 1px */
  --border-soft:   #1b2531;   /* divisória interna sutil */
  --border-strong: #33425a;   /* borda em hover / foco de container */

  /* --- Primária (ciano-radar — o "faro") --- */
  --primary:        #2dd4bf;  /* teal-ciano elétrico: precisão, sinal, dado vivo */
  --primary-hover:  #14b8a6;  /* hover/active mais fundo */
  --primary-press:  #0d9488;  /* pressed */
  --primary-soft:   rgba(45, 212, 191, 0.12);  /* fundo de chip/realce */
  --primary-glow:   rgba(45, 212, 191, 0.32);  /* halo de foco/glow */
  --on-primary:     #04201c;  /* texto sobre botão primário (escuro p/ contraste AA no ciano) */

  /* --- Accent / secundária (índigo-elétrico — contraponto frio, hero) --- */
  --accent:         #818cf8;  /* índigo claro: usado em destaques, gráficos, hero */
  --accent-soft:    rgba(129, 140, 248, 0.14);
  --accent-glow:    rgba(129, 140, 248, 0.30);

  /* --- Texto --- */
  --text:          #eef2f7;   /* texto forte / títulos (AA forte sobre surface) */
  --text-muted:    #9fb0c3;   /* texto secundário / labels */
  --text-faint:    #64748b;   /* metadados, placeholders, texto desabilitado */
  --text-on-soft:  #cdd8e6;   /* texto dentro de chips soft */

  /* --- Estados semânticos (badges de e-mail + fit score) ---
     cada um tem: base (texto/ícone), bg (fundo do chip), border (contorno) */
  --success:        #34d399;  --success-bg: rgba(52, 211, 153, 0.13);  --success-border: rgba(52, 211, 153, 0.30);
  --warning:        #fbbf24;  --warning-bg: rgba(251, 191, 36, 0.13);  --warning-border: rgba(251, 191, 36, 0.30);
  --danger:         #f87171;  --danger-bg:  rgba(248, 113, 113, 0.13);  --danger-border: rgba(248, 113, 113, 0.30);
  --info:           #60a5fa;  --info-bg:    rgba(96, 165, 250, 0.13);   --info-border:   rgba(96, 165, 250, 0.30);
  --neutral:        #94a3b8;  --neutral-bg: rgba(148, 163, 184, 0.12);  --neutral-border: rgba(148, 163, 184, 0.26);

  /* --- Faixas de fit score (0–100) --- */
  --score-high:   #34d399;   /* 75–100 quente: alinhado ao ICP */
  --score-mid:    #fbbf24;   /* 45–74 morno */
  --score-low:    #f87171;   /* 0–44 frio */
  --score-track:  #1c2735;   /* trilho da barra */

  /* --- Tipografia --- */
  --font-display: 'Sora', system-ui, sans-serif;     /* títulos, KPIs, hero */
  --font-body:    'Inter', system-ui, sans-serif;     /* corpo, UI */
  --font-mono:    'JetBrains Mono', ui-monospace, monospace; /* números, CNPJ, e-mail, dados */

  --fs-display: 2.25rem;  /* 36px */
  --fs-h1:      1.5rem;   /* 24px */
  --fs-h2:      1.175rem; /* ~19px */
  --fs-h3:      1rem;     /* 16px */
  --fs-body:    0.9375rem;/* 15px */
  --fs-sm:      0.8125rem;/* 13px */
  --fs-xs:      0.6875rem;/* 11px — labels uppercase */

  --lh-tight: 1.15;
  --lh-snug:  1.35;
  --lh-base:  1.55;

  /* --- Espaçamento (escala 4px) --- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px;

  /* --- Raios --- */
  --r-xs: 6px; --r-sm: 8px; --r-md: 11px; --r-lg: 14px; --r-xl: 20px; --r-full: 999px;

  /* --- Sombras (profundidade real, não flat) --- */
  --sh-sm:  0 1px 2px rgba(0,0,0,0.40);
  --sh-md:  0 4px 16px -4px rgba(0,0,0,0.55), 0 2px 6px -2px rgba(0,0,0,0.40);
  --sh-lg:  0 16px 48px -12px rgba(0,0,0,0.70), 0 4px 12px -4px rgba(0,0,0,0.45);
  --sh-glow: 0 0 0 1px var(--primary-glow), 0 8px 28px -8px var(--primary-glow);

  /* --- Layout --- */
  --sidebar-w: 248px;
  --topbar-h:  60px;
  --maxw:      1320px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur:  160ms;
}

/* =================================================================
   2. RESET / BASE
   ================================================================= */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-base);
  color: var(--text);
  background-color: var(--bg);
  /* Atmosfera: glow radial no topo + grade de pontos sutil (técnica Vercel/Stripe).
     Drama com propósito: dá profundidade sem roubar a leitura do dado. */
  background-image:
    radial-gradient(900px 480px at 18% -8%, rgba(45, 212, 191, 0.10), transparent 60%),
    radial-gradient(780px 460px at 92% -4%, rgba(129, 140, 248, 0.10), transparent 62%),
    radial-gradient(circle at center, rgba(255,255,255,0.022) 1px, transparent 1px);
  background-size: auto, auto, 22px 22px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: var(--lh-tight); letter-spacing: -0.02em; color: var(--text); }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

a { color: inherit; text-decoration: none; }

::selection { background: var(--primary-soft); color: var(--text); }

/* Scrollbar discreta no clima do tema */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-full); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* Foco visível global (acessibilidade — nunca remover) */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* =================================================================
   3. UTILITÁRIOS
   ================================================================= */
.u-mono   { font-family: var(--font-mono); font-feature-settings: "tnum" 1, "zero" 1; }
.u-muted  { color: var(--text-muted); }
.u-faint  { color: var(--text-faint); }
.u-strong { color: var(--text); font-weight: 600; }
.u-label  { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-faint); font-weight: 600; }
.u-row    { display: flex; align-items: center; }
.u-gap-1  { gap: var(--sp-1); } .u-gap-2 { gap: var(--sp-2); } .u-gap-3 { gap: var(--sp-3); } .u-gap-4 { gap: var(--sp-4); }
.u-center { display: flex; align-items: center; justify-content: center; }
.u-grow   { flex: 1; }

/* =================================================================
   4. APP SHELL (sidebar + topbar)
   ================================================================= */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(19,25,35,0.72), rgba(10,14,20,0.72));
  backdrop-filter: blur(8px);
  padding: var(--sp-5) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3) var(--sp-5);
}
.brand__mark {
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  background: radial-gradient(120% 120% at 30% 20%, var(--primary), var(--primary-press));
  box-shadow: 0 0 0 1px rgba(45,212,191,0.30), 0 6px 18px -6px var(--primary-glow);
  flex-shrink: 0;
}
.brand__mark svg { display: block; }
.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand__name small {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 1px;
}

.nav-group { margin-top: var(--sp-3); }
.nav-group__label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-faint);
  font-weight: 600;
  padding: 0 var(--sp-3) var(--sp-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: var(--fs-body);
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active {
  background: var(--surface-3);
  color: var(--text);
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -var(--sp-3);
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  border-radius: var(--r-full);
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
  margin-left: -2px;
}
.nav-item .badge-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  background: var(--surface-3);
  color: var(--text-muted);
  padding: 1px 7px;
  border-radius: var(--r-full);
}

.sidebar__foot { margin-top: auto; }
.user-chip {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-soft);
  background: var(--surface);
}
.user-chip__avatar {
  width: 30px; height: 30px; border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--accent), var(--primary));
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 0.75rem;
  color: var(--bg);
}
.user-chip__info { line-height: 1.25; min-width: 0; }
.user-chip__info b { font-size: var(--fs-sm); font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip__info span { font-size: var(--fs-xs); color: var(--text-faint); }

/* --- Conteúdo --- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: rgba(10,14,20,0.55);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-6);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar__title { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-h3); letter-spacing: -0.01em; }
.topbar__crumb { color: var(--text-faint); font-size: var(--fs-sm); }
.topbar #menuBtn { display: none; } /* hambúrguer aparece só no mobile (<=860px) */

.content { padding: var(--sp-6); max-width: var(--maxw); width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-6); flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-h1); }
.page-head p { color: var(--text-muted); font-size: var(--fs-sm); margin-top: var(--sp-1); }

/* =================================================================
   5. BOTÕES
   ================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1;
  padding: 0 var(--sp-4);
  height: 38px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), color var(--dur) var(--ease);
  user-select: none;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(0.5px); }

.btn--primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-hover));
  color: var(--on-primary);
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 6px 18px -8px var(--primary-glow);
}
.btn--primary:hover { background: linear-gradient(180deg, var(--primary-hover), var(--primary-press)); box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 10px 26px -8px var(--primary-glow); }

.btn--secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn--secondary:hover { background: var(--surface-3); border-color: var(--border-strong); }

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }

.btn--sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-xs); border-radius: var(--r-xs); }
.btn--icon { width: 38px; padding: 0; }
.btn--icon.btn--sm { width: 30px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

/* =================================================================
   6. CARDS
   ================================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
  position: relative;
}
.card--pad { padding: var(--sp-5); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border-soft); }
.card__title { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-h3); }
.card__body { padding: var(--sp-5); }

/* --- KPI card (hero do dashboard) --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.kpi {
  background:
    linear-gradient(180deg, rgba(45,212,191,0.05), transparent 55%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  position: relative;
  overflow: hidden;
  box-shadow: var(--sh-md);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.kpi:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.kpi::after { /* faísca de luz no canto — detalhe que ninguém esquece */
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, var(--primary-glow), transparent 70%);
  opacity: 0.5;
  pointer-events: none;
}
.kpi__label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); font-weight: 600; display: flex; align-items: center; gap: var(--sp-2); }
.kpi__label svg { width: 14px; height: 14px; color: var(--primary); }
.kpi__value { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-display); letter-spacing: -0.03em; margin-top: var(--sp-3); line-height: 1; }
.kpi__value .unit { font-size: 1rem; color: var(--text-faint); font-weight: 500; margin-left: 4px; }
.kpi__delta { display: inline-flex; align-items: center; gap: 4px; margin-top: var(--sp-3); font-size: var(--fs-sm); font-weight: 600; font-family: var(--font-mono); }
.kpi__delta.is-up   { color: var(--success); }
.kpi__delta.is-down { color: var(--danger); }
.kpi__delta .ctx { color: var(--text-faint); font-family: var(--font-body); font-weight: 400; }

/* =================================================================
   7. TABELA DE DADOS
   ================================================================= */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
  overflow: hidden;
}
.table-toolbar {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.table-scroll { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
table.data thead th {
  text-align: left;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-faint);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0;
}
table.data tbody td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  color: var(--text-muted);
}
table.data tbody tr { transition: background var(--dur) var(--ease); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .cell-strong { color: var(--text); font-weight: 600; }
table.data .cell-sub { font-size: var(--fs-xs); color: var(--text-faint); }

/* célula de empresa com avatar quadrado */
.co-cell { display: flex; align-items: center; gap: var(--sp-3); min-width: 200px; }
.co-logo {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: grid; place-items: center; flex-shrink: 0;
  font-family: var(--font-display); font-weight: 700; font-size: 0.8rem;
  background: var(--surface-3); color: var(--text-muted);
  border: 1px solid var(--border);
}
.co-cell__txt { line-height: 1.3; min-width: 0; }
.co-cell__txt b { color: var(--text); font-weight: 600; display: block; }

/* célula decisor */
.dm-cell { line-height: 1.3; }
.dm-cell b { color: var(--text); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.dm-cell .role { font-size: var(--fs-xs); color: var(--text-faint); }
.lk { color: var(--info); opacity: 0.8; }
.lk:hover { opacity: 1; }

/* célula contato (e-mail mono + badge) */
.contact-cell { display: flex; flex-direction: column; gap: 4px; }
.contact-cell .email { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-on-soft); }

/* =================================================================
   8. BADGES (status de e-mail) e CHIPS
   ================================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.4;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.badge--valid   { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.badge--valid   .dot { background: var(--success); box-shadow: 0 0 6px var(--success); }
.badge--risky   { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.badge--risky   .dot { background: var(--warning); }
.badge--invalid { color: var(--danger);  background: var(--danger-bg);  border-color: var(--danger-border); }
.badge--invalid .dot { background: var(--danger); }
.badge--info    { color: var(--info);    background: var(--info-bg);    border-color: var(--info-border); }
.badge--info    .dot { background: var(--info); }
.badge--neutral { color: var(--neutral); background: var(--neutral-bg); border-color: var(--neutral-border); }
.badge--neutral .dot { background: var(--neutral); }

/* chip genérico (segmento, tag, filtro) */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-on-soft);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 4px 11px;
  white-space: nowrap;
}
.chip--accent { color: var(--primary); background: var(--primary-soft); border-color: var(--primary-glow); }
.chip--removable { padding-right: 6px; }
.chip__x { cursor: pointer; opacity: 0.6; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; }
.chip__x:hover { opacity: 1; background: rgba(255,255,255,0.08); }

/* =================================================================
   9. FIT SCORE (chip + barra)
   ================================================================= */
.fit {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-width: 96px;
}
.fit__num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--fs-sm);
  font-feature-settings: "tnum" 1;
  width: 26px; text-align: right;
}
.fit__bar { flex: 1; height: 6px; border-radius: var(--r-full); background: var(--score-track); overflow: hidden; position: relative; }
.fit__fill { height: 100%; border-radius: var(--r-full); transition: width 600ms var(--ease); }

/* faixas por cor — definir a width inline (ex.: style="width:88%") e a classe pela faixa */
.fit.is-high .fit__num  { color: var(--score-high); }
.fit.is-high .fit__fill { background: linear-gradient(90deg, var(--score-high), #6ee7b7); box-shadow: 0 0 8px rgba(52,211,153,0.5); }
.fit.is-mid  .fit__num  { color: var(--score-mid); }
.fit.is-mid  .fit__fill { background: linear-gradient(90deg, var(--score-mid), #fcd34d); }
.fit.is-low  .fit__num  { color: var(--score-low); }
.fit.is-low  .fit__fill { background: linear-gradient(90deg, var(--score-low), #fca5a5); }

/* variação "anel" para destaque (opcional, hero) */
.fit-ring {
  --val: 0;
  --col: var(--score-high);
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--col) calc(var(--val) * 1%), var(--score-track) 0);
  position: relative;
}
.fit-ring::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--surface); }
.fit-ring span { position: relative; font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-sm); color: var(--col); }

/* =================================================================
   10. FORMULÁRIOS (input / select / textarea)
   ================================================================= */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field > label { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.field .hint { font-size: var(--fs-xs); color: var(--text-faint); }

.input, .select, .textarea {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0 var(--sp-3);
  height: 42px;
  width: 100%;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.textarea { height: auto; padding: var(--sp-3); min-height: 100px; resize: vertical; line-height: var(--lh-snug); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239fb0c3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  padding-right: var(--sp-8);
  cursor: pointer;
}

/* input com ícone (busca) */
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: var(--sp-3); top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-faint); pointer-events: none; }
.input-icon .input { padding-left: var(--sp-8); }
.input--sm { height: 34px; font-size: var(--fs-sm); }

/* checkbox/radio custom em cartão (usado no wizard) */
.opt-card {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  position: relative;
}
.opt-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.opt-card.is-selected {
  border-color: var(--primary);
  background: linear-gradient(180deg, var(--primary-soft), transparent), var(--surface);
  box-shadow: 0 0 0 1px var(--primary-glow), var(--sh-sm);
}
.opt-card__check {
  width: 20px; height: 20px; border-radius: var(--r-xs); flex-shrink: 0;
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center;
  transition: all var(--dur) var(--ease);
}
.opt-card.is-selected .opt-card__check { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.opt-card__check svg { width: 13px; height: 13px; opacity: 0; transition: opacity var(--dur) var(--ease); }
.opt-card.is-selected .opt-card__check svg { opacity: 1; }
.opt-card__body { line-height: 1.4; }
.opt-card__body b { display: block; color: var(--text); font-weight: 600; font-size: var(--fs-body); }
.opt-card__body span { font-size: var(--fs-sm); color: var(--text-muted); }
.opt-card__meta { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-faint); white-space: nowrap; }

/* =================================================================
   11. WIZARD (multi-step + progresso)
   ================================================================= */
.wizard { display: grid; grid-template-columns: 280px 1fr; gap: var(--sp-8); align-items: start; }

.steps { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + var(--sp-6)); }
.step {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text-faint);
  position: relative;
}
.step__num {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 600;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  transition: all var(--dur) var(--ease);
}
.step__txt { font-size: var(--fs-sm); font-weight: 500; line-height: 1.25; }
.step__txt small { display: block; font-size: var(--fs-xs); color: var(--text-faint); font-weight: 400; }

.step.is-done { color: var(--text-muted); }
.step.is-done .step__num { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.step.is-current { color: var(--text); }
.step.is-current .step__num {
  background: var(--primary); border-color: var(--primary); color: var(--on-primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.step.is-current .step__txt { font-weight: 600; }
/* conector vertical */
.step:not(:last-child)::after {
  content: ""; position: absolute; left: calc(var(--sp-3) + 13px); top: 38px; bottom: -2px;
  width: 1.5px; background: var(--border);
}
.step.is-done:not(:last-child)::after { background: var(--primary); opacity: 0.5; }

.progress-bar { height: 4px; border-radius: var(--r-full); background: var(--score-track); overflow: hidden; margin-bottom: var(--sp-6); }
.progress-bar__fill { height: 100%; border-radius: var(--r-full); background: linear-gradient(90deg, var(--primary), var(--accent)); box-shadow: 0 0 10px var(--primary-glow); transition: width 500ms var(--ease); }

.wizard-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--sh-lg); overflow: hidden; }
.wizard-panel__head { padding: var(--sp-6) var(--sp-8) var(--sp-5); border-bottom: 1px solid var(--border-soft); }
.wizard-panel__head .eyebrow { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.10em; color: var(--primary); font-weight: 700; margin-bottom: var(--sp-2); }
.wizard-panel__head h2 { font-size: 1.45rem; }
.wizard-panel__head p { color: var(--text-muted); margin-top: var(--sp-2); font-size: var(--fs-body); max-width: 60ch; }
.wizard-panel__body { padding: var(--sp-6) var(--sp-8); }
.wizard-panel__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-5) var(--sp-8); border-top: 1px solid var(--border-soft); background: var(--bg-elevated); }

/* =================================================================
   12. ESTADOS: loading e vazio
   ================================================================= */
.skeleton {
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s var(--ease) infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton--line { height: 12px; }
.skeleton--block { height: 56px; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--surface-3);
  border-top-color: var(--primary);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-row { display: flex; align-items: center; gap: var(--sp-3); color: var(--text-muted); font-size: var(--fs-sm); padding: var(--sp-6); justify-content: center; }

.empty {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
}
.empty__icon {
  width: 56px; height: 56px; border-radius: var(--r-lg);
  display: grid; place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--primary);
  box-shadow: 0 0 0 6px var(--primary-soft);
  margin-bottom: var(--sp-2);
}
.empty h3 { font-size: var(--fs-h3); }
.empty p { color: var(--text-muted); font-size: var(--fs-sm); max-width: 42ch; }

/* =================================================================
   13. MISC: divisória, pill de live, link de ação
   ================================================================= */
.live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); font-weight: 600; color: var(--success);
  background: var(--success-bg); border: 1px solid var(--success-border);
  padding: 3px 9px; border-radius: var(--r-full);
}
.live-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52,211,153,0.5); } 50% { opacity: 0.6; box-shadow: 0 0 0 5px rgba(52,211,153,0); } }

.act-link { color: var(--primary); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.act-link:hover { color: var(--primary-hover); }

.seg-tag { font-size: var(--fs-xs); color: var(--text-muted); }

/* =================================================================
   14. RESPONSIVO (mobile-first: o layout acima é a versão larga;
       aqui colapsamos a partir dos breakpoints para baixo)
   ================================================================= */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .wizard { grid-template-columns: 1fr; }
  .steps { position: static; flex-direction: row; overflow-x: auto; padding-bottom: var(--sp-2); }
  .step:not(:last-child)::after { display: none; }
  .step__txt small { display: none; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 50;
    transform: translateX(-100%);
    width: 280px;
    transition: transform var(--dur) var(--ease);
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--sh-lg); }
  .topbar #menuBtn { display: inline-flex; }
  .content { padding: var(--sp-4); }
  .wizard-panel__head, .wizard-panel__body, .wizard-panel__foot { padding-left: var(--sp-5); padding-right: var(--sp-5); }
}

@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
  .kpi__value { font-size: 1.7rem; }
  .page-head { flex-direction: column; align-items: stretch; }
  .topbar { padding: 0 var(--sp-4); gap: var(--sp-2); }
  /* topbar enxuta no mobile: crumb e ações secundárias somem, só o essencial fica */
  .topbar__crumb { display: none; }
  .topbar .live-pill { display: none; }
  .topbar .btn span, .topbar .btn:not(.btn--primary) { display: none; }
  .topbar .btn--primary { padding: 0 var(--sp-3); }

  /* opt-card do wizard empilha o selo de custo embaixo (não corta na borda) */
  .opt-card { flex-wrap: wrap; }
  .opt-card__meta { margin-left: 0; width: 100%; padding-left: 32px; }
}
