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

:root {
  /* PALANTIR FUTURISTIC COLOR PALETTE */
  --primary-color: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --secondary-color: #8b5cf6;
  --secondary-dark: #7c3aed;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --info-color: #06b6d4;

  /* DARK THEME - PALANTIR STYLE (DEFAULT) */
  --bg-color: #0a0e1a;
  --bg-secondary: #0f1419;
  --bg-gradient: radial-gradient(ellipse at top, #1e293b 0%, #0a0e1a 50%, #000000 100%);
  --surface-color: rgba(15, 23, 42, 0.8);
  --surface-elevated: rgba(30, 41, 59, 0.9);
  --surface-hover: rgba(51, 65, 85, 0.6);
  --card-bg: rgba(15, 23, 42, 0.6);

  /* Text colors - High contrast for readability */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: rgba(59, 130, 246, 0.15);
  --border-glow: rgba(59, 130, 246, 0.3);

  /* Advanced shadows with glow */
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 24px rgba(59, 130, 246, 0.1);
  --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.9), 0 0 40px rgba(59, 130, 246, 0.15);
  --shadow-glow: 0 0 32px rgba(59, 130, 246, 0.4), 0 0 64px rgba(59, 130, 246, 0.2);
  --shadow-glow-strong: 0 0 48px rgba(59, 130, 246, 0.6), 0 0 96px rgba(59, 130, 246, 0.3);

  /* Glassmorphism - Palantir style */
  --glass-bg: rgba(15, 23, 42, 0.4);
  --glass-border: rgba(59, 130, 246, 0.2);
  --glass-blur: blur(16px);

  /* Grid and accents */
  --grid-color: rgba(59, 130, 246, 0.05);
  --accent-glow: rgba(59, 130, 246, 0.5);
}

/* ===== LIGHT THEME - APPLE STYLE ===== */
[data-theme="light"] {
  /* Clean, minimal Apple-inspired colors */
  --primary-color: #007aff;
  --primary-dark: #0056b3;
  --primary-light: #4da3ff;
  --secondary-color: #5856d6;
  --secondary-dark: #3634a3;
  --success-color: #34c759;
  --warning-color: #ff9500;
  --danger-color: #ff3b30;
  --info-color: #5ac8fa;

  /* Light backgrounds */
  --bg-color: #f5f5f7;
  --bg-secondary: #ffffff;
  --bg-gradient: linear-gradient(180deg, #ffffff 0%, #f5f5f7 100%);
  --surface-color: rgba(255, 255, 255, 0.8);
  --surface-elevated: rgba(255, 255, 255, 0.95);
  --surface-hover: rgba(0, 0, 0, 0.03);
  --card-bg: rgba(255, 255, 255, 0.7);

  /* Text colors - Dark for readability */
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-muted: #8e8e93;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-glow: rgba(0, 0, 0, 0.12);

  /* Light shadows - subtle and soft */
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 4px 16px rgba(0, 122, 255, 0.15);
  --shadow-glow-strong: 0 8px 32px rgba(0, 122, 255, 0.2);

  /* Glassmorphism for light */
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(0, 0, 0, 0.06);
  --glass-blur: blur(20px);

  /* Grid - very subtle */
  --grid-color: rgba(0, 0, 0, 0.02);
  --accent-glow: rgba(0, 122, 255, 0.3);
}

/* Remove grid background in light theme */
[data-theme="light"] body::before {
  background-image: none;
  background: transparent;
}

/* Remove radial glow in light theme */
[data-theme="light"] body::after {
  background: radial-gradient(
    ellipse at top,
    rgba(0, 122, 255, 0.03) 0%,
    transparent 60%
  );
  animation: none;
  opacity: 1;
}

/* Header adjustments for light theme */
[data-theme="light"] header {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] header:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Logo glow adjustment */
[data-theme="light"] .logo {
  filter: none;
}

[data-theme="light"] .logo:hover {
  filter: drop-shadow(0 0 8px rgba(0, 122, 255, 0.4));
}

@keyframes pulse-glow-light {
  0%, 100% { filter: none; }
  50% { filter: drop-shadow(0 0 8px rgba(0, 122, 255, 0.3)); }
}

[data-theme="light"] .logo {
  animation: pulse-glow-light 3s infinite;
}

/* Sidebar for light */
[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* KPI cards for light */
[data-theme="light"] .kpi-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .kpi-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.12);
}

/* Chat section for light */
[data-theme="light"] .chat-section {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .chat-input-container {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .chat-input-container:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

[data-theme="light"] #message-input {
  background: transparent;
  color: var(--text-primary);
}

[data-theme="light"] #message-input::placeholder {
  color: var(--text-muted);
}

/* Message bubbles for light */
[data-theme="light"] .message.user .message-content {
  background: var(--primary-color);
  color: #ffffff;
}

[data-theme="light"] .message.assistant .message-content {
  background: #e9e9eb;
  color: var(--text-primary);
}

/* Dashboard panel for light */
[data-theme="light"] .dashboard {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Quick action buttons for light */
[data-theme="light"] .quick-action-btn {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-primary);
}

[data-theme="light"] .quick-action-btn:hover:not(:disabled) {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
}

/* Cards and panels for light */
[data-theme="light"] .card,
[data-theme="light"] .panel {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Modals for light */
[data-theme="light"] .modal-content {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Form inputs for light */
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: var(--text-primary);
}

[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* Buttons for light */
[data-theme="light"] .btn-primary {
  background: var(--primary-color);
  color: #ffffff;
}

[data-theme="light"] .btn-secondary {
  background: #e9e9eb;
  color: var(--text-primary);
}

[data-theme="light"] .btn-secondary:hover {
  background: #d1d1d6;
}

/* Navigation for light */
[data-theme="light"] .nav-link {
  color: var(--text-secondary);
}

[data-theme="light"] .nav-link:hover,
[data-theme="light"] .nav-link.active {
  color: var(--primary-color);
  background: rgba(0, 122, 255, 0.08);
}

/* Mobile bottom nav for light */
[data-theme="light"] .mobile-bottom-nav {
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .mobile-bottom-nav .nav-link {
  color: var(--text-muted);
}

[data-theme="light"] .mobile-bottom-nav .nav-link.active {
  color: var(--primary-color);
}

/* Toasts for light */
[data-theme="light"] .toast {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .toast .toast-title {
  color: var(--text-primary);
}

[data-theme="light"] .toast .toast-message {
  color: var(--text-secondary);
}

/* Notifications panel for light */
[data-theme="light"] .notifications-panel {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .notification-item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .notification-item:hover {
  background: rgba(0, 0, 0, 0.02);
}

/* Scrollbar for light */
[data-theme="light"] ::-webkit-scrollbar-track {
  background: #f5f5f7;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Theme toggle icon styling */
[data-theme="light"] .theme-toggle {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .theme-toggle:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* ===== DARK THEME (explicit selector for overrides) ===== */
[data-theme="dark"] {
  /* Inherits from :root - Palantir dark theme */
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.01em;
  transition: background 0.3s ease;
  position: relative;
}

/* Palantir-style grid background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
}

/* Radial glow effect */
body::after {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    ellipse at center,
    rgba(59, 130, 246, 0.08) 0%,
    transparent 50%
  );
  pointer-events: none;
  z-index: 0;
  animation: subtle-pulse 8s ease-in-out infinite;
}

@keyframes subtle-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
}

.container {
  max-width: 1800px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 24px;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

header:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 16px;
  animation: fadeInLeft 0.6s ease;
}

.logo {
  width: 48px;
  height: 48px;
  transition: transform 0.3s ease, filter 0.3s ease;
  animation: pulse-glow 3s infinite;
}

.logo:hover {
  transform: rotate(10deg) scale(1.1);
  filter: drop-shadow(0 0 12px rgba(37, 99, 235, 0.5));
}

@keyframes pulse-glow {
  0%, 100% {
    filter: drop-shadow(0 0 4px rgba(37, 99, 235, 0.3));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(37, 99, 235, 0.6));
  }
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  margin: 0;
}

.main-content {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 24px;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - 200px);
}

/* Sidebar */
.sidebar {
  background: var(--surface-color);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  overflow-y: auto;
  max-height: calc(100vh - 180px);
}

.sidebar h2 {
  font-size: 1.3rem;
  margin-bottom: 15px;
}

.sidebar h3 {
  font-size: 1rem;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-color);
  padding: 15px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.kpi-card:hover::before {
  opacity: 0.05;
}

.kpi-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.15);
  transform: translateY(-4px) scale(1.02);
}

.kpi-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
  position: relative;
  z-index: 1;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease;
}

.kpi-card:hover .kpi-value {
  transform: scale(1.1);
}

/* Trend indicators */
.trend-up {
  color: var(--danger-color);
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 6px;
}

.trend-down {
  color: var(--success-color);
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 6px;
}

.kpi-delta {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 4px;
  display: block;
}

.quick-view {
  margin-top: 20px;
}

.list-container {
  background: var(--bg-color);
  border-radius: 8px;
  padding: 10px;
  max-height: 200px;
  overflow-y: auto;
}

.list-item {
  padding: 8px;
  margin-bottom: 5px;
  background: var(--surface-color);
  border-radius: 6px;
  font-size: 0.85rem;
  border-left: 3px solid var(--primary-color);
}

.list-item.high-priority {
  border-left-color: var(--danger-color);
}

.list-item.medium-priority {
  border-left-color: var(--warning-color);
}

.list-item.low-priority {
  border-left-color: var(--success-color);
}

.list-item-title {
  font-weight: 600;
  margin-bottom: 3px;
}

.list-item-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Chat Section */
.chat-section {
  background: var(--surface-color);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.chat-header h2 {
  font-size: 1.3rem;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.status-indicator {
  width: 8px;
  height: 8px;
  background: var(--success-color);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

.chat-messages {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 20px;
  padding: 10px;
  background: var(--bg-color);
  border-radius: 8px;
  max-height: calc(100vh - 400px);
  min-height: 400px;
}

.message {
  margin-bottom: 15px;
  animation: slideIn 0.3s ease-out;
}

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

.message-content {
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 80%;
}

.message.user .message-content {
  background: var(--primary-color);
  margin-left: auto;
}

.message.assistant .message-content {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
}

.message-content p {
  margin-bottom: 8px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content ul {
  margin-left: 20px;
  margin-top: 8px;
}

.message-content li {
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.chat-input {
  display: flex;
  gap: 10px;
}

.chat-input input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input input:focus {
  border-color: var(--primary-color);
}

.chat-input button {
  padding: 12px 24px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-input button:hover {
  background: var(--secondary-color);
}

.chat-input button:disabled {
  background: var(--border-color);
  cursor: not-allowed;
}

/* Dashboard */
.dashboard {
  background: var(--surface-color);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  overflow-y: auto;
  max-height: calc(100vh - 180px);
}

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

.dashboard-header h2 {
  font-size: 1.3rem;
}

.btn-icon {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: var(--surface-hover);
}

.chart-section {
  margin-bottom: 25px;
}

.chart-section h3 {
  font-size: 1rem;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.chart-placeholder {
  background: var(--bg-color);
  border-radius: 8px;
  padding: 15px;
  min-height: 150px;
}

.financial-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.financial-item {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  background: var(--surface-color);
  border-radius: 6px;
}

.financial-item.positive {
  border-left: 3px solid var(--success-color);
}

.financial-item.negative {
  border-left: 3px solid var(--danger-color);
}

.financial-item.neutral {
  border-left: 3px solid var(--primary-color);
}

.task-distribution {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-category {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--surface-color);
  border-radius: 6px;
}

.task-category-name {
  flex: 1;
  font-size: 0.85rem;
  text-transform: capitalize;
}

.task-category-count {
  background: var(--primary-color);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-item {
  padding: 10px;
  background: var(--surface-color);
  border-radius: 6px;
  font-size: 0.85rem;
  border-left: 3px solid var(--primary-color);
}

.activity-time {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.loading {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
}

.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger-color);
  color: var(--danger-color);
  padding: 12px;
  border-radius: 8px;
  margin: 10px 0;
}

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

::-webkit-scrollbar-track {
  background: var(--bg-color);
  border-radius: 4px;
}

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

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

/* Responsive Design */
@media (max-width: 1400px) {
  .main-content {
    grid-template-columns: 280px 1fr 320px;
  }
}

@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .sidebar, .dashboard {
    max-height: none;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .chat-messages {
    max-height: 500px;
  }
}

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

  header h1 {
    font-size: 2rem;
  }

  .message-content {
    max-width: 90%;
  }
}

/* Header Navigation */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
}

.header-left {
  flex: 1;
}

.header-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  animation: fadeInRight 0.6s ease;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.nav-link:hover {
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.nav-link:hover::before {
  opacity: 0.1;
}

.nav-link.active {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  box-shadow: var(--shadow-glow);
}

.nav-link.active .nav-icon {
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
}

.nav-icon {
  font-size: 1.1rem;
  transition: transform 0.3s ease;
}

.nav-link:hover .nav-icon {
  transform: scale(1.2) rotate(5deg);
}

.theme-toggle {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: 8px;
}

.theme-toggle:hover {
  transform: translateY(-2px) rotate(15deg);
  box-shadow: var(--shadow-md);
}

.theme-toggle .theme-icon {
  display: inline-block;
  transition: transform 0.3s ease;
}

.theme-toggle:active .theme-icon {
  transform: rotate(180deg);
}

/* ===== NOTIFICATIONS ===== */

.notifications-toggle {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: 8px;
}

.notifications-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.notifications-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger-color);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
  animation: pulse-badge 2s infinite;
}

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

.notifications-badge.hidden {
  display: none;
}

.notifications-panel {
  position: fixed;
  top: 80px;
  right: 24px;
  width: 380px;
  max-height: 500px;
  background: var(--surface-elevated, #1e293b);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  z-index: 100000;
  overflow: hidden;
  animation: slideDown 0.3s ease-out;
}

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

.notifications-panel.hidden {
  display: none;
}

.notifications-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--glass-bg);
}

.notifications-header h3 {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
}

.mark-all-read-btn {
  background: transparent;
  border: none;
  color: var(--primary-light);
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.mark-all-read-btn:hover {
  color: var(--primary-color);
}

.health-summary {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.health-summary.hidden {
  display: none;
}

.health-summary-card {
  padding: 12px;
  border-radius: 10px;
  background: var(--glass-bg);
}

.health-summary-card.green {
  border-left: 3px solid var(--success-color);
}

.health-summary-card.yellow {
  border-left: 3px solid var(--warning-color);
}

.health-summary-card.red {
  border-left: 3px solid var(--danger-color);
}

.health-summary-headline {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.health-summary-recommendations {
  list-style: none;
  padding: 0;
  margin: 0;
}

.health-summary-recommendations li {
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding: 4px 0;
  padding-left: 16px;
  position: relative;
}

.health-summary-recommendations li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary-light);
}

.notifications-list {
  max-height: 320px;
  overflow-y: auto;
}

.no-notifications {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
  font-size: 0.9rem;
}

.notification-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s ease;
}

.notification-item:hover {
  background: var(--surface-hover);
}

.notification-item.unread {
  background: rgba(59, 130, 246, 0.05);
  border-left: 3px solid var(--primary-color);
}

.notification-item.priority-high {
  border-left-color: var(--danger-color);
}

.notification-item.priority-high.unread {
  background: rgba(239, 68, 68, 0.05);
}

.notification-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.notification-title {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
}

.notification-time {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.notification-message {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
}

.notification-dismiss {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  transition: color 0.2s ease;
}

.notification-dismiss:hover {
  color: var(--danger-color);
}

/* ===== CALENDAR PAGE ===== */

.calendar-page {
  background: var(--surface-color);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Toolbar */
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--surface-color);
}

.calendar-toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cal-btn-today {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-primary);
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.cal-btn-today:hover {
  background: var(--surface-hover);
  border-color: var(--primary-color);
}

.calendar-nav {
  display: flex;
  gap: 4px;
}

.cal-btn-nav {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-primary);
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-btn-nav:hover {
  background: var(--surface-hover);
  border-color: var(--primary-color);
}

.calendar-month-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.03em;
}

/* View Switcher */
.view-switcher {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--glass-bg);
  border-radius: 10px;
  backdrop-filter: blur(10px);
}

.view-btn {
  padding: 8px 20px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--spring-smooth);
}

.view-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.view-btn.active {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* Main Calendar Layout */
.calendar-main {
  display: grid;
  grid-template-columns: 1fr 320px;
  min-height: 600px;
}

.calendar-view {
  padding: 24px;
  border-right: 1px solid var(--border-color);
}

/* Calendar Grid Container */
.calendar-grid-container {
  background: var(--bg-color);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 2px solid var(--border-color);
  background: var(--surface-color);
}

.calendar-weekday {
  padding: 12px 8px;
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calendar-grid-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(100px, auto);
}

.calendar-day {
  min-height: 110px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: transparent;
  cursor: pointer;
  transition: all 0.3s var(--spring-gentle);
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  margin: 2px;
}

.calendar-day:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 2;
}

.calendar-day-number {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.calendar-day.other-month {
  background: transparent;
  opacity: 0.4;
}

.calendar-day.other-month .calendar-day-number {
  color: var(--text-muted);
}

.calendar-day.today {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
}

.calendar-day.today .calendar-day-number {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.calendar-day.selected {
  background: rgba(59, 130, 246, 0.1);
  box-shadow:
    inset 0 0 0 2px var(--primary-color),
    0 4px 16px rgba(59, 130, 246, 0.2);
}

/* Event Pills in Calendar Cells */
.calendar-day-events {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.calendar-event-pill {
  position: relative;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: all 0.2s var(--spring-gentle);
  backdrop-filter: blur(8px);
}

.calendar-event-pill:hover {
  transform: translateX(4px) scale(1.02);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.calendar-event-pill.meeting {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(59, 130, 246, 0.15) 100%);
  color: #60a5fa;
  border-left: 3px solid #3b82f6;
}

.calendar-event-pill.appointment {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(16, 185, 129, 0.15) 100%);
  color: #34d399;
  border-left: 3px solid #10b981;
}

.calendar-event-pill.general {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(139, 92, 246, 0.15) 100%);
  color: #a78bfa;
  border-left: 3px solid #8b5cf6;
}

.calendar-event-pill.homework {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3) 0%, rgba(245, 158, 11, 0.15) 100%);
  color: #fbbf24;
  border-left: 3px solid #f59e0b;
}

/* Drag & Drop Styles */
.calendar-event-pill[draggable="true"] {
  cursor: grab;
}

.calendar-event-pill[draggable="true"]:active {
  cursor: grabbing;
}

.calendar-event-pill.dragging {
  opacity: 0.5;
  transform: scale(0.95);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.calendar-day.drag-over {
  background: rgba(59, 130, 246, 0.2) !important;
  border: 2px dashed var(--primary-color) !important;
  transform: scale(1.02);
  transition: all 0.15s ease;
}

.calendar-day.drag-over .calendar-day-number {
  color: var(--primary-color);
  font-weight: 700;
}

/* Drag hint tooltip */
.calendar-event-pill::after {
  content: 'Drag to move';
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 1000;
}

.calendar-event-pill:hover::after {
  opacity: 1;
}

.calendar-event-pill.more-pill::after {
  display: none;
}

/* Sidebar */
.calendar-sidebar {
  padding: 24px;
  background: var(--surface-color);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
}

/* Google Calendar Section */
.google-calendar-section {
  background: var(--glass-bg);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

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

.google-header .sidebar-title {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.google-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.google-badge.connected {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success-color);
}

.google-badge.disconnected {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
}

.google-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
}

.google-btn.connect {
  background: white;
  color: #333;
  border-color: #ddd;
}

.google-btn.connect:hover {
  background: #f5f5f5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.google-btn.sync {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.google-btn.sync:hover {
  background: var(--primary-dark);
}

.google-btn.sync .sync-icon {
  display: inline-block;
  transition: transform 0.3s ease;
}

.google-btn.sync.syncing .sync-icon {
  animation: spin 1s linear infinite;
}

.google-btn.disconnect {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  font-size: 0.8rem;
  padding: 6px 12px;
}

.google-btn.disconnect:hover {
  color: var(--danger-color);
  background: rgba(239, 68, 68, 0.1);
}

#google-connected-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.google-last-sync {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

.google-not-configured {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
  background: rgba(245, 158, 11, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.google-icon {
  flex-shrink: 0;
}

/* Events List */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.event-item {
  padding: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
  border-radius: 12px;
  border-left: 4px solid var(--primary-color);
  cursor: pointer;
  transition: all 0.3s var(--spring-smooth);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.event-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.05) 50%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.event-item:hover {
  transform: translateX(6px) scale(1.01);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.event-item:hover::before {
  opacity: 1;
}

.event-item.meeting {
  border-left-color: #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
}

.event-item.appointment {
  border-left-color: #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.event-item.general {
  border-left-color: #8b5cf6;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0.05) 100%);
}

.event-item.homework {
  border-left-color: #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
}

.event-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.event-type-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.event-type-badge.meeting {
  background: rgba(59, 130, 246, 0.15);
  color: #1e40af;
}

.event-type-badge.appointment {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
}

.event-type-badge.general {
  background: rgba(107, 114, 128, 0.15);
  color: #374151;
}

.event-type-badge.homework {
  background: rgba(217, 119, 6, 0.15);
  color: #92400e;
}

.event-item-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.event-item-time {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.event-item-location {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.event-item-description {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.4;
}

/* Empty State */
.events-list-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .calendar-main {
    grid-template-columns: 1fr;
  }

  .calendar-view {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .calendar-grid-days {
    grid-auto-rows: minmax(80px, auto);
  }

  .calendar-day {
    min-height: 80px;
  }
}

/* Settings Page */
.settings-page {
  background: var(--surface-color);
  border-radius: 12px;
  padding: 32px;
  box-shadow: var(--shadow);
  max-width: 800px;
  margin: 0 auto;
}

.settings-page h2 {
  font-size: 2rem;
  margin-bottom: 32px;
}

.settings-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-color);
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-section h3 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.setting-item {
  margin-bottom: 20px;
}

.setting-item label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.setting-item select {
  width: 100%;
  max-width: 300px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-color);
  color: var(--text-primary);
  font-size: 1rem;
}

.setting-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

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

.btn-danger {
  background: var(--danger-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: #b91c1c;
}

/* ===========================
   AUTOMATION SETTINGS STYLES
   =========================== */

.setting-input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 14px;
  margin-top: 5px;
}

.setting-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.setting-checkbox {
  margin-right: 8px;
  cursor: pointer;
}

.setting-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 5px;
  margin-bottom: 0;
}

/* Automation Status */
.automation-status {
  margin-top: 1rem;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.status-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.status-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}

.status-value {
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 700;
}

.status-running {
  color: #10b981;
}

.status-stopped {
  color: #ef4444;
}

.status-loading {
  padding: 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
}

/* Automation History */
.automation-history {
  margin-top: 1rem;
}

.automation-runs {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.automation-run {
  padding: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.2s;
}

.automation-run:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.automation-run.completed {
  border-left-color: #10b981;
}

.automation-run.failed {
  border-left-color: #ef4444;
}

.automation-run.running {
  border-left-color: #3b82f6;
}

.automation-run.pending {
  border-left-color: #f59e0b;
}

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

.run-type {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.run-status {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-completed {
  background: #d1fae5;
  color: #065f46;
}

.status-failed {
  background: #fee2e2;
  color: #991b1b;
}

.status-running {
  background: #dbeafe;
  color: #1e40af;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.run-time {
  font-size: 12px;
  color: var(--text-secondary);
}

.run-error {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: #fee2e2;
  border-radius: 4px;
  font-size: 12px;
  color: #991b1b;
}

/* Settings Actions */
.settings-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Settings Message */
.settings-message {
  display: none;
  padding: 1rem;
  border-radius: 8px;
  font-weight: 500;
}

.settings-message.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}

.settings-message.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

.settings-message.warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

.settings-message.info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #3b82f6;
}

/* Dark mode adjustments */
[data-theme="dark"] .status-completed {
  background: #064e3b;
  color: #6ee7b7;
}

[data-theme="dark"] .status-failed {
  background: #7f1d1d;
  color: #fca5a5;
}

[data-theme="dark"] .status-running {
  background: #1e3a8a;
  color: #93c5fd;
}

[data-theme="dark"] .status-pending {
  background: #78350f;
  color: #fcd34d;
}

[data-theme="dark"] .run-error {
  background: #7f1d1d;
  color: #fca5a5;
}

[data-theme="dark"] .settings-message.success {
  background: #064e3b;
  color: #6ee7b7;
}

[data-theme="dark"] .settings-message.error {
  background: #7f1d1d;
  color: #fca5a5;
}

[data-theme="dark"] .settings-message.warning {
  background: #78350f;
  color: #fcd34d;
}

[data-theme="dark"] .settings-message.info {
  background: #1e3a8a;
  color: #93c5fd;
}

/* ===========================
   QUICK ACTIONS STYLES
   =========================== */

.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.quick-action-btn {
  padding: 12px 8px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.quick-action-btn:hover:not(:disabled) {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.quick-action-btn:disabled {
  background: var(--border-color);
  cursor: not-allowed;
  opacity: 0.6;
}

.quick-action-btn.running {
  background: var(--warning-color);
  animation: pulse-button 1.5s infinite;
}

@keyframes pulse-button {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(0.98);
  }
}

.quick-action-btn.success {
  background: var(--success-color);
  animation: success-pop 0.4s ease-out;
}

@keyframes success-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.quick-action-btn.error {
  background: var(--danger-color);
  animation: error-shake 0.4s ease-out;
}

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

/* Dark mode adjustments for Quick Actions */
[data-theme="dark"] .quick-action-btn:hover:not(:disabled) {
  box-shadow: 0 4px 8px rgba(96, 165, 250, 0.3);
}

[data-theme="dark"] .quick-action-btn:disabled {
  background: #374151;
  color: #6b7280;
}

/* ===========================
   ADVANCED ANIMATIONS
   =========================== */

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

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Apply animations to main sections */
.sidebar {
  animation: fadeInLeft 0.6s ease;
}

.chat-section {
  animation: fadeIn 0.8s ease 0.2s both;
}

.quick-actions {
  animation: fadeInUp 0.6s ease 0.3s both;
}

.kpi-card {
  animation: scaleIn 0.5s ease;
}

.kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-card:nth-child(3) { animation-delay: 0.3s; }

/* Enhanced card hover effects */
.card, .kpi-card, .sidebar, .chat-section, .quick-actions {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover, .kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* Smooth transitions for theme switching */
* {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Loading animation for async content */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.loading-shimmer {
  animation: shimmer 2s infinite;
  background: linear-gradient(
    to right,
    var(--surface-color) 4%,
    var(--surface-hover) 25%,
    var(--surface-color) 36%
  );
  background-size: 1000px 100%;
}

/* Floating animation for special elements */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

.float-animation {
  animation: float 3s ease-in-out infinite;
}

/* Gradient text effect */
.gradient-text {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Glassmorphism utility class */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
}

/* Neon glow effect */
.neon-glow {
  box-shadow: 0 0 5px var(--primary-color),
              0 0 10px var(--primary-color),
              0 0 20px var(--primary-color);
}

/* Ripple effect on click */
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  animation: ripple 0.6s ease-out;
}
/* ===========================
   THEME CUSTOMIZATION STYLES
   =========================== */

.theme-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.theme-preview-card {
  position: relative; /* Para posicionar el checkmark */
  padding: 16px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  background: var(--surface-color);
}

/* Light theme preview cards always have white background */
.theme-preview-card[data-theme="light"],
.theme-preview-card[data-theme="ocean"],
.theme-preview-card[data-theme="sunset"],
.theme-preview-card[data-theme="forest"],
.theme-preview-card[data-theme="lavender"] {
  background: #ffffff;
}

/* Dark theme preview card has dark background */
.theme-preview-card[data-theme="dark"] {
  background: #1e293b;
}

/* Mejorar visibilidad en dark mode */
[data-theme="dark"] .theme-preview-card[data-theme="light"],
[data-theme="dark"] .theme-preview-card[data-theme="ocean"],
[data-theme="dark"] .theme-preview-card[data-theme="sunset"],
[data-theme="dark"] .theme-preview-card[data-theme="forest"],
[data-theme="dark"] .theme-preview-card[data-theme="lavender"] {
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.theme-preview-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.theme-preview-card.active {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.theme-preview-card.active::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--primary-color);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  line-height: 24px;
  text-align: center;
}

.theme-preview-colors {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  justify-content: center;
}

.theme-color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-preview-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* Custom Theme Panel */
.custom-theme-panel {
  margin-top: 24px;
  padding: 24px;
  background: var(--surface-color);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.custom-theme-panel h4 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.color-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.color-picker-item label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.color-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-input-wrapper input[type="color"] {
  width: 60px;
  height: 40px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
}

.color-input-wrapper input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
}

.custom-theme-actions {
  display: flex;
  gap: 12px;
  margin: 20px 0;
}

.btn-secondary {
  background: var(--surface-color);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--primary-color);
}

/* Live Preview */
.theme-preview-live {
  margin-top: 24px;
}

.theme-preview-live h5 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.preview-card {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.preview-header {
  padding: 16px;
  background: var(--primary-color);
  color: white;
  font-weight: 600;
}

.preview-content {
  padding: 16px;
  background: var(--surface-color);
}

.preview-content p {
  color: var(--text-primary);
  margin-bottom: 12px;
}

.preview-button {
  background: var(--secondary-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

/* Custom preview with CSS variables */
#custom-preview {
  background: var(--preview-bg, var(--bg-color));
}

#custom-preview .preview-header {
  background: var(--preview-primary, var(--primary-color));
  color: white;
}

#custom-preview .preview-content {
  background: var(--preview-surface, var(--surface-color));
}

#custom-preview .preview-content p {
  color: var(--preview-text-primary, var(--text-primary));
}

#custom-preview .preview-button {
  background: var(--preview-secondary, var(--secondary-color));
  color: white;
}

/* ========================================
   RECURRING TASK INDICATORS
   ======================================== */

.recurring-badge {
  display: inline-block;
  font-size: 1.1em;
  margin-right: 4px;
  opacity: 0.9;
  transition: transform 0.2s ease;
}

.recurring-badge:hover {
  transform: scale(1.2);
  opacity: 1;
}

.recurring-next {
  display: inline-block;
  font-size: 0.85em;
  color: var(--primary-color);
  font-weight: 600;
  background: var(--primary-color-light, rgba(37, 99, 235, 0.1));
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 4px;
}

[data-theme="dark"] .recurring-next {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  min-width: 300px;
  max-width: 400px;
  padding: 16px 20px;
  background: var(--surface-color);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: all;
  animation: toastSlideIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  border-left: 4px solid var(--primary-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast.removing {
  animation: toastSlideOut 0.3s ease-in forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(400px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(400px) scale(0.8);
  }
}

.toast-icon {
  font-size: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.toast.success {
  border-left-color: var(--success-color);
}

.toast.success .toast-icon {
  background: rgba(5, 150, 105, 0.15);
}

.toast.error {
  border-left-color: var(--danger-color);
}

.toast.error .toast-icon {
  background: rgba(220, 38, 38, 0.15);
}

.toast.warning {
  border-left-color: var(--warning-color);
}

.toast.warning .toast-icon {
  background: rgba(217, 119, 6, 0.15);
}

.toast.info {
  border-left-color: var(--primary-color);
}

.toast.info .toast-icon {
  background: rgba(37, 99, 235, 0.15);
}

.toast-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toast-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s;
  font-size: 18px;
  line-height: 1;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-close:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--primary-color);
  border-radius: 0 0 0 12px;
  animation: toastProgress 5s linear forwards;
}

.toast.success .toast-progress {
  background: var(--success-color);
}

.toast.error .toast-progress {
  background: var(--danger-color);
}

.toast.warning .toast-progress {
  background: var(--warning-color);
}

@keyframes toastProgress {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

/* Dark theme adjustments */
[data-theme="dark"] .toast {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .toast-container {
    top: 16px;
    right: 16px;
    left: 16px;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }
}

/* ========================================
   QUICK COMMAND BUTTONS IN CHAT
   ======================================== */

.quick-commands {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--bg-color);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.quick-command-btn {
  padding: 8px 14px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.quick-command-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.quick-command-btn:active {
  transform: translateY(0);
}

.quick-command-btn .emoji {
  font-size: 1.1em;
  line-height: 1;
}

/* Responsive quick commands */
@media (max-width: 768px) {
  .quick-commands {
    gap: 6px;
    padding: 10px;
  }

  .quick-command-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
    flex: 1 1 calc(50% - 3px);
    justify-content: center;
  }
}

/* ===========================
   CHART STYLES - PALANTIR FUTURISTIC
   =========================== */

.chart-container {
  position: relative;
  width: 100%;
  height: 280px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.15);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.chart-container:hover {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 0 30px rgba(37, 99, 235, 0.1);
  transform: translateY(-2px);
}

.chart-container canvas {
  max-height: 100%;
  filter: drop-shadow(0 0 10px rgba(37, 99, 235, 0.3));
}

.chart-section {
  margin-bottom: 24px;
  animation: chartFadeIn 0.6s ease-out;
}

.chart-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 16px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-section h3::before {
  content: '';
  width: 3px;
  height: 18px;
  background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
  border-radius: 2px;
}

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

/* Chart tooltip styling */
.chartjs-tooltip {
  background: rgba(0, 0, 0, 0.9) !important;
  border: 1px solid rgba(37, 99, 235, 0.5) !important;
  border-radius: 8px !important;
  padding: 12px !important;
  font-family: 'Inter', sans-serif !important;
  backdrop-filter: blur(10px) !important;
}

/* Responsive chart sizing */
@media (max-width: 768px) {
  .chart-container {
    height: 220px;
    padding: 15px;
  }

  .chart-section h3 {
    font-size: 0.9rem;
  }
}

/* ===========================
   ONBOARDING SYSTEM - PALANTIR STYLE
   =========================== */

/* Overlay Background */
.onboarding-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9998;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: overlayFadeIn 0.4s ease;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Spotlight Effect */
.onboarding-spotlight {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.85),
              0 0 40px rgba(59, 130, 246, 0.6),
              inset 0 0 40px rgba(59, 130, 246, 0.3);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  animation: spotlightPulse 2s ease-in-out infinite;
}

@keyframes spotlightPulse {
  0%, 100% {
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.85),
                0 0 40px rgba(59, 130, 246, 0.6),
                inset 0 0 40px rgba(59, 130, 246, 0.3);
  }
  50% {
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.85),
                0 0 60px rgba(59, 130, 246, 0.8),
                inset 0 0 60px rgba(59, 130, 246, 0.5);
  }
}

/* Tooltip Container */
.onboarding-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: 400px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-glow-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: tooltipSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes tooltipSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Tooltip Header */
.onboarding-tooltip-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.onboarding-tooltip-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
  flex-shrink: 0;
}

.onboarding-tooltip-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Tooltip Content */
.onboarding-tooltip-content {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

/* Progress Indicator */
.onboarding-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.onboarding-progress-step {
  flex: 1;
  height: 4px;
  background: rgba(59, 130, 246, 0.2);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.onboarding-progress-step.active {
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
}

.onboarding-progress-step.completed {
  background: var(--success-color);
}

/* Tooltip Controls */
.onboarding-tooltip-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.onboarding-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  outline: none;
}

.onboarding-btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
  flex: 1;
}

.onboarding-btn-primary:hover {
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.6);
  transform: translateY(-2px);
}

.onboarding-btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.onboarding-btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-glow);
  color: var(--text-primary);
}

.onboarding-btn-skip {
  background: transparent;
  color: var(--text-muted);
  padding: 10px 16px;
  border: none;
  font-size: 0.85rem;
}

.onboarding-btn-skip:hover {
  color: var(--text-primary);
}

/* Step Counter */
.onboarding-step-counter {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 600;
}

/* Welcome Modal */
.onboarding-welcome {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10001;
  max-width: 500px;
  width: 90%;
  background: var(--surface-elevated);
  border: 1px solid var(--border-glow);
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--shadow-glow-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  text-align: center;
  animation: welcomeZoomIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes welcomeZoomIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.onboarding-welcome-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  box-shadow: 0 0 40px rgba(59, 130, 246, 0.6);
  animation: float 3s ease-in-out infinite;
}

.onboarding-welcome-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.onboarding-welcome-text {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 32px;
  font-size: 1.05rem;
}

.onboarding-welcome-controls {
  display: flex;
  gap: 12px;
}

/* Responsive */
@media (max-width: 768px) {
  .onboarding-tooltip {
    max-width: 90%;
    padding: 20px;
  }

  .onboarding-welcome {
    padding: 30px 20px;
  }

  .onboarding-welcome-title {
    font-size: 1.5rem;
  }
}

/* ===========================
   ADVANCED SEARCH SYSTEM
   =========================== */

/* Search Modal */
.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  animation: searchOverlayFadeIn 0.25s ease;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.search-modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes searchOverlayFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Search Modal Content */
.search-modal-content {
  width: 90%;
  max-width: 700px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  box-shadow: var(--shadow-glow-strong);
  animation: searchModalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

@keyframes searchModalSlideIn {
  from {
    transform: translateY(-30px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Search Header */
.search-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--surface-color);
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1.1rem;
  color: var(--text-primary);
  font-family: inherit;
}

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

.search-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-close-btn:hover {
  background: var(--danger-color);
  border-color: var(--danger-color);
  color: white;
  transform: scale(1.1);
}

/* Search Filters */
.search-filters {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--surface-color);
  overflow-x: auto;
}

.search-filter-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

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

.search-filter-btn.active {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-color: transparent;
  color: white;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.filter-icon {
  font-size: 1rem;
}

/* Search Results */
.search-results {
  max-height: 450px;
  overflow-y: auto;
  padding: 12px;
}

.search-results::-webkit-scrollbar {
  width: 8px;
}

.search-results::-webkit-scrollbar-track {
  background: var(--surface-color);
}

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

.search-results::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* Search Empty State */
.search-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.search-empty-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.5;
}

.search-empty p {
  font-size: 1.1rem;
  margin-bottom: 20px;
}

.search-tips {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}

.search-tip {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 8px 16px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: inline-block;
}

/* Search Result Item */
.search-result-item {
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
  animation: searchResultFadeIn 0.3s ease;
}

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

.search-result-item:hover,
.search-result-item.selected {
  background: var(--surface-hover);
  border-color: var(--primary-color);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
  transform: translateX(4px);
}

.search-result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.search-result-icon {
  font-size: 1.2rem;
}

.search-result-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.search-result-title mark {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.search-result-badge {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-task {
  background: rgba(5, 150, 105, 0.2);
  color: var(--success-color);
  border: 1px solid var(--success-color);
}

.badge-event {
  background: rgba(37, 99, 235, 0.2);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.badge-transaction {
  background: rgba(217, 119, 6, 0.2);
  color: var(--warning-color);
  border: 1px solid var(--warning-color);
}

.search-result-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 4px;
}

.search-result-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.4;
}

/* Search Footer */
.search-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--surface-color);
}

.search-shortcuts {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.search-shortcuts kbd {
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* No Results */
.search-no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.search-no-results-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.search-no-results p {
  font-size: 1rem;
  margin-bottom: 12px;
}

.search-no-results-suggestion {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 16px;
}

/* Loading State */
.search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-secondary);
}

.search-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: searchSpinner 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
  .search-modal {
    padding-top: 5vh;
  }

  .search-modal-content {
    width: 95%;
    max-width: none;
  }

  .search-filters {
    flex-wrap: wrap;
  }

  .search-results {
    max-height: 350px;
  }

  .search-result-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* ===========================
   HEALTH DASHBOARD STYLES
   =========================== */

/* Connection Status */
.connection-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.connection-info h2 {
  margin: 0 0 8px 0;
  font-size: 1.5rem;
  color: var(--text-primary);
}

.connection-info p {
  margin: 0;
  font-size: 0.9rem;
}

.status-connected {
  color: var(--success-color);
  font-weight: 500;
}

.status-disconnected {
  color: var(--text-secondary);
}

/* Sync Button Animation */
.sync-icon.spinning {
  display: inline-block;
  animation: spin 1s linear infinite;
}

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

/* AI Insights Section */
.insights-card {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(37, 99, 235, 0.1) 100%);
  border: 1px solid rgba(124, 58, 237, 0.3);
  margin-bottom: 24px;
}

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

.insights-header h3 {
  margin: 0;
  font-size: 1.3rem;
  background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.insight-badge {
  background: rgba(124, 58, 237, 0.2);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #a78bfa;
}

.insights-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.insight-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border-left: 3px solid #7c3aed;
}

.insight-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.insight-item p {
  margin: 0;
  line-height: 1.6;
  color: var(--text-primary);
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin: 20px 0;
}

.metric-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 0;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 12px 24px;
}

.metric-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.metric-status {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
}

.metric-content {
  padding: 0 24px 24px 24px;
}

.metric-content h3 {
  margin: 0 0 12px 0;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

.metric-value-large {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 16px 0;
  line-height: 1;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.metric-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.detail-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.detail-value {
  color: var(--text-primary);
  font-weight: 600;
}

/* Progress Bars */
.metric-progress {
  margin: 16px 0;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  transition: width 0.8s ease;
  border-radius: 4px;
}

.recovery-progress {
  background: linear-gradient(90deg, #059669 0%, #10b981 100%);
}

.sleep-progress {
  background: linear-gradient(90deg, #2563eb 0%, #60a5fa 100%);
}

/* Metric Details */
.metric-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  opacity: 0.8;
}

.detail-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Sleep Stages */
.sleep-stages {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stage-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stage-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  min-width: 45px;
}

.stage-bar {
  flex: 1;
  height: 20px;
  border-radius: 10px;
  transition: width 0.8s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.stage-time {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  min-width: 50px;
}

/* Strain Gauge */
.strain-gauge {
  margin: 16px 0;
  height: 12px;
  background: linear-gradient(90deg,
    #10b981 0%,
    #f59e0b 50%,
    #ef4444 75%,
    #dc2626 100%
  );
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.gauge-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  transition: width 0.8s ease;
}

/* Metric Card Colors */
.recovery-card {
  border-top: 4px solid rgba(5, 150, 105, 0.8);
}

.sleep-card {
  border-top: 4px solid rgba(37, 99, 235, 0.8);
}

.strain-card {
  border-top: 4px solid rgba(234, 88, 12, 0.8);
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.charts-grid .card {
  padding: 24px;
}

.charts-grid h3 {
  margin: 0 0 20px 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.charts-grid canvas {
  max-height: 250px;
}

/* Weekly Averages */
.averages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.average-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--surface-color);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.average-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.average-value {
  font-size: 1.5rem;
  color: var(--text-primary);
  font-weight: 700;
}

/* Weekly Comparison */
.comparison-card {
  padding: 24px;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-top: 20px;
}

.comparison-item {
  padding: 16px;
  background: var(--glass-bg);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.comparison-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.comparison-icon {
  font-size: 1.2rem;
}

.comparison-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.comparison-values {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.comparison-current {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.comparison-change {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}

.comparison-change.positive {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success-color);
}

.comparison-change.negative {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger-color);
}

.comparison-change.neutral {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-secondary);
}

.comparison-bar-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comparison-bar {
  height: 8px;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.comparison-bar.this-week {
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.comparison-bar.last-week {
  background: var(--text-muted);
  opacity: 0.5;
}

.comparison-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-color.this-week {
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.legend-color.last-week {
  background: var(--text-muted);
  opacity: 0.5;
}

/* 30-Day Trends */
.trends-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.trends-tabs {
  display: flex;
  gap: 8px;
}

.trend-tab {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.trend-tab:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.trend-tab.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.trend-chart-container {
  height: 300px;
  margin-bottom: 20px;
}

.trend-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.trend-stat {
  text-align: center;
}

.trend-stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.trend-stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.trend-stat-value.up {
  color: var(--success-color);
}

.trend-stat-value.down {
  color: var(--danger-color);
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 16px 24px;
  background: var(--surface-color);
  border-radius: 8px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-left: 4px solid var(--success-color);
}

.toast-error {
  border-left: 4px solid var(--danger-color);
}

.toast-info {
  border-left: 4px solid var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
  .connection-content {
    flex-direction: column;
    align-items: flex-start;
  }

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

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

  .averages-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================
   PROJECTS PAGE STYLES
   ======================== */

.projects-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 0;
}

.projects-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.toolbar-left h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.project-filters {
  display: flex;
  gap: 8px;
}

.filter-btn {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--text-secondary);
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.filter-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.projects-main {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
}

/* Projects Grid */
.projects-list-container {
  min-height: 400px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.project-card.selected {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.project-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-indicator.active {
  background: var(--success-color);
}

.status-indicator.completed {
  background: var(--primary-color);
}

.status-indicator.archived {
  background: var(--text-muted);
}

.project-status-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.project-card-title {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.project-card-description {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-footer {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

/* Project Detail Panel */
.project-detail-panel {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
  position: sticky;
  top: 100px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.detail-title-section {
  flex: 1;
}

.detail-title-section h2 {
  margin: 8px 0 0;
  font-size: 1.3rem;
  font-weight: 600;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-color);
}

.status-badge.completed {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-color);
}

.status-badge.archived {
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-muted);
}

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

.btn-icon {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: var(--glass-bg);
}

.btn-icon.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section h4 {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-section p {
  margin: 0;
  color: var(--text-primary);
  line-height: 1.6;
}

.detail-dates {
  display: flex;
  gap: 24px;
}

.date-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

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

.section-header h4 {
  margin: 0;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

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

/* Notes List */
.notes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.note-item {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
}

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

.note-title {
  font-weight: 600;
  color: var(--text-primary);
}

.note-actions {
  display: flex;
  gap: 4px;
}

.btn-icon-small {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  opacity: 0.6;
  transition: all 0.2s;
}

.btn-icon-small:hover {
  opacity: 1;
  background: var(--glass-bg);
}

.btn-icon-small.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.note-content {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
}

.note-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.tag {
  padding: 2px 8px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-color);
  border-radius: 4px;
  font-size: 0.75rem;
}

.note-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 8px;
  display: block;
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.empty-message {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--text-primary);
}

.empty-state p {
  margin: 0 0 20px;
  color: var(--text-secondary);
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
  display: flex;
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--surface-color);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content.modal-large {
  max-width: 700px;
}

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

.modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

/* Form Styles */
#project-form,
#note-form {
  padding: 24px;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-color);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.btn-primary {
  padding: 12px 24px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.btn-secondary {
  padding: 12px 24px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

/* Responsive Projects */
@media (max-width: 1024px) {
  .projects-main {
    grid-template-columns: 1fr;
  }

  .project-detail-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 100vh;
    border-radius: 0;
    z-index: 1000;
  }
}

@media (max-width: 640px) {
  .toolbar-left {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-filters {
    overflow-x: auto;
    width: 100%;
    padding-bottom: 4px;
  }

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

/* ========================
   USER MENU STYLES
   ======================== */

.user-menu {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 0.35rem 0.75rem 0.35rem 0.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.user-menu-btn:hover {
  background: var(--surface-hover);
  border-color: var(--primary-color);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  color: white;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 500;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown {
  position: fixed;
  /* top and right are set dynamically by JavaScript */
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 100000;
  overflow: hidden;
}

.user-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.user-dropdown-header strong {
  color: var(--text-primary);
  font-size: 0.95rem;
}

.user-dropdown-header small {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s ease;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  font-size: 0.9rem;
  text-align: left;
}

.user-dropdown-item:hover {
  background: var(--surface-hover);
}

.user-dropdown-item.logout-btn {
  border-top: 1px solid var(--border-color);
  color: var(--danger-color);
}

/* Hide user menu on mobile */
@media (max-width: 768px) {
  .user-menu {
    display: none;
  }
}

/* ========================
   MOBILE UI OPTIMIZATIONS
   ======================== */

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface-color);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 9999;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.mobile-bottom-nav .nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 500px;
  margin: 0 auto;
}

.mobile-bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border-radius: 12px;
  min-width: 60px;
}

.mobile-bottom-nav .nav-item .nav-icon {
  font-size: 1.4rem;
  transition: transform 0.2s ease;
}

.mobile-bottom-nav .nav-item:hover,
.mobile-bottom-nav .nav-item.active {
  color: var(--primary-color);
}

.mobile-bottom-nav .nav-item.active {
  background: rgba(99, 102, 241, 0.15);
}

.mobile-bottom-nav .nav-item.active .nav-icon {
  transform: scale(1.1);
}

/* Mobile Menu Button (Hamburger) */
.mobile-menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 10px;
  border-radius: 12px;
  transition: background 0.2s;
}

.mobile-menu-btn:hover {
  background: var(--glass-bg);
}

.mobile-menu-btn .hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mobile-menu-btn .hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-btn.active .hamburger span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active .hamburger span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active .hamburger span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
  opacity: 1;
}

/* Mobile Slide Menu */
.mobile-slide-menu {
  display: none;
  position: fixed;
  top: 0;
  right: -280px;
  width: 280px;
  height: 100vh;
  background: var(--surface-color);
  backdrop-filter: blur(20px);
  z-index: 10000;
  padding: 24px;
  padding-top: calc(24px + env(safe-area-inset-top));
  transition: right 0.3s ease;
  overflow-y: auto;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.mobile-slide-menu.active {
  right: 0;
}

.mobile-slide-menu .menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.mobile-slide-menu .menu-header h3 {
  font-size: 1.2rem;
  color: var(--text-primary);
}

.mobile-slide-menu .menu-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--glass-bg);
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.mobile-slide-menu .menu-close:hover {
  background: var(--danger-color);
  color: white;
}

.mobile-slide-menu .menu-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-slide-menu .menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text-secondary);
  border-radius: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.mobile-slide-menu .menu-link .menu-icon {
  font-size: 1.3rem;
}

.mobile-slide-menu .menu-link:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

.mobile-slide-menu .menu-link.active {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  /* Show mobile elements */
  .mobile-bottom-nav {
    display: block;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-menu-overlay,
  .mobile-slide-menu {
    display: block;
  }

  /* Hide desktop nav */
  .header-nav .nav-link {
    display: none;
  }

  .header-nav .theme-toggle,
  .header-nav .notifications-toggle {
    display: flex;
  }

  /* Adjust container padding for bottom nav */
  .container {
    padding-bottom: 80px;
  }

  /* Header adjustments */
  header {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 16px;
  }

  header:hover {
    transform: none;
  }

  .logo {
    width: 40px;
    height: 40px;
  }

  header h1 {
    font-size: 1.3rem;
  }

  .subtitle {
    font-size: 0.75rem;
  }

  .brand-text {
    display: none;
  }

  /* Main content adjustments */
  .main-content {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .sidebar {
    display: none;
  }

  /* Dashboard grid */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .card {
    padding: 16px;
    border-radius: 16px;
  }

  /* Calendar mobile */
  .calendar-page {
    padding: 0;
  }

  .calendar-toolbar {
    flex-direction: column;
    gap: 12px;
    padding: 0 4px;
  }

  .calendar-toolbar-left,
  .calendar-toolbar-right {
    width: 100%;
    justify-content: center;
  }

  .calendar-month-title {
    font-size: 1.1rem;
  }

  .calendar-main {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .calendar-sidebar {
    order: -1;
  }

  .calendar-weekdays {
    font-size: 0.7rem;
  }

  .calendar-weekday {
    padding: 8px 2px;
  }

  .calendar-day {
    min-height: 50px;
    padding: 4px;
  }

  .calendar-day-number {
    font-size: 0.85rem;
  }

  .calendar-event-pill {
    font-size: 0.6rem;
    padding: 2px 4px;
  }

  /* Projects mobile */
  .projects-page {
    padding: 0;
  }

  .projects-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .toolbar-right {
    width: 100%;
  }

  .toolbar-right .btn-primary {
    width: 100%;
    justify-content: center;
  }

  .projects-main {
    grid-template-columns: 1fr;
  }

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

  .project-detail-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 100vh;
    border-radius: 0;
    z-index: 9999;
  }

  /* Chat input mobile */
  .chat-input-container {
    padding: 12px;
  }

  .chat-input-wrapper {
    padding: 8px 12px;
  }

  .chat-input-wrapper textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Quick actions mobile */
  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .quick-action-btn {
    padding: 12px 8px;
    font-size: 0.8rem;
  }

  /* Health page mobile */
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .metric-card {
    padding: 12px;
  }

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

  /* Modal mobile */
  .modal-content {
    margin: 16px;
    max-height: calc(100vh - 32px);
    border-radius: 20px;
  }

  .modal-header {
    padding: 16px 20px;
  }

  #project-form,
  #note-form {
    padding: 16px 20px;
  }

  /* Google Calendar section mobile */
  .google-calendar-section {
    padding: 12px;
  }

  /* Event items mobile */
  .event-item {
    padding: 12px;
  }

  .event-item-title {
    font-size: 0.95rem;
  }
}

/* Extra small screens */
@media (max-width: 380px) {
  .mobile-bottom-nav .nav-item {
    padding: 8px 8px;
    min-width: 50px;
  }

  .mobile-bottom-nav .nav-item span:not(.nav-icon) {
    display: none;
  }

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

  .quick-actions {
    grid-template-columns: 1fr;
  }

  header h1 {
    font-size: 1.1rem;
  }
}

/* Landscape phone */
@media (max-width: 768px) and (orientation: landscape) {
  .mobile-bottom-nav {
    padding: 4px 0;
  }

  .mobile-bottom-nav .nav-item {
    padding: 6px 16px;
  }

  .mobile-bottom-nav .nav-item .nav-icon {
    font-size: 1.2rem;
  }

  .container {
    padding-bottom: 60px;
  }
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
  .mobile-bottom-nav {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .container {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
  .nav-link:hover,
  .btn-primary:hover,
  .btn-secondary:hover,
  .project-card:hover,
  header:hover {
    transform: none;
  }

  .quick-action-btn {
    min-height: 48px;
  }

  .btn-primary,
  .btn-secondary {
    min-height: 48px;
  }
}

/* ========================
   KANBAN BOARD STYLES
   ======================== */

.tasks-page {
  padding: 24px;
  position: relative;
  z-index: 1;
}

.tasks-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.tasks-toolbar .toolbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.tasks-toolbar h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.view-toggle {
  display: flex;
  gap: 4px;
  background: var(--surface-color);
  padding: 4px;
  border-radius: 8px;
}

.view-toggle .view-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.view-toggle .view-btn:hover {
  color: var(--text-primary);
}

.view-toggle .view-btn.active {
  background: var(--primary-color);
  color: white;
}

/* Kanban Board */
.kanban-board {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 20px;
  min-height: calc(100vh - 250px);
}

.kanban-column {
  flex: 1;
  min-width: 300px;
  max-width: 400px;
  background: var(--surface-color);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.kanban-column-header .column-icon {
  font-size: 1.2rem;
}

.kanban-column-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.task-count {
  background: var(--glass-bg);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.kanban-tasks {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100px;
  transition: background 0.2s;
  border-radius: 8px;
  padding: 4px;
}

.kanban-tasks.drag-over {
  background: rgba(59, 130, 246, 0.1);
  border: 2px dashed var(--primary-color);
}

.kanban-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 0.9rem;
}

/* Task Card */
.task-card {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  cursor: grab;
  transition: all 0.2s;
}

.task-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.task-card:active {
  cursor: grabbing;
}

.task-card.dragging {
  opacity: 0.5;
  transform: rotate(3deg);
  box-shadow: var(--shadow-lg);
}

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

.task-priority {
  font-size: 0.65rem;
  font-weight: 600;
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.task-card .task-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.task-card:hover .task-actions {
  opacity: 1;
}

.task-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.task-card-description {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.75rem;
}

.task-category {
  background: var(--surface-elevated);
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: 4px;
}

.task-due {
  color: var(--text-muted);
}

.task-due.overdue {
  color: var(--danger-color);
  font-weight: 600;
}

/* List View */
.list-view {
  background: var(--surface-color);
  border-radius: 12px;
  overflow: hidden;
}

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

.tasks-table th {
  text-align: left;
  padding: 14px 16px;
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.tasks-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.tasks-table tr:hover {
  background: var(--glass-bg);
}

.tasks-table tr.completed {
  opacity: 0.6;
}

.tasks-table tr.completed .task-title-cell strong {
  text-decoration: line-through;
}

.task-title-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-title-cell strong {
  font-weight: 600;
}

.task-title-cell .task-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.priority-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.priority-badge.high {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.priority-badge.medium {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.priority-badge.low {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.pending {
  background: rgba(107, 114, 128, 0.2);
  color: #6b7280;
}

.status-badge.in_progress {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.status-badge.completed {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

/* Mobile Kanban */
@media (max-width: 768px) {
  .kanban-board {
    flex-direction: column;
  }

  .kanban-column {
    min-width: 100%;
    max-width: 100%;
  }

  .tasks-toolbar .toolbar-left {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .view-toggle {
    width: 100%;
  }

  .view-toggle .view-btn {
    flex: 1;
    justify-content: center;
  }
}

/* ===== LIGHT THEME - PAGE SPECIFIC STYLES ===== */

/* Calendar Page Light Theme */
[data-theme="light"] .calendar-page {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .calendar-container {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .calendar-header {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .calendar-toolbar {
  background: rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .calendar-nav-btn,
[data-theme="light"] .cal-btn-nav {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

[data-theme="light"] .calendar-nav-btn:hover,
[data-theme="light"] .cal-btn-nav:hover {
  background: var(--primary-color);
  color: #ffffff;
}

[data-theme="light"] .view-switcher {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .view-btn {
  color: var(--text-secondary);
}

[data-theme="light"] .view-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .view-btn.active {
  background: var(--primary-color);
  color: white;
}

[data-theme="light"] .calendar-day {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .calendar-day:hover {
  background: rgba(0, 122, 255, 0.08);
  border-color: rgba(0, 122, 255, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .calendar-day.today {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.12) 0%, rgba(0, 122, 255, 0.04) 100%);
}

[data-theme="light"] .calendar-day.today .calendar-day-number {
  background: linear-gradient(135deg, #007aff 0%, #5856d6 100%);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

[data-theme="light"] .calendar-day.other-month {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .calendar-day.other-month .calendar-day-number {
  color: var(--text-muted);
}

[data-theme="light"] .calendar-weekday {
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .calendar-event-pill {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .calendar-event-pill.meeting {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.2) 0%, rgba(0, 122, 255, 0.1) 100%);
  color: #0056b3;
}

[data-theme="light"] .calendar-event-pill.appointment {
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.2) 0%, rgba(52, 199, 89, 0.1) 100%);
  color: #1d7c34;
}

[data-theme="light"] .calendar-event-pill.general {
  background: linear-gradient(135deg, rgba(88, 86, 214, 0.2) 0%, rgba(88, 86, 214, 0.1) 100%);
  color: #3634a3;
}

[data-theme="light"] .calendar-event-pill.homework {
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.2) 0%, rgba(255, 149, 0, 0.1) 100%);
  color: #b36800;
}

[data-theme="light"] .calendar-day.drag-over {
  background: rgba(0, 122, 255, 0.15) !important;
  border: 2px dashed var(--primary-color) !important;
}

[data-theme="light"] .event-item {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .event-item:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .event-item.meeting {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.1) 0%, rgba(255, 255, 255, 0.9) 100%);
}

[data-theme="light"] .event-item.appointment {
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.1) 0%, rgba(255, 255, 255, 0.9) 100%);
}

[data-theme="light"] .event-item.general {
  background: linear-gradient(135deg, rgba(88, 86, 214, 0.1) 0%, rgba(255, 255, 255, 0.9) 100%);
}

[data-theme="light"] .event-item.homework {
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.1) 0%, rgba(255, 255, 255, 0.9) 100%);
}

[data-theme="light"] .calendar-sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, rgba(245, 245, 247, 0.9) 100%);
}

/* Kanban/Tasks Page Light Theme */
[data-theme="light"] .kanban-column {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .kanban-column-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .task-count {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-secondary);
}

[data-theme="light"] .task-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .task-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.12);
}

[data-theme="light"] .kanban-tasks.drag-over {
  background: rgba(0, 122, 255, 0.08);
  border: 2px dashed var(--primary-color);
}

[data-theme="light"] .tasks-toolbar {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .view-btn {
  background: transparent;
  color: var(--text-secondary);
}

[data-theme="light"] .view-btn.active {
  background: var(--primary-color);
  color: #ffffff;
}

[data-theme="light"] .filter-select {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Health Page Light Theme */
[data-theme="light"] .health-dashboard {
  background: transparent;
}

[data-theme="light"] .health-card,
[data-theme="light"] .metric-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .health-card:hover,
[data-theme="light"] .metric-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .connection-status.connected {
  background: rgba(52, 199, 89, 0.1);
  border-color: rgba(52, 199, 89, 0.2);
}

[data-theme="light"] .connection-status.disconnected {
  background: rgba(255, 59, 48, 0.1);
  border-color: rgba(255, 59, 48, 0.2);
}

[data-theme="light"] .insight-card {
  background: rgba(0, 122, 255, 0.05);
  border: 1px solid rgba(0, 122, 255, 0.1);
}

[data-theme="light"] .chart-container {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Projects Page Light Theme */
[data-theme="light"] .project-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .project-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.1);
}

/* Settings Page Light Theme */
[data-theme="light"] .settings-section {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .settings-group {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .theme-preview-card {
  border: 2px solid rgba(0, 0, 0, 0.1);
}

/* List View Light Theme */
[data-theme="light"] .list-item {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .list-item:hover {
  background: rgba(0, 122, 255, 0.03);
  border-color: var(--primary-color);
}

/* Tables Light Theme */
[data-theme="light"] table {
  background: #ffffff;
}

[data-theme="light"] th {
  background: #fafafa;
  color: var(--text-secondary);
  border-bottom: 2px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

[data-theme="light"] tr:hover td {
  background: rgba(0, 122, 255, 0.02);
}

/* Dropdown/Select Light Theme */
[data-theme="light"] .dropdown-menu {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .dropdown-item:hover {
  background: rgba(0, 122, 255, 0.08);
}

/* Tags/Badges Light Theme */
[data-theme="light"] .tag,
[data-theme="light"] .badge {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-secondary);
}

[data-theme="light"] .tag.primary,
[data-theme="light"] .badge.primary {
  background: rgba(0, 122, 255, 0.1);
  color: var(--primary-color);
}

/* Priority badges Light */
[data-theme="light"] .priority-high {
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
}

[data-theme="light"] .priority-medium {
  background: rgba(255, 149, 0, 0.1);
  color: #ff9500;
}

[data-theme="light"] .priority-low {
  background: rgba(52, 199, 89, 0.1);
  color: #34c759;
}

/* Status badges Light */
[data-theme="light"] .status-badge.pending {
  background: rgba(142, 142, 147, 0.15);
  color: #8e8e93;
}

[data-theme="light"] .status-badge.in_progress {
  background: rgba(0, 122, 255, 0.1);
  color: #007aff;
}

[data-theme="light"] .status-badge.completed {
  background: rgba(52, 199, 89, 0.1);
  color: #34c759;
}

/* Empty States Light */
[data-theme="light"] .empty-state {
  color: var(--text-muted);
}

[data-theme="light"] .empty-state-icon {
  opacity: 0.4;
}

/* Loading States Light */
[data-theme="light"] .loading-spinner {
  border-color: rgba(0, 0, 0, 0.1);
  border-top-color: var(--primary-color);
}

/* Tooltip Light */
[data-theme="light"] .tooltip {
  background: #1d1d1f;
  color: #ffffff;
}

/* Progress bars Light */
[data-theme="light"] .progress-bar {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .progress-fill {
  background: var(--primary-color);
}

/* ===== POMODORO TIMER STYLES ===== */

.pomodoro-widget {
  text-align: center;
}

.pomodoro-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.pomodoro-display {
  position: relative;
  width: 160px;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.pomodoro-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.pomodoro-ring-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 6;
}

.pomodoro-ring-progress {
  fill: none;
  stroke: var(--primary-color);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}

.pomodoro-ring-progress.work {
  stroke: #ef4444;
}

.pomodoro-ring-progress.break {
  stroke: #10b981;
}

.pomodoro-ring-progress.long-break {
  stroke: #8b5cf6;
}

.pomodoro-time {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  z-index: 1;
}

.pomodoro-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 1;
}

.pomodoro-controls {
  display: flex;
  gap: 12px;
}

.pomodoro-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--surface-color);
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.pomodoro-btn:hover {
  border-color: var(--primary-color);
  transform: scale(1.1);
}

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

.pomodoro-modes {
  display: flex;
  gap: 8px;
}

.pomodoro-mode {
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pomodoro-mode:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.pomodoro-mode.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.pomodoro-mode[data-type="work"].active {
  background: #ef4444;
  border-color: #ef4444;
}

.pomodoro-mode[data-type="break"].active {
  background: #10b981;
  border-color: #10b981;
}

.pomodoro-mode[data-type="long-break"].active {
  background: #8b5cf6;
  border-color: #8b5cf6;
}

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

#pomodoro-sessions-count {
  font-weight: 600;
  color: var(--primary-color);
}

/* Pomodoro animation when running */
@keyframes pulse-ring {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.pomodoro-ring-progress.running {
  animation: pulse-ring 2s ease-in-out infinite;
}

/* ===== NOTES PAGE STYLES ===== */

.notes-page {
  max-width: 1400px;
  margin: 0 auto;
}

.notes-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--surface-color);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.notes-toolbar .toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.notes-toolbar .toolbar-right {
  display: flex;
  gap: 12px;
}

.notes-toolbar .search-container {
  position: relative;
}

.notes-toolbar .search-input {
  padding: 10px 16px;
  padding-left: 40px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  width: 250px;
  font-size: 0.9rem;
}

.notes-toolbar .search-container::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
}

/* Notes Grid */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Note Card */
.note-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-height: 150px;
  display: flex;
  flex-direction: column;
}

.note-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.note-card.pinned {
  border-color: var(--warning-color);
  background: linear-gradient(135deg, var(--surface-color), rgba(245, 158, 11, 0.05));
}

.note-card .pin-indicator {
  position: absolute;
  top: -8px;
  right: 10px;
  font-size: 1rem;
}

/* Note color variants */
.note-card.note-yellow {
  background: linear-gradient(135deg, #fef3c7, #fef9e7);
  border-color: #f59e0b;
}
.note-card.note-green {
  background: linear-gradient(135deg, #d1fae5, #ecfdf5);
  border-color: #10b981;
}
.note-card.note-blue {
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  border-color: #3b82f6;
}
.note-card.note-purple {
  background: linear-gradient(135deg, #ede9fe, #f5f3ff);
  border-color: #8b5cf6;
}
.note-card.note-pink {
  background: linear-gradient(135deg, #fce7f3, #fdf2f8);
  border-color: #ec4899;
}
.note-card.note-red {
  background: linear-gradient(135deg, #fee2e2, #fef2f2);
  border-color: #ef4444;
}
.note-card.note-orange {
  background: linear-gradient(135deg, #ffedd5, #fff7ed);
  border-color: #f97316;
}

/* Dark theme color adjustments */
[data-theme="dark"] .note-card.note-yellow {
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.15), rgba(254, 243, 199, 0.05));
}
[data-theme="dark"] .note-card.note-green {
  background: linear-gradient(135deg, rgba(209, 250, 229, 0.15), rgba(209, 250, 229, 0.05));
}
[data-theme="dark"] .note-card.note-blue {
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.15), rgba(219, 234, 254, 0.05));
}
[data-theme="dark"] .note-card.note-purple {
  background: linear-gradient(135deg, rgba(237, 233, 254, 0.15), rgba(237, 233, 254, 0.05));
}
[data-theme="dark"] .note-card.note-pink {
  background: linear-gradient(135deg, rgba(252, 231, 243, 0.15), rgba(252, 231, 243, 0.05));
}
[data-theme="dark"] .note-card.note-red {
  background: linear-gradient(135deg, rgba(254, 226, 226, 0.15), rgba(254, 226, 226, 0.05));
}
[data-theme="dark"] .note-card.note-orange {
  background: linear-gradient(135deg, rgba(255, 237, 213, 0.15), rgba(255, 237, 213, 0.05));
}

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

.note-type-icon {
  font-size: 1.1rem;
}

.note-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.note-card:hover .note-actions {
  opacity: 1;
}

.note-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.note-action-btn:hover {
  background: var(--surface-hover);
}

.note-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.3;
}

.note-content {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}

.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.note-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--primary-color);
  color: white;
  opacity: 0.8;
}

.note-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.note-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Note Modal */
.note-modal-content {
  max-width: 600px;
  width: 95%;
}

.note-title-input {
  width: 100%;
  padding: 12px 0;
  border: none;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
}

.note-title-input:focus {
  border-bottom-color: var(--primary-color);
}

.note-content-input {
  width: 100%;
  padding: 16px 0;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text-primary);
  resize: vertical;
  min-height: 200px;
  outline: none;
  line-height: 1.6;
  font-family: inherit;
}

/* Color picker */
.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.color-btn:hover {
  transform: scale(1.1);
}

.color-btn.active {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--bg-color), 0 0 0 4px var(--primary-color);
}

/* Empty state for notes */
.notes-page .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  color: var(--text-muted);
}

.notes-page .empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.notes-page .empty-state h3 {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.notes-page .empty-state p {
  margin-bottom: 24px;
}

/* Toast notification */
.toast-notification {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s ease;
  color: var(--text-primary);
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-notification.toast-success {
  border-color: var(--success-color);
}

.toast-notification.toast-error {
  border-color: var(--danger-color);
}

.toast-notification.toast-warning {
  border-color: var(--warning-color);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .notes-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .notes-toolbar .toolbar-left,
  .notes-toolbar .toolbar-right {
    width: 100%;
  }

  .notes-toolbar .search-input {
    width: 100%;
  }

  .notes-toolbar .toolbar-right {
    justify-content: stretch;
  }

  .notes-toolbar .toolbar-right button {
    flex: 1;
  }

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

  .note-actions {
    opacity: 1;
  }
}

/* ===== APPLE LIQUID GLASS ANIMATIONS ===== */

/* Spring physics timing functions */
:root {
  --spring-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --spring-smooth: cubic-bezier(0.34, 1.56, 0.64, 1);
  --spring-gentle: cubic-bezier(0.22, 0.61, 0.36, 1);
  --spring-fast: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --apple-ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --apple-spring: cubic-bezier(0.5, 1.5, 0.75, 1);
}

/* Liquid glass effect - enhanced glassmorphism */
.liquid-glass {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .liquid-glass {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.7) 0%,
    rgba(255, 255, 255, 0.5) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(0, 0, 0, 0.02);
}

/* Apply liquid glass to main components */
header,
.sidebar,
.chat-section,
.dashboard,
.kpi-card,
.quick-actions,
.quick-view,
.modal-content,
.notes-page .toolbar,
.notes-page .note-card {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.03) 100%
  );
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

[data-theme="light"] header,
[data-theme="light"] .sidebar,
[data-theme="light"] .chat-section,
[data-theme="light"] .dashboard,
[data-theme="light"] .kpi-card,
[data-theme="light"] .quick-actions,
[data-theme="light"] .quick-view,
[data-theme="light"] .modal-content,
[data-theme="light"] .notes-page .toolbar,
[data-theme="light"] .notes-page .note-card {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.8) 0%,
    rgba(255, 255, 255, 0.6) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Spring hover animations */
@keyframes spring-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes spring-press {
  0% { transform: scale(1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes glow-pulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.5), 0 0 60px rgba(59, 130, 246, 0.2);
  }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* Button spring effects */
button,
.btn,
.quick-action-btn,
.nav-link,
.pomodoro-btn {
  transition: all 0.3s var(--spring-smooth);
  position: relative;
  overflow: hidden;
}

button:hover,
.btn:hover,
.quick-action-btn:hover,
.nav-link:hover {
  transform: translateY(-2px);
}

button:active,
.btn:active,
.quick-action-btn:active,
.nav-link:active {
  transform: translateY(0) scale(0.98);
  transition: all 0.1s ease;
}

/* Ripple effect on buttons */
button::after,
.btn::after,
.quick-action-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
}

button:active::after,
.btn:active::after,
.quick-action-btn:active::after {
  animation: ripple 0.6s ease-out;
}

/* Card hover with spring physics */
.kpi-card,
.note-card,
.project-card,
.task-card,
.quick-view {
  transition:
    transform 0.4s var(--spring-smooth),
    box-shadow 0.4s var(--apple-ease);
}

.kpi-card:hover,
.note-card:hover,
.project-card:hover,
.task-card:hover,
.quick-view:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.2),
    0 0 40px rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .kpi-card:hover,
[data-theme="light"] .note-card:hover,
[data-theme="light"] .project-card:hover,
[data-theme="light"] .task-card:hover,
[data-theme="light"] .quick-view:hover {
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.1),
    0 0 40px rgba(0, 122, 255, 0.1);
}

/* Floating effect on sidebar nav items */
.nav-link {
  transition:
    all 0.3s var(--spring-gentle),
    background 0.2s ease;
}

.nav-link:hover {
  transform: translateX(8px);
  background: rgba(59, 130, 246, 0.15);
}

.nav-link.active {
  background: linear-gradient(
    90deg,
    rgba(59, 130, 246, 0.2) 0%,
    transparent 100%
  );
  border-left: 3px solid var(--primary-color);
}

/* Modal entrance animation */
@keyframes modal-spring-in {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modal-spring-out {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
}

.modal.active .modal-content {
  animation: modal-spring-in 0.4s var(--spring-smooth) forwards;
}

.modal.closing .modal-content {
  animation: modal-spring-out 0.3s var(--apple-ease) forwards;
}

/* Backdrop blur animation for active modal */
.modal.active {
  backdrop-filter: blur(8px);
}

/* Input focus animations */
input,
select,
textarea {
  transition:
    all 0.3s var(--spring-gentle),
    box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  transform: scale(1.01);
  box-shadow:
    0 0 0 4px rgba(59, 130, 246, 0.15),
    0 4px 20px rgba(59, 130, 246, 0.1);
}

[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus {
  box-shadow:
    0 0 0 4px rgba(0, 122, 255, 0.1),
    0 4px 20px rgba(0, 122, 255, 0.08);
}

/* Chat message animations */
@keyframes message-slide-in {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.message {
  animation: message-slide-in 0.4s var(--spring-smooth) forwards;
}

.message.user {
  transform-origin: right center;
}

.message.assistant {
  transform-origin: left center;
}

/* Typing indicator animation */
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

.typing-indicator span {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 2px;
  background: var(--primary-color);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* Notification slide in */
@keyframes notification-slide {
  0% {
    opacity: 0;
    transform: translateX(100%) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.toast,
.toast-notification {
  animation: notification-slide 0.5s var(--spring-smooth) forwards;
}

/* Pomodoro timer glow */
.pomodoro-widget {
  transition: all 0.4s var(--spring-smooth);
}

.pomodoro-widget:hover {
  transform: translateY(-4px);
}

.pomodoro-ring-progress {
  transition: stroke-dashoffset 1s var(--apple-ease);
}

/* Page transition animations */
@keyframes page-enter {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-content,
.notes-page,
.calendar-page,
.tasks-page,
.projects-page,
.health-page,
.settings-page {
  animation: page-enter 0.6s var(--spring-smooth) forwards;
}

/* Loading skeleton shimmer */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-color) 0%,
    var(--surface-elevated) 50%,
    var(--surface-color) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* Stagger animations for lists */
.kpi-grid .kpi-card,
.notes-grid .note-card,
.projects-list .project-card {
  opacity: 0;
  animation: fadeInUp 0.5s var(--spring-smooth) forwards;
}

.kpi-grid .kpi-card:nth-child(1),
.notes-grid .note-card:nth-child(1),
.projects-list .project-card:nth-child(1) { animation-delay: 0.05s; }

.kpi-grid .kpi-card:nth-child(2),
.notes-grid .note-card:nth-child(2),
.projects-list .project-card:nth-child(2) { animation-delay: 0.1s; }

.kpi-grid .kpi-card:nth-child(3),
.notes-grid .note-card:nth-child(3),
.projects-list .project-card:nth-child(3) { animation-delay: 0.15s; }

.kpi-grid .kpi-card:nth-child(4),
.notes-grid .note-card:nth-child(4),
.projects-list .project-card:nth-child(4) { animation-delay: 0.2s; }

.kpi-grid .kpi-card:nth-child(5),
.notes-grid .note-card:nth-child(5),
.projects-list .project-card:nth-child(5) { animation-delay: 0.25s; }

.kpi-grid .kpi-card:nth-child(6),
.notes-grid .note-card:nth-child(6),
.projects-list .project-card:nth-child(6) { animation-delay: 0.3s; }

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Focus visible for accessibility */
*:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Theme switch animation */
[data-theme] {
  transition:
    background-color 0.5s var(--apple-ease),
    color 0.3s ease;
}

/* Logo breathing animation */
.logo {
  animation: float 6s ease-in-out infinite;
}

/* Interactive shine effect on cards */
.kpi-card::before,
.note-card::before,
.quick-view::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
  transition: left 0.7s ease;
  pointer-events: none;
}

.kpi-card:hover::before,
.note-card:hover::before,
.quick-view:hover::before {
  left: 100%;
}

/* Subtle border glow on hover */
.kpi-card,
.note-card,
.quick-view,
.chat-section,
.sidebar {
  position: relative;
}

.kpi-card::after,
.quick-view::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    transparent 0%,
    rgba(59, 130, 246, 0) 40%,
    rgba(59, 130, 246, 0.3) 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.kpi-card:hover::after,
.quick-view:hover::after {
  opacity: 1;
}

/* ===== MULTI-SOURCE HEALTH DASHBOARD ===== */

/* Health View Toggle */
.health-view-toggle {
  margin-bottom: 24px;
  padding: 20px;
}

.view-toggle-header {
  margin-bottom: 16px;
}

.view-toggle-header h3 {
  margin: 0 0 4px 0;
  font-size: 1.1rem;
}

.view-toggle-description {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 0;
}

.view-toggle-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.view-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  background: var(--glass-bg);
  border: 2px solid transparent;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s var(--spring-smooth);
  text-align: center;
}

.view-option:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.view-option.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(139, 92, 246, 0.1) 100%);
  border-color: var(--primary-color);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2);
}

.view-option-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.view-option-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.view-option-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Health Sources Grid */
.health-sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.source-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  transition: all 0.3s var(--spring-smooth);
}

.source-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.source-card.whoop {
  border-left: 4px solid #00d4aa;
}

.source-card.garmin {
  border-left: 4px solid #1e90ff;
}

.source-card.apple-health {
  border-left: 4px solid #ff3b30;
}

.source-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.source-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.source-card.whoop .source-logo {
  background: linear-gradient(135deg, rgba(0, 212, 170, 0.2) 0%, rgba(0, 212, 170, 0.05) 100%);
  color: #00d4aa;
}

.source-card.garmin .source-logo {
  background: linear-gradient(135deg, rgba(30, 144, 255, 0.2) 0%, rgba(30, 144, 255, 0.05) 100%);
  color: #1e90ff;
}

.source-card.apple-health .source-logo {
  background: linear-gradient(135deg, rgba(255, 59, 48, 0.2) 0%, rgba(255, 59, 48, 0.05) 100%);
  color: #ff3b30;
}

.source-info {
  flex: 1;
}

.source-info h4 {
  margin: 0 0 4px 0;
  font-size: 1rem;
  font-weight: 600;
}

.source-status {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.source-badge {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.source-badge .badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success-color);
  animation: pulse-dot 2s infinite;
}

.source-badge.disconnected .badge-dot {
  background: var(--text-muted);
  animation: none;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
}

.source-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.source-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.source-btn.connect {
  background: var(--primary-color);
  color: white;
}

.source-btn.connect:hover {
  background: var(--primary-dark);
}

.source-btn.connect:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
}

.source-btn.disconnect {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.source-btn.disconnect:hover {
  background: rgba(239, 68, 68, 0.3);
}

.source-data {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.source-metric {
  text-align: center;
}

.source-metric .metric-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.source-metric .metric-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Intelligent Fitting Card */
.intelligent-card {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 24px;
  margin-bottom: 24px;
}

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

.intelligent-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.intelligent-icon {
  font-size: 1.5rem;
}

.intelligent-title h3 {
  margin: 0;
  font-size: 1.25rem;
}

.intelligent-badge {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.intelligent-description {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.intelligent-description span {
  color: var(--primary-color);
  font-weight: 600;
}

.intelligent-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.intelligent-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.metric-ring {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 12px;
}

.metric-ring svg {
  transform: rotate(-90deg);
}

.metric-ring .ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 8;
}

.metric-ring .ring-progress {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 1s var(--apple-ease);
}

.metric-ring.recovery .ring-progress { stroke: #10b981; }
.metric-ring.sleep .ring-progress { stroke: #8b5cf6; }
.metric-ring.strain .ring-progress { stroke: #f59e0b; }
.metric-ring.hrv .ring-progress { stroke: #3b82f6; }

.ring-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.metric-confidence {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.intelligent-sources {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.intelligent-sources h4 {
  margin: 0 0 12px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.sources-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sources-list .source-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--glass-bg);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.sources-list .source-tag.whoop { color: #00d4aa; }
.sources-list .source-tag.garmin { color: #1e90ff; }
.sources-list .source-tag.apple { color: #ff3b30; }

/* Individual Sources View */
.individual-sources-view {
  animation: fadeIn 0.4s ease;
}

/* Light theme for health dashboard */
[data-theme="light"] .source-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .source-card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .source-logo {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .intelligent-card {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

[data-theme="light"] .metric-ring .ring-bg {
  stroke: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .view-option {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .view-option:hover {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .view-option.active {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.1) 0%, rgba(88, 86, 214, 0.05) 100%);
  border-color: var(--primary-color);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .view-toggle-options {
    grid-template-columns: 1fr;
  }

  .health-sources-grid {
    grid-template-columns: 1fr;
  }

  .intelligent-metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .metric-ring {
    width: 80px;
    height: 80px;
  }

  .ring-value {
    font-size: 1rem;
  }
}

/* ===== FINANCE PAGE - MONEY MANAGER STYLE ===== */

.finance-page {
  animation: page-enter 0.6s var(--spring-smooth) forwards;
}

/* Balance Summary Cards */
.finance-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.balance-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
  border-radius: 20px;
  padding: 24px;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s var(--spring-smooth);
}

.balance-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.balance-card.total {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(139, 92, 246, 0.1) 100%);
  border-color: rgba(59, 130, 246, 0.3);
}

.balance-card.income {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.05) 100%);
  border-color: rgba(16, 185, 129, 0.3);
}

.balance-card.expense {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.05) 100%);
  border-color: rgba(239, 68, 68, 0.3);
}

.balance-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.balance-icon {
  font-size: 1.25rem;
}

.balance-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.balance-amount {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.balance-amount.positive { color: #10b981; }
.balance-amount.negative { color: #ef4444; }

.balance-period {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.balance-trend {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 8px;
}

.balance-trend.positive { color: #10b981; }
.balance-trend.negative { color: #ef4444; }

/* Main Finance Layout */
.finance-main {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

/* Transactions Panel */
.transactions-panel {
  padding: 0;
  overflow: hidden;
}

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

.transactions-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.transactions-actions {
  display: flex;
  gap: 12px;
}

.filter-select {
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.transactions-list {
  max-height: 600px;
  overflow-y: auto;
}

.transaction-group {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
}

.transaction-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: capitalize;
  margin-bottom: 12px;
  font-weight: 500;
}

.transaction-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.2s ease;
}

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

.transaction-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: rgba(255, 255, 255, 0.1);
}

.transaction-item.income .transaction-icon {
  background: rgba(16, 185, 129, 0.2);
}

.transaction-item.expense .transaction-icon {
  background: rgba(239, 68, 68, 0.1);
}

.transaction-info {
  flex: 1;
}

.transaction-category {
  font-weight: 600;
  color: var(--text-primary);
}

.transaction-description {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.transaction-amount {
  font-weight: 700;
  font-size: 1rem;
}

.transaction-amount.income { color: #10b981; }
.transaction-amount.expense { color: #ef4444; }

.delete-transaction-btn {
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.transaction-item:hover .delete-transaction-btn {
  opacity: 1;
}

/* Finance Sidebar */
.finance-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.period-selector {
  padding: 16px;
}

.period-selector h4 {
  margin: 0 0 12px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.period-buttons {
  display: flex;
  gap: 8px;
}

.period-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: var(--glass-bg);
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.period-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.period-btn.active {
  background: var(--primary-color);
  color: white;
}

/* Chart Cards */
.chart-card {
  padding: 20px;
}

.chart-card h4 {
  margin: 0 0 16px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

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

/* Categories Card */
.categories-card {
  padding: 20px;
}

.categories-card h4 {
  margin: 0 0 16px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.categories-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-item {
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
}

.category-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.category-icon {
  font-size: 1.1rem;
}

.category-name {
  font-weight: 500;
  color: var(--text-primary);
}

.category-stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.category-amount {
  font-weight: 600;
  color: var(--text-primary);
}

.category-percentage {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.category-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.category-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s var(--apple-ease);
}

/* Empty State */
.finance-page .empty-state {
  text-align: center;
  padding: 48px 24px;
}

.finance-page .empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.finance-page .empty-state h3 {
  color: var(--text-primary);
  margin-bottom: 8px;
}

.finance-page .empty-state p {
  color: var(--text-secondary);
}

/* Transaction Modal */
#transaction-modal .modal-content {
  max-width: 480px;
}

.type-toggle {
  display: flex;
  gap: 8px;
}

.type-btn {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.type-btn.active[data-type="expense"] {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

.type-btn.active[data-type="income"] {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #10b981;
}

.amount-input-wrapper {
  position: relative;
}

.currency-symbol {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.amount-input-wrapper input {
  padding-left: 40px;
  font-size: 1.5rem;
  font-weight: 600;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.category-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--glass-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-glow);
}

.category-btn.selected {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.cat-icon {
  font-size: 1.5rem;
}

.category-btn span:last-child {
  font-size: 0.7rem;
  font-weight: 500;
}

/* Light Theme Finance */
[data-theme="light"] .balance-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
}

[data-theme="light"] .balance-card.total {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
}

[data-theme="light"] .balance-card.income {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.02) 100%);
}

[data-theme="light"] .balance-card.expense {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.02) 100%);
}

[data-theme="light"] .transaction-item {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .transaction-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .category-item {
  background: rgba(0, 0, 0, 0.02);
}

/* Finance Mobile */
@media (max-width: 768px) {
  .finance-summary {
    grid-template-columns: 1fr;
  }

  .finance-main {
    grid-template-columns: 1fr;
  }

  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .balance-amount {
    font-size: 1.5rem;
  }
}

/* ===== ENHANCED MOBILE UX ===== */

/* Mobile-first improvements */
@media (max-width: 768px) {
  /* Better touch targets */
  button,
  .btn,
  .nav-link,
  .nav-item,
  input,
  select,
  textarea {
    min-height: 44px;
  }

  /* Improved header for mobile */
  header {
    padding: 12px 16px;
    flex-direction: column;
    gap: 12px;
    border-radius: 16px;
    margin-bottom: 16px;
  }

  .header-left {
    width: 100%;
    justify-content: center;
  }

  .logo {
    width: 36px;
    height: 36px;
  }

  header h1 {
    font-size: 1.25rem;
  }

  .subtitle {
    font-size: 0.7rem;
  }

  .header-nav {
    display: none;
  }

  /* Better card spacing */
  .card,
  .kpi-card,
  .balance-card {
    border-radius: 16px;
    padding: 16px;
  }

  /* Improved chat input */
  .chat-input-container {
    padding: 10px 14px;
    border-radius: 24px;
  }

  #message-input {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Better modal for mobile */
  .modal-content {
    width: 95%;
    max-width: none;
    max-height: 90vh;
    margin: auto;
    border-radius: 20px;
  }

  .modal-header {
    padding: 16px 20px;
  }

  .modal-body {
    padding: 16px 20px;
  }

  /* Better form elements */
  .form-group {
    margin-bottom: 16px;
  }

  .form-group label {
    margin-bottom: 8px;
    font-size: 0.9rem;
  }

  input,
  select,
  textarea {
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 12px;
  }

  /* Enhanced bottom nav */
  .mobile-bottom-nav {
    padding: 8px 16px 20px;
    border-radius: 24px 24px 0 0;
    background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.1) 0%,
      var(--surface-color) 20%
    );
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  }

  [data-theme="light"] .mobile-bottom-nav {
    background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.5) 0%,
      rgba(255, 255, 255, 0.95) 20%
    );
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  }

  .nav-items {
    display: flex;
    justify-content: space-around;
    gap: 4px;
  }

  .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 12px;
    transition: all 0.3s var(--spring-smooth);
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-decoration: none;
  }

  .nav-item:active {
    transform: scale(0.92);
  }

  .nav-item.active {
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.15);
  }

  [data-theme="light"] .nav-item.active {
    background: rgba(0, 122, 255, 0.1);
  }

  .nav-item .nav-icon {
    font-size: 1.4rem;
    transition: transform 0.3s var(--spring-bounce);
  }

  .nav-item.active .nav-icon {
    transform: scale(1.15);
  }

  /* Pull-to-refresh indicator space */
  body {
    overscroll-behavior-y: contain;
  }

  /* Swipe-friendly cards */
  .transaction-item,
  .task-card,
  .note-card,
  .event-item {
    border-radius: 14px;
    margin-bottom: 8px;
  }

  /* Better scrolling */
  .transactions-list,
  .events-list,
  .chat-messages,
  .notes-grid {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* Floating action button style for primary actions */
  .fab-container {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 100;
  }

  .fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    transition: all 0.3s var(--spring-bounce);
    display: flex;
    align-items: center;
    justify-content: center;
  }

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

  /* Gesture hint animations */
  @keyframes swipe-hint {
    0%, 100% { transform: translateX(0); opacity: 1; }
    50% { transform: translateX(10px); opacity: 0.5; }
  }

  .swipeable::after {
    content: '→';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    animation: swipe-hint 2s ease-in-out infinite;
  }

  .swipeable:hover::after {
    opacity: 0.5;
  }
}

/* Very small phones */
@media (max-width: 375px) {
  .container {
    padding: 12px;
  }

  header h1 {
    font-size: 1.1rem;
  }

  .balance-amount {
    font-size: 1.25rem;
  }

  .kpi-value {
    font-size: 1.25rem;
  }

  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .nav-item {
    font-size: 0.6rem;
  }

  .nav-item .nav-icon {
    font-size: 1.2rem;
  }
}

/* Landscape phone */
@media (max-width: 768px) and (orientation: landscape) {
  .mobile-bottom-nav {
    padding: 6px 24px 10px;
  }

  .nav-item {
    padding: 6px 8px;
  }

  .nav-item .nav-icon {
    font-size: 1.2rem;
  }

  .modal-content {
    max-height: 95vh;
  }
}

/* Safe area for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .mobile-bottom-nav {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .container {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
  /* Fix for iOS input zoom */
  input,
  select,
  textarea {
    font-size: 16px;
  }

  /* Better momentum scrolling on iOS */
  .transactions-list,
  .events-list,
  .chat-messages,
  .notes-grid {
    -webkit-overflow-scrolling: touch;
  }
}

/* Dark mode status bar handling */
@media (prefers-color-scheme: dark) {
  meta[name="theme-color"] {
    content: "#0a0e1a";
  }
}

/* Haptic feedback hint for interactive elements */
@media (max-width: 768px) {
  button:active,
  .btn:active,
  .card:active,
  .nav-item:active {
    opacity: 0.9;
  }
}

/* Improved touch ripple effect */
.touch-ripple {
  position: relative;
  overflow: hidden;
}

.touch-ripple::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
}

.touch-ripple:active::before {
  width: 200%;
  height: 200%;
  opacity: 1;
}

/* Skeleton loading for mobile */
.skeleton-mobile {
  background: linear-gradient(
    90deg,
    var(--surface-color) 0%,
    var(--surface-elevated) 50%,
    var(--surface-color) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 12px;
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

/* Empty state improvements for mobile */
@media (max-width: 768px) {
  .empty-state {
    padding: 40px 20px;
  }

  .empty-icon {
    font-size: 2.5rem;
  }

  .empty-state h3 {
    font-size: 1.1rem;
  }

  .empty-state p {
    font-size: 0.9rem;
  }
}

/* =====================================================
   MOBILE UX IMPROVEMENTS - CLEANER, LESS CLUTTERED
   ===================================================== */

@media (max-width: 768px) {
  /* Global mobile spacing improvements */
  .container {
    padding: 10px;
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
  }

  /* Cleaner header - minimal */
  header {
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: 14px;
  }

  .logo-container {
    gap: 8px;
  }

  .logo {
    width: 32px;
    height: 32px;
  }

  /* Compact KPI cards */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .kpi-card {
    padding: 12px;
    border-radius: 12px;
  }

  .kpi-value {
    font-size: 1.3rem;
  }

  .kpi-label {
    font-size: 0.7rem;
  }

  /* Cleaner chat section */
  .chat-section {
    border-radius: 16px;
    padding: 12px;
  }

  .chat-header {
    padding: 10px 12px;
    margin-bottom: 10px;
  }

  .chat-header h2 {
    font-size: 1rem;
  }

  .chat-messages {
    padding: 10px 0;
    max-height: 50vh;
  }

  .message {
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 12px;
    font-size: 0.9rem;
  }

  .chat-input {
    padding: 10px 12px;
    border-radius: 20px;
    gap: 8px;
  }

  #message-input {
    padding: 10px 14px;
    font-size: 16px;
    border-radius: 18px;
  }

  #send-button {
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 0.85rem;
  }

  /* Quick commands - more compact */
  .quick-commands {
    gap: 6px;
    padding: 8px 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }

  .quick-command-btn {
    padding: 8px 12px;
    font-size: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .quick-command-btn .emoji {
    font-size: 0.9rem;
  }

  /* Hide dashboard sidebar on mobile */
  .dashboard {
    display: none;
  }

  /* Compact quick actions */
  .quick-view {
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 12px;
  }

  .quick-view h3 {
    font-size: 0.9rem;
    margin-bottom: 10px;
  }

  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .quick-action-btn {
    padding: 10px 12px;
    font-size: 0.75rem;
    border-radius: 10px;
  }

  /* Pomodoro widget - more compact */
  .pomodoro-widget {
    padding: 14px;
  }

  .pomodoro-display {
    transform: scale(0.85);
  }

  .pomodoro-time {
    font-size: 2rem;
  }

  .pomodoro-modes button {
    padding: 6px 10px;
    font-size: 0.7rem;
  }

  /* Finance page mobile */
  .finance-page {
    padding: 0;
  }

  .finance-header {
    padding: 12px;
    margin-bottom: 12px;
  }

  .finance-header h1 {
    font-size: 1.3rem;
  }

  .finance-summary {
    gap: 10px;
    padding: 0 8px;
  }

  .balance-card {
    padding: 14px;
    border-radius: 14px;
  }

  .balance-label {
    font-size: 0.75rem;
  }

  .balance-amount {
    font-size: 1.4rem;
  }

  .finance-main {
    padding: 0 8px;
    gap: 12px;
  }

  .transactions-section,
  .categories-section {
    padding: 14px;
    border-radius: 14px;
  }

  .section-header h2 {
    font-size: 1rem;
  }

  .transaction-item {
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 8px;
  }

  .transaction-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .transaction-title {
    font-size: 0.85rem;
  }

  .transaction-category {
    font-size: 0.7rem;
  }

  .transaction-amount {
    font-size: 0.95rem;
  }

  /* Notes page mobile */
  .notes-page {
    padding: 0;
  }

  .notes-header {
    padding: 12px;
  }

  .notes-toolbar {
    padding: 0 10px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .notes-grid {
    padding: 0 10px;
    gap: 10px;
    grid-template-columns: repeat(2, 1fr);
  }

  .note-card {
    padding: 12px;
    border-radius: 12px;
  }

  .note-card .note-title {
    font-size: 0.85rem;
    margin-bottom: 6px;
  }

  .note-card .note-preview {
    font-size: 0.75rem;
    -webkit-line-clamp: 2;
  }

  .note-card .note-meta {
    font-size: 0.65rem;
    margin-top: 8px;
  }

  /* Tasks page mobile */
  .tasks-page {
    padding: 0;
  }

  .tasks-header {
    padding: 12px;
  }

  .tasks-header h1 {
    font-size: 1.3rem;
  }

  .tasks-toolbar {
    padding: 0 10px;
    gap: 8px;
  }

  .filter-btn {
    padding: 8px 12px;
    font-size: 0.75rem;
    border-radius: 16px;
  }

  .tasks-list {
    padding: 0 10px;
  }

  .task-card {
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 10px;
  }

  .task-card .task-title {
    font-size: 0.9rem;
    margin-bottom: 4px;
  }

  .task-card .task-meta {
    font-size: 0.7rem;
    gap: 8px;
  }

  .task-checkbox {
    width: 20px;
    height: 20px;
  }

  /* Projects page mobile */
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 10px;
  }

  .project-card {
    padding: 14px;
    border-radius: 14px;
  }

  .project-card h3 {
    font-size: 1rem;
  }

  /* Health page mobile */
  .health-summary-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .health-card {
    padding: 14px;
    border-radius: 14px;
  }

  .health-card .metric-value {
    font-size: 1.5rem;
  }

  .health-card .metric-label {
    font-size: 0.7rem;
  }

  /* Settings page mobile */
  .settings-page {
    padding: 0 10px;
  }

  .settings-section {
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 12px;
  }

  .settings-section h2 {
    font-size: 1rem;
    margin-bottom: 12px;
  }

  .setting-item {
    padding: 12px 0;
  }

  .setting-item label {
    font-size: 0.85rem;
  }

  /* Modal improvements for mobile */
  .modal-content {
    width: calc(100% - 20px);
    max-height: calc(100vh - 40px);
    border-radius: 20px;
    margin: 20px auto;
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-header h2 {
    font-size: 1.1rem;
  }

  .modal-body {
    padding: 14px 16px;
  }

  .modal-footer {
    padding: 14px 16px;
    gap: 10px;
  }

  .modal-footer .btn {
    padding: 12px 20px;
    font-size: 0.9rem;
    flex: 1;
  }

  /* Better form inputs on mobile */
  .form-group {
    margin-bottom: 14px;
  }

  .form-group label {
    font-size: 0.85rem;
    margin-bottom: 6px;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  select,
  textarea {
    padding: 12px 14px;
    font-size: 16px;
    border-radius: 10px;
  }

  /* Horizontal scroll for filter buttons */
  .filter-buttons,
  .tabs,
  .tag-list {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .filter-buttons::-webkit-scrollbar,
  .tabs::-webkit-scrollbar,
  .tag-list::-webkit-scrollbar {
    display: none;
  }

  /* Better spacing for lists */
  .list-container,
  .transactions-list,
  .events-list,
  .tasks-list {
    gap: 8px;
  }

  /* Cleaner empty states */
  .empty-state {
    padding: 30px 16px;
    text-align: center;
  }

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

  .empty-state h3 {
    font-size: 1rem;
    margin-bottom: 6px;
  }

  .empty-state p {
    font-size: 0.8rem;
    color: var(--text-secondary);
  }
}

/* Extra small devices - phones under 375px */
@media (max-width: 375px) {
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .kpi-card {
    padding: 10px;
  }

  .kpi-value {
    font-size: 1.1rem;
  }

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

  .health-summary-cards {
    grid-template-columns: 1fr;
  }

  .quick-actions-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .quick-action-btn {
    padding: 8px;
    font-size: 0.7rem;
  }
}

/* =====================================================
   MOBILE-FIRST REDESIGN - PROFESSIONAL UX
   ===================================================== */

/* Mobile Bottom Navigation - Enhanced */
@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 8px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    z-index: 10000;
    justify-content: center;
  }

  [data-theme="light"] .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }

  .mobile-bottom-nav .nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    max-width: 400px;
    gap: 4px;
  }

  .mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 10px;
    min-width: 56px;
    position: relative;
  }

  .mobile-bottom-nav .nav-item .nav-icon {
    font-size: 1.3rem;
    line-height: 1;
    transition: transform 0.2s ease;
  }

  .mobile-bottom-nav .nav-item.active {
    color: var(--primary-color);
  }

  .mobile-bottom-nav .nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 0 0 3px 3px;
  }

  .mobile-bottom-nav .nav-item.active .nav-icon {
    transform: scale(1.15);
  }

  /* Hide desktop navigation completely on mobile */
  .header-nav {
    display: none !important;
  }

  /* Compact Header for Mobile */
  header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 10px 12px !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: rgba(15, 15, 20, 0.9) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  [data-theme="light"] header {
    background: rgba(255, 255, 255, 0.9) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }

  .header-left {
    flex: 1;
  }

  .logo-container {
    gap: 10px;
  }

  .logo {
    width: 36px !important;
    height: 36px !important;
  }

  .brand-text h1 {
    font-size: 1.2rem !important;
    letter-spacing: 1px;
  }

  .brand-text .subtitle {
    display: none !important;
  }

  /* Theme toggle in header */
  #theme-toggle {
    width: 40px;
    height: 40px;
    padding: 8px;
    margin-left: auto;
  }

  /* Main Container Mobile Optimizations */
  .container {
    padding: 0 !important;
    padding-bottom: calc(70px + env(safe-area-inset-bottom)) !important;
    min-height: 100vh;
    overflow-x: hidden;
  }

  /* Main Content Area */
  main, .main-content {
    padding: 12px;
    padding-bottom: 20px;
  }

  /* Dashboard Layout Mobile */
  .dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  /* KPI Cards - 2x2 Grid */
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 12px;
    margin-bottom: 12px;
  }

  .kpi-card {
    padding: 14px;
    border-radius: 16px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
  }

  .kpi-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }

  .kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
  }

  .kpi-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
  }

  /* Chat Section - Full Width, Better UX */
  .chat-section {
    margin: 0 12px 12px;
    border-radius: 20px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    overflow: hidden;
  }

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

  .chat-header h2 {
    font-size: 1rem;
    font-weight: 600;
  }

  .chat-messages {
    height: 300px;
    max-height: 40vh;
    overflow-y: auto;
    padding: 12px;
    scroll-behavior: smooth;
  }

  .message {
    padding: 12px 14px;
    margin-bottom: 10px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 85%;
  }

  .message.user {
    margin-left: auto;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
  }

  .message.assistant {
    margin-right: auto;
    background: var(--surface-elevated);
    border-bottom-left-radius: 4px;
  }

  /* Message animations - fade in from bottom */
  .message {
    animation: messageSlideIn 0.3s ease-out;
    opacity: 0;
    animation-fill-mode: forwards;
  }

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

  /* Typing indicator */
  .typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
    margin-bottom: 10px;
    border-radius: 16px;
    background: var(--surface-elevated);
    border-bottom-left-radius: 4px;
    max-width: 85px;
    margin-right: auto;
  }

  .typing-indicator.hidden {
    display: none;
  }

  .typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: typingBounce 1.4s infinite ease-in-out;
  }

  .typing-dot:nth-child(1) {
    animation-delay: -0.32s;
  }

  .typing-dot:nth-child(2) {
    animation-delay: -0.16s;
  }

  .typing-dot:nth-child(3) {
    animation-delay: 0;
  }

  @keyframes typingBounce {
    0%, 80%, 100% {
      transform: scale(0.8);
      opacity: 0.5;
    }
    40% {
      transform: scale(1);
      opacity: 1;
    }
  }

  /* Success flash animation */
  .message.success-flash {
    animation: successFlash 0.6s ease-out;
  }

  @keyframes successFlash {
    0% {
      background: var(--surface-elevated);
    }
    20% {
      background: rgba(5, 150, 105, 0.2);
      box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.4);
    }
    40% {
      background: rgba(5, 150, 105, 0.15);
      box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.2);
    }
    100% {
      background: var(--surface-elevated);
      box-shadow: 0 0 0 0 rgba(5, 150, 105, 0);
    }
  }

  .message.user.success-flash {
    animation: successFlashUser 0.6s ease-out;
  }

  @keyframes successFlashUser {
    0% {
      background: var(--primary-color);
    }
    20% {
      background: rgba(5, 150, 105, 0.9);
      box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.4);
    }
    40% {
      background: rgba(5, 150, 105, 0.85);
      box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.2);
    }
    100% {
      background: var(--primary-color);
      box-shadow: 0 0 0 0 rgba(5, 150, 105, 0);
    }
  }

  /* Smooth scroll behavior */
  .chat-messages {
    scroll-behavior: smooth;
  }

  /* Chat Input - Fixed at Bottom of Chat */
  .chat-input {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: var(--surface-elevated);
    border-top: 1px solid var(--border-color);
  }

  #message-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px !important;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
  }

  #message-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  }

  #send-button {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    flex-shrink: 0;
  }

  #send-button:active {
    transform: scale(0.95);
  }

  /* Quick Commands - Horizontal Scroll */
  .quick-commands {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-top: 1px solid var(--border-color);
  }

  .quick-commands::-webkit-scrollbar {
    display: none;
  }

  .quick-command-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 0.8rem;
    border-radius: 20px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    white-space: nowrap;
    transition: all 0.2s;
  }

  .quick-command-btn:active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
  }

  /* Quick Actions Grid */
  .quick-view {
    margin: 0 12px 12px;
    padding: 16px;
    border-radius: 16px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
  }

  .quick-view h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
  }

  .quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .quick-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-radius: 14px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
  }

  .quick-action-btn:active {
    transform: scale(0.98);
    background: var(--primary-color);
    color: white;
  }

  .quick-action-btn .action-icon {
    font-size: 1.3rem;
  }

  /* Dashboard Sidebar Hidden on Mobile */
  .dashboard, .sidebar, .dashboard-sidebar {
    display: none !important;
  }

  /* Widgets Container */
  .widgets-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 12px;
  }

  /* Card Base Style for Mobile */
  .card, .widget {
    border-radius: 16px;
    padding: 16px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
  }

  /* Today's Events/Tasks Preview */
  .today-preview {
    margin: 0 12px 12px;
  }

  .today-preview h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
  }

  .event-item, .task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--surface-elevated);
    border-radius: 12px;
    margin-bottom: 8px;
  }

  .event-time, .task-time {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
    min-width: 50px;
  }

  .event-title, .task-title {
    font-size: 0.9rem;
    font-weight: 500;
    flex: 1;
  }
}

/* =====================================================
   CALENDAR PAGE - MOBILE OPTIMIZATION
   ===================================================== */
@media (max-width: 768px) {
  .calendar-page {
    padding: 0;
  }

  .calendar-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 56px;
    z-index: 50;
  }

  .calendar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .calendar-nav button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--surface-elevated);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
  }

  .calendar-title {
    font-size: 1.1rem;
    font-weight: 600;
  }

  /* Calendar Views Tabs */
  .calendar-views {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: var(--surface-color);
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
  }

  .view-btn {
    padding: 8px 16px;
    font-size: 0.8rem;
    border-radius: 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
  }

  .view-btn.active {
    background: var(--primary-color);
    color: white;
  }

  /* Mini Calendar Grid */
  .mini-calendar {
    padding: 12px;
  }

  .calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    padding-bottom: 8px;
    font-weight: 600;
  }

  .calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
  }

  .calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
  }

  .calendar-day.today {
    background: var(--primary-color);
    color: white;
  }

  .calendar-day.has-events::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
  }

  .calendar-day.today.has-events::after {
    background: white;
  }

  .calendar-day:active {
    transform: scale(0.95);
  }

  /* Events List */
  .events-list {
    padding: 12px;
  }

  .events-list h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 600;
  }

  .event-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: var(--surface-elevated);
    border-radius: 14px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary-color);
  }

  .event-card .event-time {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 600;
    min-width: 60px;
  }

  .event-card .event-details {
    flex: 1;
  }

  .event-card .event-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
  }

  .event-card .event-location {
    font-size: 0.8rem;
    color: var(--text-muted);
  }
}

/* =====================================================
   TASKS PAGE - MOBILE OPTIMIZATION
   ===================================================== */
@media (max-width: 768px) {
  .tasks-page {
    padding: 0;
  }

  .tasks-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 56px;
    z-index: 50;
    background: var(--bg-color);
  }

  .tasks-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
  }

  /* Filter Pills - Horizontal Scroll */
  .tasks-filters, .filter-tabs {
    display: flex;
    gap: 8px;
    padding: 0 12px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .filter-btn, .filter-tab {
    flex-shrink: 0;
    padding: 8px 16px;
    font-size: 0.8rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
  }

  .filter-btn.active, .filter-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
  }

  /* Tasks List */
  .tasks-list {
    padding: 0 12px;
  }

  .task-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    background: var(--surface-color);
    border-radius: 16px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
  }

  .task-card:active {
    transform: scale(0.99);
  }

  .task-checkbox {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
  }

  .task-checkbox.checked {
    background: var(--success-color);
    border-color: var(--success-color);
  }

  .task-checkbox.checked::after {
    content: '\2713';
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
  }

  .task-content {
    flex: 1;
    min-width: 0;
  }

  .task-title {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 6px;
    word-wrap: break-word;
  }

  .task-card.completed .task-title {
    text-decoration: line-through;
    color: var(--text-muted);
  }

  .task-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
  }

  .task-priority {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
  }

  .task-priority.high {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
  }

  .task-priority.medium {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
  }

  .task-priority.low {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
  }

  /* Add Task FAB */
  .add-task-fab, .fab-button {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s;
  }

  .add-task-fab:active, .fab-button:active {
    transform: scale(0.95);
  }
}

/* =====================================================
   NOTES PAGE - MOBILE OPTIMIZATION
   ===================================================== */
@media (max-width: 768px) {
  .notes-page {
    padding: 0;
  }

  .notes-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 56px;
    z-index: 50;
    background: var(--bg-color);
  }

  .notes-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
  }

  /* Notes Search */
  .notes-search {
    padding: 0 12px 12px;
  }

  .notes-search input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    font-size: 16px;
    color: var(--text-primary);
  }

  /* Notes Grid - Pinterest Style */
  .notes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 12px;
  }

  .note-card {
    padding: 14px;
    border-radius: 14px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    break-inside: avoid;
    transition: all 0.2s;
  }

  .note-card:active {
    transform: scale(0.98);
  }

  .note-card.pinned {
    border-color: var(--primary-color);
  }

  .note-card .note-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
  }

  .note-card .note-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .note-card .note-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 0.7rem;
    color: var(--text-muted);
  }

  .note-card .note-type {
    padding: 3px 8px;
    border-radius: 8px;
    background: var(--surface-elevated);
    font-weight: 500;
  }
}

/* =====================================================
   FINANCE PAGE - MOBILE OPTIMIZATION
   ===================================================== */
@media (max-width: 768px) {
  .finance-page {
    padding: 0;
  }

  /* Balance Cards - Swipeable */
  .balance-cards, .finance-summary {
    display: flex;
    gap: 12px;
    padding: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  .balance-card {
    flex-shrink: 0;
    width: calc(100vw - 48px);
    max-width: 300px;
    padding: 20px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    scroll-snap-align: start;
  }

  .balance-card .balance-label {
    font-size: 0.8rem;
    opacity: 0.9;
    margin-bottom: 8px;
  }

  .balance-card .balance-amount {
    font-size: 2rem;
    font-weight: 700;
  }

  .balance-card .balance-change {
    font-size: 0.85rem;
    margin-top: 8px;
    opacity: 0.9;
  }

  /* Quick Stats */
  .finance-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 12px 12px;
  }

  .stat-card {
    padding: 16px;
    border-radius: 14px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
  }

  .stat-card .stat-icon {
    font-size: 1.3rem;
    margin-bottom: 8px;
  }

  .stat-card .stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
  }

  .stat-card .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
  }

  /* Transactions List */
  .transactions-section {
    padding: 0 12px;
  }

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

  .section-header h2 {
    font-size: 1rem;
    font-weight: 600;
  }

  .section-header a {
    font-size: 0.8rem;
    color: var(--primary-color);
  }

  .transaction-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--surface-color);
    border-radius: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
  }

  .transaction-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--surface-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
  }

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

  .transaction-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 4px;
  }

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

  .transaction-amount {
    font-size: 1rem;
    font-weight: 600;
  }

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

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

/* =====================================================
   HEALTH PAGE - MOBILE OPTIMIZATION
   ===================================================== */
@media (max-width: 768px) {
  .health-page {
    padding: 0;
  }

  .health-header {
    padding: 12px 16px;
    position: sticky;
    top: 56px;
    z-index: 50;
    background: var(--bg-color);
  }

  /* Health Score Card */
  .health-score-card {
    margin: 0 12px 12px;
    padding: 24px;
    border-radius: 20px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    text-align: center;
  }

  .health-score-card .score {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
  }

  .health-score-card .score-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 8px;
  }

  /* Health Metrics Grid */
  .health-metrics, .health-summary-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 12px 12px;
  }

  .health-metric-card, .health-card {
    padding: 16px;
    border-radius: 16px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    text-align: center;
  }

  .health-metric-card .metric-icon, .health-card .metric-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }

  .health-metric-card .metric-value, .health-card .metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
  }

  .health-metric-card .metric-label, .health-card .metric-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
  }

  .health-metric-card .metric-trend {
    font-size: 0.75rem;
    margin-top: 6px;
    padding: 3px 8px;
    border-radius: 8px;
    display: inline-block;
  }

  .health-metric-card .metric-trend.up {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
  }

  .health-metric-card .metric-trend.down {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
  }
}

/* =====================================================
   MODALS - MOBILE BOTTOM SHEET STYLE
   ===================================================== */
@media (max-width: 768px) {
  .modal-backdrop, .modal-overlay {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
  }

  .modal-content, .modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    max-height: 90vh;
    width: 100%;
    margin: 0;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    animation: slideUp 0.3s ease forwards;
    background: var(--surface-color);
    overflow: hidden;
  }

  @keyframes slideUp {
    to {
      transform: translateY(0);
    }
  }

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

  .modal-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
  }

  .modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
  }

  .modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--surface-elevated);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
  }

  .modal-footer {
    padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
  }

  .modal-footer .btn {
    flex: 1;
    padding: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
  }

  .modal-footer .btn-primary {
    background: var(--primary-color);
    color: white;
  }

  .modal-footer .btn-secondary {
    background: var(--surface-elevated);
    color: var(--text-primary);
  }
}

/* =====================================================
   FORM ELEMENTS - TOUCH OPTIMIZED
   ===================================================== */
@media (max-width: 768px) {
  .form-group {
    margin-bottom: 16px;
  }

  .form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  input[type="search"],
  select,
  textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px !important;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
  }

  input:focus,
  select:focus,
  textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  }

  select {
    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='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
  }

  textarea {
    min-height: 120px;
    resize: vertical;
  }

  /* Toggle Switch */
  .toggle-switch {
    position: relative;
    width: 52px;
    height: 32px;
    background: var(--border-color);
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.2s;
  }

  .toggle-switch.active {
    background: var(--primary-color);
  }

  .toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  }

  .toggle-switch.active::after {
    transform: translateX(20px);
  }

  /* Buttons */
  .btn {
    padding: 14px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
  }

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

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

  .btn-secondary {
    background: var(--surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
  }

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

  .btn-block {
    width: 100%;
  }
}

/* =====================================================
   SETTINGS PAGE - MOBILE OPTIMIZATION
   ===================================================== */
@media (max-width: 768px) {
  .settings-page {
    padding: 0;
  }

  .settings-header {
    padding: 12px 16px;
    position: sticky;
    top: 56px;
    z-index: 50;
    background: var(--bg-color);
  }

  .settings-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
  }

  .settings-sections {
    padding: 0 12px;
  }

  .settings-section {
    margin-bottom: 16px;
    border-radius: 16px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    overflow: hidden;
  }

  .settings-section h2 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 16px 8px;
  }

  .setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
  }

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

  .setting-item:active {
    background: var(--surface-elevated);
  }

  .setting-item .setting-info {
    flex: 1;
  }

  .setting-item .setting-label {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 4px;
  }

  .setting-item .setting-description {
    font-size: 0.8rem;
    color: var(--text-muted);
  }

  .setting-item .setting-value {
    font-size: 0.85rem;
    color: var(--text-muted);
  }

  .setting-item .setting-arrow {
    color: var(--text-muted);
    font-size: 0.8rem;
  }
}

/* =====================================================
   UTILITY CLASSES FOR MOBILE
   ===================================================== */
@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }

  .show-mobile {
    display: block !important;
  }

  .text-center-mobile {
    text-align: center;
  }

  .full-width-mobile {
    width: 100% !important;
  }

  .safe-bottom {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .safe-top {
    padding-top: env(safe-area-inset-top);
  }

  .scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .scroll-x::-webkit-scrollbar {
    display: none;
  }

  .touch-active:active {
    opacity: 0.7;
    transform: scale(0.98);
  }

  .pull-indicator {
    text-align: center;
    padding: 12px;
    color: var(--text-muted);
    font-size: 0.8rem;
  }
}

/* =====================================================
   LOADING & EMPTY STATES - MOBILE
   ===================================================== */
@media (max-width: 768px) {
  .skeleton {
    background: linear-gradient(
      90deg,
      var(--surface-color) 0%,
      var(--surface-elevated) 50%,
      var(--surface-color) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
  }

  @keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }

  .skeleton-text {
    height: 14px;
    margin-bottom: 8px;
  }

  .skeleton-card {
    height: 120px;
    border-radius: 16px;
  }

  .empty-state {
    text-align: center;
    padding: 40px 24px;
  }

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

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

  .empty-state p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.5;
  }
}

/* =====================================================
   ACCESSIBILITY - TOUCH TARGETS
   ===================================================== */
@media (max-width: 768px) {
  a, button, [role="button"], input[type="checkbox"], input[type="radio"] {
    min-height: 44px;
  }

  .clickable-item {
    min-height: 48px;
    display: flex;
    align-items: center;
  }
}
/* =====================================================
   FINANCE TABS & BUDGETS & SAVINGS GOALS
   ===================================================== */

.finance-tabs {
  display: flex;
  gap: 10px;
  margin: 20px 0;
  border-bottom: 2px solid var(--border-color);
}

.finance-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  font-weight: 500;
}

.finance-tab:hover {
  color: var(--text-primary);
  background: var(--hover-bg);
}

.finance-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.finance-tab .tab-icon {
  font-size: 1.2rem;
}

.finance-tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.finance-tab-content.active {
  display: block;
}

/* Budget Cards */
.budgets-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.budget-alerts {
  padding: 20px;
  background: rgba(251, 191, 36, 0.1);
  border-left: 4px solid #f59e0b;
}

.budget-alert {
  display: flex;
  gap: 12px;
  padding: 12px;
  margin: 8px 0;
  background: var(--card-bg);
  border-radius: 8px;
  border-left: 3px solid #f59e0b;
}

.budget-alert.critical {
  border-left-color: var(--danger-color);
  background: rgba(239, 68, 68, 0.05);
}

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

.alert-content {
  flex: 1;
}

.alert-message {
  font-weight: 500;
  margin-bottom: 4px;
}

.alert-detail {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.budget-progress-section {
  margin-top: 20px;
}

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

.budget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.budget-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.budget-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.budget-card.warning {
  border-left: 4px solid #f59e0b;
}

.budget-card.exceeded {
  border-left: 4px solid var(--danger-color);
}

.budget-card.good {
  border-left: 4px solid var(--success-color);
}

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

.budget-category {
  display: flex;
  align-items: center;
  gap: 8px;
}

.budget-icon {
  font-size: 1.5rem;
}

.budget-name {
  font-weight: 600;
  text-transform: capitalize;
}

.budget-menu-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text-secondary);
  border-radius: 4px;
}

.budget-menu-btn:hover {
  background: var(--hover-bg);
}

.budget-progress-bar {
  height: 8px;
  background: var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  margin: 15px 0;
}

.budget-progress-fill {
  height: 100%;
  background: var(--success-color);
  transition: width 0.5s ease;
}

.budget-progress-fill.warning {
  background: #f59e0b;
}

.budget-progress-fill.exceeded {
  background: var(--danger-color);
}

.budget-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 15px 0;
}

.budget-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.stat-value {
  font-weight: 600;
  font-size: 0.95rem;
}

.stat-value.negative {
  color: var(--danger-color);
}

.stat-value.positive {
  color: var(--success-color);
}

.budget-percentage {
  text-align: center;
  padding: 8px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.9rem;
}

.budget-percentage.good {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.budget-percentage.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.budget-percentage.exceeded {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
}

/* Context Menu */
.budget-context-menu {
  position: fixed;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  min-width: 150px;
  padding: 4px 0;
}

.budget-context-menu .menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.2s ease;
}

.budget-context-menu .menu-item:hover {
  background: var(--hover-bg);
}

.budget-context-menu .menu-item.delete {
  color: var(--danger-color);
}

/* Savings Goals */
.goals-section {
  padding: 20px 0;
}

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

.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.goal-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.goal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.goal-card.achieved {
  border-left: 4px solid var(--success-color);
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.goal-card.on-track {
  border-left: 4px solid var(--primary-color);
}

.goal-card.needs-attention {
  border-left: 4px solid #f59e0b;
}

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.goal-title h4 {
  margin: 0 0 5px 0;
  font-size: 1.1rem;
}

.goal-description {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 0;
}

.goal-menu-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text-secondary);
  border-radius: 4px;
}

.goal-menu-btn:hover {
  background: var(--hover-bg);
}

.goal-progress-section {
  margin: 15px 0;
}

.goal-progress-bar {
  height: 10px;
  background: var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

.goal-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--success-color));
  transition: width 0.5s ease;
}

.goal-progress-fill.achieved {
  background: var(--success-color);
}

.goal-progress-fill.needs-attention {
  background: #f59e0b;
}

.goal-progress-label {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.goal-amounts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 15px 0;
  padding: 15px;
  background: var(--hover-bg);
  border-radius: 8px;
}

.goal-amount-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.amount-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.amount-value {
  font-weight: 600;
  font-size: 1rem;
}

.goal-timeline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--hover-bg);
  border-radius: 6px;
  margin: 10px 0;
  font-size: 0.9rem;
}

.timeline-icon {
  font-size: 1.1rem;
}

.days-remaining {
  margin-left: auto;
  font-weight: 500;
  color: var(--primary-color);
}

.goal-recommendation {
  padding: 10px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--primary-color);
  margin: 10px 0;
}

.goal-actions {
  margin-top: 15px;
  display: flex;
  gap: 10px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

/* Recommendations Section */
.recommendations-section {
  margin-top: 30px;
  padding: 20px;
}

.recommendation-group {
  margin-bottom: 20px;
}

.recommendation-group h5 {
  margin: 0 0 10px 0;
  color: var(--text-primary);
}

.recommendation-item {
  padding: 12px;
  background: var(--hover-bg);
  border-radius: 8px;
  margin: 8px 0;
  border-left: 3px solid var(--primary-color);
}

.recommendation-item.increase-savings {
  border-left-color: #f59e0b;
}

.recommendation-item.on-track {
  border-left-color: var(--success-color);
}

.recommendation-message {
  font-size: 0.9rem;
  margin-bottom: 5px;
}

.recommendation-action {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}

.no-recommendations {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 15px;
  opacity: 0.5;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .finance-tabs {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .finance-tabs::-webkit-scrollbar {
    display: none;
  }

  .budget-grid,
  .goals-grid {
    grid-template-columns: 1fr;
  }

  .budget-stats,
  .goal-amounts {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .budget-header,
  .goals-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* ========================
   MOBILE UX ENHANCEMENTS
   Enhanced mobile experience for iPhone & Android
   ======================== */

@media (max-width: 768px) {
  /* ===== BOTTOM SHEET MODALS ===== */
  /* Transform modals into bottom sheets for better mobile UX */
  .modal {
    align-items: flex-end;
    padding: 0;
  }

  .modal-content {
    margin: 0;
    max-width: 100%;
    width: 100%;
    max-height: 85vh;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

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

  /* Add drag handle indicator */
  .modal-header::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin: 0 auto 16px;
    opacity: 0.5;
  }

  .modal-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
  }

  .modal-body {
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  /* ===== ENLARGED TOUCH TARGETS (44px minimum) ===== */
  
  /* Buttons */
  button, .btn, .nav-link, .quick-command-btn, .quick-action-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
    font-size: 16px; /* Prevent iOS zoom on focus */
  }

  /* Input fields */
  input, textarea, select {
    min-height: 44px;
    padding: 12px 16px;
    font-size: 16px; /* Prevent iOS zoom on focus */
    border-radius: 12px;
  }

  textarea {
    min-height: 100px;
  }

  /* Form labels with more spacing */
  label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
  }

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

  /* ===== IMPROVED BOTTOM NAVIGATION ===== */
  
  .mobile-bottom-nav {
    padding: 12px 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.15);
  }

  .mobile-bottom-nav .nav-item {
    min-width: 60px;
    min-height: 52px;
    padding: 8px 12px;
    gap: 4px;
    border-radius: 12px;
    transition: all 0.2s ease;
  }

  .mobile-bottom-nav .nav-item:active {
    transform: scale(0.95);
    background: var(--surface-hover);
  }

  .mobile-bottom-nav .nav-icon {
    font-size: 24px;
  }

  .mobile-bottom-nav .nav-item span:not(.nav-icon) {
    font-size: 11px;
    font-weight: 600;
  }

  /* ===== CHAT INTERFACE MOBILE ===== */
  
  .chat-section {
    padding-bottom: 0;
  }

  .chat-messages {
    padding: 16px;
    padding-bottom: 80px; /* Space for fixed input */
  }

  .chat-input {
    position: fixed;
    bottom: calc(60px + env(safe-area-inset-bottom)); /* Above bottom nav */
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
  }

  #message-input {
    flex: 1;
    min-height: 44px;
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 22px;
  }

  #send-button {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
    border-radius: 22px;
    font-size: 15px;
    font-weight: 600;
  }

  /* ===== QUICK ACTIONS MOBILE ===== */
  
  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
  }

  .quick-command-btn {
    padding: 16px 12px;
    min-height: 56px;
    font-size: 14px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }

  .quick-command-btn .emoji {
    font-size: 24px;
  }

  /* ===== CALENDAR MOBILE ===== */
  
  .calendar-grid {
    gap: 6px;
  }

  .calendar-day {
    min-height: 60px;
    padding: 6px;
    font-size: 13px;
  }

  .calendar-day-number {
    font-size: 14px;
    font-weight: 600;
  }

  .calendar-event-pill {
    padding: 4px 6px;
    font-size: 10px;
    margin-bottom: 2px;
    border-radius: 4px;
  }

  /* Simplify calendar toolbar */
  .calendar-toolbar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }

  .calendar-toolbar button {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
  }

  /* ===== CARDS & CONTAINERS ===== */
  
  .card, .kpi-card, .sidebar, .dashboard {
    border-radius: 16px;
    padding: 16px;
  }

  .card-header {
    padding: 16px;
    margin: -16px -16px 16px;
  }

  /* ===== FORM MODALS ===== */
  
  /* Specific adjustments for task/event/note forms */
  #task-form, #event-form, #note-form, #project-form,
  #transaction-form, #budget-form, #goal-form {
    padding: 20px;
  }

  #task-form input,
  #event-form input,
  #note-form input,
  #note-form textarea,
  #project-form input,
  #project-form textarea,
  #transaction-form input,
  #budget-form input,
  #goal-form input {
    font-size: 16px;
    min-height: 44px;
    padding: 12px 16px;
  }

  /* Date/time inputs */
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"] {
    min-height: 44px;
    padding: 10px 16px;
  }

  /* ===== IMPROVED SPACING ===== */
  
  .container {
    padding: 12px;
  }

  header {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 16px;
  }

  .main-content {
    gap: 16px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom)); /* Space for bottom nav */
  }

  /* ===== BETTER LIST ITEMS ===== */
  
  .task-item, .event-item, .note-item, .transaction-item {
    padding: 16px;
    min-height: 64px;
    border-radius: 12px;
    margin-bottom: 8px;
  }

  /* Larger checkboxes */
  input[type="checkbox"] {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
  }

  /* ===== NOTIFICATIONS PANEL MOBILE ===== */
  
  .notifications-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 70vh;
    border-radius: 24px 24px 0 0;
    animation: slideUpMobile 0.3s ease-out;
  }

  @keyframes slideUpMobile {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }

  /* ===== SWIPE GESTURES HINT ===== */
  
  /* Add subtle hint for swipe to close */
  .modal.active::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
    animation: pulseHint 2s ease-in-out infinite;
    opacity: 0;
  }

  @keyframes pulseHint {
    0%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.3; transform: translate(-50%, -50%) scale(1.2); }
  }

  /* ===== KEYBOARD AWARE ===== */
  
  /* Ensure inputs are visible when keyboard opens */
  .chat-input-container:focus-within {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }

  /* ===== IMPROVED TAP FEEDBACK ===== */
  
  button:active,
  .btn:active,
  .nav-link:active,
  .quick-command-btn:active {
    transform: scale(0.96);
    opacity: 0.8;
  }

  /* ===== SAFE AREA INSETS ===== */
  
  /* Ensure content doesn't go under notch/home indicator */
  body {
    padding-top: env(safe-area-inset-top);
  }

  header {
    margin-top: 0;
  }
}

/* ===== EXTRA SMALL SCREENS ===== */
@media (max-width: 380px) {
  button, .btn {
    font-size: 14px;
    padding: 10px 16px;
  }

  .quick-command-btn {
    padding: 12px 8px;
    min-height: 52px;
    font-size: 13px;
  }

  .quick-command-btn .emoji {
    font-size: 20px;
  }

  .modal-header h3 {
    font-size: 1.1rem;
  }
}

/* ===== LANDSCAPE MODE IMPROVEMENTS ===== */
@media (max-width: 768px) and (orientation: landscape) {
  .modal-content {
    max-height: 75vh;
  }

  .chat-messages {
    max-height: calc(100vh - 200px);
  }

  .notifications-panel {
    max-height: 60vh;
  }
}

/* ========================
   PERFORMANCE OPTIMIZATIONS
   Reduced motion for low-end devices
   ======================== */

.reduced-motion *,
.reduced-motion *::before,
.reduced-motion *::after {
  animation-duration: 0.01s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01s !important;
}

/* Optimize will-change for animations */
.modal-content,
.user-dropdown,
.notifications-panel,
.calendar-event-pill {
  will-change: transform, opacity;
}

/* Remove will-change after animation completes */
.modal-content:not(.active),
.user-dropdown:not(.show),
.notifications-panel.hidden {
  will-change: auto;
}

/* GPU acceleration for smooth animations */
.card,
.kpi-card,
.quick-command-btn,
.nav-link {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Optimize transitions - use transform instead of position */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Lazy load images */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Skeleton loading states */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-color) 25%,
    var(--surface-hover) 50%,
    var(--surface-color) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Optimize large list rendering */
.virtualized-list {
  contain: layout style paint;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Content visibility for off-screen elements */
.task-item,
.event-item,
.transaction-item {
  content-visibility: auto;
  contain-intrinsic-size: 60px;
}

/* ========================
   PWA INSTALL BUTTON & MODAL
   ======================== */

.install-app-btn {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 24px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  cursor: pointer;
  z-index: 9999;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideInUp 0.5s ease-out;
}

.install-app-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}

.install-app-btn:active {
  transform: translateY(0);
}

.install-app-btn.hidden {
  display: none;
}

.install-app-btn svg {
  width: 20px;
  height: 20px;
}

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

/* iOS Install Modal */
.ios-install-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100000;
  animation: fadeIn 0.3s ease-out;
}

@media (min-width: 768px) {
  .ios-install-modal {
    align-items: center;
  }
}

.ios-install-content {
  background: var(--surface-elevated);
  border-radius: 24px 24px 0 0;
  padding: 32px 24px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
  max-width: 500px;
  width: 100%;
  position: relative;
  animation: slideUpModal 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 768px) {
  .ios-install-content {
    border-radius: 24px;
    padding: 32px;
  }
}

@keyframes slideUpModal {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.ios-install-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-hover);
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.ios-install-close:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.ios-install-content h3 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.ios-install-content p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.ios-install-steps {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ios-install-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--surface-color);
  border-radius: 12px;
  margin-bottom: 12px;
  color: var(--text-primary);
  line-height: 1.6;
}

.ios-install-steps li:last-child {
  margin-bottom: 0;
}

.step-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.ios-install-steps svg {
  margin-left: 4px;
  vertical-align: middle;
  opacity: 0.6;
}

/* Desktop install button position */
@media (min-width: 768px) {
  .install-app-btn {
    bottom: 20px;
  }
}

/* Splash screen for installed app */
@media (display-mode: standalone) {
  body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-color);
    z-index: 999999;
    animation: splashFadeOut 0.8s ease-out forwards;
    pointer-events: none;
  }
}

@keyframes splashFadeOut {
  0% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* ========================
   PREMIUM UI POLISH
   Apple-inspired smooth animations and micro-interactions
   ======================== */

/* Smooth micro-animations for interactive elements */
button, .btn, .nav-link, .card, .kpi-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Floating action effect on hover */
.quick-command-btn:hover,
.quick-action-btn:hover,
.kpi-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.quick-command-btn:active,
.quick-action-btn:active {
  transform: translateY(-1px) scale(0.98);
  transition-duration: 0.1s;
}

/* Elegant loading spinner */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

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

/* Ripple effect on click */
.ripple-container {
  position: relative;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: scale(0);
  animation: ripple-animation 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Enhanced focus states for accessibility */
*:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Glassmorphism effect for modals and panels */
.modal-content,
.notifications-panel,
.user-dropdown {
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(var(--surface-rgb), 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Smooth page transitions */
.page-transition {
  animation: pageTransition 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Gradient text effect for headings */
h1, h2.gradient-text {
  background: linear-gradient(135deg, var(--text-primary), var(--primary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Animated gradient background for cards */
.card-premium {
  background: linear-gradient(
    135deg,
    var(--surface-color) 0%,
    var(--surface-hover) 100%
  );
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

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

/* Subtle bounce animation for success states */
.success-bounce {
  animation: successBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes successBounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Skeleton shimmer for loading states */
.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    var(--surface-color) 0%,
    var(--surface-hover) 50%,
    var(--surface-color) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Smooth height transitions */
.collapsible {
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Fade in animation for elements */
.fade-in {
  animation: fadeIn 0.4s ease-out;
}

.fade-in-up {
  animation: fadeInUp 0.5s ease-out;
}

.fade-in-down {
  animation: fadeInDown 0.5s ease-out;
}

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

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

/* Scale in animation */
.scale-in {
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Hover glow effect */
.glow-on-hover:hover {
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4),
              0 0 40px rgba(99, 102, 241, 0.2);
}

/* Pulse animation for notifications */
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* Smooth border radius transitions */
.card, .modal-content, .btn {
  transition: border-radius 0.3s ease;
}

/* Premium shadow on scroll */
.elevated-on-scroll {
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.elevated-on-scroll.scrolled {
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* iOS-style momentum scrolling */
.smooth-scroll {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Card flip animation */
.flip-card {
  perspective: 1000px;
}

.flip-card-inner {
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}

/* Stagger animation for lists */
.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }

/* Smooth color transitions */
* {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* ===========================
   iOS-SPECIFIC ENHANCEMENTS
   =========================== */

/* Pull to Refresh Indicator */
.pull-to-refresh-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  width: 60px;
  height: 60px;
  background: var(--surface-elevated);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  transition: opacity 0.2s ease;
}

.pull-to-refresh-indicator .refresh-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  transition: transform 0.1s linear;
}

.pull-to-refresh-indicator.refreshing .refresh-spinner {
  animation: spin 0.8s linear infinite;
}

.pull-to-refresh-indicator .refresh-text {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* iOS Context Menu */
.context-menu-ios {
  position: fixed;
  background: var(--surface-elevated);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 14px;
  padding: 6px;
  min-width: 200px;
  z-index: 10000;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5),
              0 0 0 1px var(--glass-border);
  transform: scale(0.8);
  opacity: 0;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              opacity 0.15s ease;
}

.context-menu-ios.show {
  transform: scale(1);
  opacity: 1;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  text-align: left;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.context-menu-item:hover,
.context-menu-item:active {
  background: var(--surface-hover);
}

.context-menu-item.danger {
  color: var(--danger-color);
}

.context-menu-item .menu-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.context-menu-item .menu-label {
  flex: 1;
}

/* iOS Keyboard Toolbar */
.keyboard-toolbar-ios {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 44px;
  background: var(--surface-elevated);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 16px;
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.keyboard-toolbar-ios.visible {
  transform: translateY(0);
}

.keyboard-toolbar-ios .toolbar-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--primary-color);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.keyboard-toolbar-ios .toolbar-btn:active {
  opacity: 0.6;
}

/* iOS-style spring animations */
@keyframes ios-spring-in {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); opacity: 0.8; }
  70% { transform: scale(0.98); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes ios-spring-out {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.3); opacity: 0; }
}

/* iOS haptic feedback visual indicator */
.haptic-feedback {
  animation: haptic-pulse 0.15s ease-out;
}

@keyframes haptic-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

/* iOS safe area padding */
@supports (padding-top: env(safe-area-inset-top)) {
  .container {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* iOS touch highlights disabled */
@media (hover: none) and (pointer: coarse) {
  * {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }

  button, a, .clickable {
    touch-action: manipulation;
  }
}

/* ===========================
   CHATGPT-STYLE MOBILE UI
   Clean, spacious, chat-focused
   =========================== */

/* Hide mobile-only elements on desktop */
.menu-toggle,
.sidebar-close,
.sidebar-overlay,
.fab-menu {
  display: none;
}

@media (max-width: 768px) {
  /* Show mobile-only elements */
  .menu-toggle,
  .fab-menu {
    display: flex;
  }

  /* Hide header nav on mobile - use bottom nav instead */
  .header-nav {
    display: none !important;
  }

  /* Compact header */
  header {
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
  }

  .logo-container {
    gap: 10px;
  }

  .logo {
    width: 32px;
    height: 32px;
  }

  .brand-text h1 {
    font-size: 1.2rem;
  }

  .brand-text .subtitle {
    display: none;
  }

  /* Container - full width, no padding mess */
  .container {
    padding: 0;
    padding-bottom: 80px;
    max-width: 100%;
  }

  /* Main content - single column */
  .main-content {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
  }

  /* === SIDEBAR AS DRAWER === */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0;
    padding: 20px;
    padding-top: 60px;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    background: var(--bg-color);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Sidebar overlay */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }

  /* Close button for sidebar */
  .sidebar-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-hover);
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* === CHAT SECTION - FULL SCREEN === */
  .chat-section {
    flex: 1;
    border-radius: 0;
    padding: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 140px);
  }

  .chat-header {
    display: none; /* Hide redundant header */
  }

  /* Chat messages - more space */
  .chat-messages {
    flex: 1;
    padding: 16px;
    padding-bottom: 80px;
    gap: 16px;
  }

  .message {
    max-width: 85%;
    margin-bottom: 12px;
  }

  .message.user {
    margin-left: auto;
  }

  .message-content {
    padding: 14px 18px;
    font-size: 15px;
    line-height: 1.5;
    border-radius: 20px;
  }

  .message.user .message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 6px;
  }

  .message.assistant .message-content {
    background: var(--surface-elevated);
    border-bottom-left-radius: 6px;
  }

  /* Chat input - fixed at bottom, above nav */
  .chat-input-container {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
    z-index: 50;
  }

  .chat-input-container form {
    display: flex;
    gap: 10px;
    align-items: center;
  }

  .chat-input-container input,
  .chat-input-container textarea,
  #chat-input {
    flex: 1;
    padding: 14px 18px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 16px;
    min-height: 48px;
    resize: none;
  }

  .chat-input-container button,
  #send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  /* === BOTTOM NAV - SIMPLER === */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
    padding: 8px 0;
    z-index: 100;
    display: flex;
    justify-content: space-around;
    align-items: center;
  }

  .mobile-bottom-nav .nav-items {
    display: flex;
    justify-content: space-around;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
  }

  .mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    gap: 4px;
    border-radius: 12px;
    transition: all 0.2s ease;
    min-width: 60px;
  }

  .mobile-bottom-nav .nav-item .nav-icon {
    font-size: 22px;
    line-height: 1;
  }

  .mobile-bottom-nav .nav-item.active {
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
  }

  .mobile-bottom-nav .nav-item span:not(.nav-icon) {
    font-weight: 500;
  }

  /* === FLOATING ACTION BUTTON === */
  .fab-menu {
    position: fixed;
    bottom: 90px;
    right: 16px;
    z-index: 90;
  }

  .fab-main {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }

  .fab-main:active {
    transform: scale(0.95);
  }

  .fab-main.open {
    transform: rotate(45deg);
  }

  .fab-options {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.3s ease;
  }

  .fab-options.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .fab-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--surface-elevated);
    border-radius: 24px;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    cursor: pointer;
  }

  .fab-option .fab-icon {
    font-size: 18px;
  }

  /* === MENU BUTTON (hamburger) === */
  .menu-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* === KPI CARDS - MORE COMPACT === */
  .kpi-section {
    padding: 16px;
  }

  .kpi-section h2 {
    font-size: 1rem;
    margin-bottom: 12px;
  }

  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .kpi-card {
    padding: 14px;
    border-radius: 14px;
  }

  .kpi-label {
    font-size: 11px;
    margin-bottom: 6px;
  }

  .kpi-value {
    font-size: 1.3rem;
  }

  /* === QUICK ACTIONS IN SIDEBAR === */
  .quick-view {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--surface-color);
    border-radius: 16px;
  }

  .quick-view h3 {
    font-size: 0.9rem;
    margin-bottom: 12px;
  }

  .quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .quick-action-btn {
    padding: 12px;
    font-size: 12px;
    border-radius: 12px;
  }

  /* === POMODORO - COMPACT === */
  .pomodoro-widget {
    padding: 16px;
  }

  .pomodoro-display {
    transform: scale(0.85);
    margin: -10px 0;
  }

  /* === HIDE DASHBOARD SECTION === */
  .dashboard {
    display: none;
  }

  /* === NOTIFICATIONS PANEL === */
  .notifications-panel {
    position: fixed;
    top: 60px;
    right: 0;
    left: 0;
    bottom: 0;
    max-width: 100%;
    border-radius: 0;
    z-index: 200;
  }

  /* === MODALS - FULL SCREEN ON MOBILE === */
  .modal {
    padding: 0;
  }

  .modal-content {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    margin: 0;
  }

  .modal-header {
    padding: 16px 20px;
    border-radius: 0;
  }

  .modal-body {
    padding: 20px;
  }

  /* === QUICK COMMANDS - HORIZONTAL SCROLL === */
  .quick-commands {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 12px 16px;
    margin: 0 -16px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .quick-commands::-webkit-scrollbar {
    display: none;
  }

  .quick-command-btn {
    flex-shrink: 0;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 13px;
  }
}

/* Extra small phones */
@media (max-width: 375px) {
  .mobile-bottom-nav .nav-item {
    padding: 6px 10px;
    min-width: 50px;
  }

  .mobile-bottom-nav .nav-item .nav-icon {
    font-size: 20px;
  }

  .fab-main {
    width: 50px;
    height: 50px;
    font-size: 22px;
  }

  .message-content {
    padding: 12px 14px;
    font-size: 14px;
  }
}

/* ============================================
   CRITICAL MOBILE UX FIXES
   - Fixed chat (no page scroll)
   - Keyboard-aware modals
   ============================================ */

@media (max-width: 768px) {
  /* CRITICAL: Prevent body/page scrolling on mobile */
  html.mobile-chat-active {
    height: 100dvh; /* Dynamic viewport height for iOS */
    overflow: hidden;
    position: fixed;
    width: 100%;
  }
  
  html.mobile-chat-active body {
    height: 100dvh;
    overflow: hidden;
    position: fixed;
    width: 100%;
  }

  /* Container fills viewport exactly */
  html.mobile-chat-active .container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    padding-bottom: 0;
    display: flex;
    flex-direction: column;
  }

  /* Header stays at top */
  html.mobile-chat-active header {
    position: relative;
    flex-shrink: 0;
  }

  /* Main content fills remaining space */
  html.mobile-chat-active .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0; /* Important for flex shrinking */
  }

  /* Chat section fills available space */
  html.mobile-chat-active .chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    position: relative;
  }

  /* ONLY chat messages scroll */
  html.mobile-chat-active .chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 16px;
    padding-bottom: 140px; /* Space for input + bottom nav */
    min-height: 0;
  }

  /* Chat input container - sticky at bottom of chat */
  html.mobile-chat-active .chat-input,
  html.mobile-chat-active .chat-input-container {
    position: absolute;
    bottom: 70px;
    left: 0;
    right: 0;
    flex-shrink: 0;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    z-index: 50;
  }

  /* Bottom nav stays fixed */
  html.mobile-chat-active .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    flex-shrink: 0;
  }

  /* === MODAL KEYBOARD FIX === */
  /* When keyboard opens, modal needs to stay visible */
  .modal {
    align-items: flex-start !important;
    padding-top: env(safe-area-inset-top, 20px) !important;
    overflow-y: auto;
  }

  .modal-content {
    max-height: none;
    height: auto;
    min-height: auto;
    margin: 0 auto;
    margin-bottom: 50vh; /* Extra space for keyboard */
    border-radius: 16px 16px 0 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* When keyboard is open */
  .modal.keyboard-open {
    padding-top: env(safe-area-inset-top, 10px) !important;
  }

  .modal.keyboard-open .modal-content {
    margin-bottom: 0;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }

  /* Add padding-bottom to modal content for keyboard space */
  .modal-content form,
  .modal-body {
    padding-bottom: 100px; /* Space for keyboard */
  }

  /* Input fields - prevent iOS zoom and ensure visibility */
  .modal-content input,
  .modal-content textarea,
  .modal-content select,
  .modal-body input,
  .modal-body textarea,
  .modal-body select {
    font-size: 16px !important; /* Prevents iOS zoom on focus */
  }

  /* Input fields scroll into view properly */
  .modal-content input:focus,
  .modal-content textarea:focus,
  .modal-content select:focus,
  .modal-body input:focus,
  .modal-body textarea:focus,
  .modal-body select:focus {
    scroll-margin-bottom: 150px;
  }

  /* Smooth scroll for modal content */
  .modal-content {
    scroll-behavior: smooth;
  }
}

/* iOS-specific keyboard handling */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 768px) {
    /* Use visual viewport for iOS */
    .modal-content {
      max-height: calc(var(--visual-viewport-height, 100vh) - 40px);
    }

    /* When keyboard is open on iOS */
    .modal.keyboard-open .modal-content {
      max-height: calc(var(--visual-viewport-height, 100vh) - 100px);
    }

    /* Ensure inputs are visible above keyboard */
    .modal-content input,
    .modal-content textarea,
    .modal-body input,
    .modal-body textarea {
      font-size: 16px !important; /* Prevents iOS zoom */
    }

    /* Chat input no zoom */
    #chat-input,
    #message-input {
      font-size: 16px !important; /* Prevents iOS zoom on focus */
    }
  }
}

/* ============================================
   iOS OPTIMIZATIONS - COMPLETE MOBILE EXPERIENCE
   Optimizaciones específicas para iPhone/iOS
   ============================================ */

/* iOS Safe Areas - Soporte completo para notch y home indicator */
@supports (padding: env(safe-area-inset-top)) {
  html {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Header con safe area */
  header {
    padding-top: max(16px, env(safe-area-inset-top));
  }

  /* Bottom nav con safe area */
  .mobile-bottom-nav {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    height: calc(60px + env(safe-area-inset-bottom));
  }

  /* Chat input con safe area */
  .chat-input,
  .chat-input-container {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    bottom: calc(60px + env(safe-area-inset-bottom));
  }
}

/* iOS-specific: Detectar iPhone */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 768px) {
    /* Smooth scrolling nativo iOS */
    * {
      -webkit-overflow-scrolling: touch;
    }

    /* Prevenir selección de texto accidental */
    body {
      -webkit-touch-callout: none;
      -webkit-user-select: none;
      user-select: none;
    }

    /* Permitir selección en inputs y textareas */
    input,
    textarea,
    [contenteditable] {
      -webkit-user-select: text;
      user-select: text;
    }

    /* Prevenir zoom en double tap */
    * {
      touch-action: manipulation;
    }

    /* Mejorar rendimiento de scroll */
    .chat-messages,
    .modal-content,
    .notifications-list,
    .sidebar {
      -webkit-overflow-scrolling: touch;
      transform: translateZ(0); /* Force hardware acceleration */
      will-change: scroll-position;
    }

    /* Optimizar animaciones para 60fps */
    .message,
    .typing-indicator,
    .modal-content {
      will-change: transform, opacity;
    }

    /* Pull to refresh indicator */
    .pull-to-refresh-indicator {
      position: fixed;
      top: calc(env(safe-area-inset-top) + 20px);
      left: 50%;
      transform: translateX(-50%);
      z-index: 10000;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s;
    }

    .pull-to-refresh-indicator .refresh-spinner {
      width: 24px;
      height: 24px;
      border: 3px solid var(--border-color);
      border-top-color: var(--primary-color);
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }

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

    /* Context menu iOS style */
    .context-menu-ios {
      position: fixed;
      background: var(--surface-elevated);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border-radius: 14px;
      padding: 8px;
      box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
      z-index: 10000;
      opacity: 0;
      transform: scale(0.9);
      transition: opacity 0.2s, transform 0.2s;
    }

    .context-menu-ios.show {
      opacity: 1;
      transform: scale(1);
    }

    .context-menu-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 16px;
      width: 100%;
      border: none;
      background: transparent;
      color: var(--text-primary);
      font-size: 16px;
      border-radius: 10px;
      cursor: pointer;
      transition: background 0.15s;
    }

    .context-menu-item:active {
      background: var(--surface-hover);
    }

    .context-menu-item.danger {
      color: var(--danger-color);
    }

    /* Keyboard toolbar iOS */
    .keyboard-toolbar-ios {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      background: var(--surface-elevated);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border-top: 1px solid var(--border-color);
      padding: 8px 16px;
      padding-bottom: calc(8px + env(safe-area-inset-bottom));
      display: flex;
      justify-content: flex-end;
      z-index: 10001;
      transform: translateY(100%);
      transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .keyboard-toolbar-ios.visible {
      transform: translateY(0);
    }

    .toolbar-btn {
      padding: 8px 16px;
      background: var(--primary-color);
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 16px;
      font-weight: 600;
      cursor: pointer;
    }

    /* Mejorar botones para touch */
    button,
    .btn,
    .nav-link,
    .quick-command-btn {
      min-height: 44px; /* Tamaño mínimo recomendado por Apple */
      min-width: 44px;
      touch-action: manipulation;
    }

    /* Mejorar inputs para touch */
    input,
    textarea,
    select {
      min-height: 44px;
      touch-action: manipulation;
    }

    /* Optimizar cards y elementos interactivos */
    .card,
    .kpi-card,
    .list-item {
      touch-action: manipulation;
    }

    /* Mejorar feedback táctil visual */
    button:active,
    .btn:active,
    .nav-link:active,
    .card:active {
      transform: scale(0.97);
      transition: transform 0.1s;
    }

    /* Smooth transitions para iOS */
    * {
      transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Optimizar imágenes */
    img {
      image-rendering: -webkit-optimize-contrast;
      image-rendering: crisp-edges;
    }

    /* Mejorar legibilidad de texto */
    body {
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      text-rendering: optimizeLegibility;
    }

    /* Prevenir bounce scroll en body */
    body {
      overscroll-behavior-y: none;
      -webkit-overflow-scrolling: touch;
    }

    /* Permitir bounce en contenedores específicos */
    .chat-messages,
    .modal-content {
      overscroll-behavior-y: auto;
    }
  }
}

/* iPhone específico - Detectar por user agent */
@media screen and (max-width: 430px) {
  /* Optimizaciones para iPhone más pequeños */
  .container {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  /* Ajustar tamaños de fuente para mejor legibilidad */
  body {
    font-size: 16px; /* Tamaño base recomendado por Apple */
  }

  h1 { font-size: 28px; }
  h2 { font-size: 24px; }
  h3 { font-size: 20px; }
}

/* iPhone Pro Max y modelos grandes */
@media screen and (min-width: 428px) and (max-width: 768px) {
  .container {
    max-width: 100%;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
}

/* Orientación landscape en iPhone */
@media screen and (max-width: 768px) and (orientation: landscape) {
  /* Ajustar header en landscape */
  header {
    padding: 8px max(16px, env(safe-area-inset-left)) 8px max(16px, env(safe-area-inset-right));
  }

  /* Ocultar bottom nav en landscape si es necesario */
  .mobile-bottom-nav {
    display: none;
  }

  /* Ajustar chat input en landscape */
  .chat-input,
  .chat-input-container {
    bottom: 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* Dark mode iOS (si el sistema está en dark mode) */
@media (prefers-color-scheme: dark) {
  /* Ya manejado por data-theme, pero podemos agregar ajustes adicionales */
}

/* Reducir animaciones si el usuario prefiere */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   MEJORAS PROFESIONALES PARA MÓVILES - EXPERIENCIA EXCEPCIONAL
   Optimizaciones específicas para hacer AIVA excepcional en móviles
   ============================================ */

/* MÓVILES GENERALES - Mejorar espaciado y usabilidad */
@media screen and (max-width: 768px) {
  /* Contenedor principal más espacioso */
  .container {
    padding: 16px !important;
    padding-top: max(16px, env(safe-area-inset-top)) !important;
    padding-bottom: max(80px, calc(16px + env(safe-area-inset-bottom))) !important; /* Espacio para bottom nav */
  }

  /* Header más compacto pero usable */
  header {
    padding: 12px 16px !important;
    margin-bottom: 16px !important;
    min-height: 60px !important;
  }

  .header-left {
    margin-bottom: 8px !important;
  }

  /* Logo más pequeño pero visible */
  .logo-container {
    margin-bottom: 8px !important;
  }

  .logo {
    width: 32px !important;
    height: 32px !important;
  }

  .brand-text {
    font-size: 18px !important;
  }

  /* Navegación header - mejor para móviles */
  .header-nav {
    gap: 8px !important;
    flex-wrap: wrap !important;
  }

  .nav-link {
    padding: 8px 12px !important;
    font-size: 13px !important;
    min-width: 60px !important;
    min-height: 44px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
  }

  .nav-icon {
    font-size: 16px !important;
  }

  /* Cards más espaciadas */
  .card, .kpi-card, .panel {
    margin-bottom: 16px !important;
    padding: 20px !important;
    border-radius: 16px !important;
  }

  /* KPI cards específicas */
  .kpi-card {
    padding: 16px !important;
    margin-bottom: 12px !important;
  }

  .kpi-value {
    font-size: 24px !important;
    margin-bottom: 4px !important;
  }

  .kpi-label {
    font-size: 12px !important;
  }

  /* Botones más grandes y usables */
  .btn, button, .quick-action-btn {
    min-height: 48px !important;
    padding: 12px 20px !important;
    font-size: 16px !important;
    border-radius: 12px !important;
    margin-bottom: 8px !important;
  }

  /* Formularios optimizados para móviles */
  .form-group {
    margin-bottom: 20px !important;
  }

  .form-group label {
    font-size: 16px !important;
    margin-bottom: 8px !important;
    font-weight: 600 !important;
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 16px !important;
    padding: 14px 16px !important;
    border-radius: 12px !important;
    border: 2px solid var(--border-color) !important;
    min-height: 48px !important;
  }

  /* Modales optimizados */
  .modal-content {
    margin: 20px !important;
    border-radius: 20px !important;
    max-height: calc(100vh - 40px) !important;
    overflow-y: auto !important;
  }

  .modal-header {
    padding: 20px 20px 16px !important;
  }

  .modal-header h2 {
    font-size: 20px !important;
  }

  /* Navegación móvil mejorada */
  .mobile-bottom-nav {
    height: calc(64px + env(safe-area-inset-bottom)) !important;
    padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
    background: var(--surface-elevated) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-top: 1px solid var(--border-color) !important;
  }

  .nav-items {
    gap: 4px !important;
  }

  .nav-item {
    min-width: 60px !important;
    padding: 8px 4px !important;
    font-size: 11px !important;
  }

  .nav-item .nav-icon {
    font-size: 18px !important;
    margin-bottom: 2px !important;
  }

  /* Listas y grids más espaciadas */
  .list-item, .task-item, .note-item {
    padding: 16px !important;
    margin-bottom: 8px !important;
    border-radius: 12px !important;
  }

  /* Tablas responsive */
  .tasks-table, .finance-table {
    font-size: 14px !important;
  }

  .tasks-table th,
  .tasks-table td {
    padding: 12px 8px !important;
  }

  /* Kanban board optimizado */
  .kanban-board {
    padding: 16px 0 !important;
  }

  .kanban-column {
    margin: 0 8px !important;
    min-width: calc(50vw - 16px) !important;
  }

  /* Chat optimizado para móviles */
  .chat-section {
    height: calc(100vh - 140px) !important;
    margin: 0 !important;
  }

  .chat-messages {
    padding: 16px !important;
    max-height: calc(100vh - 200px) !important;
  }

  .message {
    margin-bottom: 16px !important;
    padding: 12px 16px !important;
  }

  .chat-input-container {
    padding: 12px 16px !important;
    background: var(--surface-elevated) !important;
    border-top: 1px solid var(--border-color) !important;
  }

  #message-input {
    min-height: 44px !important;
    font-size: 16px !important;
  }

  /* Dashboard optimizado */
  .dashboard {
    padding: 0 !important;
  }

  .kpi-grid {
    gap: 12px !important;
    padding: 16px !important;
  }

  /* Empty states más prominentes */
  .empty-state {
    padding: 40px 20px !important;
    text-align: center !important;
  }

  .empty-icon {
    font-size: 48px !important;
    margin-bottom: 16px !important;
  }

  /* Toolbars más usables */
  .tasks-toolbar, .notes-toolbar, .projects-toolbar {
    padding: 16px !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
  }

  .toolbar-left, .toolbar-right {
    flex: 1 !important;
    min-width: 120px !important;
  }

  /* Search modal optimizado */
  .search-modal {
    padding: 20px !important;
  }

  .search-input {
    font-size: 18px !important;
    padding: 16px !important;
  }

  /* FAB optimizado */
  .fab-menu {
    bottom: calc(80px + env(safe-area-inset-bottom)) !important;
    right: 20px !important;
  }

  .fab-btn {
    width: 56px !important;
    height: 56px !important;
  }
}

/* iPHONE ESPECÍFICO - Optimizaciones adicionales */
@media screen and (max-width: 430px) {
  /* Tipografía optimizada para iPhone */
  body {
    font-size: 16px !important;
    line-height: 1.5 !important;
  }

  h1 { font-size: 28px !important; line-height: 1.2 !important; }
  h2 { font-size: 24px !important; line-height: 1.3 !important; }
  h3 { font-size: 20px !important; line-height: 1.4 !important; }
  h4 { font-size: 18px !important; line-height: 1.4 !important; }

  /* Espaciado más generoso en iPhone */
  .container {
    padding: 20px !important;
    padding-bottom: max(100px, calc(20px + env(safe-area-inset-bottom))) !important;
  }

  /* Cards aún más espaciadas en iPhone pequeño */
  .card, .kpi-card {
    padding: 24px !important;
    margin-bottom: 20px !important;
  }

  /* Navegación bottom aún mejor */
  .mobile-bottom-nav {
    height: calc(72px + env(safe-area-inset-bottom)) !important;
  }

  .nav-item {
    font-size: 10px !important;
  }

  /* Inputs más grandes en iPhone */
  input, textarea, select {
    font-size: 16px !important; /* Previene zoom */
    padding: 16px !important;
    min-height: 52px !important;
  }

  /* Botones más prominentes */
  .btn-primary, .btn-secondary {
    font-size: 17px !important;
    font-weight: 600 !important;
    min-height: 52px !important;
    padding: 14px 24px !important;
  }
}

/* TABLET - Optimizaciones intermedias */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .container {
    max-width: 800px !important;
    margin: 0 auto !important;
    padding: 24px !important;
  }

  /* Mantener navegación desktop pero optimizada */
  .header-nav {
    display: flex !important;
  }

  .mobile-bottom-nav {
    display: none !important;
  }

  /* Layout de dos columnas en tablet */
  .dashboard {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 24px !important;
  }

  .sidebar {
    position: static !important;
    width: 100% !important;
    margin-top: 24px !important;
  }
}

/* PRINT STYLES - Para cuando se imprima */
@media print {
  .mobile-bottom-nav,
  .fab-menu,
  .theme-toggle,
  button:not(.btn) {
    display: none !important;
  }

  .container {
    padding: 0 !important;
  }

  .card {
    break-inside: avoid !important;
    border: 1px solid #000 !important;
  }
}

/* ============================================
   iPhone-SPECIFIC UI STYLES
   Native iOS design language and components
   ============================================ */

/* iOS Action Sheet */
.ios-action-sheet {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  pointer-events: none;
}

.ios-action-sheet-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: all;
}

.ios-action-sheet-backdrop.show {
  opacity: 1;
}

.ios-action-sheet-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-radius: 20px 20px 0 0;
  padding: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: all;
  max-height: 80vh;
  overflow-y: auto;
}

[data-theme="dark"] .ios-action-sheet-content {
  background: rgba(28, 28, 30, 0.95);
}

.ios-action-sheet-content.show {
  transform: translateY(0);
}

.ios-action-sheet-item {
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 400;
  color: #007AFF;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.1s;
  margin-bottom: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
}

.ios-action-sheet-item:active {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .ios-action-sheet-item {
  color: #0A84FF;
}

[data-theme="dark"] .ios-action-sheet-item:active {
  background: rgba(255, 255, 255, 0.1);
}

.ios-action-sheet-item.destructive {
  color: #FF3B30;
}

[data-theme="dark"] .ios-action-sheet-item.destructive {
  color: #FF453A;
}

.ios-action-sheet-cancel {
  width: 100%;
  padding: 16px 20px;
  background: rgba(142, 142, 147, 0.12);
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  color: #007AFF;
  text-align: center;
  cursor: pointer;
  margin-top: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
}

[data-theme="dark"] .ios-action-sheet-cancel {
  background: rgba(142, 142, 147, 0.24);
  color: #0A84FF;
}

/* iOS Alert */
.ios-alert {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
}

.ios-alert-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: all;
}

.ios-alert-backdrop.show {
  opacity: 1;
}

.ios-alert-content {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-radius: 14px;
  padding: 20px;
  max-width: 300px;
  width: 100%;
  transform: scale(0.9);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: all;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .ios-alert-content {
  background: rgba(28, 28, 30, 0.95);
}

.ios-alert-content.show {
  transform: scale(1);
  opacity: 1;
}

.ios-alert-title {
  font-size: 17px;
  font-weight: 600;
  color: #000;
  margin: 0 0 8px 0;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
}

[data-theme="dark"] .ios-alert-title {
  color: #fff;
}

.ios-alert-message {
  font-size: 13px;
  color: #8E8E93;
  margin: 0 0 20px 0;
  text-align: center;
  line-height: 1.4;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
}

[data-theme="dark"] .ios-alert-message {
  color: #98989D;
}

.ios-alert-buttons {
  display: flex;
  gap: 8px;
}

.ios-alert-button {
  flex: 1;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 400;
  color: #007AFF;
  cursor: pointer;
  transition: background-color 0.1s;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
}

.ios-alert-button:active {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .ios-alert-button {
  color: #0A84FF;
}

[data-theme="dark"] .ios-alert-button:active {
  background: rgba(255, 255, 255, 0.1);
}

.ios-alert-button.primary {
  font-weight: 600;
}

/* iOS Enhanced Buttons */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 768px) {
    button.ios-enhanced,
    .btn.ios-enhanced {
      font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
      font-weight: 600;
      letter-spacing: -0.01em;
      border-radius: 10px;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      -webkit-tap-highlight-color: transparent;
    }
    
    button.ios-enhanced:active,
    .btn.ios-enhanced:active {
      transform: scale(0.96);
      opacity: 0.8;
    }
    
    .btn-primary.ios-enhanced {
      background: linear-gradient(180deg, #007AFF 0%, #0051D5 100%);
      box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
    }
    
    [data-theme="dark"] .btn-primary.ios-enhanced {
      background: linear-gradient(180deg, #0A84FF 0%, #0051D5 100%);
    }
  }
}

/* iOS Enhanced Inputs */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 768px) {
    input.ios-enhanced,
    textarea.ios-enhanced,
    select.ios-enhanced {
      font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
      border-radius: 10px;
      border: 1px solid rgba(60, 60, 67, 0.29);
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      -webkit-appearance: none;
      appearance: none;
    }
    
    input.ios-enhanced:focus,
    textarea.ios-enhanced:focus,
    select.ios-enhanced:focus {
      border-color: #007AFF;
      box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
      outline: none;
    }
    
    [data-theme="dark"] input.ios-enhanced,
    [data-theme="dark"] textarea.ios-enhanced,
    [data-theme="dark"] select.ios-enhanced {
      border-color: rgba(255, 255, 255, 0.2);
      background: rgba(28, 28, 30, 0.8);
      color: #fff;
    }
    
    [data-theme="dark"] input.ios-enhanced:focus,
    [data-theme="dark"] textarea.ios-enhanced:focus,
    [data-theme="dark"] select.ios-enhanced:focus {
      border-color: #0A84FF;
      box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2);
    }
  }
}

/* iOS Enhanced Cards */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 768px) {
    .card.ios-enhanced,
    .kpi-card.ios-enhanced,
    .list-item.ios-enhanced {
      border-radius: 12px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      -webkit-tap-highlight-color: transparent;
    }
    
    .card.ios-enhanced:active,
    .kpi-card.ios-enhanced:active,
    .list-item.ios-enhanced:active {
      transform: scale(0.98);
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    }
    
    [data-theme="dark"] .card.ios-enhanced,
    [data-theme="dark"] .kpi-card.ios-enhanced,
    [data-theme="dark"] .list-item.ios-enhanced {
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }
  }
}

/* iOS Keyboard Open State */
body.ios-keyboard-open {
  overflow: hidden;
}

body.ios-keyboard-open .modal-content {
  max-height: calc(var(--visual-viewport-height, 100vh) - 200px);
}

/* iOS Blur Effects */
@supports (backdrop-filter: blur(10px)) {
  @supports (-webkit-touch-callout: none) {
    header {
      backdrop-filter: blur(30px) saturate(180%);
      -webkit-backdrop-filter: blur(30px) saturate(180%);
    }
    
    .mobile-bottom-nav {
      backdrop-filter: blur(30px) saturate(180%);
      -webkit-backdrop-filter: blur(30px) saturate(180%);
    }
    
    .modal-content {
      backdrop-filter: blur(40px) saturate(180%);
      -webkit-backdrop-filter: blur(40px) saturate(180%);
    }
  }
}

/* iPhone-specific optimizations */
@media screen and (max-width: 430px) {
  @supports (-webkit-touch-callout: none) {
    /* Larger touch targets for iPhone */
    button, .btn, .nav-item {
      min-height: 44px;
      min-width: 44px;
    }
    
    /* Better spacing */
    .container {
      padding-left: max(20px, env(safe-area-inset-left));
      padding-right: max(20px, env(safe-area-inset-right));
    }
    
    /* Enhanced typography */
    body {
      font-size: 17px;
      line-height: 1.47059;
      letter-spacing: -0.022em;
    }
    
    h1 {
      font-size: 34px;
      line-height: 1.11765;
      letter-spacing: 0.011em;
    }
    
    h2 {
      font-size: 28px;
      line-height: 1.14286;
      letter-spacing: 0.007em;
    }
    
    h3 {
      font-size: 22px;
      line-height: 1.18182;
      letter-spacing: 0.005em;
    }
  }
}

/* iOS Native Scrollbar */
@supports (-webkit-touch-callout: none) {
  ::-webkit-scrollbar {
    width: 0px;
    background: transparent;
  }
  
  * {
    -webkit-overflow-scrolling: touch;
  }
}

/* ============================================
   iPhone-SPECIFIC DRAMATIC STYLES
   Estilos muy visibles y notorios para iPhone
   ============================================ */

/* Cuando se detecta iPhone - Estilos muy visibles */
body.iphone-device,
html.iphone-device {
  /* Tipografía iOS nativa */
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 
               'Helvetica Neue', Helvetica, Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

/* Header dramático para iPhone */
body.iphone-device header {
  padding: 24px 20px !important;
  padding-top: calc(24px + env(safe-area-inset-top)) !important;
  background: rgba(255, 255, 255, 0.9) !important;
  backdrop-filter: blur(40px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08) !important;
}

[data-theme="dark"] body.iphone-device header {
  background: rgba(28, 28, 30, 0.9) !important;
  border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

/* Cards muy visibles en iPhone */
body.iphone-device .card,
body.iphone-device .kpi-card,
body.iphone-device .balance-card {
  padding: 28px !important;
  margin-bottom: 24px !important;
  border-radius: 20px !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12) !important;
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

[data-theme="dark"] body.iphone-device .card,
[data-theme="dark"] body.iphone-device .kpi-card,
[data-theme="dark"] body.iphone-device .balance-card {
  background: rgba(28, 28, 30, 0.95) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4) !important;
}

body.iphone-device .card:active,
body.iphone-device .kpi-card:active {
  transform: scale(0.97) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}

/* Botones muy prominentes en iPhone */
body.iphone-device button.btn-primary,
body.iphone-device .btn-primary {
  padding: 18px 32px !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  border-radius: 14px !important;
  min-height: 56px !important;
  background: linear-gradient(135deg, #007AFF 0%, #0051D5 100%) !important;
  box-shadow: 0 4px 15px rgba(0, 122, 255, 0.4) !important;
  color: white !important;
  letter-spacing: -0.01em !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

body.iphone-device button.btn-primary:active,
body.iphone-device .btn-primary:active {
  transform: scale(0.96) !important;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3) !important;
}

[data-theme="dark"] body.iphone-device button.btn-primary,
[data-theme="dark"] body.iphone-device .btn-primary {
  background: linear-gradient(135deg, #0A84FF 0%, #0051D5 100%) !important;
}

/* Inputs grandes y visibles */
body.iphone-device input,
body.iphone-device textarea,
body.iphone-device select {
  padding: 18px 20px !important;
  font-size: 17px !important;
  min-height: 56px !important;
  border-radius: 14px !important;
  border: 2px solid rgba(60, 60, 67, 0.2) !important;
  background: rgba(255, 255, 255, 0.9) !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

body.iphone-device input:focus,
body.iphone-device textarea:focus,
body.iphone-device select:focus {
  border-color: #007AFF !important;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15) !important;
  background: white !important;
  outline: none !important;
}

[data-theme="dark"] body.iphone-device input,
[data-theme="dark"] body.iphone-device textarea,
[data-theme="dark"] body.iphone-device select {
  background: rgba(28, 28, 30, 0.9) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
}

[data-theme="dark"] body.iphone-device input:focus,
[data-theme="dark"] body.iphone-device textarea:focus,
[data-theme="dark"] body.iphone-device select:focus {
  border-color: #0A84FF !important;
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.2) !important;
}

/* Bottom Navigation muy visible */
body.iphone-device .mobile-bottom-nav {
  height: calc(76px + env(safe-area-inset-bottom)) !important;
  padding-top: 16px !important;
  padding-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(40px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.15) !important;
  border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
}

[data-theme="dark"] body.iphone-device .mobile-bottom-nav {
  background: rgba(28, 28, 30, 0.95) !important;
  border-top-color: rgba(255, 255, 255, 0.1) !important;
}

body.iphone-device .mobile-bottom-nav .nav-item {
  padding: 12px 16px !important;
  border-radius: 12px !important;
  min-height: 50px !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

body.iphone-device .mobile-bottom-nav .nav-item:active {
  background: rgba(0, 122, 255, 0.1) !important;
  transform: scale(0.95) !important;
}

body.iphone-device .mobile-bottom-nav .nav-item.active {
  background: rgba(0, 122, 255, 0.15) !important;
  color: #007AFF !important;
}

body.iphone-device .mobile-bottom-nav .nav-item .nav-icon {
  font-size: 24px !important;
  margin-bottom: 4px !important;
}

body.iphone-device .mobile-bottom-nav .nav-item span:not(.nav-icon) {
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em !important;
}

/* Container con más espacio */
body.iphone-device .container {
  padding: 24px max(20px, env(safe-area-inset-left)) 
           calc(100px + env(safe-area-inset-bottom)) 
           max(20px, env(safe-area-inset-right)) !important;
}

/* Tipografía mejorada para iPhone */
body.iphone-device h1 {
  font-size: 32px !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
  line-height: 1.2 !important;
}

body.iphone-device h2 {
  font-size: 26px !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em !important;
  line-height: 1.3 !important;
}

body.iphone-device h3 {
  font-size: 22px !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em !important;
  line-height: 1.4 !important;
}

/* List items más espaciados */
body.iphone-device .list-item {
  padding: 20px !important;
  margin-bottom: 16px !important;
  border-radius: 16px !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08) !important;
}

/* Chat input más grande */
body.iphone-device .chat-input,
body.iphone-device .chat-input-container {
  padding: 16px 20px !important;
  border-radius: 24px !important;
  min-height: 60px !important;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1) !important;
}

body.iphone-device #message-input {
  font-size: 17px !important;
  padding: 12px 16px !important;
}

/* Modales más grandes y visibles */
body.iphone-device .modal-content {
  border-radius: 24px !important;
  padding: 24px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
}

/* Quick command buttons más grandes */
body.iphone-device .quick-command-btn {
  padding: 16px 20px !important;
  min-height: 56px !important;
  border-radius: 14px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
}

/* FAB más grande */
body.iphone-device .fab-main {
  width: 64px !important;
  height: 64px !important;
  font-size: 32px !important;
  box-shadow: 0 8px 25px rgba(0, 122, 255, 0.4) !important;
}

/* Mejor espaciado general */
body.iphone-device * {
  letter-spacing: -0.01em !important;
}

/* Animaciones más suaves */
body.iphone-device * {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;
}

@media screen and (max-width: 430px) {
  body.iphone-device .container {
    padding: 20px max(16px, env(safe-area-inset-left)) 
             calc(90px + env(safe-area-inset-bottom)) 
             max(16px, env(safe-area-inset-right)) !important;
  }
  
  body.iphone-device .card,
  body.iphone-device .kpi-card {
    padding: 24px !important;
  }
}

/* Finance refresh */
.finance-insights {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
}

.insight-chip {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
}

.insight-chip.negative {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

/* Projects linking */
.section-header-actions {
  display: flex;
  gap: 8px;
}

.project-link-item {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
}

.project-link-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.project-link-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

.project-link-body {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.45;
}

.project-link-meta {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.link-modal-body {
  padding: 16px 20px 20px;
}

.link-search-input {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-color);
  color: var(--text-primary);
  padding: 10px 12px;
  margin-bottom: 12px;
}

.link-item-list {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-candidate-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--glass-bg);
}

.link-candidate-main {
  min-width: 0;
}

.link-candidate-title {
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
}

.link-candidate-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

@media (max-width: 1100px) {
  .finance-insights {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .section-header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .finance-insights {
    grid-template-columns: 1fr;
  }
}
