/* ═══════════════════════════════════════════════════════════════
   AssignIQ v2 — Enterprise Design System
   Premium Workforce Management Platform CSS
   ═══════════════════════════════════════════════════════════════ */

/* ─── Google Fonts ────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Design Tokens ───────────────────────────────────────── */
:root {
  /* Dark Mode (default) */
  --bg-base:       #0D0F1A;
  --bg-surface:    #131629;
  --bg-card:       #1A1E35;
  --bg-card-hover: #1F2440;
  --bg-glass:      rgba(26, 30, 53, 0.80);
  --bg-input:      #0F1226;
  --bg-modal:      #141728;

  --border:        rgba(255,255,255,0.06);
  --border-active: rgba(108, 99, 255, 0.50);
  --border-input:  rgba(255,255,255,0.10);

  --text-primary:  #EEF0FF;
  --text-secondary:#8B8FAE;
  --text-muted:    #4B4F6B;
  --text-link:     #6C63FF;

  /* Brand Colors */
  --accent-purple: #6C63FF;
  --accent-blue:   #3B9EFF;
  --accent-green:  #10B981;
  --accent-amber:  #F59E0B;
  --accent-red:    #EF4444;
  --accent-pink:   #EC4899;
  --accent-cyan:   #06B6D4;
  --accent-indigo: #818CF8;

  /* Gradients */
  --grad-primary:  linear-gradient(135deg, #6C63FF 0%, #3B9EFF 100%);
  --grad-success:  linear-gradient(135deg, #10B981 0%, #059669 100%);
  --grad-warning:  linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  --grad-danger:   linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  --grad-purple:   linear-gradient(135deg, #6C63FF 0%, #EC4899 100%);
  --grad-glass:    linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.01) 100%);

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.40);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.45);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.55);
  --shadow-glow: 0 0 24px rgba(108, 99, 255, 0.25);

  /* Layout */
  --sidebar-w:   260px;
  --topbar-h:    64px;
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   24px;

  /* Transition */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode */
body.light-theme {
  --bg-base:       #F0F2FF;
  --bg-surface:    #FFFFFF;
  --bg-card:       #FFFFFF;
  --bg-card-hover: #F5F7FF;
  --bg-glass:      rgba(255,255,255,0.85);
  --bg-input:      #F4F6FF;
  --bg-modal:      #FFFFFF;
  --border:        rgba(0,0,0,0.08);
  --border-active: rgba(108, 99, 255, 0.40);
  --border-input:  rgba(0,0,0,0.12);
  --text-primary:  #1A1D2E;
  --text-secondary:#6B7280;
  --text-muted:    #9CA3AF;
}

/* ─── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--text-link); text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }

/* ─── App Shell Layout ─────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition);
  position: relative;
  z-index: 100;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 36px; height: 36px;
  background: var(--grad-primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff;
  box-shadow: var(--shadow-glow);
}
.logo-text { font-size: 18px; font-weight: 800; color: var(--text-primary); }
.logo-text span { background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-section { margin-bottom: 20px; }
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 0 8px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
  width: 100%;
  position: relative;
}
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(108,99,255,0.15) 0%, rgba(108,99,255,0.05) 100%);
  color: var(--accent-purple);
  font-weight: 600;
  border-left: 3px solid var(--accent-purple);
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--accent-red);
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  cursor: pointer;
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--text-muted); text-transform: capitalize; }

/* ─── Main Content ─────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ─── Top Bar ───────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.topbar-subtitle { font-size: 12px; color: var(--text-muted); font-weight: 400; margin-left: 8px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  min-width: 220px;
}
.search-box i { color: var(--text-muted); font-size: 13px; }
.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  width: 100%;
}
.search-box input::placeholder { color: var(--text-muted); }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 14px;
  transition: all var(--transition);
  position: relative;
  cursor: pointer;
}
.icon-btn:hover { color: var(--text-primary); border-color: var(--border-active); }
.icon-btn .notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--accent-red);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}
.icon-btn .notif-count {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--accent-red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 4px;
  min-width: 16px;
  text-align: center;
}

/* ─── Content Area ─────────────────────────────────────────────── */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-base);
}
.content-area::-webkit-scrollbar { width: 6px; }
.content-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Views */
.view { display: none; animation: fadeSlideIn 0.3s ease; }
.view.active { display: block; }
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Page Header ──────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-left h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.page-header-left p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ─── KPI Cards ────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--grad-primary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.kpi-card.green::before { background: var(--grad-success); }
.kpi-card.amber::before { background: var(--grad-warning); }
.kpi-card.red::before   { background: var(--grad-danger); }
.kpi-card.pink::before  { background: var(--grad-purple); }

.kpi-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  background: rgba(108, 99, 255, 0.12);
  color: var(--accent-purple);
}
.kpi-card.green .kpi-icon { background: rgba(16,185,129,0.12); color: var(--accent-green); }
.kpi-card.amber .kpi-icon { background: rgba(245,158,11,0.12); color: var(--accent-amber); }
.kpi-card.red   .kpi-icon { background: rgba(239,68,68,0.12);  color: var(--accent-red); }
.kpi-card.pink  .kpi-icon { background: rgba(236,72,153,0.12); color: var(--accent-pink); }
.kpi-card.cyan  .kpi-icon { background: rgba(6,182,212,0.12);  color: var(--accent-cyan); }
.kpi-card.cyan::before    { background: linear-gradient(135deg, #06B6D4, #0891B2); }

.kpi-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.kpi-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-change { font-size: 11px; color: var(--accent-green); margin-top: 4px; }

/* ─── Cards & Panels ──────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title i { color: var(--accent-purple); }

.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ─── Grid Layouts ─────────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.main-aside { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
@media (max-width: 1200px) { .main-aside { grid-template-columns: 1fr; } }
@media (max-width: 768px) { .two-col, .three-col { grid-template-columns: 1fr; } }

/* ─── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 2px 12px rgba(108,99,255,0.30);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(108,99,255,0.45); }
.btn-success { background: var(--grad-success); color: #fff; }
.btn-success:hover:not(:disabled) { transform: translateY(-1px); }
.btn-danger  { background: var(--grad-danger);  color: #fff; }
.btn-danger:hover:not(:disabled)  { transform: translateY(-1px); }
.btn-warning { background: var(--grad-warning); color: #fff; }
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-card-hover); border-color: var(--border-active); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  padding: 7px 12px;
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }
.btn-icon { padding: 8px; aspect-ratio: 1; }

/* ─── Badges & Status ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-default  { background: rgba(139,143,174,0.15); color: var(--text-secondary); }
.badge-purple   { background: rgba(108,99,255,0.15);  color: var(--accent-purple); }
.badge-blue     { background: rgba(59,158,255,0.15);  color: var(--accent-blue); }
.badge-green    { background: rgba(16,185,129,0.15);  color: var(--accent-green); }
.badge-amber    { background: rgba(245,158,11,0.15);  color: var(--accent-amber); }
.badge-red      { background: rgba(239,68,68,0.15);   color: var(--accent-red); }
.badge-pink     { background: rgba(236,72,153,0.15);  color: var(--accent-pink); }
.badge-cyan     { background: rgba(6,182,212,0.15);   color: var(--accent-cyan); }

/* Workflow Status Badges */
.ws-draft           { background: rgba(139,143,174,0.15); color: var(--text-muted); }
.ws-pending_pm      { background: rgba(245,158,11,0.15);  color: var(--accent-amber); }
.ws-pm_approved     { background: rgba(16,185,129,0.15);  color: var(--accent-green); }
.ws-changes_requested { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.ws-modules_defined { background: rgba(59,158,255,0.15);  color: var(--accent-blue); }
.ws-teams_forming   { background: rgba(108,99,255,0.12);  color: var(--accent-purple); }
.ws-leads_pending   { background: rgba(245,158,11,0.15);  color: var(--accent-amber); }
.ws-leads_approved  { background: rgba(16,185,129,0.15);  color: var(--accent-green); }
.ws-ai_assigned     { background: rgba(6,182,212,0.15);   color: var(--accent-cyan); }
.ws-pm_reviewing    { background: rgba(129,140,248,0.15); color: var(--accent-indigo); }
.ws-active          { background: rgba(16,185,129,0.20);  color: var(--accent-green); }
.ws-published       { background: rgba(16,185,129,0.20);  color: var(--accent-green); }
.ws-completed       { background: rgba(139,143,174,0.20); color: var(--text-secondary); }

/* Priority Badges */
.priority-Critical { background: rgba(239,68,68,0.18);  color: var(--accent-red); }
.priority-High     { background: rgba(245,158,11,0.18); color: var(--accent-amber); }
.priority-Medium   { background: rgba(108,99,255,0.15); color: var(--accent-purple); }
.priority-Low      { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.priority-critical { background: rgba(239,68,68,0.18);  color: var(--accent-red); }
.priority-high     { background: rgba(245,158,11,0.18); color: var(--accent-amber); }
.priority-medium   { background: rgba(108,99,255,0.15); color: var(--accent-purple); }
.priority-low      { background: rgba(16,185,129,0.15); color: var(--accent-green); }

/* ─── Tables ───────────────────────────────────────────────────── */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.table-toolbar-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.table-toolbar-actions { display: flex; gap: 8px; align-items: center; }

table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-card-hover); }
tbody td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  vertical-align: middle;
}
.td-muted { color: var(--text-secondary); }

/* ─── Forms & Inputs ───────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  outline: none;
  transition: border-color var(--transition);
}
.form-control:focus { border-color: var(--border-active); box-shadow: 0 0 0 3px rgba(108,99,255,0.12); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; appearance: none; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-full { grid-column: 1 / -1; }
.form-hint { font-size: 11px; color: var(--text-muted); }
.form-section { 
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex; flex-direction: column; gap: 14px;
  background: var(--bg-surface);
}
.form-section-title { font-size: 13px; font-weight: 700; color: var(--text-primary); padding-bottom: 4px; border-bottom: 1px solid var(--border); }

/* ─── Workflow Stepper ─────────────────────────────────────────── */
.workflow-stepper {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  overflow-x: auto;
  gap: 0;
}
.workflow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  position: relative;
  min-width: 80px;
}
.workflow-step::after {
  content: '';
  position: absolute;
  top: 16px;
  left: calc(50% + 16px);
  right: calc(-50% + 16px);
  height: 2px;
  background: var(--border);
}
.workflow-step:last-child::after { display: none; }
.workflow-step.done::after      { background: var(--accent-green); }
.workflow-step.active::after    { background: var(--border); }

.step-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  color: var(--text-muted);
  z-index: 1;
  position: relative;
  transition: all var(--transition);
}
.workflow-step.done   .step-circle { background: var(--accent-green); border-color: var(--accent-green); color: #fff; }
.workflow-step.active .step-circle { background: var(--grad-primary); border-color: var(--accent-purple); color: #fff; box-shadow: 0 0 16px rgba(108,99,255,0.40); }

.step-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workflow-step.done   .step-label { color: var(--accent-green); }
.workflow-step.active .step-label { color: var(--accent-purple); font-weight: 700; }

/* ─── AI Decision Card ─────────────────────────────────────────── */
.ai-decision-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.ai-decision-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--grad-primary);
}
.ai-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ai-card-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-active);
}
.ai-card-emp-info { flex: 1; }
.ai-card-emp-name { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.ai-card-emp-role { font-size: 12px; color: var(--text-secondary); }
.ai-confidence-ring {
  position: relative;
  width: 56px; height: 56px;
  flex-shrink: 0;
}
.ai-confidence-ring svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.ai-confidence-ring circle { fill: none; stroke-width: 5; }
.ai-confidence-ring .ring-bg   { stroke: var(--border); }
.ai-confidence-ring .ring-fill { stroke: var(--accent-purple); stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.ai-confidence-ring .ring-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: var(--accent-purple);
}

.ai-metric-bars { display: flex; flex-direction: column; gap: 8px; }
.ai-metric-bar { display: flex; align-items: center; gap: 10px; }
.ai-metric-label { font-size: 11px; color: var(--text-secondary); width: 90px; flex-shrink: 0; }
.ai-metric-track {
  flex: 1;
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
}
.ai-metric-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--grad-primary);
  transition: width 1s ease;
}
.ai-metric-fill.green { background: var(--grad-success); }
.ai-metric-fill.amber { background: var(--grad-warning); }
.ai-metric-val { font-size: 11px; font-weight: 700; color: var(--text-primary); width: 32px; text-align: right; }

.ai-trace-list { display: flex; flex-direction: column; gap: 4px; }
.ai-trace-item {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 11px; color: var(--text-secondary); line-height: 1.5;
}
.ai-trace-item i { color: var(--accent-green); font-size: 10px; margin-top: 2px; flex-shrink: 0; }

.ai-alternative {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.ai-alt-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.ai-alt-name { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.ai-alt-reason { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.ai-card-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--border); }

/* ─── Lead Scoring Table ──────────────────────────────────────── */
.lead-score-table .score-row {
  display: grid;
  grid-template-columns: 40px 1fr auto auto auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: pointer;
}
.lead-score-table .score-row:hover { background: var(--bg-card-hover); }
.lead-score-table .score-row.selected { background: rgba(108,99,255,0.08); border-left: 3px solid var(--accent-purple); }
.score-rank { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.score-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.score-name { font-size: 13px; font-weight: 600; }
.score-dept { font-size: 11px; color: var(--text-muted); }
.score-bar {
  width: 80px;
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
}
.score-bar-fill { height: 100%; background: var(--grad-primary); border-radius: 3px; }
.score-pct { font-size: 11px; font-weight: 700; color: var(--text-primary); width: 36px; }

/* ─── Module & Team Cards ──────────────────────────────────────── */
.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all var(--transition);
}
.module-card:hover { border-color: var(--border-active); box-shadow: var(--shadow-sm); }
.module-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.module-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.module-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.module-meta-item { font-size: 11px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.module-skills { display: flex; flex-wrap: wrap; gap: 4px; }
.skill-chip {
  background: rgba(108,99,255,0.10);
  color: var(--accent-indigo);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}

.team-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all var(--transition);
}
.team-card-header { display: flex; align-items: center; justify-content: space-between; }
.team-name { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.team-module-tag {
  font-size: 11px; color: var(--accent-blue);
  background: rgba(59,158,255,0.10);
  padding: 2px 8px; border-radius: 4px;
}
.team-lead-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.team-lead-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.team-lead-info-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.team-lead-info-sub  { font-size: 11px; color: var(--text-muted); }
.team-members-row { display: flex; gap: -8px; }
.member-thumb {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  object-fit: cover;
  margin-left: -6px;
}
.member-thumb:first-child { margin-left: 0; }
.member-thumb-count {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--text-secondary);
  margin-left: -6px;
}

/* ─── Approval Panel ──────────────────────────────────────────── */
.approval-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all var(--transition);
}
.approval-card:hover { border-color: var(--accent-amber); box-shadow: 0 0 20px rgba(245,158,11,0.10); }
.approval-card.pending { border-left: 4px solid var(--accent-amber); }
.approval-card.approved { border-left: 4px solid var(--accent-green); }
.approval-card.rejected { border-left: 4px solid var(--accent-red); }

.approval-header { display: flex; justify-content: space-between; align-items: flex-start; }
.approval-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.approval-sub   { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.approval-emp-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.approval-emp-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.approval-emp-info-name { font-size: 14px; font-weight: 700; }
.approval-emp-info-sub  { font-size: 12px; color: var(--text-muted); }
.approval-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.approval-metric { text-align: center; background: var(--bg-surface); border-radius: var(--radius-sm); padding: 8px; }
.approval-metric-val { font-size: 18px; font-weight: 800; color: var(--text-primary); }
.approval-metric-lbl { font-size: 10px; color: var(--text-muted); }
.approval-reason { font-size: 12px; color: var(--text-secondary); padding: 10px; background: var(--bg-surface); border-radius: var(--radius-sm); line-height: 1.5; }
.approval-actions { display: flex; gap: 10px; align-items: flex-end; }
.approval-comment { flex: 1; }

/* ─── Kanban Board ─────────────────────────────────────────────── */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { min-width: 260px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.kanban-col-name { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.kanban-count { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.kanban-items { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: all var(--transition);
}
.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-active); }
.kanban-card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.kanban-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.kanban-card-assignee { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }
.kanban-card-assignee img { width: 20px; height: 20px; border-radius: 50%; }

/* ─── Progress Bars ────────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--grad-primary);
  transition: width 1s ease;
}
.progress-fill.green { background: var(--grad-success); }
.progress-fill.amber { background: var(--grad-warning); }
.progress-fill.red   { background: var(--grad-danger); }

/* ─── Notification Dropdown ────────────────────────────────────── */
.notif-panel {
  position: absolute;
  top: 56px; right: 0;
  width: 360px;
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.notif-panel.open { display: flex; }
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 700; color: var(--text-primary);
}
.notif-list { overflow-y: auto; max-height: 340px; }
.notif-item {
  display: flex; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: pointer;
}
.notif-item:hover { background: var(--bg-card); }
.notif-item.unread { background: rgba(108,99,255,0.05); }
.notif-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.notif-icon.success { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.notif-icon.info    { background: rgba(59,158,255,0.15);  color: var(--accent-blue); }
.notif-icon.warning { background: rgba(245,158,11,0.15);  color: var(--accent-amber); }
.notif-icon.error   { background: rgba(239,68,68,0.15);   color: var(--accent-red); }
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.notif-message { font-size: 11px; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time { font-size: 10px; color: var(--text-muted); margin-top: 3px; }

/* ─── Modals ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.70);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.modal-overlay.open {
  display: flex;
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(10px);
  transition: all var(--transition);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1100px; }
.modal-sm { max-width: 480px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 800; color: var(--text-primary); display: flex; align-items: center; gap: 10px; }
.modal-title i { color: var(--accent-purple); }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card); color: var(--text-secondary);
  cursor: pointer; border: 1px solid var(--border);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.modal-body { padding: 24px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; }

/* Multi-step modal */
.step-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin: -24px -24px 20px; padding: 0 24px; overflow-x: auto; }
.step-tab {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.step-tab.active { color: var(--accent-purple); border-bottom-color: var(--accent-purple); }
.step-tab.done   { color: var(--accent-green); }
.step-panel { display: none; }
.step-panel.active { display: flex; flex-direction: column; gap: 16px; }

/* ─── Employee Card Grid ───────────────────────────────────────── */
.emp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.emp-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  transition: all var(--transition);
}
.emp-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-active); }
.emp-avatar-lg {
  width: 64px; height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-active);
}
.emp-name { font-size: 14px; font-weight: 700; }
.emp-title { font-size: 12px; color: var(--text-muted); }
.emp-dept { font-size: 11px; color: var(--accent-blue); background: rgba(59,158,255,0.10); padding: 2px 8px; border-radius: 4px; }
.emp-stats { display: flex; gap: 16px; justify-content: center; width: 100%; }
.emp-stat { display: flex; flex-direction: column; align-items: center; }
.emp-stat-val { font-size: 16px; font-weight: 800; color: var(--text-primary); }
.emp-stat-lbl { font-size: 10px; color: var(--text-muted); }
.emp-skills { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }

/* ─── Workload Bar ─────────────────────────────────────────────── */
.workload-bar { display: flex; align-items: center; gap: 8px; width: 100%; }
.workload-track { flex: 1; height: 6px; background: var(--bg-surface); border-radius: 3px; overflow: hidden; }
.workload-fill { height: 100%; border-radius: 3px; transition: width 0.8s ease; }
.workload-low    { background: var(--accent-green); }
.workload-medium { background: var(--accent-amber); }
.workload-high   { background: var(--accent-red); }
.workload-pct { font-size: 11px; font-weight: 700; width: 32px; text-align: right; }

/* ─── Charts Container ─────────────────────────────────────────── */
.chart-container { position: relative; height: 200px; }
.chart-container canvas { width: 100% !important; }

/* ─── Empty State ──────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
}
.empty-state i { font-size: 36px; color: var(--text-muted); opacity: 0.5; }
.empty-state h3 { font-size: 15px; font-weight: 700; color: var(--text-secondary); }
.empty-state p  { font-size: 13px; color: var(--text-muted); }

/* ─── Toast Alerts ─────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column-reverse; gap: 10px;
  z-index: 1000;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  min-width: 280px;
  max-width: 360px;
  pointer-events: all;
  animation: toastIn 0.3s ease;
  color: var(--text-primary);
}
.toast i { font-size: 16px; flex-shrink: 0; }
.toast.success { border-left: 4px solid var(--accent-green); }
.toast.success i { color: var(--accent-green); }
.toast.error   { border-left: 4px solid var(--accent-red); }
.toast.error   i { color: var(--accent-red); }
.toast.info    { border-left: 4px solid var(--accent-blue); }
.toast.info    i { color: var(--accent-blue); }
.toast.warning { border-left: 4px solid var(--accent-amber); }
.toast.warning i { color: var(--accent-amber); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── Loading Spinner ──────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-lg { width: 40px; height: 40px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: absolute; inset: 0;
  background: rgba(13, 15, 26, 0.7);
  display: flex; align-items: center; justify-content: center;
  border-radius: inherit;
  z-index: 10;
}

/* ─── Skeleton Loader ──────────────────────────────────────────── */
.skeleton { background: var(--bg-card); border-radius: var(--radius-sm); animation: shimmer 1.5s infinite; }
@keyframes shimmer {
  0%   { background-color: var(--bg-card); }
  50%  { background-color: var(--bg-card-hover); }
  100% { background-color: var(--bg-card); }
}
.skeleton-text { height: 12px; border-radius: 3px; }
.skeleton-title { height: 20px; width: 60%; border-radius: 4px; }

/* ─── Divider ──────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 8px 0; }
.divider-label { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 11px; font-weight: 600; }
.divider-label::before, .divider-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ─── Info List ────────────────────────────────────────────────── */
.info-list { display: flex; flex-direction: column; gap: 8px; }
.info-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; font-size: 13px; }
.info-key { color: var(--text-secondary); flex-shrink: 0; font-weight: 500; }
.info-val { color: var(--text-primary); text-align: right; font-weight: 600; }

/* ─── Section Row (icon + heading) ────────────────────────────── */
.section-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.section-row h2 { font-size: 15px; font-weight: 700; }
.section-row i { color: var(--accent-purple); font-size: 14px; }
.section-divider { flex: 1; height: 1px; background: var(--border); }

/* ─── Tooltip ──────────────────────────────────────────────────── */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
}

/* ─── Login Page ───────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 30%, rgba(108,99,255,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 70%, rgba(16,185,129,0.10) 0%, transparent 60%),
              var(--bg-base);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.auth-title { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.auth-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; }

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — Full Laptop & Screen Coverage
   Breakpoints: 1920 · 1600 · 1440 · 1280 · 1366 · 1200 · 1024 · 900 · 768 · 480
   ══════════════════════════════════════════════════════════════════ */

/* ─── Large Widescreen (1920px+) ───────────────────────────────── */
@media (min-width: 1920px) {
  :root { --sidebar-w: 280px; }
  html { font-size: 15px; }
  .content-area { padding: 32px; }
  .kpi-grid { grid-template-columns: repeat(6, 1fr); }
  .modal-xl { max-width: 1300px; }
}

/* ─── Standard Wide (1600px) ───────────────────────────────────── */
@media (max-width: 1600px) {
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

/* ─── Common Laptop (1440px) ───────────────────────────────────── */
@media (max-width: 1440px) {
  :root { --sidebar-w: 240px; }
  .main-aside { grid-template-columns: 1fr 300px; }
  .modal-xl { max-width: 1000px; }
}

/* ─── Standard Laptop (1280px) ─────────────────────────────────── */
@media (max-width: 1280px) {
  :root { --sidebar-w: 230px; }
  html { font-size: 13.5px; }
  .main-aside { grid-template-columns: 1fr 280px; }
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .kpi-value { font-size: 28px; }
  .modal-xl { max-width: 940px; }
  .content-area { padding: 20px; }
}

/* ─── Budget Laptop (1366px common) ────────────────────────────── */
@media (max-width: 1366px) and (min-width: 1025px) {
  .topbar { padding: 0 18px; }
  .search-box { min-width: 180px; }
}

/* ─── Small Laptop / Large Tablet (1024px) ─────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  html { font-size: 13px; }
  .content-area { padding: 18px; }
  .main-aside { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr 1fr; gap: 14px; }
  .three-col { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .kpi-card { padding: 16px; }
  .kpi-value { font-size: 26px; }
  .modal-xl { max-width: 90vw; }
  .modal-lg { max-width: 85vw; }
  .workflow-stepper { padding: 16px 14px; gap: 0; }
  .step-label { font-size: 9px; max-width: 70px; }
  .page-header-left h1 { font-size: 20px; }
  .topbar { padding: 0 18px; gap: 12px; }
  .search-box { min-width: 160px; }
  .table-toolbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .table-toolbar-actions { width: 100%; }
  .emp-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

/* ─── Collapsed Sidebar (900px) ────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 72px; }
  .sidebar { width: 72px; }
  .sidebar .nav-item span,
  .sidebar .nav-section-label,
  .sidebar .logo-text,
  .sidebar .user-info,
  .sidebar .nav-badge { display: none; }
  .sidebar .logo { justify-content: center; }
  .sidebar .logo-icon { margin: 0 auto; }
  .sidebar .nav-item { justify-content: center; padding: 10px; }
  .sidebar .nav-item i { width: auto; font-size: 16px; }
  .sidebar .nav-item.active { border-left: none; border-bottom: none; }
  .sidebar-footer { padding: 10px; }
  .sidebar-footer .user-card { justify-content: center; padding: 8px; background: none; }
  .sidebar-footer .user-avatar { margin: 0; }
  .content-area { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .main-aside { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr; }
  .modal-overlay { padding: 16px; }
  .modal { max-height: 92vh; }
  .modal-xl, .modal-lg { max-width: 100%; }
  .topbar-title { font-size: 15px; }
  .search-box { display: none; }
  .page-header { flex-direction: column; gap: 10px; }
  .page-header-actions { width: 100%; }
  .kanban-board { gap: 10px; }
  .kanban-col { min-width: 220px; }
  .emp-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .approval-metrics { grid-template-columns: repeat(2, 1fr); }
  .lead-score-table .score-row {
    grid-template-columns: 30px 1fr auto auto auto;
  }
}

/* ─── Tablet (768px) ───────────────────────────────────────────── */
@media (max-width: 768px) {
  html { font-size: 12.5px; }
  .content-area { padding: 12px; }
  .card { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-card { padding: 14px; gap: 8px; }
  .kpi-value { font-size: 22px; }
  .kpi-icon { width: 34px; height: 34px; font-size: 14px; }
  .two-col { grid-template-columns: 1fr; gap: 12px; }
  .three-col { grid-template-columns: 1fr; gap: 12px; }
  .main-aside { grid-template-columns: 1fr; }
  .workflow-stepper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 14px;
    overflow: visible;
  }
  .workflow-step::after { display: none; }
  .workflow-step { min-width: unset; }
  .page-header-left h1 { font-size: 18px; }
  .topbar { padding: 0 14px; height: 56px; }
  .topbar-title { font-size: 14px; }
  table { font-size: 12px; }
  thead th, tbody td { padding: 10px 12px; }
  .modal-body { padding: 16px; gap: 12px; }
  .modal-header, .modal-footer { padding: 14px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .emp-grid { grid-template-columns: repeat(2, 1fr); }
  .kanban-col { min-width: 200px; }
  .auth-card { padding: 28px 20px; }
  .toast { min-width: 240px; max-width: 300px; font-size: 12px; }
  .toast-container { bottom: 12px; right: 12px; }
}

/* ─── Mobile (480px) ───────────────────────────────────────────── */
@media (max-width: 480px) {
  html { font-size: 12px; }
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
    z-index: 200;
  }
  .sidebar-header { display: none; }
  .sidebar-nav {
    flex-direction: row;
    padding: 8px;
    gap: 4px;
    overflow-x: auto;
    white-space: nowrap;
  }
  .nav-section { display: contents; margin: 0; }
  .nav-section-label { display: none; }
  .sidebar-footer { display: none; }
  .nav-item { padding: 8px 12px; border-radius: var(--radius-sm); }
  .nav-item span { display: inline; font-size: 11px; }
  .nav-item i { font-size: 13px; }
  .main-content { height: calc(100vh - 56px); }
  .content-area { padding: 10px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-card { padding: 12px; }
  .kpi-value { font-size: 20px; }
  .card { padding: 12px; }
  .workflow-stepper { grid-template-columns: repeat(4, 1fr); padding: 10px 8px; }
  .step-label { display: none; }
  .modal-overlay { padding: 8px; align-items: flex-end; }
  .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 95vh; }
  .modal-xl, .modal-lg, .modal-sm { max-width: 100%; }
  .emp-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .emp-card { padding: 12px; }
  .emp-avatar-lg { width: 48px; height: 48px; }
  .kanban-board { flex-direction: column; overflow-x: visible; }
  .kanban-col { min-width: 100%; }
  .btn { padding: 8px 14px; font-size: 12px; }
  .btn-lg { padding: 10px 18px; font-size: 13px; }
  .table-wrap { overflow-x: auto; }
  table { min-width: 500px; }
  .auth-card { padding: 24px 16px; border-radius: var(--radius-lg); }
  .auth-title { font-size: 20px; }
}

/* ─── Fix table overflow on all sizes ──────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ─── Prevent horizontal overflow app-wide ─────────────────────── */
.content-area, .view, .card, .modal-body { overflow-x: hidden; }
.kanban-board { overflow-x: auto; }

/* ─── Prevent search bar crush on mid-screens ──────────────────── */
@media (max-width: 1100px) and (min-width: 901px) {
  .search-box { min-width: 140px; }
  .topbar { padding: 0 16px; gap: 10px; }
}

/* ─── Workflow stepper overflow on 1024px ─────────────────────── */
@media (max-width: 1100px) {
  .workflow-stepper { overflow-x: auto; padding: 16px 12px; }
  .workflow-step { min-width: 70px; }
  .step-label { font-size: 9px; max-width: 65px; }
  .step-circle { width: 28px; height: 28px; font-size: 11px; }
}

/* ─── Form grid collapses to 1 col on narrow modals ────────────── */
@media (max-width: 640px) {
  .modal .form-grid { grid-template-columns: 1fr !important; }
  .modal .form-full { grid-column: 1 / -1; }
}

/* ─── Notification panel on small screens ─────────────────────── */
@media (max-width: 520px) {
  .notif-panel { width: calc(100vw - 24px); right: -16px; }
}

/* ─── Utility ──────────────────────────────────────────────────── */
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-700 { font-weight: 700; }
.fw-600 { font-weight: 600; }
.fs-12  { font-size: 12px; }
.fs-13  { font-size: 13px; }
.color-muted   { color: var(--text-muted); }
.color-success { color: var(--accent-green); }
.color-danger  { color: var(--accent-red); }
.color-warning { color: var(--accent-amber); }
.color-purple  { color: var(--accent-purple); }
.w-full { width: 100%; }
.flex-1 { flex: 1; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rounded-full { border-radius: 50%; }
.hidden { display: none !important; }
.visible { display: block !important; }
.cursor-pointer { cursor: pointer; }
.relative { position: relative; }

