/* =============================================================================
 * AMET · Análise de Crédito — Global Design System (Inspirado no Viver de IA)
 * Tipografia: Geist & Geist Mono | Paleta: Navy #0A1F3B, Surface #FFFFFF, Ink #344054
 * ============================================================================= */

@font-face {
  font-family: 'Geist';
  src: url('/assets/fonts/geist.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: 'GeistMono';
  src: url('/assets/fonts/geist-mono.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'GeistMono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Cores Principais (Viver de IA DS) */
  --navy: #0A1F3B;
  --navy-hover: #122E54;
  --deep: #031628;
  --ink: #344054;
  --ink-soft: #475467;
  --muted: #7B879B;
  --faint: #98A2B3;
  --line: #E4E7EC;
  --line-soft: #EDF1F6;
  --bg: #F8FAFC;
  --surface: #FFFFFF;

  /* Semânticas & Funil */
  --success: #15803D;
  --success-bg: #DCFCE7;
  --success-border: #BBF7D0;
  --warning: #B45309;
  --warning-bg: #FEF3C7;
  --warning-border: #FDE68A;
  --danger: #B91C1C;
  --danger-bg: #FEE2E2;
  --danger-border: #FECACA;
  --info: #1D4ED8;
  --info-bg: #EFF6FF;
  --info-border: #BFDBFE;

  /* Sombras & Elevação */
  --shadow-xs: 0 2px 6px rgba(10, 31, 59, 0.04);
  --shadow-sm: 0 6px 16px rgba(10, 31, 59, 0.06);
  --shadow-md: 0 14px 32px rgba(10, 31, 59, 0.09);
  --shadow-lg: 0 24px 56px rgba(10, 31, 59, 0.16);
  --shadow-hero: 0 22px 45px rgba(10, 31, 59, 0.22);

  /* Layout */
  --sidebar-width: 224px;
  --sidebar-collapsed-width: 70px;
  --topbar-height: 72px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition-fast: 160ms cubic-bezier(0.22, 0.61, 0.36, 1);
  --transition-smooth: 280ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--navy);
  background:
    radial-gradient(ellipse 65% 50% at 0% 0%, #F1F5F9 0%, transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

/* =============================================================================
 * Customização Global de Barras de Rolagem (Design System Viver de IA / AMET)
 * ============================================================================= */

* {
  scrollbar-width: thin;
  scrollbar-color: #94A3B8 #EEF2F6;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #EEF2F6;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb {
  background: #94A3B8;
  border-radius: 999px;
  border: 2px solid #EEF2F6;
  transition: background-color 180ms ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--navy);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* =============================================================================
 * 1. Sidebar Recolhível com Efeitos & Animações
 * ============================================================================= */

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: linear-gradient(160deg, #FAFBFC 0%, #FFFFFF 65%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: width var(--transition-smooth), transform var(--transition-smooth);
  user-select: none;
}

.sidebar-brand {
  min-height: 78px;
  padding: 14px 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-brand img.logo-full {
  height: 28px;
  width: auto;
  object-fit: contain;
  transition: opacity var(--transition-fast);
}

.sidebar-app-name {
  font: 600 9.5px var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-left: 2px;
  white-space: nowrap;
}

.sidebar-brand img.logo-icon {
  height: 32px;
  width: 32px;
  object-fit: contain;
  display: none;
}

.sidebar-toggle-btn {
  position: absolute;
  right: -12px;
  top: 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #FFFFFF;
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  font-size: 14px;
  box-shadow: var(--shadow-xs);
  z-index: 45;
  transition: transform var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
}

.sidebar-toggle-btn:hover {
  background: var(--navy);
  color: #FFFFFF;
  border-color: var(--navy);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px 24px;
}

.nav-group-label {
  font: 500 9px var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 10px 8px;
  white-space: nowrap;
  transition: opacity var(--transition-fast);
}

.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  margin: 2px 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #667085;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.nav-item:hover:not(.active) {
  background: #EEF2F6;
  color: var(--navy);
  transform: translateX(2px);
}

.nav-item:hover:not(.active) svg {
  color: var(--navy);
}

.nav-item.active {
  background: linear-gradient(180deg, #0D2646 0%, #031627 100%);
  color: #FFFFFF;
  box-shadow: 0 6px 14px rgba(7, 29, 51, 0.24);
}

.nav-item.active svg {
  color: #FFFFFF;
}

.nav-badge {
  margin-left: auto;
  font: 500 10px var(--font-mono);
  padding: 2px 6px;
  border-radius: 6px;
  background: #EEF2F6;
  color: var(--ink-soft);
}

.nav-item.active .nav-badge {
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
}

.nav-badge.live {
  background: #DCFCE7;
  color: #15803D;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font: 500 9px var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.sidebar-role-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #EEF2F6;
  color: var(--navy);
  font: 600 9.5px var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  width: fit-content;
}

.sidebar-footer .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16A34A;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
  display: inline-block;
  margin-right: 6px;
}

/* Estado Recolhido (Collapsed) */
body.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .app-workspace {
  margin-left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-brand {
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  min-height: var(--topbar-height);
}

body.sidebar-collapsed .sidebar-brand img.logo-full,
body.sidebar-collapsed .sidebar-app-name {
  display: none;
}

body.sidebar-collapsed .sidebar-brand img.logo-icon {
  display: block;
}

body.sidebar-collapsed .nav-group-label,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .nav-item .nav-badge,
body.sidebar-collapsed .sidebar-footer span,
body.sidebar-collapsed .sidebar-role-tag {
  display: none;
}

body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 11px 8px;
}

body.sidebar-collapsed .sidebar-footer,
body.sidebar-collapsed .sidebar-footer-top {
  align-items: center;
  justify-content: center;
}

/* =============================================================================
 * 2. Workspace & Topbar
 * ============================================================================= */

.app-workspace {
  margin-left: var(--sidebar-width);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-smooth);
}

.app-topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  padding: 0 36px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 520px;
}

.mobile-menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: #FFFFFF;
  border-radius: 9px;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--navy);
}

.global-search-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #F2F4F7;
  border: 1px solid #E2E7EE;
  border-radius: 10px;
  color: #7B879B;
  padding: 9px 14px;
  font-size: 12.5px;
  text-align: left;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.global-search-btn:hover {
  background: #FFFFFF;
  border-color: #CBD5E1;
  box-shadow: var(--shadow-xs);
}

.global-search-btn kbd {
  margin-left: auto;
  font: 500 9.5px var(--font-mono);
  background: #FFFFFF;
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--ink-soft);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px 4px 5px;
  background: #FFFFFF;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow-xs);
}

.user-avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1E3A5F 0%, #06182C 100%);
  color: #FFFFFF;
  font: 600 11px var(--font-mono);
  display: grid;
  place-items: center;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 1640px;
  margin: 0 auto;
  padding: 30px 36px 56px;
}

/* =============================================================================
 * 3. Tipografia, Botões, Pills & Componentes Globais do Design System
 * ============================================================================= */

.eyebrow {
  display: inline-block;
  font: 500 9.5px var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: clamp(26px, 2.5vw, 34px);
  font-weight: 580;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 6px 0 4px;
  color: var(--navy);
}

.page-header p {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Botões Canônicos */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 560;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(180deg, #102B49 0%, #03182B 100%);
  color: #FFFFFF;
  border-color: #142D47;
  box-shadow: 0 6px 14px rgba(10, 31, 59, 0.2);
}

.btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(10, 31, 59, 0.26);
}

.btn-pill {
  border-radius: 999px;
  padding-left: 18px;
  padding-right: 18px;
}

.btn-ghost {
  background: #FFFFFF;
  color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--shadow-xs);
}

.btn-ghost:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
  color: var(--navy);
}

.btn-success {
  background: #15803D;
  color: #FFFFFF;
  border-color: #166534;
}

.btn-danger-ghost {
  background: #FFFFFF;
  color: var(--danger);
  border-color: #FECACA;
}

.btn-danger-ghost:hover {
  background: #FEF2F2;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 11.5px;
  border-radius: 8px;
}

/* Botões de Ação Padronizados Somente com Ícones SVG */
.action-icons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #FFFFFF;
  color: var(--ink-soft);
  display: inline-grid;
  place-items: center;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.btn-icon:hover {
  background: #F1F5F9;
  color: var(--navy);
  border-color: #CBD5E1;
  transform: translateY(-1px);
}

.btn-icon.primary {
  background: var(--navy);
  color: #FFFFFF;
  border-color: var(--navy);
}

.btn-icon.primary:hover {
  background: var(--navy-hover);
  color: #FFFFFF;
}

.btn-icon.success {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.btn-icon.success:hover {
  background: #BBF7D0;
}

.btn-icon.danger {
  color: var(--danger);
  border-color: #FECACA;
}

.btn-icon.danger:hover {
  background: #FEF2F2;
  border-color: #FCA5A5;
}

/* Abas estilo Viver de IA (Sublinhadas ou Pílulas) */
.via-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  overflow-x: auto;
}

.via-tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 12px 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.via-tab:hover {
  color: var(--navy);
}

.via-tab.active {
  color: var(--navy);
  border-bottom-color: var(--navy);
  font-weight: 600;
}

/* Badges & Status Pills */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font: 600 10px var(--font-mono);
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-pill svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.badge-pill.active,
.badge-pill.success {
  background: #DCFCE7;
  color: #166534;
  border-color: #86EFAC;
}

.badge-pill.cliford,
.badge-pill.warning {
  background: #FEF3C7;
  color: #92400E;
  border-color: #FCD34D;
}

.badge-pill.danger {
  background: #FEE2E2;
  color: #B91C1C;
  border-color: #FCA5A5;
}

.badge-pill.info {
  background: #DBEAFE;
  color: #1E40AF;
  border-color: #93C5FD;
}

.badge-pill.neutral {
  background: #EEF2F6;
  color: #475467;
  border-color: #CBD5E1;
  font-weight: 500;
}

.dossier-hero .badge-pill.neutral {
  background: rgba(255, 255, 255, 0.14);
  color: #F1F5F9;
  border-color: rgba(255, 255, 255, 0.25);
}

/* =============================================================================
 * 4. Hero Banner Azul-Marinho (Estilo Métricas / Perfil Viver de IA)
 * ============================================================================= */

.via-hero-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 28px;
  background:
    radial-gradient(ellipse at 12% 10%, #2B4769 0%, transparent 55%),
    linear-gradient(135deg, #071B32 0%, #021324 100%);
  color: #FFFFFF;
  padding: 30px 34px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-hero);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.via-hero-banner .eyebrow {
  color: #9FB5CE;
}

.via-hero-banner h2 {
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 560;
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin: 12px 0 10px;
  max-width: 680px;
}

.via-hero-banner h2 em {
  font-style: italic;
  color: #9CC0E8;
}

.via-hero-banner p {
  margin: 0;
  color: #BDCCDC;
  font-size: 13.5px;
  max-width: 620px;
}

.hero-metrics-strip {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  flex-wrap: wrap;
}

.hero-metric-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hero-metric-item strong {
  font: 500 26px var(--font-mono);
  letter-spacing: -0.03em;
  color: #FFFFFF;
  line-height: 1.05;
}

.hero-metric-item span {
  font-size: 11px;
  color: #9FB5CE;
}

.hero-metric-divider {
  width: 1px;
  height: 34px;
  background: rgba(255, 255, 255, 0.14);
}

/* Caixa de Saúde / Score Radial na direita do Hero (Idêntico à Imagem 3) */
.hero-health-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.hero-health-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.radial-score-wrap {
  position: relative;
  width: 66px;
  height: 66px;
  flex-shrink: 0;
}

.radial-score-wrap svg {
  width: 66px;
  height: 66px;
  transform: rotate(-90deg);
}

.radial-score-wrap circle.bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 6;
}

.radial-score-wrap circle.fg {
  fill: none;
  stroke: #FFFFFF;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 600ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.radial-score-val {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 600 17px var(--font-mono);
  color: #FFFFFF;
}

.hero-health-bars {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hero-bar-row {
  display: grid;
  grid-template-columns: 78px 1fr 36px;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #BDCCDC;
}

.hero-bar-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  overflow: hidden;
}

.hero-bar-fill {
  height: 100%;
  background: #FFFFFF;
  border-radius: 4px;
  transition: width 500ms ease;
}

.hero-bar-row b {
  font: 500 10px var(--font-mono);
  text-align: right;
  color: #FFFFFF;
}

/* =============================================================================
 * 5. Cards KPI, Barra de Consulta CNPJ Rápida & Funil Visual
 * ============================================================================= */

.quick-cnpj-bar {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.quick-cnpj-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 280px;
}

.via-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  border-radius: 10px;
  padding: 0 14px;
  height: 42px;
  flex: 1;
  box-shadow: 0 1px 2px rgba(10, 31, 59, 0.03);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.via-input-group:hover {
  border-color: #94A3B8;
}

.via-input-group:focus-within {
  background: #FFFFFF;
  border-color: var(--navy);
  box-shadow: 0 0 0 3.5px rgba(10, 31, 59, 0.11);
}

.via-input-group input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--navy);
  font-family: var(--font-mono);
}

.via-input-group input::placeholder {
  color: #94A3B8;
  font-weight: 400;
}

.kpi-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.kpi-card-label {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 8px;
  display: block;
}

.kpi-card-value {
  font: 600 28px var(--font-mono);
  letter-spacing: -0.03em;
  color: var(--navy);
  display: block;
}

.kpi-card-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  display: block;
}

.kpi-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  display: grid;
  place-items: center;
  color: var(--navy);
  flex-shrink: 0;
}

/* Grid de 2 Colunas do Dashboard (Funil + Regras/Insights) */
.dashboard-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.via-card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-xs);
}

.via-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.via-card-head h3 {
  font-size: 18px;
  font-weight: 570;
  letter-spacing: -0.02em;
  margin: 4px 0 0;
  color: var(--navy);
}

/* =============================================================================
 * Funil 3D Volumétrico Profissional (UX/UI 3D Isometric Conical Funnel)
 * ============================================================================= */

.funnel-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 6px 6px;
  position: relative;
  background:
    radial-gradient(ellipse 65% 55% at 32% 50%, rgba(10, 31, 59, 0.045) 0%, transparent 70%);
  border-radius: 16px;
}

.funnel-3d-tier {
  display: grid;
  grid-template-columns: minmax(270px, 1.15fr) minmax(220px, 0.95fr);
  align-items: center;
  gap: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 14px;
  transition: transform 240ms cubic-bezier(0.22, 0.61, 0.36, 1);
  position: relative;
}

.funnel-3d-tier:hover {
  transform: translateY(-3px) scale(1.012);
  z-index: 4;
}

.funnel-3d-cone-box {
  position: relative;
  width: 100%;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 10px 16px rgba(10, 31, 59, 0.16));
  transition: filter 240ms ease, transform 240ms ease;
}

.funnel-3d-tier:hover .funnel-3d-cone-box {
  filter: drop-shadow(0 16px 24px rgba(10, 31, 59, 0.28));
  transform: scale(1.02);
}

.funnel-3d-svg {
  width: 100%;
  height: 68px;
  display: block;
  overflow: visible;
}

.funnel-3d-inner-overlay {
  position: absolute;
  inset: 10px 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.funnel-3d-inner-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(3, 15, 29, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(4px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 3px 8px rgba(0, 0, 0, 0.18);
}

.funnel-3d-qty {
  font: 700 12.5px var(--font-mono);
  color: #FFFFFF;
  letter-spacing: -0.01em;
}

.funnel-3d-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
}

.funnel-3d-val {
  font: 600 11.5px var(--font-mono);
  color: #F8FAFC;
}

.funnel-3d-side-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%);
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(10, 31, 59, 0.04), inset 0 1px 0 #FFFFFF;
  transition: border-color 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
  position: relative;
}

.funnel-3d-tier:hover .funnel-3d-side-card {
  border-color: #CBD5E1;
  background: #FFFFFF;
  box-shadow: 0 10px 22px rgba(10, 31, 59, 0.09);
}

.funnel-3d-side-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.funnel-3d-step-orb {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font: 700 10px var(--font-mono);
  color: #FFFFFF;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(10, 31, 59, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.funnel-3d-stage-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.funnel-3d-stage-meta {
  font: 500 10px var(--font-mono);
  color: var(--muted);
  display: block;
  margin-top: 1px;
}

.funnel-3d-pct-badge {
  font: 600 10.5px var(--font-mono);
  padding: 3px 8px;
  border-radius: 7px;
  background: #F1F5F9;
  color: var(--navy);
  border: 1px solid #E2E8F0;
  flex-shrink: 0;
}

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

@media (max-width: 680px) {
  .funnel-3d-tier {
    grid-template-columns: 1fr;
    gap: 6px;
    margin-bottom: 8px;
  }
}

/* =============================================================================
 * 6. Quadro Kanban Interativo (Drag & Drop Fluido + Barra de Rolagem no Topo)
 * ============================================================================= */

.kanban-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.kanban-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 260px;
}

.kanban-top-scroll-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}

.kanban-scroll-label {
  font: 600 9.5px var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.kanban-top-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  height: 12px;
  border-radius: 999px;
  background: #EEF2F6;
  scrollbar-width: thin;
  scrollbar-color: var(--navy) #EEF2F6;
}

.kanban-top-scroll::-webkit-scrollbar {
  height: 10px;
}

.kanban-top-scroll::-webkit-scrollbar-track {
  background: #EEF2F6;
  border-radius: 999px;
}

.kanban-top-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #16335B 0%, #0A1F3B 100%);
  border-radius: 999px;
  border: 2px solid #EEF2F6;
  cursor: pointer;
}

.kanban-top-scroll::-webkit-scrollbar-thumb:hover {
  background: #031628;
}

.kanban-top-scroll-spacer {
  height: 1px;
}

.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 18px;
  align-items: flex-start;
  min-height: calc(100dvh - 300px);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.kanban-board::-webkit-scrollbar {
  display: none;
}

.kanban-col {
  flex: 0 0 315px;
  width: 315px;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 220px);
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.kanban-col.drag-over {
  background: #E8F0FE;
  border-color: var(--navy);
  box-shadow: 0 0 0 2px rgba(10, 31, 59, 0.15);
}

.kanban-col-head {
  padding: 14px 16px;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 16px 16px 0 0;
}

.kanban-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}

.kanban-col-count {
  font: 600 11px var(--font-mono);
  background: #FFFFFF;
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--ink-soft);
}

.kanban-col-sub {
  padding: 6px 16px;
  font: 500 10px var(--font-mono);
  color: var(--muted);
  border-bottom: 1px solid #E6ECF2;
  background: rgba(255, 255, 255, 0.35);
  display: flex;
  justify-content: space-between;
}

.kanban-cards {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-height: 140px;
  flex: 1;
}

.kanban-card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 15px;
  box-shadow: var(--shadow-xs);
  cursor: grab;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  position: relative;
}

.kanban-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #CBD5E1;
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.dragging {
  opacity: 0.45;
  transform: scale(0.97);
}

.kanban-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.kanban-cnpj {
  font: 500 10.5px var(--font-mono);
  color: var(--muted);
  background: #F8FAFC;
  border: 1px solid var(--line-soft);
  padding: 2px 7px;
  border-radius: 6px;
}

.kanban-score-pill {
  font: 600 11px var(--font-mono);
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--navy);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.kanban-score-pill.excellent {
  background: #15803D;
}

.kanban-score-pill.healthy {
  background: #047857;
}

.kanban-score-pill.moderate {
  background: #B45309;
}

.kanban-score-pill.low {
  background: #B91C1C;
}

.kanban-card h4 {
  margin: 0 0 4px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--navy);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-card-fantasia {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}

.mini-check {
  font: 500 9.5px var(--font-mono);
  padding: 2px 6px;
  border-radius: 5px;
  background: #F1F5F9;
  color: #64748B;
  border: 1px solid #E2E8F0;
}

.mini-check.on {
  background: #ECFDF3;
  color: #15803D;
  border-color: #BBF7D0;
}

.mini-check.off {
  background: #FEE2E2;
  color: #B91C1C;
  border-color: #FCA5A5;
}

.kanban-card-foot {
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-soft);
}

.kanban-budget {
  font: 600 11.5px var(--font-mono);
  color: var(--navy);
}

/* =============================================================================
 * 7. Tabelas Formatadas (Estilo Funil & Base de Clientes)
 * ============================================================================= */

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.table-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}

.via-select, .via-input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1.5px solid #CBD5E1;
  border-radius: 10px;
  background: #FFFFFF;
  color: var(--navy);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  outline: none;
  box-shadow: 0 1px 2px rgba(10, 31, 59, 0.03);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.via-select:hover:not(:disabled),
.via-input:hover:not(:disabled):not([readonly]),
.via-textarea:hover:not(:disabled):not([readonly]) {
  border-color: #94A3B8;
}

.via-input::placeholder,
.via-textarea::placeholder {
  color: #94A3B8;
  font-weight: 400;
}

.via-input[readonly],
.via-input:disabled,
.via-select:disabled {
  background: #F1F5F9;
  color: #475569;
  cursor: not-allowed;
}

.via-textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3.5px rgba(10, 31, 59, 0.11);
}

/* Campo de Endereço com Botão & Marcador Google Maps no Final */
.address-maps-group {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.address-maps-group .via-input {
  flex: 1;
  min-width: 0;
}

.address-maps-btn {
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1.5px solid #BFDBFE;
  background: #EFF6FF;
  color: #1E40AF;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
}

.address-maps-btn:hover {
  background: #DBEAFE;
  border-color: #60A5FA;
  color: #1E3A8A;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.address-maps-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #DC2626;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: rgba(220, 38, 38, 0.14);
}

.address-maps-btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.hero-maps-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #E2E8F0;
  font: 600 10.5px var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.hero-maps-chip:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(125, 211, 252, 0.6);
  color: #FFFFFF;
}

.hero-maps-chip svg {
  width: 12px;
  height: 12px;
  color: #F87171;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: rgba(248, 113, 113, 0.2);
  flex-shrink: 0;
}

.inline-maps-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1D4ED8;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  transition: all var(--transition-fast);
}

.inline-maps-link:hover {
  background: #DBEAFE;
  border-color: #60A5FA;
  color: #1E3A8A;
}

.inline-maps-link svg {
  width: 12.5px;
  height: 12.5px;
  color: #DC2626;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: rgba(220, 38, 38, 0.14);
  flex-shrink: 0;
}

.via-textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid #CBD5E1;
  border-radius: 10px;
  background: #FFFFFF;
  color: var(--navy);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  resize: vertical;
  box-shadow: 0 1px 2px rgba(10, 31, 59, 0.03);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

/* Títulos de Campos em Destaque (Alta Legibilidade em Formulários) */
.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #0A1F3B;
  margin-bottom: 6px;
  line-height: 1.3;
}

.field-label-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.field-label-title::before {
  content: "";
  width: 4px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(180deg, #0A1F3B 0%, #3B82F6 100%);
  display: inline-block;
  flex-shrink: 0;
}

.field-req {
  color: #DC2626;
  font-weight: 700;
  margin-left: 2px;
}

.field-opt {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: #EEF2F6;
  color: #475569;
  border: 1px solid #E2E8F0;
  white-space: nowrap;
  flex-shrink: 0;
}

.field-opt.admin {
  background: #EFF6FF;
  color: #1D4ED8;
  border-color: #BFDBFE;
}

.field-opt.auto {
  background: #ECFDF5;
  color: #15803D;
  border-color: #BBF7D0;
}

.field-hint {
  display: block;
  font-size: 11.5px;
  color: #64748B;
  margin-top: 5px;
  line-height: 1.4;
}

/* Cards de Seção Estruturados dentro da Ficha Cadastral */
.form-section {
  background: #F8FAFC;
  border: 1px solid #DCE4EE;
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid #E2E8F0;
}

.form-section-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.form-step-badge {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #0D2646 0%, #031627 100%);
  color: #FFFFFF;
  font: 700 12px var(--font-mono);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(7, 29, 51, 0.18);
}

.form-section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.015em;
}

.form-section-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: #475569;
}

/* Layout Amplo para Consulta CNPJ / Ficha Cadastral */
.consult-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (min-width: 1480px) {
  .consult-layout {
    grid-template-columns: minmax(0, 1.65fr) minmax(380px, 0.85fr);
  }
  .consult-result-sticky {
    position: sticky;
    top: calc(var(--topbar-height) + 20px);
  }
}

.consult-refs-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.consult-refs-row:has(#consult-limit-box[hidden]) {
  grid-template-columns: 1fr;
}

/* Card de Sócio (QSA) de Alta Legibilidade */
.partner-form-card {
  background: #FFFFFF;
  border: 1px solid #DCE4EE;
  border-left: 4px solid var(--navy);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(10, 31, 59, 0.04);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.partner-form-card:hover {
  border-color: #B8C7DA;
  box-shadow: 0 6px 16px rgba(10, 31, 59, 0.06);
}

.partner-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid #EEF2F6;
}

.partner-grid-top {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 12px;
}

/* Cartões de Upload de Documentação Obrigatória */
.doc-upload-tile {
  background: #FFFFFF;
  border: 1.5px dashed #94A3B8;
  border-radius: 13px;
  padding: 15px 16px;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.doc-upload-tile:hover {
  border-color: var(--navy);
  background: #F1F5F9;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.doc-upload-tile.has-files {
  border-style: solid;
  border-color: #16A34A;
  background: #F0FDF4;
}

.receita-field-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.01em;
}

.table-wrap {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow-x: auto;
}

.via-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.5px;
}

.via-table th {
  font: 500 9.5px var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  background: #F8FAFC;
  border-bottom: 1px solid var(--line);
  padding: 13px 16px;
  white-space: nowrap;
}

.via-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  vertical-align: middle;
}

.via-table tbody tr {
  transition: background-color var(--transition-fast);
}

.via-table tbody tr:hover {
  background: #F8FAFC;
}

/* =============================================================================
 * 8. Dossiê Completo do Cliente (Tela Inteira 100% + Header Compacto + Submenus)
 * ============================================================================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 18, 34, 0.72);
  backdrop-filter: blur(6px);
  z-index: 90;
  display: grid;
  place-items: stretch;
  padding: 0;
  animation: fade-in 180ms ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.dossier-drawer {
  width: 100vw;
  height: 100dvh;
  background: #FFFFFF;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popup-zoom-in 200ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes popup-zoom-in {
  from { transform: scale(0.985); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.dossier-hero {
  background:
    radial-gradient(ellipse at 10% 0%, #274263 0%, transparent 55%),
    linear-gradient(135deg, #071B32 0%, #021222 100%);
  color: #FFFFFF;
  padding: 13px 28px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-shrink: 0;
  position: relative;
}

.dossier-hero-main {
  flex: 1;
  min-width: 0;
}

.dossier-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 5px;
}

.dossier-hero h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.dossier-title-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.dossier-hero-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  color: #F8FAFC;
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.dossier-hero-action-btn svg {
  width: 15.5px;
  height: 15.5px;
  stroke-width: 2;
}

.dossier-hero-action-btn:hover {
  background: rgba(56, 189, 248, 0.22);
  color: #FFFFFF;
  border-color: rgba(125, 211, 252, 0.6);
}

.dossier-hero-action-btn.is-syncing svg {
  animation: spin-icon 0.85s linear infinite;
}

@keyframes spin-icon {
  to { transform: rotate(360deg); }
}

.dossier-hero-action-btn.danger {
  background: rgba(239, 68, 68, 0.16);
  color: #FCA5A5;
  border-color: rgba(239, 68, 68, 0.35);
}

.dossier-hero-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.85);
  color: #FFFFFF;
  border-color: rgba(239, 68, 68, 1);
}

.dossier-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  font: 500 11.5px var(--font-mono);
  color: #CBD5E1;
}

.dossier-hero-address-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-top: 5px;
  font: 500 11.5px var(--font-sans);
  color: #F1F5F9;
  line-height: 1.4;
}

.dossier-hero-address-label {
  font: 600 10.5px var(--font-mono);
  color: #9CC0E8;
  letter-spacing: 0.04em;
}

#dossier-meta-endereco {
  user-select: text;
  cursor: text;
}

.hero-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #CBD5E1;
  font: 600 10px var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.hero-copy-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.45);
  color: #FFFFFF;
}

.hero-copy-btn svg {
  width: 11px;
  height: 11px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}

.dossier-hero-right {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-shrink: 0;
}

.dossier-score-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.dossier-score-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dossier-status-compact {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 0;
  padding: 0;
}

.dossier-status-compact label {
  font: 600 9.5px var(--font-mono);
  letter-spacing: 0.08em;
  color: #9FB5CE;
  white-space: nowrap;
}

.dossier-stage-select {
  width: auto;
  min-width: 150px;
  max-width: 215px;
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  background: #0F2947;
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-size: 11.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.dossier-stage-select:disabled {
  opacity: 0.92;
  cursor: not-allowed;
}

.dossier-close-top {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: inline-grid;
  place-items: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.dossier-close-top:hover {
  background: rgba(239, 68, 68, 0.85);
  border-color: rgba(239, 68, 68, 1);
  color: #FFFFFF;
  transform: scale(1.05);
}

.dossier-close-top svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.dossier-tabs-bar {
  background: #FFFFFF;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.dossier-tabs-bar .via-tab {
  padding: 10px 2px;
}

.dossier-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 28px 34px;
  background: var(--bg);
}

.dossier-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.dossier-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* Grids Inteligentes nos Submenus do Dossiê e Formulários */
.dossier-split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.dossier-anexos-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
  gap: 18px;
  align-items: start;
}

.dossier-checks-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dossier-checks-grid-2 .check-row-card {
  margin-bottom: 0;
}

.qsa-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(500px, 100%), 1fr));
  gap: 14px;
}

.consult-commercial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.dossier-receita-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.popup-form-card {
  width: min(820px, 95vw);
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 26px;
  box-shadow: 0 30px 90px rgba(3, 18, 34, 0.42);
  overflow: hidden;
  animation: popup-zoom-in 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.popup-form-card .field-label {
  font-size: 11.5px;
  min-height: 20px;
  margin-bottom: 5px;
}

.popup-form-card .via-input,
.popup-form-card .via-select {
  height: 38px;
}

.popup-form-card.popup-rule-lg {
  width: min(960px, 95vw);
  padding: 28px 32px;
}

.popup-form-card.popup-rule-lg .field-label {
  font-size: 12.5px;
  min-height: 22px;
  margin-bottom: 6px;
}

.popup-form-card.popup-rule-lg .via-input,
.popup-form-card.popup-rule-lg .via-select {
  height: 42px;
  min-height: 42px;
  font-size: 13.5px;
  padding: 0 13px;
}

.popup-form-card.popup-rule-lg .via-textarea {
  min-height: 76px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.45;
}

.check-row-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 10px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.check-row-card.matched {
  border-color: #BBF7D0;
  background: linear-gradient(90deg, #F0FDF4 0%, #FFFFFF 35%);
}

/* Switch Toggle */
.via-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.via-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.via-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #CBD5E1;
  border-radius: 999px;
  transition: 0.2s;
}

.via-switch-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #FFFFFF;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.via-switch input:checked + .via-switch-slider {
  background-color: var(--navy);
}

.via-switch input:checked + .via-switch-slider::before {
  transform: translateX(18px);
}

/* Dropzone de Upload de Anexos */
.upload-dropzone {
  border: 2px dashed #CBD5E1;
  border-radius: 14px;
  background: #FFFFFF;
  padding: 26px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--navy);
  background: #F1F5F9;
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

/* Modal Visualizador de PDF e Imagens */
.preview-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 18, 34, 0.78);
  backdrop-filter: blur(6px);
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 24px;
}

.preview-dialog {
  width: min(1040px, 96vw);
  height: min(86vh, 860px);
  background: #FFFFFF;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

.preview-dialog-head {
  padding: 14px 20px;
  background: var(--navy);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-dialog-body {
  flex: 1;
  background: #1E293B;
  display: grid;
  place-items: center;
  overflow: auto;
  position: relative;
}

.preview-dialog-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #FFFFFF;
}

.preview-dialog-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Toast Flutuante Global */
.toast-container {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-item {
  min-width: 300px;
  max-width: 420px;
  background: linear-gradient(135deg, #0D233C 0%, #031526 100%);
  color: #FFFFFF;
  padding: 14px 18px;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(3, 21, 38, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  animation: toast-slide-up 280ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes toast-slide-up {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* =============================================================================
 * 9. Responsividade 100% Mobile & Tablet
 * ============================================================================= */

@media (max-width: 1200px) {
  .kpi-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-grid-2 {
    grid-template-columns: 1fr;
  }
  .via-hero-banner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1120px) {
  .dossier-split-grid,
  .dossier-anexos-grid,
  .dossier-checks-grid-2 {
    grid-template-columns: 1fr;
  }
  .dossier-receita-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: 240px !important;
  }
  body.mobile-nav-open .app-sidebar {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(3, 22, 40, 0.35);
  }
  .sidebar-toggle-btn {
    display: none;
  }
  .app-workspace,
  body.sidebar-collapsed .app-workspace {
    margin-left: 0;
  }
  .mobile-menu-btn {
    display: grid;
  }
  .app-topbar {
    padding: 0 16px;
  }
  .app-main {
    padding: 20px 16px 48px;
  }
  .dossier-grid-2,
  .dossier-grid-3,
  .dossier-receita-grid,
  .consult-commercial-grid,
  .partner-grid-top,
  .consult-refs-row {
    grid-template-columns: 1fr;
  }
  .dossier-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 16px;
  }
  .dossier-hero-right {
    justify-content: space-between;
    align-items: center;
  }
  .dossier-score-box {
    align-items: flex-start;
  }
  .dossier-tabs-bar {
    padding: 0 16px;
  }
  .popup-form-card,
  .popup-form-card.popup-rule-lg {
    max-height: 94dvh;
    overflow-y: auto;
    padding: 20px 18px;
  }
  .funnel-row {
    grid-template-columns: 130px 1fr 85px;
  }
}

@media (max-width: 560px) {
  .kpi-grid-4 {
    grid-template-columns: 1fr;
  }
  .global-search-btn kbd {
    display: none;
  }
  .user-pill span {
    display: none;
  }
  .via-hero-banner {
    padding: 22px 18px;
  }
  .dossier-hero, .dossier-body {
    padding-left: 16px;
    padding-right: 16px;
  }
}
