/* ============================================================
   MedFlex TaskCRM - Design System & Theme
   Version 2.0
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ── CSS Variables ── */
:root {
  /* Brand */
  --primary:       #1a56a0;
  --primary-dark:  #14408a;
  --primary-light: #ebf4ff;
  --primary-50:    #f0f7ff;

  /* Neutrals */
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semantic */
  --success:       #16a34a;
  --success-light: #f0fdf4;
  --warning:       #d97706;
  --warning-light: #fffbeb;
  --danger:        #dc2626;
  --danger-light:  #fef2f2;
  --info:          #0284c7;
  --info-light:    #f0f9ff;
  --purple:        #7c3aed;
  --purple-light:  #f5f3ff;
  --teal:          #0694a2;
  --teal-light:    #f0fdfd;

  /* Layout */
  --sidebar-width: 248px;
  --topbar-height: 62px;
  --radius-sm:   6px;
  --radius:      10px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-md: 0 10px 25px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.06);
  --shadow-lg: 0 20px 40px rgba(0,0,0,0.12);

  /* Typography */
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', 'Fira Code', monospace;

  /* Z-index */
  --z-sidebar: 100;
  --z-topbar:  50;
  --z-modal:   200;
  --z-tooltip: 300;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

img { max-width: 100%; }

button, input, select, textarea { font-family: var(--font-sans); }

/* ══════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  background: #1a2e4a;
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,0.06);
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}
.sidebar-header {
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.15);
}
.sidebar-logo-mark {
  width: 40px; height: 40px;
  background: white;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.sidebar-logo-mark svg { fill: white; }
.sidebar-brand { font-size: 17px; font-weight: 700; color: white; letter-spacing: -0.02em; }
.sidebar-brand span { color: #e07b2a; }
.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
.nav-group { margin-bottom: 4px; }
.nav-group-label {
  padding: 10px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.25);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 1px;
  text-decoration: none;
}
.nav-link svg, .nav-link i { flex-shrink: 0; opacity: 0.7; width: 18px; height: 18px; }
.nav-link:hover { background: rgba(255,255,255,0.1); color: white; text-decoration: none; transform: translateX(2px); }
.nav-link:hover svg, .nav-link:hover i { opacity: 1; }
.nav-link.active { background: linear-gradient(135deg, rgba(26,86,160,0.5), rgba(224,123,42,0.25)); color: white; border-left: 3px solid #e07b2a; }
.nav-link.active svg, .nav-link.active i { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; }

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 12px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,0.38); }

.sidebar-logout {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.35);
  padding: 5px; border-radius: 6px;
  transition: color 0.15s;
  display: flex;
}
.sidebar-logout:hover { color: rgba(255,255,255,0.8); }

/* ══════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════ */
.topbar {
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
}

.topbar-hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--gray-600); padding: 6px;
  border-radius: 8px;
}
.topbar-hamburger:hover { background: var(--gray-100); }

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  flex: 1;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 9px;
  padding: 7px 12px;
  width: 230px;
  transition: border 0.2s;
}
.search-box:focus-within { border-color: var(--primary); background: white; }
.search-box svg { color: var(--gray-400); flex-shrink: 0; }
.search-box input {
  border: none; background: none; outline: none;
  font-size: 13px; color: var(--gray-800);
  width: 100%;
}
.search-box input::placeholder { color: var(--gray-400); }

.topbar-icon-btn {
  width: 36px; height: 36px;
  border-radius: 9px;
  border: 1px solid var(--gray-200);
  background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-600);
  transition: all 0.15s;
  position: relative;
}
.topbar-icon-btn:hover { background: var(--gray-100); }
.notif-badge {
  position: absolute; top: 5px; right: 5px;
  width: 8px; height: 8px;
  background: var(--danger); border-radius: 50%;
  border: 1.5px solid white;
}

/* ══════════════════════════════════════════
   MAIN LAYOUT
══════════════════════════════════════════ */
.app-wrapper { display: flex; min-height: 100vh; }

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-body { flex: 1; padding: 24px; }

/* ══════════════════════════════════════════
   CARDS
══════════════════════════════════════════ */
.card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 700; color: var(--gray-900); }
.card-subtitle { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--gray-200); background: var(--gray-50); border-radius: 0 0 var(--radius-md) var(--radius-md); }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px,1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}

.stat-icon {
  width: 38px; height: 38px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.amber  { background: var(--warning-light); color: var(--warning); }
.stat-icon.red    { background: var(--danger-light);  color: var(--danger);  }
.stat-icon.purple { background: var(--purple-light);  color: var(--purple);  }
.stat-icon.teal   { background: var(--teal-light);    color: var(--teal);    }

.stat-change {
  font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: var(--radius-full);
}
.stat-change.up   { background: var(--success-light); color: var(--success); }
.stat-change.down { background: var(--danger-light);  color: var(--danger);  }

.stat-value { font-size: 28px; font-weight: 700; color: var(--gray-900); line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 3px; }

/* ══════════════════════════════════════════
   BADGES & TAGS
══════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: var(--radius-full);
}
.badge-blue   { background: var(--primary-light); color: var(--primary); }
.badge-green  { background: var(--success-light); color: var(--success); }
.badge-amber  { background: var(--warning-light); color: var(--warning); }
.badge-red    { background: var(--danger-light);  color: var(--danger);  }
.badge-purple { background: var(--purple-light);  color: var(--purple);  }
.badge-teal   { background: var(--teal-light);    color: var(--teal);    }
.badge-gray   { background: var(--gray-100);      color: var(--gray-600);}

/* ── Priority ── */
.priority-dot {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
}
.priority-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
}
.priority-low    { color: var(--success); }
.priority-low::before    { background: var(--success); }
.priority-medium { color: var(--warning); }
.priority-medium::before { background: var(--warning); }
.priority-high   { color: var(--danger);  }
.priority-high::before   { background: var(--danger);  }
.priority-critical { color: #9b1c1c; }
.priority-critical::before { background: #9b1c1c; }

/* ── Status ── */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: var(--radius-full);
}
.status-todo        { background:#f1f5f9; color:#475569; }
.status-in_progress { background:var(--primary-light); color:var(--primary); }
.status-in_review   { background:var(--warning-light); color:var(--warning); }
.status-done        { background:var(--success-light); color:var(--success); }
.status-cancelled   { background:var(--danger-light);  color:var(--danger);  }
.status-planning    { background:var(--gray-100);      color:var(--gray-600);}
.status-active      { background:var(--primary-light); color:var(--primary); }
.status-on_hold     { background:var(--warning-light); color:var(--warning); }
.status-completed   { background:var(--success-light); color:var(--success); }

/* ══════════════════════════════════════════
   PROGRESS BAR
══════════════════════════════════════════ */
.progress {
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-sm { height: 5px; }
.progress-md { height: 8px; }
.progress-lg { height: 12px; }
.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 0.5s ease;
}
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger);  }

/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all 0.15s;
  font-family: var(--font-sans);
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }

.btn-sm  { padding: 5px 11px; font-size: 12px; }
.btn-lg  { padding: 8px 16px; font-size: 13px; }
.btn-full { width: auto; justify-content: center; }

.btn-primary  { background: var(--primary);   color: white; }
.btn-primary:hover  { background: #14408a; box-shadow: 0 2px 8px rgba(26,86,160,0.25); }

.btn-success  { background: var(--success);   color: white; }
.btn-success:hover  { background: #15803d; }

.btn-danger   { background: var(--danger);    color: white; }
.btn-danger:hover   { background: #b91c1c; }

.btn-outline  { background: none; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover  { background: var(--gray-100); }

.btn-ghost    { background: none; border: none; color: var(--gray-600); }
.btn-ghost:hover    { background: var(--gray-100); color: var(--gray-800); }

.btn-light    { background: var(--primary-light); color: var(--primary); border: none; }
.btn-light:hover    { background: #d4e8fc; }

/* ══════════════════════════════════════════
   FORMS
══════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row.col-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font-sans);
  background: white; color: var(--gray-800);
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,102,204,0.12);
}
.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { resize: vertical; min-height: 88px; }

.form-hint { font-size: 11px; color: var(--gray-500); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--danger); margin-top: 4px; }

.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; cursor: pointer; accent-color: var(--primary);
}

/* ── Color Picker Row ── */
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 26px; height: 26px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  transition: transform 0.15s, border 0.15s;
}
.color-swatch:hover  { transform: scale(1.15); }
.color-swatch.active { border-color: var(--gray-800); transform: scale(1.15); }

/* ══════════════════════════════════════════
   TABLES
══════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px; color: var(--gray-700);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }

.user-cell { display: flex; align-items: center; gap: 8px; }
.user-cell-info { line-height: 1.3; }
.user-cell-name { font-weight: 600; font-size: 13px; color: var(--gray-800); }
.user-cell-sub  { font-size: 11px; color: var(--gray-500); }

/* ══════════════════════════════════════════
   MODALS
══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: var(--z-modal);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px);
  transition: transform 0.2s;
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-sm  { max-width: 420px; }
.modal-lg  { max-width: 720px; }
.modal-xl  { max-width: 900px; }

.modal-header {
  padding: 20px 24px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--gray-900); }

.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--gray-400); padding: 5px;
  border-radius: 6px; transition: all 0.15s;
  display: flex;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex; gap: 10px; justify-content: flex-end;
  background: var(--gray-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ══════════════════════════════════════════
   TABS
══════════════════════════════════════════ */
.tab-nav {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 20px;
}
.tab-nav-item {
  padding: 10px 18px;
  font-size: 13px; font-weight: 600;
  color: var(--gray-500); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
  display: flex; align-items: center; gap: 6px;
  text-decoration: none;
}
.tab-nav-item:hover { color: var(--gray-800); text-decoration: none; }
.tab-nav-item.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ══════════════════════════════════════════
   FILTERS BAR
══════════════════════════════════════════ */
.filters-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.filter-select {
  padding: 7px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 12px; font-family: var(--font-sans);
  color: var(--gray-700); background: white;
  outline: none; cursor: pointer;
}
.filter-select:focus { border-color: var(--primary); }

/* ══════════════════════════════════════════
   KANBAN BOARD
══════════════════════════════════════════ */
.kanban-board {
  display: flex; gap: 16px;
  overflow-x: auto; padding-bottom: 12px;
  min-height: calc(100vh - 200px);
}
.kanban-board::-webkit-scrollbar { height: 5px; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

.kanban-col { min-width: 268px; flex-shrink: 0; }

.kanban-col-head {
  padding: 11px 14px;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  display: flex; align-items: center; justify-content: space-between;
}
.kanban-col-head.col-todo        { background: var(--gray-100); color: var(--gray-600); }
.kanban-col-head.col-in_progress { background: var(--primary-light); color: var(--primary); }
.kanban-col-head.col-in_review   { background: var(--warning-light); color: var(--warning); }
.kanban-col-head.col-done        { background: var(--success-light); color: var(--success); }

.kanban-col-count {
  background: rgba(0,0,0,0.08);
  padding: 1px 7px; border-radius: var(--radius-full);
  font-size: 11px;
}

.kanban-col-body {
  border: 1px solid var(--gray-200);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--gray-50);
  padding: 10px;
  min-height: 200px;
  display: flex; flex-direction: column; gap: 8px;
}

.kanban-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 9px;
  padding: 12px 14px;
  cursor: grab;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.15s, transform 0.15s;
}
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kanban-card:active { cursor: grabbing; }

.kanban-card-title {
  font-size: 13px; font-weight: 600;
  color: var(--gray-800); margin-bottom: 8px;
  line-height: 1.4;
}
.kanban-card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.kanban-card-foot { display: flex; align-items: center; justify-content: space-between; }

/* ══════════════════════════════════════════
   CALENDAR
══════════════════════════════════════════ */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--gray-200);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-head {
  background: var(--gray-50);
  padding: 8px 4px;
  text-align: center;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase;
  color: var(--gray-500);
}
.cal-cell {
  background: white;
  padding: 8px;
  min-height: 100px;
  cursor: pointer;
  transition: background 0.1s;
}
.cal-cell:hover { background: var(--primary-50); }
.cal-cell.other-month { background: var(--gray-50); }
.cal-cell.today { background: var(--primary-50); }
.cal-day-num {
  font-size: 12px; font-weight: 600;
  color: var(--gray-500); margin-bottom: 4px;
}
.cal-cell.today .cal-day-num { color: var(--primary); font-weight: 800; }
.cal-event {
  font-size: 10px; font-weight: 600;
  border-radius: 3px; padding: 1px 5px;
  margin-bottom: 2px;
  color: white; background: var(--primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-event.green  { background: var(--success); }
.cal-event.amber  { background: var(--warning); }
.cal-event.red    { background: var(--danger);  }
.cal-event.purple { background: var(--purple);  }

/* ══════════════════════════════════════════
   GANTT
══════════════════════════════════════════ */
.gantt-wrap { overflow-x: auto; }
.gantt-row { display: grid; grid-template-columns: 220px 1fr; border-bottom: 1px solid var(--gray-100); }
.gantt-row:last-child { border-bottom: none; }
.gantt-label {
  padding: 10px 14px;
  font-size: 12px; font-weight: 600;
  color: var(--gray-700);
  border-right: 1px solid var(--gray-200);
  display: flex; align-items: center; gap: 8px;
}
.gantt-timeline { padding: 10px 8px; position: relative; min-height: 40px; }
.gantt-bar {
  height: 22px; border-radius: 5px;
  background: var(--primary);
  display: flex; align-items: center; padding: 0 10px;
  font-size: 11px; font-weight: 600; color: white;
  white-space: nowrap; overflow: hidden;
  position: relative;
}
.gantt-bar.amber  { background: var(--warning); }
.gantt-bar.green  { background: var(--success); }
.gantt-bar.purple { background: var(--purple);  }
.gantt-bar.teal   { background: var(--teal);    }

/* ══════════════════════════════════════════
   TIMELINE / ACTIVITY LOG
══════════════════════════════════════════ */
.activity-timeline { position: relative; padding-left: 26px; }
.activity-timeline::before {
  content: '';
  position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: var(--gray-200);
}
.tl-item { position: relative; margin-bottom: 16px; }
.tl-dot {
  position: absolute; left: -22px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%; background: var(--gray-300);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--gray-300);
}
.tl-dot.blue   { background: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.tl-dot.green  { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.tl-dot.amber  { background: var(--warning); box-shadow: 0 0 0 2px var(--warning); }
.tl-dot.red    { background: var(--danger);  box-shadow: 0 0 0 2px var(--danger);  }
.tl-time  { font-size: 11px; color: var(--gray-400); margin-bottom: 2px; }
.tl-text  { font-size: 13px; color: var(--gray-700); line-height: 1.5; }
.tl-bold  { font-weight: 600; color: var(--gray-900); }

/* ══════════════════════════════════════════
   CHAT
══════════════════════════════════════════ */
.chat-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - var(--topbar-height) - 48px);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: white;
  box-shadow: var(--shadow-sm);
}

.chat-sidebar { border-right: 1px solid var(--gray-200); overflow-y: auto; }
.chat-sidebar-head { padding: 14px 16px; border-bottom: 1px solid var(--gray-200); font-size: 14px; font-weight: 700; }
.chat-channel-item {
  padding: 12px 16px; cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.1s;
}
.chat-channel-item:hover, .chat-channel-item.active { background: var(--primary-50); }
.chat-channel-name { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.chat-channel-preview { font-size: 12px; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-main { display: flex; flex-direction: column; }
.chat-main-head {
  padding: 12px 20px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; gap: 10px;
}
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 2px; }

.msg { display: flex; gap: 10px; align-items: flex-end; }
.msg.mine { flex-direction: row-reverse; }
.msg-bubble {
  max-width: 65%; padding: 10px 14px;
  border-radius: 14px; font-size: 13px; line-height: 1.5;
}
.msg-bubble.other { background: var(--gray-100); border-bottom-left-radius: 4px; color: var(--gray-800); }
.msg-bubble.mine  { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.msg-time { font-size: 10px; color: var(--gray-400); }

.chat-input-area { padding: 14px 20px; border-top: 1px solid var(--gray-200); display: flex; gap: 10px; }
.chat-input {
  flex: 1; padding: 10px 16px;
  border: 1px solid var(--gray-200);
  border-radius: 20px; outline: none;
  font-size: 13px; font-family: var(--font-sans);
  transition: border 0.2s;
}
.chat-input:focus { border-color: var(--primary); }
.chat-send {
  background: var(--primary); color: white;
  border: none; border-radius: 20px; padding: 10px 18px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: var(--font-sans); transition: background 0.15s;
}
.chat-send:hover { background: var(--primary-dark); }

/* ══════════════════════════════════════════
   TIME TRACKER
══════════════════════════════════════════ */
.timer-display {
  font-family: var(--font-mono);
  font-size: 42px; font-weight: 500;
  color: var(--gray-900);
  letter-spacing: 0.04em;
}
.timer-active .timer-display { color: var(--primary); }

/* ══════════════════════════════════════════
   CHECKLIST
══════════════════════════════════════════ */
.checklist-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--gray-100);
}
.checklist-item:last-child { border-bottom: none; }
.check-box {
  width: 18px; height: 18px;
  border: 2px solid var(--gray-300);
  border-radius: 4px;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.check-box.checked { background: var(--success); border-color: var(--success); }
.check-box.checked::after {
  content: '';
  width: 10px; height: 6px;
  border: 2px solid white;
  border-top: none; border-right: none;
  transform: rotate(-45deg) translateY(-1px);
}
.check-label { font-size: 13px; color: var(--gray-700); flex: 1; }
.check-label.done { text-decoration: line-through; color: var(--gray-400); }

/* ══════════════════════════════════════════
   REPORT CHARTS
══════════════════════════════════════════ */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding: 0 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-fill {
  width: 100%; border-radius: 5px 5px 0 0;
  background: var(--primary); min-height: 4px;
  transition: height 0.5s ease;
}
.bar-col:nth-child(2) .bar-fill { background: var(--teal); }
.bar-col:nth-child(3) .bar-fill { background: var(--success); }
.bar-col:nth-child(4) .bar-fill { background: var(--warning); }
.bar-col:nth-child(5) .bar-fill { background: var(--purple); }
.bar-col:nth-child(6) .bar-fill { background: var(--danger); }
.bar-label { font-size: 10px; color: var(--gray-500); text-align: center; }
.bar-value { font-size: 11px; font-weight: 700; color: var(--gray-700); }

.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ══════════════════════════════════════════
   WORKLOAD BARS
══════════════════════════════════════════ */
.workload-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--gray-100);
}
.workload-row:last-child { border-bottom: none; }
.workload-user { width: 140px; }
.workload-bar-wrap { flex: 1; }
.workload-count { width: 40px; text-align: right; font-size: 12px; font-weight: 600; color: var(--gray-600); }

/* ══════════════════════════════════════════
   NOTIFICATION PANEL
══════════════════════════════════════════ */
.notif-item {
  display: flex; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--gray-100);
  cursor: pointer; transition: background 0.1s;
}
.notif-item:hover { background: var(--gray-50); }
.notif-item.unread { background: var(--primary-50); }
.notif-icon {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px;
}
.notif-icon.task     { background: var(--primary-light); color: var(--primary); }
.notif-icon.comment  { background: var(--success-light); color: var(--success); }
.notif-icon.deadline { background: var(--danger-light);  color: var(--danger);  }
.notif-icon.project  { background: var(--purple-light);  color: var(--purple);  }
.notif-title  { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.notif-body   { font-size: 12px; color: var(--gray-600); }
.notif-time   { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* ══════════════════════════════════════════
   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 {}
.page-header-title { font-size: 22px; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.page-header-sub   { font-size: 13px; color: var(--gray-500); margin-top: 3px; }
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ══════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 48px 24px;
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--gray-700); }
.empty-sub   { font-size: 13px; color: var(--gray-500); margin-top: 6px; }

/* ══════════════════════════════════════════
   ALERTS
══════════════════════════════════════════ */
.alert {
  padding: 12px 16px; border-radius: 8px;
  font-size: 13px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #bbf7d0; }
.alert-danger  { background: var(--danger-light);  color: var(--danger);  border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fde68a; }
.alert-info    { background: var(--info-light);    color: var(--info);    border: 1px solid #bae6fd; }

/* ══════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════ */
.flex           { display: flex; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.justify-between{ justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-col       { flex-direction: column; }
.flex-1         { flex: 1; }
.gap-1          { gap: 4px; }
.gap-2          { gap: 8px; }
.gap-3          { gap: 12px; }
.gap-4          { gap: 16px; }
.gap-5          { gap: 20px; }
.gap-6          { gap: 24px; }
.flex-wrap      { flex-wrap: wrap; }
.grid-2         { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3         { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4         { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.mb-1 { margin-bottom:4px; }
.mb-2 { margin-bottom:8px; }
.mb-3 { margin-bottom:12px; }
.mb-4 { margin-bottom:16px; }
.mb-5 { margin-bottom:20px; }
.mb-6 { margin-bottom:24px; }
.mt-2 { margin-top:8px; }
.mt-4 { margin-top:16px; }
.text-xs   { font-size:11px; }
.text-sm   { font-size:12px; }
.text-base { font-size:14px; }
.text-lg   { font-size:16px; }
.text-xl   { font-size:18px; }
.font-medium { font-weight:500; }
.font-semibold { font-weight:600; }
.font-bold   { font-weight:700; }
.text-muted  { color:var(--gray-500); }
.text-primary { color:var(--primary); }
.text-success { color:var(--success); }
.text-danger  { color:var(--danger); }
.text-warning { color:var(--warning); }
.truncate    { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.w-full      { width:100%; }
.text-center { text-align:center; }
.text-right  { text-align:right; }
.divider     { height:1px; background:var(--gray-200); margin:16px 0; }
.hidden      { display:none !important; }

/* ══════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #f0f6ff 0%, #e8f0fb 50%, #fff7ed 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-bg-circle {
  position: absolute; border-radius: 50%;
  background: rgba(26,86,160,0.07);
  pointer-events: none;
}
.login-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 40px 40px 32px;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(26,86,160,0.12), 0 4px 20px rgba(0,0,0,0.06);
  position: relative; z-index: 1;
  border: 1px solid rgba(26,86,160,0.09);
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-logo-icon {
  width: 42px; height: 42px;
  background: var(--primary); border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
}
.login-logo-icon svg { fill: white; }
.login-brand { font-size: 23px; font-weight: 800; color: var(--gray-900); letter-spacing:-0.02em; }
.login-brand span { color: var(--primary); }
.login-tagline { font-size: 13px; color: var(--gray-500); margin-bottom: 28px; }
.login-tabs {
  display: flex; gap: 0;
  border: 1px solid var(--gray-200); border-radius: 9px;
  padding: 3px; margin-bottom: 24px; background: var(--gray-50);
}
.login-tab {
  flex: 1; padding: 7px; text-align: center;
  border-radius: 7px; cursor: pointer;
  font-size: 13px; font-weight: 600;
  color: var(--gray-500); transition: all 0.2s;
}
.login-tab.active { background: white; color: var(--primary); box-shadow: var(--shadow-xs); }
.login-divider { text-align: center; font-size: 12px; color: var(--gray-400); margin: 12px 0; }
.login-demo { margin-top: 20px; padding: 12px 14px; background: var(--gray-50); border-radius: 8px; font-size: 12px; color: var(--gray-600); line-height: 1.7; }
.login-demo b { color: var(--gray-800); }

/* ══════════════════════════════════════════
   SIDEBAR OVERLAY (mobile)
══════════════════════════════════════════ */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: calc(var(--z-sidebar) - 1);
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 1024px) {
  :root { --sidebar-width: 220px; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .grid-4 { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
  .sidebar-overlay.show { opacity: 1; pointer-events: all; }
  .main-content { margin-left: 0; }
  .topbar-hamburger { display: flex; }
  .search-box { display: none; }
  .page-body { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2,1fr); gap: 12px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-row.col-3 { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
  .modal { max-width: 100%; margin: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .page-header { flex-direction: column; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 480px) {
  .login-card { padding: 28px 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value { font-size: 22px; }
}

/* ══════════════════════════════════════════
   SCROLLBAR (global)
══════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ══════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════ */
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
@keyframes slideIn { from { transform:translateX(-10px); opacity:0; } to { transform:none; opacity:1; } }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
.animate-fade { animation: fadeIn 0.25s ease both; }
.animate-slide { animation: slideIn 0.2s ease both; }
.animate-pulse { animation: pulse 1.5s ease infinite; }

/* ── Global Button Fixes ── */
button[type="submit"].btn,
button[type="button"].btn { flex: 0 0 auto !important; width: auto !important; min-width: unset !important; }
.btn { max-width: fit-content; }
.modal-footer .btn, .card-footer .btn { flex: 0 0 auto !important; width: auto !important; }

/* ── Choices.js Theme Fix ── */
.choices { width: 100%; }
.choices__inner {
  background: white !important;
  border: 1px solid var(--gray-300) !important;
  border-radius: 8px !important;
  padding: 6px 10px !important;
  font-size: 13px !important;
  font-family: var(--font-sans) !important;
  min-height: 38px !important;
}
.choices__inner:focus-within {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(26,86,160,0.1) !important;
}
.choices__list--dropdown {
  border: 1px solid var(--gray-200) !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1) !important;
  font-size: 13px !important;
  z-index: 9999 !important;
}
.choices__list--dropdown .choices__item--selectable.is-highlighted {
  background: var(--primary-light) !important;
  color: var(--primary) !important;
}
.choices__input {
  font-size: 13px !important;
  font-family: var(--font-sans) !important;
  background: white !important;
}
.choices__placeholder { color: var(--gray-400) !important; }
.choices[data-type*=select-one] .choices__inner { padding-right: 30px !important; }
