/* ==========================================================================
   GELEX HUB — View "Công việc" gộp (Cá nhân + Dự án) — Enterprise redesign
   Sạch, pro, density cao. Linear/Height style.
   ========================================================================== */

.wc-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--content-pad-y) var(--content-pad-x) 140px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- Header: title + KPI insight pills ---------- */
.wc-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.wc-head-left { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wc-head h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.wc-sub { font-size: 12.5px; color: var(--text-3); }
.wc-kpi-row { display: flex; gap: 8px; flex-wrap: wrap; }
.wc-kpi {
  display: flex; align-items: baseline; gap: 6px;
  padding: 6px 11px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  color: var(--text-3);
}
.wc-kpi b { font-size: 15px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.wc-kpi.danger b { color: var(--danger); }
.wc-kpi.accent b { color: var(--brand); }
/* KPI là nút lọc nhanh — bấm giữ trạng thái active */
button.wc-kpi { cursor: pointer; font: inherit; transition: border-color var(--ease) 120ms, background var(--ease) 120ms; }
button.wc-kpi:hover { border-color: var(--border-strong); }
button.wc-kpi.is-active { border-color: var(--brand-border); background: var(--brand-soft); color: var(--brand-dark); }
button.wc-kpi.is-active b { color: var(--brand-dark); }
button.wc-kpi.danger.is-active { border-color: #fecaca; background: #fef2f2; }

/* Skeleton loading */
.wc-row.wc-skel { cursor: default; pointer-events: none; height: 56px; }
.wc-skel-circle, .wc-skel-line {
  display: inline-block;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-sunken) 25%, #e8e8ea 50%, var(--surface-sunken) 75%);
  background-size: 200% 100%;
  animation: wcShimmer 1.2s ease-in-out infinite;
}
.wc-skel-circle { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.wc-skel-line { height: 10px; }
.wc-skel-line.w-60 { width: 60%; }
.wc-skel-line.w-35 { width: 35%; }
.wc-skel-line.w-10 { width: 56px; flex: none; height: 12px; }
@keyframes wcShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Danh sách / Kanban toggle */
.wc-mode-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-sunken);
  flex: none;
}
.wc-mode-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 10px;
  border: none; background: transparent;
  color: var(--text-3); font: inherit; font-size: 11.5px; font-weight: 600;
  cursor: pointer;
  transition: background var(--ease) 120ms, color var(--ease) 120ms;
}
.wc-mode-btn + .wc-mode-btn { border-left: 1px solid var(--border); }
.wc-mode-btn:hover { color: var(--text); }
.wc-mode-btn.active { background: var(--surface-raised); color: var(--brand); box-shadow: var(--shadow-xs); }

/* Chip hạn sắp đến (≤2 ngày) */
.wc-due.is-soon { color: #b45309; font-weight: 600; background: #fffbeb; padding: 2px 8px; border-radius: 999px; }

/* ---------- Kanban board (tab Dự án) ---------- */
.wc-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(230px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: start;
}
.wc-bcol {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 160px;
}
.wc-bcol-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 2px; }
.wc-bcol-count {
  font-size: 10.5px; font-weight: 700; color: var(--text-3);
  background: var(--surface-raised); border-radius: 999px; padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}
.wc-bcol-body { display: flex; flex-direction: column; gap: 8px; }
.wc-bcard {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color var(--ease) 120ms, box-shadow var(--ease) 120ms;
}
.wc-bcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.wc-bcard-title {
  font-size: 12.5px; font-weight: 500; color: var(--text); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.wc-bcard-meta .wc-prio { margin-top: 1px; }
.wc-bcard.is-done .wc-bcard-title { text-decoration: line-through; color: var(--text-3); }
.wc-bcard.is-overdue { border-left: 3px solid var(--danger); }
.wc-bcard-meta { display: flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--text-3); flex-wrap: wrap; }
.wc-bcard-due.is-over { color: var(--danger); font-weight: 700; }
.wc-bcard-progress { height: 4px; border-radius: 999px; background: var(--border); overflow: hidden; }
.wc-bcard-progress > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.wc-bcol-empty {
  padding: 14px 8px; text-align: center;
  font-size: 11px; color: var(--text-3);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

@media (max-width: 720px) {
  .wc-board { grid-auto-columns: minmax(75vw, 1fr); }
}

/* ---------- Onboarding (thu gọn, không đỏ full) ---------- */
.wc-onboard {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
}
.wc-onboard-ic { font-size: 15px; flex: none; line-height: 1.5; opacity: 0.8; }
.wc-onboard-body { flex: 1; font-size: 12px; color: var(--text-2); line-height: 1.5; }
.wc-onboard-body b { font-weight: 600; color: var(--text); }
.wc-onboard-body p { margin-top: 2px; color: var(--text-3); }
.wc-onboard-close {
  width: 20px; height: 20px;
  border: none; border-radius: var(--radius-xs);
  background: transparent; color: var(--text-3);
  font-size: 15px; line-height: 1; cursor: pointer;
  flex: none;
  transition: background var(--ease) 120ms, color var(--ease) 120ms;
}
.wc-onboard-close:hover { background: var(--surface-raised); color: var(--text); }

/* ---------- Tabs (Cá nhân / Dự án) ---------- */
.wc-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.wc-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px 11px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--ease) 120ms, border-color var(--ease) 120ms;
  margin-bottom: -1px;
}
.wc-tab svg { flex: none; }
.wc-tab:hover { color: var(--text); }
.wc-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}
.wc-tab-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--text-3);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.wc-tab.active .wc-tab-badge { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- Read-only banner (tab Dự án) ---------- */
.wc-readonly-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-3);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}
.wc-readonly-banner svg { color: var(--text-3); flex: none; }

/* ---------- Role button group (Tôi thực hiện / Tôi giao / Tôi theo dõi) ---------- */
.wc-role-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-sunken);
  align-self: flex-start;
}
.wc-role-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease) 120ms, color var(--ease) 120ms;
  border-right: 1px solid var(--border);
}
.wc-role-btn:last-child { border-right: none; }
.wc-role-btn:hover { color: var(--text); background: var(--surface-raised); }
.wc-role-btn.active {
  background: var(--surface-raised);
  color: var(--brand);
  box-shadow: inset 0 -2px 0 var(--brand);
}

/* ---------- Toolbar (grouped, sticky) ---------- */
.wc-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
  position: sticky;
  top: calc(var(--topbar-h) + 8px);
  z-index: 20;
}
.wc-search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text-3);
  flex: 1;
  min-width: 160px;
  max-width: 260px;
  transition: border-color var(--ease) 120ms, background var(--ease) 120ms;
}
.wc-search:focus-within { border-color: var(--brand-border); background: var(--surface-raised); }
.wc-search svg { color: var(--text-3); flex: none; }
.wc-search input {
  flex: 1;
  border: none; outline: none;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
  min-width: 0;
}
.wc-search input::placeholder { color: var(--text-3); }

.wc-status-select {
  height: 30px;
  padding: 0 24px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  font: inherit;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color var(--ease) 120ms;
}
.wc-status-select:hover:not(:disabled) { border-color: var(--border-strong); }
.wc-status-select:disabled { opacity: 0.55; cursor: not-allowed; }

/* Nút "＋ Tạo việc" (CTA brand) */
.wc-add-btn {
  height: 30px;
  padding: 0 13px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background var(--ease) 120ms;
}
.wc-add-btn:hover { background: var(--brand-dark); }

/* Quick-add inline (toggle hiện dưới toolbar) */
.wc-quick-add {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-raised);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.wc-quick-add svg { color: var(--brand); flex: none; }
.wc-quick-add input {
  flex: 1;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  font: inherit;
  font-size: 13px;
  color: var(--text);
  min-width: 0;
}
.wc-quick-add input:focus {
  outline: none;
  border-color: var(--brand-border);
  background: var(--surface-raised);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.wc-quick-detail {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  flex: none;
  transition: background var(--ease) 120ms;
}
.wc-quick-detail:hover { background: var(--surface-sunken); color: var(--text); }

/* ---------- List ---------- */
.wc-list { display: flex; flex-direction: column; gap: 0; }
.wc-loading, .wc-empty, .wc-error {
  padding: 40px 12px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.wc-empty .emoji { font-size: 28px; display: block; margin-bottom: 8px; opacity: 0.5; }
.wc-error { color: var(--danger); }

/* ---------- Section groups (Quá hạn / Hôm nay / Sắp tới / Đã xong) ---------- */
.wc-groups { display: flex; flex-direction: column; gap: 16px; }
.wc-section { display: flex; flex-direction: column; gap: 4px; }
.wc-section-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wc-section-icon { font-size: 13px; line-height: 1; }
.wc-section-label { color: var(--text-2); }
.wc-section-count {
  background: var(--surface-sunken);
  color: var(--text-3);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0;
}
.wc-section-danger .wc-section-label { color: var(--danger); }
.wc-section-danger .wc-section-icon { color: var(--danger); }
.wc-section-danger .wc-section-count { background: #fef2f2; color: var(--danger); }
.wc-section-accent .wc-section-label { color: var(--brand); }
.wc-section-accent .wc-section-icon { color: var(--brand); }
.wc-section-accent .wc-section-count { background: var(--brand-soft); color: var(--brand-dark); }
.wc-section-muted .wc-section-head { opacity: 0.6; }

/* Row container: card group (border ngoài, divider trong) */
.wc-section-list {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ---------- Row enterprise (card style) ---------- */
.wc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  min-height: 52px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--ease) 100ms;
  position: relative;
}
.wc-row:hover { background: var(--surface-sunken); }
.wc-row:last-child { border-bottom: none; }
.wc-row.is-done { opacity: 0.55; }
.wc-row.is-done .wc-title { text-decoration: line-through; color: var(--text-3); }
.wc-row.is-overdue { background: #fef7f7; }
.wc-row.is-overdue:hover { background: #fee2e2; }
.wc-row.is-overdue .wc-due { color: var(--danger); font-weight: 700; }
.wc-row.is-overdue::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--danger);
}

/* Checkbox (personal task) + kind icon (project task) */
.wc-check {
  width: 18px; height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex: none;
  transition: background var(--ease) 120ms, border-color var(--ease) 120ms;
  padding: 0;
}
.wc-check:hover { border-color: var(--brand); }
.wc-check.is-checked {
  background: var(--brand);
  border-color: var(--brand);
}
.wc-check svg { color: #fff; }
.wc-kind-icon {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  flex: none;
}
.wc-row:hover .wc-kind-icon { color: var(--brand-dark); }

/* Priority dot */
.wc-prio {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex: none;
}

/* Main content */
.wc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wc-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
.wc-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-3);
  flex-wrap: nowrap;
  overflow: hidden;
}
.wc-meta > * { flex: none; }
.wc-code {
  background: var(--surface-sunken);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  font-size: 10.5px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--text-3);
}
.wc-row:hover .wc-code { background: var(--surface-raised); }
.wc-recog { color: #d97706; font-weight: 700; font-size: 11px; }

/* Status chip (compact pill) */
.wc-status {
  flex: none;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--text-3);
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.wc-row:hover .wc-status { background: var(--surface-raised); }
/* Map status class */
.wc-status.st-pending, .wc-status.st-todo { background: #f1f5f9; color: #475569; }
.wc-status.st-doing, .wc-status.st-in_progress { background: var(--brand-soft); color: var(--brand-dark); }
.wc-status.st-review { background: #fef3c7; color: #b45309; }
.wc-status.st-done, .wc-status.st-completed { background: #ecfdf5; color: #047857; }
.wc-status.st-pause { background: #f1f5f9; color: #64748b; }
.wc-status.st-bad { background: #fef2f2; color: var(--danger); }
.wc-status.st-cancelled { background: #f1f5f9; color: #94a3b8; }

/* Progress (mảnh, bên phải) */
.wc-progress-wrap { display: flex; align-items: center; gap: 6px; flex: none; }
.wc-progress {
  width: 60px; height: 5px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.wc-progress-fill { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width var(--ease) 200ms; }
.wc-progress-num {
  font-size: 10.5px;
  color: var(--text-3);
  min-width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* Due date (tabular, phải) */
.wc-due {
  flex: none;
  font-size: 11.5px;
  color: var(--text-3);
  min-width: 68px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* UX-1: marker "của tôi" — dấu chấm brand trái row */
.wc-mine { color: var(--brand); font-weight: 700; margin-right: 4px; }
.wc-row.is-mine::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px; background: var(--brand);
}
.wc-row.is-mine.is-overdue::before { background: var(--danger); }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .wc-shell { padding: 14px 14px 120px; gap: 12px; }
  .wc-head { gap: 10px; }
  .wc-head h1 { font-size: 19px; }
  .wc-kpi { padding: 5px 9px; font-size: 11px; }
  .wc-kpi b { font-size: 13px; }
  .wc-toolbar { padding: 6px 8px; gap: 6px; top: calc(var(--topbar-h) + 4px); }
  .wc-search { max-width: none; min-width: 120px; }
  .wc-tab { padding: 9px 12px 10px; font-size: 12.5px; }
  .wc-readonly-banner { font-size: 11.5px; padding: 8px 11px; }
  .wc-role-group { width: 100%; }
  .wc-role-btn { flex: 1; justify-content: center; padding: 7px 8px; font-size: 11.5px; gap: 4px; }
  .wc-row {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    gap: 4px 10px;
    padding: 9px 12px;
    align-items: flex-start;
  }
  .wc-check, .wc-kind-icon { order: 0; }
  .wc-main { order: 1; flex-basis: calc(100% - 30px); }
  .wc-status { order: 2; }
  .wc-progress-wrap { order: 3; }
  .wc-due { order: 4; margin-left: auto; min-width: auto; }
  .wc-meta { font-size: 10.5px; }
}
