/*
 * Sistema de Controle Financeiro Pessoal
 * Design System - Premium & Modern
 * Versão: 2.3 (Base Preservada + Mobile Fix + Compact Desktop)
 */

/* ============================================================================
   IMPORTS & FONTS
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

/* ============================================================================
   CSS VARIABLES - Color Palette & Tokens
   ========================================================================= */
:root {
  /* Slate Scale (Gray) */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --gray-950: #020617;

  /* ============================================================================
     PREMIUM DESIGN SYSTEM - NoAzul v3.0
     ========================================================================= */

  /* Primary Brand Colors - Vivid Blue & Deep Ocean */
  --primary: #0ea5e9;
  /* Sky 500 */
  --primary-hover: #0284c7;
  /* Sky 600 */
  --primary-active: #0369a1;
  /* Sky 700 */
  --primary-light: #e0f2fe;
  /* Sky 100 */
  --primary-soft: rgba(14, 165, 233, 0.12);
  --primary-glow: rgba(14, 165, 233, 0.4);

  /* Secondary Colors - Cyan/Teal */
  --secondary: #06b6d4;
  --secondary-soft: rgba(6, 182, 212, 0.1);

  /* Semantic Colors - High Contrast & Vibrancy */
  --success: #10b981;
  /* Emerald 500 */
  --success-hover: #059669;
  --success-soft: rgba(16, 185, 129, 0.12);
  --success-glow: rgba(16, 185, 129, 0.4);

  --danger: #ef4444;
  /* Red 500 */
  --danger-hover: #dc2626;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --danger-glow: rgba(239, 68, 68, 0.4);

  --warning: #f59e0b;
  /* Amber 500 */
  --warning-hover: #d97706;
  --warning-soft: rgba(245, 158, 11, 0.12);

  --info: #3b82f6;
  /* Blue 500 */
  --info-soft: rgba(59, 130, 246, 0.12);

  /* Surfaces & Backgrounds (Light Mode) */
  --background: #f8fafc;
  /* Slate 50 - Softer than pure white/blue */
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  /* Slate 100 */
  --surface-active: #e2e8f0;
  /* Slate 200 */
  --border: #e2e8f0;
  /* Slate 200 */
  --border-hover: #cbd5e1;
  /* Slate 300 */

  /* White Colors */
  --white: #ffffff;
  --white-hover: #f1f5f9;

  /* Text Colors (Light Mode) */
  --text: #0f172a;
  /* Slate 900 - Deepest Blue/Black */
  --text-secondary: #475569;
  /* Slate 600 */
  --text-muted: #94a3b8;
  /* Slate 400 */
  --text-on-primary: #ffffff;

  /* Premium Gradients */
  --gradient-primary: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  /* Vivid Sky to Blue */
  --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --gradient-dark: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  --gradient-glass: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.6) 100%);

  /* Glassmorphism & Blurs */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --blur-sm: 4px;
  --blur-md: 8px;
  --blur-lg: 16px;

  /* Shadows - Layered & Smooth */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 15px rgba(14, 165, 233, 0.3);
  /* Primary Glow */

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
  --radius: var(--radius-lg);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
  /* Bouncy feel */
}

/* ============================================================================
   DARK MODE THEME - Deep Space & Neon
   ========================================================================= */
[data-theme="dark"] {
  /* Surfaces & Backgrounds (Dark Mode) */
  --background: #020617;
  /* Slate 950 - Almost Black */
  --surface: #0f172a;
  /* Slate 900 */
  --surface-hover: #1e293b;
  /* Slate 800 */
  --surface-active: #334155;
  /* Slate 700 */

  --border: #1e293b;
  /* Slate 800 */
  --border-hover: #334155;
  /* Slate 700 */

  /* Chat Specific */
  --chat-bg-dark: #020617;
  --chat-user-msg-bg: #00875a;
  /* Richer Green */
  --chat-user-msg-text: #f0f9ff;
  --chat-bot-msg-bg: #1e293b;
  --chat-bot-msg-text: #f8fafc;

  /* Text Colors (Dark Mode) */
  --text: #f8fafc;
  /* Slate 50 */
  --text-secondary: #cbd5e1;
  /* Slate 300 */
  --text-muted: #64748b;
  /* Slate 500 */
  --text-on-primary: #ffffff;

  /* Gradients & Glows (Dark Mode) */
  --primary-soft: rgba(14, 165, 233, 0.2);
  --primary-glow: rgba(14, 165, 233, 0.5);

  --success-soft: rgba(16, 185, 129, 0.2);
  --success-glow: rgba(16, 185, 129, 0.5);

  --danger-soft: rgba(239, 68, 68, 0.2);
  --danger-glow: rgba(239, 68, 68, 0.5);

  --warning-soft: rgba(245, 158, 11, 0.2);
  --info-soft: rgba(59, 130, 246, 0.2);

  /* Glassmorphism Dark */
  --glass-bg: rgba(15, 23, 42, 0.7);
  --glass-border: rgba(30, 41, 59, 0.6);

  /* Shadows (Dark Mode) - Focus on Glows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-colored: 0 0 20px rgba(14, 165, 233, 0.2);
  /* Ambient light */
}

/* ============================================================================
   RESET & BASE STYLES
   ========================================================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9375rem;
  /* Ajustado para 15px para melhor densidade */
  line-height: 1.5;
  color: var(--text);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

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

/* ============================================================================
   TYPOGRAPHY
   ========================================================================= */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--gray-900);
  margin-bottom: var(--space-4);
  letter-spacing: -0.025em;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1.125rem;
}

h6 {
  font-size: 1rem;
}

p {
  margin-bottom: var(--space-4);
}

a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-dark);
}

.font-light {
  font-weight: 300;
}

.font-normal {
  font-weight: 400;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.text-xs {
  font-size: 0.75rem;
}

.text-sm {
  font-size: 0.875rem;
}

.text-base {
  font-size: 1rem;
}

.text-lg {
  font-size: 1.125rem;
}

.text-xl {
  font-size: 1.25rem;
}

.text-2xl {
  font-size: 1.5rem;
}

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

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

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

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

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

.text-left {
  text-align: left;
}

/* ============================================================================
   SPACING & UTILITY CLASSES (Restored from Original)
   ========================================================================= */
.mb-0 {
  margin-bottom: 0;
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-6 {
  margin-bottom: var(--space-6);
}

.mb-8 {
  margin-bottom: var(--space-8);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-6 {
  margin-top: var(--space-6);
}

.mt-8 {
  margin-top: var(--space-8);
}

.p-0 {
  padding: 0;
}

.p-2 {
  padding: var(--space-2);
}

.p-4 {
  padding: var(--space-4);
}

.p-6 {
  padding: var(--space-6);
}

.px-4 {
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.py-4 {
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

.m-0 {
  margin: 0;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.fixed {
  position: fixed;
}

.sticky {
  position: sticky;
}

.hidden {
  display: none !important;
}

.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

.d-flex {
  display: flex;
}

/* Flexbox Utilities */
.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.flex-col {
  flex-direction: column;
}

.flex-row {
  flex-direction: row;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-start {
  align-items: flex-start;
}

.items-center {
  align-items: center;
}

.items-end {
  align-items: flex-end;
}

.items-stretch {
  align-items: stretch;
}

.justify-start {
  justify-content: flex-start;
}

.justify-center {
  justify-content: center;
}

.justify-end {
  justify-content: flex-end;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.gap-1 {
  gap: var(--space-1);
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

.gap-8 {
  gap: var(--space-8);
}

/* Grid Utilities */
.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-auto-fill {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* 4 column grid - always 4 on desktop, 2x2 on mobile */
.stats-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

@media (max-width: 1024px) {
  .stats-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

/* ============================================================================
   COMPONENT: Container
   ========================================================================= */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--space-6);
  }
}

/* ============================================================================
   COMPONENT: Buttons
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.5rem 1rem;
  /* Compactado */
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  user-select: none;
  line-height: 1.5;
}

.btn:active {
  transform: translateY(1px);
}

/* Variants */
.btn-primary {
  background: var(--gradient-primary);
  color: var(--white);
  box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.3), 0 2px 4px -1px rgba(14, 165, 233, 0.1);
  border: none;
}

.btn-primary:hover {
  filter: brightness(110%);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(14, 165, 233, 0.4), 0 4px 6px -2px rgba(14, 165, 233, 0.2);
}

.btn-success {
  background: var(--gradient-success);
  color: var(--white);
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3), 0 2px 4px -1px rgba(16, 185, 129, 0.1);
  border: none;
}

.btn-success:hover {
  filter: brightness(110%);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4), 0 4px 6px -2px rgba(16, 185, 129, 0.2);
}

.btn-danger {
  background: var(--gradient-danger);
  color: var(--white);
  box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3), 0 2px 4px -1px rgba(239, 68, 68, 0.1);
  border: none;
}

.btn-danger:hover {
  filter: brightness(110%);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.4), 0 4px 6px -2px rgba(239, 68, 68, 0.2);
}

.btn-outline {
  background: var(--white);
  border-color: var(--gray-200);
  color: var(--gray-700);
  box-shadow: none;
}

.btn-outline:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-900);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-md);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: 1.125rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  padding: var(--space-3);
  aspect-ratio: 1;
}

.btn-icon-rounded {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-500);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.btn-icon-rounded:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn-icon-rounded.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

/* ============================================================================
   COMPONENT: Cards
   ========================================================================= */
.card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
  overflow: hidden;
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-soft);
  transform: translateY(-2px);
}

.card-header {
  padding: var(--space-4) var(--space-6);
  /* Reduzido padding vertical */
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}

.card-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-800);
}

.card-body {
  padding: var(--space-5);
  margin-bottom: 0;
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
}

/* Grid for Stats (Restored & Improved) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

/* Stat Cards */
/* Stat Cards - Premium 3D Effect */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-bounce);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-soft);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

.stat-card.success::before {
  background: var(--gradient-success);
}

.stat-card.danger::before {
  background: var(--gradient-danger);
}

.stat-card.warning::before {
  background: var(--gradient-warm);
}

.stat-card-icon {
  width: 44px;
  /* Icone menor */
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: var(--space-3);
  background: var(--gray-50);
  color: var(--gray-600);
}

.stat-card.success .stat-card-icon {
  background: var(--success-soft);
  color: var(--success);
}

.stat-card.danger .stat-card-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.stat-card.warning .stat-card-icon {
  background: var(--warning-soft);
  color: var(--warning);
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.stat-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
  letter-spacing: -0.025em;
}

.stat-change {
  font-size: 0.875rem;
  margin-top: var(--space-2);
  color: var(--text-light);
}

/* ============================================================================
   COMPONENT: Forms
   ========================================================================= */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-700);
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.8rem;
  /* Input mais compacto */
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--gray-900);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
  background: var(--surface);
}

.form-control::placeholder {
  color: var(--gray-400);
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-help {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-error {
  display: block;
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: var(--space-1);
}

/* ============================================================================
   COMPONENT: Tables (Compact & Modern)
   ========================================================================= */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  background: var(--white);
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--gray-200);
  /* Borda sutil */
}

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

.table th {
  background: var(--gray-50);
  color: var(--gray-600);
  font-weight: 600;
  text-align: left;
  padding: 0.6rem 0.75rem;
  /* Mais compacto */
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--gray-200);
}

.table td {
  padding: 0.6rem 0.75rem;
  /* Mais compacto */
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-500);
  vertical-align: middle;
  font-size: 0.875rem;
}

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

.table tbody tr:hover {
  background: var(--gray-50);
}

/* Table Column Widths */
.table thead tr th:nth-child(1) {
  width: 100px;
}

/* Data */
.table thead tr th:nth-child(2) {
  width: 140px;
}

/* Categoria */
.table thead tr th:nth-child(3) {
  width: auto;
  min-width: 180px;
}

/* Descrição */
.table thead tr th:nth-child(4) {
  width: 110px;
}

/* Valor */
.table thead tr th:nth-child(5) {
  width: 120px;
}

/* Responsável */
.table thead tr th:nth-child(6) {
  width: 100px;
}

/* Pagamento */
.table thead tr th:nth-child(7) {
  width: 90px;
}

/* Status */
.table thead tr th:nth-child(8) {
  width: 90px;
}

/* Ações */

/* Category column - ellipsis */
.table td:nth-child(2) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* Description - allow wrap */
.table td:nth-child(3) {
  white-space: normal;
  word-wrap: break-word;
  max-width: 300px;
  /* Limite para não estourar */
}

/* Value - align right */
.table td:nth-child(4) {
  text-align: right;
  font-weight: 600;
  font-family: 'Inter', monospace;
  color: var(--gray-900);
}

.table th:nth-child(4) {
  text-align: right;
}

/* Header Valor align right */

/* Action buttons container */
.action-buttons {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  justify-content: center;
}

/* ============================================================================
   COMPONENT: Badges
   ========================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-soft);
  color: var(--success-dark);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger-dark);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning-dark);
}

.badge-info {
  background: var(--info-soft);
  color: var(--info-dark);
}

.badge-primary {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.badge-status-paid,
.badge-status-received,
.badge-status-pending,
.badge-status-overdue {
  gap: 0.35rem;
  padding: 0.32rem 0.72rem;
  border: 1px solid transparent;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.badge-status-paid {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
  border-color: rgba(34, 197, 94, 0.24);
}

.badge-status-received {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.24);
}

.badge-status-pending {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.24);
}

.badge-status-overdue {
  background: rgba(239, 68, 68, 0.14);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.24);
}

.badge-status-paid i,
.badge-status-received i,
.badge-status-pending i,
.badge-status-overdue i {
  font-size: 0.72rem;
}

/* ============================================================================
   COMPONENT: Navigation (Desktop)
   ========================================================================= */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
}

.navbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  font-size: 1.25rem;
  font-weight: 800;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.navbar-link {
  color: var(--gray-600);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-link:hover {
  color: var(--primary);
  background: var(--gray-50);
}

.navbar-link.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.navbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 700;
  font-size: 0.8rem;
}

/* ============================================================================
   COMPONENT: Navigation (Mobile)
   ========================================================================= */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-lg));
  -webkit-backdrop-filter: blur(var(--blur-lg));
  border-top: 1px solid var(--gray-200);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 4000;
  justify-content: space-around;
  height: calc(60px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  font-size: 0.7rem;
  font-weight: 500;
  text-decoration: none;
  gap: 4px;
  padding: 8px 0;
  position: relative;
}

.bottom-nav-item i {
  font-size: 1.25rem;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: var(--radius-md);
  font-weight: 600;
}

.bottom-nav-item.active i {
  transform: translateY(-2px);
}

.bottom-nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  width: 50%;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
}

/* ============================================================================
   COMPONENT: Modals
   ========================================================================= */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5000;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.modal.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-2xl);
  transform: scale(0.95);
  transition: transform 0.2s ease-in-out;
  display: flex;
  flex-direction: column;
}

.modal.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--gray-100);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--gray-400);
  cursor: pointer;
  transition: color var(--transition-fast);
  padding: var(--space-2);
  display: flex;
}

.modal-close:hover {
  color: var(--gray-600);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

/* ============================================================================
   COMPONENT: Notifications (Toasts)
   ========================================================================= */
#notification-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 400px;
  pointer-events: none;
}

.notification {
  pointer-events: auto;
  background: var(--white);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 500;
  animation: slideInRight 0.3s ease;
  border-left: 4px solid var(--primary);
  min-width: 300px;
}

.notification i {
  font-size: 1.25rem;
}

.notification.success {
  border-left-color: var(--success);
}

.notification.success i {
  color: var(--success);
}

.notification.error {
  border-left-color: var(--danger);
}

.notification.error i {
  color: var(--danger);
}

.notification.warning {
  border-left-color: var(--warning);
}

.notification.warning i {
  color: var(--warning);
}

/* ============================================================================
   COMPONENT: Alerts
   ========================================================================= */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.alert-success {
  background: var(--success-soft);
  color: var(--success-dark);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger {
  background: var(--danger-soft);
  color: var(--danger-dark);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
  background: var(--warning-soft);
  color: var(--warning-dark);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ============================================================================
   AUTH PAGES
   ========================================================================= */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background);
  padding: var(--space-6);
  background-image: radial-gradient(var(--primary-soft) 1px, transparent 1px);
  background-size: 24px 24px;
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  max-width: 450px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
}

.logo-icon {
  width: clamp(28px, 4.5vw, 38px);
  height: clamp(28px, 4.5vw, 38px);
  background: var(--gradient-primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: clamp(0.9rem, 1.8vw, 1.2rem);
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.auth-logo h1 {
  font-size: 1.75rem;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: var(--space-2);
}

/* ============================================================================
   UTILITIES & ANIMATIONS
   ========================================================================= */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================================
   NAVIGATION (Navbar)
   ========================================================================= */
.navbar {
  max-width: 100vw;
  overflow-x: hidden;
}

.navbar .container {
  max-width: 100%;
  overflow-x: hidden;
}

.desktop-nav {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.nav-link {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Intermediate breakpoint for medium screens */
@media (max-width: 1200px) {
  .desktop-nav {
    gap: var(--space-2);
  }

  .nav-link {
    padding: var(--space-2) var(--space-2);
    font-size: 0.875rem;
  }
}

@media (max-width: 1024px) {
  .desktop-nav {
    gap: var(--space-2);
  }

  .nav-link {
    padding: var(--space-2) var(--space-2);
    font-size: 0.8125rem;
  }

  .navbar .container {
    padding: 0 var(--space-3);
  }
}

/* ============================================================================
   COMPONENT: Custom Chart Legend Layout
   ========================================================================= */
.chart-body-flex {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: 320px;
  padding: var(--space-5);
  overflow: hidden;
}

.chart-wrapper {
  flex: 1;
  height: 100%;
  min-width: 0;
  position: relative;
}

.chart-custom-legend {
  flex: 0 0 45%;
  /* Fixed width percentage for legend */
  max-width: 250px;
  max-height: 100%;
  overflow: hidden;
  /* Container fixed, inner list scrolls */
  position: relative;
  display: flex;
  flex-direction: column;
}

.legend-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  /* Reduced gap */
  padding-bottom: 40px;
  /* Space for arrow */
}

/* Scrollbar for legend */
/* Scrollbar for legend */
/* Scrollbar for legend */
.legend-list::-webkit-scrollbar {
  width: 6px;
}

.legend-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

.legend-list::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: 4px;
}

.legend-list::-webkit-scrollbar-thumb:hover {
  background: var(--gray-500);
}

/* Scroll Indicator Arrow */
.legend-scroll-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to bottom, transparent 0%, var(--surface) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 10;
}

.legend-scroll-indicator.visible {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

.legend-scroll-indicator i {
  animation: bounce 2s infinite;
  font-size: 1rem;
  background: var(--surface);
  border-radius: 50%;
  padding: 6px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

@keyframes bounce {

  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-5px);
  }

  60% {
    transform: translateY(-3px);
  }
}

/* Legend Items */
.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-transform: uppercase;
  /* Requested: Uppercase */
  font-weight: 600;
  letter-spacing: 0.05em;
}

.legend-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.legend-item.hidden {
  text-decoration: line-through;
  opacity: 0.5;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.legend-value {
  font-weight: 700;
  color: var(--text);
  margin-left: auto;
}

/* Dark Mode Contrast Fix */
[data-theme="dark"] .legend-item {
  color: var(--gray-400);
}

[data-theme="dark"] .legend-item:hover {
  color: var(--white);
  background: var(--gray-800);
}

[data-theme="dark"] .legend-value {
  color: var(--gray-200);
  /* Brighter for contrast */
}

/* Mobile Adjustments */
@media (max-width: 480px) {
  .chart-body-flex {
    flex-direction: column;
    height: auto;
    max-height: 500px;
  }

  .chart-wrapper {
    height: 220px;
    width: 100%;
    flex: none;
  }

  .chart-custom-legend {
    flex: none;
    width: 100%;
    max-width: 100%;
    max-height: 180px;
  }

  /* Grid layout specifically for the inner list on mobile */
  .legend-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-1) var(--space-3);
  }
}

/* ============================================================================
   RESPONSIVE DESIGN (Mobile adjustments)
   ========================================================================= */
@media (max-width: 768px) {
  .desktop-nav {
    display: none;
  }

  .bottom-nav {
    display: flex;
  }

  body {
    padding-bottom: 80px;
  }

  .container {
    padding: 0 var(--space-4);
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  /* Ajuste Page Header Mobile */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
  }

  .page-header>div {
    width: 100%;
  }

  .header-controls {
    flex-direction: column;
    width: 100%;
    gap: var(--space-3);
  }

  .header-controls .btn,
  .header-controls .form-control,
  .header-controls input {
    width: 100% !important;
    margin: 0 !important;
  }

  /* --- MOBILE TABLE CARD VIEW --- */
  .table-container {
    box-shadow: none;
    border: none;
    background: transparent;
  }

  .table thead {
    display: none;
  }

  /* Esconde cabeçalho da tabela */

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    background: var(--white);
    margin-bottom: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
    position: relative;
  }

  .table td {
    padding: 0.5rem 0;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--gray-50);
    min-height: 30px;
  }

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

  /* Labels Automáticos */
  .table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    text-align: left;
    margin-right: 1rem;
    flex-shrink: 0;
  }

  /* --- AJUSTES ESPECÍFICOS (Considerando Checkbox na Coluna 1) --- */

  /* Coluna 1: Checkbox (Opcional: Ocultar no mobile se não usar ações em massa) */
  .table td:nth-child(1) {
    display: none;
    /* Oculta checkbox no card para limpar visual */
  }

  /* Coluna 4: Descrição (Ajustada para índice 4 devido ao checkbox) */
  .table td[data-label="Descrição"] {
    display: block;
    text-align: left;
    height: auto;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    white-space: normal;
  }

  .table td[data-label="Descrição"]::before {
    display: block;
    margin-bottom: 0.25rem;
  }

  /* Coluna 5: Valor (Destaque) */
  .table td[data-label="Valor"] {
    font-size: 1.25rem;
    font-weight: 700;
    justify-content: flex-end;
    border-bottom: none;
    /* Remove borda para agrupar visualmente */
  }

  .table td[data-label="Valor"]::before {
    display: none;
  }

  /* Coluna Ações: Ajustes para última coluna */
  .table td:last-child {
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
    justify-content: flex-end;
    gap: 0.5rem;
    width: 100%;
  }

  /* Remove o label "UNDEFINED" ou "AÇÕES" da coluna de botões para limpar o visual */
  .table td:last-child::before {
    display: none;
  }

  .action-buttons {
    width: 100%;
    justify-content: flex-end;
    gap: 0.5rem;
  }

  .action-buttons .btn {
    flex: 0 0 auto;
    justify-content: center;
    width: auto !important;
  }

  /* FAB Mobile */
  .fab {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 3000;
  }
}

/* ============================================================================
   COMPONENT: Page Header & Responsive Controls (Mobile Fix)
   ========================================================================= */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
  }

  .page-header>div {
    width: 100%;
  }

  /* Controles (Inputs/Botões) ocupam 100% no mobile para toque fácil */
  .header-controls {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: var(--space-3);
  }

  .header-controls .btn,
  .header-controls .form-control,
  .header-controls input {
    width: 100% !important;
    margin: 0 !important;
  }

  /* Ajuste para Categorias (botão solto) */
  .page-header .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Correção para Badges Padrão (Cinza) */
.badge-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}

/* Garante alinhamento vertical perfeito na tabela */
.table td {
  vertical-align: middle;
}

/* ============================================================================
   STICKY FOOTER - Mantém footer no bottom mesmo com pouco conteúdo
   ========================================================================= */
.main-content {
  flex: 1 0 auto;
}

/* Mobile: Add top padding for better spacing below navbar */
@media (max-width: 768px) {
  .main-content {
    padding-top: var(--space-5);
  }
}

.footer {
  flex-shrink: 0;
  margin-top: auto !important;
}

/* Wrapper para páginas que usam o layout padrão */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-wrapper>.footer {
  margin-top: auto;
}

/* ============================================================================
   DASHBOARD TIPS ROW - 3 COLUMN LAYOUT
   ========================================================================= */
.dashboard-tips-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

/* Desktop: 3 cards side by side */
@media (min-width: 768px) {
  .dashboard-tips-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Ensure cards have consistent height */
.dashboard-tips-row .ai-tip-container {
  height: 100%;
}

.dashboard-tips-row .ai-tip-card {
  height: 100%;
  min-height: 120px;
  display: flex;
  align-items: center;
  /* gap: var(--space-1); */
}

/* ============================================================================
   FLOATING PENDING INDICATOR
   ========================================================================= */
.ai-pending-indicator {
  position: fixed;
  bottom: 100px;
  right: 30px;
  z-index: 9998;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
  animation: pendingPulse 2s infinite;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
}

.ai-pending-indicator.show {
  display: flex;
}

.ai-pending-indicator:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(245, 158, 11, 0.6);
}

@keyframes pendingPulse {

  0%,
  100% {
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
    transform: scale(1);
  }

  50% {
    box-shadow: 0 6px 30px rgba(245, 158, 11, 0.7);
    transform: scale(1.05);
  }
}

/* Mobile: adjust position */
@media (max-width: 768px) {
  .ai-pending-indicator {
    bottom: 90px;
    right: 20px;
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
  }
}

/* ============================================================================
   AI ASSISTANT WIDGET (Whatsapp Style)
   ========================================================================= */
#ai-assistant {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 11000;
  font-family: 'Inter', sans-serif;
}

.ai-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: none;
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(14, 165, 233, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
  z-index: 1;
}

.ai-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(14, 165, 233, 0.5);
}

.ai-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--success);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  border: 2px solid white;
}

.ai-chat {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: 380px;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  background: #efeae2;
  border-radius: 0;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  border: 1px solid var(--border);
  z-index: 3;
  pointer-events: none;
}

/* Dark mode chat background */
[data-theme="dark"] .ai-chat {
  background: var(--chat-bg-dark);
}

/* Textura de fundo sutil */
.ai-chat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(var(--gray-300) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.2;
  pointer-events: none;
}

[data-theme="dark"] .ai-chat::before {
  opacity: 0.05;
}

.ai-chat.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ai-header {
  background: var(--gradient-primary);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 1rem;
  min-width: 0;
}

.ai-header-title span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-header-title i {
  background: rgba(255, 255, 255, 0.2);
  padding: 8px;
  border-radius: 50%;
}

.ai-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ai-header-action {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.ai-header-action:hover {
  background: rgba(255, 255, 255, 0.24);
  color: white;
  transform: translateY(-1px);
}

.ai-usage-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgb(0, 255, 10) !important;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.ai-usage-counter:hover {
  background: rgba(255, 255, 255, 0.25);
}

.ai-close {
  background: transparent;
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.ai-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

#ai-assistant.chat-open .ai-toggle {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
}

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1;
  scroll-behavior: smooth;
}

.ai-message {
  max-width: 75%;
  display: flex;
  flex-direction: column;
  position: relative;
  margin-bottom: 8px;
  animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-message-content {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  word-wrap: break-word;
  position: relative;
}

.ai-message-timestamp {
  font-size: 0.7rem;
  color: rgba(0, 0, 0, 0.45);
  margin-top: 4px;
  text-align: right;
  padding: 0 4px;
}

[data-theme="dark"] .ai-message-timestamp {
  color: rgba(255, 255, 255, 0.45);
}

.ai-message-bot-wrapper {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.ai-bot-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.9rem;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Balão Usuário (Verde estilo WhatsApp) */
.ai-message-user {
  align-self: flex-end;
}

.ai-message-user .ai-message-content {
  background: #d9fdd3;
  color: #111b21;
  border-top-right-radius: 2px;
  padding-bottom: 6px;
}

/* Dark mode: green WhatsApp user message */
[data-theme="dark"] .ai-message-user .ai-message-content {
  background: var(--chat-user-msg-bg);
  color: var(--chat-user-msg-text);
}

.ai-message-user::after {
  content: "";
  position: absolute;
  top: 0;
  right: -6px;
  width: 0;
  height: 0;
  border-top: 0px solid transparent;
  border-left: 10px solid #d9fdd3;
  border-bottom: 10px solid transparent;
}

[data-theme="dark"] .ai-message-user::after {
  border-left-color: var(--chat-user-msg-bg);
}

.ai-message-user .ai-message-timestamp {
  text-align: right;
  color: rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .ai-message-user .ai-message-timestamp {
  color: rgba(255, 255, 255, 0.5);
}

/* Balão Bot (Branco/Cinza escuro) */
.ai-message-bot,
.ai-message-error {
  align-self: flex-start;
  margin-left: 40px;
}

.ai-message-bot .ai-message-content {
  background: #ffffff;
  color: #111b21;
  border-top-left-radius: 2px;
  padding-bottom: 6px;
}

[data-theme="dark"] .ai-message-bot .ai-message-content {
  background: var(--chat-bot-msg-bg);
  color: var(--chat-bot-msg-text);
}

.ai-message-bot::before {
  content: "\f544";
  color: var(--white);
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  position: absolute;
  left: -40px;
  bottom: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-message-bot::after {
  content: "";
  position: absolute;
  top: 0;
  left: -6px;
  width: 0;
  height: 0;
  border-top: 0px solid transparent;
  border-right: 10px solid #ffffff;
  border-bottom: 10px solid transparent;
}

[data-theme="dark"] .ai-message-bot::after {
  border-right-color: var(--chat-bot-msg-bg);
}

.ai-message-bot .ai-message-timestamp {
  text-align: left;
  color: rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .ai-message-bot .ai-message-timestamp {
  color: rgba(255, 255, 255, 0.5);
}

.ai-message-error .ai-message-content {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.ai-message-error::before {
  content: "⚠️";
}

.ai-input-container,
.ai-input-area {
  padding: 8px 10px;
  background: var(--gray-100);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 2;
}

.ai-input,
.ai-input-area textarea {
  flex: 1;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.95rem;
  outline: none;
  background: var(--white);
  color: var(--text);
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 120px;
}

.ai-input:focus,
.ai-input-area textarea:focus {
  box-shadow: inset 0 0 0 1px var(--primary-light);
}

/* Mobile: Add bottom padding to avoid browser bar */
@media (max-width: 768px) {
  .ai-input-area {
    padding-bottom: 3rem !important;
  }
}

.ai-send,
.ai-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.ai-send:hover,
.ai-send-btn:hover {
  background: var(--primary-dark);
}

.ai-footer {
  background: var(--gray-100);
  padding: 4px;
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ============================================================================
   INTERACTIVE QUICK BUTTONS (Survey)
   ========================================================================= */
.ai-quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
}

.ai-quick-btn {
  padding: 0.75rem 1.25rem;
  background: var(--primary-soft);
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
}

.ai-quick-btn:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

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

.ai-quick-btn.skip {
  background: var(--gray-100);
  color: var(--text-muted);
  border-color: var(--border);
}

.ai-quick-btn.skip:hover {
  background: var(--gray-200);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .ai-quick-btn {
  background: rgba(14, 165, 233, 0.1);
}

[data-theme="dark"] .ai-quick-btn:hover {
  background: var(--primary);
}

[data-theme="dark"] .ai-quick-btn.skip {
  background: var(--gray-800);
  color: var(--gray-400);
  border-color: var(--gray-700);
}

[data-theme="dark"] .ai-quick-btn.skip:hover {
  background: var(--gray-700);
  color: var(--gray-300);
}

/* Input disabled state */
.ai-input:disabled,
.ai-input-area textarea:disabled {
  background: var(--gray-100);
  cursor: not-allowed;
  opacity: 0.6;
}

[data-theme="dark"] .ai-input:disabled,
[data-theme="dark"] .ai-input-area textarea:disabled {
  background: var(--gray-800);
}

/* Survey progress bar in header */
.ai-survey-progress-container {
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  display: none;
}

.ai-survey-progress-container.active {
  display: block;
}

.ai-survey-progress-bar {
  position: relative;
  background: rgba(255, 255, 255, 0.2);
  height: 6px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.ai-survey-progress {
  height: 100%;
  background: white;
  border-radius: 10px;
  transition: width 0.5s ease;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
}

.ai-survey-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  display: block;
}

/* Typing indicator */
.ai-typing {
  display: flex;
  gap: 4px;
  padding: 4px 0;
  align-items: center;
}

.ai-typing span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.ai-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.ai-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {

  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* =========================================
   ESTILOS PREMIUM - LANDING PAGE & CHECKOUT
   ========================================= */

:root {
  --lp-primary: #2563eb;
  --lp-primary-dark: #1e40af;
  --lp-secondary: #0f172a;
  --lp-accent: #3b82f6;
  --lp-bg: #f8fafc;
  --lp-text: #334155;
  --lp-gradient: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
}

.lp-body,
.chk-body {
  font-family: 'Inter', sans-serif;
  background-color: var(--lp-bg);
  color: var(--lp-text);
  margin: 10px 0 0;
  padding: 0;
  line-height: 1.6;
}

.text-gradient {
  background: var(--lp-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.lp-badge {
  display: inline-block;
  background: rgba(37, 99, 235, 0.1);
  color: var(--lp-primary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.lp-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
}

.lp-logo,
.chk-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--lp-secondary);
  font-family: 'Poppins', sans-serif;
}

.dot {
  color: var(--lp-primary);
}

.lp-nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.lp-btn-text {
  text-decoration: none;
  color: var(--lp-text);
  font-weight: 500;
}

.lp-btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.lp-btn-lg {
  padding: 14px 32px;
  font-size: 1.1rem;
}

.lp-btn-primary,
.chk-btn-submit {
  background: var(--lp-gradient);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.lp-btn-primary:hover,
.chk-btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.lp-btn-outline {
  background: transparent;
  border: 2px solid #e2e8f0;
  color: var(--lp-text);
}

.lp-btn-outline:hover {
  border-color: var(--lp-primary);
  color: var(--lp-primary);
}

.lp-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding: 60px 0 80px;
  align-items: center;
}

.lp-hero h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 3.5rem;
  line-height: 1.1;
  color: var(--lp-secondary);
  margin-bottom: 20px;
}

.lp-hero p {
  font-size: 1.2rem;
  color: #64748b;
  margin-bottom: 30px;
}

.lp-hero-actions {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
}

.lp-trust-badges {
  display: flex;
  gap: 20px;
  font-size: 0.9rem;
  color: #64748b;
}

.lp-trust-badges i {
  color: var(--lp-primary);
  margin-right: 5px;
}

.glass-effect {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
  border-radius: 20px;
}

.lp-mockup-card {
  padding: 20px;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  transform: rotate(-2deg);
}

.mockup-header {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.circle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.red {
  background: #ff5f57;
}

.yellow {
  background: #febc2e;
}

.green {
  background: #28c840;
}

.ai-msg {
  background: #eff6ff;
  padding: 15px;
  border-radius: 12px;
  font-size: 0.9rem;
  margin-bottom: 15px;
  display: flex;
  gap: 10px;
  align-items: start;
}

.ai-msg i {
  color: var(--lp-primary);
  margin-top: 3px;
}

.stats-row {
  display: flex;
  gap: 10px;
}

.stat-box {
  flex: 1;
  background: white;
  padding: 15px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: bold;
  color: #cbd5e1;
}

.lp-section {
  padding: 80px 20px;
}

.lp-section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 50px;
}

.lp-section-header h2 {
  font-size: 2.5rem;
  font-family: 'Poppins', sans-serif;
  color: var(--lp-secondary);
}

.lp-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.lp-feature-card {
  background: white;
  padding: 30px;
  border-radius: 16px;
  transition: transform 0.3s;
  border: 1px solid #f1f5f9;
}

.lp-feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.icon-box {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 20px;
}

.icon-box.blue {
  background: #dbeafe;
  color: #2563eb;
}

.icon-box.purple {
  background: #f3e8ff;
  color: #9333ea;
}

.icon-box.green {
  background: #dcfce7;
  color: #16a34a;
}

.bg-light-premium {
  background: white;
}

.lp-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  align-items: center;
  padding: 80px 20px;
}

.lp-check-list {
  list-style: none;
  padding: 0;
  margin-top: 20px;
}

.lp-check-list li {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.lp-check-list i {
  color: #16a34a;
}

.user-pill {
  background: white;
  padding: 10px 20px;
  border-radius: 30px;
  margin-bottom: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  font-weight: 600;
  display: inline-block;
  margin-right: 10px;
}

.user-pill.kid {
  background: #eff6ff;
  color: var(--lp-primary);
}

.lp-pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  align-items: start;
}

.lp-price-card {
  background: white;
  padding: 40px 30px;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  position: relative;
}

.lp-price-card.popular {
  border-color: var(--lp-primary);
  box-shadow: 0 20px 40px rgba(37, 99, 235, 0.1);
  transform: scale(1.05);
  z-index: 2;
}

.popular-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--lp-primary);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.price-value {
  font-size: 3rem;
  font-weight: 800;
  color: var(--lp-secondary);
  margin: 20px 0;
  font-family: 'Poppins', sans-serif;
}

.price-value .currency {
  font-size: 1.5rem;
  vertical-align: top;
}

.price-value .period {
  font-size: 1rem;
  color: #94a3b8;
  font-weight: 400;
}

.price-features {
  list-style: none;
  padding: 0;
  margin-bottom: 30px;
}

.price-features li {
  margin-bottom: 15px;
  color: #64748b;
  display: flex;
  gap: 10px;
  align-items: center;
}

.price-features i {
  color: var(--lp-primary);
  width: 20px;
}

.full-width {
  display: block;
  text-align: center;
}

.lp-footer {
  background: var(--lp-secondary);
  color: white;
  padding: 60px 0 20px;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  margin-bottom: 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 40px;
}

.footer-brand p {
  color: #94a3b8;
  max-width: 300px;
}

.footer-links a {
  color: #cbd5e1;
  text-decoration: none;
  margin-left: 20px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: white;
}

.footer-bottom {
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
}

.chk-container {
  display: flex;
  min-height: 100vh;
}

.chk-summary {
  flex: 1;
  background: #f8fafc;
  padding: 40px;
  border-right: 1px solid #e2e8f0;
}

.chk-payment {
  flex: 1;
  background: white;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.chk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.back-link {
  text-decoration: none;
  color: #64748b;
  font-size: 0.9rem;
}

.plan-highlight {
  background: white;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin-bottom: 30px;
}

.plan-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
}

.chk-features li {
  margin-bottom: 10px;
  color: #475569;
  display: flex;
  gap: 10px;
}

.chk-testimonial {
  background: #eff6ff;
  padding: 20px;
  border-radius: 12px;
  margin-top: 40px;
  font-style: italic;
  color: #334155;
}

.chk-testimonial .user {
  font-style: normal;
  font-weight: 600;
  font-size: 0.85rem;
  margin-top: 10px;
}

.chk-form {
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.form-group input {
  width: 100%;
  padding: 12px 0 12px 40px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
  transition: border 0.2s;
}

.form-group input:focus {
  border-color: var(--lp-primary);
  outline: none;
}

.payment-methods {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.payment-methods .method {
  flex: 1;
  padding: 12px;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}

.payment-methods .method.active {
  border-color: var(--lp-primary);
  background: #eff6ff;
  color: var(--lp-primary);
}

.card-details {
  background: #f8fafc;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.row {
  display: flex;
  gap: 15px;
}

.half {
  flex: 1;
}

.chk-btn-submit {
  width: 100%;
  padding: 16px;
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: 8px;
}

.chk-secure-note {
  text-align: center;
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 15px;
}

@media (max-width: 768px) {

  .lp-hero,
  .lp-split,
  .chk-container {
    grid-template-columns: 1fr;
    display: block;
  }

  .lp-hero h1 {
    font-size: 2.5rem;
  }

  .lp-mockup-card {
    margin-top: 40px;
  }

  .lp-pricing-grid {
    margin-top: 20px;
  }

  .chk-container {
    display: flex;
    flex-direction: column;
  }

  .chk-summary,
  .chk-payment {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
  }
}

.lp-section-alt {
  background-color: #f1f5f9;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.price-shock {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #b45309;
  display: inline-block;
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 15px;
  box-shadow: 0 2px 10px rgba(251, 191, 36, 0.2);
  animation: pulse 2s infinite;
}

.popular-badge {
  left: 32%;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

.lp-contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  align-items: center;
}

.contact-info-item {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
}

.contact-icon {
  width: 45px;
  height: 45px;
  background: #eff6ff;
  color: var(--lp-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.contact-text h4 {
  margin: 0 0 5px 0;
  color: var(--lp-secondary);
}

.contact-text p {
  margin: 0;
  color: #64748b;
  font-size: 0.95rem;
}

@media (max-width: 768px) {
  .lp-contact-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   AJUSTES GERAIS DE RESPONSIVIDADE (Index & Assistente)
   ========================================================================= */
@media (max-width: 768px) {

  /* Respiro nas bordas do celular para Index/Landing Page */
  .container {
    padding: 1rem 1.5rem 0 !important;
  }

  /* Garante que seções da Landing Page tenham respiro */
  .lp-section {
    padding: 60px 1.5rem;
  }

  .lp-hero {
    padding: 40px 0 60px;
  }

  /* Ajuste do botão flutuante para não sobrepor o menu inferior */
  #ai-assistant {
    bottom: 90px;
    right: 20px;
  }

  .ai-toggle {
    width: 55px;
    height: 55px;
    font-size: 1.5rem;
  }

  /* Chat fullscreen on mobile */
  .ai-chat {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    z-index: 10000;
  }
}

/* ============================================================================
   COMPONENT: Footer (Otimizado Mobile)
   ========================================================================= */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--space-8) 0 var(--space-6);
  font-size: 0.9rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  /* 1 coluna maior + 3 iguais */
  gap: var(--space-8);
  margin-bottom: var(--space-6);
}

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

.footer-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.footer-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 1.1rem;
}

.footer-brand-name {
  margin: 0;
  font-size: 1.25rem;
  color: var(--gray-900);
  font-weight: 800;
}

.footer-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: var(--space-4);
}

.footer-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-list li {
  margin-bottom: var(--space-2);
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
  display: inline-block;
}

.footer-link:hover {
  color: var(--primary);
  transform: translateX(2px);
}

.footer-copyright {
  border-top: 1px solid var(--border);
  padding-top: var(--space-6);
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
}

/* Responsividade Mobile */
@media (max-width: 768px) {
  .footer {
    padding: var(--space-6) 0 var(--space-4);
    padding-bottom: 90px;
    /* Espaço extra para não cobrir a Bottom Nav */
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    /* Transforma em 2 colunas */
    gap: var(--space-6) var(--space-4);
  }

  .footer-brand-col {
    grid-column: 1 / -1;
    /* Marca ocupa toda a largura no topo */
    align-items: center;
    text-align: center;
    margin-bottom: var(--space-2);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--gray-100);
  }

  .footer-heading {
    margin-bottom: var(--space-3);
  }
}

/* ============================================================================
   AI CHAT PREMIUM UPGRADE (WhatsApp Style + Cards)
   ========================================================================= */

/* Button Reset override for chat */
.ai-chat button {
  font-family: inherit;
}

/* Messages Area - WhatsApp Background vibe */
.ai-messages {
  background-color: #fceceb;
  /* Soft warm bg or keep white/gray */
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%239C92AC' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
}

/* Bubbles */
.ai-message {
  margin-bottom: 24px;
  max-width: 85%;
  position: relative;
  clear: both;
}

.ai-message-user {
  float: right;
  background-color: #dcf8c6;
  /* WhatsApp Green */
  color: #333;
  border-radius: 8px 0 8px 8px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.ai-message-bot {
  float: left;
  background-color: #fff;
  color: #333;
  border-radius: 0 8px 8px 8px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.ai-message-system {
  float: left;
  background-color: #fff;
  color: #333;
  border-radius: 0 8px 8px 8px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.ai-message-card {
  max-width: 100%;
}

.ai-message-content {
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.4;
}

/* Transaction Card */
.ai-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  /* border: 1px solid #e0e0e0; */
  /* box-shadow already on message bubble */
  min-width: 280px;
  max-width: 320px;
  border: 1px solid var(--gray-200);
}

.ai-card-header {
  background: var(--primary);
  color: white;
  padding: 10px 15px;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-card-body {
  padding: 15px 18px;
  background: white;
}

.ai-card-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--gray-100);
}

.ai-card-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.ai-card-label {
  color: var(--gray-500);
}

.ai-card-value {
  font-weight: 500;
  color: var(--gray-800);
  text-align: right;
}

.ai-card-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--gray-100);
  justify-content: center;
}

.ai-btn {
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}

.ai-btn i {
  font-size: 0.9rem;
}

/* Icon-only buttons */
.ai-btn-icon-only {
  width: 40px;
  height: 40px;
  padding: 0;
  flex: 0 0 auto;
}

.ai-btn-icon-only span {
  display: none;
}

.ai-btn-confirm {
  background: var(--success);
  color: white;
}

.ai-btn-confirm:hover {
  background: var(--success-dark);
}

.ai-btn-adjust {
  background: var(--info-light);
  color: white;
}

.ai-btn-adjust:hover {
  background: var(--info);
}

.ai-btn-cancel {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger-light);
}

.ai-btn-cancel:hover {
  background: var(--danger-soft);
}

/* Form inside chat */
.ai-form-group {
  margin-bottom: 12px;
}

.ai-form-label {
  display: block;
  font-size: 0.8rem;
  color: var(--gray-600);
  margin-bottom: 4px;
  font-weight: 500;
}

.ai-form-input,
.ai-form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.9rem;
  background: white;
  color: var(--gray-800);
}

.ai-form-input:focus,
.ai-form-select:focus {
  border-color: var(--primary);
  outline: none;
}

/* History Load Button */
.ai-history-loader {
  text-align: center;
  margin: 20px 0;
  clear: both;
}

.ai-history-btn {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.ai-history-btn:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

/* ============================================================================
   AI CHAT - DARK MODE SUPPORT
   ========================================================================= */
[data-theme="dark"] .ai-messages {
  background-color: #1e293b;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23334155' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
}

[data-theme="dark"] .ai-message-user {
  background-color: #065f46;
  color: #f0fdf4;
}

[data-theme="dark"] .ai-message-bot {
  background-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .ai-message-system {
  background-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .ai-card {
  background: #1e293b;
  border-color: #475569;
}

[data-theme="dark"] .ai-card-body {
  background: #1e293b;
}

[data-theme="dark"] .ai-card-row {
  border-bottom-color: #475569;
}

[data-theme="dark"] .ai-card-label {
  color: #94a3b8;
}

[data-theme="dark"] .ai-card-value {
  color: #f1f5f9;
}

[data-theme="dark"] .ai-form-label {
  color: #cbd5e1;
}

[data-theme="dark"] .ai-form-input,
[data-theme="dark"] .ai-form-select {
  background: #0f172a;
  border-color: #475569;
  color: #f1f5f9;
}

[data-theme="dark"] .ai-form-input::placeholder {
  color: #64748b;
}

/* ============================================================================
   SWAL Z-INDEX FIX
   ========================================================================= */
/* Ensure SweetAlert appears above chat widget */
.swal2-container {
  z-index: 10001 !important;
}

/* Dark Mode Support for SweetAlert2 */
[data-theme="dark"] .swal2-popup {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .swal2-title {
  color: #f1f5f9 !important;
}

[data-theme="dark"] .swal2-html-container {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .swal2-input,
[data-theme="dark"] .swal2-textarea {
  background-color: #0f172a !important;
  border-color: #475569 !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .swal2-input::placeholder,
[data-theme="dark"] .swal2-textarea::placeholder {
  color: #64748b !important;
}

/* Toast specific dark mode */
[data-theme="dark"] .swal2-toast {
  background-color: #334155 !important;
  color: #f1f5f9 !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3) !important;
}

/* ============================================================================
   REPORTS PAGE MOBILE OPTIMIZATION
   ========================================================================= */
@media (max-width: 768px) {

  /* Scope everything to .reports-page-wrapper */
  .reports-page-wrapper .grid-cols-4 {
    grid-template-columns: 1fr !important;
  }

  .reports-page-wrapper .flex.justify-between {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .reports-page-wrapper #report-summary {
    width: 100%;
    margin-left: 0 !important;
  }

  .reports-page-wrapper #report-summary .flex {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  /* Transform Table to Cards */
  .reports-page-wrapper table,
  .reports-page-wrapper thead,
  .reports-page-wrapper tbody,
  .reports-page-wrapper th,
  .reports-page-wrapper td,
  .reports-page-wrapper tr {
    display: block;
  }

  .reports-page-wrapper thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .reports-page-wrapper tr {
    margin-bottom: 1rem;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Premium shadow */
    overflow: hidden;
    /* For rounded corners */
    padding: 0;
  }

  /* Premium spacing for rows */
  .reports-page-wrapper td {
    /* Behave like a "row" */
    border: none;
    border-bottom: 1px solid var(--gray-100);
    position: relative;
    padding-left: 40% !important;
    /* Space for label */
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    text-align: right;
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 0.95rem;
  }

  .reports-page-wrapper td:last-child {
    border-bottom: 0;
  }

  .reports-page-wrapper td:before {
    position: absolute;
    top: 50%;
    left: 1rem;
    width: 35%;
    padding-right: 10px;
    white-space: nowrap;
    transform: translateY(-50%);
    font-weight: 600;
    color: var(--gray-600);
    content: attr(data-label);
    text-align: left;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  /* Specific Data Cell adjustments */
  .reports-page-wrapper td[data-label="Status"] span {
    margin-left: auto;
  }

  .reports-page-wrapper td[data-label="Categoria"] {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
  }

  /* Dark Mode Overrides for Mobile Cards */
  [data-theme="dark"] .reports-page-wrapper tr {
    background: #1e293b;
    /* Slate 800 */
    border-color: #334155;
    /* Slate 700 */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  }

  [data-theme="dark"] .reports-page-wrapper td {
    border-bottom-color: #334155;
    color: #f1f5f9;
    background: transparent;
  }

  [data-theme="dark"] .reports-page-wrapper td:before {
    color: #94a3b8;
    /* Slate 400 */
  }

  /* Adjust button width on mobile */
  .reports-page-wrapper #export-btn {
    width: 100%;
    justify-content: center;
    margin-top: 1rem;
  }

  /* Fix input widths in filters */
  .reports-page-wrapper .form-control {
    width: 100%;
  }
}

/* ============================================================================
   PWA INSTALLATION MODAL
   ========================================================================= */
.pwa-modal {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  max-width: 400px;
  width: 100%;
}

.pwa-modal.show {
  display: block;
  animation: pwaSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-modal-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pwa-icon {
  width: 64px;
  height: 64px;
  background: #f0f9ff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.pwa-icon img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
}

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

.pwa-text h3 {
  margin: 0 0 8px 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-900);
}

.pwa-text p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--gray-600);
  line-height: 1.5;
}

.pwa-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
}

@keyframes pwaSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile Specific (Modal Sheet) */
@media (max-width: 640px) {
  .pwa-modal {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    padding: 0;
  }

  .pwa-modal.show {
    animation: pwaSlideUpMobile 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .pwa-modal-content {
    border-radius: 24px 24px 0 0;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    border-bottom: none;
  }

  @keyframes pwaSlideUpMobile {
    from {
      transform: translateY(100%);
    }

    to {
      transform: translateY(0);
    }
  }
}

/* Dark Mode Support */
[data-theme="dark"] .pwa-modal-content {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .pwa-icon {
  background: #0f172a;
}

[data-theme="dark"] .pwa-text h3 {
  color: #f1f5f9;
}

[data-theme="dark"] .pwa-text p {
  color: #94a3b8;
}

/* ============================================================================
   HEADER & DATE FILTER REFINEMENTS
   ========================================================================= */

/* User Sub-Header (Floating below generic header) */
.user-sub-header {
  /* background: var(--surface); */
  /* padding: 0 var(--space-6) var(--space-3) var(--space-6); */
  /* border-bottom: 1px solid var(--border); */
  margin-top: -1px;
  /* Overlap slightly or just sit below */
  position: sticky;
  top: 44px;
  /* Adjust based on navbar height */
  z-index: 1001;
}

[data-theme="dark"] .user-sub-header {
  /* background: var(--background); */
  /* Or surface */
  /* border-bottom-color: var(--gray-800); */
}

.user-sub-header .responsive-nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-end;
}

/* Header Buttons - Dark Mode Outline Override */
[data-theme="dark"] .navbar .btn-outline {
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: var(--white);
  background: transparent;
  border-radius: 12px;
  /* Screenshot "pill" look */
  transition: all 0.2s;
}

[data-theme="dark"] .navbar .btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--white);
}

/* Header Donate Button */
.btn-donate-header {
  border-radius: 50px;
  /* Pillow shape for donate */
  font-weight: 600;
  padding-left: 1.2rem;
  padding-right: 1.2rem;
}

/* Date Filter Styles */
.date-filter-container {
  position: relative;
  display: inline-block;
}

.date-filter-btn {
  font-size: 0.9rem;
  /* Slightly smaller text */
  font-weight: 600;
  padding: 0.2rem 0.75rem;
  /* More compact padding */
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  min-width: 140px;
  /* Reduced from 180px */
  justify-content: space-between;
  /* Space between text and icon */
}

[data-theme="dark"] .date-filter-btn {
  border-color: var(--gray-700);
  color: var(--white);
}

.date-filter-btn:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.dropdown-menu {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  margin-top: 8px;
  overflow: hidden;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .date-filter-container {
    width: 100%;
    margin-top: var(--space-2);
  }

  .date-filter-btn {
    width: 100%;
    justify-content: center;
    font-size: 1.2rem;
  }

  .user-sub-header {
    display: none;
    /* Hide on mobile to avoid clutter */
  }
}

/* ============================================================================
   EMERGENCY FIXES - DATE FILTER & DARK MODE
   ========================================================================= */

/* Fix Dropdown Visibility (Leaking Info Fix) */
.dropdown-menu {
  display: none;
  /* Force hidden by default */
  position: absolute;
  /* Ensure it floats */
  top: 100%;
  left: 0;
  z-index: 1000;
  float: left;
  min-width: 10rem;
  padding: .5rem 0;
  margin: .125rem 0 0;
  font-size: 1rem;
  color: var(--text);
  text-align: left;
  list-style: none;
  background-color: var(--white);
  background-clip: padding-box;
  border: 1px solid rgba(0, 0, 0, .15);
  border-radius: .25rem;
}

.dropdown-menu.show {
  display: block;
  /* Bootstrap 4/5 reliance fallback */
}

/* Use display block to ensure vertical stacking */
.dropdown-item {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  clear: both;
  font-weight: 400;
  color: var(--text);
  text-align: inherit;
  white-space: nowrap;
  background-color: transparent;
  border: 0;
}

/* Dark Mode Overrides for Dropdown */
[data-theme="dark"] .dropdown-menu {
  background-color: var(--surface) !important;
  border-color: var(--gray-700) !important;
}

[data-theme="dark"] .dropdown-item {
  color: var(--gray-300);
  /* Better contrast than --text sometimes */
}

[data-theme="dark"] .dropdown-item:hover {
  background-color: var(--surface-hover) !important;
  color: var(--white) !important;
}

[data-theme="dark"] .dropdown-divider {
  border-top-color: var(--gray-700);
}

/* KPI Card Dark Mode Fix */
[data-theme="dark"] .kpi-card {
  background: var(--surface) !important;
  border: 1px solid var(--border);
}

/* General Card Dark Mode Fix */
[data-theme="dark"] .card {
  background: var(--surface) !important;
  border-color: var(--gray-800);
}

[data-theme="dark"] .card-header {
  background: var(--surface);
  border-bottom-color: var(--gray-800);
}

/* Table Dark Mode Fixes */
[data-theme="dark"] .table {
  color: var(--text);
}

[data-theme="dark"] .table tr {
  background: var(--surface);
  /* Fix mobile card view rows */
  border-color: var(--gray-800);
}

[data-theme="dark"] .table td {
  border-color: var(--gray-800);
  color: var(--gray-600);
  /* User requested gray-600 for better contrast on dark blue */
}

[data-theme="dark"] .table td[data-label="Valor"] {
  color: var(--text);
}

[data-theme="dark"] .table-container {
  background: transparent;
  /* Or surface if container itself has bg */
}

/* Notification Dark Mode Fix */
[data-theme="dark"] .notification {
  background: var(--surface);
  border: 1px solid var(--gray-700);
  /* Keep left border logic, add surrounding */
  color: var(--text);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .notification i.fa-bell-slash {
  color: var(--gray-500);
}

/* Form Control Dark Mode Fix (Login/Register inputs were white) */
[data-theme="dark"] .form-control {
  background-color: var(--surface-active);
  /* Slightly lighter than surface for input */
  border-color: var(--gray-700);
  color: var(--text);
}

[data-theme="dark"] .form-control:focus {
  background-color: var(--surface-hover);
  border-color: var(--primary);
  color: var(--white);
}

/* ============================================================================
   EMERGENCY FIXES - DATE FILTER & DARK MODE
   ========================================================================= */

/* Ensure Modal Visibility (Bootstrap Override) */
.modal.show {
  display: block !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.modal-backdrop.show {
  opacity: 0.5 !important;
}

/* Right Aligned Modal (Custom Date Filter) */
.modal-right .modal-dialog {
  position: absolute;
  right: 15px;
  top: 140px;
  /* Adjust based on header height + spacing */
  margin: 0;
  width: 300px;
  max-width: 90vw;
  z-index: 1060;
}

.modal-right .modal-content {
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
}

[data-theme="dark"] .modal-right .modal-content {
  background: var(--surface);
  border-color: var(--gray-700);
}

/* ============================================================================
   DARK MODE COMPREHENSIVE FIXES (Buttons, Tables, Icons)
   ========================================================================= */

/* Fix Outline Buttons (remove white bg) */
[data-theme="dark"] .btn-outline {
  background: transparent;
  border-color: var(--gray-600);
  color: var(--gray-300);
}

[data-theme="dark"] .btn-outline:hover {
  background: var(--surface-hover);
  border-color: var(--gray-400);
  color: var(--white);
}

/* Fix Rounded Icon Buttons (remove white bg) */
[data-theme="dark"] .btn-icon-rounded {
  background: var(--surface);
  border-color: var(--gray-700);
  color: var(--gray-400);
}

[data-theme="dark"] .btn-icon-rounded:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  color: var(--primary);
}

/* Fix Table Container (remove white bg) */
[data-theme="dark"] .table-container {
  background: var(--surface);
  border-color: var(--gray-800);
}

/* Fix Table Headers (remove gray-50 bg) */
[data-theme="dark"] .table th {
  background: var(--surface-hover);
  /* Slightly lighter than surface */
  color: var(--gray-400);
  border-bottom-color: var(--gray-700);
}

/* Fix Table Striped/Hover Rows */
[data-theme="dark"] .table tbody tr:hover {
  background: var(--surface-active);
}

/* Fix Badges (ensure visibility) */
[data-theme="dark"] .badge {
  border: 1px solid transparent;
}

/* ============================================================================
   DARK MODE TYPOGRAPHY & VISIBILITY FIXES (Emergency)
   ========================================================================= */

/* Fix Headings colors in Dark Mode */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] .card-title,
[data-theme="dark"] .navbar-brand,
[data-theme="dark"] .stat-card-value {
  color: var(--white) !important;
}

/* Fix Muted Text visibility */
[data-theme="dark"] .text-muted,
[data-theme="dark"] .stat-card-label,
[data-theme="dark"] .form-help {
  color: var(--gray-400) !important;
}

/* Fix Input placeholders */
[data-theme="dark"] .form-control::placeholder {
  color: var(--gray-500);
}

/* Fix Select Icons (if SVG is dark) - Force white filter or replace check */
/* (Selects usually need custom SVG replacement or filter invert) */
[data-theme="dark"] select.form-control {
  color: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23cbd5e1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
}

/* Optional: Add borders to badges in dark mode for better definition if needed */
/* Fix Complete seu Perfil Card in Dark Mode */
[data-theme='dark'] .ai-tip-card[style*='linear-gradient'] {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
}

[data-theme='dark'] .ai-tip-label,
[data-theme='dark'] .ai-tip-text {
  color: var(--text) !important;
}

[data-theme='dark'] .ai-tip-icon {
  background: var(--surface-active) !important;
  color: var(--primary) !important;
}

[data-theme='dark'] #start-profile-survey {
  background: var(--surface-active) !important;
  color: var(--white) !important;
  border: 1px solid var(--border);
}

[data-theme='dark'] #start-profile-survey:hover {
  background: var(--primary) !important;
}

/* Fix KPI Cards Text in Dark Mode */
[data-theme="dark"] .kpi-value {
  color: var(--white) !important;
}

[data-theme="dark"] .kpi-label {
  color: var(--gray-400) !important;
}

[data-theme="dark"] .kpi-trend {
  color: var(--gray-400);
}

/* Fix Modal Footer in Dark Mode */
[data-theme='dark'] .modal-footer {
  background: var(--surface-active);
  border-top-color: var(--border);
}

/* Fix Badges/Tags in Dark Mode */
[data-theme='dark'] .badge {
  background: var(--surface-active);
  color: var(--text);
  border: 1px solid var(--border);
}

[data-theme='dark'] .badge-status-paid {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.35);
}

[data-theme='dark'] .badge-status-received {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.35);
}

[data-theme='dark'] .badge-status-pending {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.35);
}

[data-theme='dark'] .badge-status-overdue {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
}

[data-theme='dark'] .select2-selection__choice {
  background-color: var(--surface-active) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

/* =========================================
   AI Chat - WhatsApp Theme Overrides
   ========================================= */

/* --- Light Mode (Default) --- */
.ai-chat {
  background-color: #efe7dd !important;
  background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png') !important;
  background-blend-mode: overlay;
  border-radius: 0 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
}

.ai-header {
  background: #008069 !important;
  color: #ffffff !important;
  padding: 10px 16px !important;
  border-radius: 0 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ai-header-title {
  font-weight: 500 !important;
  font-size: 1rem !important;
}

.ai-messages {
  background: transparent !important;
  padding: 10px 16px !important;
}

/* User Message */
.ai-message-user .ai-message-content {
  background-color: #d9fdd3 !important;
  color: #111b21 !important;
  border-radius: 7.5px 0 7.5px 7.5px !important;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13) !important;
  padding: 6px 9px 8px 9px !important;
  font-size: 14.2px !important;
  line-height: 19px !important;
}

/* Bot Message */
.ai-message-bot .ai-message-content {
  background-color: #ffffff !important;
  color: #111b21 !important;
  border-radius: 0 7.5px 7.5px 7.5px !important;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13) !important;
  border: none !important;
  padding: 6px 9px 8px 9px !important;
  font-size: 14.2px !important;
}

.ai-message-timestamp {
  color: rgba(17, 27, 33, 0.5) !important;
  font-size: 11px !important;
  text-align: right !important;
  margin-top: 2px !important;
}

/* Input Area */
.ai-input-area {
  background: #f0f2f5 !important;
  padding: 8px 10px !important;
  border-radius: 0 !important;
}

#ai-input {
  background: #ffffff !important;
  border-radius: 8px !important;
  padding: 9px 12px !important;
  color: #111b21 !important;
  border: none !important;
}

.ai-send-btn {
  color: #54656f !important;
  background: transparent !important;
}

.ai-send-btn:hover {
  color: #008069 !important;
}

/* Toggle Button */
.ai-toggle {
  background: #25d366 !important;
  color: white !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2) !important;
}

.ai-header-action {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
}

.ai-header-action:hover {
  background: rgba(255, 255, 255, 0.24) !important;
}

/* --- Dark Mode Overrides --- */
[data-theme='dark'] .ai-chat {
  background-color: #0b141a !important;
  background-image: none !important;
  /* Or use dark pattern if available */
  border: 1px solid #202c33 !important;
}

[data-theme='dark'] .ai-header {
  background: #202c33 !important;
  color: #e9edef !important;
}

[data-theme='dark'] .ai-message-user .ai-message-content {
  background-color: #005c4b !important;
  color: #e9edef !important;
}

[data-theme='dark'] .ai-message-bot .ai-message-content {
  background-color: #202c33 !important;
  color: #e9edef !important;
}

[data-theme='dark'] .ai-message-timestamp {
  color: rgba(233, 237, 239, 0.6) !important;
}

[data-theme='dark'] .ai-input-area {
  background: #202c33 !important;
  border-top: 1px solid #202c33 !important;
}

[data-theme='dark'] #ai-input {
  background: #2a3942 !important;
  color: #e9edef !important;
}

[data-theme='dark'] .ai-send-btn {
  color: #8696a0 !important;
}

[data-theme='dark'] .ai-footer {
  background: #0b141a !important;
  color: #8696a0 !important;
  border-top: 1px solid #202c33 !important;
}


/* AI Chat Read Receipt (Blue Double Check) */
.ai-check-read {
  color: #53bdeb;
  /* WhatsApp Blue */
  font-size: 11px;
  margin-left: 4px;
}

/* Add styles for multi-select buttons */
.ai-quick-btn.selected {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.ai-quick-btn.done {
  margin-top: 10px;
  width: 100%;
  font-weight: bold;
}

/* =========================================
   AI Transaction Card Styles (Restored)
   ========================================= */
.ai-message-card {
  width: 100%;
  max-width: 300px;
}

.ai-card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  margin-top: 5px;
  border: 1px solid #e0e0e0;
}

.ai-card-header {
  background: #f8f9fa;
  padding: 10px 15px;
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid #eee;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-card-body {
  padding: 12px 15px;
}

.ai-card-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.ai-card-label {
  color: #666;
}

.ai-card-value {
  font-weight: 500;
  color: #333;
  text-align: right;
}

.ai-card-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
  gap: 10px;
}

.ai-btn {
  flex: 1;
  border: none;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-btn-confirm {
  background: #d9fdd3;
  color: #1a7f64;
  /* WhatsApp Green Darker */
}

.ai-btn-confirm:hover {
  background: #c0fcc0;
}

.ai-btn-adjust {
  background: #f0f2f5;
  color: #54656f;
}

.ai-btn-adjust:hover {
  background: #e0e2e5;
}

.ai-btn-cancel {
  background: #ffebee;
  color: #c62828;
}

.ai-btn-cancel:hover {
  background: #ffcdd2;
}

/* Dark Mode Support for Cards */
[data-theme='dark'] .ai-card {
  background: #202c33;
  border-color: #2a3942;
}

[data-theme='dark'] .ai-card-header {
  background: #2a3942;
  color: #e9edef;
  border-bottom-color: #2a3942;
}

[data-theme='dark'] .ai-card-label {
  color: #8696a0;
}

[data-theme='dark'] .ai-card-value {
  color: #e9edef;
}

[data-theme='dark'] .ai-btn-confirm {
  background: #005c4b;
  color: #e9edef;
}

[data-theme='dark'] .ai-btn-adjust {
  background: #2a3942;
  color: #e9edef;
}

[data-theme='dark'] .ai-btn-cancel {
  background: #3c1e1e;
  color: #fca5a5;
}

/* ============================================================================
   AI CHAT SURVEY PROGRESS BAR
   ========================================================================= */
.ai-survey-progress-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: absolute;
  top: 60px;
  /* Below header */
  left: 0;
  right: 0;
  z-index: 10;
  animation: slideDown 0.3s ease;
}

.ai-survey-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--gray-600);
  font-weight: 500;
}

.ai-survey-progress-track {
  width: 100%;
  height: 6px;
  background: var(--gray-100);
  border-radius: 3px;
  overflow: hidden;
}

.ai-survey-progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideDown {
  from {
    transform: translateY(-10px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}
