:root {
  --bg-main: #07090e;
  --bg-surface: #0f1523;
  --bg-card: rgba(19, 27, 46, 0.7);
  --bg-card-solid: #131b2e;
  --bg-card-hover: rgba(30, 41, 69, 0.8);
  --border: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.4);
  
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.3);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.3);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);
  --purple: #a855f7;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  --shadow-card: 0 12px 36px -4px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border);
  --font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(99, 102, 241, 0.15) 0%, transparent 45%),
    radial-gradient(circle at 90% 20%, rgba(168, 85, 247, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 50% 90%, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  padding-bottom: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.app-container {
  width: 100%;
  max-width: 680px;
  padding: 16px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 18px;
}

.brand-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 26px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(168, 85, 247, 0.25) 100%);
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 16px var(--primary-glow);
}

.brand-info h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.sync-dot.syncing {
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning);
  animation: pulse 1s infinite;
}

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

.header-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-glow);
  transform: translateY(-2px);
}

/* Streak & Conquistas Banner */
.streak-bar {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.15) 0%, rgba(239, 68, 68, 0.15) 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.streak-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 13px;
  color: #fde68a;
}

.streak-level-badge {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Glass Card Global */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  padding: 22px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s;
}

/* Card Principal Semanal */
.highlight-card {
  border: 1px solid rgba(99, 102, 241, 0.4);
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.6) 0%, rgba(15, 23, 42, 0.9) 100%);
}

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

.badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.badge-primary {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-urgent {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  animation: pulse 1.5s infinite;
}

.meta-display {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.meta-val-large {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -1px;
  color: #fff;
}

.meta-sub-val {
  font-size: 14px;
  color: var(--text-muted);
}

/* Barra de Progresso Animada */
.progress-track {
  height: 16px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 12px;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1 0%, #a855f7 50%, #10b981 100%);
  border-radius: var(--radius-full);
  transition: width 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.6);
}

.progress-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.stat-box {
  background: rgba(0, 0, 0, 0.3);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}

.stat-value {
  font-size: 18px;
  font-weight: 800;
}

/* Card Viagem Lilian */
.trip-card {
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, rgba(46, 29, 14, 0.5) 0%, rgba(15, 23, 42, 0.9) 100%);
}

.trip-progress-fill {
  background: linear-gradient(90deg, #f59e0b 0%, #10b981 100%);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.6);
}

/* Calculadora Reversa ("O que fazer hoje") */
.calculator-box {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
}

.calc-title {
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
  color: #a5b4fc;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.calc-pill {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.calc-pill-name {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.calc-pill-qty {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

/* Alerta de Contas Urgentes */
.urgent-alert-card {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.15) 0%, rgba(245, 158, 11, 0.15) 100%);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 14px;
  display: none;
}

.urgent-alert-card.show {
  display: block;
}

/* Abas */
.tabs {
  display: flex;
  background: var(--bg-card);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 14px;
  gap: 4px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

/* Seções */
.view-section {
  display: none;
}

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

/* Lista de Contas */
.category-group {
  margin-bottom: 16px;
}

.category-title {
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.bill-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.bill-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.bill-item.paid {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.04);
}

.bill-item.scheduled {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.04);
}

.bill-item.is-urgent {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.08);
}

.bill-info {
  flex: 1;
}

.bill-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 3px;
}

.bill-item.paid .bill-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.bill-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.bill-price {
  font-size: 15px;
  font-weight: 800;
  text-align: right;
  min-width: 85px;
}

.bill-actions {
  display: flex;
  gap: 6px;
}

.status-btn {
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-muted);
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

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

.status-btn.active-paid {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  box-shadow: 0 0 10px var(--success-glow);
}

.status-btn.active-sched {
  background: var(--warning);
  border-color: var(--warning);
  color: #111;
  box-shadow: 0 0 10px var(--warning-glow);
}

/* FAB */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: linear-gradient(135deg, var(--primary) 0%, #10b981 100%);
  color: white;
  border: none;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.5);
  z-index: 100;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fab:active {
  transform: scale(0.9);
}

/* Modais */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  padding: 24px;
  box-shadow: var(--shadow-card);
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

.modal-header h3 {
  font-size: 19px;
  font-weight: 800;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input, .form-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  padding: 13px 14px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(1px);
}

/* History */
.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-desc {
  font-weight: 700;
  font-size: 14px;
}

.history-date {
  font-size: 11px;
  color: var(--text-muted);
}

.history-val {
  font-size: 15px;
  font-weight: 800;
  color: var(--success);
}

/* Login Overlay */
#login-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-main);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.login-icon {
  font-size: 44px;
  margin-bottom: 12px;
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}

.login-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.pin-input {
  letter-spacing: 10px;
  font-size: 26px;
  text-align: center;
  font-weight: 800;
}
