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

/* ==========================================================================
   1. VARIÁVEIS E TEMAS (LIGHT / DARK)
   ========================================================================== */
:root {
  --color-slate-50: #F8FAFC;
  --color-slate-100: #F1F5F9;
  --color-slate-200: #E2E8F0;
  --color-slate-300: #CBD5E1;
  --color-slate-400: #94A3B8;
  --color-slate-500: #64748B;
  --color-slate-600: #475569;
  --color-slate-700: #334155;
  --color-slate-800: #1E293B;
  --color-slate-900: #0F172A;

  --color-primary: #4f46e5;
  --color-primary-hover: #3730a3;
  --color-primary-light: rgba(79, 70, 229, 0.1);

  --bs-primary: #4f46e5;
  --color-bg-app: #F3F4F6;
  --color-surface: #FFFFFF;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  --font-base: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', system-ui, sans-serif;
}

[data-theme="dark"] {
  --color-slate-50: #1e293b;
  --color-slate-100: #1e293b;
  --color-slate-200: rgba(255, 255, 255, 0.08);
  --color-slate-300: #475569;
  --color-slate-400: #64748b;
  --color-slate-500: #94a3b8;
  --color-slate-600: #cbd5e1;
  --color-slate-700: #e2e8f0;
  --color-slate-800: #f1f5f9;
  --color-slate-900: #ffffff;

  --color-primary-light: rgba(57, 3, 245, 0.15);
  --color-bg-app: #0f172a;
  --color-surface: #1e293b;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

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



body {
  font-family: var(--font-base);
  background-color: var(--color-slate-50) !important;
  color: var(--color-slate-800) !important;
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease, color 0.4s ease;
}

[data-theme="dark"] body {
  background-color: #0a0c10 !important;
  color: #e2e8f0 !important;
}

main {
  flex: 1;
  width: 100%;
  padding: 2rem 2.5rem 2rem 2.5rem;
  position: relative;
}

hr {
  border-color: var(--color-slate-200);
}

[data-theme="dark"] hr {
  border-color: rgba(255, 255, 255, 0.06);
}

/* Estilo global para scrollbars (invisível por padrão, mostra em hover) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
  transition: background 0.3s ease;
}

*:hover::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] *:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

/* Fallback Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.3s ease;
}

*:hover {
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

[data-theme="dark"] *:hover {
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* ==========================================================================
   3. TIPOGRAFIA E UTILS
   ========================================================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-slate-900);
  letter-spacing: -0.025em;
}

.text-primary {
  color: #4f46e5 !important;
}

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

[data-theme="dark"] .text-muted {
  color: #94a3b8 !important;
}

[data-theme="dark"] .text-primary {
  color: #c0abfd !important;
  text-shadow: 0 0 8px rgba(167, 139, 250, 0.2);
}

[data-theme="dark"] .border-primary-subtle {
  border-color: rgba(124, 114, 245, 0.3) !important;
}

[data-theme="dark"] .bg-light-subtle {
  background-color: transparent !important;
}

[data-theme="dark"] .bg-light {
  background-color: #1e293b !important;
}

/* Badge de Tipo de Movimentação de Estoque */
.movement-type-badge {
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
}

.type-entrada {
  background: rgba(16, 185, 129, 0.1);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.type-saida {
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.type-ajuste {
  background: rgba(245, 158, 11, 0.1);
  color: #F59E0B;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

[data-theme="dark"] .type-entrada {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .type-saida {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .type-ajuste {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

/* Estilos Plano de Contas (Categorias) */
.premium-card {
  background: var(--color-surface);
  border: 1px solid var(--color-slate-200);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

[data-theme="dark"] .premium-card {
  background: rgba(30, 41, 59, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

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

.badge-category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.725rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge-parent {
  background-color: rgba(57, 3, 245, 0.1);
  color: #3903F5 !important;
  border-color: rgba(57, 3, 245, 0.2);
}

[data-theme="dark"] .badge-parent {
  background-color: rgba(139, 92, 246, 0.15);
  color: #C084FC !important;
  border-color: rgba(139, 92, 246, 0.3);
}

.badge-child {
  background-color: rgba(16, 185, 129, 0.1);
  color: #059669 !important;
  border-color: rgba(16, 185, 129, 0.2);
}

[data-theme="dark"] .badge-child {
  background-color: rgba(52, 211, 153, 0.15);
  color: #34D399 !important;
  border-color: rgba(52, 211, 153, 0.3);
}

.tree-root-item {
  border-left: 4px solid var(--color-primary);
  margin-bottom: 1rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

[data-theme="dark"] .tree-root-item {
  border-left-color: #8b5cf6;
}

.tree-child-item {
  border-left: 2px dashed var(--color-slate-300);
  margin-left: 1.5rem;
  padding-left: 1.25rem;
  position: relative;
}

[data-theme="dark"] .tree-child-item {
  border-left-color: rgba(255, 255, 255, 0.15);
}

.tree-child-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 12px;
  height: 2px;
  border-top: 2px dashed var(--color-slate-300);
}

[data-theme="dark"] .tree-child-item::before {
  border-top-color: rgba(255, 255, 255, 0.15);
}

.tree-collapse-btn {
  background: none;
  border: none;
  color: var(--color-slate-500);
  font-size: 0.9rem;
  transition: transform 0.2s ease;
  cursor: pointer;
}

.tree-collapse-btn.collapsed {
  transform: rotate(-90deg);
}

.parent-select-container {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}

.parent-select-container.show {
  max-height: 120px;
  opacity: 1;
  margin-top: 1rem;
}

.icon-box {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.btn-action-danger {
  color: #EF4444;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-action-danger:hover {
  background: #EF4444;
  color: #fff !important;
  border-color: #EF4444;
  transform: scale(1.05);
}

[data-theme="dark"] .btn-action-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #F87171;
}

[data-theme="dark"] .btn-action-danger:hover {
  background: #EF4444;
  color: #fff !important;
  border-color: #EF4444;
}

.search-input-premium {
  border-radius: 8px;
  border: 1px solid var(--color-slate-300);
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  font-size: 0.9rem;
  background-color: var(--color-surface);
  color: var(--color-slate-800);
  transition: all 0.2s ease;
}

.search-input-premium:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(57, 3, 245, 0.15);
  outline: none;
}

.search-icon-pos {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-slate-400);
  pointer-events: none;
}

/* Estilos Dashboard Executivo Financeiro */
.financial-card {
  background: var(--color-surface);
  border: 1px solid var(--color-slate-200);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

[data-theme="dark"] .financial-card {
  background: rgba(30, 41, 59, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

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

.icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge-abc-a {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-abc-b {
  background: linear-gradient(135deg, #94A3B8 0%, #475569 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(148, 163, 184, 0.3);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.badge-abc-c {
  background: linear-gradient(135deg, #B45309 0%, #78350F 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.3);
  border: 1px solid rgba(180, 83, 9, 0.2);
}

@keyframes overduePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.badge-status-overdue {
  background-color: rgba(239, 68, 68, 0.15);
  color: #B91C1C !important;
  border-color: rgba(239, 68, 68, 0.4);
  animation: overduePulse 1.8s infinite;
}

[data-theme="dark"] .badge-status-overdue {
  color: #FCA5A5 !important;
}

.py-1-5 {
  padding-top: 0.375rem !important;
  padding-bottom: 0.375rem !important;
}

.js-btn-period {
  transition: all 0.2s ease;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-slate-600) !important;
}

.js-btn-period:hover {
  background-color: var(--color-slate-200);
  color: var(--color-slate-900) !important;
}

[data-theme="dark"] .js-btn-period {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .js-btn-period:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff !important;
}

.js-btn-period.active {
  background-color: var(--color-primary) !important;
  color: #ffffff !important;
  border-color: var(--color-primary) !important;
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .js-btn-period.active {
  background-color: #7c3aed !important;
  border-color: #7c3aed !important;
}

/* Badges de Contas Pagar / Receber */
.badge-status-pending {
  background-color: rgba(245, 158, 11, 0.15);
  color: #B45309 !important;
  border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .badge-status-pending {
  color: #FCD34D !important;
}

.badge-status-paid {
  background-color: rgba(16, 185, 129, 0.15);
  color: #047857 !important;
  border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .badge-status-paid {
  color: #34D399 !important;
}

.badge-status-partial {
  background-color: rgba(59, 130, 246, 0.15);
  color: #1D4ED8 !important;
  border-color: rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .badge-status-partial {
  color: #60A5FA !important;
}

.badge-status-voided {
  background-color: rgba(107, 114, 128, 0.15);
  color: #374151 !important;
  border-color: rgba(107, 114, 128, 0.3);
}

[data-theme="dark"] .badge-status-voided {
  color: #9CA3AF !important;
}

/* Nav Tabs Premium */
.nav-tabs-premium {
  border-bottom: 2px solid var(--color-slate-200);
  gap: 0.5rem;
}

[data-theme="dark"] .nav-tabs-premium {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.nav-tabs-premium .nav-link {
  border: none;
  color: var(--color-slate-500);
  font-weight: 600;
  font-family: var(--font-heading);
  padding: 0.8rem 1.5rem;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s ease;
  position: relative;
}

.nav-tabs-premium .nav-link:hover {
  color: var(--color-primary);
  background-color: var(--color-slate-100);
}

[data-theme="dark"] .nav-tabs-premium .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.nav-tabs-premium .nav-link.active {
  color: var(--color-primary) !important;
  background: transparent !important;
}

.nav-tabs-premium .nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: var(--color-primary);
  border-radius: 3px;
}

[data-theme="dark"] .nav-tabs-premium .nav-link.active {
  color: #a78bfa !important;
}

[data-theme="dark"] .nav-tabs-premium .nav-link.active::after {
  background-color: #a78bfa;
}

/* Botão de Pagamento/Baixa */
.btn-pay-action {
  background-color: var(--color-primary);
  color: #fff !important;
  border: none;
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-pay-action:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-pay-action:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

[data-theme="dark"] .btn-pay-action {
  background-color: #7c3aed;
}

[data-theme="dark"] .btn-pay-action:hover {
  background-color: #6d28d9;
}

/* Botão de Pagamento Expresso */
.btn-pay-express {
  background-color: rgba(16, 185, 129, 0.08);
  color: #10B981 !important;
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-pay-express:hover {
  background-color: #10B981;
  color: #fff !important;
  border-color: #10B981;
  transform: scale(1.05);
}

[data-theme="dark"] .btn-pay-express {
  background-color: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34D399;
}

[data-theme="dark"] .btn-pay-express:hover {
  background-color: #10B981;
  color: #fff !important;
}

/* ==========================================================================
   4. ANIMAÇÕES E TRANSIÇÕES DE TELA
   ========================================================================== */

/* ─── Efeito Mestre de Entrada de Página (Page Fade-In) ────────────────────
   Aplique a classe .view-page-transition no wrapper <div class="container-fluid…">
   de toda view operacional. A animação usa apenas opacity + translateY (composited
   layers) garantindo zero reflow e performance suave em 60fps.
   Proibido: @keyframes locais redundantes nos arquivos .ejs.
   ─────────────────────────────────────────────────────────────────────────── */
.view-page-transition {
  animation: pageFadeIn 0.4s ease-out forwards;
  will-change: opacity, transform;
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

/* ==========================================================================
   5. CONTAINERS E CARDS
   ========================================================================== */
/* Card de Navegação de Estoque (Inventory Header Cards) */
.inventory-nav-card {
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03) !important;
  transition: all 0.2s ease;
}

.active-header-card {
  border: 1.5px solid var(--color-primary) !important;
  background-color: rgba(57, 3, 245, 0.02) !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
}

.inventory-nav-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1) !important;
  background-color: var(--color-slate-50) !important;
}

.inventory-nav-card:active {
  transform: translateY(0);
}

.inventory-nav-card:hover .nav-icon {
  transform: scale(1.1);
  transition: transform 0.2s ease;
}

[data-theme='dark'] .inventory-nav-card {
  background-color: rgba(30, 41, 59, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.05);
}

[data-theme='dark'] .active-header-card {
  border-color: #a78bfa !important;
  background-color: rgba(124, 114, 245, 0.1) !important;
}

@media (max-width: 768px) {
  .inventory-header-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  .inventory-header-grid>.col-md-3 {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .inventory-nav-card {
    padding: 1rem 0.5rem !important;
    flex-direction: column;
    justify-content: center !important;
    text-align: center;
    gap: 8px;
  }

  .inventory-nav-card>.d-flex {
    flex-direction: column;
    gap: 8px !important;
  }

  .inventory-nav-card .fa-chevron-right {
    display: none;
  }

  .inventory-nav-card h6 {
    font-size: 0.8rem !important;
  }

  .inventory-nav-card small {
    font-size: 0.65rem !important;
  }
}

.glass-card {
  background: var(--color-surface);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-slate-200);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

[data-theme="dark"] .glass-card {
  background: rgba(30, 41, 59, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

/* CARDS DO DASHBOARD DE ESTOQUE */
.dash-card {
  background: var(--color-surface);
  border: 1px solid var(--color-slate-200);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

[data-theme="dark"] .dash-card {
  background: rgba(30, 41, 59, 0.5) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

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

.dash-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

/* CARDS DE ESTATÍSTICA (ESTOQUE/VENDAS) */
.inventory-stat-card {
  background: var(--color-surface);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  border: 1px solid var(--color-slate-200);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.inventory-stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.inventory-stat-card .icon-box {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.inventory-stat-card .stat-content .label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-slate-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.inventory-stat-card .stat-content .value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-slate-900);
  margin: 0;
}

/* Força a cor da borda no card se tiver a classe do bootstrap */
.inventory-stat-card.border-warning {
  border-color: #F59E0B !important;
}

.inventory-stat-card.border-danger {
  border-color: #EF4444 !important;
}

.inventory-stat-card.border-success {
  border-color: #10B981 !important;
}

[data-theme="dark"] .inventory-stat-card {
  background: rgba(30, 41, 59, 0.5) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

[data-theme="dark"] .inventory-stat-card .stat-content .value {
  color: #f8fafc;
}

[data-theme="dark"] .inventory-stat-card.border-warning {
  border-color: rgba(245, 158, 11, 0.4) !important;
}

[data-theme="dark"] .inventory-stat-card.border-danger {
  border-color: rgba(239, 68, 68, 0.4) !important;
}

[data-theme="dark"] .inventory-stat-card.border-success {
  border-color: rgba(16, 185, 129, 0.4) !important;
}

/* SISTEMA DE ORÇAMENTO (BUDGET) */
.fade-in-up {
  opacity: 0;
  transform: translateY(15px);
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.glass-card-budget {
  background: var(--color-surface);
  border: 1px solid var(--color-slate-200);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .glass-card-budget {
  background: rgba(30, 41, 59, 0.5) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

.glass-card-budget:hover {
  box-shadow: var(--shadow-md);
}

.tree-node-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1.25rem;
  border-radius: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-slate-200);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 0.5rem;
}

[data-theme="dark"] .tree-node-row {
  background: rgba(30, 41, 59, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

.tree-node-row:hover {
  border-color: var(--color-primary);
  transform: translateX(3px);
  box-shadow: 0 4px 12px rgba(57, 3, 245, 0.12);
}

.tree-node-children {
  transition: max-height 0.3s ease-out, opacity 0.25s ease-out;
  overflow: hidden;
}

.tree-node-children.collapsed {
  display: none !important;
}

.collapse-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.collapse-toggle:hover {
  background-color: rgba(57, 3, 245, 0.12);
  color: var(--color-primary) !important;
}

.node-actions .btn-action {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-slate-200);
  background: transparent;
  color: var(--color-slate-500);
  transition: all 0.2s ease;
}

[data-theme="dark"] .node-actions .btn-action {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

.node-actions .btn-action:hover {
  background-color: rgba(57, 3, 245, 0.12);
  color: var(--color-primary);
  border-color: var(--color-primary);
  transform: scale(1.05);
}

.node-actions .btn-delete:hover {
  background-color: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border-color: #ef4444;
}

.badge-budget {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 50px;
}

.performance-card {
  border-left: 4px solid var(--color-primary);
}

.progress-micro {
  height: 6px;
  border-radius: 50px;
  overflow: hidden;
  background-color: var(--color-slate-200);
}

[data-theme="dark"] .progress-micro {
  background-color: rgba(255, 255, 255, 0.08);
}

.progress-micro-bar {
  height: 100%;
  border-radius: 50px;
  transition: width 0.6s ease;
}

.form-select-cr {
  border: 1px solid var(--color-slate-300);
  background-color: var(--color-surface);
  color: var(--color-slate-800);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  transition: all 0.2s ease;
}

[data-theme="dark"] .form-select-cr {
  border-color: rgba(255, 255, 255, 0.1);
  background-color: #0f172a;
  color: #e2e8f0;
}

.form-select-cr:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(57, 3, 245, 0.15);
  outline: none;
}

/* Dashboard de Orçamento (Budget Dashboard) */
.glass-card-bd {
  background: var(--color-surface);
  border: 1px solid var(--color-slate-200);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .glass-card-bd {
  background: rgba(30, 41, 59, 0.5) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

.glass-card-bd:hover {
  box-shadow: var(--shadow-md);
}

.kpi-card {
  padding: 1.5rem;
  border-radius: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-slate-200);
  transition: all 0.3s ease;
}

[data-theme="dark"] .kpi-card {
  background: rgba(30, 41, 59, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

.kpi-card:hover {
  transform: translateY(-3px);
}

.kpi-orçado {
  border-left: 5px solid var(--color-primary);
}

.kpi-orçado:hover {
  box-shadow: 0 10px 25px rgba(57, 3, 245, 0.15);
}

.kpi-realizado {
  border-left: 5px solid #ef4444;
}

.kpi-realizado:hover {
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.15);
}

.kpi-restante {
  border-left: 5px solid #10b981;
}

.kpi-restante.overspent {
  border-left: 5px solid #ef4444;
}

.kpi-restante:hover {
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.15);
}

.kpi-restante.overspent:hover {
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.15);
}

.progress-container {
  height: 12px;
  border-radius: 50px;
  background-color: var(--color-slate-200);
  overflow: hidden;
  position: relative;
}

[data-theme="dark"] .progress-container {
  background-color: rgba(255, 255, 255, 0.08);
}

.progress-bar-fill {
  height: 100%;
  border-radius: 50px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.4s ease;
}

.bar-green {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.bar-yellow {
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.bar-red-pulse {
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
  animation: pulseRed 1.8s infinite ease-in-out;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

@keyframes pulseRed {
  0% {
    opacity: 0.85;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.3);
  }

  50% {
    opacity: 1;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.6);
  }

  100% {
    opacity: 0.85;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.3);
  }
}

.btn-period-filter {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--color-slate-200);
  background: var(--color-surface);
  color: var(--color-slate-500);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .btn-period-filter {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(30, 41, 59, 0.3);
}

.btn-period-filter:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background-color: rgba(57, 3, 245, 0.12);
}

.btn-period-filter.active {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: #ffffff !important;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(57, 3, 245, 0.15);
}

.meta-list-card {
  border-left: 5px solid transparent;
  transition: all 0.3s ease;
}

.meta-list-card:hover {
  border-left: 5px solid var(--color-primary);
  transform: translateX(4px);
}

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

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

.badge-red-pulse {
  background-color: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  animation: pulseText 1.5s infinite ease-in-out;
}

@keyframes pulseText {
  0% {
    opacity: 0.8;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.8;
  }
}

.empty-state-container {
  padding: 4rem 2rem;
  text-align: center;
}

.empty-state-icon {
  font-size: 3.5rem;
  color: var(--color-slate-400);
  margin-bottom: 1.5rem;
  animation: pulseIcon 2s infinite ease-in-out;
}

@keyframes pulseIcon {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }

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

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


/* CASH REGISTER STYLING */
.glass-card-cr {
  background: var(--color-surface);
  border: 1px solid var(--color-slate-200);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}

[data-theme="dark"] .glass-card-cr {
  background: rgba(30, 41, 59, 0.5) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

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

.stats-card-cr {
  border-radius: 12px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--color-slate-200);
  background: var(--color-surface);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .stats-card-cr {
  background: rgba(30, 41, 59, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

.stats-card-cr:hover {
  transform: translateY(-4px);
}

.stats-card-opening {
  border-left: 5px solid #0ea5e9;
}

.stats-card-opening:hover {
  box-shadow: 0 15px 35px rgba(14, 165, 233, 0.15);
}

.stats-card-inflow {
  border-left: 5px solid #10b981;
}

.stats-card-inflow:hover {
  box-shadow: 0 15px 35px rgba(16, 185, 129, 0.15);
}

.stats-card-outflow {
  border-left: 5px solid #ef4444;
}

.stats-card-outflow:hover {
  box-shadow: 0 15px 35px rgba(239, 68, 68, 0.15);
}

.stats-card-balance {
  border-left: 5px solid var(--color-primary);
}

.stats-card-balance:hover {
  box-shadow: 0 15px 35px rgba(57, 3, 245, 0.15);
}

.stats-icon-wrap-cr {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: transform 0.3s ease;
}

.stats-card-cr:hover .stats-icon-wrap-cr {
  transform: scale(1.1) rotate(5deg);
}

/* ==========================================================================
   5. FORMS E INPUTS
   ========================================================================== */
.form-label {
  font-weight: 500;
  color: var(--color-slate-700);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.form-control,
.form-select {
  border-radius: 4px;
  border: 1px solid var(--color-slate-300);
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  color: var(--color-slate-800);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(57, 3, 245, 0.15);
  outline: none;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: #0f172a;
  border-color: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

[data-theme="dark"] .form-select option {
  background-color: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .form-control::placeholder {
  color: #475569;
}

[data-theme="dark"] .input-group-text {
  background-color: #1e293b;
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

.form-input-cr {
  border: 1px solid var(--color-slate-200);
  background-color: var(--color-surface);
  color: var(--color-slate-800);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.form-input-cr:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
  outline: none;
}

[data-theme="dark"] .form-input-cr {
  border-color: rgba(255, 255, 255, 0.1);
  background-color: #0f172a;
  color: #e2e8f0;
}


/* ==========================================================================
   6. BOTÕES E BADGES
   ========================================================================== */
.btn,
.btn-primary,
.btn-light,
.btn-outline-slate,
.badge,
.action-btn {
  font-family: var(--font-heading);
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
  border: none !important;
  color: #fff !important;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #5a51e6 0%, #4338ca 100%) !important;
  box-shadow: 0 6px 14px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

.btn-outline-slate {
  border: 1px solid var(--color-slate-400) !important;
  color: var(--color-slate-800) !important;
  background: var(--color-surface);
  font-weight: 700;
  transition: all 0.2s ease;
  border-radius: 4px !important;
}

.btn-outline-slate:hover {
  background: var(--color-slate-100) !important;
}

[data-theme="dark"] .btn-outline-slate {
  border-color: var(--color-slate-500) !important;
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .btn-outline-slate:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

.btn-mobile-100 {
  width: 100%;
}

@media (min-width: 576px) {
  .btn-mobile-100 {
    width: auto !important;
  }
}

/* Ações nas Tabelas */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--color-slate-500);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background-color: var(--color-slate-100);
  color: var(--color-primary);
}

.btn-premium-action {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--color-slate-200);
  background: var(--color-surface);
  color: var(--color-slate-600);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

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

[data-theme="dark"] .btn-premium-action {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

[data-theme="dark"] .btn-premium-action:hover {
  background: #0f172a;
  color: #ffffff;
  border-color: var(--color-primary);
}

/* Badges */
[data-theme="dark"] .badge {
  font-weight: 700;
  letter-spacing: 0.3px;
}

[data-theme="dark"] .bg-primary-subtle {
  background-color: rgba(124, 114, 245, 0.15) !important;
}

[data-theme="dark"] .bg-warning-subtle {
  background-color: rgba(245, 158, 11, 0.15) !important;
}

[data-theme="dark"] .bg-danger-subtle {
  background-color: rgba(239, 68, 68, 0.15) !important;
}

[data-theme="dark"] .bg-success-subtle {
  background-color: rgba(16, 185, 129, 0.15) !important;
}

[data-theme="dark"] .bg-secondary-subtle {
  background-color: rgba(148, 163, 184, 0.15) !important;
}

/* ===== BADGES PADRONIZADOS (ESTOQUE / STATUS / FAMÍLIA) ===== */
.badge-standard {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* CORREÇÃO: Conteúdo agora é 100% centrado */
  min-width: 130px;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-standard i {
  margin-right: 8px;
  font-size: 0.85rem;
}

.badge-warning-custom {
  background-color: rgba(245, 158, 11, 0.15);
  color: #B45309 !important;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .badge-warning-custom {
  color: #FCD34D !important;
}

/* CORREÇÃO: Badge de família mais forte e contrastante */
.badge-family-custom {
  background-color: var(--color-slate-200);
  /* Fundo um pouco mais presente */
  color: var(--color-slate-800);
  /* Letra bem escura */
  border: 1px solid var(--color-slate-300);
}

[data-theme="dark"] .badge-family-custom {
  background-color: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  /* Letra branca radiante no dark */
  border-color: rgba(255, 255, 255, 0.2);
}

/* ===== VALORES MONETÁRIOS (TABELAS) ===== */
.text-cost-price {
  color: var(--color-slate-600);
  font-family: 'Inter', monospace;
  font-weight: 700;
  /* Mais forte */
}

[data-theme="dark"] .text-cost-price {
  color: var(--color-slate-300);
}

.text-sale-price {
  color: var(--color-primary);
  font-family: 'Inter', monospace;
  font-weight: 800;
  /* Destaque máximo */
  font-size: 0.95rem;
  /* Ligeiramente maior */
}

[data-theme="dark"] .text-sale-price {
  color: #a78bfa !important;
  /* Lilás suave que brilha perfeitamente no fundo escuro */
}

/* Botão Flutuante Mobile */
.mobile-fab-btn {
  position: fixed;
  bottom: 85px;
  right: 20px;
  width: 56px;
  height: 56px;
  background-color: var(--color-primary);
  color: #ffffff !important;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 15px rgba(57, 3, 245, 0.4);
  text-decoration: none !important;
  z-index: 999;
}

.mobile-fab-btn:active {
  transform: scale(0.92);
}

[data-theme="dark"] .mobile-fab-btn {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  border: 2px solid #131620;
}

/* Cash Register Badges & Status Pills */
.cr-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 50px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.badge-payment {
  background-color: rgba(16, 185, 129, 0.1);
  color: #059669;
}

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

.badge-adjustment {
  background-color: rgba(245, 158, 11, 0.1);
  color: #b45309;
}

.status-pill {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 50px;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.status-pill-open {
  background-color: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-pill-closed {
  background-color: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  animation: pulseActive 1.5s infinite ease-in-out;
}

@keyframes pulseActive {
  0% {
    transform: scale(0.9);
    opacity: 0.6;
  }

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

  100% {
    transform: scale(0.9);
    opacity: 0.6;
  }
}

.amount-inflow {
  color: #10b981;
  font-weight: 700;
}

.amount-outflow {
  color: #ef4444;
  font-weight: 700;
}

/* ==========================================================================
   7. TABELAS E ORDENAÇÃO (DESKTOP)
   ========================================================================== */
/* CSS Mágico Global: Remove border-radius de qualquer container, wrapper ou card que contenha uma tabela premium */
.glass-card:has(.table-premium),
.glass-card-cr:has(.table-premium),
.premium-card:has(.table-premium),
.table-responsive,
.table-premium {
  border-radius: 0px !important;
}

.table-premium {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
  border-radius: 0px !important;
}

.table-premium thead tr {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
  border-radius: 0px !important;
}

.table-premium th {
  background: transparent !important;
  color: #ffffff !important;
  border-bottom: none !important;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  padding: 0.9rem;
  border-radius: 0px !important;
}

.table-premium td {
  border-bottom: 1px solid var(--color-slate-200);
  vertical-align: middle;
  padding: 0.9rem;
  font-size: 0.85rem;
  border-radius: 0px !important;
}

.table-premium tbody tr {
  transition: background-color 0.2s ease;
}

.table-premium tbody tr:hover {
  background-color: var(--color-slate-50);
}

[data-theme="dark"] .table-premium {
  background-color: transparent !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .table-premium thead tr {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f0b29 100%) !important;
}

[data-theme="dark"] .table-premium th {
  background: transparent !important;
  color: #ffffff !important;
}

[data-theme="dark"] .table-premium tbody tr {
  background-color: transparent !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] .table-premium tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02) !important;
}

[data-theme="dark"] .table-premium td {
  background-color: transparent !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: inherit !important;
}

.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 0.15s;
}

.sortable-th:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .sortable-th:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
}

.sort-icon {
  margin-left: 8px;
  font-size: 0.7rem;
  vertical-align: middle;
  opacity: 0.4;
  color: rgba(255, 255, 255, 0.6) !important;
}

.sortable-th[data-sort-dir="asc"] .sort-icon,
.sortable-th[data-sort-dir="desc"] .sort-icon {
  opacity: 1;
  color: #ffffff !important;
}

[data-theme="dark"] .sortable-th[data-sort-dir="asc"] .sort-icon,
[data-theme="dark"] .sortable-th[data-sort-dir="desc"] .sort-icon {
  opacity: 1;
  color: #ffffff !important;
}

/* ==========================================================================
   8. MODAIS E DIÁLOGOS
   ========================================================================== */
/* Modais Padrão (Bootstrap) */
.modal-title {
  color: var(--color-slate-900);
}

.modal-header.bg-primary,
.modal-header.bg-light-subtle {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
  border: none !important;
}

.modal-header.bg-primary .modal-title,
.modal-header.bg-light-subtle .modal-title {
  color: #ffffff !important;
}

.modal-header.bg-primary .btn-close,
.modal-header.bg-light-subtle .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%) !important;
}

[data-theme="dark"] .modal-content {
  background: rgba(30, 41, 59, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .modal-header {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f0b29 100%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .modal-header.bg-primary,
[data-theme="dark"] .modal-header.bg-light-subtle {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f0b29 100%) !important;
}

[data-theme="dark"] .modal-title {
  color: #ffffff;
}

[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f0b29 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .btn-primary:hover {
  background: linear-gradient(135deg, #2e2a75 0%, #171340 100%) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}

/* Custom Confirm Dialog (Núcleo) - Overlay e Base */
.nucleo-confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.nucleo-confirm-overlay.open {
  opacity: 1;
  visibility: visible;
}

.nucleo-confirm-modal {
  background: var(--color-surface);
  border: 1px solid var(--color-slate-200);
  border-radius: 1.25rem;
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nucleo-confirm-overlay.open .nucleo-confirm-modal {
  transform: scale(1);
}

/* Custom Confirm Dialog (Núcleo) - Elementos Internos */
.nucleo-confirm-icon {
  width: 64px;
  height: 64px;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  font-size: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin: 0 auto 1.5rem;
}

.nucleo-confirm-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-slate-900);
  margin-bottom: 0.75rem;
}

.nucleo-confirm-text {
  font-size: 0.95rem;
  color: var(--color-slate-500);
  margin-bottom: 2rem;
  line-height: 1.5;
}

.nucleo-confirm-actions {
  display: flex;
  gap: 1rem;
}

.nucleo-confirm-btn {
  flex: 1;
  padding: 0.75rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.nucleo-confirm-btn-cancel {
  background: transparent;
  border: 1px solid var(--color-slate-200);
  color: var(--color-slate-700);
}

.nucleo-confirm-btn-cancel:hover {
  background: var(--color-slate-100);
}

.nucleo-confirm-btn-danger {
  background: #ef4444;
  border: 1px solid #ef4444;
  color: #fff;
}

.nucleo-confirm-btn-danger:hover {
  background: #dc2626;
}

/* Custom Confirm Dialog (Núcleo) - Dark Mode */
[data-theme="dark"] .nucleo-confirm-title {
  color: #f8fafc;
}

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

[data-theme="dark"] .nucleo-confirm-btn-cancel {
  border-color: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

[data-theme="dark"] .nucleo-confirm-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc;
}

/* ==========================================================================
   9. PREFERENCES TOOLBAR (DESKTOP)
   ========================================================================== */
.prefs-toolbar {
  display: none !important;
}

[data-theme="dark"] .prefs-toolbar {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.prefs-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--color-slate-500);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 0.88rem;
}

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

[data-theme="dark"] .prefs-btn:hover {
  background: rgba(57, 3, 245, 0.15);
  color: #a78bfa;
}

.prefs-lang-dropdown {
  position: relative;
}

.prefs-lang-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-slate-200);
  border-radius: 10px;
  padding: 4px;
  min-width: 120px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1001;
}

[data-theme="dark"] .prefs-lang-menu {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
}

.prefs-lang-dropdown.open .prefs-lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.prefs-lang-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-slate-700);
  transition: all 0.2s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.prefs-lang-option:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

[data-theme="dark"] .prefs-lang-option:hover {
  background: rgba(57, 3, 245, 0.12);
  color: #a78bfa;
}

.prefs-lang-option.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
}

[data-theme="dark"] .prefs-lang-option.active {
  background: rgba(57, 3, 245, 0.15);
  color: #a78bfa;
}

/* ===== ERP FOOTER ===== */
.erp-footer {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
  border-top: none !important;
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  z-index: 1000;
  height: 63px;
  display: flex;
  align-items: center;
  padding-left: 82px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  transition: padding-left 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s ease, border-color 0.4s ease;
}

.erp-footer span.text-muted {
  color: rgba(255, 255, 255, 0.8) !important;
  font-weight: 500;
}

.erp-footer a {
  color: rgba(255, 255, 255, 0.8) !important;
  font-weight: 600;
  transition: color 0.2s ease;
}

.erp-footer a:hover {
  color: #ffffff !important;
}

[data-theme="dark"] .erp-footer {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f0b29 100%) !important;
}

body:not(.sidebar-closed) .erp-footer,
#sidebar.open-sidebar~#app-layout-wrapper .erp-footer {
  padding-left: 280px;
}

.erp-footer .container-fluid>span.text-muted {
  margin-left: 1.5rem;
}

/* ===== APP LAYOUT WRAPPER ===== */
#app-layout-wrapper {
  padding-bottom: 75px !important;
  overflow-x: hidden;
}

/* ===== UTILS & MODALS ===== */
.rounded-xl {
  border-radius: 8px !important;
}

/* ===== BADGES DINÂMICOS DAS EMPRESAS ===== */
.badge-company-dynamic {
  background: hsla(var(--company-hue), 70%, 50%, 0.1);
  color: hsl(var(--company-hue), 70%, 40%);
  border: 1px solid hsla(var(--company-hue), 70%, 40%, 0.2);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}

[data-theme="dark"] .badge-company-dynamic {
  background: hsla(var(--company-hue), 60%, 50%, 0.15);
  color: hsl(var(--company-hue), 80%, 85%);
  border-color: hsla(var(--company-hue), 60%, 60%, 0.3);
}

.avatar-company-dynamic {
  background: hsl(var(--company-hue), 70%, 40%);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  margin-right: 8px;
}

/* ===== BADGES DE PERFIS E ACESSOS ===== */
.badge-role {
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-block;
}

.badge-role.admin {
  background: rgba(57, 3, 245, 0.1);
  color: #3903F5;
  border: 1px solid rgba(57, 3, 245, 0.2);
}

[data-theme="dark"] .badge-role.admin {
  background: rgba(124, 114, 245, 0.15);
  color: #d8b4fe;
  border-color: rgba(124, 114, 245, 0.3);
}

.badge-role.user {
  background: rgba(100, 116, 139, 0.1);
  color: #475569;
  border: 1px solid rgba(100, 116, 139, 0.2);
}

[data-theme="dark"] .badge-role.user {
  background: rgba(148, 163, 184, 0.15);
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.3);
}

.avatar-sm {
  background: rgba(57, 3, 245, 0.1) !important;
  color: var(--color-primary) !important;
}

[data-theme="dark"] .avatar-sm {
  background: rgba(124, 114, 245, 0.15) !important;
  color: #c4b5fd !important;
}

/* ==========================================================================
   10. RESPONSIVIDADE MOBILE-FIRST
   ========================================================================== */
@media (max-width: 768px) {
  .desktop-actions {
    display: none !important;
  }

  .page-header-mobile {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .table-premium td .avatar-company-dynamic {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
    margin-right: 0;
    border-radius: 12px;
  }

  .table-premium tbody td .avatar-sm {
    width: 56px !important;
    height: 56px !important;
    font-size: 1.3rem;
  }

  #prefsToolbar {
    display: none !important;
  }

  .erp-footer,
  .main-header {
    display: none !important;
  }

  main {
    padding: 4.5rem 8px 1rem 8px;
  }

  .glass-card {
    padding: 1rem;
  }

  .btn,
  .form-control,
  .form-select,
  .action-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .form-control,
  .form-select {
    padding: 0.6rem 1rem;
    justify-content: flex-start;
  }

  /* Transformação em Cards no Mobile */
  .table-premium thead {
    display: none !important;
  }

  .table-premium tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .table-premium tbody tr {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--color-surface);
    border: 2px solid var(--color-slate-200);
    border-radius: 0px !important;
    padding: 1.25rem 1rem;
    position: relative;
  }

  .table-premium.collapsible-mobile tbody tr {
    padding-bottom: 3.5rem !important;
  }

  /* Fontes mais fortes no card mobile */
  .table-premium td .fw-semibold {
    font-weight: 800 !important;
    font-size: 1.05rem;
  }

  /* MÁGICA RECUPERADA: Oculta as colunas extras até clicar em Ver Mais */
  .table-premium.collapsible-mobile tbody tr:not(.mobile-expanded) td.collapsible-td {
    display: none !important;
  }

  [data-theme="dark"] .table-premium tbody tr {
    background: rgba(30, 41, 59, 0.4) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
  }

  .table-premium td {
    display: block;
    width: 100%;
    justify-content: center !important;
    text-align: center !important;
    border: none !important;
    padding: 0.4rem 0 !important;
  }

  .table-premium td::before {
    display: none !important;
  }

  .table-premium td .d-flex,
  .table-premium td .d-inline-flex {
    justify-content: center !important;
    text-align: center !important;
  }

  /* ID Flutuante */
  .table-premium td:first-child {
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: auto;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.2rem 0.6rem !important;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
  }

  [data-theme="dark"] .table-premium td:first-child {
    background: rgba(255, 255, 255, 0.08);
  }

  /* Linha pontilhada das Ações e espaçamento */
  .table-premium td:last-child .d-flex,
  .table-premium td:last-child .d-inline-flex {
    justify-content: center !important;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--color-slate-200);
    width: 100%;
    gap: 1.25rem !important;
    /* CORREÇÃO: Aumenta o espaço entre o botão de estoque e edição no celular */
  }

  [data-theme="dark"] .table-premium td:last-child .d-flex,
  [data-theme="dark"] .table-premium td:last-child .d-inline-flex {
    border-top-color: rgba(255, 255, 255, 0.1);
  }

  /* Botão de Ver Mais (Collapsible) */
  .mobile-toggle-row-btn {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: var(--color-slate-50);
    color: var(--color-slate-500);
    border: none;
    border-top: 1px solid var(--color-slate-100);
    border-radius: 0px !important;
    font-size: 0.85rem;
    font-weight: 700;
  }

  [data-theme="dark"] .mobile-toggle-row-btn {
    background: rgba(255, 255, 255, 0.02);
    border-top-color: rgba(255, 255, 255, 0.08);
    color: var(--color-slate-300);
  }
}

/* ===== FINANCIAL DASHBOARD COMPONENT STYLES ===== */
.financial-card {
  background: var(--color-surface);
  border: 1px solid var(--color-slate-200);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

[data-theme="dark"] .financial-card {
  background: rgba(30, 41, 59, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

.icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* DRE Period Buttons Styling */
.dre-table-btn-group,
.btn-group.border.rounded-3 {
  background: var(--color-slate-100) !important;
  border: 1px solid var(--color-slate-200) !important;
  border-radius: 10px !important;
  padding: 2px !important;
}

[data-theme="dark"] .btn-group.border.rounded-3 {
  background: rgba(15, 23, 42, 0.6) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

.js-btn-period {
  color: var(--color-slate-700) !important;
  font-weight: 600;
  font-size: 0.85rem !important;
  padding: 0.5rem 1rem !important;
  border-radius: 8px !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer;
}

.js-btn-period:hover {
  background: rgba(79, 70, 229, 0.05) !important;
}

.js-btn-period.active,
.js-btn-period.active:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25) !important;
}

[data-theme="dark"] .js-btn-period {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .js-btn-period:hover {
  background: rgba(167, 139, 250, 0.1) !important;
}

[data-theme="dark"] .js-btn-period.active,
[data-theme="dark"] .js-btn-period.active:hover {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f0b29 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
}

/* Glass Card Ledger for Discrepancy & Shift Audit */
.glass-card-ledger {
  background: var(--color-surface);
  border: 1px solid var(--color-slate-200) !important;
  border-radius: 16px;
}

[data-theme="dark"] .glass-card-ledger {
  background: rgba(30, 41, 59, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

/* Stats Icon inside consolidated DRE discrepancy banner */
.stats-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* LEDGER TABLE DARK MODE DEFAULTS */
[data-theme="dark"] .ledger-table {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .ledger-row:hover {
  background-color: rgba(255, 255, 255, 0.02) !important;
}