/* ==========================================================================
   TaskFlow - Notion-inspired UI layer on top of Bootstrap 5.3
   ========================================================================== */

:root,
[data-bs-theme='light'] {
  --tf-bg: #ffffff;
  --tf-bg-subtle: #fbfbfa;
  --tf-sidebar: #f7f7f5;
  --tf-surface: #ffffff;
  --tf-border: #e9e9e7;
  --tf-border-strong: #dcdcd9;
  --tf-text: #37352f;
  --tf-muted: #787774;
  --tf-faint: #a5a49f;
  --tf-hover: rgba(55, 53, 47, 0.06);
  --tf-active: rgba(55, 53, 47, 0.09);
  --tf-accent: #2383e2;
  --tf-accent-soft: rgba(35, 131, 226, 0.1);
  --tf-shadow: 0 1px 2px rgba(15, 15, 15, 0.04), 0 2px 8px rgba(15, 15, 15, 0.04);
  --tf-shadow-lg: 0 8px 28px rgba(15, 15, 15, 0.12);

  /* Status */
  --st-todo-bg: #e9e9e7;   --st-todo-fg: #4b4a46;
  --st-progress-bg: #d3e5ef; --st-progress-fg: #1b4a68;
  --st-blocked-bg: #ffe2dd; --st-blocked-fg: #8a2a1f;
  --st-done-bg: #dbeddb;   --st-done-fg: #1f5130;

  /* Priority */
  --pr-low-bg: #f1f1ef;    --pr-low-fg: #6b6a66;
  --pr-medium-bg: #e7f0fb; --pr-medium-fg: #1f5c99;
  --pr-high-bg: #fdecc8;   --pr-high-fg: #7a4a0c;
  --pr-urgent-bg: #ffe2dd; --pr-urgent-fg: #a3271b;

  --tf-danger: #d44c47;
  --tf-warning: #cb912f;
  --tf-success: #448361;

  --bs-body-bg: var(--tf-bg);
  --bs-body-color: var(--tf-text);
  --bs-border-color: var(--tf-border);
  --bs-link-color: var(--tf-text);
  --bs-link-color-rgb: 55, 53, 47;
  --bs-link-hover-color: var(--tf-accent);
  --bs-primary: #2f3437;
  --bs-primary-rgb: 47, 52, 55;
  --bs-secondary-color: var(--tf-muted);
  --bs-tertiary-bg: var(--tf-sidebar);
  --bs-focus-ring-color: rgba(35, 131, 226, 0.35);
}

[data-bs-theme='dark'] {
  /* Midnight blue / slate: navy sidebar, blue-grey page, lighter slate cards. */
  --tf-bg: #1c2333;
  --tf-bg-subtle: #222b3e;
  --tf-sidebar: #161c2a;
  --tf-surface: #253047;
  --tf-border: #323f5a;
  --tf-border-strong: #41506f;
  --tf-text: #e7ecf6;
  --tf-muted: #a1aec7;
  --tf-faint: #73819e;
  --tf-hover: rgba(148, 172, 230, 0.09);
  --tf-active: rgba(148, 172, 230, 0.16);
  --tf-accent: #7cb4ff;
  --tf-accent-soft: rgba(124, 180, 255, 0.18);
  --tf-shadow: 0 1px 2px rgba(5, 10, 25, 0.35);
  --tf-shadow-lg: 0 10px 30px rgba(5, 10, 25, 0.5);

  --st-todo-bg: #34415c;   --st-todo-fg: #d6deee;
  --st-progress-bg: #1d3d63; --st-progress-fg: #a6cdfa;
  --st-blocked-bg: #4f2834; --st-blocked-fg: #f7a8b1;
  --st-done-bg: #1d4436;   --st-done-fg: #93dbb4;

  --pr-low-bg: #34415c;    --pr-low-fg: #bcc7dc;
  --pr-medium-bg: #1f3a60; --pr-medium-fg: #a6cdfa;
  --pr-high-bg: #4b3a1a;   --pr-high-fg: #f4c96e;
  --pr-urgent-bg: #4f2834; --pr-urgent-fg: #f7a8b1;

  --tf-danger: #f07a85;
  --tf-warning: #f0bd5e;
  --tf-success: #6fd0a0;

  --bs-body-bg: var(--tf-bg);
  --bs-body-color: var(--tf-text);
  --bs-border-color: var(--tf-border);
  --bs-link-color: var(--tf-text);
  --bs-link-color-rgb: 231, 236, 246;
  --bs-primary: #e7ecf6;
  --bs-primary-rgb: 231, 236, 246;
  --bs-tertiary-bg: var(--tf-sidebar);
  --bs-secondary-bg: var(--tf-surface);
  --bs-form-control-bg: var(--tf-surface);
}

/* ---------- Base ---------- */
html, body { height: 100%; }
body {
  font-family: Inter, ui-sans-serif, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  background: var(--tf-bg);
  color: var(--tf-text);
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; }
a:hover { text-decoration: none; }
::selection { background: var(--tf-accent-soft); }
.text-muted, .text-body-secondary { color: var(--tf-muted) !important; }
.text-faint { color: var(--tf-faint); }
.small-caps { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--tf-muted); }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 2000; background: var(--tf-surface); padding: 8px 12px; border-radius: 6px; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--tf-accent); outline-offset: 2px; }
.btn:focus-visible, .form-control:focus, .form-select:focus { box-shadow: 0 0 0 3px var(--bs-focus-ring-color); outline: none; }

/* ---------- Buttons & forms ---------- */
.btn { border-radius: 6px; font-weight: 500; font-size: 14px; }
.btn-sm { font-size: 13px; }
.btn-dark, .btn-primary {
  --bs-btn-bg: #2f3437; --bs-btn-border-color: #2f3437; --bs-btn-color: #fff;
  --bs-btn-hover-bg: #1f2326; --bs-btn-hover-border-color: #1f2326; --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #151719; --bs-btn-active-border-color: #151719;
  --bs-btn-disabled-bg: #2f3437; --bs-btn-disabled-border-color: #2f3437;
}
[data-bs-theme='dark'] .btn-dark, [data-bs-theme='dark'] .btn-primary {
  --bs-btn-bg: #3b82f6; --bs-btn-border-color: #3b82f6; --bs-btn-color: #ffffff;
  --bs-btn-hover-bg: #5193f8; --bs-btn-hover-border-color: #5193f8; --bs-btn-hover-color: #ffffff;
  --bs-btn-active-bg: #2f6fd8; --bs-btn-active-border-color: #2f6fd8; --bs-btn-active-color: #ffffff;
  --bs-btn-disabled-bg: #3b82f6; --bs-btn-disabled-border-color: #3b82f6; --bs-btn-disabled-color: #ffffff;
}
[data-bs-theme='dark'] .quick-filter.active { background: #3b82f6; border-color: #3b82f6; color: #ffffff; }
[data-bs-theme='dark'] .pagination { --bs-pagination-active-bg: #3b82f6; --bs-pagination-active-border-color: #3b82f6; --bs-pagination-active-color: #ffffff; }
.btn-ghost { --bs-btn-color: var(--tf-text); --bs-btn-hover-bg: var(--tf-hover); --bs-btn-active-bg: var(--tf-active); --bs-btn-hover-color: var(--tf-text); border: 1px solid transparent; }
.btn-outline-subtle { --bs-btn-color: var(--tf-text); --bs-btn-border-color: var(--tf-border-strong); --bs-btn-hover-bg: var(--tf-hover); --bs-btn-hover-border-color: var(--tf-border-strong); --bs-btn-hover-color: var(--tf-text); --bs-btn-active-bg: var(--tf-active); --bs-btn-active-border-color: var(--tf-border-strong); background: var(--tf-surface); }
.btn-icon { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.form-control, .form-select { border-color: var(--tf-border-strong); border-radius: 6px; font-size: 14px; background-color: var(--tf-surface); color: var(--tf-text); }
.form-control::placeholder { color: var(--tf-faint); }
.form-label { font-weight: 500; font-size: 13px; margin-bottom: 6px; }
.form-text { color: var(--tf-muted); font-size: 12px; }
.invalid-feedback { font-size: 12px; }
.required::after { content: ' *'; color: var(--tf-danger); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--tf-sidebar); border-right: 1px solid var(--tf-border);
}
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.sidebar .offcanvas-body { display: flex; flex-direction: column; padding: 12px 10px; height: 100%; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; font-weight: 700; font-size: 15px; color: var(--tf-text); }
.brand:hover { color: var(--tf-text); }
.logo { display: inline-flex; align-items: center; gap: 9px; line-height: 1; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #2f3437 0%, #4b5563 100%); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 800; letter-spacing: -0.04em;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}
.logo-word { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; color: var(--tf-text); }
.logo-accent { color: #2383e2; }
.logo-lg .brand-mark { width: 38px; height: 38px; border-radius: 10px; font-size: 15px; }
.logo-lg .logo-word { font-size: 21px; }
[data-bs-theme='dark'] .brand-mark { background: linear-gradient(135deg, #5b9bff 0%, #2f6fd8 100%); color: #ffffff; box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35); }
[data-bs-theme='dark'] .logo-accent { color: #7cb4ff; }
.nav-section { margin-top: 14px; }
.nav-section-title { padding: 4px 10px; font-size: 11px; font-weight: 600; color: var(--tf-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 6px; color: var(--tf-muted); font-weight: 500; margin: 1px 0;
  transition: background 0.12s ease, color 0.12s ease;
}
.side-link i { font-size: 16px; width: 18px; text-align: center; }
.side-link:hover { background: var(--tf-hover); color: var(--tf-text); }
.side-link.active { background: var(--tf-active); color: var(--tf-text); }
.side-link .badge { margin-left: auto; }
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--tf-border); }
.btn-logout { width: 100%; text-align: left; background: transparent; border: 0; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1020; background: color-mix(in srgb, var(--tf-bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--tf-border);
  display: flex; align-items: center; gap: 10px; padding: 10px 24px; min-height: 56px;
}
.topbar-search { flex: 1; max-width: 420px; position: relative; }
.topbar-search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--tf-faint); }
.topbar-search input { padding-left: 32px; background: var(--tf-bg-subtle); border-color: var(--tf-border); height: 34px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.bell { position: relative; }
.bell .count {
  position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--tf-danger); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.app-content { padding: 28px 32px 48px; flex: 1; outline: none; }
.app-footer { padding: 16px 32px; font-size: 12px; color: var(--tf-faint); border-top: 1px solid var(--tf-border); }
@media (max-width: 991.98px) {
  .sidebar { width: 280px; }
  .topbar { padding: 10px 14px; }
  .app-content { padding: 20px 16px 40px; }
  .app-footer { padding: 14px 16px; }
}

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.page-subtitle { color: var(--tf-muted); margin: 4px 0 0; }
.breadcrumb-lite { font-size: 13px; color: var(--tf-muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.breadcrumb-lite a { color: var(--tf-muted); }
.breadcrumb-lite a:hover { color: var(--tf-text); }

/* ---------- Cards ---------- */
.tf-card { background: var(--tf-surface); border: 1px solid var(--tf-border); border-radius: 10px; box-shadow: var(--tf-shadow); }
.tf-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--tf-border); }
.tf-card-title { font-size: 14px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.tf-card-body { padding: 16px; }
.tf-card-link { font-size: 12px; color: var(--tf-muted); }
.tf-card-link:hover { color: var(--tf-accent); }

.stat-card {
  display: block; padding: 16px; border: 1px solid var(--tf-border); border-radius: 10px; background: var(--tf-surface);
  color: var(--tf-text); transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease; height: 100%;
}
.stat-card:hover { border-color: var(--tf-border-strong); box-shadow: var(--tf-shadow-lg); transform: translateY(-1px); color: var(--tf-text); }
.stat-card .label { font-size: 12px; color: var(--tf-muted); display: flex; align-items: center; gap: 6px; font-weight: 500; }
.stat-card .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; line-height: 1; }
.stat-card .icon { width: 28px; height: 28px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.tone-neutral { background: var(--st-todo-bg); color: var(--st-todo-fg); }
.tone-blue { background: var(--st-progress-bg); color: var(--st-progress-fg); }
.tone-red { background: var(--st-blocked-bg); color: var(--st-blocked-fg); }
.tone-green { background: var(--st-done-bg); color: var(--st-done-fg); }
.tone-yellow { background: var(--pr-high-bg); color: var(--pr-high-fg); }
.tone-purple { background: #ece4f7; color: #5a3d86; }
[data-bs-theme='dark'] .tone-purple { background: #3a2d4d; color: #c9b3ec; }

/* ---------- Badges ---------- */
.badge-status, .badge-priority {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; white-space: nowrap; line-height: 1.6;
}
.badge-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.status-todo { background: var(--st-todo-bg); color: var(--st-todo-fg); }
.status-in_progress { background: var(--st-progress-bg); color: var(--st-progress-fg); }
.status-blocked { background: var(--st-blocked-bg); color: var(--st-blocked-fg); }
.status-completed { background: var(--st-done-bg); color: var(--st-done-fg); }
.priority-low { background: var(--pr-low-bg); color: var(--pr-low-fg); }
.priority-medium { background: var(--pr-medium-bg); color: var(--pr-medium-fg); }
.priority-high { background: var(--pr-high-bg); color: var(--pr-high-fg); }
.priority-urgent { background: var(--pr-urgent-bg); color: var(--pr-urgent-fg); font-weight: 600; }
.tag-chip { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 4px; background: var(--tf-hover); color: var(--tf-muted); font-size: 11.5px; margin: 1px 2px 1px 0; }
.tag-chip:hover { color: var(--tf-text); background: var(--tf-active); }
.category-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--tf-muted); white-space: nowrap; }
.category-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--dot, #94a3b8); flex-shrink: 0; }
.badge-soft { background: var(--tf-hover); color: var(--tf-muted); font-weight: 500; border-radius: 4px; }
.badge-inactive { background: var(--st-blocked-bg); color: var(--st-blocked-fg); font-weight: 500; border-radius: 4px; font-size: 10.5px; padding: 1px 6px; }
.badge-pending { background: var(--pr-high-bg); color: var(--pr-high-fg); font-weight: 500; border-radius: 4px; font-size: 10.5px; padding: 1px 6px; }

/* ---------- Working today & sharing ---------- */
.working-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 4px; font-size: 11.5px; font-weight: 500;
  background: #fff3c4; color: #7a5a00; white-space: nowrap;
}
[data-bs-theme='dark'] .working-chip { background: #4a3b10; color: #f2cf63; }
.btn-working { --bs-btn-color: var(--tf-text); --bs-btn-border-color: var(--tf-border-strong); --bs-btn-hover-bg: #fff3c4; --bs-btn-hover-border-color: #e9c44a; --bs-btn-hover-color: #7a5a00; background: var(--tf-surface); }
.btn-working.active, .btn-working.active:hover { background: #fff3c4; border-color: #e9c44a; color: #7a5a00; }
[data-bs-theme='dark'] .btn-working { --bs-btn-hover-bg: #4a3b10; --bs-btn-hover-color: #f2cf63; --bs-btn-hover-border-color: #8a6d1d; }
[data-bs-theme='dark'] .btn-working.active { background: #4a3b10; border-color: #8a6d1d; color: #f2cf63; }
.share-picker { border: 1px solid var(--tf-border-strong); border-radius: 6px; background: var(--tf-surface); }
.share-picker.is-invalid { border-color: var(--bs-form-invalid-border-color); }
.share-picker .share-filter { border: 0; border-bottom: 1px solid var(--tf-border); border-radius: 6px 6px 0 0; }
.share-list { max-height: 190px; overflow-y: auto; padding: 4px; }
.share-option { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 5px; cursor: pointer; font-size: 13.5px; min-width: 0; }
.share-option:hover { background: var(--tf-hover); }
.share-option .form-check-input { margin: 0; flex-shrink: 0; }

/* ---------- Avatars ---------- */
.avatar {
  --size: 24px; width: var(--size); height: var(--size); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: calc(var(--size) * 0.42); font-weight: 600; flex-shrink: 0; color: hsl(var(--hue), 45%, 30%); background: hsl(var(--hue), 60%, 88%);
}
[data-bs-theme='dark'] .avatar { color: hsl(var(--hue), 70%, 88%); background: hsl(var(--hue), 35%, 36%); }
.avatar.inactive { filter: grayscale(1); opacity: 0.6; }
.avatar-lg { --size: 40px; }
.avatar-sm { --size: 20px; }
.user-chip { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--tf-text); }
.user-chip:hover { color: var(--tf-accent); }

/* ---------- Deadlines ---------- */
.deadline { white-space: nowrap; font-size: 13px; }
.deadline.overdue { color: var(--tf-danger); font-weight: 600; }
.deadline.today { color: var(--tf-warning); font-weight: 600; }
.deadline.done { color: var(--tf-faint); text-decoration: line-through; }

/* ---------- Task table ---------- */
.table-wrap { border: 1px solid var(--tf-border); border-radius: 10px; background: var(--tf-surface); overflow: hidden; }
.table-scroll { overflow-x: auto; }
.task-table { margin: 0; --bs-table-bg: transparent; --bs-table-hover-bg: var(--tf-hover); color: var(--tf-text); font-size: 13.5px; }
.task-table thead th {
  font-size: 12px; font-weight: 500; color: var(--tf-muted); background: var(--tf-bg-subtle); border-bottom: 1px solid var(--tf-border);
  padding: 9px 12px; white-space: nowrap; position: sticky; top: 0;
}
.task-table thead th a { color: var(--tf-muted); display: inline-flex; align-items: center; gap: 4px; }
.task-table thead th a:hover, .task-table thead th a.sorted { color: var(--tf-text); }
.task-table td { padding: 10px 12px; vertical-align: middle; border-color: var(--tf-border); }
.task-table tbody tr:last-child td { border-bottom: 0; }
.task-table tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--tf-danger); }
.task-title-link { color: var(--tf-text); font-weight: 500; display: inline-block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.task-title-link:hover { color: var(--tf-accent); }
.task-table .meta { font-size: 12px; color: var(--tf-faint); }
.status-select {
  border: 0; background-color: transparent; padding: 2px 26px 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500;
  cursor: pointer; background-position: right 6px center; background-size: 10px 10px; min-width: 120px;
}
.status-select.status-todo { background-color: var(--st-todo-bg); color: var(--st-todo-fg); }
.status-select.status-in_progress { background-color: var(--st-progress-bg); color: var(--st-progress-fg); }
.status-select.status-blocked { background-color: var(--st-blocked-bg); color: var(--st-blocked-fg); }
.status-select.status-completed { background-color: var(--st-done-bg); color: var(--st-done-fg); }
.status-select:disabled { cursor: not-allowed; opacity: 0.85; }
.row-actions .btn { padding: 2px 6px; }

/* ---------- Filters ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filter-bar .form-select, .filter-bar .form-control { height: 34px; font-size: 13px; width: auto; }
.employee-filter { min-width: 210px; font-weight: 500; border-color: var(--tf-border-strong); }
.quick-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.quick-filter {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--tf-border);
  color: var(--tf-muted); font-size: 12.5px; font-weight: 500; background: var(--tf-surface);
}
.quick-filter:hover { color: var(--tf-text); border-color: var(--tf-border-strong); }
.quick-filter.active { background: var(--tf-text); border-color: var(--tf-text); color: var(--tf-bg); }
.filter-panel { background: var(--tf-bg-subtle); border: 1px solid var(--tf-border); border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; font-size: 12.5px; }
.filter-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--tf-accent-soft); color: var(--tf-accent); font-weight: 500; }
.filter-pill a { color: inherit; opacity: 0.7; padding: 0 4px; }
.filter-pill a:hover { opacity: 1; }
.results-meta { font-size: 13px; color: var(--tf-muted); }
.view-switch { display: inline-flex; padding: 2px; background: var(--tf-hover); border-radius: 8px; }
.view-switch a { padding: 4px 10px; border-radius: 6px; color: var(--tf-muted); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.view-switch a.active { background: var(--tf-surface); color: var(--tf-text); box-shadow: var(--tf-shadow); }

/* ---------- Pagination ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--tf-border); }
.pagination { --bs-pagination-color: var(--tf-text); --bs-pagination-bg: var(--tf-surface); --bs-pagination-border-color: var(--tf-border); --bs-pagination-hover-bg: var(--tf-hover); --bs-pagination-hover-color: var(--tf-text); --bs-pagination-active-bg: var(--tf-text); --bs-pagination-active-border-color: var(--tf-text); --bs-pagination-active-color: var(--tf-bg); --bs-pagination-disabled-bg: var(--tf-surface); --bs-pagination-disabled-color: var(--tf-faint); --bs-pagination-font-size: 13px; margin: 0; }

/* ---------- Compact task list (dashboard) ---------- */
.task-list { list-style: none; margin: 0; padding: 0; }
.task-list li { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--tf-border); }
.task-list li:last-child { border-bottom: 0; }
.task-list li:hover { background: var(--tf-hover); }
.task-list .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tf-text); font-weight: 500; }
.task-list .title:hover { color: var(--tf-accent); }
.task-list .side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ---------- Activity feed ---------- */
.activity-feed { list-style: none; margin: 0; padding: 0; }
.activity-feed li { display: flex; gap: 10px; padding: 10px 16px; font-size: 13px; }
.activity-feed li + li { border-top: 1px solid var(--tf-border); }
.activity-feed .icon { width: 26px; height: 26px; border-radius: 50%; background: var(--tf-hover); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--tf-muted); font-size: 12px; }
.activity-feed .when { color: var(--tf-faint); font-size: 12px; }
.activity-feed .quote { color: var(--tf-muted); border-left: 2px solid var(--tf-border-strong); padding-left: 8px; margin-top: 4px; white-space: pre-wrap; word-break: break-word; }

/* ---------- Workload bars ---------- */
.workload-row { display: grid; grid-template-columns: minmax(110px, 160px) 1fr 34px; gap: 10px; align-items: center; padding: 7px 16px; font-size: 13px; }
.workload-bar { height: 8px; border-radius: 4px; background: var(--tf-hover); display: flex; overflow: hidden; }
.workload-bar span { display: block; height: 100%; }
.workload-bar .todo { background: #b4b4b0; }
.workload-bar .progress-seg { background: #4f9bd9; }
.workload-bar .blocked { background: #e26a5f; }

/* ---------- Task detail ---------- */
.task-detail-title { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; word-break: break-word; }
.prop-grid { display: grid; grid-template-columns: 150px 1fr; gap: 2px 12px; font-size: 13.5px; }
.prop-grid dt { color: var(--tf-muted); font-weight: 400; padding: 6px 0; display: flex; align-items: center; gap: 8px; }
.prop-grid dd { margin: 0; padding: 6px 0; min-height: 32px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
@media (max-width: 575.98px) { .prop-grid { grid-template-columns: 1fr; } .prop-grid dt { padding-bottom: 0; } }
.description { white-space: pre-wrap; word-break: break-word; line-height: 1.65; font-size: 14.5px; }
.description.empty { color: var(--tf-faint); font-style: italic; }
.comment { display: flex; gap: 10px; padding: 14px 0; }
.comment + .comment { border-top: 1px solid var(--tf-border); }
.comment-body { white-space: pre-wrap; word-break: break-word; margin-top: 2px; line-height: 1.55; }
.archived-banner { background: var(--pr-high-bg); color: var(--pr-high-fg); border-radius: 8px; padding: 10px 14px; margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.timeliness { font-size: 12.5px; font-weight: 500; }
.timeliness.on-time { color: var(--tf-success); }
.timeliness.late { color: var(--tf-danger); }

/* ---------- Board ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(270px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.board-column { background: var(--tf-bg-subtle); border: 1px solid var(--tf-border); border-radius: 10px; display: flex; flex-direction: column; max-height: calc(100vh - 220px); min-height: 200px; }
.board-column-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px; }
.board-column-body { padding: 4px 8px 10px; overflow-y: auto; flex: 1; min-height: 120px; transition: background 0.12s ease; border-radius: 0 0 10px 10px; }
.board-column-body.drag-over { background: var(--tf-accent-soft); }
.board-card {
  background: var(--tf-surface); border: 1px solid var(--tf-border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
  box-shadow: var(--tf-shadow); cursor: grab; transition: box-shadow 0.12s ease, border-color 0.12s ease, opacity 0.12s ease; position: relative;
}
.board-card:hover { border-color: var(--tf-border-strong); box-shadow: var(--tf-shadow-lg); }
.board-card.dragging { opacity: 0.5; }
.board-card.locked { cursor: default; }
.board-card.saving { opacity: 0.6; pointer-events: none; }
.board-card .card-title { font-weight: 500; color: var(--tf-text); display: block; margin-bottom: 8px; word-break: break-word; }
.board-card .card-title:hover { color: var(--tf-accent); }
.board-card .card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; }
.board-card.is-overdue { border-left: 3px solid var(--tf-danger); }
.board-card .move-menu { position: absolute; top: 6px; right: 6px; }
.board-card .move-menu .btn { padding: 0 5px; color: var(--tf-faint); }
@media (max-width: 991.98px) { .board { grid-template-columns: repeat(4, minmax(260px, 85vw)); scroll-snap-type: x mandatory; } .board-column { scroll-snap-align: start; } }

/* ---------- Calendar ---------- */
.calendar { border: 1px solid var(--tf-border); border-radius: 10px; overflow: hidden; background: var(--tf-surface); }
.calendar-head, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-head div { padding: 8px 10px; font-size: 12px; color: var(--tf-muted); font-weight: 500; border-bottom: 1px solid var(--tf-border); background: var(--tf-bg-subtle); }
.calendar-day { min-height: 118px; border-right: 1px solid var(--tf-border); border-bottom: 1px solid var(--tf-border); padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.out { background: var(--tf-bg-subtle); }
.calendar-day.out .day-number { color: var(--tf-faint); }
.calendar-day.weekend { background: color-mix(in srgb, var(--tf-bg-subtle) 60%, transparent); }
.calendar-week .calendar-day { min-height: 340px; }
.day-number { font-size: 12px; font-weight: 500; color: var(--tf-muted); display: flex; justify-content: space-between; align-items: center; }
.day-number .num { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.calendar-day.today .day-number .num { background: var(--tf-danger); color: #fff; font-weight: 700; }
.day-number .add { opacity: 0; color: var(--tf-faint); }
.calendar-day:hover .day-number .add, .day-number .add:focus { opacity: 1; }
.cal-entry {
  display: block; font-size: 11.5px; padding: 2px 6px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tf-text);
  border-left: 3px solid var(--tf-border-strong); background: var(--tf-hover);
}
.cal-entry:hover { color: var(--tf-text); background: var(--tf-active); }
.cal-entry.p-urgent { border-left-color: #e0584f; }
.cal-entry.p-high { border-left-color: #e4a43a; }
.cal-entry.p-medium { border-left-color: #4f9bd9; }
.cal-entry.p-low { border-left-color: #b4b4b0; }
.cal-entry.kind-start { background: transparent; border-left-style: dashed; color: var(--tf-muted); }
.cal-entry.completed { text-decoration: line-through; color: var(--tf-faint); }
.cal-entry.overdue { background: var(--st-blocked-bg); color: var(--st-blocked-fg); }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--tf-muted); }
@media (max-width: 767.98px) {
  .calendar-month .calendar-day { min-height: 76px; padding: 3px; }
  .calendar-month .cal-entry { font-size: 10px; padding: 1px 3px; }
  .calendar-head div { padding: 6px 4px; font-size: 11px; text-align: center; }
  .calendar-week .calendar-head { display: none; }
  .calendar-week .calendar-grid { grid-template-columns: 1fr; }
  .calendar-week .calendar-day { min-height: 0; border-right: 0; }
}

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--tf-muted); }
.empty-state .icon { font-size: 30px; color: var(--tf-faint); display: block; margin-bottom: 8px; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--tf-text); margin-bottom: 4px; }
.empty-state.compact { padding: 22px 16px; }

/* ---------- Notifications ---------- */
.notification-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--tf-border); align-items: flex-start; }
.notification-item:last-child { border-bottom: 0; }
.notification-item.unread { background: var(--tf-accent-soft); }
.notification-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tf-accent); margin-top: 7px; flex-shrink: 0; }
.notification-item.read .dot { background: transparent; }
.notification-item .message { word-break: break-word; }

/* ---------- Auth ---------- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: var(--tf-sidebar); }
.auth-card { width: 100%; max-width: 410px; background: var(--tf-surface); border: 1px solid var(--tf-border); border-radius: 14px; box-shadow: var(--tf-shadow-lg); padding: 34px 32px; }
.auth-card h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.auth-card .form-control { height: 40px; }
.auth-card .btn-lg { height: 42px; font-size: 14.5px; }
.auth-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 22px; font-weight: 700; font-size: 16px; }
.password-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }

/* ---------- Toasts & misc ---------- */
.toast-container { z-index: 1090; }
.toast { border: 1px solid var(--tf-border); background: var(--tf-surface); box-shadow: var(--tf-shadow-lg); border-radius: 10px; color: var(--tf-text); }
.toast .toast-icon { font-size: 16px; }
.toast.toast-success .toast-icon { color: var(--tf-success); }
.toast.toast-error .toast-icon, .toast.toast-danger .toast-icon { color: var(--tf-danger); }
.toast.toast-warning .toast-icon { color: var(--tf-warning); }
.toast.toast-info .toast-icon { color: var(--tf-accent); }
.dropdown-menu { --bs-dropdown-bg: var(--tf-surface); --bs-dropdown-border-color: var(--tf-border); --bs-dropdown-link-hover-bg: var(--tf-hover); --bs-dropdown-link-active-bg: var(--tf-active); --bs-dropdown-link-active-color: var(--tf-text); --bs-dropdown-font-size: 13.5px; box-shadow: var(--tf-shadow-lg); border-radius: 8px; padding: 4px; }
.dropdown-item { border-radius: 5px; padding: 6px 10px; display: flex; align-items: center; gap: 8px; }
.modal-content { background: var(--tf-surface); border: 1px solid var(--tf-border); border-radius: 12px; }
.offcanvas { --bs-offcanvas-bg: var(--tf-sidebar); }
.spinner-inline { width: 14px; height: 14px; border-width: 2px; }
.btn.is-loading { pointer-events: none; opacity: 0.75; }
.color-input { width: 46px; height: 34px; padding: 3px; }
.list-table { margin: 0; --bs-table-bg: transparent; font-size: 13.5px; color: var(--tf-text); }
.list-table th { font-size: 12px; font-weight: 500; color: var(--tf-muted); background: var(--tf-bg-subtle); padding: 9px 12px; white-space: nowrap; }
.list-table td { padding: 10px 12px; vertical-align: middle; border-color: var(--tf-border); }
.metric { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.progress-thin { height: 6px; border-radius: 3px; background: var(--tf-hover); overflow: hidden; }
.progress-thin > span { display: block; height: 100%; background: var(--tf-success); }
.error-page { max-width: 480px; margin: 60px auto; text-align: center; }
.error-code { font-size: 64px; font-weight: 800; letter-spacing: -0.04em; color: var(--tf-faint); line-height: 1; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Performance page (charts) ---------- */
/* Colours validated with the dataviz palette checker against the card surfaces
   (#ffffff light, #253047 dark). The light aqua sits below 3:1, so every chart
   ships a "View as table" alternative. */
.perf-root {
  --series-1: #2a78d6; --series-2: #eb6834;
  --status-completed: #1baf7a; --status-progress: #2a78d6; --status-blocked: #e34948; --status-todo: #6250d6;
  --heat-0: #f1f1ef; --heat-1: #cde2fb; --heat-2: #86b6ef; --heat-3: #3987e5; --heat-4: #1c5cab;
  --heat-ink-dark: #0b2547; --heat-ink-light: #ffffff;
}
[data-bs-theme='dark'] .perf-root {
  --series-1: #3987e5; --series-2: #d95926;
  --status-completed: #199e70; --status-progress: #3987e5; --status-blocked: #e66767; --status-todo: #9085e9;
  --heat-0: #2c3850; --heat-1: #184f95; --heat-2: #256abf; --heat-3: #5598e7; --heat-4: #9ec5f4;
  --heat-ink-dark: #0b2547; --heat-ink-light: #ffffff;
}
.chart-box { position: relative; width: 100%; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--tf-muted); margin-bottom: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-swatch.line { height: 3px; width: 14px; border-radius: 2px; }
.chart-table { margin-top: 10px; font-size: 13px; }
.chart-table summary { cursor: pointer; color: var(--tf-muted); font-size: 12.5px; }
.chart-table summary:hover { color: var(--tf-text); }
.chart-table table { margin-top: 8px; }
.hbar-row { display: grid; grid-template-columns: 96px 1fr 32px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--tf-border); }
.hbar-row:last-child { border-bottom: 0; }
.hbar-row:hover .hbar-fill { filter: brightness(1.1); }
.hbar-track { height: 10px; background: var(--tf-hover); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.heatmap { border-collapse: separate; border-spacing: 3px; font-size: 12px; min-width: 100%; }
.heatmap th { font-weight: 500; color: var(--tf-muted); text-align: center; padding: 2px 4px; white-space: nowrap; }
.heatmap th[scope='row'] { max-width: 160px; padding-right: 10px; color: var(--tf-text); }
.heatmap th.weekend { color: var(--tf-faint); }
.heatmap td { padding: 0; text-align: center; }
.heatmap tr.is-selected th[scope='row'] { color: var(--tf-accent); font-weight: 600; }
.heat-cell { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 26px; border-radius: 4px; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--heat-0); }
.heat-1 { background: var(--heat-1); color: var(--heat-ink-dark); }
.heat-2 { background: var(--heat-2); color: var(--heat-ink-dark); }
.heat-3 { background: var(--heat-3); color: var(--heat-ink-light); }
.heat-4 { background: var(--heat-4); color: var(--heat-ink-light); }
[data-bs-theme='dark'] .heat-1, [data-bs-theme='dark'] .heat-2 { color: var(--heat-ink-light); }
[data-bs-theme='dark'] .heat-3, [data-bs-theme='dark'] .heat-4 { color: var(--heat-ink-dark); }
.heat-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.heat-legend .heat-cell { width: 16px; height: 12px; border-radius: 3px; }
.list-table tr.is-selected td { background: var(--tf-accent-soft); }

/* ---------- Task progress ---------- */
.task-progress { display: inline-flex; align-items: center; gap: 6px; min-width: 92px; }
.task-progress-track { flex: 1; height: 6px; min-width: 48px; border-radius: 3px; background: var(--tf-hover); overflow: hidden; }
.task-progress-fill { display: block; height: 100%; border-radius: 3px; background: var(--tf-accent); }
.task-progress.is-done .task-progress-fill { background: var(--tf-success); }
.task-progress-value { font-size: 11.5px; font-weight: 600; color: var(--tf-muted); font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }
.progress-form { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 360px; }
.progress-output { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 40px; }
.progress-range { --range-pct: 0%; }
.progress-range::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--tf-accent) var(--range-pct), var(--tf-hover) var(--range-pct));
}
.progress-range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--tf-hover); }
.progress-range::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--tf-accent); }
.progress-range::-webkit-slider-thumb { margin-top: -5px; background: var(--tf-accent); }
.progress-range::-moz-range-thumb { background: var(--tf-accent); }

/* Quick "working on it today" toggle in lists */
.btn-working-icon { color: var(--tf-muted); }
.btn-working-icon:hover { color: #b8860b; }
.btn-working-icon.active, .btn-working-icon.active:hover { color: #d99a00; background: #fff3c4; }
[data-bs-theme='dark'] .btn-working-icon:hover { color: #f2cf63; }
[data-bs-theme='dark'] .btn-working-icon.active { color: #f2cf63; background: #4a3b10; }
.task-list .side form { line-height: 1; }
.task-list .btn-working-icon { padding: 2px 6px; }
