/* ============================================================
   NEXI LEAD 360 — COMPONENTS
   @import './components.css';
   Requer tokens.css importado antes.
   ============================================================ */

/* ──────────────────────────────────────────
   RESET & BASE
────────────────────────────────────────── */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  background: var(--bg);
  /* Fundo ambiente (régua da apresentação CCE):
     aurora verde dominante + toques frios discretos + textura de dot grid.
     Tudo estático (sem repaint) — verde é a marca, frios são só profundidade. */
  background-image:
    radial-gradient(900px 380px at 12% -12%, rgba(9,188,138,.060), transparent 68%),
    radial-gradient(620px 300px at 98% 2%,  rgba(58,126,240,.026), transparent 64%),
    radial-gradient(560px 360px at 4% 92%,  rgba(9,188,138,.020), transparent 62%),
    var(--dot-grid);
  background-size: auto, auto, auto, var(--dot-size) var(--dot-size);
  background-repeat: no-repeat, no-repeat, no-repeat, repeat;
  background-attachment: fixed;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.07); border-radius: 4px; }

/* ──────────────────────────────────────────
   LAYOUT SHELL
────────────────────────────────────────── */

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

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

/* ──────────────────────────────────────────
   SIDEBAR
────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surface-1);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: var(--z-sidebar);
}

/* Logo */
.sidebar-logo {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-5);
  gap: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-logo__mark {
  width: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 0 16px var(--accent-glow);
}

.sidebar-logo__mark svg {
  width: 15px;
  height: 15px;
}

.sidebar-logo__text {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.sidebar-logo__text em {
  font-style: normal;
  color: var(--accent);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: var(--space-5) var(--space-2);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-4) var(--space-3) var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8.5px var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  transition: var(--transition-fast);
  position: relative;
  user-select: none;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(255,255,255,.04);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: var(--weight-medium);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  left: 0; top: 7px; bottom: 7px;
  width: 2.5px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(9,188,138,.5);
}

.nav-item__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.75;
}

.nav-item.active .nav-item__icon { opacity: 1; }

.nav-item__badge {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: var(--weight-semibold);
  padding: 1.5px 7px;
  line-height: 1;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
}

.nav-item__badge--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-item__badge--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

/* User footer */
.sidebar-footer {
  padding: var(--space-2);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.user-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 9px var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.user-row:hover { background: rgba(255,255,255,.04); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: var(--weight-bold);
  color: var(--text-on-accent);
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.user-row__name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.user-row__role {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 1px;
}

/* ──────────────────────────────────────────
   TOPBAR
────────────────────────────────────────── */

.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  box-shadow: var(--card-edge), 0 1px 0 rgba(0,0,0,.25);
  gap: var(--space-4);
  flex-shrink: 0;
  z-index: var(--z-topbar);
}

.topbar__title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.topbar__sep {
  width: 1px;
  height: 18px;
  background: var(--border-default);
  flex-shrink: 0;
}

.topbar__breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.topbar__breadcrumb svg {
  width: 11px;
  height: 11px;
  opacity: 0.5;
}

.topbar__breadcrumb span {
  color: var(--accent);
  font-weight: var(--weight-medium);
}

.topbar__end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ──────────────────────────────────────────
   CONTENT AREA
────────────────────────────────────────── */

.content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ──────────────────────────────────────────
   TABS
────────────────────────────────────────── */

.tabs {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 1px;
}

.tab {
  padding: 5px var(--space-3);
  border-radius: 5px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.tab.active {
  background: var(--surface-2);
  color: var(--text-primary);
}

.tab:hover:not(.active) { color: var(--text-primary); }

/* sub-abas numeradas em ordem de trabalho (stepper) */
.tab__n {
  font-style: normal; font-size: 10px; font-weight: 700; width: 17px; height: 17px; border-radius: 50%;
  display: inline-grid; place-items: center; background: var(--surface-3); color: var(--text-muted);
  margin-right: 7px; vertical-align: -3px;
}
.tab.active .tab__n { background: var(--accent); color: var(--text-on-accent); }
.tab__sep { color: var(--text-muted); opacity: .4; font-size: 11px; align-self: center; user-select: none; }

/* alinhamento fino do stepper: centraliza números, rótulos, pill ativa e setas */
#tabs { align-items: center; }
#tabs .tab { display: inline-flex; align-items: center; line-height: 1; padding-top: 6px; padding-bottom: 6px; }
#tabs .tab__n { vertical-align: 0; }

/* ──────────────────────────────────────────
   BUTTONS
────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: 7px var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  outline: none;
  transition: var(--transition-base);
  letter-spacing: -0.1px;
  white-space: nowrap;
  user-select: none;
}

.btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .38;
  filter: grayscale(.6);
  box-shadow: none;
  pointer-events: none;
}

/* Primary — gradiente de marca + fio de luz no topo + glint no hover */
.btn--primary {
  background: var(--gradient-accent);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-accent), inset 0 1px 0 rgba(255,255,255,.18);
  position: relative;
  overflow: hidden;
}

.btn--primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.22) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s var(--e-out, cubic-bezier(0.16,1,0.3,1));
  pointer-events: none;
}

.btn--primary:hover {
  box-shadow: var(--shadow-accent-lg), inset 0 1px 0 rgba(255,255,255,.18);
  transform: translateY(-1px);
}

.btn--primary:hover::after { transform: translateX(120%); }

.btn--primary:active { transform: translateY(0); }

/* Ghost */
.btn--ghost {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.btn--ghost:hover {
  border-color: var(--border-default);
  color: var(--text-primary);
}

/* Danger */
.btn--danger {
  background: var(--danger-soft);
  border: 1px solid rgba(232,72,74,.2);
  color: var(--danger);
}

.btn--danger:hover {
  background: rgba(232,72,74,.18);
}

/* Confirmação transitória (ex.: "enviado!") — troca de conteúdo + cor de
   sucesso por alguns segundos, depois volta ao estado original. Aplicar a
   classe junto com a troca do innerHTML; o :disabled do próprio estado de
   loading já impede duplo clique. */
.btn--sent {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: var(--text-on-accent) !important;
  animation: btnSentPop .38s var(--e-spring, cubic-bezier(.34,1.56,.64,1)) both;
}
.btn--sent .btn-sent-check path {
  stroke-dasharray: 30; stroke-dashoffset: 30;
  animation: checkDraw .35s var(--e-out, ease-out) .1s both;
}
@keyframes btnSentPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* Loading em botão (ex.: disparo de WhatsApp com várias bolhas) — anel
   girando + texto; o :disabled já impede duplo clique. Some sozinho quando
   o innerHTML original volta (ver JS que chama isso). */
.btn__spin {
  width: 13px; height: 13px; border-radius: var(--radius-full);
  border: 2px solid rgba(255,255,255,.35); border-top-color: currentColor;
  flex-shrink: 0; display: inline-block; animation: btnSpin .7s linear infinite;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* Sizes */
.btn--sm { padding: 5px var(--space-3); font-size: var(--text-xs); }
.btn--lg { padding: 9px var(--space-5); font-size: var(--text-base); }

/* Icon-only */
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-fast);
  position: relative;
  flex-shrink: 0;
}

.icon-btn:hover {
  border-color: var(--border-default);
  color: var(--text-primary);
}

.icon-btn svg { width: 15px; height: 15px; }

.icon-btn__dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--surface-1);
  box-shadow: 0 0 6px var(--accent-glow);
}

/* ──────────────────────────────────────────
   SEARCH INPUT
────────────────────────────────────────── */

.searchbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  transition: var(--transition-base);
}

.searchbar:focus-within {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(9,188,138,.06);
}

.searchbar svg {
  width: 13px; height: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.searchbar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  width: 100%;
}

.searchbar input::placeholder { color: var(--text-muted); }

/* ──────────────────────────────────────────
   INPUTS / FORM
────────────────────────────────────────── */

.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.input-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.input {
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px var(--space-3);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition-base);
  width: 100%;
}

.input:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(9,188,138,.06);
}

.input::placeholder { color: var(--text-muted); }

.input--error { border-color: rgba(232,72,74,.4); }
.input--error:focus { box-shadow: 0 0 0 3px rgba(232,72,74,.08); }

/* ──────────────────────────────────────────
   BADGES
────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: var(--weight-semibold);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  line-height: 1;
  border: 1px solid transparent;
}

.badge__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Variantes — fundo a ~11%, borda a ~28%, texto na cor cheia (régua #1/#2) */
.badge--success {
  background: rgba(9,188,138,.11);
  border-color: rgba(9,188,138,.28);
  color: var(--accent);
}
.badge--success .badge__dot {
  background: var(--accent);
  box-shadow: 0 0 4px var(--accent);
}

.badge--danger {
  background: var(--danger-soft);
  border-color: rgba(232,72,74,.28);
  color: var(--danger);
}
.badge--danger .badge__dot { background: var(--danger); }

.badge--warning {
  background: var(--warning-soft);
  border-color: rgba(240,160,32,.28);
  color: var(--warning);
}
.badge--warning .badge__dot { background: var(--warning); }

.badge--info {
  background: var(--info-soft);
  border-color: rgba(58,126,240,.28);
  color: var(--info);
}
.badge--info .badge__dot { background: var(--info); }

.badge--muted {
  background: rgba(255,255,255,.05);
  border-color: var(--border-default);
  color: var(--text-secondary);
}
.badge--muted .badge__dot { background: var(--text-muted); }

.badge--rose   { background: var(--rose-soft);   border-color: var(--rose-border);   color: var(--rose); }
.badge--rose   .badge__dot { background: var(--rose); }
.badge--violet { background: var(--violet-soft); border-color: var(--violet-border); color: var(--violet); }
.badge--violet .badge__dot { background: var(--violet); }
.badge--cyan   { background: var(--cyan-soft);   border-color: var(--cyan-border);   color: var(--cyan); }
.badge--cyan   .badge__dot { background: var(--cyan); }
.badge--orange { background: var(--orange-soft); border-color: var(--orange-border); color: var(--orange); }
.badge--orange .badge__dot { background: var(--orange); }

/* ──────────────────────────────────────────
   VIABILITY SIGNAL
────────────────────────────────────────── */

.viab-signal {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: var(--weight-medium);
}

.viab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.viab-dot--green {
  background: var(--accent);
  box-shadow: 0 0 5px rgba(9,188,138,.7);
  position: relative;
}

/* Sinal vivo (Motion Lab §4): SÓ o verde pulsa — "dispara hoje".
   Anel via transform/opacity (compositor), não box-shadow (paint). */
.viab-dot--green::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(9, 188, 138, 0.40);
  animation: viabPing 2.4s var(--e-out, ease-out) infinite;
  pointer-events: none;
}

@keyframes viabPing {
  0%        { transform: scale(1);   opacity: 0.7; }
  70%, 100% { transform: scale(2.6); opacity: 0;   }
}

.viab-dot--amber {
  background: var(--warning);
  box-shadow: 0 0 5px rgba(240,160,32,.5);
}

.viab-dot--red { background: var(--danger); }

/* ──────────────────────────────────────────
   CARDS
────────────────────────────────────────── */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--card-edge), var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card__header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(255,255,255,.022), transparent);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.card__header svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
  flex-shrink: 0;
}

.card__title {
  font-size: 13px;
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.card__subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-left: auto;
}

.card__body {
  padding: var(--space-5);
  flex: 1;
}

/* Card hover variant */
.card--hoverable {
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.card--hoverable::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, rgba(9,188,138,.04), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.card--hoverable:hover {
  border-color: var(--border-default);
  transform: translateY(-2px);
  box-shadow: var(--card-edge), var(--shadow-card-hover);
}

.card--hoverable:hover::before { opacity: 1; }

/* ──────────────────────────────────────────
   KPI CARD
────────────────────────────────────────── */

.kpi {
  --kpi-glow: rgba(9,188,138,.11);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--card-edge), var(--shadow-card);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

/* glow de canto semântico + brilho diagonal — sempre leve, cresce no hover (régua #3) */
.kpi::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 84% 14%, var(--kpi-glow), transparent 44%),
    linear-gradient(135deg, rgba(255,255,255,.030), transparent 46%);
  opacity: 0.65;
  transition: opacity 0.25s;
  pointer-events: none;
}

/* letra d'água: data-watermark="MW" — diz do que o card trata sem ler o texto */
.kpi::after {
  content: attr(data-watermark);
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 56px;
  font-weight: var(--weight-bold);
  line-height: 1;
  letter-spacing: -2px;
  color: var(--watermark);
  pointer-events: none;
  z-index: 0;
}

.kpi:hover {
  border-color: var(--border-default);
  transform: translateY(-2px);
  box-shadow: var(--card-edge), var(--shadow-card-hover);
}

.kpi:hover::before { opacity: 1; }

/* variantes semânticas do glow de canto */
.kpi--danger  { --kpi-glow: rgba(232,72,74,.13); }
.kpi--warning { --kpi-glow: rgba(240,160,32,.13); }
.kpi--info    { --kpi-glow: rgba(58,126,240,.13); }
.kpi--rose    { --kpi-glow: rgba(232,100,154,.13); }
.kpi--violet  { --kpi-glow: rgba(155,126,240,.13); }
.kpi--cyan    { --kpi-glow: rgba(34,198,212,.13); }
.kpi--orange  { --kpi-glow: rgba(249,115,22,.13); }

/* KPI destaque — linha de acento no topo via camada de background (libera o ::after p/ watermark) */
.kpi--featured {
  border-color: rgba(9,188,138,.20);
  background:
    linear-gradient(90deg, var(--accent), transparent 78%) top left / 100% 2px no-repeat,
    linear-gradient(135deg, rgba(9,188,138,.07) 0%, var(--surface-1) 55%);
}
.kpi--rose.kpi--featured {
  border-color: var(--rose-border);
  background:
    linear-gradient(90deg, var(--rose), transparent 78%) top left / 100% 2px no-repeat,
    linear-gradient(135deg, var(--rose-soft) 0%, var(--surface-1) 55%);
}
.kpi--violet.kpi--featured {
  border-color: var(--violet-border);
  background:
    linear-gradient(90deg, var(--violet), transparent 78%) top left / 100% 2px no-repeat,
    linear-gradient(135deg, var(--violet-soft) 0%, var(--surface-1) 55%);
}
.kpi--cyan.kpi--featured {
  border-color: var(--cyan-border);
  background:
    linear-gradient(90deg, var(--cyan), transparent 78%) top left / 100% 2px no-repeat,
    linear-gradient(135deg, var(--cyan-soft) 0%, var(--surface-1) 55%);
}
.kpi--orange.kpi--featured {
  border-color: var(--orange-border);
  background:
    linear-gradient(90deg, var(--orange), transparent 78%) top left / 100% 2px no-repeat,
    linear-gradient(135deg, var(--orange-soft) 0%, var(--surface-1) 55%);
}

.kpi__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 1;
}

.kpi__label {
  font-size: 11.5px;
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  letter-spacing: 0.1px;
}

.kpi__icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.kpi__icon svg { width: 15px; height: 15px; }
.kpi__icon--accent  { background: rgba(9,188,138,.10); color: var(--accent); }
.kpi__icon--danger  { background: var(--danger-soft);  color: var(--danger); }
.kpi__icon--warning { background: var(--warning-soft); color: var(--warning); }
.kpi__icon--info    { background: var(--info-soft);    color: var(--info); }
.kpi__icon--rose    { background: var(--rose-soft);    color: var(--rose); }
.kpi__icon--violet  { background: var(--violet-soft);  color: var(--violet); }
.kpi__icon--cyan    { background: var(--cyan-soft);    color: var(--cyan); }
.kpi__icon--orange  { background: var(--orange-soft);  color: var(--orange); }

.kpi__value {
  font-size: 28px;
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: var(--space-1);
  font-variant-numeric: tabular-nums;
  position: relative;
  z-index: 1;
}

.kpi__value--accent { color: var(--accent); }

.kpi__footer {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 11.5px;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

.delta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: var(--weight-medium);
  padding: 2px 5px;
  border-radius: 4px;
}

.delta--up { background: rgba(9,188,138,.10); color: var(--accent); }
.delta--dn { background: var(--danger-soft);  color: var(--danger); }

/* ──────────────────────────────────────────
   TABLE
────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

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

.table th {
  text-align: left;
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.table td {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  transition: background 0.1s;
  color: var(--text-primary);
}

.table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

.table tbody tr:hover td {
  background: rgba(255,255,255,.025);
}

.table tbody tr:last-child td { border-bottom: none; }

.table__lead-name {
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.table__lead-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.table__mwm {
  font-family: var(--font-mono);
  font-size: 12px;
}

.table__dist {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* Números monospace tabulares, alinhados à direita (régua #1 Carteiras) */
.table td.num, .table th.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.table td.num--accent { color: var(--accent); font-weight: var(--weight-semibold); }

/* Densidade alta para triagem em massa de centenas de linhas */
.table--dense th { padding: 8px var(--space-3); }
.table--dense td { padding: 7px var(--space-3); font-size: 12px; }

/* Cabeçalho fixo ao rolar (listas longas) */
.table--sticky thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
}

/* Zebra sutil opcional */
.table--zebra tbody tr:nth-child(even) td { background: rgba(255,255,255,.012); }

/* Linha de detalhe expandida inline (master-detail sem modal — régua #1) */
.table tr.sub td,
.table tr.row-detail td {
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--text-secondary);
  padding-top: 7px;
  padding-bottom: 7px;
}
.table tr.sub:hover td,
.table tr.row-detail:hover td { background: var(--surface-2); }

/* ──────────────────────────────────────────
   PROGRESS RING
────────────────────────────────────────── */

.ring-container { position: relative; }

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}

.ring-center__value {
  font-size: 26px;
  font-weight: var(--weight-bold);
  color: var(--accent);
  letter-spacing: -1px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ring-center__label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: var(--weight-medium);
  letter-spacing: 0.3px;
}

.ring-stats {
  display: flex;
  gap: var(--space-6);
  justify-content: center;
}

.ring-stat { text-align: center; }
.ring-stat__value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}
.ring-stat__label {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ──────────────────────────────────────────
   FUNNEL BARS
────────────────────────────────────────── */

.funnel { display: flex; flex-direction: column; gap: var(--space-2); }

.funnel__row { display: flex; align-items: center; gap: var(--space-2); }

.funnel__label {
  font-size: 11.5px;
  color: var(--text-secondary);
  width: 90px;
  flex-shrink: 0;
}

.funnel__track {
  flex: 1;
  height: 24px;
  background: var(--bg);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.funnel__fill {
  height: 100%;
  border-radius: 5px;
  display: flex;
  align-items: center;
  padding-left: 9px;
  font-size: 11px;
  font-weight: var(--weight-semibold);
  font-family: var(--font-mono);
  position: relative;
  overflow: hidden;
  width: 0;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.funnel__fill::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; bottom: 0;
  width: 60%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.15), transparent);
  animation: barShimmer 2.5s infinite linear;
  animation-delay: 1.2s;
}

.funnel__fill--1 { background: var(--accent); color: var(--text-on-accent); }
.funnel__fill--2 { background: rgba(9,188,138,.45); color: var(--accent); }
.funnel__fill--3 { background: rgba(240,160,32,.45); color: var(--warning); }
.funnel__fill--4 { background: rgba(58,126,240,.45); color: var(--info); }

.funnel__pct {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  width: 34px;
  text-align: right;
  flex-shrink: 0;
}

/* ──────────────────────────────────────────
   VIABILITY LIST
────────────────────────────────────────── */

.viab-list { display: flex; flex-direction: column; gap: var(--space-2); }

.viab-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px var(--space-3);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.viab-item:hover {
  border-color: var(--border-accent);
  transform: translateX(2px);
}

.viab-item__info { flex: 1; }
.viab-item__name { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-primary); }
.viab-item__sub  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.viab-item__value {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: var(--weight-medium);
  text-align: right;
}

.viab-item__value--green  { color: var(--accent); }
.viab-item__value--amber  { color: var(--warning); }
.viab-item__value--red    { color: var(--danger); }

/* ──────────────────────────────────────────
   GRID HELPERS
────────────────────────────────────────── */

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
.grid-sidebar { display: grid; grid-template-columns: 1fr 332px; gap: var(--space-4); }

/* ──────────────────────────────────────────
   DIVIDERS / HELPERS
────────────────────────────────────────── */

.divider {
  width: 100%;
  height: 1px;
  background: var(--border-subtle);
}

.text-mono { font-family: var(--font-mono); }
.text-accent { color: var(--accent); }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ──────────────────────────────────────────
   TIMELINE / LINHA DO TEMPO (régua #2 — cadência CCE)
   Grid [trilho | conteúdo]; nós com halo + conector em gradiente;
   cards de etapa tingidos por estado.
────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; }
.timeline__item { display: grid; grid-template-columns: 72px 1fr; }
.timeline__rail { display: flex; flex-direction: column; align-items: center; padding-top: 2px; }
.timeline__node {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: var(--weight-bold);
  flex-shrink: 0; z-index: 2; color: #fff;
  background: var(--surface-3); border: 1px solid var(--border-default);
}
.timeline__node--accent  { background: var(--gradient-accent);  color: var(--text-on-accent); border: none; box-shadow: 0 0 0 4px rgba(9,188,138,.18); }
.timeline__node--danger   { background: var(--gradient-danger);  border: none; box-shadow: 0 0 0 4px rgba(232,72,74,.18); }
.timeline__node--warning  { background: var(--gradient-warning); color: #1a0a00; border: none; box-shadow: 0 0 0 4px rgba(240,160,32,.18); }
.timeline__node--info     { background: var(--gradient-info);    border: none; box-shadow: 0 0 0 4px rgba(58,126,240,.18); }
.timeline__connector {
  width: 2px; flex: 1; min-height: 18px; margin: 4px 0;
  background: linear-gradient(180deg, var(--border-default), rgba(255,255,255,.03));
}
.timeline__content { padding: 2px 0 18px 18px; min-width: 0; }
.timeline__label { font-size: 10px; font-weight: var(--weight-bold); text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 7px; }
.timeline__card {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--card-edge);
}
.timeline__card--danger  { border-color: rgba(232,72,74,.35);  background: rgba(232,72,74,.06); }
.timeline__card--warning { border-color: rgba(240,160,32,.35); background: rgba(240,160,32,.06); }
.timeline__card--info    { border-color: rgba(58,126,240,.35); background: rgba(58,126,240,.06); }
.timeline__card--accent  { border-color: var(--accent-border);  background: rgba(9,188,138,.06); }
.timeline__card-title { font-size: 13px; font-weight: var(--weight-semibold); color: var(--text-primary); margin-bottom: 4px; }
.timeline__card-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }

/* ──────────────────────────────────────────
   STEPPER (régua #3 — simulador de metas)
   [−] [campo] [+]; setas nativas removidas; travado mostra valor em verde.
────────────────────────────────────────── */
.stepper { display: inline-grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; }
.stepper__btn {
  width: 30px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle); background: var(--surface-2);
  color: var(--text-secondary); font-weight: var(--weight-bold); font-size: 15px;
  cursor: pointer; display: grid; place-items: center;
  transition: var(--transition-fast); user-select: none;
}
.stepper__btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.stepper__btn:disabled { opacity: .35; cursor: not-allowed; }
.stepper__input {
  height: 36px; min-width: 64px; text-align: center;
  font-weight: var(--weight-bold);
  background: var(--bg); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  outline: none; -moz-appearance: textfield; appearance: textfield;
}
.stepper__input::-webkit-outer-spin-button,
.stepper__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper__input:focus { border-color: var(--border-accent); box-shadow: 0 0 0 3px rgba(9,188,138,.06); }
.stepper__input:disabled { color: var(--accent); opacity: 1; -webkit-text-fill-color: var(--accent); }

/* ──────────────────────────────────────────
   PROGRESS BAR (régua #3 — preenchimento em gradiente)
────────────────────────────────────────── */
.progress { height: 6px; background: var(--bg); border-radius: var(--radius-full); overflow: hidden; }
.progress--lg { height: 10px; }
.progress__fill {
  height: 100%; border-radius: var(--radius-full);
  background: var(--gradient-accent); width: 0;
  transition: width .4s var(--e-out, cubic-bezier(0.16,1,0.3,1));
}
.progress__fill--warning { background: var(--gradient-warning); }
.progress__fill--danger  { background: var(--gradient-danger); }
