/* Задачи CRM — карточки, фильтры, напоминания */
.tasks-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.tasks-kpi {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  background: linear-gradient(165deg, #fff 0%, #f8fafc 100%);
}
.tasks-kpi.overdue { border-color: #fecaca; background: linear-gradient(165deg, #fff5f5, #fff); }
.tasks-kpi.today { border-color: #fde68a; background: linear-gradient(165deg, #fffdf4, #fff); }
.tasks-kpi b { display: block; font-size: 26px; line-height: 1.1; margin-bottom: 4px; }
.tasks-kpi span { font-size: 12px; color: #64748b; }
.tasks-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.tasks-toolbar .filter-pill {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.tasks-toolbar .filter-pill.active {
  background: #fffbeb;
  border-color: #f7c948;
  color: #92400e;
}
.tasks-compose {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdf4 0%, #fff 100%);
  margin-bottom: 14px;
}
.tasks-compose-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.tasks-compose-row input[type="text"],
.tasks-compose-row input[type="datetime-local"],
.tasks-compose-row select,
.tasks-compose-row textarea {
  font: inherit;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 9px 11px;
  background: #fff;
}
.tasks-compose-row .grow { flex: 1 1 220px; min-width: 180px; }
.tasks-priority-group { display: inline-flex; gap: 4px; }
.tasks-priority-btn {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.tasks-priority-btn.active[data-p="high"] { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.tasks-priority-btn.active[data-p="normal"] { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.tasks-priority-btn.active[data-p="low"] { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }
.tasks-quick-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tasks-quick-chips button {
  border: 1px dashed #cbd5e1;
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  color: #475569;
}
.tasks-quick-chips button:hover { background: #f8fafc; border-color: #94a3b8; }
.tasks-list { display: grid; gap: 8px; }
.task-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  transition: border-color .15s, box-shadow .15s;
}
.task-card:hover { border-color: #cbd5e1; box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07); }
.task-card.done { opacity: 0.72; background: #f8fafc; }
.task-card.overdue { border-color: #fca5a5; background: linear-gradient(90deg, #fff5f5, #fff 40%); }
.task-card.due-soon { border-color: #fcd34d; }
.task-card input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: #f7c948;
  cursor: pointer;
}
.task-card-body { min-width: 0; }
.task-card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}
.task-card.done .task-card-title { text-decoration: line-through; color: #64748b; }
.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}
.task-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
}
.task-tag.due { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.task-tag.due.overdue { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.task-tag.lead { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; cursor: pointer; }
.task-tag.p-high { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.task-tag.p-low { background: #f1f5f9; color: #64748b; }
.task-card-actions { display: flex; flex-direction: column; gap: 4px; }
.task-icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.task-icon-btn:hover { background: #f8fafc; }
.task-icon-btn.danger:hover { background: #fff1f2; border-color: #fecaca; }
.tasks-empty {
  text-align: center;
  padding: 32px 16px;
  color: #64748b;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #fafbfc;
}
.tasks-widget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.tasks-widget-head-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.tasks-widget-stat {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #5b21b6;
  background: #ede9fe;
  border: 1px solid #c4b5fd;
}
.tasks-widget-stat--overdue {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fca5a5;
}
.tasks-widget-stat--today {
  color: #92400e;
  background: #fef3c7;
  border-color: #fcd34d;
}
.tasks-widget-head a {
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  color: #6d28d9;
}
.tasks-widget-list { display: grid; gap: 8px; max-height: 240px; overflow-y: auto; }
.tasks-widget-list-compact { max-height: min(220px, 32vh); }
.tasks-empty-compact {
  padding: 14px;
  font-size: 12px;
  text-align: center;
  color: #64748b;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}
.task-widget-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e9d5ff;
  border-left: 4px solid #a78bfa;
  border-radius: 12px;
  background: linear-gradient(90deg, #faf5ff 0%, #fff 40%);
  cursor: pointer;
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.task-widget-row:hover {
  border-color: #c4b5fd;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.1);
  transform: translateY(-1px);
}
.task-widget-row.overdue {
  border-color: #fca5a5;
  border-left-color: #ef4444;
  background: linear-gradient(90deg, #fff1f2 0%, #fff 42%);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.08);
}
.task-widget-row.due-today {
  border-color: #fcd34d;
  border-left-color: #f59e0b;
  background: linear-gradient(90deg, #fffbeb 0%, #fff 42%);
}
.task-widget-row.priority-high:not(.overdue) {
  border-left-color: #7c3aed;
}
.task-widget-check {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #7c3aed;
  background: #ede9fe;
  margin-top: 2px;
}
.task-widget-check--overdue {
  color: #fff;
  background: #ef4444;
}
.task-widget-check--today {
  color: #fff;
  background: #f59e0b;
}
.task-widget-body {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.task-widget-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.task-widget-text {
  display: block;
  font-size: 14px;
  line-height: 1.35;
  color: #1e1b4b;
  word-break: break-word;
}
.task-priority-chip {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: #7c3aed;
  background: #ede9fe;
  border: 1px solid #c4b5fd;
}
.task-due-chip {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.task-due-chip--overdue {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fca5a5;
}
.task-due-chip--today {
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
}
.task-due-chip--later {
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}
.task-widget-lead {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: #1d4ed8;
  background: #dbeafe;
  border: 1px solid #93c5fd;
}
@media (max-width: 760px) {
  .tasks-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.tasks-page-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tasks-page-tab {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tasks-page-tab.active {
  background: #ede9fe;
  border-color: #a78bfa;
  color: #5b21b6;
}
.team-task-list { display: grid; gap: 10px; }
.team-task-item {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
}
.team-task-item.needs-ack {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
  background: linear-gradient(165deg, #fffbeb, #fff);
}
.team-task-item.selected { border-color: #818cf8; }
.team-task-item.team-task-highlight {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22);
  animation: team-task-flash 1.6s ease-out 1;
}
@keyframes team-task-flash {
  0% { background: #fffbeb; }
  100% { background: #fff; }
}
.team-task-ack-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: #b45309;
  margin-right: 8px;
}
.team-task-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.team-task-body { margin: 8px 0 0; font-size: 14px; line-height: 1.45; }
.team-task-meta { font-size: 12px; margin-top: 6px; }
.team-task-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.team-task-history-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 13px; }
.team-task-assign-card { margin-bottom: 14px; }
.team-tasks-shell .card { margin-top: 12px; }
.team-tasks-api-banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #fcd34d;
  background: #fffbeb;
  font-size: 13px;
  line-height: 1.5;
  color: #78350f;
}
.team-tasks-api-banner code {
  font-size: 12px;
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
}
