:root {
  --bg-dark: #0a0a0f;
  --bg-card: rgba(18, 18, 26, 0.6);
  --bg-card-solid: #12121a;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent: #8b5cf6;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --border-radius: 16px;
  --border-radius-sm: 8px;
  --nav-height: 70px;
  --header-height: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent 40%),
              radial-gradient(circle at bottom left, rgba(139, 92, 246, 0.15), transparent 40%),
              var(--bg-dark);
}

.auth-container { width: 100%; max-width: 400px; padding: 1.5rem; margin: 0 auto; }
.auth-header { text-align: center; margin-bottom: 2rem; }
.logo { font-size: 3rem; margin-bottom: 0.5rem; }
.auth-header h1 { font-size: 1.5rem; font-weight: 600; background: linear-gradient(to right, var(--primary), var(--accent)); -webkit-background-clip: text; color: transparent; }

/* Cards & Glassmorphism */
.card {
  background-color: var(--bg-card-solid);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border);
}

.card-glass {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn {
  flex: 1; padding: 0.75rem; background: none; border: none; color: var(--text-muted);
  font-family: inherit; font-size: 1rem; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent; transition: all 0.3s ease;
}
.tab-btn.active { color: var(--text-main); border-bottom-color: var(--primary); }
.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }

/* Forms */
.input-group { margin-bottom: 1.25rem; }
.input-group label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; color: var(--text-muted); }
.input {
  width: 100%; padding: 0.75rem 1rem; border-radius: var(--border-radius-sm);
  background-color: rgba(255, 255, 255, 0.05); border: 1px solid var(--border);
  color: var(--text-main); font-family: inherit; font-size: 1rem; transition: all 0.2s;
}
.input:focus { outline: none; border-color: var(--primary); background-color: rgba(255, 255, 255, 0.1); }
.divider { text-align: center; margin: 1rem 0; color: var(--text-muted); font-size: 0.875rem; position: relative; }
.divider::before, .divider::after { content: ""; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--border); }
.divider::before { left: 0; } .divider::after { right: 0; }

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem; border-radius: var(--border-radius-sm); font-family: inherit;
  font-size: 1rem; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.btn:disabled { opacity: 0.7; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white; box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.btn-danger { background-color: var(--danger); color: white; }
.btn-ghost { background: transparent; color: var(--text-main); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.05); }
.w-full { width: 100%; }

/* App Layout */
.app-body { padding-top: var(--header-height); padding-bottom: calc(var(--nav-height) + 1rem); }
.top-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-height);
  background: rgba(10, 10, 15, 0.8); backdrop-filter: blur(12px);
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 1.5rem; border-bottom: 1px solid var(--border); z-index: 40;
}
.logo-small { font-weight: 600; font-size: 1.1rem; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; font-weight: bold; }
.main-content { padding: 1.5rem 1rem; max-width: 800px; margin: 0 auto; min-height: calc(100vh - var(--header-height) - var(--nav-height)); }

/* Bottom Nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-height);
  background: rgba(18, 18, 26, 0.85); backdrop-filter: blur(16px);
  display: flex; justify-content: space-around; align-items: center;
  border-top: 1px solid var(--border); z-index: 40; padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
  color: var(--text-muted); text-decoration: none; font-size: 0.75rem; transition: color 0.2s;
}
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 1.25rem; filter: grayscale(1); opacity: 0.6; transition: all 0.2s; }
.nav-item.active .nav-icon { filter: grayscale(0); opacity: 1; transform: scale(1.1); }

/* FAB */
.fab {
  position: fixed; bottom: calc(var(--nav-height) + 1.5rem); right: 1.5rem;
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: white;
  font-size: 2rem; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4); cursor: pointer; z-index: 45; transition: transform 0.2s;
}
.fab:active { transform: scale(0.9); }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px);
  display: none; align-items: flex-end; z-index: 50;
}
.modal-overlay.show { display: flex; animation: fadeIn 0.2s ease; }
.modal-content {
  width: 100%; max-height: 90vh; overflow-y: auto;
  border-radius: 24px 24px 0 0; padding: 1.5rem;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); background: var(--bg-card-solid);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-header h3 { margin: 0; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 2rem; cursor: pointer; line-height: 1; padding: 0; }
.amount-group { position: relative; }
.currency-prefix { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); font-size: 1.5rem; color: var(--text-muted); }
.amount-input { font-size: 2rem; font-weight: 700; padding-left: 3.5rem; height: 4rem; color: var(--text-main); }

/* Category Grid */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 0.75rem; }
.category-pill {
  display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
  padding: 0.75rem 0.25rem; border-radius: var(--border-radius-sm); border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05); cursor: pointer; transition: all 0.2s; text-align: center; font-size: 0.7rem;
}
.category-pill.selected { border-color: var(--primary); background: rgba(99, 102, 241, 0.15); }
.category-icon { font-size: 1.5rem; }

/* Utilities */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }
.p-0 { padding: 0; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 1rem; }
h3 { font-size: 1.25rem; font-weight: 500; }
h4 { font-size: 1.1rem; font-weight: 500; }

/* Dashboard Cards */
.stat-card { text-align: center; }
.stat-value { font-size: 1.75rem; font-weight: 700; margin: 0.5rem 0; line-height: 1.1; }
.progress-bar-bg { height: 8px; background: rgba(255, 255, 255, 0.1); border-radius: 4px; overflow: hidden; margin-top: 0.5rem; }
.progress-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }

/* Expense List */
.expense-item {
  display: flex; align-items: center; padding: 1rem; border-bottom: 1px solid var(--border);
  background: var(--bg-card-solid); border-radius: var(--border-radius-sm); margin-bottom: 0.5rem;
}
.expense-item:last-child { margin-bottom: 0; }
.expense-item-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; background: rgba(255, 255, 255, 0.05); margin-right: 1rem; flex-shrink: 0; }
.expense-item-details { flex: 1; overflow: hidden; }
.expense-item-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expense-item-time { font-size: 0.75rem; color: var(--text-muted); }
.expense-item-amount { font-weight: 600; color: var(--danger); margin-left: 0.5rem; }

/* Toasts */
#toast-container { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; width: 90%; max-width: 400px; }
.toast { padding: 1rem; border-radius: var(--border-radius-sm); background: var(--bg-card-solid); border: 1px solid var(--border); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); display: flex; align-items: center; gap: 0.5rem; animation: slideDown 0.3s ease; }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); } 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); } }
.pulse-hover:hover { animation: none; }

/* Grid systems */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Select dropdown para dark mode */
select.input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}
select.input option { background: var(--bg-card-solid); color: var(--text-main); }

/* Utilitários adicionais */
.pb-4 { padding-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }

/* Scrollbar dark mode */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* Responsividade mobile-first */
@media (max-width: 480px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.4rem; }
  .main-content { padding: 1rem 0.75rem; }
}

@media (min-width: 768px) {
  .main-content { padding: 2rem; }
  .modal-content { max-width: 500px; margin: auto; border-radius: var(--border-radius); }
  .modal-overlay { align-items: center; }
}
