/* =========================================
   TASK MANAGEMENT MODULE - PREMIUM UI
   (Eisenhower Matrix & Analytics)
   ========================================= */

/* --- Container & Layout --- */
.tasks-container {
  display: flex;
  flex-direction: column;
  gap: 12px; /* Super compact for laptops */
  padding: 12px 8px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  font-family: var(--font-family);
  color: var(--neutral-800);
}

/* Page Header */
.tasks-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 12px;
  border-left: 4px solid var(--primary-500);
}
.tasks-page-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--neutral-900);
  margin: 0;
  line-height: 1.2;
}
.tasks-page-subtitle {
  color: var(--neutral-500);
  font-size: 13px;
  margin-top: 2px;
}

/* --- Task Analytics (Top Section) --- */
.task-analytics-panel {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0,0,0,0.04);
  border-radius: var(--radius-xl);
  padding: 16px;
  box-shadow: var(--shadow-card);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.ta-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.ta-metric-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 6px 12px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,0.04);
  cursor: pointer;
  transition: all 0.2s;
}
.ta-metric-card:hover {
  border-color: var(--primary-500);
  box-shadow: 0 4px 12px rgba(13,148,136,0.1);
  transform: translateY(-2px);
}

.ta-metric-title {
  font-size: 13px;
  color: var(--neutral-500);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ta-metric-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--neutral-900);
  line-height: 1;
}
.ta-metric-sub {
  font-size: 12px;
  color: var(--neutral-500);
}

/* Báo động đỏ List */
.ta-red-alert {
  background: linear-gradient(135deg, rgba(254, 226, 226, 0.5) 0%, rgba(254, 202, 202, 0.5) 100%);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-xl);
  padding: 16px;
}
.ta-red-alert-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #b91c1c;
  font-weight: 700;
  margin-bottom: 12px;
}
.ta-red-alert-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ta-red-alert-item {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.05);
}

/* Manager View - Workload */
.ta-workload-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid rgba(0,0,0,0.04);
}
.ta-workload-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-700); /* Teal color */
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ta-workload-title::before {
  content: '';
  display: block;
  width: 4px;
  height: 14px;
  background: var(--primary-500);
  border-radius: 2px;
}
.ta-wl-header {
  display: grid;
  grid-template-columns: 2fr 3fr 1fr 1fr;
  gap: 16px;
  padding: 6px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-700); /* Teal text */
  background: rgba(13, 148, 136, 0.08); /* Light teal background */
  border-radius: 8px;
  margin-bottom: 8px;
}
.ta-wl-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  padding-right: 4px;
}
.ta-wl-list::-webkit-scrollbar { width: 6px; }
.ta-wl-list::-webkit-scrollbar-track { background: transparent; }
.ta-wl-list::-webkit-scrollbar-thumb { background: var(--neutral-200); border-radius: 12px; }
.ta-wl-list::-webkit-scrollbar-thumb:hover { background: var(--neutral-300); }
.ta-wl-row {
  display: grid;
  grid-template-columns: 2fr 3fr 1fr 1fr;
  gap: 16px;
  align-items: center;
  padding: 6px 16px;
  background: var(--card-bg);
  border: 1px solid rgba(0,0,0,0.04);
  border-radius: 12px;
  transition: all 0.2s;
  cursor: pointer;
}
.ta-wl-row:hover {
  border-color: var(--primary-500);
  box-shadow: 0 4px 12px rgba(13,148,136,0.1);
  transform: translateY(-1px);
}
.ta-wl-row.warning {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(254, 226, 226, 0.2);
}

.wl-user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wl-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--neutral-100);
  color: var(--neutral-600);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.wl-user-info {
  display: flex; flex-direction: column;
}
.wl-name { font-weight: 600; color: var(--neutral-900); font-size: 14px; }
.wl-role { font-size: 12px; color: var(--neutral-500); }

.wl-dist {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wl-bars {
  display: flex; gap: 2px; width: 140px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--neutral-100);
}
.wl-bar-q1 { background: #ef4444; }
.wl-bar-q2 { background: #10b981; }
.wl-bar-q3 { background: #f59e0b; }
.wl-bar-q4 { background: #6b7280; }
.wl-dist-text { font-size: 13px; font-weight: 500; color: var(--neutral-600); letter-spacing: 1px;}

.wl-completion { font-weight: 700; font-size: 14px; color: var(--neutral-800); }

.wl-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.wl-status-ok { background: rgba(16, 185, 129, 0.1); color: #059669; }
.wl-status-overload { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.wl-status-warning { background: rgba(245, 158, 11, 0.1); color: #d97706; }

/* --- View Controls inside Quadrant --- */
.eh-view-toggles {
  display: flex;
  background: var(--neutral-100);
  padding: 2px;
  border-radius: 6px;
  margin-left: auto;
  margin-right: 12px;
}
.eh-view-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  color: var(--neutral-500);
  cursor: pointer;
  transition: all 0.2s;
}
.eh-view-btn.active {
  background: var(--card-bg);
  color: var(--neutral-900);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* --- Eisenhower Matrix Grid --- */
.eisenhower-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 16px;
  min-height: 400px;
}

.eh-quadrant {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: 0; /* Important for nested scrolling */
  min-width: 0; /* MUST have this to prevent grid item from expanding beyond its column */
}

.eh-quadrant:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.04);
}

/* Quadrant Styles */
.eh-q1 { border-top: 4px solid #ef4444; } /* Do First */
.eh-q2 { border-top: 4px solid #3b82f6; } /* Schedule */
.eh-q3 { border-top: 4px solid #f59e0b; } /* Delegate */
.eh-q4 { border-top: 4px solid #6b7280; } /* Don't Do */

.eh-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.eh-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}
.eh-q1 .eh-title { color: #b91c1c; }
.eh-q2 .eh-title { color: #1d4ed8; }
.eh-q3 .eh-title { color: #b45309; }
.eh-q4 .eh-title { color: #374151; }

.eh-count {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s;
}
.eh-q1 .eh-count { background: #fee2e2; color: #b91c1c; }
.eh-q2 .eh-count { background: #dbeafe; color: #1d4ed8; }
.eh-q3 .eh-count { background: #fef3c7; color: #b45309; }
.eh-q4 .eh-count { background: #f3f4f6; color: #374151; }

.eh-add-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px; border: none; cursor: pointer; padding: 0; transition: all 0.2s;
}
.eh-q1 .eh-add-btn { background: #fee2e2; color: #b91c1c; }
.eh-q1 .eh-add-btn:hover { background: #fca5a5; color: #991b1b; }
.eh-q2 .eh-add-btn { background: #dbeafe; color: #1d4ed8; }
.eh-q2 .eh-add-btn:hover { background: #93c5fd; color: #1e3a8a; }
.eh-q3 .eh-add-btn { background: #fef3c7; color: #b45309; }
.eh-q3 .eh-add-btn:hover { background: #fde68a; color: #92400e; }
.eh-q4 .eh-add-btn { background: #f3f4f6; color: #374151; }
.eh-q4 .eh-add-btn:hover { background: #e5e7eb; color: #1f2937; }

/* Task List inside Quadrant */
.eh-task-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  align-content: start;
  gap: 8px; /* Reduced gap between cards */
  flex: 1;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  padding-right: 4px;
}
.eh-task-list::-webkit-scrollbar { width: 4px; }
.eh-task-list::-webkit-scrollbar-track { background: transparent; }
.eh-task-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* =============================================
   Premium Task Modal UI
   ============================================= */
.tm-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 8px 0;
}
.tm-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tm-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--neutral-800);
  display: flex;
  justify-content: space-between;
}
.tm-char-count {
  font-weight: 400;
  color: var(--neutral-400);
  font-size: 12px;
}
.tm-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--neutral-300);
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
  color: var(--neutral-900);
  font-family: inherit;
}
.tm-input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-100);
  outline: none;
}
.tm-input::placeholder {
  color: var(--neutral-400);
}
.tm-quadrants-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.tm-q-btn {
  padding: 12px;
  text-align: center;
  border: 1px solid var(--neutral-300);
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  background: var(--card-bg);
  transition: all 0.2s;
  user-select: none;
}

/* Base colors for text & border when not active */
.tm-q-btn.q1 { color: #ef4444; }
.tm-q-btn.q2 { color: #10b981; }
.tm-q-btn.q3 { color: #f59e0b; }
.tm-q-btn.q4 { color: #6b7280; }

.tm-q-btn:hover {
  background: #f9fafb;
}

/* Active states: filled background */
.tm-q-btn.active.q1 { background: #ef4444; color: white; border-color: #ef4444; }
.tm-q-btn.active.q2 { background: #10b981; color: white; border-color: #10b981; }
.tm-q-btn.active.q3 { background: #f59e0b; color: white; border-color: #f59e0b; }
.tm-q-btn.active.q4 { background: #6b7280; color: white; border-color: #6b7280; }

.eh-task-list::-webkit-scrollbar-thumb:hover { background: var(--neutral-300); }

/* --- Task Card (Glassmorphism & Compact UI) --- */
.task-card {
  background: var(--card-bg);
  border: 1px solid rgba(0,0,0,0.04);
  border-radius: 6px; /* Sharper */
  padding: 4px 6px; /* Super compact */
  display: flex;
  gap: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: grab;
  position: relative;
}
.task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  border-color: var(--neutral-300);
}
.task-card:active {
  cursor: grabbing;
}

/* 3 Distinct Buttons for Status - Compact */
.task-status-actions {
  display: flex;
  gap: 2px;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--neutral-200);
}
.task-btn {
  flex: 1;
  padding: 3px 2px;
  border-radius: 4px;
  font-size: 9px; /* Very small text to fit 3 columns */
  font-weight: 600;
  border: 1px solid rgba(0,0,0,0.04);
  background: var(--neutral-50);
  color: var(--neutral-500);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap; /* Prevent wrapping */
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-btn:hover { background: var(--neutral-100); }

.task-card.todo .btn-todo { background: var(--neutral-200); color: var(--neutral-800); border-color: var(--neutral-300); }
.task-card.in_progress .btn-inprogress { background: rgba(59, 130, 246, 0.1); color: #2563eb; border-color: rgba(59, 130, 246, 0.3); }
.task-card.done .btn-done { background: rgba(16, 185, 129, 0.1); color: #059669; border-color: rgba(16, 185, 129, 0.3); }

/* Card Colors by Status */
.task-card.todo {
  background: var(--card-bg);
  border-left: 4px solid var(--neutral-300);
}
.task-card.in_progress {
  background: rgba(239, 246, 255, 0.8);
  border-color: rgba(59, 130, 246, 0.3);
  border-left: 4px solid #3b82f6;
}
.task-card.done {
  background: rgba(236, 253, 245, 0.8);
  border-color: rgba(16, 185, 129, 0.3);
  border-left: 4px solid #10b981;
  opacity: 0.8;
}

/* LIST MODE OVERRIDES FOR QUADRANT */
.eh-quadrant.list-mode .eh-task-list {
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
.eh-quadrant.list-mode .task-card {
  flex-direction: row;
  align-items: center;
  padding: 8px 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.eh-quadrant.list-mode .task-content {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  min-width: 0;
}
.eh-quadrant.list-mode .task-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: unset;
}
.eh-quadrant.list-mode .task-meta {
  flex: 0 0 auto;
  width: 130px;
  align-items: flex-start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.eh-quadrant.list-mode .task-tags {
  display: none;
}
.eh-quadrant.list-mode .task-status-actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: none;
  min-width: auto;
  justify-content: flex-end;
}
.task-card.done .task-title {
  text-decoration: line-through;
  color: var(--neutral-400);
}

/* Card Content - Compact */
.task-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px; /* Tighter */
  min-width: 0; /* Important for ellipsis in narrow columns */
}
.task-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--neutral-800);
  margin: 0;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Max 2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-meta {
  display: flex;
  flex-direction: row; /* Stack horizontally to save space */
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 9px; /* Very small font */
  color: var(--neutral-500);
}
.task-deadline {
  display: flex;
  align-items: center;
  gap: 4px;
}
.task-deadline.overdue {
  color: #dc2626; /* Red 600 */
  background: rgba(239, 68, 68, 0.1);
  font-weight: 700;
}

@keyframes wave {
  0% { transform: rotate(0deg); }
  20% { transform: rotate(15deg); }
  40% { transform: rotate(-10deg); }
  60% { transform: rotate(15deg); }
  80% { transform: rotate(-10deg); }
  100% { transform: rotate(0deg); }
}
.task-deadline.warning {
  color: #f59e0b;
  font-weight: 600;
}

/* Pill Badges */
.task-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.task-pill {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--neutral-100);
  color: var(--neutral-600);
  display: flex;
  align-items: center;
  gap: 4px;
}
.pill-vip { background: rgba(13, 148, 136, 0.1); color: var(--primary-600); }
.pill-onboarding { background: rgba(59, 130, 246, 0.1); color: #2563eb; }

/* Add Task Button */
.btn-add-task {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--primary-500);
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}
.btn-add-task:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.4);
}

/* =========================================================================
   TASK v2 — 2 ô (Việc hôm nay / Task pending), 1 task = 1 dòng
   Mật độ "siêu gọn": dòng 26px. Đổi 4 biến dưới là đổi toàn bộ mật độ.
   ========================================================================= */
.tasks-container {
  --tv2-row-h: 26px;
  --tv2-row-fs: 12.5px;
  --tv2-seg-w: 23px;
  --tv2-seg-h: 18px;
}

/* ---- Thanh trên: 4 số liệu + AI NLP + nút tra cứu, tất cả 1 hàng ---- */
.tv2-strip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--card-bg, #fff); border: 1px solid rgba(0,0,0,.05);
  border-radius: 12px; box-shadow: var(--shadow-card); padding: 8px 10px;
}
.tv2-strip-sp { flex: 1; min-width: 0; }
.tv2-mets { display: flex; gap: 6px; flex-shrink: 0; }
.tv2-met {
  display: flex; align-items: center; gap: 6px; padding: 6px 11px;
  border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 700;
  white-space: nowrap; transition: transform .12s;
}
.tv2-met:hover { transform: translateY(-1px); }
.tv2-met b { font-size: 16px; font-weight: 900; line-height: 1; }
.tv2-met-blue  { background: #eff6ff; color: #1d4ed8; }
.tv2-met-green { background: #f0fdf4; color: #15803d; }
.tv2-met-amber { background: #fffbeb; color: #b45309; }
.tv2-met-red   { background: #fef2f2; color: #b91c1c; }

.tv2-btn {
  border: none; border-radius: 8px; font-weight: 700; font-size: 12.5px;
  cursor: pointer; font-family: inherit; padding: 0 14px; height: 34px;
  white-space: nowrap; transition: .15s;
}
.tv2-btn-primary { background: var(--primary-700); color: #fff; }
.tv2-btn-primary:hover { background: var(--primary-800); }
.tv2-btn-ghost { background: #fff; color: var(--primary-700); border: 1px solid var(--primary-500); }
.tv2-btn-ghost:hover { background: var(--primary-50); }
.tv2-btn-hist { background: #fff; color: var(--neutral-700); border: 1px solid var(--neutral-300); }
.tv2-btn-hist:hover { background: var(--neutral-50); }

/* ---- 2 ô ---- */
.tv2-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.tv2-box {
  background: var(--card-bg, #fff); border-radius: 12px; box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,.05); overflow: hidden;
}
.tv2-today   { border-top: 3px solid #dc2626; }
.tv2-pending { border-top: 3px solid var(--neutral-400); }
.tv2-box-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-bottom: 1px solid var(--neutral-100);
}
.tv2-box-title {
  font-size: 13px; font-weight: 900; letter-spacing: .3px;
  display: flex; align-items: center; gap: 7px;
}
.tv2-today .tv2-box-title   { color: #dc2626; }
.tv2-pending .tv2-box-title { color: var(--neutral-700); }
.tv2-box-sub {
  font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 10px;
  background: var(--neutral-100); color: var(--neutral-600); letter-spacing: 0;
}
.tv2-box-tools { display: flex; align-items: center; gap: 7px; }
.tv2-count {
  font-size: 11.5px; font-weight: 800; background: var(--neutral-100);
  color: var(--neutral-700); border-radius: 20px; padding: 1px 9px;
}
.tv2-add {
  width: 24px; height: 24px; border-radius: 7px; border: 1px dashed var(--neutral-300);
  background: #fff; color: var(--neutral-600); font-size: 14px; font-weight: 700;
  cursor: pointer; line-height: 1;
}
.tv2-add:hover { border-color: var(--primary-500); color: var(--primary-700); }
/* ===== Dấu ? + bảng hướng dẫn cách gõ ===== */
.tv2-qa-help {
  position: relative; flex-shrink: 0;
  width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid var(--primary-600); background: var(--primary-600);
  font-size: 10px; font-weight: 800; line-height: 13px; text-align: center;
  color: #fff; cursor: help; user-select: none;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.tv2-qa-help:hover, .tv2-qa-help:focus-visible {
  background: var(--primary-800); border-color: var(--primary-800);
  box-shadow: 0 0 0 3px rgba(20,184,166,.22); outline: none;
}
/* position:fixed — ô việc có overflow:hidden, dùng absolute sẽ bị cắt mất chữ.
   Toạ độ do Tasks._placeQuickAddTip() đặt, luôn kẹp gọn trong màn hình. */
.tv2-qa-tip {
  position: fixed; top: 0; left: 0; z-index: 4000;
  display: none;
  width: min(396px, calc(100vw - 16px));
  max-height: calc(100vh - 16px); overflow-y: auto; overscroll-behavior: contain;
  background: #fff; color: var(--neutral-800);
  border: 1px solid var(--neutral-200); border-radius: 10px;
  box-shadow: 0 12px 34px rgba(0,0,0,.18);
  padding: 11px 13px;
  font-size: 11.5px; font-weight: 500; line-height: 1.5;
  text-align: left; cursor: default; white-space: normal;
}
/* Bảng được JS chuyển ra làm con trực tiếp của <body> khi mở, nên
   không dùng :hover của dấu ? được nữa — bật/tắt bằng class. */
.tv2-qa-tip.tv2-tip-open { display: block; }
.tv2-tip-h {
  display: block; font-size: 10px; font-weight: 800; letter-spacing: .4px;
  text-transform: uppercase; color: var(--primary-700);
  margin: 9px 0 4px; padding-bottom: 3px; border-bottom: 1px solid var(--neutral-100);
}
.tv2-tip-h:first-child { margin-top: 0; }
.tv2-tip-r { display: flex; align-items: baseline; gap: 7px; padding: 1.5px 0; }
.tv2-tip-r code {
  flex-shrink: 0; background: var(--primary-50); color: var(--primary-700);
  border: 1px solid var(--primary-100); border-radius: 4px;
  padding: 0 4px; font-size: 10.5px; font-weight: 700;
  font-family: ui-monospace, Consolas, monospace; white-space: nowrap;
}
.tv2-tip-r i { color: var(--neutral-600); font-style: normal; font-size: 11px; }
.tv2-tip-r b { color: var(--neutral-900); font-weight: 800; }

/* ===== Dòng gõ nhanh ở đầu mỗi ô ===== */
.tv2-quickadd {
  display: flex; align-items: center; gap: 6px;
  margin: 4px 6px 0; padding: 0 4px;
  height: var(--tv2-row-h, 26px);
  border-bottom: 1px dashed var(--neutral-300);
  border-radius: 7px;
  transition: background .12s, border-color .12s;
}
.tv2-quickadd:focus-within {
  background: var(--primary-50);
  border-bottom-color: var(--primary-500);
  border-bottom-style: solid;
}
.tv2-qa-plus {
  flex-shrink: 0; width: 16px; text-align: center;
  font-size: 14px; font-weight: 800; line-height: 1;
  color: var(--neutral-400);
}
.tv2-quickadd:focus-within .tv2-qa-plus { color: var(--primary-600); }
.tv2-qa-in {
  flex: 1; min-width: 0;
  border: none; outline: none; background: transparent;
  font-family: inherit; font-size: var(--tv2-row-fs, 12.5px); font-weight: 600;
  color: var(--neutral-900); padding: 0;
}
.tv2-qa-in::placeholder { color: var(--neutral-400); font-weight: 500; font-style: italic; }
.tv2-qa-in:disabled { opacity: .5; }
.tv2-qa-go {
  flex-shrink: 0; width: 22px; height: 18px;
  border: 1px solid var(--neutral-300); border-radius: 5px;
  background: #fff; cursor: pointer;
  font-size: 11px; font-weight: 800; line-height: 1;
  color: var(--neutral-500); padding: 0;
  opacity: 0; transition: opacity .12s;
}
.tv2-quickadd:focus-within .tv2-qa-go { opacity: 1; }
/* Dấu ? luôn xanh, luôn rõ — không làm mờ nữa */
.tv2-qa-go:hover { background: var(--primary-50); border-color: var(--primary-500); color: var(--primary-700); }

.tv2-rows { padding: 3px 6px 6px; min-height: 44px; }
.tv2-empty {
  text-align: center; padding: 18px 8px; color: var(--neutral-400);
  font-size: 12.5px; font-style: italic;
}
.tv2-divider {
  font-size: 10px; font-weight: 800; color: var(--neutral-400); text-transform: uppercase;
  letter-spacing: .5px; padding: 8px 4px 3px; display: flex; align-items: center; gap: 7px;
}
.tv2-divider::after { content: ""; flex: 1; height: 1px; background: var(--neutral-200); }

/* ---- 1 TASK = 1 DÒNG ---- */
.tv2-row {
  display: flex; align-items: center; gap: 7px; height: var(--tv2-row-h);
  padding: 0 4px; border-radius: 7px; border-bottom: 1px solid var(--neutral-100);
}
.tv2-row:last-child { border-bottom: none; }
.tv2-row:hover { background: var(--neutral-50); }
/* Cả dòng kéo được: con trỏ bàn tay + chặn bôi đen chữ khi kéo */
.tv2-row { cursor: grab; user-select: none; -webkit-user-select: none; }
.tv2-row:active { cursor: grabbing; }
/* Các vùng bấm được thì trả lại con trỏ ngón tay */
.tv2-row .tv2-seg-btn,
.tv2-row .tv2-ico,
.tv2-row .tv2-cust { cursor: pointer; }
.tv2-row.done { opacity: .55; }
.tv2-row.done .tv2-ttl { text-decoration: line-through; color: var(--neutral-400); font-weight: 600; }
.tv2-ghost { opacity: .4; background: var(--primary-50); }

.tv2-grip {
  color: var(--neutral-300); font-size: 12px; flex-shrink: 0;
  letter-spacing: -3px; width: 9px;
}
.tv2-row:hover .tv2-grip { color: var(--neutral-500); }

/* 3 nút trạng thái: chỉ icon, phân biệt bằng màu */
.tv2-seg {
  display: flex; flex-shrink: 0; border: 1px solid var(--neutral-300);
  border-radius: 20px; overflow: hidden; background: #fff;
}
.tv2-seg-btn {
  width: var(--tv2-seg-w); height: var(--tv2-seg-h); border: none; background: transparent;
  cursor: pointer; font-size: 11px; font-weight: 800; color: var(--neutral-400);
  border-right: 1px solid var(--neutral-200); line-height: 1; padding: 0;
}
.tv2-seg-btn:last-child { border-right: none; }
.tv2-seg-btn:hover { background: var(--neutral-100); color: var(--neutral-700); }
.tv2-seg-btn.on-todo  { background: var(--neutral-600); color: #fff; }
.tv2-seg-btn.on-doing { background: #f59e0b;            color: #fff; }
.tv2-seg-btn.on-done  { background: #16a34a;            color: #fff; }

.tv2-flag { flex-shrink: 0; font-size: 11px; line-height: 1; cursor: help; }
.tv2-ttl {
  flex: 1; min-width: 0; font-size: var(--tv2-row-fs); font-weight: 700;
  color: var(--neutral-900); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; cursor: pointer;
}
.tv2-ttl:hover { color: var(--primary-700); }
.tv2-cust {
  flex-shrink: 0; max-width: 88px; font-size: 10.5px; font-weight: 700;
  color: var(--primary-600); background: rgba(13,148,136,.09); padding: 1px 6px;
  border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}
.tv2-cust:hover { background: rgba(13,148,136,.2); }
.tv2-pend {
  flex-shrink: 0; font-size: 10px; font-weight: 800; padding: 1px 5px;
  border-radius: 4px; cursor: help; background: var(--neutral-200); color: var(--neutral-700);
}
.tv2-pend.hot { background: #fee2e2; color: #dc2626; }
.tv2-dl {
  flex-shrink: 0; font-size: 11px; font-weight: 800; padding: 1px 6px;
  border-radius: 5px; min-width: 52px; text-align: center;
}
.tv2-dl-ok   { background: var(--neutral-100); color: var(--neutral-600); }
.tv2-dl-soon { background: #ffedd5; color: var(--accent-700); }
.tv2-dl-over { background: #fee2e2; color: #dc2626; }
.tv2-who {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary-100); color: var(--primary-700); font-size: 9.5px;
  font-weight: 800; display: flex; align-items: center; justify-content: center; cursor: help;
}
.tv2-acts {
  display: flex; gap: 1px; flex-shrink: 0; width: 88px; justify-content: flex-end;
  opacity: 0; transition: opacity .1s;
}
.tv2-row:hover .tv2-acts { opacity: 1; }
.tv2-ico {
  width: 21px; height: 21px; border: none; background: transparent; border-radius: 5px;
  cursor: pointer; font-size: 11px; line-height: 1; padding: 0;
}
.tv2-ico:hover { background: var(--neutral-200); }

/* Modal chọn ô: 2 nút thay vì lưới 2x2 */
.tm-quadrants-grid.tv2-2box { grid-template-columns: 1fr 1fr !important; }

/* Danh sách task hiện trong modal (bấm vào ô số liệu) */
.tv2-modal-rows { max-height: 60vh; overflow-y: auto; padding-right: 4px; }

/* ---- Màn hình tra cứu việc đã hoàn thành ---- */
.tv2-hist-filters { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.tv2-hist-search {
  flex: 1; min-width: 200px; padding: 8px 11px; font-size: 12.5px; border-radius: 8px;
  border: 1px solid var(--neutral-300); font-family: inherit; color: var(--neutral-800);
}
.tv2-hist-search:focus {
  outline: none; border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(20,184,166,.12);
}
.tv2-pill {
  font-size: 11.5px; font-weight: 700; padding: 5px 11px; border-radius: 20px;
  cursor: pointer; border: 1px solid var(--neutral-300); background: #fff;
  color: var(--neutral-600); white-space: nowrap;
}
.tv2-pill:hover { border-color: var(--primary-500); color: var(--primary-700); }
.tv2-pill.on { background: var(--primary-700); color: #fff; border-color: var(--primary-700); }
.tv2-hist { max-height: 66vh; overflow-y: auto; }
.tv2-hist-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tv2-hist-table th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--neutral-500); padding: 7px 5px; border-bottom: 1px solid var(--neutral-200);
  position: sticky; top: 0; background: #fff;
}
.tv2-hist-table td {
  padding: 7px 5px; border-bottom: 1px solid var(--neutral-100); color: var(--neutral-800);
  max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tv2-hist-table tr:hover td { background: var(--neutral-50); }
.tv2-hist-foot { margin-top: 10px; font-size: 11.5px; color: var(--neutral-500); }
.tv2-reopen {
  font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 5px; cursor: pointer;
  border: 1px solid var(--primary-500); background: #fff; color: var(--primary-700);
  white-space: nowrap;
}
.tv2-reopen:hover { background: var(--primary-50); }

/* Màn hình hẹp: 2 ô xếp dọc */
@media (max-width: 1100px) {
  .tv2-boxes { grid-template-columns: 1fr; }
}
