:root {
  --indigo: #2f6fed;
  --purple: #7c3aed;
  --cyan: #06b6d4;
  /* A clean two-stop brand gradient reads as more premium/professional than a
     three-color "rainbow" — used across buttons, badges, and the hero banner. */
  --grad-primary: linear-gradient(135deg, #2f6fed 0%, #1d4fd1 100%);
  --grad-soft: linear-gradient(
    135deg,
    rgba(47, 111, 237, 0.1) 0%,
    rgba(29, 79, 209, 0.06) 100%
  );
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface2: #f1f5f9;
  --surface3: #e2e8f0;
  --border: rgba(15, 23, 42, 0.09);
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --sidebar-w: 260px;
  --sidebar-collapsed: 100px;
  --topbar-h: 64px;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.1), 0 2px 8px rgba(15, 23, 42, 0.05);
  --t: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #1a2540;
  --surface3: #334155;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #64748b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: 6px;
}

/* ---- LAYOUT ---- */
#app {
  display: flex;
  min-height: 100vh;
  padding-top: var(--topbar-h);
}

/* ---- SIDEBAR ----
   Desktop default = collapsed (icon + small label stacked). Expanding is an
   explicit user action, remembered via localStorage + the data-sidebar
   attribute on <html> (same flash-free pattern as the dark-mode toggle).
   On mobile the sidebar is always a full-width slide-in drawer regardless
   of this desktop collapse preference — see the max-width:992px block. */
#sidebar {
  width: var(--sidebar-collapsed);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  z-index: 1000;
  transition: width var(--t);
  overflow: hidden;
}
html[data-sidebar="expanded"] #sidebar {
  width: var(--sidebar-w);
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 10px;
}
.sidebar-section-title {
  display: none;
}
.nav-item {
  margin-bottom: 2px;
}
.nav-link-custom {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  text-align: center;
  transition: all var(--t);
  cursor: pointer;
  position: relative;
}
html[data-sidebar="expanded"] .nav-link-custom {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}
.nav-link-custom:hover {
  background: var(--grad-soft);
  color: var(--indigo);
}
.nav-link-custom.active {
  background: var(--grad-soft);
  color: var(--indigo);
  font-weight: 600;
}
.nav-link-custom.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--grad-primary);
  border-radius: 0 4px 4px 0;
}
html[data-sidebar="expanded"] .nav-link-custom.active::before {
  display: block;
}
.nav-icon {
  font-size: 17px;
  flex-shrink: 0;
}
.nav-label {
  font-size: 9.5px;
  line-height: 1.15;
  white-space: normal;
  max-width: 100%;
  transition: font-size var(--t);
}
html[data-sidebar="expanded"] .nav-label {
  font-size: 13.5px;
  white-space: nowrap;
}
.sidebar-badge {
  margin-left: auto;
  background: var(--indigo);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  min-width: 20px;
  text-align: center;
  display: none;
}
html[data-sidebar="expanded"] .sidebar-badge {
  display: inline-block;
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-footer-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 4px;
  transition: background var(--t);
}
.sidebar-footer-profile:hover {
  background: var(--grad-soft);
}
.sidebar-footer-info {
  min-width: 0;
  overflow: hidden;
  opacity: 0;
  width: 0;
  transition: opacity var(--t);
}
.sidebar-footer-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer-email {
  font-size: 10.5px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer-logout {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: none;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  text-decoration: none;
  font-size: 16px;
  transition: background var(--t);
}
.sidebar-footer-logout:hover {
  background: rgba(239, 68, 68, 0.12);
}
html[data-sidebar="expanded"] .sidebar-footer-info {
  opacity: 1;
  width: auto;
}
html[data-sidebar="expanded"] .sidebar-footer-logout {
  display: flex;
}

/* ---- MAIN ---- */
#main {
  margin-left: var(--sidebar-collapsed);
  flex: 1;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--t);
  min-width: 0;
}
html[data-sidebar="expanded"] #main {
  margin-left: var(--sidebar-w);
}

/* ---- TOPBAR ----
   Fixed, full-width, sits ABOVE the sidebar+content row entirely (not nested
   inside it) — so its own position/width never changes when the sidebar
   collapses or expands. z-index is higher than the sidebar's so it always
   renders on top during that transition. */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  z-index: 1100;
  transition: background var(--t);
}
.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--t);
  display: flex;
  align-items: center;
}
.sidebar-toggle:hover {
  background: var(--surface2);
  color: var(--text);
}
/* Brand mark in the topbar's left section — now the sidebar itself only
   holds the collapse/expand toggle (no logo there anymore), so this is the
   one place the logo always lives, on every screen size. */
.topbar-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.topbar-brand-icon {
  height: 26px;
  width: auto;
  max-width: 118px;
  object-fit: contain;
}
.topbar-brand-dark {
  display: none;
}
[data-theme="dark"] .topbar-brand-light {
  display: none;
}
[data-theme="dark"] .topbar-brand-dark {
  display: block;
}
.search-bar:focus-within {
  border-color: var(--indigo);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}
/* Centers the main topbar search regardless of what's in the icon tray on the
   right or whether the (desktop-hidden) mobile brand mark is showing —
   absolute positioning ignores sibling widths entirely, unlike flex auto-
   margins which would fight with .topbar-right's own margin-left:auto.
   Desktop only; every mobile breakpoint below already has its own explicit
   position (fixed full-width overlay, or hidden behind the search icon) with
   higher selector specificity, so this never fights with those. */
@media (min-width: 993px) {
  #topbar-search-bar {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
}
.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  width: 100%;
}
.search-bar input::placeholder {
  color: var(--text3);
}
.search-bar i {
  color: var(--text3);
  font-size: 14px;
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--t);
  display: flex;
  align-items: center;
}
.icon-btn:hover {
  background: var(--surface2);
  color: var(--text);
}
.notif-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid var(--surface);
}
.theme-toggle {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--text2);
  font-size: 13px;
  font-family: "Poppins", sans-serif;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--t);
  white-space: nowrap;
}
.theme-toggle:hover {
  border-color: var(--indigo);
  color: var(--indigo);
}
.btn-create {
  background: var(--grad-primary);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 4px;
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--t);
  box-shadow: 0 4px 12px rgba(47, 111, 237, 0.3);
  white-space: nowrap;
}
.btn-create:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(47, 111, 237, 0.4);
}
.role-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px;
}
.role-btn {
  background: none;
  border: none;
  padding: 5px 12px;
  border-radius: 4px;
  font-family: "Poppins", sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text3);
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
}
.role-btn.active {
  background: var(--surface);
  color: var(--indigo);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ---- CONTENT ---- */
#content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}
.page {
  display: none;
}
.page.active {
  display: block;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text3);
  margin-top: 2px;
}

/* ---- CARDS ---- */
.stat-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t);
  cursor: default;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-card-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.stat-icon.indigo {
  background: rgba(47, 111, 237, 0.12);
  color: var(--indigo);
}
.stat-icon.green {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}
.stat-icon.amber {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}
.stat-icon.red {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}
.stat-icon.purple {
  background: rgba(124, 58, 237, 0.12);
  color: var(--purple);
}
.stat-icon.cyan {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan);
}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}
.stat-label {
  font-size: 12.5px;
  color: var(--text3);
  font-weight: 500;
}
.stat-change {
  position: absolute;
  top: 22px;
  right: 22px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}
.stat-change.up {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}
.stat-change.down {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.chart-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.chart-subtitle {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 20px;
}
.prog-bar {
  height: 6px;
  background: var(--surface2);
  border-radius: 6px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  border-radius: 6px;
  background: var(--grad-primary);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-item {
  margin-bottom: 14px;
}
.progress-item-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}
.progress-item-name {
  font-size: 13px;
  font-weight: 500;
}
.progress-item-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--indigo);
}

/* ---- KANBAN ---- */
.kanban-wrapper {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 500px;
}
.kanban-col {
  min-width: 300px;
  flex: 1;
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.kanban-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
}
.col-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.col-dot.todo {
  background: #94a3b8;
}
.col-dot.inprogress {
  background: #f59e0b;
}
.col-dot.done {
  background: #10b981;
}
.col-dot.closed {
  background: #6366f1;
}
.kanban-count {
  font-size: 11px;
  font-weight: 600;
  background: var(--surface3);
  color: var(--text2);
  padding: 2px 8px;
  border-radius: 6px;
}
.kanban-add-btn {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 18px;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  transition: all var(--t);
}
.kanban-add-btn:hover {
  background: var(--surface3);
  color: var(--indigo);
}
.kanban-tasks {
  flex: 1;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background var(--t);
  border-radius: 6px;
  padding: 2px;
}
.kanban-tasks.drag-over {
  background: rgba(47, 111, 237, 0.07);
  border: 2px dashed rgba(47, 111, 237, 0.3);
}

/* ---- TASK CARDS ---- */
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  cursor: pointer;
  transition: all var(--t);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.task-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}
.task-card.priority-critical::before {
  background: #ef4444;
}
.task-card.priority-high::before {
  background: #f97316;
}
.task-card.priority-medium::before {
  background: #f59e0b;
}
.task-card.priority-low::before {
  background: #10b981;
}
.task-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: rgba(47, 111, 237, 0.2);
}
.task-card.dragging {
  opacity: 0.5;
  transform: rotate(1.5deg) scale(1.02);
  cursor: grabbing;
}
/* Brief visual cue while a status change is being saved to the server — mainly so
   the person doesn't hit refresh in the split-second before the request lands
   (the request itself is protected against that too, via fetch's keepalive flag). */
.task-card.status-saving {
  animation: pulse 1s infinite;
  pointer-events: none;
}

/* DEADLINE HIGHLIGHTS */
.task-card.deadline-today {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.03) !important;
}
.task-card.deadline-tomorrow {
  border-color: #f97316 !important;
  background: rgba(249, 115, 22, 0.03) !important;
}
.task-card.deadline-overdue {
  border-color: #dc2626 !important;
  background: rgba(220, 38, 38, 0.06) !important;
}
.deadline-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  animation: pulse 2s infinite;
}
.deadline-chip.overdue {
  background: rgba(220, 38, 38, 0.15);
  color: #dc2626;
}
.deadline-chip.today {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.deadline-chip.tomorrow {
  background: rgba(249, 115, 22, 0.12);
  color: #f97316;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.task-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 6px;
}
.task-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
}
/* Small red dot for "there's something new here" indicators (e.g. pending
   join requests on the Employees page's "Join Requests" button). */
.badge-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  margin-left: 6px;
  vertical-align: middle;
}
.priority-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.priority-badge.critical {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}
.priority-badge.high {
  background: rgba(249, 115, 22, 0.12);
  color: #f97316;
}
.priority-badge.medium {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}
.priority-badge.low {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}
.task-desc {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 10px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.task-tag {
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--grad-soft);
  color: var(--indigo);
}
.task-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.task-due {
  font-size: 11.5px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 4px;
}
.task-due.overdue {
  color: #ef4444;
  font-weight: 600;
}
.task-due.today {
  color: #ef4444;
  font-weight: 600;
}
.task-due.tomorrow {
  color: #f97316;
  font-weight: 600;
}
.task-avatars {
  display: flex;
}
.task-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--grad-primary);
  border: 2px solid var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  margin-left: -6px;
  cursor: pointer;
  flex-shrink: 0;
}
.task-avatar:first-child {
  margin-left: 0;
}
.task-avatar-more {
  background: var(--surface3);
  color: var(--text2);
  font-size: 9px;
}

/* ---- LIST TABLE ---- */
.data-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.data-table table {
  width: 100%;
  border-collapse: collapse;
}
.data-table thead th {
  padding: 13px 16px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text3);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--t);
}
.data-table tbody tr:last-child {
  border-bottom: none;
}
.data-table tbody tr:hover {
  background: var(--surface2);
}
.data-table tbody td {
  padding: 13px 16px;
  font-size: 13px;
  vertical-align: middle;
}
.data-table tbody tr.row-overdue {
  background: rgba(239, 68, 68, 0.04);
}
.data-table tbody tr.row-today {
  background: rgba(239, 68, 68, 0.06);
}
.data-table tbody tr.row-tomorrow {
  background: rgba(249, 115, 22, 0.04);
}

/* ---- FILTERS ---- */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 7px 30px 7px 14px;
  font-family: "Poppins", sans-serif;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: all var(--t);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%2394a3b8' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px;
}
.filter-select:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}
/* The date-range field shares .filter-select's box styling but is a text
   input (flatpickr), not a <select> — swap the dropdown-caret background
   for a calendar icon so it doesn't look like a dropdown that does nothing. */
#filter-date-range {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%2394a3b8' d='M4 1a.5.5 0 0 1 .5.5V2h7v-.5a.5.5 0 0 1 1 0V2h1a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h1v-.5A.5.5 0 0 1 4 1zM2 5v8a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V5H2z'/%3E%3C/svg%3E");
  background-size: 13px;
  cursor: pointer;
}
#task-refresh-btn,
.btn-reset-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#task-refresh-btn i,
.btn-reset-icon i {
  display: inline-block;
  transition: transform 0.5s ease;
}
#task-refresh-btn.spinning i,
.btn-reset-icon.spinning i {
  animation: taskRefreshSpin 0.6s linear;
}
@keyframes taskRefreshSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
}
.view-btn {
  background: none;
  border: none;
  padding: 7px 14px;
  cursor: pointer;
  color: var(--text3);
  font-size: 14px;
  transition: all var(--t);
  display: flex;
  align-items: center;
}
.view-btn.active {
  background: var(--indigo);
  color: white;
}

/* ---- MODAL ---- */
/* Bootstrap positions/centers modals relative to the whole viewport with no
   awareness of our fixed #topbar (z-index 1100). Left alone, a modal's
   default z-index (1055) sits BELOW the topbar's, so any modal whose dialog
   happens to land in that top strip — easy on short dialogs that Bootstrap
   vertically centers, especially on shorter/mobile viewports — gets its
   header/close-button visually chopped off, hidden behind the topbar.
   Fixed by (a) pushing every modal dialog down to start below the topbar so
   it never lands there to begin with, and (b) raising the modal/backdrop
   z-index above the topbar's as a safety net for anything that still
   overlaps (e.g. a very tall dialog on a short screen). Scoped to
   body.has-topbar so login.php's modals — that page has no topbar at all —
   aren't pushed down for no reason. */
body.has-topbar .modal { z-index: 1150; }
body.has-topbar .modal-backdrop { z-index: 1140; }
body.has-topbar .modal-backdrop.show ~ .modal-backdrop.show { z-index: 1141; } /* stacked modals (e.g. task modal -> add-project modal) */

/* Dashboard-only subscription banner — deliberately NOT in the sidebar (which
   shows on every page); this sits inline above #content, only ever included
   by dashboard.php. */
.dash-trial-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 20px 20px 0; padding: 12px 18px; border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.12); color: #b45309;
  font-size: 13px; font-weight: 500; text-decoration: none;
}
.dash-trial-banner:hover { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.dash-trial-banner b { font-weight: 700; }
.dash-trial-banner span { flex: 1; }
.dash-trial-banner.expired { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.dash-trial-banner.expired:hover { background: rgba(239, 68, 68, 0.18); color: #b91c1c; }
@media (max-width: 992px) {
  .dash-trial-banner { margin: calc(var(--topbar-h) + env(safe-area-inset-top) + 12px) 12px 0; }
}

body.has-topbar .modal-dialog {
  margin-top: calc(var(--topbar-h) + 20px);
}
body.has-topbar .modal-dialog-centered {
  min-height: calc(100vh - var(--topbar-h) - 40px);
}
@media (max-width: 992px) {
  body.has-topbar .modal-dialog {
    margin-top: calc(var(--topbar-h) + env(safe-area-inset-top) + 12px);
  }
  body.has-topbar .modal-dialog-centered {
    min-height: calc(100vh - var(--topbar-h) - env(safe-area-inset-top) - 24px);
  }
}
.modal-content {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
  color: var(--text) !important;
}
.modal-header {
  border-bottom: 1px solid var(--border) !important;
  padding: 20px 24px !important;
  align-items: center !important;
}
.modal-body {
  padding: 24px !important;
}
.modal-footer {
  border-top: 1px solid var(--border) !important;
  padding: 16px 24px !important;
}
.modal-title {
  font-size: 16px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
}
.btn-close-custom {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all var(--t);
}
.btn-close-custom:hover {
  background: var(--surface2);
  color: var(--text);
}
.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  display: block;
}
.form-control,
.form-select {
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text) !important;
  font-family: "Poppins", sans-serif !important;
  font-size: 13px !important;
  padding: 9px 13px !important;
  transition: all var(--t) !important;
}
.form-select {
  appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%2394a3b8' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 13px center !important;
  background-size: 10px !important;
  padding-right: 32px !important;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--indigo) !important;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12) !important;
  background-color: var(--surface) !important;
}
.form-control::placeholder {
  color: var(--text3) !important;
}
.date-input-wrap {
  position: relative;
}
.date-input-wrap .form-control {
  padding-right: 38px !important;
  cursor: pointer;
}
.date-input-icon {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14.5px;
  color: var(--text3);
  pointer-events: none;
}
.date-input-wrap .form-control:focus ~ .date-input-icon {
  color: var(--indigo);
}
.pw-input-wrap {
  position: relative;
}
.pw-input-wrap .form-control {
  padding-right: 38px !important;
}
.pw-toggle-app {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text3);
  font-size: 14.5px;
  padding: 7px 8px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t);
}
.pw-toggle-app:hover {
  color: var(--indigo);
  background: var(--surface2);
}
.section-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ---- ASSIGNEE PICKER ---- */
.assignee-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 160px;
  overflow-y: auto;
}
.assignee-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 4px;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--t);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text2);
  user-select: none;
}
.assignee-chip:hover {
  border-color: var(--indigo);
  color: var(--indigo);
}
.assignee-chip.selected {
  border-color: var(--indigo);
  background: rgba(47, 111, 237, 0.08);
  color: var(--indigo);
}
.assignee-chip .chip-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.selected-assignees-display {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---- COMMENTS ---- */
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 200px;
  overflow-y: auto;
}
.comment-item {
  display: flex;
  gap: 10px;
}
.comment-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.comment-body {
  background: var(--surface2);
  border-radius: 0 6px 6px 6px;
  padding: 10px 14px;
  flex: 1;
}
.comment-author {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 3px;
}
.comment-text {
  font-size: 12.5px;
  color: var(--text2);
  line-height: 1.5;
}
.comment-time {
  font-size: 10.5px;
  color: var(--text3);
  margin-top: 4px;
}
.upload-zone i {
  font-size: 22px;
}

/* ---- BUTTONS ---- */
.btn-primary-custom {
  background: var(--grad-primary);
  color: white;
  border: none;
  padding: 9px 20px;
  border-radius: 4px;
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t);
  box-shadow: 0 3px 10px rgba(47, 111, 237, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary-custom:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(47, 111, 237, 0.4);
}
.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 9px 20px;
  border-radius: 4px;
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-ghost:hover {
  border-color: var(--indigo);
  color: var(--indigo);
}
.btn-icon-sm {
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--t);
}
.btn-icon-sm:hover {
  border-color: var(--indigo);
  color: var(--indigo);
}

/* ---- Universal button mini-loader ----
   Any <button>, .btn-styled <a>, or type="submit" element automatically gets
   a small inline spinner (replacing its content, not resizing it) for as
   long as the async action it triggered is in flight — wired up in
   data.js (apiGet/apiPost/apiUpload wrap document.activeElement). Dark
   spinner by default (fits ghost/icon/outlined buttons); solid/filled
   buttons override to a white spinner below since their background is dark. */
.btn-is-loading {
  position: relative !important;
  pointer-events: none !important;
  cursor: default !important;
  color: transparent !important;
}
.btn-is-loading > * {
  visibility: hidden !important;
}
.btn-is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--indigo);
  animation: btnLoaderSpin 0.65s linear infinite;
}
.btn-primary-custom.btn-is-loading::after,
.view-btn.active.btn-is-loading::after,
.bn-fab.btn-is-loading::after,
.btn-danger-custom.btn-is-loading::after {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
}
@keyframes btnLoaderSpin {
  to { transform: rotate(360deg); }
}

.btn-danger-ghost {
  background: none;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--t);
  font-family: "Poppins", sans-serif;
}
.btn-danger-ghost:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: #ef4444;
}

/* ---- BADGES ---- */
.badge-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.badge-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.badge-status.todo {
  background: rgba(148, 163, 184, 0.15);
  color: #64748b;
}
.badge-status.todo::before {
  background: #94a3b8;
}
.badge-status.inprogress {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}
.badge-status.inprogress::before {
  background: #f59e0b;
}
.badge-status.done {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}
.badge-status.done::before {
  background: #10b981;
}
.badge-status.closed {
  background: rgba(99, 102, 241, 0.12);
  color: #6366f1;
}
.badge-status.closed::before {
  background: #6366f1;
}
.badge-status.overdue {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}
.badge-status.overdue::before {
  background: #ef4444;
}

/* ---- HERO BANNER ---- */
.hero-banner {
  background: var(--grad-primary);
  border-radius: var(--radius);
  padding: 28px 32px;
  color: white;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.hero-banner::before {
  content: "";
  position: absolute;
  top: -30px;
  right: -30px;
  width: 180px;
  height: 180px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}
.hero-banner::after {
  content: "";
  position: absolute;
  bottom: -50px;
  right: 120px;
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}
.hero-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}
.hero-sub {
  font-size: 13px;
  opacity: 0.85;
  position: relative;
  z-index: 1;
}
/* The overdue chip's default red-on-red styling (built for light card backgrounds)
   is nearly unreadable against the purple hero gradient — override it here. */
.hero-banner .deadline-chip.overdue {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  animation: none;
}
.hero-banner .deadline-chip.overdue i {
  color: #fecaca;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 500;
}

/* ---- EMPLOYEES ---- */
.employee-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--t);
  box-shadow: var(--shadow-sm);
}
.employee-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.dept-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: all var(--t);
  box-shadow: var(--shadow-sm);
  height: 100%;
}
.dept-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.dept-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}
.dept-icon {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.dept-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.dept-desc {
  font-size: 12.5px;
  color: var(--text3);
  line-height: 1.5;
  margin-bottom: 16px;
  min-height: 36px;
}
.dept-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.dept-head-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.dept-head-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.dept-head-label {
  font-size: 10.5px;
  color: var(--text3);
}
.dept-head-empty {
  font-size: 12.5px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dept-stats {
  display: flex;
  gap: 8px;
}
.dept-stat {
  flex: 1;
  text-align: center;
  background: var(--surface2);
  border-radius: 6px;
  padding: 10px 4px;
}
.dept-stat-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}
.dept-stat-label {
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
}
.dept-designation-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.dept-designation-tag {
  font-size: 10.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--grad-soft);
  color: var(--indigo);
}
.dept-designation-tag-more {
  background: var(--surface2);
  color: var(--text3);
}
.emp-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.emp-avatar-lg {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(47, 111, 237, 0.25);
}
.emp-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.emp-name {
  font-size: 14.5px;
  font-weight: 700;
  margin-bottom: 2px;
}
.emp-designation {
  font-size: 12px;
  color: var(--text3);
}
.emp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.emp-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text2);
}
.emp-meta-item i {
  color: var(--text3);
  font-size: 11px;
}
.emp-actions {
  display: flex;
  gap: 6px;
}
.emp-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.emp-status-dot.active {
  background: #10b981;
}
.emp-status-dot.inactive {
  background: #ef4444;
}
.emp-status-dot.probation {
  background: #f59e0b;
}
.role-badge-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
}
.role-badge-pill.admin {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}
.role-badge-pill.manager {
  background: rgba(124, 58, 237, 0.12);
  color: var(--purple);
}
.role-badge-pill.employee {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}
.emp-avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: white;
  margin: 0 auto;
  box-shadow: 0 6px 20px rgba(47, 111, 237, 0.3);
}

/* ---- ORG CHART ---- */
.org-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.org-level {
  display: flex;
  gap: 24px;
  justify-content: center;
  position: relative;
  margin-bottom: 12px;
}
.org-node {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 18px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  min-width: 140px;
  max-width: 160px;
  transition: all var(--t);
  cursor: pointer;
}
.org-node:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--indigo);
}
.org-node-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: white;
  margin: 0 auto 8px;
}
.org-node-name {
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 3px;
}
.org-node-role {
  font-size: 11px;
  color: var(--text3);
}
.org-connector {
  width: 2px;
  height: 20px;
  background: var(--border);
  margin: 0 auto;
}
.hierarchy-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--indigo);
  margin: 6px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---- TEAM MEMBERS ---- */
.member-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  transition: all var(--t);
  box-shadow: var(--shadow-sm);
}
.member-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.member-avatar-lg {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: white;
  margin: 0 auto 12px;
  box-shadow: 0 4px 14px rgba(47, 111, 237, 0.3);
}
.member-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.member-dept {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 10px;
}
.member-stats {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}
.member-stat-val {
  font-size: 15px;
  font-weight: 700;
}
.member-stat-lbl {
  font-size: 10.5px;
  color: var(--text3);
}

/* ---- ACTIVITY ---- */
.activity-list {
  display: flex;
  flex-direction: column;
}
.activity-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.activity-dot.create {
  background: rgba(47, 111, 237, 0.12);
  color: var(--indigo);
}
.activity-dot.update {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}
.activity-dot.complete {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}
.activity-dot.comment {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan);
}
.activity-dot.close {
  background: rgba(99, 102, 241, 0.12);
  color: #6366f1;
}
.activity-msg {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text2);
}
.activity-msg strong {
  color: var(--text);
  font-weight: 600;
}
.log-entity-tag {
  font-size: 9.5px;
  font-weight: 600;
  padding: 1.5px 7px;
  border-radius: 4px;
  background: var(--surface2);
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ---- DROPDOWNS ---- */
.custom-dropdown {
  position: relative;
}
.dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 9000;
  overflow: hidden;
  animation: dropIn 0.15s ease;
}
@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.dropdown-panel.show {
  display: block;
}
.notif-panel {
  min-width: 320px !important;
}

/* ---- Employee status toggle (list row + details page) ---- */
.status-toggle-wrap {
  position: relative;
  display: inline-block;
}
.status-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 8px 3px 6px;
  cursor: pointer;
  transition: all var(--t);
}
.status-toggle-btn:hover {
  background: var(--surface2);
  border-color: var(--border);
}
.status-toggle-btn span:nth-child(2) {
  font-size: 12px;
  text-transform: capitalize;
  color: var(--text2);
}
.status-toggle-menu {
  display: none;
  position: fixed; /* was `absolute` — inside a scrollable table/card that clips
    overflow, an absolutely-positioned menu gets cut off/hidden. `fixed` + JS-computed
    top/left (see initEmployeesPageEvents in js/app.js) escapes that clipping. */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 140px;
  z-index: 1200;
  overflow: hidden;
  animation: dropIn 0.15s ease;
}
.status-toggle-menu.show {
  display: block;
}
.status-toggle-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  color: var(--text2);
  transition: background var(--t);
}
.status-toggle-option:hover {
  background: var(--surface2);
}
.status-toggle-option.current {
  color: var(--indigo);
  font-weight: 600;
  background: var(--grad-soft);
}
#notif-list {
  max-height: 380px;
  overflow-y: auto;
}
.notif-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-header span {
  font-size: 14px;
  font-weight: 600;
}
.notif-header a {
  font-size: 12px;
  color: var(--indigo);
  cursor: pointer;
  text-decoration: none;
}
.notif-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t);
}
.notif-item:hover {
  background: var(--surface2);
}
.notif-item.unread {
  background: rgba(47, 111, 237, 0.04);
}
.notif-item:last-child {
  border-bottom: none;
}
.notif-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.notif-text {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.5;
}
.notif-time {
  font-size: 11px;
  color: var(--text3);
  margin-top: 3px;
}
.dropdown-item-custom {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: background var(--t);
}
.dropdown-item-custom:hover {
  background: var(--surface2);
  color: var(--text);
}
.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ---- TOAST ---- */
#toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast-notif {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 400px;
  animation: slideInToast 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideInToast {
  from {
    transform: translateX(100px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.toast-icon.success {
  color: #10b981;
}
.toast-icon.warning {
  color: #f59e0b;
}
.toast-icon.error {
  color: #ef4444;
}
.toast-icon.info {
  color: var(--indigo);
}
.toast-text {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}
.toast-close {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
}

/* ---- DONUT ---- */
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-label {
  font-size: 12.5px;
  color: var(--text2);
  flex: 1;
}
.legend-val {
  font-size: 12.5px;
  font-weight: 600;
}

/* ---- SETTINGS ---- */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.settings-section h5 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.settings-section p {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 20px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child {
  border-bottom: none;
}
.settings-row-label {
  font-size: 13.5px;
  font-weight: 500;
}
.settings-row-desc {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}
.toggle-switch {
  width: 40px;
  height: 22px;
  background: var(--surface3);
  border-radius: 99px;
  position: relative;
  cursor: pointer;
  transition: background var(--t);
  flex-shrink: 0;
  border: none;
}
.toggle-switch.on {
  background: var(--indigo);
}
.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform var(--t);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.toggle-switch.on .toggle-knob {
  transform: translateX(18px);
}

/* ---- EMPTY STATE ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px;
  color: var(--text3);
  text-align: center;
}
.empty-icon {
  font-size: 52px;
  margin-bottom: 16px;
  opacity: 0.35;
}
.empty-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text2);
}
.empty-sub {
  font-size: 13px;
}

/* ---- TASK DETAIL (in modal) ---- */
.detail-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: flex-start;
}
.detail-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  min-width: 100px;
  padding-top: 2px;
}
.detail-value {
  font-size: 13px;
  color: var(--text);
  flex: 1;
}
.status-update-bar {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 16px;
}
.status-update-bar label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text2);
  display: block;
  margin-bottom: 8px;
}
.status-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.status-btn {
  padding: 7px 16px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--t);
  font-family: "Poppins", sans-serif;
}
.status-btn.todo {
  border-color: #94a3b8;
  color: #64748b;
  background: rgba(148, 163, 184, 0.1);
}
.status-btn.inprogress {
  border-color: #f59e0b;
  color: #d97706;
  background: rgba(245, 158, 11, 0.1);
}
.status-btn.done {
  border-color: #10b981;
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}
.status-btn.closed {
  border-color: #6366f1;
  color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
}
.status-btn:hover,
.status-btn.active-status {
  color: white;
}
.status-btn.todo:hover,
.status-btn.todo.active-status {
  background: #94a3b8;
}
.status-btn.inprogress:hover,
.status-btn.inprogress.active-status {
  background: #f59e0b;
}
.status-btn.done:hover,
.status-btn.done.active-status {
  background: #10b981;
}
.status-btn.closed:hover,
.status-btn.closed.active-status {
  background: #6366f1;
}
.status-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 992px) {
  #sidebar.mobile-open {
    transform: translateX(0);
  }
  #sidebar .nav-link-custom { flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; padding: 10px 12px; text-align: left; white-space: nowrap; }
  #sidebar .nav-label { font-size: 13.5px; white-space: nowrap; }
  #sidebar .sidebar-badge { display: inline-block; }
  #sidebar .sidebar-footer-info { opacity: 1; width: auto; }
  #sidebar .sidebar-footer-logout { display: flex; }
  #theme-toggle {
    display: none !important;
  }
  /* Bottom-nav's "More" button already opens the sidebar drawer, so the
     topbar hamburger is redundant on phones/tablets — dropping it gives
     the header a cleaner, native-app title-bar feel with no sidebar affordance. */
  .sidebar-toggle {
    display: none !important;
  }
  .kanban-col {
    min-width: 270px;
  }
}
@media (max-width: 576px) {
  #content {
    padding: 16px;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .btn-create span {
    display: none;
  }
  .topbar-right {
    gap: 4px;
  }
}
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  backdrop-filter: blur(2px);
}

/* ---- COLOR PICKER ---- */
.color-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
  position: relative;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected {
  border-color: var(--text);
  transform: scale(1.1);
}
.color-swatch.selected::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.icon-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.icon-picker-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t);
}
.icon-picker-btn:hover {
  border-color: var(--indigo);
  color: var(--indigo);
  transform: translateY(-1px);
}
.icon-picker-btn.selected {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #fff;
  box-shadow: 0 4px 12px rgba(47, 111, 237, 0.3);
}

/* ---- PROJECT STATUS BADGE ---- */
.proj-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 4px;
}
.proj-status-badge.active { background: rgba(16,185,129,0.12); color: #10b981; }
.proj-status-badge.inactive { background: rgba(148,163,184,0.15); color: #94a3b8; }

/* ---- FILE ATTACH IN DETAIL MODAL ---- */
.file-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 6px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
  font-size: 12.5px;
  color: var(--text3);
  margin-top: 8px;
}
.file-upload-zone:hover {
  border-color: var(--indigo);
  background: rgba(47,111,237,0.04);
  color: var(--indigo);
}
.attached-files-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.attached-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--text2);
}
.attached-file-chip button {
  background: none;
  border: none;
  padding: 0;
  color: var(--text3);
  cursor: pointer;
  font-size: 11px;
  margin-left: 2px;
}
.attached-file-chip button:hover { color: #ef4444; }

/* ---- PROJECT CREATOR ROW ---- */
.proj-creator-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text3);
  margin-top: 6px;
}

/* ---- INACTIVE PROJECT CARD ---- */
.project-card-inactive {
  opacity: 0.6;
  filter: grayscale(0.3);
}
.assignee-options-list::-webkit-scrollbar { width: 5px; }
.assignee-options-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
.assignee-option-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.assignee-option-info {
  flex: 1;
  min-width: 0;
}
.assignee-option-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.assignee-option-role {
  font-size: 11px;
  color: var(--text3);
}
.assignee-option-check {
  font-size: 15px;
  color: var(--text3);
}
.assignee-option.selected .assignee-option-check {
  color: var(--indigo);
}

/* ============================================================
   MODAL ATTACHMENT PREVIEW (Create/Edit Task Modal)
============================================================ */
.modal-attachments-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.modal-attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 4px;
  padding: 7px 10px;
  max-width: 240px;
  position: relative;
}
.attachment-preview-wrap {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  flex-shrink: 0;
}
.attachment-thumb {
  width: 36px; height: 36px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
}
.attachment-info {
  flex: 1;
  min-width: 0;
}
.attachment-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attachment-size {
  font-size: 10.5px;
  color: var(--text3);
}
.modal-remove-attachment-btn {
  background: none;
  border: none;
  padding: 2px 4px;
  color: var(--text3);
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  border-radius: 4px;
  transition: color 0.15s;
}
.modal-remove-attachment-btn:hover { color: #ef4444; }

/* ============================================================
   TASK DETAIL ATTACHMENTS GRID
============================================================ */
.attachments-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}
.attached-file-card {
  width: 130px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.attached-file-card:hover {
  border-color: var(--indigo);
  box-shadow: 0 2px 10px rgba(47,111,237,0.12);
}
.attached-file-preview {
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  overflow: hidden;
}
.attachment-thumb-detail {
  width: 100%; height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}
.attachment-icon-box {
  font-size: 30px;
  color: var(--indigo);
  opacity: 0.7;
}
.attached-file-info {
  padding: 6px 8px;
}
.attached-file-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attached-file-size {
  font-size: 10px;
  color: var(--text3);
  margin-top: 1px;
}
.attached-file-card .remove-attachment-btn {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,0.45);
  border: none;
  border-radius: 50%;
  width: 20px; height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.15s;
  padding: 0;
}
.attached-file-card:hover .remove-attachment-btn {
  opacity: 1;
}
.attached-file-card .attachment-download-btn {
  position: absolute;
  top: 4px; right: 28px;
  background: rgba(0,0,0,0.45);
  border: none;
  border-radius: 50%;
  width: 20px; height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.15s;
  padding: 0;
  text-decoration: none;
}
.attached-file-card:hover .attachment-download-btn {
  opacity: 1;
}

/* ============================================================
   IMAGE LIGHTBOX
============================================================ */
.attachment-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.lightbox-content {
  background: var(--surface);
  border-radius: var(--radius);
  width: 92vw;
  max-width: 1100px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
}
.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.lightbox-header span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.lightbox-header a,
.lightbox-header button {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}
.lightbox-header a:hover,
.lightbox-header button:hover { background: var(--surface2); color: var(--text); }

/* Full-width media: fills the lightbox rather than a small capped preview */
.lightbox-media {
  display: block;
  width: 100%;
  max-height: calc(90vh - 50px);
  object-fit: contain;
  background: #0f172a;
}
.lightbox-pdf {
  width: 100%;
  height: calc(90vh - 50px);
  border: none;
  display: block;
}
.lightbox-nopreview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 30px;
  text-align: center;
}
.lightbox-nopreview i {
  font-size: 54px;
  color: var(--indigo);
  opacity: 0.75;
}
.lightbox-nopreview-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  max-width: 420px;
  word-break: break-word;
}
.lightbox-nopreview-sub {
  font-size: 12.5px;
  color: var(--text3);
  margin-bottom: 6px;
}

@media (max-width: 640px) {
  .lightbox-content { width: 96vw; max-height: 94vh; }
  .lightbox-media { max-height: calc(94vh - 50px); }
  .lightbox-pdf { height: calc(94vh - 50px); }
}

/* ============================================================
   FILE UPLOAD ZONE (task modal)
============================================================ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text3);
  font-size: 13px;
}
.upload-zone:hover {
  border-color: var(--indigo);
  color: var(--indigo);
  background: rgba(47,111,237,0.04);
}

/* ============================================================
   EMPLOYEE LIST VIEW TABLE TWEAKS
============================================================ */
#emp-table-body tr td:first-child {
  min-width: 200px;
}

/* ============================================================
   STATUS COMMENT PROMPT
============================================================ */
.status-comment-prompt {
  background: rgba(47,111,237,0.06);
  border: 1.5px solid rgba(47,111,237,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 10px;
}

/* ============================================================
   ASSIGNEE MULTI-SELECT DROPDOWN
============================================================ */
.assignee-multiselect-wrapper {
  position: relative;
}
.assignee-multiselect-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text);
  transition: border-color 0.2s;
  min-height: 42px;
  user-select: none;
}
.assignee-multiselect-trigger:hover {
  border-color: var(--indigo);
}
.assignee-multiselect-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  z-index: 9999;
  max-height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.assignee-dropdown-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.assignee-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  background: var(--surface2);
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 13px;
  color: var(--text3);
}
.assignee-search-wrap input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text);
  width: 100%;
  font-family: inherit;
}
.assignee-select-all-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 5px;
}
.assignee-select-all-btn:hover {
  background: rgba(47,111,237,0.15);
  border-color: var(--indigo);
  color: var(--indigo);
}
.assignee-options-list {
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}
.assignee-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.12s;
}
.assignee-option:hover {
  background: var(--surface2);
}
.assignee-option.selected {
  background: rgba(47,111,237,0.06);
}
.assignee-check-icon { flex-shrink: 0; font-size: 14px; }
.sel-assignee-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(47,111,237,0.1);
  color: var(--indigo);
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  margin: 2px;
}
.sel-assignee-tag button {
  background: none;
  border: none;
  color: var(--indigo);
  cursor: pointer;
  font-size: 11px;
  padding: 0;
  line-height: 1;
}

/* ============================================================
   TASK TABLE ROWS HOVER
============================================================ */
.task-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.task-table tbody tr:last-child { border-bottom: none; }
.task-table tbody tr:hover { background: var(--surface2); }

/* ============================================================
   ATTACHMENT PREVIEW
============================================================ */
.modal-attachments-preview .attachment-preview-item {
  transition: box-shadow 0.15s;
}
.modal-attachments-preview .attachment-preview-item:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* ============================================================
   PROJECT PAGE — SUMMARY STAT PILLS
============================================================ */
.proj-stat-pill {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--pill-color, var(--indigo));
  transition: box-shadow var(--t), transform var(--t);
}
.proj-stat-pill:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.proj-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--pill-color, var(--indigo)) 12%, transparent);
  color: var(--pill-color, var(--indigo));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.proj-stat-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}
.proj-stat-lbl {
  font-size: 12px;
  color: var(--text3);
  font-weight: 500;
  margin-top: 2px;
}

/* ============================================================
   PROJECT CARDS
============================================================ */
.proj-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--t), transform var(--t);
  height: 100%;
}
.proj-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.proj-card-inactive {
  opacity: 0.72;
}
.proj-card-inactive:hover {
  opacity: 1;
}
.proj-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.proj-card-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.proj-card-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 3px;
}
.proj-card-desc {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.proj-card-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}
.proj-card-status-badge.active {
  background: rgba(16,185,129,0.12);
  color: #10b981;
}
.proj-card-status-badge.inactive {
  background: rgba(148,163,184,0.15);
  color: var(--text3);
}
.proj-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}
.proj-card-progress {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.proj-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.proj-pct-label {
  font-size: 13px;
  font-weight: 700;
}
.proj-progress-track {
  width: 100%;
  height: 7px;
  background: var(--surface2);
  border-radius: 6px;
  overflow: hidden;
}
.proj-progress-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}
.proj-card-stats {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.proj-mini-stat {
  flex: 1;
  text-align: center;
}
.proj-mini-num {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
}
.proj-mini-lbl {
  font-size: 10.5px;
  color: var(--text3);
  margin-top: 2px;
}
.proj-mini-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}
.proj-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  margin-top: auto;
}
.proj-avatar-stack {
  display: flex;
  align-items: center;
}
.proj-avatar-item {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  margin-left: -8px;
  flex-shrink: 0;
}
.proj-avatar-item:first-child { margin-left: 0; }
.proj-avatar-more {
  background: var(--surface2);
  color: var(--text2);
  font-size: 9.5px;
  font-weight: 700;
}
.proj-card-actions {
  display: flex;
  gap: 6px;
}
.proj-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.proj-action-btn:hover { background: var(--surface3); color: var(--text); border-color: var(--indigo); }
.proj-action-btn.danger { background: rgba(239,68,68,0.08); color: #ef4444; border-color: rgba(239,68,68,0.2); }
.proj-action-btn.danger:hover { background: rgba(239,68,68,0.15); border-color: #ef4444; }
.proj-action-btn.success { background: rgba(16,185,129,0.08); color: #10b981; border-color: rgba(16,185,129,0.2); }
.proj-action-btn.success:hover { background: rgba(16,185,129,0.15); border-color: #10b981; }

/* ============================================================
   NATIVE-APP MOBILE EXPERIENCE
   Bottom tab bar, full-screen sheets, swipeable kanban, safe areas
============================================================ */

/* ---- Global mobile touch feel ---- */
html {
  -webkit-tap-highlight-color: transparent;
}
body {
/* stop the page-bounce/pull-to-refresh feel */
  font-family: "Poppins", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--t),
    color var(--t);
  overscroll-behavior-y: contain;
}
@media (max-width: 992px) {
  input, select, textarea {
    font-size: 16px !important; /* prevents iOS auto-zoom on focus */
  }
  * {
    -webkit-tap-highlight-color: transparent;
  }
  a, button, .nav-link-custom, .icon-btn, .btn-icon-sm, .task-card, .emp-avatar-sm {
    touch-action: manipulation;
  }
}

/* ---- Bottom Tab Bar ---- */
.bottom-nav {
  display: none;
}
@media (max-width: 992px) {
  :root {
    --bn-height: 58px;
  }
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(var(--bn-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 1050;
    align-items: stretch;
    justify-content: space-around;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
  }
  .bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text3);
    font-size: 10.5px;
    font-weight: 600;
    text-decoration: none;
    padding: 6px 2px 2px;
  }
  .bn-item i {
    font-size: 20px;
  }
  .bn-item.active {
    color: var(--indigo);
  }
  .bn-fab-wrap {
    flex: 0 0 auto;
    width: 58px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
  }
  .bn-fab {
    width: 50px;
    height: 50px;
    margin-top: -22px;
    border-radius: 50%;
    border: 4px solid var(--bg);
    background: linear-gradient(135deg, #2f6fed, #1d4fd1);
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(47,111,237,0.4);
  }
  .bn-fab:active {
    transform: scale(0.94);
  }

  /* Leave room so content never sits behind the bar */
  #main {
  margin-left: 0 !important;
  padding-bottom: calc(var(--bn-height) + env(safe-area-inset-bottom) + 8px);
}
}

/* ---- "More" bottom sheet — native app style, not a sidebar drawer ----
   Slides up from the bottom edge and sits above the tab bar (covering it
   while open), instead of the sidebar's side-drawer pattern which reads as
   a website nav rather than a mobile app menu. */
.mms-backdrop, .mms-sheet {
  display: none;
}
@media (max-width: 992px) {
  .mms-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .mms-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }
  .mms-sheet {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1201;
    background: var(--surface);
    border-radius: 6px 6px 0 0;
    box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.22);
    padding: 10px 8px calc(14px + env(safe-area-inset-bottom));
    max-height: 78vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  }
  .mms-sheet.show {
    transform: translateY(0);
  }
  .mms-handle {
    width: 36px;
    height: 4px;
    border-radius: 6px;
    background: var(--border);
    margin: 2px auto 12px;
  }
  .mms-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px 16px;
    margin: 0 4px 8px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
  }
  .mms-user-info {
    flex: 1;
    min-width: 0;
  }
  .mms-user-name {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
  }
  .mms-user-email {
    font-size: 12px;
    color: var(--text3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mms-user > i {
    color: var(--text3);
    font-size: 15px;
  }
  .mms-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 4px;
  }
  .mms-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 12px;
    border-radius: 6px;
    color: var(--text2);
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 500;
    transition: background 0.15s;
  }
  .mms-item i {
    font-size: 17px;
    width: 20px;
    text-align: center;
    color: var(--text3);
  }
  .mms-item:active {
    background: var(--surface2);
  }
  .mms-item.active {
    color: var(--indigo);
    background: var(--grad-soft);
  }
  .mms-item.active i {
    color: var(--indigo);
  }
  .mms-logout {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    margin: 10px 4px 0;
    border-radius: 6px;
    color: #ef4444;
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 600;
  }
  .mms-logout:active {
    background: rgba(239, 68, 68, 0.08);
  }
  .mms-logout i {
    font-size: 17px;
    width: 20px;
    text-align: center;
  }
}

/* ---- Topbar: condensed on mobile, app-like ---- */
@media (max-width: 992px) {
  #topbar {
    /* Stays position:fixed (inherited from the base rule) — was position:sticky
       here previously, which is no longer needed now that #topbar sits outside
       the sidebar+content row entirely; fixed keeps it full-width and pinned
       above everything (sidebar included) consistently at every breakpoint. */
    z-index: 1100;
    /* The header previously had a FIXED height (var(--topbar-h)) with extra
       top padding added on top for the phone's notch/status-bar safe area.
       Since box-sizing is border-box, that padding ate directly into the
       fixed height instead of adding to it — on notched phones (44–59px
       inset) this squeezed the content row down to almost nothing, clipping
       the logo and icons. Extending the height by the inset (and using only
       the inset as padding) keeps the original 64px of usable content space
       and simply adds the safe area on top of it. */
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }
  /* Sidebar and the #app padding that pushes #main down both need the same
     safe-area-aware offset, or they'd start underneath the taller mobile
     topbar (or leave an unwanted gap on non-notched phones). */
  #app {
    padding-top: calc(var(--topbar-h) + env(safe-area-inset-top));
  }
  #topbar .search-bar {
    max-width: 140px;
  }
  #btn-create-task {
    display: none; /* replaced by the bottom-nav FAB on mobile */
  }
}
@media (max-width: 576px) {
  #topbar .search-bar {
    display: none;
  }
  #mobile-search-btn {
    display: inline-flex !important;
  }
  #topbar .search-bar.mobile-search-active {
    display: flex !important;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1101;
    border-radius: 0;
    max-width: none;
    padding: calc(10px + env(safe-area-inset-top)) 50px 10px 16px;
    background: var(--surface);
    border: none;
    border-bottom: 1px solid var(--border);
  }
  #topbar .search-bar.mobile-search-active .search-kbd-hint {
    display: none;
  }
  .mobile-search-close {
    display: none;
    position: fixed;
    top: calc(10px + env(safe-area-inset-top));
    right: 12px;
    z-index: 1102;
    background: none;
    border: none;
    color: var(--text2);
    font-size: 16px;
    padding: 6px;
  }
  #topbar .search-bar.mobile-search-active .mobile-search-close {
    display: block;
  }
}
#mobile-search-btn {
  display: none;
}
.mobile-search-close {
  display: none;
}

/* ---- Sidebar becomes a full drawer on mobile ---- */
@media (max-width: 992px) {
  #sidebar {
  /* Must stay BELOW the topbar's z-index (1100) — equal values fall back
     to DOM order, and since #sidebar comes after #topbar in the markup it
     would render on top and hide the logo/topbar controls. And no extra
     padding-top for the safe-area inset here — `top` above already
     includes it, so adding it again as padding would double-count it and
     push the first nav item down by an extra notch-height for nothing. */
  width: var(--sidebar-w) !important;
  transform: translateX(-100%);
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  z-index: 1090;
  box-shadow: 8px 0 24px rgba(0,0,0,0.15);
}
}

/* ---- Modals become full-screen sheets on small phones ---- */
@media (max-width: 576px) {
  .modal-dialog {
    margin: 0;
    max-width: 100%;
    height: 100dvh;
  }
  .modal-content {
    height: 100%;
    border-radius: 0;
  }
  .modal-body {
    max-height: none;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .modal.fade .modal-dialog {
    transform: translateY(24px);
  }
  .modal.show .modal-dialog {
    transform: translateY(0);
  }
}

/* ---- Kanban: swipeable, one column at a time ---- */
@media (max-width: 768px) {
  #kanban-view .kanban-wrapper {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .kanban-col {
    min-width: 86vw;
    scroll-snap-align: start;
  }
}

/* ---- Tables: card-list layout on phones/tablets (native-app feel instead of a
   cramped horizontally-scrolling spreadsheet) ---- */
@media (max-width: 768px) {
  .data-table {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
  }
  .data-table table {
    width: 100%;
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 10px;
  }
  .data-table thead {
    display: none;
  }
  .data-table tbody tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 10px);
    box-shadow: var(--shadow-sm);
    padding: 12px 14px;
  }
  .data-table tbody tr:hover {
    background: var(--surface);
  }
  .data-table tbody td {
    display: block;
    padding: 7px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 12.5px;
    text-align: left;
  }
  .data-table tbody td:last-child {
    border-bottom: none;
  }
  .data-table tbody td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text3);
    margin-bottom: 4px;
  }
  .data-table tbody td.td-primary {
    padding: 0 0 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
  }
  .data-table tbody td.td-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
    border-bottom: none;
  }
  .data-table tbody td.td-actions:empty {
    display: none;
    padding: 0;
  }
  .data-table tbody td[colspan] {
    display: block;
    text-align: left;
    padding: 4px 0;
  }
  /* Value wrappers (e.g. the project progress bar) often carry an inline
     min-width for desktop layout — let them shrink to fit inside a card. */
  .data-table tbody td > div {
    min-width: 0 !important;
  }
}

/* ---- Dropdown panels (notifications/profile) anchored under the topbar on phones ----
   Previously these were pinned as "bottom sheets" near the bottom-nav, which made the
   notification panel look like it was stuck at the bottom of the screen. Anchoring them
   just below the header (native app "tray" pattern) keeps them near the icon that opened
   them and fully on-screen regardless of scroll position. */
@media (max-width: 576px) {
  .dropdown-panel {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    top: calc(var(--topbar-h) + env(safe-area-inset-top) + 8px) !important;
    bottom: auto !important;
    width: auto !important;
    max-width: none !important;
    max-height: calc(100vh - var(--topbar-h) - env(safe-area-inset-top) - var(--bn-height, 58px) - env(safe-area-inset-bottom) - 24px);
    overflow-y: auto;
  }
}

/* ---- Stat cards / grids: comfortable single/double column on phones ---- */
@media (max-width: 576px) {
  .hero-banner {
  padding: 20px;
  border-radius: var(--radius);
}
  .page-title {
    font-size: 19px;
  }
  .filters-bar {
    flex-wrap: wrap;
  }
  .filters-bar .search-bar {
    max-width: 100% !important;
    flex: 1 1 100%;
  }
  .filters-bar .filter-select {
    flex: 1 1 100%;
    width: 100%;
  }
}

/* ---- Dashboard stat cards: horizontal swipeable row on phones ----
   Native apps surface top-line stats as a swipeable card strip rather than a
   cramped 2-column grid. Overrides Bootstrap's .row/.col- via the #id so it
   wins without !important soup. Cards are compact/rectangular (not the tall
   desktop card) so ~2.5 fit on screen at once, still peeking at the edge to
   hint scrollability. */
@media (max-width: 576px) {
  #dashboard-stats {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
    margin: 0 -16px 24px;
    padding: 2px 16px 6px;
  }
  #dashboard-stats::-webkit-scrollbar {
    display: none;
  }
  #dashboard-stats > [class*="col-"] {
    flex: 0 0 46%;
    max-width: 46%;
    scroll-snap-align: start;
  }
  #dashboard-stats .stat-card {
    height: 100%;
    padding: 12px 14px;
    border-radius: 6px
  }
  #dashboard-stats .stat-card-row {
    gap: 10px;
    margin-bottom: 6px;
  }
  #dashboard-stats .stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 15px;
  }
  #dashboard-stats .stat-value {
    font-size: 19px;
  }
  #dashboard-stats .stat-label {
    font-size: 10.5px;
  }
  #dashboard-stats .stat-change {
    top: 12px;
    right: 12px;
    font-size: 9.5px;
    padding: 2px 6px;
  }
}

/* ---- Org chart / wide diagrams: allow horizontal pan on phones ---- */
@media (max-width: 768px) {
  #org-chart-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ---- Assignee dropdown & other floating panels: keep on-screen on phones ----
   Positioning on mobile is now handled directly in JS (positionAssigneeDropdown()
   in js/app.js), which anchors the panel to the trigger's real position and
   re-anchors on scroll/resize — a plain CSS media-query rule can't do that
   inside a scrollable modal, which is what caused the dropdown to render far
   from the field it belongs to. */

/* ---- Pagination bar ---- */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 4px 4px;
  font-size: 12.5px;
  color: var(--text3);
}
.pagination-bar .pg-info {
  white-space: nowrap;
}
.pagination-bar .pg-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.pagination-bar .pg-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.pagination-bar .pg-btn.active {
  background: linear-gradient(135deg, #2f6fed, #1d4fd1);
  color: #fff;
  border-color: transparent;
}
.pagination-bar .pg-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================================
   @mention dropdown (comment inputs)
============================================================ */
.user-avatar-xs {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 10px;
  flex-shrink: 0;
}
.mention-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: 260px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 10px);
  box-shadow: 0 10px 30px rgba(0,0,0,.14);
  z-index: 40;
}
.mention-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
}
.mention-option:hover {
  background: var(--surface2);
}
.mention-tag {
  color: var(--indigo, #2f6fed);
  font-weight: 600;
  background: rgba(47,111,237,0.1);
  border-radius: 4px;
  padding: 0 3px;
}

/* ============================================================
   Global search results dropdown (topbar)
============================================================ */
.search-bar {
  flex: 1;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 16px;
  transition: all var(--t);
  position: relative;
}
.global-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 380px;
  max-width: 90vw;
  max-height: 420px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 10px);
  box-shadow: 0 16px 40px rgba(0,0,0,.16);
  z-index: 50;
  display: none;
}
.gsr-group-label {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text3);
}
.gsr-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
}
.gsr-item:hover {
  background: var(--surface2);
}
.gsr-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  color: #fff;
}
.gsr-title {
  font-weight: 600;
  color: var(--text);
}
.gsr-sub {
  font-size: 11.5px;
  color: var(--text3);
}
.gsr-empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
}

/* ============================================================
   Reports — data tables
============================================================ */
.report-table-wrap {
  overflow-x: auto;
  margin-top: 6px;
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.report-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text3);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.report-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
.report-table tr:last-child td { border-bottom: none; }
.report-pct {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 11.5px;
}
.report-pct.good { background: rgba(16,185,129,.12); color: #10b981; }
.report-pct.mid  { background: rgba(245,158,11,.12); color: #f59e0b; }
.report-pct.bad  { background: rgba(239,68,68,.12);  color: #ef4444; }

/* ============================================================
   Task detail — activity/history timeline
============================================================ */
.activity-timeline {
  position: relative;
  padding-left: 22px;
}
.activity-timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 4px; bottom: 4px;
  width: 2px;
  background: var(--border);
}
.activity-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
  padding-bottom: 16px;
  font-size: 12.5px;
}
.activity-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.activity-item::before {
  content: '';
  position: absolute;
  left: -22px; top: 3px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--indigo, #2f6fed);
  border: 2px solid var(--surface);
}
.activity-desc { color: var(--text); }
.activity-time {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}

/* Print-friendly reports (Export → Print / Save as PDF) */
@media print {
  #sidebar, .topbar, .bottom-nav, .page-header button, .page-header .dropdown,
  .modal, #toast-container { display: none !important; }
  #content { margin: 0 !important; padding: 0 !important; }
  .chart-card, .stat-card { break-inside: avoid; box-shadow: none !important; border: 1px solid #ddd; }
}

/* ============================================================
   Dashboard — equal-height cards without leftover blank space
============================================================ */
.dash-equal-row .chart-card.h-100 {
  display: flex;
  flex-direction: column;
}
.dash-equal-row .chart-card-fill {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.dash-equal-row .chart-card-fill:has(.progress-item),
.dash-equal-row .chart-card-fill:has(.activity-item) {
  justify-content: flex-start;
}

/* ============================================================
   Status-change log entries shown inline in the Comments feed
============================================================ */
.comment-item.comment-system {
  opacity: 0.9;
}
.comment-avatar-system {
  background: var(--surface2) !important;
  color: var(--text3) !important;
  font-size: 13px;
}
.comment-text-system {
  font-style: italic;
  color: var(--text3);
  font-size: 12.5px;
}

/* ============================================================
   Keyboard shortcut hint (Ctrl K) inside the search bar
============================================================ */
.search-kbd-hint {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  flex-shrink: 0;
}
.search-bar:focus-within .search-kbd-hint {
  display: none;
}
@media (max-width: 992px) {
  .search-kbd-hint { display: none; }
}

/* ============================================================
   Saved filters ("Views") dropdown on the Tasks page
============================================================ */
.saved-filter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  font-size: 12.5px;
}
.saved-filter-item:hover {
  background: var(--surface2);
}
.saved-filter-name {
  cursor: pointer;
  flex: 1;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.saved-filter-name i {
  color: var(--indigo, #2f6fed);
  font-size: 11px;
  margin-right: 4px;
}
.saved-filter-delete {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
}
.saved-filter-delete:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

/* ============================================================
   AI Assistant — floating chat widget
============================================================ */
#ai-assistant-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2f6fed, #1d4fd1);
  color: #fff;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(47, 111, 237, 0.4);
  z-index: 1040;
  transition: transform 0.15s ease;
}
#ai-assistant-launcher:hover {
  transform: scale(1.06);
}
#ai-assistant-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 350px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 100px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  z-index: 1040;
  flex-direction: column;
  overflow: hidden;
}
.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #2f6fed, #1d4fd1);
  color: #fff;
  flex-shrink: 0;
}
.ai-panel-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.ai-panel-title {
  font-size: 13.5px;
  font-weight: 700;
}
.ai-panel-sub {
  font-size: 10.5px;
  opacity: 0.85;
}
#ai-panel-close {
  background: none;
  border: none;
  color: #fff;
  opacity: 0.85;
  cursor: pointer;
  font-size: 14px;
}
#ai-panel-close:hover {
  opacity: 1;
}
.ai-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-msg-bot {
  align-self: flex-start;
  background: var(--surface2);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.ai-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #2f6fed, #1d4fd1);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-msg-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 14px;
}
.ai-msg-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text3);
  animation: aiTypingBounce 1.2s infinite ease-in-out;
}
.ai-msg-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-msg-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes aiTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}
.ai-panel-input-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ai-panel-input-row input {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 4px;
  padding: 8px 14px;
  font-size: 12.5px;
  color: var(--text);
  outline: none;
}
.ai-panel-input-row input:focus {
  border-color: var(--indigo, #2f6fed);
}
.ai-panel-input-row button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2f6fed, #1d4fd1);
  color: #fff;
  border: none;
  flex-shrink: 0;
  cursor: pointer;
}
.ai-panel-input-row button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
@media (max-width: 992px) {
  #ai-assistant-panel {
    bottom: calc(var(--bn-height, 58px) + env(safe-area-inset-bottom) + 12px);
    max-height: calc(100vh - var(--bn-height, 58px) - 120px);
  }
  #ai-assistant-launcher {
    bottom: calc(var(--bn-height, 58px) + env(safe-area-inset-bottom) + 12px);
  }
}
@media (max-width: 576px) {
  #ai-assistant-panel {
    right: 12px;
    width: calc(100vw - 24px);
  }
  #ai-assistant-launcher {
    right: 16px;
  }
}

/* ============================================================
   SKELETON LOADER — shown in #content while the initial data fetch
   (loadAllData()'s Promise.all in js/data.js) is still in flight, so the
   person sees an instant page-shaped placeholder instead of a blank white
   screen. Composed from a handful of reusable shapes (js/skeleton.js
   picks the right combination per page) rather than one skeleton per page.
============================================================ */
.skel {
  position: relative;
  overflow: hidden;
  background: var(--surface2);
  border-radius: var(--radius-sm);
}
.skel::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: skel-shimmer 1.4s infinite;
}
html[data-theme="dark"] .skel::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}
@keyframes skel-shimmer {
  100% { transform: translateX(100%); }
}
.skel-line { height: 12px; margin-bottom: 8px; }
.skel-line.w-40 { width: 40%; }
.skel-line.w-60 { width: 60%; }
.skel-line.w-80 { width: 80%; }
.skel-line.w-100 { width: 100%; }
.skel-title { height: 18px; width: 45%; margin-bottom: 14px; }
.skel-circle { border-radius: 50%; flex-shrink: 0; }
.skel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.skel-stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }
.skel-stat-card { display: flex; align-items: center; gap: 12px; }
.skel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.skel-kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.skel-kanban-col { flex: 1; min-width: 260px; }
.skel-kanban-card { height: 88px; margin-bottom: 12px; border-radius: var(--radius); }
.skel-table-row { display: flex; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }

