/* ============================================================
   Sistema Financeiro Inteligente Borsato — app.css
   Dark mode padrão | Design System completo
   ============================================================ */

/* ------------------------------------------------------------
   1. VARIÁVEIS CSS — Dark Mode (padrão)
   ------------------------------------------------------------ */
:root {
  /* Backgrounds */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --border-color: #334155;

  /* Textos */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Cores funcionais */
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-info: #3b82f6;

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;
  --bottom-nav-height: 64px;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;

  /* Sombras e transições */
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 60px -10px rgba(0, 0, 0, 0.5);
  --transition: all 0.2s ease;
}

/* Light mode */
[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f8fafc;
  --border-color: #e2e8f0;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 60px -10px rgba(0, 0, 0, 0.15);
}

/* ------------------------------------------------------------
   2. RESET E BASE
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: var(--transition);
}

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

ul, ol {
  list-style: none;
}

img, svg {
  max-width: 100%;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

p {
  color: var(--text-secondary);
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

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

/* Seleção de texto */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: var(--text-primary);
}

/* ------------------------------------------------------------
   3. LAYOUT SPA PRINCIPAL
   ------------------------------------------------------------ */

/* Wrapper raiz da aplicação */
.app-wrapper {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  position: relative;
}

/* Conteúdo principal */
.main-content {
  flex-grow: 1;
  margin-left: var(--sidebar-width);
  overflow-y: auto;
  min-height: 100vh;
  padding: 24px;
  padding-bottom: 32px;
  transition: margin-left 0.3s ease;
}

/* Área de conteúdo das páginas */
.content-area {
  max-width: 1400px;
  margin: 0 auto;
}

/* ------------------------------------------------------------
   4. SIDEBAR
   ------------------------------------------------------------ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

/* Logo da sidebar */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-logo-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Navegação da sidebar */
.sidebar-nav {
  flex: 1;
  padding: 12px 12px 0;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 8px 6px;
  margin-top: 4px;
}

/* Item de navegação */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  position: relative;
  user-select: none;
}

.nav-item svg,
.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item span {
  flex: 1;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--color-primary);
  color: #ffffff;
}

.nav-item.active svg,
.nav-item.active .nav-icon {
  opacity: 1;
}

/* Badge no nav-item */
.nav-badge {
  background: var(--color-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}

.nav-item.active .nav-badge {
  background: rgba(255, 255, 255, 0.3);
}

/* Rodapé da sidebar */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-user:hover {
  background: var(--bg-hover);
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* Overlay da sidebar no mobile */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* ------------------------------------------------------------
   5. HEADER MOBILE
   ------------------------------------------------------------ */
.header-mobile {
  display: none;
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.header-mobile-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.hamburger-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 8px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.hamburger-btn:hover {
  background: var(--bg-hover);
}

/* ------------------------------------------------------------
   6. BOTTOM NAV (mobile)
   ------------------------------------------------------------ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  z-index: 100;
  flex-direction: row;
  align-items: stretch;
  padding: 0 4px;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  transition: var(--transition);
  border-radius: var(--border-radius-sm);
  position: relative;
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
}

.bottom-nav-item.active {
  color: var(--color-primary);
}

.bottom-nav-item .bottom-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  background: var(--color-danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 8px;
  min-width: 14px;
  text-align: center;
}

/* ------------------------------------------------------------
   7. SEÇÕES DE PÁGINA
   ------------------------------------------------------------ */
.page-section {
  display: none;
  animation: fadeIn 0.25s ease;
}

.page-section.active {
  display: block;
}

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

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

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

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

/* ------------------------------------------------------------
   8. CARDS KPI
   ------------------------------------------------------------ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

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

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), #8b5cf6);
  opacity: 0;
  transition: var(--transition);
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon-primary { background: rgba(99, 102, 241, 0.15); color: var(--color-primary); }
.kpi-icon-success { background: rgba(16, 185, 129, 0.15); color: var(--color-success); }
.kpi-icon-danger  { background: rgba(239, 68, 68, 0.15); color: var(--color-danger); }
.kpi-icon-warning { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); }
.kpi-icon-info    { background: rgba(59, 130, 246, 0.15); color: var(--color-info); }

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.kpi-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.kpi-change {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
}

.kpi-change.positive {
  color: var(--color-success);
}

.kpi-change.negative {
  color: var(--color-danger);
}

.kpi-change-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ------------------------------------------------------------
   9. CARDS GENÉRICOS
   ------------------------------------------------------------ */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

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

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

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
}

/* Grid de cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.cards-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.cards-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ------------------------------------------------------------
   10. TABELAS
   ------------------------------------------------------------ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  white-space: nowrap;
}

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

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

.data-table tr:hover td {
  background: var(--bg-hover);
}

.data-table tbody tr {
  transition: var(--transition);
  cursor: pointer;
}

/* Coluna de ações */
.data-table .col-actions {
  text-align: right;
  width: 1%;
  white-space: nowrap;
}

.data-table .col-amount {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Célula com ícone */
.table-cell-icon {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-category-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Empty state */
.table-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.table-empty svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  opacity: 0.4;
}

.table-empty p {
  font-size: 14px;
}

/* ------------------------------------------------------------
   11. FORMULÁRIOS
   ------------------------------------------------------------ */
.form-group {
  margin-bottom: 16px;
}

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

.form-label.required::after {
  content: ' *';
  color: var(--color-danger);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 15px;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 12px;
  color: var(--color-danger);
  margin-top: 4px;
  display: none;
}

.form-error.visible {
  display: block;
}

.form-input.error {
  border-color: var(--color-danger);
}

/* Grid de formulário */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* Checkbox e Radio customizados */
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.form-check-label {
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

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

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

/* Barra de pesquisa */
.search-bar {
  position: relative;
}

.search-bar svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.search-bar .form-input {
  padding-left: 38px;
}

/* Filtros */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ------------------------------------------------------------
   12. MODAIS
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  width: min(540px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.2s ease;
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  margin-bottom: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* Modal pequeno */
.modal.modal-sm {
  width: min(380px, 95vw);
}

/* Modal grande */
.modal.modal-lg {
  width: min(720px, 95vw);
}

/* ------------------------------------------------------------
   13. BOTÕES
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  white-space: nowrap;
  line-height: 1;
  user-select: none;
}

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

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

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

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

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

.btn-success:hover {
  background: #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

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

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

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

.btn-warning:hover {
  background: #d97706;
}

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

.btn-info:hover {
  background: #2563eb;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

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

.btn-text {
  background: transparent;
  border: none;
  color: var(--color-primary);
  padding: 6px 8px;
}

.btn-text:hover {
  background: rgba(99, 102, 241, 0.1);
}

/* Tamanhos */
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: 10px;
}

.btn-block {
  width: 100%;
}

/* Botão com loading */
.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Grupo de botões */
.btn-group {
  display: flex;
  gap: 6px;
}

/* Botão de ação (ícone) */
.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--border-radius-sm);
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

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

.btn-icon svg {
  width: 15px;
  height: 15px;
}

/* ------------------------------------------------------------
   14. BADGES E STATUS
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.badge svg {
  width: 12px;
  height: 12px;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.badge-info {
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
}

.badge-secondary {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.badge-purple {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
}

/* Badge de ponto (com dot) */
.badge-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
}

.badge-dot::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-dot.success::before { background: var(--color-success); }
.badge-dot.danger::before  { background: var(--color-danger); }
.badge-dot.warning::before { background: var(--color-warning); }
.badge-dot.info::before    { background: var(--color-info); }

/* ------------------------------------------------------------
   15. TOAST NOTIFICATIONS
   ------------------------------------------------------------ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border-radius: var(--border-radius-sm);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--color-primary);
  min-width: 300px;
  max-width: 400px;
  pointer-events: all;
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.toast.hiding {
  animation: slideOut 0.3s ease forwards;
}

.toast-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-icon svg {
  width: 18px;
  height: 18px;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.toast-message {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
  transition: var(--transition);
}

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

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

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

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

.toast-info    { border-left-color: var(--color-info); }
.toast-info .toast-icon    { color: var(--color-info); }

/* ------------------------------------------------------------
   16. LOADING E SKELETON
   ------------------------------------------------------------ */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

.loading-spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.loading-spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

/* Tela de carregamento de página */
.page-loading {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 9990;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.page-loading p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Skeleton shimmer */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 25%,
    var(--bg-hover) 50%,
    var(--bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--border-radius-sm);
}

.skeleton-text {
  height: 14px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-text.wide  { width: 80%; }
.skeleton-text.mid   { width: 60%; }
.skeleton-text.short { width: 40%; }

.skeleton-title {
  height: 24px;
  width: 50%;
  border-radius: 4px;
  margin-bottom: 12px;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--border-radius);
}

.skeleton-kpi {
  height: 100px;
  border-radius: var(--border-radius);
}

.skeleton-chart {
  height: 280px;
  border-radius: var(--border-radius);
}

/* ------------------------------------------------------------
   17. SCORE DE SAÚDE FINANCEIRA
   ------------------------------------------------------------ */
.health-score-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
}

.health-score-gauge {
  position: relative;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
}

.health-score-gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.health-score-track {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 8;
}

.health-score-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease, stroke 0.5s ease;
}

.health-score-number {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.health-score-number span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Cores por faixa de score */
.health-score-fill.score-low    { stroke: var(--color-danger); }
.health-score-fill.score-medium { stroke: var(--color-warning); }
.health-score-fill.score-high   { stroke: var(--color-success); }

.health-score-number.score-low    { color: var(--color-danger); }
.health-score-number.score-medium { color: var(--color-warning); }
.health-score-number.score-high   { color: var(--color-success); }

.health-score-info {
  flex: 1;
}

.health-score-label {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.health-score-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ------------------------------------------------------------
   18. CHAT IA
   ------------------------------------------------------------ */
.chat-button {
  position: fixed;
  bottom: 84px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
  transition: var(--transition);
}

.chat-button:hover {
  background: var(--color-primary-hover);
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.6);
}

.chat-button svg {
  width: 24px;
  height: 24px;
}

.chat-button .chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--color-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Painel de chat */
.chat-panel {
  position: fixed;
  bottom: 84px;
  right: 20px;
  width: min(380px, calc(100vw - 32px));
  height: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  z-index: 998;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.chat-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.chat-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-panel-title-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulse 2s infinite;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.chat-bubble-user {
  background: var(--color-primary);
  color: #ffffff;
  align-self: flex-end;
  border-radius: 12px 12px 0 12px;
}

.chat-bubble-ai {
  background: var(--bg-secondary);
  color: var(--text-primary);
  align-self: flex-start;
  border-radius: 12px 12px 12px 0;
  border: 1px solid var(--border-color);
}

.chat-bubble-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

.chat-bubble-ai .chat-bubble-time {
  text-align: left;
}

.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-radius: 12px 12px 12px 0;
  align-self: flex-start;
  border: 1px solid var(--border-color);
}

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

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

.chat-panel-input {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-panel-input textarea {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 14px;
  resize: none;
  max-height: 100px;
  min-height: 38px;
  line-height: 1.5;
}

.chat-panel-input textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--border-radius-sm);
  background: var(--color-primary);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}

.chat-send-btn:hover {
  background: var(--color-primary-hover);
}

.chat-send-btn svg {
  width: 16px;
  height: 16px;
}

/* ------------------------------------------------------------
   19. TELA DE ACESSO RESTRITO (GATE)
   ------------------------------------------------------------ */
.access-gate {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
}

.access-gate-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  width: min(400px, 100%);
  text-align: center;
  box-shadow: var(--shadow-xl);
}

.access-gate-icon {
  width: 64px;
  height: 64px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: var(--color-primary);
}

.access-gate-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.access-gate-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ------------------------------------------------------------
   20. TELA DE LOGIN
   ------------------------------------------------------------ */
.auth-page {
  min-height: 100vh;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  pointer-events: none;
}

.auth-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
  pointer-events: none;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  width: min(420px, 100%);
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
  animation: slideUp 0.4s ease;
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  color: #fff;
  font-size: 24px;
}

.auth-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* ------------------------------------------------------------
   21. PROGRESS BARS
   ------------------------------------------------------------ */
.progress-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--border-color);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
  background: var(--color-primary);
}

.progress-fill.success { background: var(--color-success); }
.progress-fill.danger  { background: var(--color-danger); }
.progress-fill.warning { background: var(--color-warning); }

.progress-bar.sm { height: 4px; }
.progress-bar.lg { height: 12px; }

/* Progress com label */
.progress-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.progress-label-text { color: var(--text-secondary); }
.progress-label-value { font-weight: 600; color: var(--text-primary); }

/* ------------------------------------------------------------
   22. GRÁFICOS CONTAINERS
   ------------------------------------------------------------ */
.chart-container {
  position: relative;
  width: 100%;
}

.chart-sm  { height: 200px; }
.chart-md  { height: 280px; }
.chart-lg  { height: 360px; }
.chart-xl  { height: 440px; }

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

.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

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

.chart-legend-line {
  width: 16px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ------------------------------------------------------------
   23. INSIGHTS IA
   ------------------------------------------------------------ */
.insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: var(--transition);
}

.insight-card:hover {
  border-color: var(--color-primary);
}

.insight-card.unread {
  border-left: 3px solid var(--color-primary);
}

.insight-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.insight-icon.tip     { background: rgba(99, 102, 241, 0.15); color: var(--color-primary); }
.insight-icon.alert   { background: rgba(239, 68, 68, 0.15); color: var(--color-danger); }
.insight-icon.success { background: rgba(16, 185, 129, 0.15); color: var(--color-success); }
.insight-icon.info    { background: rgba(59, 130, 246, 0.15); color: var(--color-info); }

.insight-content {
  flex: 1;
  min-width: 0;
}

.insight-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.insight-message {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ------------------------------------------------------------
   24. CLIENTES
   ------------------------------------------------------------ */
.client-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
  cursor: pointer;
}

.client-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow);
}

.client-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.client-info {
  flex: 1;
  min-width: 0;
}

.client-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-company {
  font-size: 12px;
  color: var(--text-muted);
}

.client-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.client-fee {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ------------------------------------------------------------
   25. METAS / GOALS
   ------------------------------------------------------------ */
.goal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
}

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.goal-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.goal-amounts {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 10px;
}

.goal-current {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.goal-separator {
  font-size: 14px;
  color: var(--text-muted);
}

.goal-target {
  font-size: 14px;
  color: var(--text-secondary);
}

.goal-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ------------------------------------------------------------
   26. NAVEGAÇÃO POR ABAS (TABS)
   ------------------------------------------------------------ */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  gap: 0;
  margin-bottom: 20px;
}

.tab-item {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}

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

.tab-item.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ------------------------------------------------------------
   27. MONTH PICKER / SELETOR DE MÊS
   ------------------------------------------------------------ */
.month-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 6px 10px;
}

.month-picker-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: var(--transition);
}

.month-picker-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.month-picker-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 120px;
  text-align: center;
}

/* ------------------------------------------------------------
   28. DROPDOWN MENU
   ------------------------------------------------------------ */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

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

.dropdown-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
}

.dropdown-item svg {
  width: 15px;
  height: 15px;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* ------------------------------------------------------------
   29. CONTAS BANCÁRIAS / CARTÕES (visual)
   ------------------------------------------------------------ */
.account-card-visual {
  background: linear-gradient(135deg, #1e293b, #334155);
  border-radius: 16px;
  padding: 20px;
  aspect-ratio: 1.586;
  position: relative;
  overflow: hidden;
  color: #fff;
}

.account-card-visual::before {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  top: -80px;
  right: -60px;
}

.account-card-visual.primary-card {
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
}

.account-card-visual.success-card {
  background: linear-gradient(135deg, var(--color-success), #059669);
}

.card-number {
  font-size: 14px;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.8);
  margin-top: auto;
  margin-bottom: 12px;
}

.card-balance {
  font-size: 24px;
  font-weight: 700;
}

/* ------------------------------------------------------------
   30. UTILS / HELPERS
   ------------------------------------------------------------ */
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-success   { color: var(--color-success); }
.text-danger    { color: var(--color-danger); }
.text-warning   { color: var(--color-warning); }
.text-info      { color: var(--color-info); }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 18px; }

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

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.d-flex   { display: flex; }
.flex-col { flex-direction: column; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.w-100 { width: 100%; }

.hidden    { display: none !important; }
.invisible { visibility: hidden; }

.truncate {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.divider {
  height: 1px;
  background: var(--border-color);
  margin: 20px 0;
}

/* Indicador de variação positiva/negativa */
.amount-positive { color: var(--color-success); font-weight: 600; }
.amount-negative { color: var(--color-danger);  font-weight: 600; }
.amount-neutral  { color: var(--text-primary); font-weight: 600; }

/* ------------------------------------------------------------
   31. ANIMAÇÕES
   ------------------------------------------------------------ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes slideOut {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(60px); opacity: 0; }
}

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

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

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.9); }
}

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0);   opacity: 0.4; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

.animate-fade-in  { animation: fadeIn  0.3s ease; }
.animate-slide-up { animation: slideUp 0.3s ease; }
.animate-slide-in { animation: slideIn 0.3s ease; }

/* ------------------------------------------------------------
   32. RESPONSIVIDADE — Tablet (≤ 1024px)
   ------------------------------------------------------------ */
@media (max-width: 1024px) {
  .cards-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row-3 {
    grid-template-columns: 1fr 1fr;
  }

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

/* ------------------------------------------------------------
   33. RESPONSIVIDADE — Mobile (≤ 768px)
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  /* Layout */
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 0 0 80px;
  }

  .header-mobile {
    display: flex;
  }

  .bottom-nav {
    display: flex;
  }

  /* Páginas */
  .content-area {
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }

  .page-title {
    font-size: 20px;
  }

  .page-header-actions {
    width: 100%;
  }

  /* KPI grid em coluna */
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .kpi-value {
    font-size: 22px;
  }

  /* Cards em coluna */
  .cards-grid-2,
  .cards-grid-3 {
    grid-template-columns: 1fr;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  /* Tabelas — viram cards no mobile */
  .table-wrapper {
    border: none;
    background: transparent;
  }

  .data-table thead {
    display: none;
  }

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

  .data-table tr {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    padding: 12px 16px;
  }

  .data-table tr:hover {
    background: var(--bg-card);
    border-color: var(--color-primary);
  }

  .data-table td {
    border: none;
    padding: 4px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .data-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    flex-shrink: 0;
  }

  .data-table .col-actions {
    justify-content: flex-end;
    text-align: right;
  }

  .data-table .col-actions::before {
    display: none;
  }

  /* Modais */
  .modal {
    width: 95vw;
    padding: 20px;
    max-height: 95vh;
    border-radius: 16px 16px 0 0;
  }

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

  /* Formulários */
  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  /* Chat */
  .chat-button {
    bottom: 76px;
  }

  .chat-panel {
    bottom: 76px;
    width: calc(100vw - 32px);
    right: 16px;
    height: calc(100vh - 160px);
    max-height: 500px;
  }

  /* Toasts */
  .toast-container {
    top: auto;
    bottom: 80px;
    right: 16px;
    left: 16px;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  /* Tabs */
  .tabs {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  /* Filters */
  .filters-bar {
    gap: 8px;
  }

  /* Month picker label curto */
  .month-picker-label {
    min-width: 100px;
    font-size: 13px;
  }
}

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

  .kpi-value {
    font-size: 20px;
  }

  .content-area {
    padding: 12px;
  }

  .card-body {
    padding: 14px;
  }
}

/* ------------------------------------------------------------
   34. TEMA CLARO — ajustes específicos
   ------------------------------------------------------------ */
[data-theme="light"] .sidebar {
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .kpi-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .data-table th {
  background: #f8fafc;
}

[data-theme="light"] .chat-button {
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
}

[data-theme="light"] .skeleton {
  background: linear-gradient(
    90deg,
    #e2e8f0 25%,
    #f1f5f9 50%,
    #e2e8f0 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Botão de alternância de tema */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  padding: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}
