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

/* ===== CSS Variables / Design Tokens — EloContábil Dark Theme ===== */
:root {
  --bg-primary: #0a0f1a;
  --bg-secondary: #111827;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(6, 182, 212, 0.06);
  --bg-card-solid: #151e2d;
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-sidebar: #060b14;
  --bg-modal: rgba(0, 0, 0, 0.7);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-white: #ffffff;

  --accent-primary: #06b6d4;
  --accent-primary-hover: #22d3ee;
  --accent-secondary: #0ea5e9;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-success: #10b981;
  --accent-info: #38bdf8;

  --gradient-primary: linear-gradient(135deg, #06b6d4 0%, #0ea5e9 100%);
  --gradient-secondary: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  --gradient-accent: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
  --gradient-card: linear-gradient(145deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
  --gradient-danger: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
  --gradient-dark-radial: radial-gradient(ellipse at 20% 50%, rgba(6,182,212,0.08) 0%, transparent 60%);

  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 4px 20px rgba(6, 182, 212, 0.25);
  --shadow-glow-sm: 0 2px 10px rgba(6, 182, 212, 0.15);

  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(12px);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-full: 50%;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
}

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

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

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

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

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

::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(6, 182, 212, 0.5);
}

/* ===== Layout ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-primary);
  background-image: var(--gradient-dark-radial);
}

.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 2rem 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: var(--transition);
  backdrop-filter: blur(16px);
  background-image: linear-gradient(180deg, #060b14 0%, #0a1020 50%, #060b14 100%);
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(6,182,212,0.2), transparent);
}

.sidebar-header {
  padding: 0 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo .logo-icon {
  width: 42px;
  height: 42px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: var(--shadow-glow);
}

.sidebar-logo h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  font-family: var(--font-heading);
  letter-spacing: -0.3px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-logo p {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 0;
  overflow-y: auto;
}

.nav-section {
  padding: 0 1rem;
  margin-bottom: 1.5rem;
}

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
}

.nav-item:hover {
  background: rgba(6, 182, 212, 0.08);
  color: var(--accent-primary-hover);
}

.nav-item.active {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-primary);
  box-shadow: inset 3px 0 0 var(--accent-primary);
  font-weight: 600;
}

.nav-item .nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.user-info:hover {
  background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #ffffff;
}

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

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

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 2rem;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
  font-family: var(--font-heading);
  letter-spacing: -0.5px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== Cards (Glassmorphism) ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

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

.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(6, 182, 212, 0.2);
  box-shadow: var(--shadow-glow-sm);
  background: var(--bg-card-hover);
}

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

.stat-card.accent-green::before {
  background: var(--gradient-secondary);
}

.stat-card.accent-green:hover {
  border-color: rgba(16, 185, 129, 0.2);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.15);
}

.stat-card.accent-warning::before {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-card.accent-warning:hover {
  border-color: rgba(245, 158, 11, 0.2);
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.15);
}

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

.stat-card.accent-danger:hover {
  border-color: rgba(239, 68, 68, 0.2);
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.15);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.stat-icon {
  width: 44px;
  height: 44px;
  background: rgba(6, 182, 212, 0.1);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.stat-card.accent-green .stat-icon {
  background: rgba(16, 185, 129, 0.1);
}

.stat-card.accent-warning .stat-icon {
  background: rgba(245, 158, 11, 0.1);
}

.stat-card.accent-danger .stat-icon {
  background: rgba(239, 68, 68, 0.1);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  font-family: var(--font-heading);
  letter-spacing: -0.5px;
}

.stat-change {
  font-size: 0.75rem;
  color: var(--accent-success);
  margin-top: 0.25rem;
}

/* ===== Charts ===== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.chart-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
}

.chart-card:hover {
  border-color: rgba(6, 182, 212, 0.15);
}

.chart-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-family: var(--font-heading);
}

.chart-container {
  height: 250px;
  position: relative;
}

/* ===== Select Dropdown Fix (Dark Theme) ===== */
select.form-input,
.form-select {
  appearance: auto;
  -webkit-appearance: auto;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

select.form-input option,
.form-select option {
  background: #1e293b;
  color: #f1f5f9;
  padding: 0.5rem;
}

select.form-input optgroup,
.form-select optgroup {
  background: #1e293b;
  color: #94a3b8;
  font-style: normal;
}

[data-theme="light"] select.form-input,
[data-theme="light"] .form-select {
  background-color: #ffffff;
  color: #0f172a;
}

[data-theme="light"] select.form-input option,
[data-theme="light"] .form-select option {
  background: #ffffff;
  color: #0f172a;
}

[data-theme="light"] select.form-input optgroup,
[data-theme="light"] .form-select optgroup {
  background: #ffffff;
  color: #64748b;
}

/* ===== Tab Bar (Fluxo de Caixa) ===== */
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--border-color);
}

.tab-bar .btn {
  flex: 1;
  border-radius: 0;
  padding: 0.85rem 1rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}

.tab-bar .btn:hover {
  color: var(--accent-primary);
  background: rgba(6, 182, 212, 0.04);
}

.tab-bar .btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  font-weight: 600;
}

/* ===== Tables ===== */
.table-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.table-title {
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-heading);
  color: var(--text-primary);
}

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

.data-table thead th {
  padding: 0.85rem 1.5rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
}

.data-table tbody td {
  padding: 0.85rem 1.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition-fast);
}

.data-table tbody tr:hover td {
  background: rgba(6, 182, 212, 0.04);
  color: var(--text-primary);
}

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

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-primary);
}

.badge-success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-warning);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-danger);
}

.badge-info {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-info);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  text-decoration: none;
  color: var(--text-secondary);
}

.btn-primary {
  background: var(--gradient-primary);
  color: #0a0f1a;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
  font-weight: 700;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(6, 182, 212, 0.45);
  color: #0a0f1a;
}

.btn-secondary {
  background: rgba(6, 182, 212, 0.08);
  color: var(--accent-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.3);
  color: var(--accent-primary-hover);
}

.btn-success {
  background: var(--gradient-secondary);
  color: #0a0f1a;
  font-weight: 700;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  color: #0a0f1a;
}

.btn-danger {
  background: var(--gradient-danger);
  color: var(--text-white);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.78rem;
}

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

/* ===== Forms ===== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  letter-spacing: 0.3px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

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

.form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ===== Search ===== */
.search-bar {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-bar .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

.search-bar input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
  backdrop-filter: var(--glass-blur);
}

.search-bar input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

/* ===== Modals ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: var(--transition);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(6, 182, 212, 0.08);
}

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


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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-danger);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 1.1rem;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* ===== Login Page ===== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at 20% 80%, rgba(6, 182, 212, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(14, 165, 233, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.05) 0%, transparent 60%);
  position: relative;
  overflow: hidden;
}

.login-container::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.06), transparent 70%);
  top: -200px;
  right: -200px;
  pointer-events: none;
  animation: pulse-glow 6s ease-in-out infinite;
}

.login-container::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.05), transparent 70%);
  bottom: -200px;
  left: -200px;
  pointer-events: none;
  animation: pulse-glow 6s ease-in-out infinite reverse;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.login-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(6, 182, 212, 0.05);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  width: 64px;
  height: 64px;
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  box-shadow: var(--shadow-glow);
}

.login-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
  font-family: var(--font-heading);
  letter-spacing: -0.5px;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.login-form .form-input {
  padding: 0.85rem 1rem;
}

.login-btn {
  width: 100%;
  padding: 0.9rem;
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.login-footer a {
  color: var(--accent-primary);
  font-weight: 600;
}

.login-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--accent-danger);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}

.login-error.visible {
  display: block;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* ===== Alerts / Toasts ===== */
.toast {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 9999;
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}

.toast.visible {
  transform: translateX(0);
}

.toast-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--accent-success);
}

.toast-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--accent-danger);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* ===== Loading ===== */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(6, 182, 212, 0.15); }
  50% { box-shadow: 0 0 25px rgba(6, 182, 212, 0.3); }
}

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

.animate-slide {
  animation: slideInLeft 0.4s ease-out;
}

/* ===== Responsividade ===== */
@media (max-width: 1024px) {
  .sidebar {
    width: 80px;
  }

  .sidebar-logo h1,
  .sidebar-logo p,
  .nav-section-title,
  .nav-item span:not(.nav-icon),
  .user-details {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 0.75rem;
  }

  .nav-item.active {
    box-shadow: none;
    background: rgba(6, 182, 212, 0.15);
  }

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

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

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }

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

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

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

  .login-card {
    margin: 1rem;
    padding: 2rem 1.5rem;
  }
}

/* ===== Utility Classes ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.currency::before { content: 'R$ '; }
.text-success { color: var(--accent-success); }
.text-warning { color: var(--accent-warning); }
.text-danger { color: var(--accent-danger); }
.text-muted { color: var(--text-muted); }

/* ===== Theme Toggle Button ===== */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 0.5rem;
}

.theme-toggle:hover {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-primary);
  border-color: rgba(6, 182, 212, 0.25);
}

.theme-toggle .toggle-icon {
  font-size: 1rem;
  line-height: 1;
}

/* ===== Light Theme Override ===== */
[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(6, 182, 212, 0.05);
  --bg-card-solid: #ffffff;
  --bg-input: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-modal: rgba(0, 0, 0, 0.45);

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

  --gradient-dark-radial: radial-gradient(ellipse at 20% 50%, rgba(6,182,212,0.04) 0%, transparent 60%);

  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 4px 20px rgba(6, 182, 212, 0.15);
  --shadow-glow-sm: 0 2px 10px rgba(6, 182, 212, 0.08);

  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: #e2e8f0;
  --glass-blur: blur(12px);
}

[data-theme="light"] .sidebar {
  background: #ffffff;
  background-image: none;
  border-right-color: #e2e8f0;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .sidebar::after {
  background: linear-gradient(180deg, transparent, rgba(6,182,212,0.08), transparent);
}

[data-theme="light"] .sidebar-logo h1 {
  background: linear-gradient(135deg, #0891b2 0%, #0284c7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="light"] .sidebar-logo p {
  color: #94a3b8;
}

[data-theme="light"] .nav-item.active {
  background: rgba(6, 182, 212, 0.08);
  color: #0891b2;
  box-shadow: inset 3px 0 0 #0891b2;
}

[data-theme="light"] .stat-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .stat-card:hover {
  box-shadow: var(--shadow-md);
}

[data-theme="light"] .chart-card,
[data-theme="light"] .table-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: var(--shadow-sm);
}

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

[data-theme="light"] .data-table tbody tr:hover td {
  background: #f1f5f9;
}

[data-theme="light"] .login-container {
  background: #f1f5f9;
  background-image:
    radial-gradient(ellipse at 20% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(14, 165, 233, 0.04) 0%, transparent 50%);
}

[data-theme="light"] .login-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .modal-overlay > .modal,
[data-theme="light"] .modal {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .btn-primary {
  color: #ffffff;
}

[data-theme="light"] .btn-primary:hover {
  color: #ffffff;
}

[data-theme="light"] .btn-success {
  color: #ffffff;
}

[data-theme="light"] .btn-success:hover {
  color: #ffffff;
}

[data-theme="light"] .form-select option {
  background: #ffffff;
  color: #0f172a;
}

/* ===== Health Indicator (Saúde Fiscal) ===== */
.health-indicator {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem 2rem;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.health-indicator::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  transition: var(--transition);
}

.health-indicator.health-verde::before { background: linear-gradient(135deg, #10b981, #34d399); }
.health-indicator.health-amarelo::before { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.health-indicator.health-vermelho::before { background: linear-gradient(135deg, #ef4444, #f97316); }

.health-dot {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  position: relative;
}

.health-verde .health-dot {
  background: rgba(16, 185, 129, 0.15);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
}
.health-amarelo .health-dot {
  background: rgba(245, 158, 11, 0.15);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
  animation: pulse-health 2s ease-in-out infinite;
}
.health-vermelho .health-dot {
  background: rgba(239, 68, 68, 0.15);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
  animation: pulse-health 1.5s ease-in-out infinite;
}

@keyframes pulse-health {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.health-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  font-family: var(--font-heading);
}
.health-verde .health-info h3 { color: var(--accent-success); }
.health-amarelo .health-info h3 { color: var(--accent-warning); }
.health-vermelho .health-info h3 { color: var(--accent-danger); }

.health-info p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ===== Timeline de Vencimentos ===== */
.timeline-container {
  position: relative;
  padding-left: 2rem;
}

.timeline-container::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent-primary), var(--accent-primary), transparent);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  padding: 0.75rem 0 0.75rem 1rem;
  transition: var(--transition);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.55rem;
  top: 1.1rem;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.35);
  z-index: 1;
}

.timeline-item.urgente::before {
  background: var(--accent-danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
  animation: pulse-health 1.5s ease-in-out infinite;
}

.timeline-item.atencao::before {
  background: var(--accent-warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.35);
}

.timeline-card {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-subtle);
  transition: var(--transition);
}

.timeline-card:hover {
  border-color: rgba(6, 182, 212, 0.2);
  transform: translateX(4px);
  background: var(--bg-card-hover);
}

.timeline-card .tl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.timeline-card .tl-tipo {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.timeline-card .tl-valor {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent-primary);
}

.timeline-card .tl-data {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.timeline-card .tl-dias {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  display: inline-block;
  margin-top: 0.3rem;
}

.timeline-card .tl-dias.dias-urgente {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-danger);
}
.timeline-card .tl-dias.dias-atencao {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-warning);
}
.timeline-card .tl-dias.dias-normal {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-primary);
}

/* ===== Charts Grid (lado a lado) ===== */
.dashboard-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

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

.chart-box {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
}

.chart-box:hover {
  border-color: rgba(6, 182, 212, 0.15);
}

.chart-box-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-family: var(--font-heading);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===== Donut Chart Legend ===== */
.donut-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-top: 1rem;
  justify-content: center;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.donut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ===== Stats Grid Extended (4 cards) ===== */
.stats-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

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

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

/* ===== Stat Card Mini Trend ===== */
.stat-trend {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 0.5rem;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  width: fit-content;
}

.stat-trend.trend-up {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-success);
}

.stat-trend.trend-down {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-danger);
}

.stat-trend.trend-neutral {
  background: rgba(6, 182, 212, 0.08);
  color: var(--accent-primary);
}

/* ===== Section Divider ===== */
.section-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0 1.25rem;
}

.section-divider h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-heading);
  white-space: nowrap;
}

.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-color), transparent);
}

/* ===== Light Theme Overrides for new components ===== */
[data-theme="light"] .health-indicator {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .chart-box {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .timeline-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .timeline-card:hover {
  background: #f1f5f9;
  border-color: rgba(6, 182, 212, 0.2);
}

[data-theme="light"] .timeline-item::before {
  border-color: #ffffff;
}