/* =====================================================================
   AgencyOS — Design System
   Stack: Bootstrap 5.3 + Custom Properties
   Aesthetic: Linear/Notion-inspired · Dark & Light · Clean utility
   ===================================================================== */

/* ── Google Font ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Custom Properties ── */
:root {
  /* Brand */
  --brand:          #6366f1;
  --brand-hover:    #4f46e5;
  --brand-light:    #eef0ff;
  --brand-rgb:      99,102,241;
  --brand-glow:     rgba(99,102,241,.18);

  /* Surfaces */
  --surface-0:      #ffffff;
  --surface-1:      #f8f9fb;
  --surface-2:      #f1f3f7;
  --surface-3:      #e8eaef;

  /* Borders */
  --border:         #e5e7ee;
  --border-strong:  #cfd2de;

  /* Text */
  --text-primary:   #0f1117;
  --text-secondary: #556270;
  --text-muted:     #8b94a3;
  --text-inverse:   #ffffff;

  /* Status colours */
  --c-backlog:      #8b94a3;
  --c-todo:         #3b82f6;
  --c-in-progress:  #f59e0b;
  --c-review:       #8b5cf6;
  --c-testing:      #06b6d4;
  --c-completed:    #10b981;
  --c-blocked:      #ef4444;

  /* Priority */
  --p-low:          #64748b;
  --p-medium:       #f59e0b;
  --p-high:         #f97316;
  --p-urgent:       #ef4444;

  /* Surfaces (aliases) */
  --card:           #ffffff;
  --card-hover:     #fafbff;

  /* Layout */
  --sidebar-w:      240px;
  --sidebar-collapsed-w: 64px;
  --topbar-h:       56px;
  --radius-xs:      4px;
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
  --radius-xl:      20px;

  /* Shadows */
  --shadow-xs:      0 1px 2px rgba(0,0,0,.06);
  --shadow-sm:      0 2px 6px rgba(0,0,0,.08);
  --shadow-md:      0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:      0 8px 32px rgba(0,0,0,.14);

  /* Animation */
  --ease:           cubic-bezier(.16,1,.3,1);
  --ease-in:        cubic-bezier(.4,0,1,1);
  --dur:            180ms;
  --dur-lg:         280ms;

  /* Shadows */
  --shadow-brand:   0 4px 16px rgba(var(--brand-rgb),.25);
}

[data-bs-theme="dark"] {
  --surface-0:      #0d0e14;
  --surface-1:      #13151e;
  --surface-2:      #1a1d2a;
  --surface-3:      #222538;

  --border:         #252839;
  --border-strong:  #2f3248;

  --text-primary:   #e8eaf0;
  --text-secondary: #8b94a3;
  --text-muted:     #555e73;

  --brand-light:    #1e2040;
  --shadow-sm:      0 2px 6px rgba(0,0,0,.30);
  --shadow-md:      0 4px 16px rgba(0,0,0,.40);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--surface-1);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

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

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

/* =====================================================================
   SIDEBAR
   ===================================================================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface-0);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--dur) var(--ease);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Brand */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary) !important;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.3px;
}

.brand-icon {
  width: 30px; height: 30px;
  background: var(--brand);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 15px;
}

/* Search trigger */
.sidebar-search { padding: 0 10px 8px; }

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--dur);
}

.search-trigger:hover {
  background: var(--surface-3);
  color: var(--text-secondary);
}

.search-trigger kbd {
  margin-left: auto;
  font-size: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-muted);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 4px 8px;
  overflow-y: auto;
}

.nav-section { margin-bottom: 4px; }

.analytics-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: color 120ms, border-color 120ms;
}
.analytics-tab:hover { color: var(--text-secondary); }
.analytics-tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 450;
  cursor: pointer;
  transition: background var(--dur), color var(--dur);
  position: relative;
  white-space: nowrap;
}

.nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-item.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }

.nav-item .bi {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: transform var(--dur);
}
.nav-item:hover .bi { transform: scale(1.08); }

/* Per-icon colour pills */
.nav-item .bi-house-door       { background: #eff6ff; color: #3b82f6; }
.nav-item .bi-building         { background: #faf5ff; color: #7c3aed; }
.nav-item .bi-people           { background: #ecfeff; color: #0891b2; }
.nav-item .bi-folder2          { background: #fff7ed; color: #ea580c; }
.nav-item .bi-check2-square    { background: #f0fdf4; color: #16a34a; }
.nav-item .bi-palette          { background: #fdf4ff; color: #c026d3; }
.nav-item .bi-bar-chart-line   { background: #eff6ff; color: #2563eb; }
.nav-item .bi-stack            { background: #fff7ed; color: #d97706; }
.nav-item .bi-journal-text     { background: #f8fafc; color: #475569; }
.nav-item .bi-plug             { background: #fef2f2; color: #dc2626; }
.nav-item .bi-plus-circle      { background: #f0fdf4; color: #16a34a; }
.nav-item .bi-gear             { background: #f8fafc; color: #475569; }
.nav-item .bi-person-circle    { background: #eff6ff; color: #3b82f6; }
.nav-item .bi-shield-check     { background: #fdf4ff; color: #c026d3; }
.nav-item .bi-bell             { background: #fffbeb; color: #d97706; }
.nav-item .bi-chevron-bar-expand { background: #f8fafc; color: #64748b; }

.nav-item.active .bi {
  background: rgba(var(--brand-rgb), .18) !important;
  color: var(--brand) !important;
}

[data-bs-theme="dark"] .nav-item .bi-house-door       { background: rgba(59,130,246,.18);  color: #60a5fa; }
[data-bs-theme="dark"] .nav-item .bi-building         { background: rgba(124,58,237,.18);  color: #a78bfa; }
[data-bs-theme="dark"] .nav-item .bi-people           { background: rgba(8,145,178,.18);   color: #22d3ee; }
[data-bs-theme="dark"] .nav-item .bi-folder2          { background: rgba(234,88,12,.18);   color: #fb923c; }
[data-bs-theme="dark"] .nav-item .bi-check2-square    { background: rgba(22,163,74,.18);   color: #4ade80; }
[data-bs-theme="dark"] .nav-item .bi-palette          { background: rgba(192,38,211,.18);  color: #e879f9; }
[data-bs-theme="dark"] .nav-item .bi-bar-chart-line   { background: rgba(37,99,235,.18);   color: #60a5fa; }
[data-bs-theme="dark"] .nav-item .bi-stack            { background: rgba(217,119,6,.18);   color: #fbbf24; }
[data-bs-theme="dark"] .nav-item .bi-journal-text     { background: rgba(71,85,105,.18);   color: #94a3b8; }
[data-bs-theme="dark"] .nav-item .bi-plug             { background: rgba(220,38,38,.18);   color: #f87171; }
[data-bs-theme="dark"] .nav-item .bi-plus-circle      { background: rgba(22,163,74,.18);   color: #4ade80; }

.nav-item-project .project-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-item-muted { color: var(--text-muted); }

.badge-count {
  margin-left: auto;
  background: var(--c-blocked);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-primary) !important;
  transition: background var(--dur);
}

.user-pill:hover { background: var(--surface-2); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--avatar-color, var(--brand));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.user-avatar .avatar-img,
.user-avatar img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-size: 13px; font-weight: 500; line-height: 1.3; }
.user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

/* =====================================================================
   MAIN CONTENT
   ===================================================================== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface-0);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 0;
}

.topbar-breadcrumb a { color: var(--text-secondary); }
.topbar-breadcrumb a:hover { color: var(--brand); }
.topbar-breadcrumb span { color: var(--text-primary); font-weight: 500; }
.crumb-sep { font-size: 10px; color: var(--text-muted); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.topbar-btn {
  width: 34px; height: 34px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 15px;
  position: relative;
  transition: all var(--dur);
}

.topbar-btn:hover { background: var(--surface-2); color: var(--text-primary); }

.notif-badge {
  position: absolute;
  top: 3px; right: 3px;
  min-width: 16px; height: 16px;
  background: var(--c-blocked);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* Page content */
.page-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
}

/* =====================================================================
   FLASH MESSAGES
   ===================================================================== */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  font-size: 13.5px;
  font-weight: 500;
}

.flash-success { background: #dcfce7; color: #166534; border-bottom: 1px solid #bbf7d0; }
.flash-error   { background: #fee2e2; color: #991b1b; border-bottom: 1px solid #fecaca; }

[data-bs-theme="dark"] .flash-success { background: #052e16; color: #4ade80; border-color: #14532d; }
[data-bs-theme="dark"] .flash-error   { background: #2d0a0a; color: #f87171; border-color: #5a0a0a; }

.flash-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: .5;
  padding: 0;
  font-size: 14px;
}
.flash-close:hover { opacity: 1; }

/* =====================================================================
   NOTIFICATIONS DROPDOWN
   ===================================================================== */
.notif-dropdown {
  width: 360px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-0);
}

.btn-link-sm {
  background: none;
  border: none;
  color: var(--brand);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.notif-list { max-height: 380px; overflow-y: auto; }

.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--dur);
}

.notif-item:hover { background: var(--surface-1); }
.notif-item.unread { background: var(--brand-light); }
[data-bs-theme="dark"] .notif-item.unread { background: rgba(91,95,199,.12); }

.notif-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  color: var(--brand);
}

.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.notif-text  { font-size: 12px; color: var(--text-secondary); }
.notif-time  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.notif-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* =====================================================================
   STATUS & PRIORITY BADGES
   ===================================================================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-backlog    { color: var(--c-backlog);    background: #f1f3f7; }
.status-todo       { color: var(--c-todo);       background: #eff6ff; }
.status-in_progress{ color: var(--c-in-progress);background: #fffbeb; }
.status-review     { color: var(--c-review);     background: #f5f3ff; }
.status-testing    { color: var(--c-testing);    background: #ecfeff; }
.status-completed  { color: var(--c-completed);  background: #f0fdf4; }
.status-blocked    { color: var(--c-blocked);    background: #fef2f2; }

[data-bs-theme="dark"] .status-backlog    { background: rgba(139,148,163,.12); }
[data-bs-theme="dark"] .status-todo       { background: rgba(59,130,246,.12); }
[data-bs-theme="dark"] .status-in_progress{ background: rgba(245,158,11,.12); }
[data-bs-theme="dark"] .status-review     { background: rgba(139,92,246,.12); }
[data-bs-theme="dark"] .status-testing    { background: rgba(6,182,212,.12); }
[data-bs-theme="dark"] .status-completed  { background: rgba(16,185,129,.12); }
[data-bs-theme="dark"] .status-blocked    { background: rgba(239,68,68,.12); }

.priority-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 500;
}
.priority-low    { color: var(--p-low); }
.priority-medium { color: var(--p-medium); }
.priority-high   { color: var(--p-high); }
.priority-urgent { color: var(--p-urgent); }

/* =====================================================================
   TASK TABLE
   ===================================================================== */
.task-table-wrap {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.task-table-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: nowrap;
  overflow-x: auto;
}

.task-table {
  width: 100%;
  border-collapse: collapse;
}

.task-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}

.task-table th:hover { color: var(--text-primary); }
.task-table th.sorted { color: var(--brand); }

.task-table td {
  padding: 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.task-table tbody tr:hover { background: var(--surface-1); }
.task-table tbody tr.selected { background: var(--brand-light); }
[data-bs-theme="dark"] .task-table tbody tr.selected { background: rgba(91,95,199,.1); }

/* Inline cell */
.cell-wrap {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.task-title-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.task-checkbox {
  width: 15px; height: 15px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  appearance: none;
  transition: all var(--dur);
}

.task-checkbox:checked {
  background: var(--brand);
  border-color: var(--brand);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='white' d='M6.5 11.5L3 8l1-1 2.5 2.5 5-5 1 1z'/%3e%3c/svg%3e");
}

.task-title-link {
  font-size: 13.5px;
  font-weight: 450;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 360px;
  display: block;
}

.task-title-link:hover { color: var(--brand); }

.task-meta-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}

/* Inline edit */
.inline-edit-wrap {
  position: relative;
  display: inline-block;
}

.inline-edit-trigger {
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  transition: background var(--dur);
}

.inline-edit-trigger:hover { background: var(--surface-2); }

/* Fixed position so it escapes overflow:hidden on the table wrapper */
.inline-edit-select {
  position: fixed;
  z-index: 9999;
  background: var(--surface-0);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 160px;
  padding: 4px;
  display: none;
}

.inline-edit-select.open { display: block; }

.inline-edit-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: background var(--dur);
}

.inline-edit-option:hover { background: var(--surface-2); }
.inline-edit-option.active { background: var(--brand-light); color: var(--brand); }

/* Bulk action bar */
.bulk-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--brand-light);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
}

.bulk-bar.visible { display: flex; }

/* =====================================================================
   KANBAN BOARD
   ===================================================================== */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
}

.kanban-column {
  min-width: 280px;
  max-width: 320px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
}

.kanban-col-count {
  margin-left: auto;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}

.kanban-col-body {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
  min-height: 120px;
  transition: background var(--dur);
}
.kanban-col-body.drag-over { background: var(--brand-light); border-radius: var(--radius-md); }

.kanban-card {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: box-shadow var(--dur), transform var(--dur);
}

.kanban-card:hover { box-shadow: var(--shadow-sm); }
.kanban-card.dragging { opacity: .5; box-shadow: var(--shadow-lg); }
.kanban-card-title { font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 8px; }
.kanban-card-meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; }

/* =====================================================================
   TASK DETAIL PANEL
   ===================================================================== */
.task-detail-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.task-detail-main {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.task-detail-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.task-detail-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin: 0 0 12px;
}

.task-detail-title[contenteditable] {
  outline: none;
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  margin: -2px -4px;
  cursor: text;
}

.task-detail-title[contenteditable]:focus {
  box-shadow: 0 0 0 2px var(--brand-glow), 0 0 0 1px var(--brand);
}

.task-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.task-detail-body { padding: 20px 24px; }

/* Sidebar panel */
.task-detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-card {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.detail-card-title {
  padding: 12px 16px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.detail-card-body { padding: 12px 16px; }

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
}

.detail-row-label { color: var(--text-muted); font-size: 12.5px; }
.detail-row-value { color: var(--text-primary); font-weight: 450; }

/* Comment feed */
.comment-list { display: flex; flex-direction: column; gap: 0; }

.comment-item {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.comment-item:last-child { border-bottom: none; }
.comment-item.internal { background: rgba(245,158,11,.04); border-left: 3px solid var(--c-in-progress); }

.comment-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--avatar-color, var(--brand));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.comment-avatar .avatar-img,
.comment-avatar img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
}

.comment-body { flex: 1; min-width: 0; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.comment-time   { font-size: 11.5px; color: var(--text-muted); }
.comment-internal-badge { font-size: 10.5px; background: #fff8e1; color: #92400e; padding: 1px 6px; border-radius: 10px; font-weight: 500; }
/* ── Approval comment badges ──────────────────────────────────────── */
.comment-approval-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}
.comment-approval-badge.request  { background: #eff6ff; color: #2563eb; }
.comment-approval-badge.approved { background: #f0fdf4; color: #16a34a; }
.comment-approval-badge.changes   { background: #fffbeb; color: #d97706; }
.comment-approval-badge.completed { background: #f0fdf4; color: #15803d; }


.comment-content {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-primary);
  word-break: break-word;
}

.comment-content p { margin: 0 0 6px; }
.comment-content p:last-child { margin-bottom: 0; }
.comment-content code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 12px;
}

/* Mention autocomplete */

/* @mention display in comments and descriptions */
.mention-tag {
  color: var(--brand);
  font-weight: 600;
  background: rgba(99, 102, 241, 0.08);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: inherit;
}

.mention-dropdown {
  position: absolute;
  z-index: 300;
  background: var(--surface-0);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 220px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
}

.mention-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: background var(--dur);
}

.mention-option:hover, .mention-option.active { background: var(--surface-2); }
.mention-name { font-weight: 500; }
.mention-role { color: var(--text-muted); font-size: 11.5px; }

/* Comment editor */
.comment-editor-wrap {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.comment-editor {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-primary);
  resize: vertical;
  outline: none;
  font-family: inherit;
  transition: border-color var(--dur);
}

.comment-editor:focus { border-color: var(--brand); background: var(--surface-0); }

.comment-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

/* Checklist */
.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.checklist-item input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
  flex-shrink: 0;
}

.checklist-label { font-size: 13px; flex: 1; cursor: pointer; }
.checklist-label.done { text-decoration: line-through; color: var(--text-muted); }

/* File attachments */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  padding: 12px 0;
}

.file-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--dur);
}

.file-card:hover { box-shadow: var(--shadow-sm); }
.file-thumb { width: 100%; height: 80px; object-fit: cover; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--text-muted); }
.file-name { padding: 6px 8px; font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Activity feed */
.activity-feed { display: flex; flex-direction: column; }

.activity-item {
  display: flex;
  gap: 10px;
  padding: 8px 16px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  margin-top: 4px;
  flex-shrink: 0;
}

.activity-time { color: var(--text-muted); font-size: 11.5px; white-space: nowrap; }

/* =====================================================================
   GLOBAL SEARCH MODAL
   ===================================================================== */
.search-dialog { max-width: 600px; margin-top: 80px; }

.search-dialog .modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 4px 16px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.search-icon { color: var(--text-muted); font-size: 16px; }

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  padding: 14px 0;
  font-family: inherit;
}

.search-esc {
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 6px;
  color: var(--text-muted);
}

.search-results { max-height: 400px; overflow-y: auto; padding: 8px; }

.search-group-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 8px 2px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text-primary);
  transition: background var(--dur);
}

.search-result-item:hover { background: var(--surface-2); }
.search-result-icon { color: var(--text-muted); font-size: 15px; width: 20px; text-align: center; }
.search-result-meta { font-size: 11.5px; color: var(--text-muted); margin-left: auto; }
.search-empty { padding: 32px 16px; text-align: center; color: var(--text-muted); font-size: 13.5px; }

/* =====================================================================
   TOAST NOTIFICATIONS
   ===================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  min-width: 280px;
  max-width: 360px;
  animation: toast-in 250ms var(--ease);
}

.toast-item.success { border-left: 3px solid var(--c-completed); }
.toast-item.error   { border-left: 3px solid var(--c-blocked); }
.toast-item.info    { border-left: 3px solid var(--brand); }

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

/* =====================================================================
   FORMS
   ===================================================================== */
.form-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }

.form-control, .form-select {
  background-color: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13.5px;
  border-radius: var(--radius-sm);
  transition: border-color var(--dur), box-shadow var(--dur);
}

.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
  background-color: var(--surface-0);
  color: var(--text-primary);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  background-color: var(--surface-2);
  border-color: var(--border);
  color: var(--text-primary);
}

[data-bs-theme="dark"] .form-control::placeholder { color: var(--text-muted); }

/* =====================================================================
   CARDS & PAGE SECTIONS
   ===================================================================== */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); margin: 0; }
.page-subtitle { font-size: 13.5px; color: var(--text-secondary); margin: 4px 0 0; }
.page-header-actions { margin-left: auto; display: flex; gap: 8px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* Dashboard page gradient background */
.page-content-dashboard {
  background: linear-gradient(135deg, #f8fafc 0%, #f0f4ff 60%, #f8fafc 100%);
}

/* Stat card gradient accents */
.stat-card.accent-blue   { background: linear-gradient(135deg, #ffffff 55%, #eff6ff 100%); }
.stat-card.accent-amber  { background: linear-gradient(135deg, #ffffff 55%, #fffbeb 100%); }
.stat-card.accent-red    { background: linear-gradient(135deg, #ffffff 55%, #fef2f2 100%); }
.stat-card.accent-green  { background: linear-gradient(135deg, #ffffff 55%, #f0fdf4 100%); }
.stat-card.accent-purple { background: linear-gradient(135deg, #ffffff 55%, #faf5ff 100%); }
.stat-card.accent-brand  { background: linear-gradient(135deg, #ffffff 55%, var(--brand-light) 100%); }

[data-bs-theme="dark"] .stat-card.accent-blue   { background: linear-gradient(135deg, var(--card) 55%, rgba(59,130,246,.06) 100%); }
[data-bs-theme="dark"] .stat-card.accent-amber  { background: linear-gradient(135deg, var(--card) 55%, rgba(245,158,11,.06) 100%); }
[data-bs-theme="dark"] .stat-card.accent-red    { background: linear-gradient(135deg, var(--card) 55%, rgba(239,68,68,.06) 100%); }
[data-bs-theme="dark"] .stat-card.accent-green  { background: linear-gradient(135deg, var(--card) 55%, rgba(34,197,94,.06) 100%); }
[data-bs-theme="dark"] .stat-card.accent-purple { background: linear-gradient(135deg, var(--card) 55%, rgba(124,58,237,.06) 100%); }

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur), transform var(--dur-lg);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--dur);
  border-radius: var(--radius-lg);
}

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

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 14px;
}

.stat-card-icon.blue    { background: #eff6ff; color: #3b82f6; }
.stat-card-icon.amber   { background: #fffbeb; color: #f59e0b; }
.stat-card-icon.red     { background: #fef2f2; color: #ef4444; }
.stat-card-icon.green   { background: #f0fdf4; color: #22c55e; }
.stat-card-icon.purple  { background: #faf5ff; color: #7c3aed; }
.stat-card-icon.brand   { background: var(--brand-light); color: var(--brand); }

[data-bs-theme="dark"] .stat-card-icon.blue   { background: rgba(59,130,246,.15); }
[data-bs-theme="dark"] .stat-card-icon.amber  { background: rgba(245,158,11,.15); }
[data-bs-theme="dark"] .stat-card-icon.red    { background: rgba(239,68,68,.15); }
[data-bs-theme="dark"] .stat-card-icon.green  { background: rgba(34,197,94,.15); }
[data-bs-theme="dark"] .stat-card-icon.purple { background: rgba(124,58,237,.15); }

.stat-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); margin: 4px 0; line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--text-secondary); }

/* Project card */
.project-card {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: box-shadow var(--dur), border-color var(--dur);
}

.project-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.project-card-header { display: flex; align-items: flex-start; gap: 12px; }

.project-color-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.project-name { font-size: 15px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.project-desc { font-size: 12.5px; color: var(--text-secondary); }

.project-progress-bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}

.project-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--brand);
  transition: width .6s var(--ease);
}

.project-stats { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); }

/* =====================================================================
   AUTH PAGES
   ===================================================================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-1);
  padding: 24px;
}

.auth-card {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 28px;
}

.auth-logo .brand-icon {
  width: 36px; height: 36px;
  background: var(--brand);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 18px;
}

.auth-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.auth-sub   { font-size: 13.5px; color: var(--text-secondary); margin: 0 0 24px; }

/* =====================================================================
   ADMIN TABLES
   ===================================================================== */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tbody tr:hover { background: var(--surface-1); }

/* =====================================================================
   DROPZONE
   ===================================================================== */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--dur);
  color: var(--text-muted);
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand);
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-content { margin-left: 0; }

  .task-detail-layout {
    grid-template-columns: 1fr;
  }

  .task-detail-sidebar {
    order: -1;
  }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575px) {
  .page-content { padding: 16px; }
  .topbar { padding: 0 12px; }
  .auth-card { padding: 24px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* =====================================================================
   UTILITIES
   ===================================================================== */
.text-truncate-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.avatar-sm {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--avatar-color, var(--brand));
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.avatar-sm img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; border-radius: 50%; }

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state-desc { font-size: 13.5px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.4s infinite;
  border-radius: var(--radius-sm);
}

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

/* Bootstrap overrides */
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-hover); border-color: var(--brand-hover); }

.btn-outline-primary {
  color: var(--brand);
  border-color: var(--brand);
}
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }

.modal-content {
  background: var(--surface-0);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.modal-header { border-bottom-color: var(--border); }
.modal-footer { border-top-color: var(--border); }

.dropdown-menu {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
}

.dropdown-item { color: var(--text-primary); padding: 7px 14px; }
.dropdown-item:hover { background: var(--surface-2); color: var(--text-primary); }

.table { color: var(--text-primary); }
.table-bordered { border-color: var(--border); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.card-header {
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
}

.card-header-row {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-link {
  font-size: 12.5px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--dur);
}
.card-link:hover { color: var(--brand); }

/* ── Comment reactions & emoji ─────────────────────────────── */
.comment-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  position: relative;
}
.emoji-trigger {
  font-size: 14px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: background var(--dur);
}
.emoji-trigger:hover { background: var(--surface-2); color: var(--text-primary); }
.emoji-picker {
  display: none;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px;
  background: var(--surface-0);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 180px;
}
.emoji-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background var(--dur);
  line-height: 1;
}
.emoji-btn:hover { background: var(--surface-2); }
.comment-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--dur), border-color var(--dur);
  color: var(--text-primary);
}
.reaction-chip:hover { background: var(--surface-2); }
.reaction-chip.reacted {
  background: rgba(99,102,241,.1);
  border-color: var(--brand);
  color: var(--brand);
}
.reaction-chip span { font-size: 12px; font-weight: 600; }

/* avatar-sm .avatar-img - absolute positioned like user-avatar */
.avatar-sm .avatar-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
}
/* Fix old non-absolute avatar-sm img rule */
.avatar-sm img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
}

/* ── Project member avatar stack ───────────────────────────── */
.member-stack {
  display: flex;
  align-items: center;
}
.member-stack .user-avatar {
  width: 24px; height: 24px; font-size: 9px;
  border: 2px solid var(--surface-0);
  margin-left: -6px;
  transition: transform var(--dur);
}
.member-stack .user-avatar:first-child { margin-left: 0; }
.member-stack .user-avatar:hover { transform: scale(1.15); z-index: 2; }
.member-stack-more {
  width: 24px; height: 24px; font-size: 9px; font-weight: 700;
  background: var(--surface-2); color: var(--text-secondary);
  border: 2px solid var(--surface-0);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-left: -6px;
  cursor: default;
}
.member-stack-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: var(--surface-0);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 8px 10px;
  min-width: 140px;
  z-index: 100;
  white-space: nowrap;
}
.member-stack-wrap:hover .member-stack-tooltip { display: block; }
.member-stack-wrap { position: relative; display: inline-flex; }

/* ── Client nav groups in sidebar ──────────────────────────── */
.client-nav-group { position: relative; }

.client-nav-toggle {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-secondary);
  font-family: inherit;
  transition: background var(--dur), color var(--dur);
}
.client-nav-toggle:hover { background: var(--surface-2); color: var(--text-primary); }
.client-nav-toggle.active  { background: var(--brand-light); color: var(--brand); font-weight: 600; }

.client-chevron { transition: transform 0.15s; color: var(--text-muted); flex-shrink: 0; }

.client-nav-projects { overflow: hidden; }

.nav-item-indented {
  padding-left: 32px !important;
}

.client-nav-name {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ── Sidebar project item: name truncates, badge stays visible ─── */
.nav-item-project {
  overflow: visible !important; /* allow badge to show */
}
.nav-item-project > span:not(.project-dot):not(.badge-count) {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Client nav toggle avatar: never shrink */
.client-nav-toggle .user-avatar {
  flex-shrink: 0;
  min-width: 20px;
}

/* ── New Task wizard (quickCreateModal) ─────────────────────────── */
.qc-add-new-option {
  font-weight: 600;
  color: var(--brand);
}
.qc-step .modal-header { border-bottom: 1px solid var(--border); }
.qc-step .modal-footer { border-top: 1px solid var(--border); }
