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

:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --secondary: #ec4899;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-dark: #0f0f1a;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.09);
  --radius: 18px;
  --radius-sm: 13px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 2px 14px rgba(0, 0, 0, 0.18);
  --shadow-glow: 0 0 32px rgba(99, 102, 241, 0.1);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Background Animation - blobs flutuantes */
body::before,
body::after {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  pointer-events: none;
  z-index: -1;
}

body::before {
  background:
    radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.10) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(236, 72, 153, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
  animation: bgFloat 18s ease-in-out infinite;
}

body::after {
  background:
    radial-gradient(circle at 85% 10%, rgba(129, 140, 248, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 10% 85%, rgba(6, 214, 160, 0.05) 0%, transparent 40%);
  animation: bgFloat 22s ease-in-out infinite reverse;
}

@keyframes bgFloat {
  0%, 100% { transform: scale(1) translate(0, 0); }
  33% { transform: scale(1.06) translate(2%, 1%); }
  66% { transform: scale(0.97) translate(-2%, -1%); }
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 100px;
}

@media (min-width: 900px) {
  .container {
    padding: 24px;
  }
}

/* Header */
.header {
  text-align: center;
  padding: 32px 24px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 45%, #ec4899 100%);
  background-size: 220% 220%;
  animation: headerShift 14s ease infinite;
  border-radius: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

@keyframes headerShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
  animation: shimmer 8s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(10%, 10%); }
}

.header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
  position: relative;
  letter-spacing: -0.5px;
}

.header .subtitle {
  font-size: 0.95rem;
  opacity: 0.9;
  position: relative;
  font-weight: 500;
}

.user-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.2);
  position: relative;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255,255,255,0.3);
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.nav-tab {
  flex: 1;
  min-width: 80px;
  padding: 14px 12px;
  border: none;
  background: var(--bg-card);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
  border: 1px solid var(--border);
}

.nav-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}

.nav-tab.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 3px 14px rgba(99, 102, 241, 0.3);
  border-color: transparent;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  transition: var(--transition);
  animation: cardIn 0.5s ease both;
}

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

.card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.28);
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.3px;
}

/* Summary Cards */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  box-shadow: none;
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.summary-card.income::before { background: linear-gradient(90deg, var(--success), #34d399); }
.summary-card.expense::before { background: linear-gradient(90deg, var(--danger), #f87171); }
.summary-card.balance::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.summary-card.savings::before { background: linear-gradient(90deg, var(--warning), #fbbf24); }

.summary-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: none;
}

.summary-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.summary-value {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

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

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font-size: 1rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
}

/* Buttons */
.btn {
  width: 100%;
  padding: 18px;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: 0.3px;
  -webkit-tap-highlight-color: transparent;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(99, 102, 241, 0.45);
}

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

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

/* Categories Grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.category-btn {
  padding: 14px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
  font-size: 0.82rem;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.category-btn:hover {
  border-color: var(--c, var(--primary));
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-2px);
}

.category-btn:hover .emoji {
  transform: scale(1.12);
}

.category-btn.selected {
  border-color: var(--c, var(--primary));
  background: rgba(99, 102, 241, 0.14);
  background: color-mix(in srgb, var(--c, var(--primary)) 16%, rgba(0, 0, 0, 0.2));
  box-shadow: inset 0 0 0 1px var(--c, var(--primary));
  transform: scale(1.03);
}

.category-btn.selected .emoji {
  transform: scale(1.15);
}

.category-btn:active {
  transform: scale(0.95);
}

.category-btn .emoji {
  font-size: 1.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 8px;
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.12);
  background: color-mix(in srgb, var(--c, var(--primary)) 18%, transparent);
  transition: transform 0.25s ease, background 0.25s ease;
}

.category-btn.selected .emoji {
  background: rgba(99, 102, 241, 0.22);
  background: color-mix(in srgb, var(--c, var(--primary)) 30%, transparent);
}

/* Transactions List */
.transaction-list {
  max-height: 300px;
  overflow-y: auto;
}

.transaction-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  animation: slideIn 0.4s ease;
  transition: var(--transition);
  border-radius: var(--radius-sm);
}

.transaction-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.transaction-item:last-child {
  border-bottom: none;
}

.transaction-info {
  flex: 1;
}

.transaction-desc {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.transaction-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.transaction-amount {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.3px;
}

.transaction-amount.income {
  color: var(--success);
}

.transaction-amount.expense {
  color: var(--danger);
}

.transaction-delete {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 8px;
  font-size: 1.2rem;
  opacity: 0.5;
  transition: var(--transition);
  border-radius: 8px;
}

.transaction-delete:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.1);
}

/* Alerts */
.alert {
  padding: 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  animation: pulse 3s infinite;
  border: 1px solid;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.9; }
}

.alert-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
  border-color: rgba(245, 158, 11, 0.3);
}

.alert-danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
  border-color: rgba(239, 68, 68, 0.3);
}

.alert-info {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0.05) 100%);
  border-color: rgba(99, 102, 241, 0.3);
}

.alert-icon {
  font-size: 1.4rem;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.alert-text {
  font-size: 0.9rem;
  opacity: 0.9;
  line-height: 1.5;
}

/* Progress Bars */
.progress-item {
  margin-bottom: 16px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}

.progress-bar {
  height: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.success { background: linear-gradient(90deg, var(--success), #34d399); }
.progress-fill.warning { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.progress-fill.danger { background: linear-gradient(90deg, var(--danger), #f87171); }

/* Family Members */
.member-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border: 1px solid var(--border);
  transition: var(--transition);
}

.member-card:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--primary);
}

.member-avatar-large {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.member-info {
  flex: 1;
}

.member-name {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 1.05rem;
}

.member-salary {
  font-size: 0.9rem;
  color: var(--success);
  font-weight: 600;
}

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

.empty-state .emoji {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 15, 26, 0.92);
  display: flex;
  border-top: 1px solid var(--border);
  padding: 8px 4px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 1000;
  backdrop-filter: blur(24px);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.72rem;
  transition: var(--transition);
  font-weight: 500;
  border-radius: 14px;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item .emoji {
  font-size: 1.35rem;
  transition: transform 0.25s ease;
}

.bottom-nav-item:active .emoji {
  transform: scale(0.85);
}

.bottom-nav-item.active {
  color: var(--primary-light);
  background: rgba(99, 102, 241, 0.12);
}

.bottom-nav-item.active .emoji {
  transform: scale(1.12);
}

/* Charts */
.chart-container {
  position: relative;
  height: 280px;
  margin-bottom: 20px;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.filter-btn {
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 25px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.85rem;
  transition: var(--transition);
  font-weight: 500;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 3px 12px rgba(99, 102, 241, 0.25);
}

/* Export Buttons */
.export-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

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

.modal {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 28px;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: var(--transition);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
}

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

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  padding: 4px;
  transition: var(--transition);
}

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

/* Login Screen */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-dark);
}

.login-card {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 40px 32px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow), var(--shadow-glow);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
}

.login-card h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.login-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 0.95rem;
}

/* Tabs Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

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

/* Responsive */
@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
  
  .container {
    padding-bottom: 24px;
  }
  
  .category-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Dashboard Desktop */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.dashboard-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px;
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
}

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

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

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

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

/* Amount Input */
.amount-input-wrapper {
  position: relative;
}

.amount-input-wrapper::before {
  content: 'R$';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  z-index: 1;
  font-weight: 600;
}

.amount-input-wrapper input {
  padding-left: 52px;
}

/* Quick Amounts */
.quick-amounts {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.quick-amount-btn {
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 25px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}

.quick-amount-btn:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-light);
  transform: translateY(-1px);
}

.quick-amount-btn:active {
  transform: scale(0.94);
}

/* ============================================
   OCULTAR SELO "Powered by Netlify" (canto inferior direito)
   ============================================ */
#netlify-hud,
.netlify-hud,
[data-netlify-hud],
.deploy-coa,
#deploy-coa,
.netlify-badge,
.netlify-attribution,
.netlify-banner,
[data-nf-hud],
#nl-badge-frame,
iframe#nl-badge-frame,
iframe[id*="nl-badge"],
iframe.netlify-hud,
iframe[title*="Netlify"],
iframe[src*="netlify" i],
div[id*="nl-badge"],
div[class*="nl-badge"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  border: none !important;
}

/* ============================================
   RECEITA AUTOMÁTICA (salários) E DICAS
   ============================================ */
.summary-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500;
}

.auto-tag {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--success);
  background: rgba(6, 214, 160, 0.16);
  padding: 1px 6px;
  border-radius: 999px;
  vertical-align: middle;
}

.transaction-auto {
  background: rgba(6, 214, 160, 0.06);
  border-radius: 10px;
}

.form-hint {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-muted);
  background: rgba(6, 214, 160, 0.08);
  border: 1px solid rgba(6, 214, 160, 0.22);
  border-radius: 10px;
  padding: 8px 12px;
  margin-top: 10px;
}

/* ============================================
   ACESSIBILIDADE: respeitar movimento reduzido
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* TEMA AURORA — visual atualizado; seletores e estados originais preservados. */
/* FINANÇAS EM FAMÍLIA — tema Aurora
 * Camada visual para os seletores informados. Nenhuma regra de autenticação.
 * Preserve as regras funcionais do CSS original (visibilidade/estados).
 * Inter: mantenha o link da fonte existente no <head>, ou hospede-a localmente.
 */
:root {
  color-scheme: dark;
  --primary: #6366f1;
  --primary-light: #a5b4fc;
  --primary-dark: #4f46e5;
  --secondary: #ec4899;
  --success: #6ee7b7;
  --danger: #fda4af;
  --warning: #fcd34d;
  --bg-dark: #0c0d19;
  --text: #f5f5ff;
  --text-muted: #b1b6cf;
  --border: rgba(190,195,255,.13);
  --border-strong: rgba(190,195,255,.25);
  --radius: 22px;
  --radius-sm: 16px;
  --radius-pill: 999px;
  --surface: #171929;
  --surface-raised: #202239;
  --shadow: 0 16px 44px rgba(0,0,0,.25);
  --transition: 180ms ease;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(ellipse at 0% 0%,rgba(99,102,241,.17),transparent 45%),
    radial-gradient(ellipse at 100% 15%,rgba(236,72,153,.09),transparent 38%),var(--bg-dark);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--primary-light); outline-offset: 3px;
}
a { color: var(--primary-light); text-underline-offset: 4px; }
img, svg { max-width: 100%; }
h1, h2, h3, p { overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.container, #app { width: 100%; max-width: 1120px; margin-inline: auto; }
.container { padding: 18px 16px calc(112px + env(safe-area-inset-bottom,0px)); }
#app { padding-bottom: calc(112px + env(safe-area-inset-bottom,0px)); }
#app > .container { padding-bottom: 0; }
/* Login: não força display no ID; respeita os estados definidos pelo app. */
.login-screen { min-height: 100svh; padding: 28px 20px; align-content: center; }
.login-card {
  width: 100%; max-width: 440px; margin: auto; padding: 32px 24px;
  text-align: center; border-radius: 24px; border: 1px solid var(--border-strong);
  background: linear-gradient(145deg,rgba(43,44,74,.92),rgba(21,23,40,.96));
  box-shadow: var(--shadow),0 0 70px rgba(99,102,241,.12);
}
#loginEmoji, .login-emoji {
  width: 72px; height: 72px; margin: 0 auto 22px; display: grid; place-items: center;
  font-size: 32px; border-radius: 22px; border: 1px solid var(--border-strong);
  background: linear-gradient(135deg,rgba(99,102,241,.3),rgba(236,72,153,.17));
}
#loginTitle, .login-card h1 { margin: 0 0 10px; font-size: clamp(24px,6vw,30px); line-height: 1.18; letter-spacing: -.9px; }
#loginSubtitle, .login-card .subtitle { margin: 0 0 28px; color: var(--text-muted); font-size: 14px; }
#loginFamilyName, #loginPassword { min-height: 54px; }
#authButton { width: 100%; margin-top: 8px; min-height: 54px; }
.login-hint, .login-foot { color: var(--text-muted); font-size: 12px; line-height: 1.65; }
.login-foot { text-align: center; margin-top: 18px; }
/* Cabeçalho */
.header {
  margin-bottom: 20px; padding: 22px 20px; border-radius: 24px;
  background: radial-gradient(ellipse at 100% 0%,rgba(236,72,153,.28),transparent 65%),
    linear-gradient(125deg,#29275a,#252443 70%);
  border: 1px solid rgba(165,180,252,.24); box-shadow: var(--shadow);
}
#appHeaderTitle, .header h1 { margin: 0 0 8px; font-size: clamp(23px,5vw,32px); line-height: 1.2; letter-spacing: -.7px; }
#currentMonth, .header .subtitle { color: #d3d5ed; font-size: 14px; margin: 0; }
.topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.topo > div { min-width: 0; }
.user-info { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.user-avatar, #userAvatar { width: 42px; height: 42px; flex-shrink: 0; display: grid; place-items: center; border-radius: 15px; background: rgba(165,180,252,.16); border: 1px solid var(--border-strong); font-weight: 700; }
#userName { flex: 1; min-width: 80px; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; }
#versionBadge, .ver { color: var(--text-muted); font-size: 11px; letter-spacing: .4px; }
#versionBadge { border: 1px solid var(--border); border-radius: 999px; padding: 4px 8px; }
.chip-btn, .icon-btn { min-height: 44px; border: 1px solid var(--border-strong); border-radius: 14px; background: rgba(255,255,255,.06); color: var(--text); padding: 10px 12px; font-size: 12px; font-weight: 600; }
.icon-btn { min-width: 44px; }
/* Résumé: deux colonnes à 360px, valeurs repliables sans troncature. */
.summary-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-bottom: 22px; }
.summary-card {
  --accent: var(--primary-light); position: relative; min-width: 0; padding: 18px 14px;
  border-radius: 20px; border: 1px solid var(--border);
  background: linear-gradient(140deg,rgba(255,255,255,.065),rgba(255,255,255,.025)),var(--surface);
  box-shadow: 0 10px 26px rgba(0,0,0,.17); text-align: left;
  animation: aurora-enter 320ms ease both;
}
.summary-card.income { --accent: var(--success); }
.summary-card.expense { --accent: var(--danger); }
.summary-card.balance { --accent: var(--primary-light); }
.summary-card.savings { --accent: #f9a8d4; }
.summary-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 14px; border-radius: 13px; color: var(--accent); background: rgba(165,180,252,.1); font-size: 20px; }
.summary-value, #totalIncome, #totalExpense, #balance, #savingsGoal {
  color: var(--accent,var(--text)); font-size: clamp(22px,5.9vw,34px); font-weight: 800;
  line-height: 1.2; letter-spacing: -.9px; font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere; margin: 0 0 8px;
}
.summary-label { font-size: 12px; font-weight: 600; color: #e1e3f3; }
.summary-sub, #incomeDetail { color: var(--text-muted); font-size: 11px; line-height: 1.5; margin-top: 6px; overflow-wrap: anywhere; }
/* Abas: mantém estados/visibilidade do aplicativo original. */
.nav-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 6px; margin-bottom: 20px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); scrollbar-width: thin; }
.nav-tab { flex: 0 0 auto; min-height: 44px; padding: 10px 16px; border: 1px solid transparent; border-radius: 13px; color: var(--text-muted); background: transparent; font-size: 13px; font-weight: 600; }
.nav-tab.active, .nav-tab[aria-selected='true'] { background: #4543a4; color: #fff; border-color: rgba(165,180,252,.35); }
.tab-content { min-width: 0; }
#tab-home, #tab-add, #tab-history, #tab-family, #tab-analysis, #tab-dashboard { scroll-margin-top: 20px; }
.card, .dashboard-card { min-width: 0; margin-bottom: 18px; padding: 20px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(145deg,rgba(255,255,255,.025),transparent),var(--surface); box-shadow: var(--shadow); }
.card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 20px; font-size: 17px; line-height: 1.35; font-weight: 700; letter-spacing: -.3px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; }
.dashboard-card { margin-bottom: 0; }
/* Lançamentos */
.transaction-list, #recentTransactions, #allTransactions { margin: 0; padding: 0; list-style: none; }
.transaction-item { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.transaction-item:last-child { border-bottom: 0; }
.transaction-info { flex: 1 1 120px; min-width: 0; }
.transaction-desc { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.transaction-meta { margin-top: 4px; font-size: 12px; line-height: 1.5; color: var(--text-muted); overflow-wrap: anywhere; }
.transaction-amount { max-width: 100%; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.transaction-amount.income { color: var(--success); }
.transaction-amount.expense { color: var(--danger); }
.transaction-delete { flex-shrink: 0; min-width: 44px; min-height: 44px; border: 1px solid rgba(253,164,175,.2); border-radius: 13px; color: var(--danger); background: rgba(253,164,175,.05); }
.auto-tag { display: inline-block; padding: 3px 7px; margin: 3px; border: 1px solid var(--border-strong); border-radius: 8px; color: #c7d2fe; background: rgba(99,102,241,.12); font-size: 10px; }
.transaction-auto { border-inline-start: 2px solid rgba(165,180,252,.55); padding-inline-start: 10px; }
/* Formulários e categorias */
.form-group { min-width: 0; margin-bottom: 18px; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: #d5d8ed; }
.form-control { width: 100%; min-width: 0; min-height: 50px; padding: 13px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); background: #101222; transition: border-color var(--transition),box-shadow var(--transition); }
.form-control::placeholder { color: #9299b6; opacity: 1; }
.form-control:focus { border-color: var(--primary-light); box-shadow: 0 0 0 4px rgba(99,102,241,.14); }
.form-control:disabled { opacity: .6; }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control option { color: var(--text); background: var(--surface); }
.form-hint, #incomeHint { color: var(--text-muted); margin-top: 8px; font-size: 12px; line-height: 1.6; }
#transDescription, #transAmount, #transMember, #transDate, #memberName, #memberSalary { max-width: 100%; }
.amount-input-wrapper { position: relative; min-width: 0; }
.amount-input-wrapper .form-control { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
/* Preserva o posicionamento do prefixo monetário definido no CSS original. */
.quick-amounts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quick-amount-btn { min-height: 44px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 12px; color: #d7dcff; background: rgba(99,102,241,.08); font-size: 12px; font-weight: 600; }
.category-grid, #categoryGrid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.category-btn { min-width: 0; min-height: 76px; padding: 12px 6px; border: 1px solid var(--border-strong); border-radius: 16px; background: rgba(255,255,255,.025); color: #d6d9eb; font-size: 12px; overflow-wrap: anywhere; }
.category-btn.active, .category-btn.selected, .category-btn[aria-pressed='true'] { border-color: #a5b4fc; background: rgba(99,102,241,.23); color: #fff; box-shadow: inset 0 0 0 1px #a5b4fc; }
.btn { min-height: 48px; padding: 12px 18px; border: 1px solid transparent; border-radius: 15px; font-size: 14px; font-weight: 700; line-height: 1.4; color: var(--text); background: var(--surface-raised); transition: background-color var(--transition),transform var(--transition),border-color var(--transition); }
.btn.primary, .btn-primary { background: linear-gradient(120deg,#5855d6,#6758dd 70%,#8952c3); color: #fff; box-shadow: 0 8px 24px rgba(99,102,241,.22); }
.btn.success, .btn-success { background: #6ee7b7; color: #07271c; }
.btn.danger, .btn-danger { background: #fda4af; color: #3c101a; }
.btn.outline, .btn-outline { border-color: var(--border-strong); background: transparent; color: var(--text); }
#btnIncome, #btnExpense { min-height: 48px; }
#btnIncome.active { border-color: var(--success); box-shadow: inset 0 0 0 1px var(--success); }
#btnExpense.active { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.filter-bar, .export-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.filter-btn { min-height: 44px; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: 12px; color: var(--text-muted); background: var(--surface); font-size: 12px; }
.filter-btn.active { background: #4543a4; border-color: var(--primary-light); color: #fff; }
/* Progresso: largura e valores permanecem sob controle do JavaScript. */
.progress-item { margin-bottom: 20px; }
.progress-header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 9px; font-size: 12px; color: #d5d8ed; font-variant-numeric: tabular-nums; }
.progress-bar { height: 9px; overflow: hidden; border-radius: 999px; background: #0d1020; }
.progress-fill { height: 100%; max-width: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--primary),var(--secondary)); transition: width 320ms ease; }
#categoryBars, #savingsTips { min-width: 0; }
/* Alertas */
#alertsContainer { min-width: 0; }
.alert { display: flex; align-items: flex-start; gap: 12px; padding: 16px; margin-bottom: 12px; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--surface); }
.alert.warning { border-color: rgba(252,211,77,.3); background: #292518; }
.alert.danger { border-color: rgba(253,164,175,.3); background: #2c1c29; }
.alert.info { border-color: rgba(165,180,252,.3); background: #202342; }
.alert-icon { flex-shrink: 0; font-size: 21px; }
.alert-content { min-width: 0; }
.alert-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.alert-text { font-size: 12px; color: #c9cce1; line-height: 1.65; overflow-wrap: anywhere; }
/* Família e modal: nenhum display/estado de abertura imposto. */
#familyMembers { min-width: 0; }
.member-card { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 16px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 18px; background: rgba(255,255,255,.025); }
.member-avatar-large { flex-shrink: 0; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px; background: rgba(99,102,241,.15); border: 1px solid var(--border-strong); font-size: 26px; }
.member-info { flex: 1; min-width: 100px; }
.member-name { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.member-salary { margin-top: 4px; color: var(--success); font-size: 13px; font-variant-numeric: tabular-nums; }
.empty-state { padding: 30px 16px; text-align: center; color: var(--text-muted); font-size: 14px; }
.modal-overlay { position: fixed; inset: 0; z-index: 2000; padding: 16px; align-items: center; justify-content: center; background: rgba(5,6,15,.8); }
.modal { width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; margin: auto; padding: 24px 20px; border: 1px solid var(--border-strong); border-radius: 24px; background: #1b1d31; box-shadow: 0 24px 80px rgba(0,0,0,.5); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.modal-close { width: 44px; height: 44px; flex-shrink: 0; border: 1px solid var(--border); border-radius: 13px; background: rgba(255,255,255,.04); color: var(--text); font-size: 22px; }
#memberModal { isolation: isolate; }
#avatarGrid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; }
#avatarGrid > * { min-height: 44px; border-radius: 12px; }
#avatarGrid button { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); }
#avatarGrid .selected, #avatarGrid .active { border-color: var(--primary-light); background: #4543a4; }
/* Charts: mantém cores do canvas controladas pelo JavaScript. */
.chart-container { position: relative; min-width: 0; max-width: 100%; margin-top: 16px; }
.chart-container canvas, #expenseChart, #dashboardChart, #monthlyChart { max-width: 100%; }
/* Navegação móvel com seis itens e espaço para a área segura. */
.bottom-nav {
  position: fixed; z-index: 1000; left: 10px; right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom,0px));
  max-width: 620px; margin-inline: auto; padding: 6px 4px; gap: 2px;
  border: 1px solid var(--border-strong); border-radius: 22px;
  background: #1a1c30; box-shadow: 0 12px 50px rgba(0,0,0,.5);
}
.bottom-nav-item { flex: 1 1 0; min-width: 0; min-height: 56px; padding: 8px 2px; border: 0; border-radius: 15px; background: transparent; color: #b9bed8; text-align: center; font-size: 10px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.bottom-nav-item .emoji { display: block; font-size: 21px; margin-bottom: 4px; }
.bottom-nav-item.active, .bottom-nav-item[aria-current='page'] { color: #fff; background: #4543a4; box-shadow: inset 0 0 0 1px rgba(165,180,252,.25); }
@supports (backdrop-filter: blur(16px)) {
  .summary-card { background: linear-gradient(140deg,rgba(41,44,70,.85),rgba(23,25,41,.9)); backdrop-filter: blur(16px); }
  .bottom-nav { background: rgba(26,28,48,.94); backdrop-filter: blur(16px); }
}
@media (min-width: 640px) {
  .container { padding-inline: 26px; }
  .summary-grid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; }
  .summary-card { padding: 22px 18px; }
  .summary-value { font-size: 28px; }
  .category-grid, #categoryGrid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .card, .dashboard-card { padding: 24px; }
}
@media (min-width: 900px) {
  .dashboard-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .header { padding: 28px; }
  .summary-value { font-size: 34px; }
}
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover, .quick-amount-btn:hover, .filter-btn:hover, .chip-btn:hover, .icon-btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
  .category-btn:hover, .nav-tab:hover, .bottom-nav-item:hover { border-color: var(--primary-light); color: #fff; background-color: rgba(99,102,241,.18); }
}
.btn:not(:disabled):active, .category-btn:active, .quick-amount-btn:active { transform: scale(.98); }
@keyframes aurora-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .btn:active, .category-btn:active, .quick-amount-btn:active { transform: none; }
}

/* Ajustes validados contra a estrutura do aplicativo v3.4. */
body { overflow-x: visible; }
body::before, body::after { animation: none; background: none; }
.header { animation: none; background-size: auto; text-align: left; }
.header::before, .header::after, .summary-card::before { content: none; }
.login-screen { background: transparent; }
#loginName { min-height: 54px; }
#loginEmoji { font-size: 32px !important; margin-bottom: 22px !important; }
.login-card > .btn { width: 100%; min-height: 54px; }
.header button { min-height: 44px; border: 1px solid var(--border-strong) !important; border-radius: 14px !important; padding: 10px 12px !important; background: rgba(255,255,255,.06) !important; font-size: 13px !important; }
.header > div:first-child > div { min-width: 0; }
.header > div:first-child { gap: 12px; }
#versionBadge { display: inline-block; }
.amount-input-wrapper .form-control { padding-left: 52px; }
.category-btn { transform: none; }
.summary-card:hover { transform: none; }
.transaction-item:hover { transform: none; }
.chart-container { overflow: hidden; }
.dashboard-grid { grid-template-columns: minmax(0,1fr) !important; }
@media(min-width:900px) { .dashboard-grid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; } }
@media(min-width:768px) { #app { padding-bottom: 24px; } .container { padding-bottom: 24px; } }
