/* ==========================================================================
   Innova Fluxo - Main Stylesheet v6.0 (Dark Premium - Riwer Labs Inspired)
   Author: Master Orchestrator
   Description: Arquivo CSS principal com tema dark premium, efeitos de glow,
                animações suaves e experiência visual moderna.
   ========================================================================== */

/* ==========================================================================
   1. RESET E ESTILOS GLOBAIS
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  scroll-behavior: smooth;
  line-height: var(--line-height-normal);
  font-size: 16px;
  scroll-padding-top: 80px;
  overflow-x: hidden !important;
  overflow-y: auto;
  width: 100%;
  max-width: 100vw;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--surface-secondary);
  color: var(--text-primary);
  overflow-x: hidden !important;
  overflow-y: auto;
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  height: 100%;
  transition: background-color var(--duration-normal), color var(--duration-normal);
}

::selection {
  background: var(--primary);
  color: var(--black);
}

img {
  max-width: 100%;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.3s var(--ease);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

ul, ol {
  list-style: none;
}

/* Prevent overflow on all elements */
section, article, aside, header, footer, main, nav, div {
  max-width: 100%;
}

/* Scrollbar Premium Dark */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
  border: 2px solid var(--scrollbar-track);
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

/* ==========================================================================
   2. LAYOUT PRINCIPAL
   ========================================================================== */

.app-container {
  display: flex;
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  height: 100%;
  overflow-x: hidden !important;
  background: var(--surface-secondary);
  position: relative;
}

/* --- Sidebar Dark Premium --- */
.sidebar {
  width: var(--width-sidebar);
  background: var(--dark-2);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-sidebar);
  transition: width var(--duration-normal) var(--ease),
              transform var(--duration-normal) var(--ease);
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    var(--primary) 20%,
    var(--secondary) 50%,
    var(--accent) 80%,
    transparent 100%
  );
  opacity: 0.3;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  min-height: var(--header-height);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

.sidebar-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.5;
}

.sidebar-logo {
  max-width: 150px;
  height: auto;
  transition: transform var(--duration-normal) var(--ease);
  filter: drop-shadow(0 0 10px rgba(var(--primary-rgb), 0.3));
}

.sidebar-logo:hover {
  transform: scale(1.05);
}

.sidebar-nav {
  flex-grow: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease);
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
}

.nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), 0.1), transparent);
  transition: left 0.5s ease;
}

.nav-link:hover::before {
  left: 100%;
}

.nav-link:hover {
  background-color: var(--surface-tertiary);
  color: var(--text-primary);
  transform: translateX(5px);
  border-color: var(--border-default);
}

.nav-link.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--black);
  font-weight: var(--font-weight-semibold);
  box-shadow: var(--glow-primary-sm);
  border-color: var(--primary);
}

.nav-link.active:hover {
  transform: translateX(5px);
}

.nav-link.active .nav-icon {
  color: var(--black);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color var(--duration-fast) var(--ease);
}

.nav-text {
  opacity: 1;
  transition: opacity var(--duration-fast) var(--ease);
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: center;
}

/* Logout Button */
.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  transition: all var(--duration-normal) var(--ease);
}

/* Override btn-icon styles for logout button */
.logout-btn.btn-icon {
  width: 100%;
  height: auto;
  padding: var(--space-3) var(--space-4);
  min-height: unset;
  margin-left: 0;
}

.logout-btn:hover {
  background: rgba(var(--error-rgb), 0.15);
  color: var(--error);
}

.logout-icon {
  width: 24px !important;
  height: 24px !important;
  stroke-width: 2.5;
}

/* --- Main Content --- */
.main-content {
  flex: 1 1 0;
  min-width: 0; /* Critical: prevents flex item from overflowing */
  margin-left: var(--width-sidebar);
  width: calc(100vw - var(--width-sidebar));
  max-width: calc(100vw - var(--width-sidebar));
  transition: margin-left var(--duration-normal) var(--ease);
  position: relative;
  background: var(--surface-secondary);
  min-height: 100vh;
  height: 100%;
  overflow-x: hidden !important;
  overflow-y: auto;
}

/* Background Pattern Subtle */
.main-content::before {
  content: '';
  position: fixed;
  top: 0;
  left: var(--width-sidebar);
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(var(--primary-rgb), 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--primary-rgb), 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

.content-area {
  padding: var(--element-gap);
  max-width: 100%;
  margin: 0;
  width: 100%;
  min-height: calc(100vh - var(--header-height, 0px));
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  overflow-x: hidden !important;
  overflow-y: visible;
}

/* Ensure all direct children don't cause overflow */
.content-area > * {
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

/* Dashboard wrapper - prevent overflow */
.content-area > .animate-fade-in {
  max-width: 100%;
  width: 100%;
  overflow-x: hidden;
}

/* Page Header */
.page-header {
  margin-bottom: var(--element-gap);
  animation: fade-in-up 0.5s ease forwards;
}

.page-title {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  letter-spacing: var(--letter-spacing-tight);
}

.page-title .feather,
.page-title .icon-wrapper {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  color: var(--black);
  box-shadow: var(--glow-primary-sm);
}

.page-title .feather {
  padding: 12px;
}

.page-description,
.page-subtitle {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  margin-top: var(--space-2);
  max-width: 100%;
}

/* ==========================================================================
   3. COMPONENTES - CARDS PREMIUM
   ========================================================================== */

.card {
  background: var(--gradient-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  transition: all var(--duration-normal) var(--ease);
  margin-bottom: var(--element-gap);
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Gradient bar no topo do card */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-card-bar);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease);
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-default);
}

.card:hover::before {
  opacity: 1;
}

.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.card-title .feather {
  width: 1.2em;
  height: 1.2em;
  color: var(--primary);
}

.feather-title {
  width: 1.2em;
  height: 1.2em;
  color: var(--primary);
}

.feather-title-sm {
  width: 1em;
  height: 1em;
  color: var(--primary);
}

.card-body {
  padding: var(--element-gap);
  display: flex;
  flex-direction: column;
  gap: var(--element-gap);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.card-footer {
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background-color: var(--surface-tertiary);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ==========================================================================
   4. KPI CARDS - DASHBOARD PREMIUM
   ========================================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--element-gap);
  margin-bottom: var(--element-gap);
  width: 100%;
  max-width: 100%;
}

.kpi-card {
  background: linear-gradient(145deg, var(--dark-4) 0%, var(--dark-3) 100%);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  transition: all var(--duration-normal) var(--ease);
  position: relative;
  overflow: hidden;
}

/* Animated gradient border on top */
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-card-bar);
  background-size: 200% 100%;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-normal) var(--ease);
}

/* Glow effect on hover */
.kpi-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(var(--primary-rgb), 0.08) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease);
}

.kpi-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl), var(--glow-primary-sm);
  border-color: rgba(var(--primary-rgb), 0.3);
}

.kpi-card:hover::before {
  transform: scaleX(1);
  animation: border-flow 2s ease infinite;
}

.kpi-card:hover::after {
  opacity: 1;
}

/* KPI Card Header */
.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.kpi-card-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  box-shadow: var(--glow-primary-sm);
  transition: all var(--duration-normal) var(--ease);
}

.kpi-card:hover .kpi-card-icon-wrapper {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: var(--glow-primary);
}

.kpi-card-icon-wrapper svg,
.kpi-card-icon-wrapper .feather {
  width: 24px;
  height: 24px;
  color: var(--black);
}

.kpi-card-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  flex: 1;
  text-align: right;
}

/* KPI Card Body */
.kpi-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.kpi-card-value {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: var(--line-height-tight);
  transition: all var(--duration-normal) var(--ease);
}

.kpi-card:hover .kpi-card-value {
  background: var(--gradient-card-bar);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* KPI Card Variants */
.kpi-card.kpi-success .kpi-card-icon-wrapper {
  background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
  box-shadow: var(--glow-success);
}

.kpi-card.kpi-warning .kpi-card-icon-wrapper {
  background: linear-gradient(135deg, var(--warning) 0%, var(--warning-dark) 100%);
  box-shadow: var(--glow-warning);
}

.kpi-card.kpi-error .kpi-card-icon-wrapper {
  background: linear-gradient(135deg, var(--error) 0%, var(--error-dark) 100%);
  box-shadow: var(--glow-error);
}

.kpi-card.kpi-secondary .kpi-card-icon-wrapper {
  background: var(--gradient-secondary);
  box-shadow: var(--glow-secondary);
}

.kpi-card.kpi-accent .kpi-card-icon-wrapper {
  background: var(--gradient-accent);
  box-shadow: var(--glow-accent);
}

/* KPI Card with Trend */
.kpi-card-trend {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  margin-top: var(--space-2);
  width: fit-content;
}

.kpi-card-trend.positive {
  background: rgba(var(--success-rgb), 0.15);
  color: var(--success);
}

.kpi-card-trend.negative {
  background: rgba(var(--error-rgb), 0.15);
  color: var(--error);
}

.kpi-card-trend svg {
  width: 14px;
  height: 14px;
}

/* Mini Sparkline in KPI */
.kpi-card-sparkline {
  height: 40px;
  margin-top: var(--space-2);
  opacity: 0.7;
  transition: opacity var(--duration-normal) var(--ease);
}

.kpi-card:hover .kpi-card-sparkline {
  opacity: 1;
}

.kpi-card .icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--duration-normal) var(--ease);
}

.kpi-card:hover .icon-wrapper {
  transform: scale(1.1) rotate(-5deg);
}

.kpi-card .icon-wrapper.primary {
  background: var(--gradient-primary);
  box-shadow: var(--glow-primary-sm);
}

.kpi-card .icon-wrapper.secondary {
  background: var(--gradient-secondary);
  box-shadow: var(--glow-secondary);
}

.kpi-card .icon-wrapper.accent {
  background: var(--gradient-accent);
  box-shadow: var(--glow-accent);
}

.kpi-card .icon-wrapper.success {
  background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
  box-shadow: var(--glow-success);
}

.kpi-card .icon-wrapper.warning {
  background: linear-gradient(135deg, var(--warning) 0%, var(--warning-dark) 100%);
  box-shadow: var(--glow-warning);
}

.kpi-card .icon-wrapper.error {
  background: linear-gradient(135deg, var(--error) 0%, var(--error-dark) 100%);
  box-shadow: var(--glow-error);
}

.kpi-card .icon-wrapper .feather {
  width: 28px;
  height: 28px;
  color: var(--black);
}

.kpi-card .kpi-content {
  flex-grow: 1;
  min-width: 0;
}

.kpi-card .kpi-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  margin-bottom: var(--space-1);
}

.kpi-card .kpi-value {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: var(--line-height-tight);
}

/* ==========================================================================
   5. BOTÕES PREMIUM - PADRONIZADOS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-weight: var(--font-weight-semibold);
  font-size: var(--btn-font-size-md);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: all var(--duration-fast) var(--ease);
  padding: 0 var(--btn-padding-x-md);
  height: var(--btn-height-md);
  min-height: var(--btn-height-md);
  position: relative;
  overflow: hidden;
}

/* Shine effect */
.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transition: left 0.5s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

.btn:disabled,
.btn.is-loading {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none !important;
  box-shadow: none !important;
}

/* Button Icon Sizes - Consistent */
.btn .feather,
.btn svg {
  width: var(--icon-sm);
  height: var(--icon-sm);
  flex-shrink: 0;
}

/* Primary Button */
.btn-primary {
  background: var(--gradient-primary);
  color: var(--black);
  box-shadow: var(--glow-primary-sm);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--glow-primary);
}

/* Secondary Button */
.btn-secondary {
  background: var(--surface-tertiary);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-elevated);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

/* Outline Button */
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-tertiary);
  color: var(--text-primary);
}

/* Danger Button */
.btn-danger {
  background: linear-gradient(135deg, var(--error) 0%, var(--error-dark) 100%);
  color: var(--white);
  box-shadow: var(--glow-error);
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(var(--error-rgb), 0.4);
}

/* Success Button */
.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
  color: var(--white);
  box-shadow: var(--glow-success);
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(var(--success-rgb), 0.4);
}

/* Warning Button */
.btn-warning {
  background: linear-gradient(135deg, var(--warning) 0%, var(--warning-dark) 100%);
  color: var(--black);
  box-shadow: var(--glow-warning);
}

.btn-warning:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(var(--warning-rgb), 0.4);
}

/* ============================================
   BUTTON SIZES - PADRONIZADOS
   ============================================ */

/* Extra Small Button */
.btn-xs {
  padding: 0 var(--btn-padding-x-xs);
  height: var(--btn-height-xs);
  min-height: var(--btn-height-xs);
  font-size: var(--btn-font-size-xs);
  gap: var(--space-1);
}

.btn-xs .feather,
.btn-xs svg {
  width: var(--icon-xs);
  height: var(--icon-xs);
}

/* Small Button */
.btn-sm {
  padding: 0 var(--btn-padding-x-sm);
  height: var(--btn-height-sm);
  min-height: var(--btn-height-sm);
  font-size: var(--btn-font-size-sm);
}

.btn-sm .feather,
.btn-sm svg {
  width: var(--icon-sm);
  height: var(--icon-sm);
}

/* Large Button */
.btn-lg {
  padding: 0 var(--btn-padding-x-lg);
  height: var(--btn-height-lg);
  min-height: var(--btn-height-lg);
  font-size: var(--btn-font-size-lg);
}

.btn-lg .feather,
.btn-lg svg {
  width: var(--icon-md);
  height: var(--icon-md);
}

/* Icon-only Button */
.btn-icon {
  width: var(--btn-height-md);
  height: var(--btn-height-md);
  padding: 0;
  min-height: unset;
  border-radius: var(--radius-md);
}

.btn-icon.btn-xs {
  width: var(--btn-height-xs);
  height: var(--btn-height-xs);
}

.btn-icon.btn-sm {
  width: var(--btn-height-sm);
  height: var(--btn-height-sm);
}

.btn-icon.btn-lg {
  width: var(--btn-height-lg);
  height: var(--btn-height-lg);
}

.btn-icon .feather,
.btn-icon svg {
  width: var(--icon-md);
  height: var(--icon-md);
}

/* Block Button */
.btn-block {
  width: 100%;
}

/* Button Group */
.btn-group {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

/* ==========================================================================
   6. FORMULÁRIOS PREMIUM - PADRONIZADOS
   ========================================================================== */

/* --- Form Group --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--label-margin-bottom);
  margin-bottom: var(--form-group-gap);
  width: 100%;
  max-width: 100%;
}

/* Remove margin from last form-group */
.form-group:last-child {
  margin-bottom: 0;
}

/* --- Labels Padronizados --- */
.label {
  font-size: var(--label-font-size);
  font-weight: var(--label-font-weight);
  color: var(--label-color);
  line-height: 1.4;
}

.label.required::after {
  content: ' *';
  color: var(--error);
}

/* --- Inputs Padronizados --- */
.input,
.select,
.textarea {
  width: 100%;
  height: var(--input-height-md);
  padding: var(--input-padding-y) var(--input-padding-x);
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease);
}

/* Input Sizes */
.input-xs, .select-xs { height: var(--input-height-xs); padding: var(--input-padding-y-sm) var(--input-padding-x-sm); font-size: var(--font-size-xs); }
.input-sm, .select-sm { height: var(--input-height-sm); padding: var(--input-padding-y-sm) var(--input-padding-x); font-size: var(--font-size-sm); }
.input-lg, .select-lg { height: var(--input-height-lg); padding: var(--input-padding-y) var(--input-padding-x); font-size: var(--font-size-base); }

.input::placeholder,
.textarea::placeholder {
  color: var(--input-placeholder);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--input-border-hover);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--input-border-focus);
  box-shadow: var(--shadow-focus-ring);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: var(--surface-tertiary);
}

/* --- Textarea --- */
.textarea {
  height: auto;
  min-height: var(--textarea-min-height);
  resize: vertical;
  line-height: var(--line-height-normal);
}

/* --- Select --- */
.select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23A0A0A0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--input-padding-x) center;
  background-size: 16px;
  padding-right: 40px;
}

/* --- Form Text/Help --- */
.form-text {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* --- Form Row (Inputs lado a lado) --- */
.form-row {
  display: flex;
  gap: var(--form-row-gap);
  align-items: flex-start;
  flex-wrap: wrap;
  width: 100%;
}

.form-row > .form-group {
  flex: 1;
  min-width: 150px;
  margin-bottom: 0;
}

.form-row > .form-group.flex-2 {
  flex: 2;
}

.form-row > .form-group.flex-3 {
  flex: 3;
}

/* --- Fieldset Padronizado --- */
.fieldset {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--fieldset-gap);
  background: var(--surface-tertiary);
}

.fieldset legend {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  padding: 0 var(--space-2);
}

.fieldset legend svg,
.fieldset legend .feather {
  width: var(--icon-sm);
  height: var(--icon-sm);
  color: var(--primary);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--dark-5);
  transition: all var(--duration-fast) var(--ease);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: var(--white);
  transition: all var(--duration-fast) var(--ease);
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--gradient-primary);
  border-color: var(--primary);
  box-shadow: var(--glow-primary-sm);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(24px);
  background-color: var(--black);
}

/* ==========================================================================
   7. TABELAS PREMIUM
   ========================================================================== */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.table thead {
  background: var(--surface-tertiary);
}

.table th {
  padding: var(--space-4) var(--space-5);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  font-size: var(--font-size-xs);
  border-bottom: 1px solid var(--border-subtle);
}

.table td {
  padding: var(--space-4) var(--space-5);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  transition: all var(--duration-fast) var(--ease);
}

.table tbody tr {
  transition: all var(--duration-fast) var(--ease);
}

.table tbody tr:hover {
  background-color: var(--surface-tertiary);
}

.table tbody tr:hover td {
  color: var(--text-primary);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* ==========================================================================
   8. BADGES PREMIUM
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.badge-primary {
  background: var(--badge-primary-bg);
  color: var(--badge-primary-text);
}

.badge-secondary {
  background: var(--badge-secondary-bg);
  color: var(--badge-secondary-text);
}

.badge-success {
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
}

.badge-warning {
  background: var(--badge-warning-bg);
  color: var(--badge-warning-text);
}

.badge-error {
  background: var(--badge-error-bg);
  color: var(--badge-error-text);
}

.badge-purple {
  background: var(--badge-purple-bg);
  color: var(--badge-purple-text);
}

/* ==========================================================================
   9. ALERTS PREMIUM
   ========================================================================== */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid;
  margin-bottom: var(--space-5);
}

.alert-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.alert-content {
  flex-grow: 1;
}

.alert-title {
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-1);
}

.alert-message {
  font-size: var(--font-size-sm);
  opacity: 0.9;
}

.alert-info {
  background: var(--alert-info-bg);
  border-color: var(--alert-info-border);
  color: var(--alert-info-text);
}

.alert-success {
  background: var(--alert-success-bg);
  border-color: var(--alert-success-border);
  color: var(--alert-success-text);
}

.alert-warning {
  background: var(--alert-warning-bg);
  border-color: var(--alert-warning-border);
  color: var(--alert-warning-text);
}

.alert-error {
  background: var(--alert-error-bg);
  border-color: var(--alert-error-border);
  color: var(--alert-error-text);
}

/* ==========================================================================
   10. MODALS PREMIUM - PADRONIZADOS
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--surface-overlay);
  backdrop-filter: blur(var(--backdrop-blur-md));
  z-index: var(--z-overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal) var(--ease),
              visibility var(--duration-normal) var(--ease);
}

.modal-backdrop.visible,
.modal-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal) var(--ease),
              visibility var(--duration-normal) var(--ease);
}

.modal.visible,
.modal.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Modal Sizes */
.modal-content {
  background: var(--surface-primary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-2xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  max-width: 560px;
  width: 100%;
  transform: scale(0.95);
  transition: transform var(--duration-normal) var(--ease);
}

.modal-sm .modal-content { max-width: 400px; }
.modal-md .modal-content { max-width: 560px; }
.modal-lg .modal-content { max-width: 720px; }
.modal-xl .modal-content { max-width: 900px; }
.modal-full .modal-content { max-width: 95vw; max-height: 95vh; }

.modal.visible .modal-content,
.modal.is-visible .modal-content {
  transform: scale(1);
}

/* Modal Header - Padronizado */
.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.modal-title .feather,
.modal-title svg {
  width: var(--icon-md);
  height: var(--icon-md);
  color: var(--primary);
}

/* Modal Body - Padronizado */
.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex-grow: 1;
}

/* Form groups inside modal body */
.modal-body .form-group {
  margin-bottom: var(--form-group-gap);
}

.modal-body .form-group:last-child {
  margin-bottom: 0;
}

.modal-body .form-row {
  margin-bottom: var(--form-group-gap);
}

.modal-body .form-row:last-child {
  margin-bottom: 0;
}

.modal-body .fieldset {
  margin-bottom: var(--fieldset-gap);
}

.modal-body .fieldset:last-child {
  margin-bottom: 0;
}

/* Modal Footer - Padronizado */
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface-tertiary);
  flex-shrink: 0;
}

.modal-footer-left {
  justify-content: flex-start;
}

.modal-footer-between {
  justify-content: space-between;
}

/* Modal Close Button */
.modal-close-btn {
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease);
  flex-shrink: 0;
}

.modal-close-btn:hover {
  color: var(--error);
  transform: rotate(90deg);
}

/* Login Modal Special */
.login-modal .modal-content {
  max-width: 420px;
}

.login-header {
  flex-direction: column;
  text-align: center;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-6);
  background: var(--gradient-dark);
}

.login-logo {
  max-width: 180px;
  margin: 0 auto;
  filter: drop-shadow(0 0 20px rgba(var(--primary-rgb), 0.3));
}

.login-title {
  font-size: var(--font-size-2xl);
}

.login-body {
  padding: var(--space-8) var(--space-6);
}

.login-submit-btn {
  width: 100%;
  margin-top: var(--space-4);
}

/* ==========================================================================
   11. KANBAN BOARD PREMIUM
   ========================================================================== */

.kanban-board {
  display: flex;
  gap: var(--element-gap);
  overflow-x: auto;
  padding: var(--element-gap);
  min-height: 60vh;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.kanban-column {
  flex: 0 0 320px;
  background: var(--surface-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 250px);
  transition: all var(--duration-normal) var(--ease);
}

.kanban-column:hover {
  border-color: var(--border-default);
}

.kanban-column-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-tertiary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kanban-column-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.kanban-column-count {
  background: var(--badge-primary-bg);
  color: var(--primary);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  min-width: 24px;
  text-align: center;
}

.kanban-cards {
  flex-grow: 1;
  overflow-y: auto;
  padding: var(--gap-md);
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
}

/* ==========================================================================
   KANBAN CARD - REDESIGN CLEAN
   ========================================================================== */

.kanban-card {
  background: var(--dark-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: var(--space-3);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease);
  position: relative;
}

.kanban-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

/* Card Header */
.kanban-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  gap: var(--space-2);
}

.kanban-card-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
}

.kanban-card-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Avatar do Card - Suporta foto de perfil ou inicial */
.kanban-card-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  overflow: hidden;
}

/* Fallback com inicial quando não tem foto */
.kanban-card-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--dark-1);
  text-transform: uppercase;
}

/* Foto de perfil quando disponível */
.kanban-card-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-full);
}

/* Esconde fallback quando imagem carregada */
.kanban-card-avatar.has-photo .kanban-card-avatar-fallback {
  display: none;
}

/* Remove o ::before pois agora usamos elemento real */
.kanban-card-title::before {
  display: none;
}

/* Card Body */
.kanban-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Detalhes do Card */
.kanban-card-detail {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin: 0;
}

.kanban-card-detail svg,
.kanban-card-detail .feather {
  width: 12px;
  height: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Card Footer */
.kanban-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

.kanban-card-footer .kanban-card-detail {
  font-size: 11px;
  color: var(--text-muted);
}

.kanban-card-footer .kanban-card-detail svg {
  width: 11px;
  height: 11px;
}

.kanban-card-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.kanban-card-actions .btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease);
}

.kanban-card-actions .btn-icon svg {
  width: 14px;
  height: 14px;
}

.kanban-card-actions .btn-icon:hover {
  transform: scale(1.1);
}

.kanban-card-actions .toggle-llm-btn.btn-warning {
  background: rgba(var(--warning-rgb), 0.15);
  color: var(--warning);
  border: 1px solid rgba(var(--warning-rgb), 0.3);
}

.kanban-card-actions .toggle-llm-btn.btn-warning:hover {
  background: rgba(var(--warning-rgb), 0.25);
}

.kanban-card-actions .toggle-llm-btn.btn-success {
  background: rgba(var(--success-rgb), 0.15);
  color: var(--success);
  border: 1px solid rgba(var(--success-rgb), 0.3);
}

.kanban-card-actions .toggle-llm-btn.btn-success:hover {
  background: rgba(var(--success-rgb), 0.25);
}

.kanban-card-actions .view-history-btn {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  border: 1px solid rgba(var(--primary-rgb), 0.2);
}

.kanban-card-actions .view-history-btn:hover {
  background: rgba(var(--primary-rgb), 0.2);
}

/* ==========================================================================
   KANBAN CARD TAGS
   ========================================================================== */

.kanban-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: var(--space-2);
}

.kanban-card-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 500;
  border-radius: var(--radius-full);
  border: 1px solid;
  white-space: nowrap;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all var(--duration-fast) var(--ease);
}

.kanban-card-tag:hover {
  transform: scale(1.05);
}

.kanban-card-tag-more {
  background: var(--dark-3) !important;
  color: var(--text-muted) !important;
  border-color: var(--border-subtle) !important;
  cursor: help;
}

/* ==========================================================================
   KANBAN CARD HEADER ACTIONS (History + Funnel Menu)
   ========================================================================== */

.kanban-card-header-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.kanban-card-header-actions .btn-icon {
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  opacity: 0.7;
  transition: all var(--duration-fast) var(--ease);
}

.kanban-card-header-actions .btn-icon:hover {
  opacity: 1;
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
}

.kanban-card-header-actions .btn-icon svg {
  width: 14px;
  height: 14px;
}

.funnel-menu-btn {
  background: transparent !important;
  border: none !important;
  color: var(--text-muted) !important;
}

.funnel-menu-btn:hover {
  background: rgba(var(--primary-rgb), 0.1) !important;
  color: var(--primary) !important;
}

/* ==========================================================================
   FUNNEL CONTEXT MENU - Dropdown for changing prospect's funnel
   ========================================================================== */

.funnel-context-menu {
  background: var(--surface-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  min-width: 200px;
  max-width: 280px;
  overflow: hidden;
  animation: fadeInScale 0.15s var(--ease);
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.funnel-context-menu-header {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
}

.funnel-context-menu-list {
  padding: 8px 0;
  max-height: 250px;
  overflow-y: auto;
}

.funnel-context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease);
}

.funnel-context-menu-item:hover:not(.current) {
  background: rgba(var(--primary-rgb), 0.1);
}

.funnel-context-menu-item.current {
  background: rgba(var(--primary-rgb), 0.08);
  cursor: default;
}

.funnel-context-menu-item .funnel-name {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.funnel-context-menu-item .funnel-default-badge {
  font-size: 12px;
}

.funnel-context-menu-item .funnel-current-badge {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* ==========================================================================
   MODAL STYLES FOR FUNNEL CHANGE CONFIRMATION
   ========================================================================== */

#create-funnel-modal,
#change-funnel-modal {
  display: none; /* IMPORTANTE: Escondido por padrão, JS define para 'flex' ao abrir */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.7); /* Overlay escuro */
}

#create-funnel-modal .modal-overlay,
#change-funnel-modal .modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

#create-funnel-modal .modal-content,
#change-funnel-modal .modal-content {
  position: relative;
  background: var(--surface-primary, #1a1a2e); /* Fallback dark bg */
  border: 1px solid var(--border-default, #333);
  border-radius: var(--radius-xl, 16px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeInScale 0.2s ease-out;
  z-index: 10001; /* Acima do overlay */
}

#create-funnel-modal .modal-header,
#change-funnel-modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle, #333);
}

#create-funnel-modal .modal-title,
#change-funnel-modal .modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary, #ffffff);
}

#create-funnel-modal .btn-close-modal,
#change-funnel-modal .btn-close-modal {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-muted, #888);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

#create-funnel-modal .btn-close-modal:hover,
#change-funnel-modal .btn-close-modal:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger, #ef4444);
}

#create-funnel-modal .modal-body,
#change-funnel-modal .modal-body {
  padding: 20px;
}

#create-funnel-modal .modal-footer,
#change-funnel-modal .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle, #333);
  background: var(--surface-secondary, #0f0f1a);
  border-radius: 0 0 16px 16px;
}

/* ==========================================================================
   LLM STATUS BADGE - FUNCTIONAL & BEAUTIFUL
   ========================================================================== */

.llm-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease);
  cursor: default;
}

/* Status Ativo */
.llm-status-indicator.is-active,
.llm-status-indicator.active {
  background: rgba(var(--success-rgb), 0.15);
  color: var(--success);
  border: 1px solid rgba(var(--success-rgb), 0.3);
  margin-right: 20px;
}

.llm-status-indicator.is-active::before,
.llm-status-indicator.active::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  animation: llm-pulse 1.5s ease-in-out infinite;
  margin-right: 2px;
}

.llm-status-indicator.is-active::after,
.llm-status-indicator.active::after {
  content: 'IA Ativo';
}

/* Status Pausado - apenas indicador visual sem texto */
.llm-status-indicator.is-paused,
.llm-status-indicator.paused {
  background: rgba(var(--warning-rgb), 0.15);
  color: var(--warning);
  border: 1px solid rgba(var(--warning-rgb), 0.3);
  margin-right: 20px;
  padding: 6px 8px;
  gap: 0;
}

.llm-status-indicator.is-paused::before,
.llm-status-indicator.paused::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--warning);
  border-radius: 50%;
  margin-right: 0;
}

/* Pausado não mostra texto, apenas o indicador visual */
.llm-status-indicator.is-paused::after,
.llm-status-indicator.paused::after {
  content: none;
}

/* Status Desabilitado */
.llm-status-indicator.disabled {
  background: rgba(var(--text-muted), 0.1);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.llm-status-indicator.disabled::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  margin-right: 2px;
}

.llm-status-indicator.disabled::after {
  content: 'Off';
}

@keyframes llm-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

/* ==========================================================================
   KANBAN CARD META (para campos extras)
   ========================================================================== */

.kanban-card-meta {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ==========================================================================
   KANBAN COLUMN RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
  .kanban-card {
    padding: var(--space-2);
  }

  .kanban-card-header {
    margin-bottom: var(--space-2);
  }

  .kanban-card-avatar {
    width: 28px;
    height: 28px;
  }

  .llm-status-indicator {
    padding: 3px 8px;
    font-size: 10px;
  }
}

/* ==========================================================================
   12. ANALYTICS SECTION - PREMIUM REDESIGN
   ========================================================================== */

/* Main Analytics Container */
.analytics-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  width: 100%;
}

/* Analytics Grid - Premium Layout */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--grid-gap);
  width: 100%;
  max-width: 100%;
}

@media (max-width: 1024px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

/* Analytics Section Card */
.analytics-section {
  background: linear-gradient(145deg, var(--dark-4) 0%, var(--dark-3) 100%);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease);
}

.analytics-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-card-bar);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease);
}

.analytics-section:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--glow-primary-sm);
  border-color: var(--border-default);
}

.analytics-section:hover::before {
  opacity: 1;
}

/* Analytics Section Header with Icon */
.analytics-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0 0 var(--space-5) 0;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.analytics-title svg,
.analytics-title .feather {
  width: 24px;
  height: 24px;
  color: var(--primary);
  filter: drop-shadow(0 0 8px rgba(var(--primary-rgb), 0.5));
}

/* Analytics List Container */
.analytics-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Premium Analytics Item */
.analytics-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5);
  background: linear-gradient(135deg, var(--dark-5) 0%, var(--dark-4) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  transition: all var(--duration-normal) var(--ease);
  position: relative;
  overflow: hidden;
}

.analytics-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease);
}

.analytics-item:hover {
  border-color: rgba(var(--primary-rgb), 0.3);
  transform: translateX(8px);
  box-shadow: var(--shadow-md), 0 0 20px rgba(var(--primary-rgb), 0.1);
}

.analytics-item:hover::before {
  opacity: 1;
}

/* Analytics Item Label */
.analytics-item-label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-width: 0;
}

.analytics-item-label .main-text {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  line-height: var(--line-height-tight);
}

.analytics-item-label .sub-text {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Analytics Item Value */
.analytics-item-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  min-width: 100px;
}

.analytics-item-value .main-value {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--primary);
  line-height: 1;
  text-shadow: 0 0 20px rgba(var(--primary-rgb), 0.4);
}

.analytics-item-value .sub-value {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

/* Conversion Bar Premium */
.conversion-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--dark-6);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.conversion-bar-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: translateX(-100%);
}

.analytics-item:hover .conversion-bar-bg::before {
  animation: wave 1.5s ease-in-out infinite;
}

.conversion-bar-fill {
  height: 100%;
  background: var(--gradient-card-bar);
  border-radius: var(--radius-full);
  transition: width 0.8s var(--ease);
  position: relative;
  box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.5);
}

.conversion-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  background: var(--white);
  border-radius: 50%;
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.analytics-item:hover .conversion-bar-fill::after {
  opacity: 0.5;
}

/* Legacy conversion-bar support */
.conversion-bar {
  width: 100%;
  height: 8px;
  background: var(--progress-track);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-2);
}

/* ==========================================================================
   12.1 RING PROGRESS INDICATOR
   ========================================================================== */

.ring-progress {
  position: relative;
  width: var(--ring-size, 120px);
  height: var(--ring-size, 120px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring-progress svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-progress-track {
  fill: none;
  stroke: var(--dark-5);
  stroke-width: var(--ring-thickness, 12);
}

.ring-progress-fill {
  fill: none;
  stroke: url(#ring-gradient);
  stroke-width: var(--ring-thickness, 12);
  stroke-linecap: round;
  stroke-dasharray: var(--ring-circumference);
  stroke-dashoffset: var(--ring-offset);
  transition: stroke-dashoffset 1s var(--ease);
  filter: drop-shadow(0 0 8px rgba(var(--primary-rgb), 0.5));
}

.ring-progress-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.ring-progress-value .value {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: 1;
}

.ring-progress-value .label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  margin-top: var(--space-1);
}

/* ==========================================================================
   12.2 METRIC CARD COMPONENT
   ========================================================================== */

.metric-card {
  background: linear-gradient(145deg, var(--dark-4) 0%, var(--dark-3) 100%);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: relative;
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(var(--primary-rgb), 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.metric-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl), var(--glow-primary-sm);
  border-color: rgba(var(--primary-rgb), 0.3);
}

.metric-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  box-shadow: var(--glow-primary-sm);
}

.metric-card-icon svg {
  width: 24px;
  height: 24px;
  color: var(--black);
}

.metric-card-trend {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
}

.metric-card-trend.positive {
  background: rgba(var(--success-rgb), 0.15);
  color: var(--success);
}

.metric-card-trend.negative {
  background: rgba(var(--error-rgb), 0.15);
  color: var(--error);
}

.metric-card-trend.neutral {
  background: rgba(var(--text-muted), 0.15);
  color: var(--text-secondary);
}

.metric-card-trend svg {
  width: 14px;
  height: 14px;
}

.metric-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.metric-card-value {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: var(--line-height-tight);
}

.metric-card-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.metric-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.metric-card-sparkline {
  flex: 1;
  height: 40px;
}

/* ==========================================================================
   12.3 HORIZONTAL BAR CHART
   ========================================================================== */

.bar-chart-horizontal {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
}

.bar-chart-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.bar-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bar-chart-label {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  font-weight: var(--font-weight-medium);
}

.bar-chart-value {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--primary);
}

.bar-chart-track {
  width: 100%;
  height: 12px;
  background: var(--dark-5);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.bar-chart-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s var(--ease);
  position: relative;
  overflow: hidden;
}

.bar-chart-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

.bar-chart-fill.chart-1 {
  background: linear-gradient(90deg, var(--chart-1), var(--chart-2));
  box-shadow: 0 0 15px rgba(var(--chart-1-rgb), 0.4);
}

.bar-chart-fill.chart-2 {
  background: linear-gradient(90deg, var(--chart-2), var(--chart-3));
  box-shadow: 0 0 15px rgba(var(--chart-2-rgb), 0.4);
}

.bar-chart-fill.chart-3 {
  background: linear-gradient(90deg, var(--chart-3), var(--chart-4));
  box-shadow: 0 0 15px rgba(var(--chart-3-rgb), 0.4);
}

.bar-chart-fill.chart-4 {
  background: linear-gradient(90deg, var(--chart-4), var(--chart-5));
  box-shadow: 0 0 15px rgba(var(--chart-4-rgb), 0.4);
}

.bar-chart-fill.chart-5 {
  background: linear-gradient(90deg, var(--chart-5), var(--chart-6));
  box-shadow: 0 0 15px rgba(var(--chart-5-rgb), 0.4);
}

/* ==========================================================================
   12.4 STATS GRID
   ========================================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--grid-gap-sm);
  width: 100%;
  max-width: 100%;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--dark-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  transition: all var(--duration-fast) var(--ease);
  position: relative;
  overflow: hidden;
}

.stat-item::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-card-bar);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-normal) var(--ease);
}

.stat-item:hover {
  border-color: var(--border-default);
  transform: translateY(-4px);
}

.stat-item:hover::before {
  transform: scaleX(1);
}

.stat-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.stat-value {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.stat-change {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.stat-change.positive {
  color: var(--success);
}

.stat-change.negative {
  color: var(--error);
}

/* ==========================================================================
   12.5 FUNNEL VISUALIZATION
   ========================================================================== */

.funnel-chart {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
}

.funnel-stage {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--dark-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  transition: all var(--duration-fast) var(--ease);
  position: relative;
}

.funnel-stage::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 70%;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.funnel-stage:hover {
  background: var(--dark-5);
  border-color: rgba(var(--primary-rgb), 0.3);
  transform: translateX(8px);
}

.funnel-stage:hover::before {
  opacity: 1;
}

.funnel-stage-number {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  color: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-lg);
  flex-shrink: 0;
  box-shadow: var(--glow-primary-sm);
}

.funnel-stage-info {
  flex: 1;
  min-width: 0;
}

.funnel-stage-name {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.funnel-stage-count {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.funnel-stage-bar {
  flex: 1;
  height: 8px;
  background: var(--dark-6);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.funnel-stage-fill {
  height: 100%;
  background: var(--gradient-card-bar);
  border-radius: var(--radius-full);
  transition: width 0.8s var(--ease);
  box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.4);
}

.funnel-stage-percentage {
  min-width: 60px;
  text-align: right;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--primary);
}

/* Funnel Arrow Connector */
.funnel-connector {
  display: flex;
  justify-content: center;
  padding: var(--space-2) 0;
}

.funnel-arrow {
  width: 24px;
  height: 24px;
  color: var(--text-muted);
  opacity: 0.5;
}

/* ==========================================================================
   12.6 DONUT CHART
   ========================================================================== */

.donut-chart {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto;
}

.donut-chart svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-segment {
  fill: none;
  stroke-width: 30;
  stroke-linecap: round;
  transition: all var(--duration-normal) var(--ease);
}

.donut-segment:hover {
  filter: brightness(1.2);
  stroke-width: 35;
}

.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.donut-center-value {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: 1;
}

.donut-center-label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.donut-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: center;
  margin-top: var(--space-6);
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.donut-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   12.7 TIME DURATION DISPLAY
   ========================================================================== */

.duration-display {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--dark-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.duration-display-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: rgba(var(--chart-7-rgb), 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.duration-display-icon svg {
  width: 18px;
  height: 18px;
  color: var(--chart-7);
}

.duration-display-value {
  font-family: var(--font-mono);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  letter-spacing: var(--letter-spacing-wide);
}

.duration-display-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-left: auto;
}

/* ==========================================================================
   12.8 COMPARISON INDICATOR
   ========================================================================== */

.comparison-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--dark-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.comparison-values {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.comparison-current {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.comparison-previous {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  text-decoration: line-through;
}

.comparison-change {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  margin-left: auto;
}

.comparison-change.increase {
  background: rgba(var(--success-rgb), 0.15);
  color: var(--success);
}

.comparison-change.decrease {
  background: rgba(var(--error-rgb), 0.15);
  color: var(--error);
}

.comparison-change svg {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   12.9 DATA TABLE PREMIUM
   ========================================================================== */

.data-table-premium {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table-premium thead th {
  padding: var(--space-4);
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
  background: var(--dark-5);
  border-bottom: 1px solid var(--border-subtle);
}

.data-table-premium thead th:first-child {
  border-radius: var(--radius-lg) 0 0 0;
}

.data-table-premium thead th:last-child {
  border-radius: 0 var(--radius-lg) 0 0;
}

.data-table-premium tbody td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease);
}

.data-table-premium tbody tr {
  transition: all var(--duration-fast) var(--ease);
}

.data-table-premium tbody tr:hover {
  background: var(--dark-4);
}

.data-table-premium tbody tr:hover td {
  color: var(--text-primary);
}

.data-table-premium tbody tr:last-child td:first-child {
  border-radius: 0 0 0 var(--radius-lg);
}

.data-table-premium tbody tr:last-child td:last-child {
  border-radius: 0 0 var(--radius-lg) 0;
}

/* ==========================================================================
   12.10 MINI SPARKLINE
   ========================================================================== */

.sparkline {
  display: inline-block;
  vertical-align: middle;
}

.sparkline svg {
  width: 100%;
  height: 100%;
}

.sparkline-line {
  fill: none;
  stroke: var(--sparkline-stroke);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline-area {
  fill: var(--sparkline-fill);
}

.sparkline-dot {
  fill: var(--sparkline-dot);
  filter: drop-shadow(0 0 4px rgba(var(--primary-rgb), 0.6));
}

/* ==========================================================================
   12.11 PROGRESS STEPS
   ========================================================================== */

.progress-steps {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.progress-step {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  transition: all var(--duration-fast) var(--ease);
}

.progress-step.completed {
  background: var(--gradient-primary);
  color: var(--black);
  box-shadow: var(--glow-primary-sm);
}

.progress-step.active {
  background: var(--dark-4);
  border: 2px solid var(--primary);
  color: var(--primary);
}

.progress-step.pending {
  background: var(--dark-5);
  border: 1px solid var(--border-default);
  color: var(--text-muted);
}

.progress-step-line {
  flex: 1;
  height: 2px;
  background: var(--dark-5);
  max-width: 60px;
}

.progress-step-line.completed {
  background: var(--gradient-primary);
}

/* ==========================================================================
   12.12 INSIGHT CARD
   ========================================================================== */

.insight-card {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5);
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1) 0%, transparent 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(var(--primary-rgb), 0.2);
}

.insight-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.insight-card-icon svg {
  width: 22px;
  height: 22px;
  color: var(--black);
}

.insight-card-content {
  flex: 1;
}

.insight-card-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--primary);
  margin-bottom: var(--space-1);
}

.insight-card-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: var(--line-height-normal);
}

/* ==========================================================================
   12.13 EMPTY STATE ANALYTICS
   ========================================================================== */

.analytics-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  background: var(--dark-4);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border-default);
}

.analytics-empty-icon {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.analytics-empty-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.analytics-empty-text {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  max-width: 300px;
}

/* ==========================================================================
   12.14 CONVERSION FLOW VISUALIZATION
   ========================================================================== */

.conversion-flow {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--dark-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.conversion-flow-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  min-width: 100px;
}

.conversion-flow-circle {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  transition: all var(--duration-fast) var(--ease);
}

.conversion-flow-circle.active {
  background: var(--gradient-primary);
  color: var(--black);
  box-shadow: var(--glow-primary);
}

.conversion-flow-circle.completed {
  background: var(--dark-5);
  border: 2px solid var(--success);
  color: var(--success);
}

.conversion-flow-circle.pending {
  background: var(--dark-5);
  border: 1px solid var(--border-default);
  color: var(--text-muted);
}

.conversion-flow-name {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  text-align: center;
  max-width: 80px;
}

.conversion-flow-arrow {
  width: 40px;
  height: 2px;
  background: var(--border-default);
  position: relative;
  flex-shrink: 0;
}

.conversion-flow-arrow::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid var(--border-default);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

.conversion-flow-arrow.active {
  background: var(--primary);
}

.conversion-flow-arrow.active::after {
  border-left-color: var(--primary);
}

/* ==========================================================================
   12.15 GRADIENT COUNTER
   ========================================================================== */

.gradient-counter {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
}

.gradient-counter-value {
  font-size: var(--font-size-5xl);
  font-weight: var(--font-weight-extrabold);
  background: var(--gradient-card-bar);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  filter: drop-shadow(0 0 20px rgba(var(--primary-rgb), 0.3));
}

.gradient-counter-suffix {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
}

/* ==========================================================================
   13. SPINNER E LOADING - PREMIUM
   ========================================================================== */

.spinner-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--space-12);
}

/* Premium Spinner */
.spinner,
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--dark-5);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  position: relative;
}

.spinner::before,
.loading-spinner::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border: 3px solid transparent;
  border-top-color: rgba(var(--primary-rgb), 0.3);
  border-radius: 50%;
  animation: spin 1.5s linear infinite reverse;
}

.spinner-lg,
.loading-spinner-lg {
  width: 60px;
  height: 60px;
  border-width: 4px;
}

.spinner-sm,
.loading-spinner-sm {
  width: 24px;
  height: 24px;
  border-width: 2px;
}

/* Dots Loading Animation */
.loading-dots {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  justify-content: center;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: bounce-in 0.6s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.1s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.2s;
}

/* Pulse Loading */
.loading-pulse {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-primary);
  box-shadow: var(--glow-primary);
  animation: pulse 1.5s ease-in-out infinite;
}

/* Skeleton Loading Premium */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--dark-4) 0%,
    var(--dark-5) 20%,
    var(--dark-6) 40%,
    var(--dark-5) 60%,
    var(--dark-4) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 16px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-sm);
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: var(--space-3);
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
}

.skeleton-card {
  height: 200px;
  border-radius: var(--radius-lg);
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(var(--dark-1), 0.8);
  backdrop-filter: blur(var(--backdrop-blur-sm));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}

/* Progress Bar Loading */
.loading-progress {
  width: 100%;
  height: 4px;
  background: var(--dark-5);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.loading-progress-bar {
  height: 100%;
  background: var(--gradient-card-bar);
  border-radius: var(--radius-full);
  animation: progress-fill 2s ease-in-out infinite;
  width: 30%;
}

/* Ring Loader */
.ring-loader {
  width: 50px;
  height: 50px;
  position: relative;
}

.ring-loader::before,
.ring-loader::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 4px solid transparent;
  border-radius: 50%;
}

.ring-loader::before {
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}

.ring-loader::after {
  border-bottom-color: var(--secondary);
  animation: spin 1s linear infinite reverse;
}

/* ==========================================================================
   14. FEEDBACK MESSAGES
   ========================================================================== */

.feedback-message {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.feedback-message.success {
  background: var(--alert-success-bg);
  color: var(--alert-success-text);
  border: 1px solid var(--success);
}

.feedback-message.error {
  background: var(--alert-error-bg);
  color: var(--alert-error-text);
  border: 1px solid var(--error);
}

.feedback-message.warning {
  background: var(--alert-warning-bg);
  color: var(--alert-warning-text);
  border: 1px solid var(--warning);
}

.feedback-message.info {
  background: var(--alert-info-bg);
  color: var(--alert-info-text);
  border: 1px solid var(--info);
}

/* ==========================================================================
   15. CONVERSATION HISTORY
   ========================================================================== */

/* Container do histórico */
.conversation-history {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-height: 65vh;
  overflow-y: auto;
  padding: var(--space-4);
  background: var(--dark-2);
  border-radius: var(--radius-lg);
  list-style: none;
  margin: 0;
}

/* Cabeçalho do prospect no modal */
.history-prospect-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface-secondary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  border: 1px solid var(--border-subtle);
}

.history-prospect-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--dark-1);
}

.history-prospect-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-prospect-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.history-prospect-name {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0;
}

.history-prospect-phone {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.history-prospect-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}

/* Remove margin extra no contexto do header do histórico */
.history-prospect-status .llm-status-indicator {
  margin-right: 0;
}

/* Item de mensagem */
.message {
  display: flex;
  margin: 0;
  padding: 0;
}

.message.user {
  justify-content: flex-end;
}

.message.assistant {
  justify-content: flex-start;
}

.message.system-event {
  justify-content: center;
}

/* Bolha de mensagem */
.message-bubble {
  max-width: 80%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.user .message-bubble {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--dark-1);
  border-bottom-right-radius: var(--radius-xs);
}

.message.assistant .message-bubble {
  background: var(--surface-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: var(--radius-xs);
}

.message.system-event .message-bubble {
  background: rgba(var(--info-rgb), 0.1);
  color: var(--info);
  font-size: var(--font-size-xs);
  max-width: 90%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid rgba(var(--info-rgb), 0.2);
}

/* Rótulo do remetente */
.message-sender {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-1);
  opacity: 0.8;
}

.message.user .message-sender {
  color: var(--dark-2);
}

.message.assistant .message-sender {
  color: var(--primary);
}

/* Conteúdo da mensagem */
.message-content {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* Rodapé da mensagem (timestamp + tokens) */
.message-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.message.assistant .message-footer {
  border-top-color: var(--border-subtle);
}

.message-timestamp {
  font-size: 10px;
  opacity: 0.7;
}

/* Info de tokens/modelo */
.token-info {
  font-size: 10px;
  opacity: 0.6;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.token-info::before {
  content: '';
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
  opacity: 0.5;
}

/* Scrollbar customizada */
.conversation-history::-webkit-scrollbar {
  width: 6px;
}

.conversation-history::-webkit-scrollbar-track {
  background: var(--dark-3);
  border-radius: var(--radius-full);
}

.conversation-history::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}

.conversation-history::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* ==========================================================================
   16. DANGER ZONE
   ========================================================================== */

.danger-zone {
  background: var(--alert-error-bg);
  border: 1px solid var(--error);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-top: var(--space-8);
}

.danger-zone-title {
  color: var(--error);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.danger-zone-description {
  color: var(--alert-error-text);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-5);
}

/* Card Danger variant */
.card-danger {
  border-color: rgba(var(--error-rgb), 0.3);
}

.card-danger::before {
  background: linear-gradient(90deg, var(--error), var(--warning), var(--error));
}

.card-danger .card-header {
  border-bottom-color: rgba(var(--error-rgb), 0.2);
}

.danger-title {
  color: var(--error) !important;
}

.danger-title svg {
  color: var(--error);
}

.danger-description {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-5);
  line-height: var(--line-height-normal);
}

/* Controls Grid */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--element-gap);
  margin-bottom: var(--element-gap);
  width: 100%;
}

.controls-grid .card {
  margin-bottom: 0;
}

@media (max-width: 1024px) {
  .controls-grid {
    grid-template-columns: 1fr;
  }
}

/* Queue Status Display */
.queue-status-display {
  margin-bottom: var(--space-4);
}

.queue-status-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}

.queue-status-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-5) var(--space-4);
  background: linear-gradient(135deg, var(--surface-elevated) 0%, var(--surface) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  overflow: hidden;
  min-height: 100px;
}

.queue-status-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.queue-status-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.queue-status-item:hover::before {
  opacity: 1;
}

.queue-status-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  margin-bottom: var(--space-2);
}

.queue-status-value {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--primary);
  line-height: 1;
}

.queue-status-item .badge {
  margin-top: var(--space-1);
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-xs);
}

.queue-status-item .badge-success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.08) 100%);
  color: var(--badge-success-text);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.queue-status-item .badge-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.08) 100%);
  color: var(--badge-warning-text);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Loading Wrapper */
.loading-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
}

.loading-wrapper-lg {
  padding: var(--space-12);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  text-align: center;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  opacity: 0.5;
}

.empty-state-text {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin: 0;
}

/* Kanban Section specific */
.kanban-section .card-body {
  padding: var(--space-2);
}

.kanban-body {
  overflow-x: auto;
}

/* Analytics Section specific */
.analytics-section .card-body {
  padding: var(--space-6);
}

/* Button Group */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-md);
}

.btn-group .btn {
  flex: 1;
  min-width: 100px;
}

@media (max-width: 480px) {
  .btn-group {
    flex-direction: column;
  }

  .btn-group .btn {
    width: 100%;
  }
}

/* Wallet Balance Display */
.wallet-balance-display {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  color: var(--primary);
  margin-bottom: var(--space-4);
}

.wallet-balance-display .spinner {
  width: 32px;
  height: 32px;
}

/* Payment Area */
.payment-area {
  margin-top: var(--space-6);
  padding: var(--space-6);
  background: var(--dark-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  display: none;
}

.payment-area.active {
  display: block;
}

.payment-area .qr-code-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.payment-area .qr-code-container img {
  max-width: 200px;
  border-radius: var(--radius-md);
  background: white;
  padding: var(--space-3);
}

/* ==========================================================================
   17. MOBILE MENU
   ========================================================================== */

.mobile-menu-button {
  display: none !important;
  position: fixed;
  top: var(--space-4);
  left: var(--space-4);
  z-index: calc(var(--z-sidebar) + 10);
  background: var(--surface-primary);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}

.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: calc(var(--z-sidebar) - 1);
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-normal) var(--ease);
}

.mobile-menu-overlay.visible {
  opacity: 1;
  visibility: visible;
}

/* ==========================================================================
   18. SETTINGS PAGE
   ========================================================================== */

.settings-container {
  max-width: 1200px;
}

.settings-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-6);
  margin-top: var(--space-6);
  width: 100%;
}

.settings-sidebar {
  position: sticky;
  top: var(--space-8);
  height: fit-content;
}

.settings-nav {
  background: var(--surface-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: var(--space-4);
}

.settings-nav-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-4);
}

.settings-nav-title:first-child {
  margin-top: 0;
}

.settings-nav-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.settings-nav-link {
  display: block;
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease);
}

.settings-nav-link:hover {
  background: var(--surface-tertiary);
  color: var(--text-primary);
}

.settings-nav-link.active {
  background: var(--badge-primary-bg);
  color: var(--primary);
  font-weight: var(--font-weight-medium);
}

.settings-content {
  min-height: 500px;
  width: 100%;
  overflow-x: hidden;
}

/* ==========================================================================
   19. SLIDER/RANGE INPUT
   ========================================================================== */

.slider-container {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.slider {
  flex-grow: 1;
  -webkit-appearance: none;
  height: 8px;
  background: var(--progress-track);
  border-radius: var(--radius-full);
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--glow-primary-sm);
  transition: all var(--duration-fast) var(--ease);
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: var(--glow-primary);
}

.slider-value {
  min-width: 50px;
  text-align: center;
  font-weight: var(--font-weight-semibold);
  color: var(--primary);
}

/* ==========================================================================
   20. EMPTY STATES
   ========================================================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--text-secondary);
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin-bottom: var(--space-6);
  color: var(--text-muted);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-description {
  max-width: 400px;
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-6);
}

/* ==========================================================================
   21. RESPONSIVIDADE
   ========================================================================== */

/* Tablet */
@media (max-width: 1024px) {
  .sidebar {
    width: var(--width-sidebar-collapsed);
  }

  .sidebar:hover {
    width: var(--width-sidebar);
  }

  .sidebar:not(:hover) .nav-text,
  .sidebar:not(:hover) .sidebar-logo {
    opacity: 0;
    width: 0;
    overflow: hidden;
  }

  .main-content {
    margin-left: var(--width-sidebar-collapsed);
  }

  .main-content::before {
    left: var(--width-sidebar-collapsed);
  }

  .content-area {
    padding: var(--space-6);
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-sidebar {
    position: static;
  }

  .settings-nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3);
  }

  .settings-nav-title {
    width: 100%;
    padding: var(--space-2);
    margin-top: var(--space-2);
  }

  .settings-nav-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .settings-nav-link {
    padding: var(--space-2) var(--space-4);
  }
}

/* Mobile - apenas em telas menores que 768px */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .sidebar {
    transform: translateX(-100%);
    width: var(--width-sidebar);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    width: 100vw !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  .main-content::before {
    left: 0;
  }

  .mobile-menu-button {
    display: flex !important;
  }

  .mobile-menu-overlay {
    display: block;
  }

  .content-area {
    padding: var(--gap-md);
    padding-top: calc(var(--space-16) + var(--space-4));
    max-width: 100% !important;
    width: 100% !important;
    overflow-x: hidden !important;
  }

  .content-area > * {
    max-width: 100% !important;
    width: 100% !important;
  }

  .page-title {
    font-size: var(--font-size-2xl);
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    gap: var(--grid-gap-sm);
  }

  .kanban-board {
    flex-direction: column;
    padding: var(--gap-xs);
    gap: var(--grid-gap-sm);
  }

  .kanban-column {
    flex: none;
    width: 100%;
    max-width: 100%;
    max-height: 400px;
  }

  .analytics-grid {
    grid-template-columns: 1fr;
    gap: var(--grid-gap-sm);
  }

  .modal {
    max-width: calc(100% - var(--space-8));
  }

  /* Ensure all cards fit */
  .card {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
  }

  /* Form groups full width */
  .form-group {
    max-width: 100%;
  }

  /* Stats grid single column on mobile */
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  html, body, .app-container, .main-content {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .content-area {
    padding: var(--gap-sm);
    padding-top: calc(var(--space-16) + var(--space-2));
    width: 100% !important;
    max-width: 100% !important;
  }

  .page-title {
    font-size: var(--font-size-xl);
    flex-wrap: wrap;
  }

  .page-title .icon-wrapper {
    width: 40px;
    height: 40px;
  }

  .kpi-card {
    padding: var(--gap-sm);
  }

  .kpi-card .kpi-value {
    font-size: var(--font-size-2xl);
  }

  .btn {
    padding: var(--gap-xs) var(--gap-md);
    min-height: 40px;
  }

  .btn-lg {
    padding: var(--gap-sm) var(--gap-lg);
    min-height: 48px;
  }

  /* Ensure cards don't overflow */
  .card,
  .card-body,
  .analytics-section {
    padding: var(--gap-sm);
    max-width: 100%;
  }

  /* Table responsiveness */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Form elements */
  .input,
  .textarea,
  .select {
    max-width: 100%;
  }
}

/* ==========================================================================
   22. LOGIN MODAL - PREMIUM STYLE
   ========================================================================== */

.login-modal {
  background: transparent;
}

.login-modal .login-modal-content {
  position: relative;
  background: linear-gradient(180deg, var(--dark-3) 0%, var(--dark-2) 100%);
  border: 1px solid var(--dark-5);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  max-width: 420px;
  width: 100%;
  overflow: hidden;
}

.login-modal .login-modal-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(var(--primary-rgb), 0.08) 0%, transparent 50%);
  pointer-events: none;
  animation: float 8s ease-in-out infinite;
}

.login-modal .login-header {
  text-align: center;
  padding: 0 0 var(--space-6) 0;
  border-bottom: 1px solid var(--dark-5);
  margin-bottom: var(--space-6);
}

.login-logo-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.login-logo {
  max-width: 180px;
  height: auto;
  filter: drop-shadow(0 0 20px rgba(var(--primary-rgb), 0.3));
}

.login-title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  letter-spacing: var(--letter-spacing-tight);
}

.login-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin: 0;
}

.login-body {
  padding: 0;
}

.login-form .form-group {
  margin-bottom: var(--space-5);
}

.login-form .label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.login-form .label svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.login-form .input {
  background: var(--dark-4);
  border: 1px solid var(--dark-6);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  transition: all var(--duration-normal) var(--ease);
}

.login-form .input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring), var(--glow-primary-sm);
}

.login-form .input::placeholder {
  color: var(--text-muted);
}

.login-submit-btn {
  width: 100%;
  margin-top: var(--space-4);
  padding: var(--space-4) var(--space-6);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-wide);
}

.login-footer {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--dark-5);
  text-align: center;
}

.login-footer-text {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin: 0;
}

/* ==========================================================================
   23. TOAST NOTIFICATIONS
   ========================================================================== */

/* Container - canto superior direito */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
  max-width: 400px;
  width: 100%;
}

/* Toast base */
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: linear-gradient(145deg, var(--dark-3) 0%, var(--dark-2) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xl), 0 0 40px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Toast visível */
.toast-visible {
  transform: translateX(0);
  opacity: 1;
}

/* Toast saindo */
.toast-hiding {
  transform: translateX(120%);
  opacity: 0;
}

/* Ícone do toast */
.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-icon svg {
  width: 20px;
  height: 20px;
}

/* Conteúdo do toast */
.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-message {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  line-height: 1.4;
}

/* Botão de fechar */
.toast-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--duration-fast) var(--ease);
  padding: 0;
}

.toast-close:hover {
  background: var(--dark-5);
  color: var(--text-primary);
}

.toast-close svg {
  width: 16px;
  height: 16px;
}

/* Toast Success */
.toast-success {
  border-left: 4px solid var(--success);
}

.toast-success .toast-icon {
  color: var(--success);
}

.toast-success::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(var(--success-rgb), 0.1) 0%, transparent 50%);
  border-radius: inherit;
  pointer-events: none;
}

/* Toast Error */
.toast-error {
  border-left: 4px solid var(--error);
}

.toast-error .toast-icon {
  color: var(--error);
}

.toast-error::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(var(--error-rgb), 0.1) 0%, transparent 50%);
  border-radius: inherit;
  pointer-events: none;
}

/* Toast Warning */
.toast-warning {
  border-left: 4px solid var(--warning);
}

.toast-warning .toast-icon {
  color: var(--warning);
}

.toast-warning::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(var(--warning-rgb), 0.1) 0%, transparent 50%);
  border-radius: inherit;
  pointer-events: none;
}

/* Toast Info */
.toast-info {
  border-left: 4px solid var(--info);
}

.toast-info .toast-icon {
  color: var(--info);
}

.toast-info::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(var(--info-rgb), 0.1) 0%, transparent 50%);
  border-radius: inherit;
  pointer-events: none;
}

/* Responsivo */
@media (max-width: 480px) {
  .toast-container {
    top: var(--space-4);
    right: var(--space-4);
    left: var(--space-4);
    max-width: none;
  }

  .toast {
    padding: var(--space-3);
  }
}

/* ==========================================================================
   24. PRINT STYLES
   ========================================================================== */

@media print {
  .sidebar,
  .mobile-menu-button,
  .btn,
  .modal-backdrop,
  .modal {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .main-content::before {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ==========================================================================
   23. ACCESSIBILITY
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-subtle: var(--dark-7);
    --border-default: var(--light-3);
    --text-secondary: var(--light-2);
  }
}

/* ==========================================================================
   GOOGLE CALENDAR - TIME INTERVALS
   ========================================================================== */

.availability-day-group {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.availability-day-group:last-child {
  border-bottom: none;
}

.time-intervals-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

/* Time interval row - input + delete button inline */
.time-interval-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.time-interval-input {
  flex: 1;
  max-width: 200px;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

/* Delete button - inline style */
.btn-remove-interval {
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  opacity: 0.5;
  transition: all var(--duration-fast) var(--ease);
  margin-left: 0;
}

.btn-remove-interval:hover {
  opacity: 1;
  color: var(--error);
  background: rgba(var(--error-rgb), 0.1);
  border-color: rgba(var(--error-rgb), 0.3);
}

.btn-remove-interval .feather {
  width: 16px;
  height: 16px;
}

/* Add interval button */
.btn-add-interval {
  margin-top: var(--space-2);
}

.btn-add-interval .feather {
  width: 16px;
  height: 16px;
}

/* ============================================
   FUNNELS OVERVIEW SECTION - DASHBOARD
   ============================================ */

.funnels-overview-section {
  margin-bottom: var(--element-gap);
}

.funnels-overview-section .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.funnels-overview-section .card-header-actions {
  display: flex;
  gap: var(--space-2);
}

/* Funnels Grid */
.funnels-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

/* Funnel Card */
.funnel-overview-card {
  position: relative;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: all 0.2s ease;
  overflow: hidden;
}

.funnel-overview-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  opacity: 0.6;
}

.funnel-overview-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.funnel-overview-card:hover::before {
  opacity: 1;
}

.funnel-overview-card.is-default::before {
  background: var(--gradient-accent);
  opacity: 1;
}

.funnel-overview-card.is-inactive {
  opacity: 0.6;
}

.funnel-overview-card.is-inactive::before {
  background: var(--text-muted);
  opacity: 0.5;
}

/* Card Header */
.funnel-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-3);
}

.funnel-card-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  color: var(--black);
}

.funnel-card-icon svg {
  width: 18px;
  height: 18px;
}

.funnel-card-badges {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.funnel-card-badges .badge-sm {
  font-size: 0.65rem;
  padding: 2px 6px;
}

/* Card Body */
.funnel-card-body {
  margin-bottom: var(--space-3);
}

.funnel-card-name {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0 0 var(--space-1) 0;
  line-height: 1.3;
}

.funnel-card-description {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin: 0 0 var(--space-2) 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.funnel-card-stats {
  display: flex;
  gap: var(--space-3);
}

.funnel-stat {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.funnel-stat svg {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

/* Card Stages Mini */
.funnel-card-stages {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

.funnel-stage-mini {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
}

.funnel-stage-mini .funnel-stage-number {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  color: var(--black);
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}

.funnel-stage-mini .funnel-stage-name {
  color: var(--text-secondary);
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.funnel-stage-mini.funnel-stage-more {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: var(--font-weight-semibold);
}

/* Empty State */
.funnels-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  text-align: center;
}

.funnels-empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.funnels-empty-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0 0 var(--space-2) 0;
}

.funnels-empty-text {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin: 0 0 var(--space-4) 0;
  max-width: 300px;
}

/* Error State */
.funnels-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  text-align: center;
}

.funnels-error-icon {
  width: 40px;
  height: 40px;
  color: var(--error);
  margin-bottom: var(--space-3);
}

.funnels-error-text {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin: 0 0 var(--space-3) 0;
}

/* Responsive */
@media (max-width: 768px) {
  .funnels-overview-grid {
    grid-template-columns: 1fr;
  }

  .funnel-stage-mini .funnel-stage-name {
    max-width: 80px;
  }
}

/* ============================================
   KANBAN FUNNEL SELECTOR
   ============================================ */

.kanban-section .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.funnel-selector-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.funnel-selector-label {
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

.funnel-selector-label svg {
  width: 16px;
  height: 16px;
}

.funnel-selector {
  background: transparent;
  border: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  cursor: pointer;
  min-width: 150px;
  padding: var(--space-1) var(--space-2);
}

.funnel-selector:focus {
  outline: none;
  box-shadow: none;
}

.funnel-selector option {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .kanban-section .card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .funnel-selector-wrapper {
    width: 100%;
  }

  .funnel-selector {
    flex: 1;
  }
}

/* ==========================================================================
   28. LEADS PAGE - PREMIUM STYLE
   ========================================================================== */

/* Filters Grid */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}

@media (max-width: 768px) {
  .filters-grid {
    grid-template-columns: 1fr;
  }
}

/* Lead Info Cell */
.lead-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.lead-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lead-avatar svg {
  width: 20px;
  height: 20px;
  color: var(--white);
}

.lead-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lead-name {
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-phone {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Tags Container */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  max-width: 200px;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

/* Last Message Preview */
.last-message-preview {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 250px;
}

.last-message-preview .msg-sender {
  font-size: 10px;
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.last-message-preview .msg-content {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Stage Badge */
.stage-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  border: 1px solid rgba(var(--primary-rgb), 0.3);
}

/* Badge Variants */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: var(--font-weight-medium);
}

.badge-success {
  background: rgba(var(--success-rgb), 0.15);
  color: var(--success);
  border: 1px solid rgba(var(--success-rgb), 0.3);
}

.badge-warning {
  background: rgba(var(--warning-rgb), 0.15);
  color: var(--warning);
  border: 1px solid rgba(var(--warning-rgb), 0.3);
}

.badge-danger {
  background: rgba(var(--danger-rgb), 0.15);
  color: var(--danger);
  border: 1px solid rgba(var(--danger-rgb), 0.3);
}

.badge-info {
  background: rgba(var(--info-rgb), 0.15);
  color: var(--info);
  border: 1px solid rgba(var(--info-rgb), 0.3);
}

.badge-secondary {
  background: rgba(var(--text-muted), 0.1);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.badge-primary {
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
  border: 1px solid rgba(var(--primary-rgb), 0.3);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
}

.pagination-info {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

/* Table Styling for Leads */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  background: var(--dark-4);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  border-bottom: 1px solid var(--border-subtle);
}

.table thead th:first-child {
  border-radius: var(--radius-md) 0 0 0;
}

.table thead th:last-child {
  border-radius: 0 var(--radius-md) 0 0;
}

.table tbody tr {
  transition: background-color var(--duration-fast) var(--ease);
}

.table tbody tr:hover {
  background: rgba(var(--primary-rgb), 0.05);
}

.table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

/* Table Responsive */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* History Messages in Modal */
.history-messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--space-2);
}

.history-message {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  max-width: 85%;
}

.history-message.message-user {
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1) 0%, rgba(var(--primary-rgb), 0.05) 100%);
  border: 1px solid rgba(var(--primary-rgb), 0.2);
  align-self: flex-start;
}

.history-message.message-assistant {
  background: linear-gradient(135deg, var(--dark-4) 0%, var(--dark-3) 100%);
  border: 1px solid var(--border-subtle);
  align-self: flex-end;
}

.history-message .message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.history-message .message-sender {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--primary);
}

.history-message.message-assistant .message-sender {
  color: var(--secondary);
}

.history-message .message-time {
  font-size: 10px;
  color: var(--text-muted);
}

.history-message .message-content {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  line-height: var(--line-height-relaxed);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==================== DADOS DO PACIENTE (CLÍNICAS) ==================== */
.patient-data-section {
  background: linear-gradient(135deg, var(--dark-3) 0%, var(--dark-4) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.patient-data-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.patient-data-header svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.patient-data-header span {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.patient-data-header .badge {
  margin-left: auto;
}

.patient-data-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.patient-data-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background: rgba(var(--primary-rgb), 0.03);
  transition: background 0.2s ease;
}

.patient-data-row:hover {
  background: rgba(var(--primary-rgb), 0.06);
}

.patient-data-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  min-width: 140px;
}

.patient-data-label svg {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.patient-data-value {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  font-weight: var(--font-weight-medium);
}

.patient-data-empty {
  text-align: center;
  padding: var(--space-4);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.patient-data-missing {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: rgba(var(--warning-rgb), 0.1);
  border: 1px solid rgba(var(--warning-rgb), 0.3);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  color: var(--warning);
}

.patient-data-missing svg {
  width: 14px;
  height: 14px;
}

/* Badge styles for patient data status */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-full);
}

.badge-success {
  background: rgba(var(--success-rgb), 0.15);
  color: var(--success);
  border: 1px solid rgba(var(--success-rgb), 0.3);
}

.badge-warning {
  background: rgba(var(--warning-rgb), 0.15);
  color: var(--warning);
  border: 1px solid rgba(var(--warning-rgb), 0.3);
}

.badge-info {
  background: rgba(var(--info-rgb), 0.15);
  color: var(--info);
  border: 1px solid rgba(var(--info-rgb), 0.3);
}

/* Stat Card Icon Variants */
.stat-icon-success {
  color: var(--success);
  background: rgba(var(--success-rgb), 0.1);
}

.stat-icon-warning {
  color: var(--warning);
  background: rgba(var(--warning-rgb), 0.1);
}

.stat-icon-info {
  color: var(--info);
  background: rgba(var(--info-rgb), 0.1);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10);
  text-align: center;
  color: var(--text-muted);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state h3 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: var(--font-size-sm);
  max-width: 300px;
}
