/* ==========================================================================
   JB Finanças - Sistema de Controle Financeiro Inteligente com IA
   Design System: Modern Fintech & Analytics UI (Pure Vanilla CSS)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* Brand & Theme Colors */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-glow: rgba(79, 70, 229, 0.16);

  --secondary: #0f172a;
  --secondary-muted: #1e293b;

  --accent: #0ea5e9;
  --accent-light: #e0f2fe;

  --success: #10b981;
  --success-dark: #059669;
  --success-light: #ecfdf5;

  --danger: #f43f5e;
  --danger-dark: #e11d48;
  --danger-light: #fff1f2;

  --warning: #f59e0b;
  --warning-dark: #d97706;
  --warning-light: #fffbeb;

  --info: #3b82f6;
  --info-light: #eff6ff;

  /* Neutrals & Surfaces */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: #f1f5f9;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  --border-color: #e2e8f0;
  --border-focus: #4f46e5;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 12px 24px -4px rgba(79, 70, 229, 0.12), 0 4px 6px -2px rgba(15, 23, 42, 0.05);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* High Contrast & Dark Theme Support */
body.high-contrast {
  --primary: #818cf8;
  --primary-hover: #a5b4fc;
  --primary-light: #1e1b4b;
  --primary-glow: rgba(129, 140, 248, 0.25);

  --secondary: #f8fafc;
  --secondary-muted: #e2e8f0;

  --bg-page: #090d16;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f2937;
  --bg-subtle: #1e293b;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --border-color: #374151;
  --border-focus: #818cf8;

  background-color: #090d16 !important;
  color: #f8fafc !important;
}

body.high-contrast .app-header,
body.high-contrast .modern-card,
body.high-contrast .metric-card,
body.high-contrast .action-card,
body.high-contrast .modal-content,
body.high-contrast .module-nav-item {
  background-color: #111827 !important;
  color: #f8fafc !important;
  border-color: #374151 !important;
}

body.high-contrast .form-input,
body.high-contrast .form-select {
  background-color: #1f2937 !important;
  color: #f8fafc !important;
  border-color: #4b5563 !important;
}

body.high-contrast .table-modern th {
  background-color: #1f2937 !important;
  color: #f8fafc !important;
  border-color: #374151 !important;
}

body.high-contrast .table-modern td {
  border-color: #1f2937 !important;
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.header-top {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title .badge-ai {
  font-size: 10.5px;
  font-weight: 800;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.2);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Header Quick Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-accessibility {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-accessibility:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.user-profile-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 5px 14px 5px 6px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.user-profile-chip:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.user-avatar-initials {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

/* User Dropdown Menu */
.user-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
  min-width: 220px;
  z-index: 1000;
  padding: 6px;
  animation: slideUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.dropdown-item:hover {
  background: var(--bg-subtle);
  color: var(--primary);
}

.dropdown-item.text-danger:hover {
  background: var(--danger-light);
  color: var(--danger);
}


/* Sub Ribbon */
.header-sub-ribbon {
  background: linear-gradient(90deg, #1e1b4b 0%, #0f172a 100%);
  color: #e2e8f0;
  padding: 8px 24px;
}

.sub-ribbon-content {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 500;
}

.sub-ribbon-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
  display: inline-block;
}

/* ==========================================================================
   Main Layout Container
   ========================================================================== */
.main-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

/* ==========================================================================
   Hero Global Search
   ========================================================================== */
.search-container {
  margin-bottom: 32px;
}

.search-box-wrapper {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 10px 6px 20px;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
  max-width: 840px;
  margin: 0 auto;
  transition: all 0.25s ease;
}

.search-box-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow), var(--shadow-md);
  background: #ffffff;
}

.search-box-wrapper input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  padding: 8px 12px;
  color: var(--text-main);
  background: transparent;
}

.search-box-wrapper input::placeholder {
  color: var(--text-subtle);
}

.search-icon-btn {
  background: var(--primary);
  color: #ffffff;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

.search-icon-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.04);
}

.search-badge-hint {
  font-size: 11px;
  color: var(--text-subtle);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  margin-right: 8px;
}

/* ==========================================================================
   Module Navigation Selector (Modern Tabs/Cards)
   ========================================================================== */
.section-header-modern {
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.section-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.4px;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.modules-nav-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}

.module-nav-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  cursor: pointer;
}

.module-nav-item:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.module-nav-item.active {
  background: linear-gradient(180deg, #ffffff 0%, var(--primary-light) 100%);
  border-color: var(--primary);
  box-shadow: 0 4px 14px var(--primary-glow);
  transform: translateY(-2px);
}

.module-nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
}

.circle-img-wrapper {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 10px;
  transition: all 0.2s ease;
  position: relative;
}

.module-nav-item.active .circle-img-wrapper {
  background-color: #ffffff;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.15);
  transform: scale(1.05);
}

.circle-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--secondary);
  color: #fff;
  border-radius: var(--radius-full);
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.module-nav-item.active .circle-badge {
  background: var(--primary);
}

.circle-label {
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.2px;
  color: var(--text-main);
}

.module-nav-item.active .circle-label {
  color: var(--primary);
}

/* ==========================================================================
   Quick Actions Grid
   ========================================================================== */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.action-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.22s ease;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  text-align: left;
}

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

.action-card .card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.action-card:hover .card-icon {
  transform: scale(1.08);
}

.action-card .card-content {
  flex: 1;
}

.action-card .card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.action-card .card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   KPI Metrics Row
   ========================================================================== */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

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

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background-color: var(--primary);
}

.metric-card.positive::before {
  background-color: var(--success);
}

.metric-card.negative::before {
  background-color: var(--danger);
}

.metric-card.warning::before {
  background-color: var(--warning);
}

.metric-title {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.6px;
}

.metric-card.positive .metric-value {
  color: var(--success-dark);
}

.metric-card.negative .metric-value {
  color: var(--danger-dark);
}

.metric-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   Modern Cards & Containers
   ========================================================================== */
.modern-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

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

.card-title-modern {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.3px;
}

/* ==========================================================================
   Modern Tables
   ========================================================================== */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.table-modern {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  background: var(--bg-surface);
}

.table-modern th {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 700;
  padding: 12px 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.table-modern td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13.5px;
  color: var(--text-main);
}

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

.table-modern tr:hover td {
  background-color: rgba(241, 245, 249, 0.6);
}

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-success { background-color: var(--success-light); color: var(--success-dark); }
.badge-danger { background-color: var(--danger-light); color: var(--danger-dark); }
.badge-warning { background-color: var(--warning-light); color: var(--warning-dark); }
.badge-info { background-color: var(--primary-light); color: var(--primary); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1.2;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

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

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
}

.btn-success {
  background: var(--success);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

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

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

.btn-danger:hover {
  background: var(--danger-dark);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Modals & Overlays
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.25);
  padding: 28px;
  position: relative;
  border: 1px solid var(--border-color);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.4px;
}

.modal-close {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ==========================================================================
   Forms & Inputs
   ========================================================================== */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background-color: var(--bg-surface);
  color: var(--text-main);
  transition: all 0.2s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ==========================================================================
   Drag & Drop Zone (NF-e Upload)
   ========================================================================== */
.dropzone {
  border: 2px dashed var(--primary);
  border-radius: var(--radius-lg);
  background-color: var(--primary-light);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 20px;
}

.dropzone:hover, .dropzone.dragover {
  background-color: #e0e7ff;
  border-color: var(--primary-hover);
  transform: scale(1.01);
}

.dropzone-icon {
  font-size: 46px;
  color: var(--primary);
  margin-bottom: 10px;
}

/* ==========================================================================
   Split Preview Item Cards
   ========================================================================== */
.split-item-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 12px;
  background-color: var(--bg-surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.split-item-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.split-item-card.ambiguous {
  border-color: var(--warning);
  background-color: var(--warning-light);
}

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

.toast {
  background: var(--secondary);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.success { background-color: var(--success); }
.toast.danger { background-color: var(--danger); }
.toast.info { background-color: var(--primary); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 1024px) {
  .modules-nav-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .modules-nav-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .module-nav-item {
    padding: 12px 10px;
  }
  .circle-img-wrapper {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }
  .circle-label {
    font-size: 12px;
  }
}

/* ==============================================================================
   QR CODE CAMERA SCANNER STYLES & RETICLE ANIMATION
   ============================================================================== */
#qrScannerWrapper video {
  width: 100% !important;
  height: auto !important;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius-md);
}

#qrReader {
  border: none !important;
}

#qrReader img {
  display: none !important;
}

.scanner-frame {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 16px;
  box-shadow: 0 0 0 4000px rgba(11, 15, 25, 0.55);
}

.scanner-corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border-color: #6366f1;
  border-style: solid;
}

.scanner-corner.top-left {
  top: 0;
  left: 0;
  border-width: 4px 0 0 4px;
  border-top-left-radius: 12px;
}

.scanner-corner.top-right {
  top: 0;
  right: 0;
  border-width: 4px 4px 0 0;
  border-top-right-radius: 12px;
}

.scanner-corner.bottom-left {
  bottom: 0;
  left: 0;
  border-width: 0 0 4px 4px;
  border-bottom-left-radius: 12px;
}

.scanner-corner.bottom-right {
  bottom: 0;
  right: 0;
  border-width: 0 4px 4px 0;
  border-bottom-right-radius: 12px;
}

.scanner-laser {
  position: absolute;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #6366f1, #a855f7, transparent);
  box-shadow: 0 0 12px #6366f1, 0 0 20px #a855f7;
  top: 0;
  animation: laserScan 2s ease-in-out infinite alternate;
}

@keyframes laserScan {
  0% { top: 6px; }
  100% { top: calc(100% - 8px); }
}

@media (max-width: 480px) {
  .scanner-frame {
    width: 190px;
    height: 190px;
  }
}

/* ==========================================================================
   Voice Chat & Audio Financial Assistant Styles
   ========================================================================== */

.chat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-bottom: 30px;
}

.chat-header-bar {
  padding: 16px 22px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(139, 92, 246, 0.05) 100%);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar-ai {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5 0%, #8b5cf6 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.chat-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  color: var(--success-dark);
}

.chat-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.chat-suggestions-bar {
  padding: 10px 18px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
}

.chat-suggestion-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.chat-suggestion-chip:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.chat-messages-container {
  padding: 20px;
  min-height: 400px;
  max-height: 520px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-page);
  scroll-behavior: smooth;
}

.chat-message-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: messageFadeIn 0.25s ease-out;
}

.chat-message-row.user {
  justify-content: flex-end;
}

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

.chat-bubble {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.chat-bubble.bot {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
}

.chat-bubble.user {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-audio-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.chat-tx-card {
  margin-top: 10px;
  padding: 12px 14px;
  background: rgba(79, 70, 229, 0.06);
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-tx-amount {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}

.chat-tx-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.chat-input-bar {
  padding: 16px 20px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-input-bar .form-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius-full);
  font-size: 14px;
}

.btn-mic-large {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-mic-large:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.45);
}

.btn-mic-large.recording {
  background: #ef4444;
  animation: pulseRecording 1.4s infinite;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
}

@keyframes pulseRecording {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.08); box-shadow: 0 0 0 14px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.chat-recording-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-full);
  padding: 8px 18px;
  animation: recordingFade 0.2s ease-in;
}

@keyframes recordingFade {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.sound-wave {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 20px;
}

.sound-wave-bar {
  width: 3.5px;
  background: #ef4444;
  border-radius: 2px;
  animation: waveBar 0.8s ease-in-out infinite alternate;
}

.sound-wave-bar:nth-child(1) { height: 6px; animation-delay: 0.1s; }
.sound-wave-bar:nth-child(2) { height: 16px; animation-delay: 0.3s; }
.sound-wave-bar:nth-child(3) { height: 22px; animation-delay: 0.2s; }
.sound-wave-bar:nth-child(4) { height: 12px; animation-delay: 0.4s; }
.sound-wave-bar:nth-child(5) { height: 18px; animation-delay: 0.15s; }
.sound-wave-bar:nth-child(6) { height: 8px; animation-delay: 0.25s; }

@keyframes waveBar {
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1.2); }
}

/* Floating Action Button (FAB) */
.fab-voice-chat {
  position: fixed;
  bottom: 26px;
  right: 26px;
  z-index: 990;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #4f46e5 0%, #8b5cf6 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.45);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fab-voice-chat:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.55);
}

@media (max-width: 600px) {
  .fab-voice-chat {
    bottom: 20px;
    right: 16px;
    padding: 10px 16px;
    font-size: 13px;
  }
}

