/* OPD Creative Studio - Task Management System */
/* Premium SaaS Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   1. CSS Variables
   ============================================================ */
:root {
  /* Primary Palette */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-darker: #4338ca;
  --primary-light: #a5b4fc;
  --primary-bg: #eef2ff;

  /* Status Colors */
  --success: #10b981;
  --success-dark: #059669;
  --success-bg: #ecfdf5;

  --warning: #f59e0b;
  --warning-dark: #d97706;
  --warning-bg: #fffbeb;

  --danger: #ef4444;
  --danger-dark: #dc2626;
  --danger-bg: #fef2f2;

  --info: #3b82f6;
  --info-dark: #2563eb;
  --info-bg: #eff6ff;

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --sidebar-bg: #1e1b4b;
  --sidebar-hover: #312e81;
  --sidebar-text: #c7d2fe;
  --sidebar-active-bg: rgba(99, 102, 241, 0.2);
  --sidebar-active-text: #ffffff;

  /* Layout */
  --header-height: 64px;
  --body-bg: #f8fafc;
  --card-bg: #ffffff;

  /* Typography */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* Borders */
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --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);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ============================================================
   2. Base Styles
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--body-bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

::selection {
  background-color: var(--primary);
  color: #ffffff;
}

img {
  max-width: 100%;
  height: auto;
}

/* ============================================================
   3. Layout System
   ============================================================ */
.app-layout {
  display: block;
  min-height: 100vh;
  width: 100%;
}

.app-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  overflow-y: auto;
  z-index: 40;
  transition: width 300ms ease, transform 300ms ease;
  display: flex;
  flex-direction: column;
}

.app-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 300ms ease;
}

.app-header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 30;
}

.app-content {
  flex: 1;
  padding: 24px 24px 40px;
}

/* Responsive Layout */
@media (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.active {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
    width: 100%;
  }
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 35;
  display: none;
}

.sidebar-overlay.active {
  display: block;
}

/* ============================================================
   4. Sidebar Components
   ============================================================ */
.sidebar-brand {
  padding: 20px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #ffffff;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  padding: 12px;
  flex: 1;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(199, 210, 254, 0.5);
  padding: 16px 12px 8px;
  margin: 0;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 2px;
  position: relative;
}

.sidebar-nav-item:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.sidebar-nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.sidebar-nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-nav-item.active .sidebar-nav-icon {
  opacity: 1;
}

.sidebar-nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  background: var(--danger);
  color: #ffffff;
  border-radius: 10px;
  padding: 2px 8px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================================
   5. Cards
   ============================================================ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: all var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-sm);
}

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

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

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 20px;
  background: #f8fafc;
  border-top: 1px solid var(--border-light);
}

/* ============================================================
   6. Stat Cards
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  cursor: default;
}

.stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

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

.stat-card-content {
  flex: 1;
}

.stat-card-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stat-card-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin-top: 4px;
}

.stat-card-change {
  font-size: 12px;
  margin-top: 4px;
}

.stat-card-change.positive {
  color: var(--success);
}

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

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* Stat Card Variants */
.stat-card--primary::before {
  background: var(--primary);
}
.stat-card--primary .stat-card-icon {
  background: var(--primary-bg);
  color: var(--primary);
}

.stat-card--success::before {
  background: var(--success);
}
.stat-card--success .stat-card-icon {
  background: var(--success-bg);
  color: var(--success);
}

.stat-card--warning::before {
  background: var(--warning);
}
.stat-card--warning .stat-card-icon {
  background: var(--warning-bg);
  color: var(--warning);
}

.stat-card--danger::before {
  background: var(--danger);
}
.stat-card--danger .stat-card-icon {
  background: var(--danger-bg);
  color: var(--danger);
}

.stat-card--info::before {
  background: var(--info);
}
.stat-card--info .stat-card-icon {
  background: var(--info-bg);
  color: var(--info);
}

/* ============================================================
   7. Tables
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 2px solid var(--border-color);
  text-align: left;
  position: sticky;
  top: 0;
  white-space: nowrap;
}

.data-table thead th.sortable {
  cursor: pointer;
  user-select: none;
}

.data-table thead th.sortable:hover {
  color: var(--text-primary);
}

.data-table thead th .sort-indicator {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.5;
}

.data-table thead th.sort-asc .sort-indicator,
.data-table thead th.sort-desc .sort-indicator {
  opacity: 1;
  color: var(--primary);
}

.data-table tbody td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table tbody tr.clickable-row {
  cursor: pointer;
}

.data-table tbody tr.clickable-row:hover {
  background: var(--primary-bg);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
}

/* ============================================================
   8. Badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 9999px;
  line-height: 1.5;
  white-space: nowrap;
}

/* Status Badges */
.badge-pending {
  background: #f1f5f9;
  color: #475569;
}

.badge-in_progress {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-on_hold {
  background: #fef3c7;
  color: #b45309;
}

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

.badge-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

/* Priority Badges */
.badge-high {
  background: #fee2e2;
  color: #991b1b;
}

.badge-medium {
  background: #fef3c7;
  color: #b45309;
}

.badge-low {
  background: #d1fae5;
  color: #065f46;
}

/* User Status Badges */
.badge-active {
  background: #d1fae5;
  color: #065f46;
}

.badge-inactive {
  background: #f1f5f9;
  color: #64748b;
}

/* ============================================================
   9. Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1.5;
  outline: none;
  font-family: inherit;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary */
.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Success */
.btn-success {
  background: var(--success);
  color: #ffffff;
  border-color: var(--success);
}

.btn-success:hover {
  background: var(--success-dark);
  border-color: var(--success-dark);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Danger */
.btn-danger {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-dark);
  border-color: var(--danger-dark);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Warning */
.btn-warning {
  background: var(--warning);
  color: #ffffff;
  border-color: var(--warning);
}

.btn-warning:hover {
  background: var(--warning-dark);
  border-color: var(--warning-dark);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Outline Primary */
.btn-outline-primary {
  background: transparent;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline-primary:hover {
  background: var(--primary-bg);
}

/* Outline Danger */
.btn-outline-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-outline-danger:hover {
  background: var(--danger-bg);
}

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

.btn-ghost:hover {
  background: var(--border-light);
}

/* Size Variants */
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius);
}

/* Loading State */
.btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.btn.loading .btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ============================================================
   10. Forms
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
  font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

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

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ============================================================
   11. Modals
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: scaleIn var(--transition-slow) ease;
}

.modal-lg .modal-content {
  max-width: 720px;
}

.modal-sm .modal-content {
  max-width: 400px;
}

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

.modal-header .modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

/* ============================================================
   12. Toast Notifications
   ============================================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 400px;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid;
  animation: slideInRight var(--transition-slow) ease;
  position: relative;
  overflow: hidden;
  min-width: 320px;
}

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

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

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

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

.toast-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

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

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

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

.toast-info .toast-icon {
  color: var(--info);
}

.toast-body {
  flex: 1;
}

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

.toast-message {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.toast-close {
  background: none;
  border: none;
  font-size: 16px;
  padding: 2px;
  flex-shrink: 0;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition-fast);
  line-height: 1;
}

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

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.3;
  animation: progressBar linear forwards;
}

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

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

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

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

.toast.removing {
  animation: slideOutRight 300ms ease forwards;
}

/* Notifications Dropdown */
.notification-item {
  display: flex;
  align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}

.notification-item:last-child {
  border-bottom: none;
}

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

.notification-item.unread {
  background: rgba(99, 102, 241, 0.05);
}

.notification-item.unread:hover {
  background: var(--primary-bg);
}

.notification-content {
  flex: 1;
  padding-right: 12px;
}

.notification-text {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.4;
}

.notification-item.unread .notification-text {
  font-weight: 600;
}

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

.notification-item .notification-dot {
  position: relative;
  top: 6px;
  right: 0;
}

/* ============================================================
   13. Timeline
   ============================================================ */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  padding-bottom: 24px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #ffffff;
}

.timeline-dot--created {
  background: var(--info);
}

.timeline-dot--updated {
  background: var(--warning);
}

.timeline-dot--completed {
  background: var(--success);
}

.timeline-dot--comment {
  background: var(--primary);
}

.timeline-dot--deleted {
  background: var(--danger);
}

.timeline-content {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

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

.timeline-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.timeline-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ============================================================
   14. Filter Bar
   ============================================================ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 16px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
}

.filter-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.search-input {
  padding-left: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 16px;
}

/* ============================================================
   15. Utilities
   ============================================================ */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

.divider {
  height: 1px;
  background: var(--border-color);
  margin: 16px 0;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.empty-state-text {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
  max-width: 360px;
  margin-inline: auto;
}

/* Loading Skeleton */
.loading-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
  height: 20px;
}

.loading-skeleton.skeleton-title {
  height: 24px;
  width: 60%;
}

.loading-skeleton.skeleton-text {
  height: 16px;
  width: 80%;
}

.loading-skeleton.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* Scrollbar */
.scroll-thin::-webkit-scrollbar {
  width: 6px;
}

.scroll-thin::-webkit-scrollbar-track {
  background: transparent;
}

.scroll-thin::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

.scroll-thin::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Notification Dot */
.notification-dot {
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  position: absolute;
  top: -2px;
  right: -2px;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb-separator::after {
  content: '/';
  opacity: 0.5;
}

/* ============================================================
   16. Keyframe Animations
   ============================================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

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

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

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

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

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

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

/* Animation Utility Classes */
.fade-in {
  animation: fadeIn var(--transition-slow) ease;
}

.fade-in-up {
  animation: fadeInUp var(--transition-slow) ease both;
}

.stagger-1 { animation-delay: 50ms; }
.stagger-2 { animation-delay: 100ms; }
.stagger-3 { animation-delay: 150ms; }
.stagger-4 { animation-delay: 200ms; }
.stagger-5 { animation-delay: 250ms; }
.stagger-6 { animation-delay: 300ms; }
.stagger-7 { animation-delay: 350ms; }
.stagger-8 { animation-delay: 400ms; }

/* ============================================================
   17. Print Styles
   ============================================================ */
@media print {
  .app-sidebar,
  .sidebar-overlay,
  .app-header,
  .filter-actions,
  .btn,
  .toast-container,
  .modal-overlay {
    display: none !important;
  }

  .app-layout {
    display: block;
  }

  .app-main {
    margin-left: 0 !important;
  }

  .app-content {
    padding: 0;
  }

  body {
    background: #ffffff;
    color: #000000;
  }

  .card {
    box-shadow: none;
    border: 1px solid #cccccc;
    break-inside: avoid;
  }

  .stat-card {
    box-shadow: none;
    border: 1px solid #cccccc;
  }

  .stat-card:hover {
    transform: none;
  }

  .data-table {
    width: 100%;
  }

  .data-table thead th {
    background: #f0f0f0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .data-table tbody td {
    border-bottom: 1px solid #cccccc;
  }

  .badge {
    border: 1px solid currentColor;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  a {
    color: #000000;
  }

  .page-title {
    font-size: 20px;
  }
}

/* ============================================================
   18. Login Page Styles
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #3730a3 100%);
  position: relative;
  /*overflow: hidden;*/
  overflow: visible;
}

.login-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  animation: fadeInUp var(--transition-slow) ease;
}

@media (max-width: 480px) {
  .login-card {
    margin: 16px;
    padding: 24px;
  }
}

.login-logo {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo-icon {
  width: 56px;
  height: 56px;
  background: var(--primary);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #ffffff;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Decorative Background Pattern */
.login-bg-pattern {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-bg-pattern::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.15);
  filter: blur(80px);
}

.login-bg-pattern::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.1);
  filter: blur(60px);
}

.login-bg-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

/* Role Selector */
.role-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 480px) {
  .role-selector {
    grid-template-columns: 1fr;
  }
}

.role-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--card-bg);
}

.role-card:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.role-card.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.role-card-icon {
  font-size: 28px;
  margin-bottom: 8px;
  display: block;
}

.role-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.role-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-muted);
}

.login-footer a {
  color: var(--primary);
  font-weight: 600;
}

.login-footer a:hover {
  color: var(--primary-dark);
}

.login-error {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--danger-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: shake 0.4s ease;
}

/* Password Toggle */
.password-wrapper { position: relative; display: flex; align-items: center; }
.password-wrapper input { padding-right: 40px; }
.password-toggle-btn { position: absolute; right: 10px; background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px; padding: 0; outline: none; }
.password-toggle-btn:hover { color: var(--text-primary); }

/* ============================================================
   19. Responsive Laptop Layout (Scaling)
   ============================================================ */

@media (max-width: 1600px) {
  :root {
    --header-height: 60px;
    --sidebar-width: 240px;
  }
  
  .app-content {
    padding: 20px 20px 32px;
  }

  .page-title {
    font-size: 22px;
  }
  
  .card-header {
    padding: 16px 20px;
  }
  
  .card-body {
    padding: 20px;
  }
  
  .data-table thead th {
    padding: 10px 14px;
    font-size: 11px;
  }

  .data-table tbody td {
    padding: 12px 14px;
    font-size: 13px;
  }
  
  .btn {
    padding: 8px 16px;
    font-size: 13px;
  }

  .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .form-input, .form-select, .form-textarea {
    padding: 8px 14px;
    font-size: 13px;
  }
  
  .form-label {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .sidebar-brand {
    padding: 16px;
  }

  .sidebar-brand-text {
    font-size: 15px;
  }

  .sidebar-nav-item {
    padding: 8px 12px;
    font-size: 13px;
  }

  .stat-card {
    padding: 20px;
  }

  .stat-card-value {
    font-size: 28px;
  }
}

@media (max-width: 1366px) {
  :root {
    --header-height: 56px;
    --sidebar-width: 220px;
  }

  .app-content {
    padding: 16px 16px 24px;
  }

  .page-title {
    font-size: 20px;
  }

  .card-header {
    padding: 14px 16px;
  }
  
  .card-body {
    padding: 16px;
  }

  .data-table thead th {
    padding: 8px 12px;
    font-size: 10px;
  }

  .data-table tbody td {
    padding: 10px 12px;
    font-size: 12px;
  }

  .btn {
    padding: 6px 14px;
    font-size: 12px;
  }
  
  .btn-sm {
    padding: 4px 10px;
    font-size: 11px;
  }

  .form-input, .form-select, .form-textarea {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .form-label {
    font-size: 12px;
    margin-bottom: 4px;
  }

  .sidebar-brand {
    padding: 12px;
  }

  .sidebar-brand-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .sidebar-brand-text {
    font-size: 14px;
  }

  .sidebar-nav-item {
    padding: 8px 10px;
    font-size: 12px;
    gap: 8px;
  }

  .sidebar-nav-icon {
    font-size: 14px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-card-value {
    font-size: 24px;
  }
}

/* ============================================================
   20. Mobile-First & Phone Excellence (Screens <= 640px)
   ============================================================ */
@media (max-width: 640px) {
  :root {
    --header-height: 56px;
  }
  
  /* Global Layout & Padding */
  .app-content, .page-content, main {
    padding: 12px !important;
  }
  
  /* Header adjustments for mobile phones */
  .app-header {
    padding: 0 12px !important;
    gap: 8px !important;
  }
  
  /* Hide non-essential text on small screens to prevent overflow */
  .hide-mobile {
    display: none !important;
  }
  
  /* Ensure all dropdown panels fit screen without horizontal scrolling */
  #notification-dropdown, #boss-tasks-dropdown, #user-dropdown, .dropdown-menu {
    position: fixed !important;
    top: 60px !important;
    left: 12px !important;
    right: 12px !important;
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100vh - 80px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    word-wrap: break-word !important;
    z-index: 9999 !important;
  }

  /* Role selector grid on landing page */
  .role-cards-grid, .role-selector {
    grid-template-columns: 1fr !important;
    padding: 0 !important;
    gap: 14px !important;
  }

  /* Cards & Form containers */
  .card {
    border-radius: var(--radius-md) !important;
    margin-bottom: 16px !important;
  }
  
  .card-header {
    padding: 14px 16px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }
  
  .card-body {
    padding: 16px !important;
  }

  /* Stack filter bars, action buttons, and flex rows vertically on mobile */
  .filter-bar, .action-bar, .flex-row-mobile-stack {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  
  .filter-bar > *, .action-bar > *, .flex-row-mobile-stack > * {
    width: 100% !important;
    text-align: left !important;
  }

  /* Tables horizontal scrolling */
  .table-responsive, .table-container {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  .data-table th, .data-table td {
    white-space: nowrap !important;
    padding: 10px 12px !important;
  }

  /* Make buttons full width and centered on mobile when stacked */
  .btn-mobile-full {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Boss dashboard responsive tweaks */
  .boss-card {
    margin: 16px auto !important;
    width: 100% !important;
    border-radius: 12px !important;
  }
  .boss-card-header {
    padding: 18px 16px !important;
  }
  .boss-card-body {
    padding: 20px 16px !important;
  }
}

@media (max-width: 480px) {
  /* Extra compact adjustments for very narrow phone screens (320px - 480px) */
  .stat-card {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }
  
  .stat-card-icon {
    align-self: flex-end !important;
    margin-top: -36px !important;
  }

  .login-card {
    margin: 12px !important;
    padding: 20px !important;
  }
}

/* Universal Dropdown & Select Box Screen-Boundary Protection */
select, select option {
  max-width: 100% !important;
  text-overflow: ellipsis !important;
  overflow: hidden !important;
  white-space: normal !important;
  word-wrap: break-word !important;
}

#user-dropdown, #notification-dropdown, #boss-tasks-dropdown, .dropdown-menu {
  max-width: calc(100vw - 24px) !important;
  box-sizing: border-box !important;
}

@media (max-width: 1024px) {
  #user-dropdown, #notification-dropdown, #boss-tasks-dropdown, .dropdown-menu {
    max-width: calc(100vw - 24px) !important;
    overflow-x: hidden !important;
    word-wrap: break-word !important;
  }
}

/* ============================================================
   MOBILE RESPONSIVE TABLES & LAYOUTS (Mobile First Approach)
   ============================================================ */
@media (max-width: 768px) {
  .mobile-friendly-table {
    display: block !important;
    width: 100% !important;
    border: none !important;
  }
  .mobile-friendly-table thead, 
  .mobile-friendly-table tbody, 
  .mobile-friendly-table th, 
  .mobile-friendly-table td, 
  .mobile-friendly-table tr { 
    display: block; 
  }
  .mobile-friendly-table thead tr { 
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  .mobile-friendly-table tr { 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    background: var(--card-bg);
    overflow: hidden;
  }
  .mobile-friendly-table td { 
    border: none !important;
    border-bottom: 1px solid var(--border-light) !important; 
    position: relative;
    padding: 12px 16px 12px 40% !important; 
    text-align: right !important;
    white-space: normal !important;
    min-height: 44px;
  }
  .mobile-friendly-table td:before { 
    content: attr(data-label);
    position: absolute;
    left: 16px;
    top: 12px;
    width: 35%; 
    padding-right: 10px; 
    white-space: nowrap;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
  }
  .mobile-friendly-table td:last-child {
      border-bottom: 0 !important;
  }
  
  /* Make filter forms stack on mobile */
  .filter-bar form {
      flex-direction: column !important;
      align-items: stretch !important;
      gap: 12px !important;
  }
  .filter-bar form > div {
      min-width: 100% !important;
      flex: 1 1 100% !important;
  }
  .filter-actions {
      justify-content: flex-end;
      width: 100%;
  }
}
