/* ================================
   MODERN DESIGN SYSTEM
   ================================ */

/* CSS Custom Properties (Design Tokens) */
:root {
  /* Color Palette - Primary */
  --color-primary-50: #f0f4ff;
  --color-primary-100: #dce5ff;
  --color-primary-200: #bfd2ff;
  --color-primary-300: #93b4ff;
  --color-primary-400: #6791ff;
  --color-primary-500: #4169ff;
  --color-primary-600: #2947f5;
  --color-primary-700: #1e33d8;
  --color-primary-800: #1e2cae;
  --color-primary-900: #1e2a89;
  
  /* Color Palette - Secondary */
  --color-secondary-50: #faf5ff;
  --color-secondary-100: #f3e8ff;
  --color-secondary-200: #e9d5ff;
  --color-secondary-300: #d8b4fe;
  --color-secondary-400: #c084fc;
  --color-secondary-500: #a855f7;
  --color-secondary-600: #9333ea;
  --color-secondary-700: #7e22ce;
  --color-secondary-800: #6b21a8;
  --color-secondary-900: #581c87;
  
  /* Color Palette - Accent */
  --color-accent-50: #fff1f2;
  --color-accent-100: #ffe4e6;
  --color-accent-200: #fecdd3;
  --color-accent-300: #fda4af;
  --color-accent-400: #fb7185;
  --color-accent-500: #f43f5e;
  --color-accent-600: #e11d48;
  --color-accent-700: #be123c;
  --color-accent-800: #9f1239;
  --color-accent-900: #881337;
  
  /* Neutral Colors */
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;
  
  /* Semantic Colors */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;
  
  /* Spacing Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Z-index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  
  /* Light Mode Variables */
  --bg-primary: #ffffff;
  --bg-secondary: var(--color-gray-50);
  --bg-tertiary: var(--color-gray-100);
  --bg-elevated: #ffffff;
  
  --text-primary: var(--color-gray-900);
  --text-secondary: var(--color-gray-600);
  --text-tertiary: var(--color-gray-500);
  --text-inverse: #ffffff;
  
  --border-color: var(--color-gray-200);
  --border-color-hover: var(--color-gray-300);
  
  --gradient-primary: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-secondary-500) 100%);
  --gradient-secondary: linear-gradient(135deg, var(--color-secondary-500) 0%, var(--color-primary-500) 100%);
}

/* Dark Mode Variables */
body.dark-mode {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d26;
  --bg-tertiary: #252932;
  --bg-elevated: #1f232e;
  
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-tertiary: #6b7280;
  --text-inverse: var(--color-gray-900);
  
  --border-color: #2d3139;
  --border-color-hover: #3d4148;
  
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* ================================
   GLOBAL STYLES
   ================================ */

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* ================================
   MODERN CARD COMPONENTS
   ================================ */

.card-modern {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.card-modern:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
}

body.dark-mode .card-glass {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-elevated {
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

/* ================================
   AUTHENTICATION STYLES
   ================================ */

.auth-container-modern {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
}

.auth-container-modern::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(-20px, -20px) rotate(180deg); }
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-elevated);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  box-shadow: var(--shadow-2xl);
  border: 1px solid var(--border-color);
  position: relative;
  z-index: 1;
}

.auth-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.auth-logo {
  width: 64px;
  height: 64px;
  background: var(--gradient-primary);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-3xl);
  margin: 0 auto var(--space-4);
  box-shadow: var(--shadow-lg);
}

.auth-title {
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.auth-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ================================
   MODERN FORM STYLES
   ================================ */

.form-group-modern {
  margin-bottom: var(--space-5);
}

.form-label-modern {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-input-modern {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input-modern:focus {
  border-color: var(--color-primary-500);
  background-color: var(--bg-elevated);
  box-shadow: 0 0 0 4px rgba(65, 105, 255, 0.1);
}

.form-input-modern::placeholder {
  color: var(--text-tertiary);
}

/* ================================
   MODERN BUTTONS
   ================================ */

.btn-modern {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-sans);
  text-decoration: none;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
  white-space: nowrap;
}

.btn-primary-modern {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary-modern:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary-modern:active {
  transform: translateY(0);
}

.btn-secondary-modern {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-secondary-modern:hover {
  background: var(--bg-elevated);
  border-color: var(--border-color-hover);
}

.btn-ghost-modern {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost-modern:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-danger-modern {
  background: var(--color-error);
  color: white;
}

.btn-danger-modern:hover {
  background: #dc2626;
  box-shadow: var(--shadow-md);
}

.btn-full {
  width: 100%;
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
}

/* ================================
   MODERN TABS
   ================================ */

.tabs-modern {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-1);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
}

.tab-modern {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-modern:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.tab-modern.active {
  color: var(--color-primary-500);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

/* ================================
   MODERN TABLE STYLES
   ================================ */

.table-modern {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-modern thead {
  background: var(--bg-tertiary);
}

.table-modern th {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  text-align: left;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.table-modern tbody tr {
  transition: background-color var(--transition-fast);
}

.table-modern tbody tr:hover {
  background: var(--bg-tertiary);
}

.table-modern td {
  padding: 12px;
  font-size: var(--text-sm);
  color: var(--text-primary);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.table-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
}

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.action-btn:hover {
  transform: scale(1.1);
}

.action-btn.edit-btn:hover {
  background: var(--color-primary-100);
  color: var(--color-primary-600);
}

.action-btn.delete-btn:hover {
  background: var(--color-accent-100);
  color: var(--color-accent-600);
}

.table-modern td:last-child {
  border-right: none;
}

/* ================================
   STAT CARDS
   ================================ */

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-label {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-change {
  font-size: var(--text-xs);
  color: var(--color-success);
  margin-top: var(--space-2);
}

.stat-change.negative {
  color: var(--color-error);
}

/* ================================
   MODERN DASHBOARD HEADER
   ================================ */

.dashboard-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-color);
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.dashboard-logo {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.dashboard-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
}

/* ================================
   DROPDOWN MENU
   ================================ */

.dropdown-modern {
  position: relative;
}

.dropdown-toggle-modern {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dropdown-toggle-modern:hover {
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.dropdown-menu-modern {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-2);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
}

.dropdown-item-modern {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
  font-size: var(--text-sm);
}

.dropdown-item-modern:hover {
  background: var(--bg-tertiary);
}

.dropdown-divider-modern {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-2) 0;
}

/* ================================
   ALERTS & NOTIFICATIONS
   ================================ */

.alert-modern {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  box-shadow: var(--shadow-sm);
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border-left: 4px solid var(--color-info);
  color: var(--color-info);
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border-left: 4px solid var(--color-success);
  color: var(--color-success);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-left: 4px solid var(--color-warning);
  color: var(--color-warning);
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border-left: 4px solid var(--color-error);
  color: var(--color-error);
}

/* ================================
   UTILITIES
   ================================ */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }

.w-full { width: 100%; }

/* ================================
   RESPONSIVE DESIGN
   ================================ */

@media (max-width: 768px) {
  /* ── Auth ── */
  .auth-card {
    padding: var(--space-6);
  }

  .auth-title {
    font-size: var(--text-2xl);
  }

  /* ── Dashboard Header ── */
  .dashboard-header {
    padding: var(--space-3) var(--space-4);
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .dashboard-logo {
    font-size: var(--text-base);
  }

  .dashboard-logo img {
    height: 30px !important;
    width: 30px !important;
  }

  .dropdown-toggle-modern {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
  }

  /* ── Main Container ── */
  .main-container {
    padding: var(--space-3) !important;
  }

  /* ── Stat Cards ── */
  .stat-value {
    font-size: var(--text-2xl);
  }

  /* ── Entry / Filter / Chart Cards ── */
  .entry-form-card,
  .filter-card,
  .chart-card {
    padding: var(--space-4);
  }

  /* ── Section Title ── */
  .section-title {
    font-size: var(--text-lg) !important;
  }

  /* ── Buttons — smaller on mobile ── */
  .btn-modern {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
  }

  .btn-lg {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-base);
  }

  .btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
  }

  /* ── View Status Bar ── */
  .view-status-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
  }

  .view-status-bar .btn-group-modern {
    width: 100%;
    flex-wrap: wrap;
    gap: var(--space-1);
  }

  .view-status-bar .btn-group-modern .btn-modern {
    flex: 1 1 auto;
    min-width: 44px;
    font-size: var(--text-xs);
    padding: var(--space-2) var(--space-2);
    text-align: center;
  }

  /* ── Filter button group ── */
  .btn-group-modern {
    flex-wrap: wrap;
  }

  /* ── Advisor Card ── */
  #advisorInner {
    flex-direction: column !important;
    gap: 12px !important;
    padding: 16px !important;
    align-items: flex-start !important;
  }

  #advisorRing {
    width: 52px !important;
    height: 52px !important;
    font-size: 1.4rem !important;
  }

  #advisorHourNum {
    font-size: 1.8rem !important;
  }

  #advisorInner > div:last-child {
    border-left: none !important;
    padding-left: 0 !important;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* ── Running Timer ── */
  #runningTimer {
    font-size: var(--text-3xl) !important;
  }

  /* ── Tapering Goal section ── */
  #taperingGoalSection .entry-form-card {
    padding: var(--space-4);
  }

  /* ── Section header wrap ── */
  .section-header {
    flex-wrap: wrap;
    gap: var(--space-3);
  }

  /* ── Table header card ── */
  .table-header-card {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
  }

  /* ── Modal ── */
  .modal-content-modern {
    padding: var(--space-5);
    border-radius: var(--radius-xl);
  }

  /* ── Confirm dialog ── */
  .confirm-dialog-content {
    padding: var(--space-5);
    margin: var(--space-4);
  }

  .dialog-actions {
    flex-direction: column;
  }
}

/* ================================
   MODAL OVERLAY
   ================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-6);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content-modern {
  background: var(--bg-elevated);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-2xl);
  border: 1px solid var(--border-color);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalSlideIn var(--transition-base) ease-out;
}

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

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

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

.animate-fade-in {
  animation: fadeIn var(--transition-slow) ease-out;
}

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

.animate-slide-in {
  animation: slideIn var(--transition-slow) ease-out;
}

/* ================================
   LOADING STATES
   ================================ */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--color-primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-elevated) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ================================
   V2 ADDITIONAL STYLES
   ================================ */

.advisor-card {
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

.advisor-strong-red {
  border-left: 6px solid var(--color-error) !important;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.15) 0%, transparent 100%);
  color: var(--color-error);
}

.advisor-red {
  border-left: 6px solid var(--color-error) !important;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.08) 0%, transparent 100%);
}

.advisor-yellow {
  border-left: 6px solid var(--color-warning) !important;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.08) 0%, transparent 100%);
}

.advisor-safe {
  border-left: 6px solid var(--color-success) !important;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.08) 0%, transparent 100%);
}

.advisor-icon-bg {
  position: absolute;
  right: -10px;
  bottom: -10px;
  font-size: 5rem;
  opacity: 0.05;
  transform: rotate(-15deg);
}

.view-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  backdrop-filter: blur(8px);
}

.premium-blur {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.badge-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  margin-right: 8px;
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.d-none { display: none !important; }

/* Better tooltips */
[data-bs-toggle="tooltip"] {
  cursor: help;
}

/* ================================
   THEMES
   ================================ */

body.theme-serenity {
  --color-primary-500: #10b981; /* Emerald */
  --color-primary-600: #059669;
  --gradient-primary: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
  --bg-secondary: #f0fdf4; /* Very light green */
  --bg-elevated: #ffffff;
}

body.theme-midnight {
  --color-primary-500: #6366f1; /* Indigo */
  --color-primary-600: #4f46e5;
  --bg-primary: #020617;
  --bg-secondary: #0f172a;
  --bg-tertiary: #1e293b;
  --bg-elevated: #2d3b50;
  --bg-glass: rgba(30, 41, 59, 0.7);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --border-color-hover: #475569;
}

/* ================================
   PROFESSIONAL POLISH (V2.1)
   ================================ */

/* Responsive Table -> Cards on Mobile */
@media (max-width: 992px) {
  .table-modern thead {
    display: none;
  }

  .table-modern,
  .table-modern tbody,
  .table-modern tr,
  .table-modern td {
    display: block;
    width: 100%;
  }

  .table-modern tr {
    margin-bottom: var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }

  .table-modern td {
    text-align: right;
    padding: var(--space-3) var(--space-4) var(--space-3) 45%;
    position: relative;
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    word-break: break-word;
    min-height: 40px;
  }

  .table-modern td:last-child {
    border-bottom: none !important;
    text-align: center;
    padding-left: var(--space-4);
  }

  .table-modern td::before {
    content: attr(data-label);
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    width: 40%;
    text-align: left;
    font-weight: var(--font-weight-semibold);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  /* Action buttons inside table cards */
  .table-actions {
    justify-content: center;
    padding: var(--space-2) 0;
  }
}

/* Extra tight on very small phones */
@media (max-width: 480px) {
  .table-modern td {
    padding-left: 40%;
  }

  .table-modern td::before {
    width: 35%;
    font-size: 0.65rem;
  }

  /* Stack form buttons vertically */
  .form-grid .btn-modern,
  .btn-full {
    font-size: var(--text-sm);
  }

  /* Compact stat cards */
  .stat-card {
    padding: var(--space-4);
  }

  .stat-value {
    font-size: var(--text-xl);
  }

  /* Smaller timer display */
  #runningTimer {
    font-size: var(--text-2xl) !important;
  }

  /* View status bar buttons: even more compact */
  .view-status-bar .btn-group-modern .btn-modern {
    padding: var(--space-1) var(--space-2);
    min-width: 38px;
  }
}

/* Sophisticated Empty State */
.pro-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
  animation: fadeIn 0.5s ease-out;
}

.pro-empty-icon {
  font-size: 5rem;
  margin-bottom: var(--space-4);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.8;
}


.pro-empty-title {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.pro-empty-text {
  color: var(--text-secondary);
  max-width: 400px;
  line-height: 1.6;
}

/* Loading Skeletons */
.skeleton-row {
  height: 60px;
  width: 100%;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-elevated) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
/* ================================
   MODERN DIALOG SYSTEM
   ================================ */

.confirm-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: dialog-fade-in 0.2s ease-out;
}

.confirm-dialog-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  width: 90%;
  max-width: 440px;
  box-shadow: var(--shadow-2xl);
  transform-origin: center;
  animation: dialog-pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dialog-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  background: var(--bg-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  border: 2px solid var(--border-color);
}

.dialog-title {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  text-align: center;
  margin-bottom: var(--space-2);
}

.dialog-message {
  font-size: var(--text-base);
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.6;
  margin-bottom: var(--space-6);
}

.dialog-actions {
  display: flex;
  gap: var(--space-3);
}

.dialog-btn {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-weight: var(--font-weight-bold);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dialog-btn-cancel {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.dialog-btn-confirm {
  background: var(--color-danger-600);
  color: white;
}

.dialog-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

@keyframes dialog-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialog-pop-in {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
