/**
 * AssistIA Negócios - styles.css
 * Folha de Estilo Principal com Tema Claro/Escuro (CSS Variables),
 * Glassmorphism, Micro-animações e Design Responsivo Premium.
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

/* --- DESIGN SYSTEM & TOKENS --- */
:root {
  /* Cores Comuns */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* Tema Claro (Padrão) */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-sidebar: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --border-color: #e2e8f0;
  --accent-primary: #4f6ef7;
  --accent-primary-hover: #3b5bdb;
  --accent-gradient: linear-gradient(135deg, #4f6ef7 0%, #7b5cf5 100%);
  --accent-light: rgba(79, 110, 247, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(226, 232, 240, 0.8);
}

[data-theme="dark"] {
  /* Tema Escuro */
  --bg-primary: #090d16;
  --bg-secondary: #111827;
  --bg-sidebar: #0b0f19;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --border-color: #1f2937;
  --accent-primary: #5c7cfa;
  --accent-primary-hover: #4f6ef7;
  --accent-gradient: linear-gradient(135deg, #5c7cfa 0%, #7b5cf5 100%);
  --accent-light: rgba(92, 124, 250, 0.12);
  --glass-bg: rgba(17, 24, 39, 0.7);
  --glass-border: rgba(31, 41, 55, 0.8);
}

/* --- RESETS E BÁSICOS --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--text-primary);
}

/* --- APP LAYOUT (SPA) --- */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
}

/* --- SIDEBAR --- */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  transition: all var(--transition-normal);
  z-index: 100;
}

.sidebar-logo {
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo h2 {
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}

.sidebar-logo span.subtitle {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #94a3b8;
  margin-top: 4px;
  font-weight: 700;
}

.sidebar-menu {
  flex: 1;
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
}

.menu-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.menu-item a:hover {
  background-color: rgba(255, 255, 255, 0.03);
  color: #ffffff;
}

.menu-item.active a {
  background: var(--accent-gradient);
  color: var(--sidebar-text-active);
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.sidebar-footer {
  padding: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- MAIN CONTENT & HEADER --- */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  height: 100vh;
  min-height: 0;
}

.main-header {
  height: 70px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 30px;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.menu-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.menu-toggle-btn:hover {
  background-color: var(--accent-light);
  color: var(--accent-primary);
}

/* Colapso suave da sidebar no PC */
.sidebar.collapsed {
  margin-left: -260px;
  opacity: 0;
  pointer-events: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* --- ENGINE SELECTOR (DATABASE) --- */
.engine-selector-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-primary);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  font-size: 12px;
}

.engine-selector-container select {
  background: none;
  border: none;
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

/* --- PLAN BADGES --- */
.plan-badge {
  padding: 5px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.plan-badge:hover {
  transform: translateY(-1px);
}

.badge-free {
  background-color: var(--border-color);
  color: var(--text-secondary);
}

.badge-pro {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.badge-enterprise {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

/* --- THEME TOGGLE --- */
.theme-toggle-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: background-color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-btn:hover {
  background-color: var(--border-color);
}

/* --- CONTENT AREA & SPA SCREENS --- */
.content-viewport {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  min-height: 0;
}

.app-screen {
  display: none;
  width: 100%;
}

.app-screen.active {
  display: block;
}

/* --- GERAIS DE TEXTO & BOTÕES --- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 30px;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--border-color);
  transform: translateY(-1px);
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background-color: #dc2626;
  transform: translateY(-1px);
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.w-full {
  width: 100%;
}

.text-center { text-align: center; }
.text-right { text-align: right; }

/* --- CONTROLES DE FORMULÁRIO --- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

textarea.form-input {
  resize: vertical;
}

/* --- PANELS & CARDS (GLASSMORPHISM & BENTO GRID) --- */
.detail-panel {
  background-color: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
  transition: border-color var(--transition-normal);
}

.detail-panel h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- STATS GRID (BENTO GRID WITH HIERARCHY) --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.stats-card-hero {
  grid-column: span 12;
}

@media (min-width: 1100px) {
  .stats-card-hero { grid-column: span 6; }
  .stats-card-subhero { grid-column: span 6; }
  .stats-card-normal { grid-column: span 4; }
}

@media (min-width: 768px) and (max-width: 1099px) {
  .stats-card-hero { grid-column: span 12; }
  .stats-card-subhero { grid-column: span 6; }
  .stats-card-normal { grid-column: span 6; }
}

@media (max-width: 767px) {
  .stats-card-hero, .stats-card-subhero, .stats-card-normal { grid-column: span 12; }
}

.stats-card {
  background-color: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.stats-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Specific Card Accent Styles */
.stats-card.card-receita {
  border-left: 4px solid var(--success);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, var(--glass-bg) 100%);
  position: relative;
  overflow: hidden;
}

.stats-card.card-receita::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px; width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.18) 0%, transparent 70%);
  pointer-events: none;
}

.stats-card.card-orcamentos {
  border-left: 4px solid #8b5cf6;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.06) 0%, var(--glass-bg) 100%);
}

.stats-card.card-contratos {
  border-left: 4px solid #ec4899;
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.06) 0%, var(--glass-bg) 100%);
}

.stats-card.card-cobrancas {
  border-left: 4px solid var(--warning);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.06) 0%, var(--glass-bg) 100%);
}

.stats-card.card-clientes {
  border-left: 4px solid #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06) 0%, var(--glass-bg) 100%);
}

.stats-card.card-agenda {
  border-left: 4px solid #06b6d4;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.06) 0%, var(--glass-bg) 100%);
}

.stats-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
}

.stats-card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.stats-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background-color: var(--accent-light);
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.stats-card-value {
  font-family: 'Outfit', sans-serif;
  font-size: 30px;
  font-weight: 800;
  margin: 12px 0 6px 0;
  letter-spacing: -0.5px;
}

.stats-card-hero .stats-card-value {
  font-size: 36px;
}

.stats-card-subtext {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stats-card-footer {
  font-size: 11px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.trend {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.trend.positive { color: var(--success); }
.trend.negative { color: var(--danger); }

.highlight-card {
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
}

.highlight-card .stats-card-footer,
.highlight-card .stats-card-title {
  color: rgba(255, 255, 255, 0.85);
}

/* --- GREETING BANNER COMERCIAL --- */
.greeting-banner {
  background: linear-gradient(135deg, rgba(79, 110, 247, 0.08) 0%, rgba(123, 92, 245, 0.04) 100%);
  border: 1px solid var(--glass-border);
  border-left: 4px solid var(--accent-primary);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.greeting-text h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.greeting-text p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

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

.greeting-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.greeting-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* --- SMART INSIGHT CHIPS --- */
.smart-insights-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 25px;
}

.smart-insight-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  background-color: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.smart-insight-chip:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.smart-insight-chip.chip-warning {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.08);
  color: var(--text-primary);
}

.smart-insight-chip.chip-info {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.08);
  color: var(--text-primary);
}

.smart-insight-chip.chip-purple {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.08);
  color: var(--text-primary);
}

.smart-insight-chip.chip-success {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.08);
  color: var(--text-primary);
}

/* --- RECENT ACTIVITIES FEED --- */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.activity-item:hover {
  transform: translateX(4px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.activity-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.activity-content {
  flex: 1;
}

.activity-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.activity-time {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* --- EMPTY STATE COMPONENTS --- */
.empty-state-card {
  padding: 45px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--glass-bg);
  border: 1.5px dashed var(--border-color);
  border-radius: 16px;
  margin: 10px 0;
  transition: border-color var(--transition-normal);
}

.empty-state-card:hover {
  border-color: var(--accent-primary);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--accent-light);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.empty-state-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state-desc {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 380px;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* --- SKELETON LOADING --- */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-box {
  background: linear-gradient(90deg, var(--border-color) 25%, var(--accent-light) 50%, var(--border-color) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite ease-in-out;
  border-radius: 6px;
  display: inline-block;
}

/* --- TABELAS --- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}

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

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

.table-row-animate {
  transition: background-color var(--transition-fast);
}

.table-row-animate:hover {
  background-color: rgba(99, 102, 241, 0.02);
}

/* --- STATUS BADGES --- */
.status-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-paid {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.status-pending {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.status-overdue {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* --- DASHBOARD DETAILS --- */
.dashboard-details-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 25px;
}

/* --- CHART MOCKS (CSS BARS) --- */
.chart-container {
  padding: 10px 0;
}

.chart-bar-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.bar-track {
  width: 100%;
  height: 10px;
  background-color: var(--border-color);
  border-radius: 5px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 1s cubic-bezier(0.1, 1, 0.1, 1);
}

.bar-value {
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  margin-top: 2px;
}

/* --- AI SUGGESTIONS --- */
.ai-suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.suggestion-item {
  display: flex;
  gap: 15px;
  align-items: center;
  background-color: var(--accent-light);
  border-left: 4px solid var(--accent-primary);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.suggestion-item:hover {
  transform: translateX(3px);
  background-color: rgba(99, 102, 241, 0.15);
}

.suggestion-avatar {
  font-size: 24px;
}

.suggestion-content strong {
  font-size: 13px;
  color: var(--text-primary);
  display: block;
}

.suggestion-content p {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* --- ORÇAMENTOS E DOCUMENT PREVIEW --- */
.history-item {
  transition: background-color var(--transition-fast);
}

.history-item:hover {
  background-color: var(--accent-light);
}

.preview-document-body h1 {
  font-size: 20px;
  color: #1e3a8a;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 6px;
  margin-top: 25px;
  margin-bottom: 12px;
}

.preview-document-body h2 {
  font-size: 16px;
  color: #2563eb;
  margin-top: 18px;
  margin-bottom: 8px;
}

.preview-document-body h3 {
  font-size: 14px;
  color: #1f2937;
  margin-top: 12px;
  margin-bottom: 6px;
}

.preview-document-body, .contract-body-view {
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  word-break: break-word !important;
  max-width: 100% !important;
}

.preview-document-body p, 
.contract-body-view p,
.preview-document-body li,
.contract-body-view li,
.preview-document-body h3,
.contract-body-view h3,
.custom-clause-item,
.budget-section-item {
  margin-bottom: 12px;
  line-height: 1.65;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  word-break: break-word !important;
  text-align: justify;
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.preview-document-body h1, 
.preview-document-body h2, 
.preview-document-body h3,
.contract-body-view h1,
.contract-body-view h2,
.contract-body-view h3 {
  page-break-after: avoid !important;
  break-after: avoid !important;
}

.preview-document-body li, .contract-body-view li {
  margin-left: 20px;
  margin-bottom: 4px;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  word-break: break-word !important;
}

/* --- MODAL DIALOGS --- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 90vh;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 15px 24px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-primary);
}

/* --- PRICING GRID --- */
.pricing-modal-content {
  max-width: 900px;
  width: 90%;
}

.pricing-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 30px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  align-items: stretch;
}

.pricing-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.pricing-card.recommended {
  border: 2px solid var(--accent-primary);
}

.recommend-tag {
  position: absolute;
  top: -12px;
  background: var(--accent-gradient);
  color: #ffffff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.current-plan-label {
  position: absolute;
  bottom: 12px;
  font-size: 11px;
  color: var(--success);
  font-weight: bold;
}

.pricing-card h3 {
  font-size: 20px;
  margin-bottom: 15px;
}

.price {
  font-family: 'Outfit', sans-serif;
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}

.price-cents {
  font-size: 20px;
  vertical-align: super;
}

.price-period {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  margin-bottom: 25px;
}

.plan-features {
  list-style: none;
  width: 100%;
  margin-bottom: 30px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-features li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-check { color: var(--success); font-weight: bold; }
.icon-close { color: var(--danger); font-weight: bold; }

/* --- COBRANÇAS RADIO CARDS --- */
.radio-card input {
  display: none;
}

.radio-card:has(input:checked) {
  border-color: var(--accent-primary) !important;
  background-color: var(--accent-light);
  color: var(--accent-primary);
}

/* --- CHAT ASSISTENTE STYLES --- */
.chat-messages-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-secondary);
}

.chat-bubble-assistant {
  border-bottom-left-radius: 2px !important;
}

.chat-bubble-user {
  border-bottom-right-radius: 2px !important;
}

.chat-text-content pre {
  background-color: #272822;
  color: #f8f8f2;
  padding: 10px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 11px;
  overflow-x: auto;
  margin-top: 8px;
}

/* Typing Indicator Animation */
.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--border-color);
  border-radius: 12px;
}

.typing-dots .dot {
  width: 6px;
  height: 6px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dots .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* --- ANIMAÇÕES GERAIS --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn var(--transition-normal) forwards;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-slide-up {
  animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Loading spinner */
.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* --- RESPONSO --- */
@media (max-width: 1024px) {
  .dashboard-details-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .menu-toggle-btn {
    display: inline-flex;
  }

  .page-header {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .page-header button {
    width: 100%;
    justify-content: center;
  }

  .content-viewport {
    padding: 20px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .pricing-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  /* Conversão Responsiva de Tabelas em Cartões no Celular */
  .table-responsive {
    overflow-x: visible;
  }

  .data-table, .data-table tbody, .data-table tr, .data-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  .data-table th {
    display: none;
  }

  .data-table tr {
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 4px;
    border-bottom: 1px dashed var(--border-color);
    text-align: right;
    font-size: 13px;
  }

  .data-table td:last-child {
    border-bottom: none;
    justify-content: flex-end;
  }

  .data-table td[data-label]::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    text-align: left;
    margin-right: 12px;
  }

  /* Garantia de Áreas de Toque confortáveis no Celular (mínimo 44x44px) */
  .btn, .form-input, select, button, input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
    min-height: 44px;
  }

  .btn-sm {
    min-height: 40px;
    padding: 8px 14px;
  }

  /* Ajuste para telas estreitas (320px a 414px) */
  .content-viewport {
    padding: 15px 10px;
  }

  .detail-panel {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .main-header {
    padding: 0 12px;
  }
  
  .header-right {
    gap: 8px;
  }

  .plan-badge {
    padding: 6px 10px;
    font-size: 10px;
  }

  /* Botões empilhados em modais de celular */
  .modal-footer, .form-row {
    flex-direction: column !important;
    gap: 10px !important;
  }

  .modal-footer button, .form-row .form-group {
    width: 100% !important;
  }
}

/* Global Overlay Loader */
.global-loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.global-loader-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.global-loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--accent-primary, #6366f1);
  animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.global-loader-text {
  margin-top: 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  letter-spacing: 0.5px;
}

/* --- ADICIONADO PARA FINANCEIRO E AGENDA --- */
@keyframes barGrow {
  from { height: 0; }
}

.chart-bar-animation {
  animation: barGrow 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes rowFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.table-row-animate {
  animation: rowFadeIn 0.35s ease forwards;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(5px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--danger);
}
