/* Задачи: список, карточка и файлы.
   Отдельным файлом, потому что это самостоятельный раздел: его можно
   выключить вместе с модулем, и в общем app.css не остаётся мусора. */

.tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--border);
}

.tabs__item {
  padding: 9px 14px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 14px;
}

.tabs__item:hover { color: var(--text); text-decoration: none; }

.tabs__item.is-active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

.tabs__count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- Список ---------- */

.task-list { display: flex; flex-direction: column; }

.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  color: inherit;
}

.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--surface-2); text-decoration: none; }

.task-row__main { min-width: 0; }

.task-row__title {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row__meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}

.task-row__side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

/* ---------- Метки состояния ---------- */

.task-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.task-chip--open { background: var(--accent-soft); border-color: #c3d6fd; color: var(--accent-dark); }
.task-chip--work { background: var(--warn-soft); border-color: #f0d5a8; color: var(--warn); }
.task-chip--done { background: var(--ok-soft); border-color: #b7e3cf; color: var(--ok); }
.task-chip--cancelled { background: #eef0f4; color: #6b7280; }

.task-due { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.task-due--over { color: var(--danger); font-weight: 500; }
.task-due--today { color: var(--warn); font-weight: 500; }
.task-due--soon { color: var(--text); }
.task-due--done, .task-due--off { color: var(--text-muted); }

.task-over { color: var(--danger); }

/* ---------- Карточка ---------- */

.task-text { font-size: 14px; line-height: 1.55; }
.task-text p { margin: 0 0 8px; }

.task-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 18px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.task-meta > div { display: flex; flex-direction: column; gap: 1px; }

.task-meta__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}

.task-actions { display: flex; flex-direction: column; gap: 8px; }
.task-actions form { margin: 0; }
.task-actions .btn { width: 100%; justify-content: center; }

/* ---------- Файлы ---------- */

.task-files {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.task-file {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.task-file__thumb {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--border);
}

.task-file__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.task-file__doc {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  word-break: break-word;
}

.task-file__icon { font-size: 18px; color: var(--text-muted); }

.task-file__meta { display: block; }
.task-file__meta span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-file .btn { align-self: flex-start; }

.task-file input[type="file"] { display: none; }


/* Обсуждение задачи: реплики, а не чат — поэтому простые блоки. */
.task-comment {
  padding: 10px 0;
  border-top: 1px solid var(--line, #e6e8ec);
}
.task-comment:first-child { border-top: 0; padding-top: 0; }
.task-comment__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.task-comment-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line, #e6e8ec);
}
.task-comment-form .field + .field { margin-top: 8px; }

/* Полоса загруженности: кому сколько открыто. */
.task-load {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin: 0 0 12px;
}
.task-load__item {
  padding: 2px 8px;
  border: 1px solid var(--line, #e6e8ec);
  border-radius: 999px;
  font-size: 13px;
  background: #fff;
}
.task-load__item.is-over { border-color: #f0c2c2; background: #fff7f7; }
