/* ============================================
   FINANZIA - Stylesheet Mobile-First
   Sistema de diseño: Dark Mode Financial UI
   ============================================ */

/* ─── CSS Custom Properties ─── */
:root {
  /* Colores principales */
  --primary: #3b82f6;
  --primary-dark: #1d4ed8;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #06b6d4;
  
  /* Superficies */
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --surface-elevated: #243447;
  
  /* Texto */
  --text: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --text-disabled: #64748b;
  
  /* Bordes y efectos */
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 4px 20px rgba(59, 130, 246, 0.3);
  
  /* Gradientes */
  --gradient-primary: linear-gradient(135deg, var(--primary), var(--primary-dark));
  --gradient-ai: linear-gradient(135deg, #8b5cf6, var(--primary));
  --gradient-header: linear-gradient(135deg, var(--primary), #1d4ed8);
  
  /* Espaciado */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;
  
  /* Radios */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  
  /* Tipografía */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  
  /* Transiciones */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* Safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* ─── Reset & Base ─── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height */
  line-height: 1.5;
  overflow-x: hidden;
  padding-bottom: calc(80px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Selección de texto */
::selection {
  background: rgba(59, 130, 246, 0.3);
  color: var(--text);
}

/* ─── Utilidades ─── */
.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden;
  opacity: 0;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fade-in {
  animation: fadeIn 0.5s var(--transition-base) forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-up {
  animation: slideUp 0.4s var(--transition-bounce) forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* ─── Splash Screen ─── */
#splash {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s var(--transition-base);
}

#splash.hidden {
  opacity: 0;
  pointer-events: none;
}

.splash-logo {
  width: 120px;
  height: 120px;
  background: var(--gradient-ai);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin-bottom: var(--space-lg);
  animation: pulse 2s infinite;
  box-shadow: var(--shadow-lg);
}

.splash-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.splash-subtitle {
  color: var(--text-muted);
  margin-top: var(--space-sm);
  font-size: 15px;
}

/* ─── Install Banner ─── */
.install-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--primary);
  padding: var(--space-md) var(--space-xl);
  padding-top: calc(var(--space-md) + var(--safe-top));
  display: none;
  align-items: center;
  justify-content: space-between;
  z-index: 400;
  animation: slideDown 0.3s var(--transition-base);
}

.install-banner.active {
  display: flex;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

.install-text {
  font-size: 14px;
  font-weight: 600;
  color: white;
}

.install-btn {
  background: white;
  color: var(--primary);
  border: none;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.install-btn:active {
  transform: scale(0.95);
}

/* ─── Header ─── */
.header {
  background: var(--gradient-header);
  padding: var(--space-xl);
  padding-top: calc(20px + var(--safe-top));
  border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.logo {
  font-size: 24px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  letter-spacing: -0.5px;
}

.header-actions {
  display: flex;
  gap: var(--space-md);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: scale(0.92);
}

/* ─── Balance Card ─── */
.balance-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: transform var(--transition-base);
}

.balance-card:active {
  transform: scale(0.99);
}

.balance-label {
  font-size: 13px;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.balance-amount {
  font-size: 36px;
  font-weight: 800;
  margin: var(--space-sm) 0;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

.balance-detail {
  display: flex;
  gap: var(--space-lg);
  font-size: 13px;
  font-weight: 500;
}

.balance-detail span {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.positive {
  color: #6ee7b7;
}

.negative {
  color: #fca5a5;
}

/* ─── Daily Available Card ─── */
.daily-card {
  margin: var(--space-lg) var(--space-xl);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid var(--warning);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.daily-card:active {
  transform: scale(0.98);
}

.daily-info h3 {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  font-weight: 500;
}

.daily-info .amount {
  font-size: 28px;
  font-weight: 700;
  color: var(--warning);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.daily-message {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.daily-progress {
  width: 60px;
  height: 60px;
  position: relative;
  flex-shrink: 0;
}

.daily-progress svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.daily-progress circle {
  fill: none;
  stroke-width: 6;
}

.daily-progress .bg {
  stroke: rgba(245, 158, 11, 0.2);
}

.daily-progress .progress {
  stroke: var(--warning);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s var(--transition-base);
}

.daily-progress text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 700;
  fill: var(--warning);
  font-variant-numeric: tabular-nums;
}

/* ─── Quick Actions ─── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin: var(--space-lg) var(--space-xl);
}

.action-btn {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.action-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.05));
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.action-btn:hover::before {
  opacity: 1;
}

.action-btn:active {
  transform: scale(0.96);
  box-shadow: var(--shadow-md);
}

.action-btn.income {
  border: 2px solid var(--success);
}

.action-btn.expense {
  border: 2px solid var(--danger);
}

.action-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform var(--transition-bounce);
}

.action-btn:hover .action-icon {
  transform: scale(1.1) rotate(-5deg);
}

.action-btn.income .action-icon {
  background: rgba(16, 185, 129, 0.2);
}

.action-btn.expense .action-icon {
  background: rgba(239, 68, 68, 0.2);
}

.action-label {
  font-size: 14px;
  font-weight: 600;
}

/* ─── Sections ─── */
.section {
  margin: var(--space-2xl) var(--space-xl);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.view-all {
  color: var(--primary);
  font-size: 14px;
  text-decoration: none;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.view-all:hover {
  background: rgba(59, 130, 246, 0.1);
}

/* ─── Transaction List ─── */
.transaction-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.transaction-item {
  background: var(--surface);
  border-radius: 14px;
  padding: 14px var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
}

.transaction-item:hover {
  border-color: var(--border);
  transform: translateX(2px);
}

.transaction-item:active {
  transform: scale(0.98);
}

.tx-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  transition: transform var(--transition-bounce);
}

.transaction-item:hover .tx-icon {
  transform: scale(1.1);
}

.tx-icon.income {
  background: rgba(16, 185, 129, 0.15);
}

.tx-icon.expense {
  background: rgba(239, 68, 68, 0.15);
}

.tx-details {
  flex: 1;
  min-width: 0;
}

.tx-title {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.tx-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.tx-amount {
  font-weight: 700;
  font-size: 16px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
  flex-shrink: 0;
}

.tx-amount.income {
  color: var(--success);
}

.tx-amount.expense {
  color: var(--danger);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state-text {
  font-size: 15px;
  line-height: 1.6;
}

/* ─── Goals Grid ─── */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.goal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.goal-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.goal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-ai);
}

.goal-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.goal-target {
  font-size: 12px;
  color: var(--text-muted);
}

.goal-progress {
  margin-top: var(--space-md);
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.goal-progress-bar {
  height: 100%;
  background: var(--gradient-ai);
  border-radius: 3px;
  transition: width 0.5s var(--transition-base);
  position: relative;
}

.goal-progress-bar::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
}

.goal-amount {
  margin-top: var(--space-sm);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.goal-deadline {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Chart Container ─── */
.chart-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin: var(--space-lg) var(--space-xl);
  height: 250px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.chart-container canvas {
  max-height: 100%;
}

/* ─── Bottom Navigation ─── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: var(--space-sm) 0;
  padding-bottom: calc(var(--space-sm) + var(--safe-bottom));
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  border: none;
  background: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 2px 2px;
  transition: width var(--transition-base);
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active::before {
  width: 24px;
}

.nav-item span {
  font-size: 20px;
  transition: transform var(--transition-bounce);
}

.nav-item:active span {
  transform: scale(0.85);
}

/* ─── Modals ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: flex-end;
  z-index: 200;
  opacity: 0;
  transition: opacity var(--transition-slow);
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-sheet {
  background: var(--surface);
  width: 100%;
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  padding: var(--space-2xl) var(--space-xl);
  padding-bottom: calc(var(--space-2xl) + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform var(--transition-slow);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 10;
  padding-top: var(--space-sm);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.modal-close:active {
  transform: scale(0.9);
}

/* ─── Forms ─── */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 14px var(--space-lg);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-select {
  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: 18px;
  padding-right: 40px;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* Toggle switch */
.form-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
}

.toggle-switch {
  width: 48px;
  height: 28px;
  background: var(--surface-hover);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-sm);
}

input:checked + .toggle-switch {
  background: var(--primary);
}

input:checked + .toggle-switch::after {
  transform: translateX(20px);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.btn-primary {
  width: 100%;
  padding: var(--space-lg);
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-lg);
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.2));
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: none;
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-elevated);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
  padding: var(--space-sm) var(--space-md);
  font-size: 13px;
}

.btn-lg {
  padding: var(--space-lg) var(--space-xl);
  font-size: 16px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ─── AI Floating Button ─── */
.ai-fab {
  position: fixed;
  bottom: 90px;
  right: var(--space-xl);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-ai);
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  transition: all var(--transition-base);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.ai-fab:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 6px 30px rgba(139, 92, 246, 0.6);
}

.ai-fab:active {
  transform: scale(0.9);
}

.ai-fab.pulse {
  animation: fabPulse 2s infinite;
}

@keyframes fabPulse {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
  }
  50% {
    box-shadow: 0 4px 30px rgba(139, 92, 246, 0.7);
  }
}

/* ─── AI Chat Interface ─── */
.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  flex-direction: column;
  z-index: 300;
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.chat-overlay.active {
  display: flex;
  opacity: 1;
}

.chat-header {
  padding: var(--space-lg) var(--space-xl);
  padding-top: calc(var(--space-lg) + var(--safe-top));
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-ai);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.chat-title {
  flex: 1;
  min-width: 0;
}

.chat-title h3 {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-title p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--success);
}

.chat-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.message {
  max-width: 85%;
  padding: var(--space-md) var(--space-lg);
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.6;
  animation: messageIn 0.3s var(--transition-base);
  word-wrap: break-word;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.message.ai {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text);
}

.message.ai strong {
  color: var(--primary);
}

.message.ai em {
  color: var(--text-secondary);
  font-style: italic;
}

.message-time {
  font-size: 11px;
  opacity: 0.6;
  margin-top: var(--space-xs);
  text-align: right;
}

.audit-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

.chat-input-area {
  padding: var(--space-md) var(--space-xl);
  padding-bottom: calc(var(--space-md) + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--space-md);
  align-items: flex-end;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 12px var(--space-lg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  transition: all var(--transition-fast);
}

.chat-input:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-glow);
}

.chat-send:hover {
  transform: scale(1.1);
}

.chat-send:active {
  transform: scale(0.9);
}

.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: var(--space-md) var(--space-lg);
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* ─── Settings ─── */
.settings-group {
  margin-bottom: var(--space-xl);
}

.settings-group-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  padding-left: var(--space-sm);
}

.settings-item {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  cursor: pointer;
}

.settings-item:hover {
  border-color: var(--border);
  transform: translateX(2px);
}

.settings-item:active {
  transform: scale(0.99);
}

.settings-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(59, 130, 246, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.settings-icon.danger {
  background: rgba(239, 68, 68, 0.15);
}

.settings-icon.success {
  background: rgba(16, 185, 129, 0.15);
}

.settings-icon.warning {
  background: rgba(245, 158, 11, 0.15);
}

.settings-content {
  flex: 1;
  min-width: 0;
}

.settings-label {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.settings-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-action {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.settings-action:hover {
  color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
}

.settings-action.danger {
  color: var(--danger);
}

.settings-action.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Info box */
.info-box {
  margin-top: var(--space-xl);
  padding: var(--space-lg);
  background: rgba(59, 130, 246, 0.1);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.info-box-text {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.info-box-text a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.info-box-text a:hover {
  text-decoration: underline;
}

/* ─── Toast Notifications ─── */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--surface);
  color: var(--text);
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 600;
  z-index: 500;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: toastIn 0.3s var(--transition-bounce) forwards;
  max-width: 90vw;
  text-align: center;
}

@keyframes toastIn {
  to {
    transform: translateX(-50%) translateY(0);
  }
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7;
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

/* ─── Loading States ─── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface) 25%,
    var(--surface-hover) 50%,
    var(--surface) 75%
  );
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeletonLoading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Responsive Adjustments ─── */
@media (min-width: 768px) {
  .quick-actions {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .goals-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .modal-sheet {
    max-width: 500px;
    margin: 0 auto;
    border-radius: var(--radius-2xl);
    max-height: 80vh;
  }
  
  .modal-overlay {
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
  }
  
  .chat-overlay {
    max-width: 500px;
    right: 20px;
    left: auto;
    border-radius: var(--radius-2xl);
    top: 20px;
    bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
  }
  
  .ai-fab {
    bottom: 100px;
    right: 40px;
  }
}

@media (min-width: 1024px) {
  body {
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  }
  
  .bottom-nav {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
  
  .install-banner {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* ─── Dark Mode Optimizations ─── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --border: rgba(255, 255, 255, 0.3);
    --text-muted: #cbd5e1;
  }
}