/* ============================================
   🎨 CSS VARIABLES & THEME CONFIGURATION
   ============================================ */

:root {
  /* Primary Colors */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-600: #4f46e5;
  --primary-light: #818cf8;
  --primary-lighter: #a5b4fc;
  --primary-lightest: #dbeafe;
  
  /* Semantic Colors */
  --secondary: #0ea5e9;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  
  /* Base Colors */
  --dark: #111827;
  --dark-accent: #1f2937;
  --light: #f9fafb;
  --gray: #9ca3af;
  
  /* Background */
  --bg-start: #f5f7fa;
  --bg-end: #e6f2ff;
  --card: #ffffff;
  
  /* Text Colors */
  --text: #111827;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --muted: #6b7280;
  
  /* UI Elements */
  --border: #e2e8f0;
  --hover: #f8fafc;
  
  /* Design System */
  --radius: 14px;
  --radius-lg: 16px;
  --border-radius: 12px;
  --shadow: 0 10px 28px rgba(2,6,23,.08);
  --box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   🌙 DARK THEME
   ============================================ */

:root[data-theme="dark"] {
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --primary-600: #3b82f6;
  --bg-start: #0b1220;
  --bg-end: #0e172a;
  --card: #1e293b;
  --text: #e5e7eb;
  --text-primary: #e5e7eb;
  --text-secondary: #9aa7bd;
  --text-muted: #9aa7bd;
  --muted: #9aa7bd;
  --border: #1f2a44;
  --hover: #2d3748;
  --shadow: 0 12px 30px rgba(0,0,0,.35);
  --dark: #0f172a;
  --dark-accent: #1e293b;
  --light: #1e293b;
}

/* ============================================
   🎯 BASE STYLES
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family);
}

html, body {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
  overflow-x: hidden;
}

.container {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* ============================================
   📱 SIDEBAR NAVIGATION
   ============================================ */

.sidebar {
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark-accent) 100%);
  color: var(--light);
  padding: 30px 24px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 280px;
  transition: var(--transition);
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow);
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.sidebar-header {
  display: flex;
  align-items: center;
  margin-bottom: 40px;
}

.sidebar-header h2 {
  font-size: 24px;
  font-weight: 700;
  margin-left: 12px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
  color: white;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 20px 0;
}

.sidebar-section {
  margin-bottom: 8px;
  margin-top: 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray);
  padding-left: 14px;
  font-weight: 600;
}

.nav-menu {
  list-style: none;
  margin-top: 10px;
  margin-bottom: 10px;
}

.nav-item {
  margin-bottom: 5px;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--border-radius);
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: var(--transition);
  font-weight: 500;
  position: relative;
  cursor: pointer;
}

.nav-link .icon {
  font-size: 20px;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  flex-shrink: 0;
}

.nav-link .label {
  flex: 1;
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0));
  color: white;
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}

.nav-link:hover:not(.active) {
  background-color: rgba(255, 255, 255, 0.05);
  color: white;
  transform: translateX(2px);
}

/* ============================================
   👤 USER PROFILE
   ============================================ */

.user-profile {
  position: absolute;
  bottom: 20px;
  left: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  padding: 16px;
  border-radius: var(--border-radius);
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: var(--transition);
  cursor: pointer;
}

.user-profile:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  margin-right: 12px;
  box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  color: var(--gray);
  font-size: 12px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu {
  color: var(--gray);
  font-size: 18px;
  margin-left: 8px;
}

/* ============================================
   👤 USER MENU DROPDOWN
   ============================================ */

.user-menu-dropdown {
  position: absolute;
  bottom: 80px;
  left: 24px;
  right: 24px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 8px;
  z-index: 1000;
  animation: slideUp 0.2s ease;
}

:root[data-theme="dark"] .user-menu-dropdown {
  background: var(--card);
  border: 1px solid var(--border);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}

.user-menu-item:hover {
  background: var(--hover);
}

.user-menu-item svg {
  flex-shrink: 0;
}

.user-menu-logout {
  color: var(--danger);
}

.user-menu-logout:hover {
  background: rgba(239, 68, 68, 0.1);
}

.user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   📄 MAIN CONTENT AREA
   ============================================ */

.main-content {
  grid-column: 2;
  padding: 30px 40px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  position: relative;
  flex-wrap: wrap;
  gap: 20px;
}

.page-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.header-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

/* ============================================
   🔘 BUTTONS
   ============================================ */

.btn {
  padding: 12px 24px;
  border-radius: var(--border-radius);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-family);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(to right, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 6px 12px -2px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 8px 16px -2px rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: white;
  color: var(--text-primary);
  border: 1px solid #e5e7eb;
  position: relative;
}

:root[data-theme="dark"] .btn-secondary {
  background-color: var(--card);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background-color: #f9fafb;
  box-shadow: var(--box-shadow);
  transform: translateY(-1px);
}

:root[data-theme="dark"] .btn-secondary:hover {
  background-color: var(--dark-accent);
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-success:active {
  transform: translateY(0);
}

.btn-success:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.btn-danger:active {
  transform: translateY(0);
}

.btn-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  transition: var(--transition);
  padding: 0;
}

.btn-close:hover {
  background: var(--light);
  color: var(--danger);
  transform: rotate(90deg);
}

:root[data-theme="dark"] .btn-close:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn.small {
  padding: 6px 12px;
  font-size: 12px;
  height: auto;
  white-space: nowrap;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn.small svg {
  width: 14px;
  height: 14px;
}

.btn-secondary.small {
  background-color: white;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-secondary.small:hover {
  background-color: var(--primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-danger-outline {
  background-color: white !important;
  color: var(--danger) !important;
  border: 1px solid var(--danger) !important;
}

.btn-danger-outline:hover {
  background-color: var(--danger) !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-primary.small {
  background: linear-gradient(to right, var(--primary), var(--primary-dark));
  color: white;
  border: none;
}

.btn-primary.small:hover {
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

.btn.min {
  padding: 8px 16px;
  height: 36px;
  font-size: 13px;
}

.w-full {
  width: 100%;
}

/* ============================================
   🔍 SEARCH & INPUTS
   ============================================ */

.search-box {
  position: relative;
}

.search-input {
  padding: 12px 20px 12px 48px;
  border-radius: var(--border-radius);
  border: 1px solid #e5e7eb;
  width: 280px;
  transition: var(--transition);
  font-size: 14px;
  background-color: white;
  color: var(--text);
  font-family: var(--font-family);
}

:root[data-theme="dark"] .search-input {
  background-color: var(--card);
  border-color: var(--border);
  color: var(--text);
}

.search-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
}

.search-icon::before {
  content: "🔍";
}

.select {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  color: var(--text);
  font: 500 14px/1 var(--font-family);
  cursor: pointer;
  transition: var(--transition);
}

:root[data-theme="dark"] .select {
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}

.select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.select.sm {
  font-size: 13px;
  padding: 8px 12px;
  height: 36px;
}

.input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--border-radius);
  font-family: var(--font-family);
  font-size: 14px;
  transition: var(--transition);
  background: white;
  color: var(--text);
}

:root[data-theme="dark"] .input {
  background: var(--dark-accent);
  border-color: var(--border);
  color: var(--text);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input::placeholder {
  color: var(--text-muted);
}

.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   🔔 NOTIFICATIONS
   ============================================ */

.notification-wrapper {
  position: relative;
}

.badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

:root[data-theme="dark"] .badge {
  border-color: var(--dark);
}

/* ============================================
   📊 DASHBOARD GRID & CARDS
   ============================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.card {
  background-color: var(--card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

:root[data-theme="dark"] .card {
  border-color: var(--border);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

:root[data-theme="dark"] .card:hover {
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
}

.stat-card {
  min-height: 160px;
}

.gradient-overlay {
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100%;
  opacity: 0.1;
  transition: var(--transition);
  pointer-events: none;
}

.gradient-primary {
  background: linear-gradient(135deg, transparent, var(--primary));
}

.gradient-success {
  background: linear-gradient(135deg, transparent, var(--success));
}

.gradient-warning {
  background: linear-gradient(135deg, transparent, var(--warning));
}

.gradient-danger {
  background: linear-gradient(135deg, transparent, var(--danger));
}

.card:hover .gradient-overlay {
  opacity: 0.15;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.icon-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.icon-success {
  background: linear-gradient(135deg, var(--success), #059669);
}

.icon-warning {
  background: linear-gradient(135deg, var(--warning), #d97706);
}

.icon-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
}

.card-value {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.card-change {
  font-size: 14px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  gap: 5px;
}

.positive {
  color: var(--success);
  font-weight: 600;
}

.negative {
  color: var(--danger);
  font-weight: 600;
}

.chip {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chip.up {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.chip.down {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.col-2 {
  grid-column: span 2;
}

.col-3 {
  grid-column: span 3;
}

/* ============================================
   📈 CHARTS
   ============================================ */

.chart-container {
  grid-column: 1 / -1;
  min-height: 400px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.chart-tabs {
  display: flex;
  gap: 10px;
}

.chart-tab {
  padding: 8px 16px;
  border-radius: var(--border-radius);
  background-color: #f1f5f9;
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

:root[data-theme="dark"] .chart-tab {
  background-color: var(--dark-accent);
  color: var(--text-secondary);
}

.chart-tab:hover {
  background-color: #e2e8f0;
}

:root[data-theme="dark"] .chart-tab:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.chart-tab.active {
  background: linear-gradient(to right, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 6px 12px -2px rgba(99, 102, 241, 0.3);
}

.chart-box {
  position: relative;
  width: 100%;
  height: 300px;
  overflow: hidden;
}

.donut-chart {
  height: 250px;
}

:root[data-theme="dark"] .chart-box canvas {
  filter: saturate(1.02);
}

.chart-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  z-index: 10;
  border-radius: 12px;
}

:root[data-theme="dark"] .chart-loading {
  background: rgba(30, 41, 59, 0.95);
}

.chart-loading .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.chart-loading div:last-child {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.green {
  background: var(--success);
}

.dot.amber {
  background: var(--warning);
}

.dot.red {
  background: var(--danger);
}

.legend-item span:not(.dot) {
  flex: 1;
  color: var(--text-secondary);
}

.legend-item b {
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================================
   📋 TABLES
   ============================================ */

.transactions {
  grid-column: 1 / -1;
}

.table-container {
  overflow-x: auto;
  border-radius: var(--border-radius);
  margin-top: 16px;
  position: relative;
}

.table-scroll {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 600px;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.table th {
  padding: 16px 20px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  background-color: #f8fafc;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 10;
}

:root[data-theme="dark"] .table th {
  background-color: var(--dark-accent);
}

.table th:first-child {
  border-top-left-radius: var(--border-radius);
}

.table th:last-child {
  border-top-right-radius: var(--border-radius);
}

.table td {
  padding: 16px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.table tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: var(--transition);
}

.table tbody tr:hover {
  background-color: #f8fafc;
}

:root[data-theme="dark"] .table tbody tr:hover {
  background-color: var(--dark-accent);
}

.transaction-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.transaction-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background-color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  font-weight: 600;
}

.transaction-details {
  flex: 1;
  min-width: 0;
}

.transaction-name {
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.transaction-date {
  font-size: 12px;
  color: var(--text-muted);
}

.amount {
  font-weight: 600;
  font-size: 15px;
}

.amount-negative {
  color: var(--danger);
}

.amount-positive {
  color: var(--success);
}

.table-foot {
  padding: 16px 20px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ============================================
   🏷️ STATUS BADGES
   ============================================ */

.status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  display: inline-block;
  white-space: nowrap;
}

.status-completed {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.status-pending {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.status-failed {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.status-badge {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
}

.status-badge::before {
  font-size: 14px;
}

.status-badge.completed {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  border-color: rgba(16, 185, 129, 0.3);
}

.status-badge.completed::before {
  content: '✓';
}

.status-badge.in-progress {
  background: linear-gradient(135deg, var(--warning), #d97706);
  color: white;
  border-color: rgba(245, 158, 11, 0.3);
}

.status-badge.in-progress::before {
  content: '⏳';
}

.status-badge.not-completed {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
  border-color: rgba(239, 68, 68, 0.3);
}

.status-badge.not-completed::before {
  content: '✗';
}

/* ============================================
   ⚠️ OLD TASK INDICATORS
   ============================================ */

.old-task-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  animation: badgePulse 2s ease-in-out infinite;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.old-task-badge::before {
  content: '⚠️';
  font-size: 12px;
}

@keyframes badgePulse {
  0%, 100% { 
    transform: scale(1); 
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
  }
  50% { 
    transform: scale(1.05); 
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
  }
}

.old-task-row {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.03) 0%, rgba(251, 191, 36, 0.03) 100%);
  position: relative;
}

.old-task-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #f59e0b, #d97706);
  border-radius: 0 4px 4px 0;
}

.old-task-row:hover {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.08) 0%, rgba(251, 191, 36, 0.08) 100%);
}

/* ============================================
   🚨 URGENCY INDICATORS
   ============================================ */

.urgent-task {
  animation: urgentPulse 2s ease-in-out infinite;
  position: relative;
}

@keyframes urgentPulse {
  0%, 100% { 
    background: rgba(239, 68, 68, 0.05); 
    border-left-color: var(--danger);
  }
  50% { 
    background: rgba(239, 68, 68, 0.1); 
    border-left-color: #dc2626;
  }
}

.urgency-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================
   ✅ CONFIRMATION CONTAINERS
   ============================================ */

.confirmed-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.confirmed-text {
  color: var(--success);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  line-height: 1.4;
}

.confirmed-text::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.comment-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.comment-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  max-width: 300px;
  word-wrap: break-word;
}

.action-buttons-inline {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ============================================
   ⏳ LOADING STATES
   ============================================ */

.loading {
  text-align: center;
  color: var(--muted);
  padding: 40px 24px;
}

.spinner {
  margin: 0 auto 10px;
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner-small {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   🎭 MODALS
   ============================================ */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-overlay {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
  padding: 20px;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
}

.modal-panel {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-head,
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  margin-bottom: 20px;
  padding: 24px;
}

.modal-body label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.modal-body textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: 14px;
  transition: var(--transition);
  background: white;
  color: var(--text);
  resize: vertical;
  min-height: 100px;
}

:root[data-theme="dark"] .modal-body textarea {
  background: var(--dark-accent);
  border-color: var(--border);
  color: var(--text);
}

.modal-body textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-foot,
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  background: var(--hover);
  border-top: 1px solid var(--border);
}

/* ============================================
   💬 TOOLTIPS
   ============================================ */

.tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.95);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  max-width: 300px;
  word-wrap: break-word;
  white-space: normal;
  z-index: 10000;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
}

.tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(15, 23, 42, 0.95);
}

.tooltip.tooltip-bottom::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: rgba(15, 23, 42, 0.95);
}

:root[data-theme="dark"] .tooltip {
  background: rgba(255, 255, 255, 0.95);
  color: #1e293b;
}

:root[data-theme="dark"] .tooltip::after {
  border-top-color: rgba(255, 255, 255, 0.95);
}

:root[data-theme="dark"] .tooltip.tooltip-bottom::after {
  border-top-color: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.95);
}

/* ============================================
   🍞 TOAST NOTIFICATIONS
   ============================================ */

.toast-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.toast-error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.toast-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.toast-info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

/* ============================================
   📄 VIEW SECTIONS
   ============================================ */

.view-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view-section.active {
  display: block;
}

.employees-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 24px;
}

.reports-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.report-card {
  text-align: center;
  padding: 30px 20px;
}

.report-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.report-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.report-card p {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 14px;
}

/* ============================================
   🔍 FILTERS
   ============================================ */

.filters-card {
  margin-bottom: 24px;
}

.filters-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.export-group {
  margin-left: auto;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hint {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.info-text {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--primary-lightest), rgba(255, 255, 255, 0.5));
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary);
  color: var(--text-secondary);
  font-size: 14px;
}

.info-text svg {
  flex-shrink: 0;
  color: var(--primary);
}

/* ============================================
   🎨 ICONS
   ============================================ */

.icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dashboard-icon:before { content: "📊"; }
.tasks-icon:before { content: "✓"; }
.employees-icon:before { content: "👥"; }
.analytics-icon:before { content: "📈"; }
.reports-icon:before { content: "📋"; }
.profile-icon:before { content: "👤"; }
.theme-icon:before { content: "🌓"; }
.search-icon:before { content: "🔍"; }
.notification-icon:before { content: "🔔"; }
.refresh-icon:before { content: "🔄"; }
.total-icon:before { content: "📦"; }
.completed-icon:before { content: "✅"; }
.progress-icon:before { content: "⏳"; }
.failed-icon:before { content: "❌"; }
.arrow-right:before { content: "→"; }
.back-icon:before { content: "←"; }
.download-icon:before { content: "⬇️"; }
.add-icon:before { content: "+"; font-size: 18px; font-weight: 700; }
.star-icon:before { content: "⭐"; }
.chart-icon:before { content: "📊"; }

/* ============================================
   📱 MOBILE MENU
   ============================================ */

.menu-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  display: none;
  z-index: 200;
  position: fixed;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================
   📏 FOOTER
   ============================================ */

.footer {
  display: flex;
  align-items: center;
  padding: 20px 0;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  flex-wrap: wrap;
  gap: 16px;
}

.grow {
  flex: 1;
}

.link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.link:hover {
  text-decoration: underline;
}

.view-all {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}

.view-all:hover {
  text-decoration: underline;
}

/* ============================================
   🖱️ SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--light);
}

:root[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--dark);
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

:root[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

:root[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.table-container::-webkit-scrollbar {
  height: 8px;
}

.table-container::-webkit-scrollbar-track {
  background: var(--border);
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

/* ============================================
   📱 MOBILE RESPONSIVE (768px and below)
   ============================================ */

@media (max-width: 768px) {
  .container {
    display: flex;
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 1000;
    transition: left 0.3s ease;
  }

  .sidebar.active {
    left: 0;
  }

  .overlay {
    display: none;
  }

  .overlay.active {
    display: block;
  }

  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 16px;
    left: 16px;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 20px;
    cursor: pointer;
    z-index: 998;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  }

  .main-content {
    margin-left: 0;
    padding: 80px 16px 24px;
    width: 100%;
  }

  .page-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .page-title {
    font-size: 24px;
  }

  .page-subtitle {
    font-size: 13px;
  }

  .header-actions {
    width: 100%;
    flex-direction: column;
    gap: 12px;
  }

  .search-box {
    width: 100%;
  }

  .select {
    width: 100%;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .notification-wrapper {
    width: 100%;
  }

  .notification-wrapper .btn {
    width: 100%;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .card.col-2 {
    grid-column: span 1;
  }

  .stat-card {
    padding: 20px;
  }

  .card-value {
    font-size: 32px;
  }

  .chart-box {
    height: 300px !important;
    min-height: 300px;
  }

  .chart-container .chart-box {
    height: 350px !important;
  }

  .chart-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .chart-tabs {
    width: 100%;
    justify-content: space-between;
  }

  .chart-tab {
    flex: 1;
    text-align: center;
    font-size: 11px;
    padding: 8px 4px;
  }

  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    min-width: 800px;
    font-size: 13px;
  }

  .table th,
  .table td {
    padding: 12px 8px;
    white-space: nowrap;
  }

  .transaction-user {
    min-width: 150px;
  }

  .filters-card {
    padding: 16px;
  }

  .filters-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .actions {
    flex-direction: column;
    gap: 8px;
  }

  .actions .btn {
    width: 100%;
  }

  .export-group {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .card {
    padding: 16px;
    border-radius: 12px;
  }

  .card-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .card-title {
    font-size: 16px;
  }

  .modal-panel {
    width: 95%;
    max-width: 95%;
    margin: 20px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-head {
    padding: 16px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-foot {
    padding: 16px;
    flex-direction: column;
  }

  .modal-foot .btn {
    width: 100%;
  }

  .dashboard-grid.employees-grid {
    grid-template-columns: 1fr;
  }

  #empDetail_taskTable th,
  #empDetail_taskTable td {
    font-size: 12px;
    padding: 10px 6px;
  }

  .old-task-badge {
    font-size: 10px;
    padding: 2px 6px;
  }

  .status-badge {
    font-size: 11px;
    padding: 4px 8px;
  }

  .btn.small {
    font-size: 11px;
    padding: 6px 10px;
  }

  .confirmed-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .action-buttons-inline {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .dashboard-grid[style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: 1fr 1fr !important;
  }

  .reports-grid {
    grid-template-columns: 1fr;
  }

  .report-card {
    padding: 24px 16px;
  }

  .report-icon {
    font-size: 36px;
  }

  .footer {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .hint {
    font-size: 12px;
  }

  .view-all {
    font-size: 12px;
  }

  .legend {
    flex-direction: column;
    gap: 8px;
  }

  .legend-item {
    justify-content: space-between;
  }

  .tooltip {
    font-size: 12px;
    padding: 6px 10px;
    max-width: 250px;
  }

  .urgency-badge {
    font-size: 11px;
    padding: 4px 8px;
  }

  .urgency-badge span:last-child {
    display: none;
  }

  .toast-notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .btn,
  .nav-link,
  .chart-tab {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .table-container::after {
    content: '← Swipe to see more →';
    display: block;
    position: sticky;
    left: 0;
    bottom: 0;
    width: 100%;
    padding: 8px;
    background: var(--primary);
    color: white;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
  }
}

/* ============================================
   💻 TABLET (769px - 1024px)
   ============================================ */

@media (min-width: 769px) and (max-width: 1024px) {
  .main-content {
    margin-left: 280px;
    padding: 32px 24px;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .card.col-2 {
    grid-column: span 2;
  }

  .page-header {
    flex-wrap: wrap;
  }

  .header-actions {
    flex-wrap: wrap;
  }
}

/* ============================================
   🖥️ LARGE DESKTOP (1440px+)
   ============================================ */

@media (min-width: 1440px) {
  .container {
    max-width: 1920px;
    margin: 0 auto;
  }

  .main-content {
    padding: 40px 48px;
  }

  .dashboard-grid {
    gap: 32px;
  }
}

/* ============================================
   🖨️ PRINT STYLES
   ============================================ */

@media print {
  .sidebar,
  .menu-toggle,
  .overlay,
  .header-actions,
  .modal {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0;
    padding: 0;
  }
  
  .container {
    grid-template-columns: 1fr;
  }
  
  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ============================================
   🛠️ UTILITY CLASSES
   ============================================ */

.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.gap { gap: 24px; }
.gap-sm { gap: 12px; }
.gap-lg { gap: 32px; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-4,
  .grid-3,
  .grid-2 { 
    grid-template-columns: 1fr; 
  }
}

/* ============================================
   🎬 ANIMATIONS
   ============================================ */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

.bounce {
  animation: bounce 1s infinite;
}

/* ============================================
   ⚡ PERFORMANCE OPTIMIZATIONS
   ============================================ */

.sidebar {
  will-change: transform;
}

.tooltip {
  will-change: opacity, transform;
}

.chart-container-mobile {
  position: relative;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .chart-container-mobile canvas {
    min-width: 600px;
  }
}

/* ============================================
   ♿ ACCESSIBILITY
   ============================================ */

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  z-index: 100;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  top: 0;
}

.btn:focus-visible,
.nav-link:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* ============================================
   🎨 SKELETON LOADING
   ============================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--border) 25%,
    var(--hover) 50%,
    var(--border) 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
/* ============================================
   🎨 SIDEBAR LOGO IMAGE (แก้ไขใหม่)
   ============================================ */

.sidebar-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;  /* เพิ่ม padding */
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.sidebar-logo {
  width: 44px;   /* ลดจาก 48px */
  height: 44px;  /* ลดจาก 48px */
  background: rgba(99, 102, 241, 0.08);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(99, 102, 241, 0.15);
  border-radius: 10px;  /* ลดจาก 12px */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.sidebar-logo:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.3);
}

/* ปรับ sidebar-header */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;  /* ลดจาก 16px */
  padding: 20px 20px 24px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 20px;  /* ลดจาก 24px */
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .sidebar-logo {
    width: 40px;
    height: 40px;
  }
  
  .sidebar-header h2 {
    font-size: 18px;
  }
}