/* ===== Канбан ===== */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: var(--sp-4); align-items: start; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-3); min-height: 200px; transition: border-color var(--dur), background var(--dur); }
.kanban-col.is-over { border-color: var(--accent); background: var(--accent-soft); }
.kanban-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; font-weight: 600; }
.kanban-head .btn { margin-left: auto; }
.kanban-list { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kanban-empty { padding: 20px 8px; text-align: center; color: var(--text-3); font-size: var(--fs-sm); border: 1px dashed var(--border-strong); border-radius: var(--r-md); }
.task-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); cursor: grab; transition: border-color var(--dur), transform var(--dur), box-shadow var(--dur); }
.task-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.task-card:active { cursor: grabbing; }
.task-card.is-dragging { opacity: .4; }
.task-card-title { font-weight: 500; }
.task-card-foot { display: flex; align-items: center; justify-content: space-between; }
.task-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== Артефакты ===== */
.artifact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-4); }
.artifact-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); text-align: left; transition: border-color var(--dur), transform var(--dur); }
.artifact-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.artifact-thumb { position: relative; height: 130px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); }
.artifact-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.artifact-card-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.artifact-card-title { font-weight: 600; }
.artifact-card-meta { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); }

/* ===== Таймлайн ===== */
.events-filters { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.timeline { list-style: none; margin: 0; padding: 0; max-width: 760px; }
.timeline-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline-icon { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.timeline-item[data-type="error"] .timeline-icon { color: var(--st-error); }
.timeline-item[data-type="approval"] .timeline-icon { color: var(--st-waiting); }
.timeline-item[data-type="review"] .timeline-icon { color: var(--st-review); }
.timeline-body { flex: 1; }
.timeline-item .mono { font-size: var(--fs-xs); }

/* ===== Проекты ===== */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-4); }
.project-card { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: var(--sp-4); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); text-align: left; transition: border-color var(--dur), transform var(--dur); }
.project-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.project-card.is-active { border-color: var(--accent); }
.project-card-top { display: flex; justify-content: space-between; width: 100%; color: var(--text-2); }
.project-card-name { font-size: var(--fs-lg); font-weight: 600; }
.project-card .emp-task-row { width: 100%; }
.project-card-meta { display: flex; gap: 14px; font-size: var(--fs-xs); flex-wrap: wrap; }
.project-card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.project-card-new { align-items: center; justify-content: center; border-style: dashed; color: var(--text-2); min-height: 180px; }
.project-card-new:hover { color: var(--accent); border-color: var(--accent); }

/* ===== Сотрудники ===== */
.search-field { position: relative; width: 280px; }
.search-field .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-field .input { padding-left: 32px; height: 34px; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-4); }
.team-card { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: var(--sp-4); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); text-align: left; transition: border-color var(--dur), transform var(--dur); }
.team-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.team-card-head { display: flex; align-items: center; gap: 12px; }
.team-card-name { font-weight: 600; font-size: var(--fs-lg); }
.team-card-task { font-size: var(--fs-sm); min-height: 20px; }

/* ===== Аналитика ===== */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.kpi { display: flex; align-items: center; gap: 12px; padding: var(--sp-4); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); text-align: left; }
button.kpi:hover { border-color: var(--accent); }
.kpi .icon { width: 22px; height: 22px; color: var(--accent); }
.kpi .faint { font-size: var(--fs-xs); }
.kpi-value { font-size: var(--fs-xl); font-weight: 650; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--sp-4); }
.chart-card { padding: var(--sp-4) var(--sp-5); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.chart-card h2 { margin: 0 0 var(--sp-4); font-size: var(--fs-md); font-weight: 600; }
.hbars { display: flex; flex-direction: column; gap: 6px; }
.hbar { display: grid; grid-template-columns: 150px 1fr 56px; align-items: center; gap: 10px; padding: 4px; border: 0; background: none; border-radius: var(--r-sm); text-align: left; font-size: var(--fs-sm); }
.hbar:hover { background: var(--surface-2); }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.hbar-track span { display: block; height: 100%; border-radius: inherit; transition: width 600ms var(--ease); }
.hbar-value { text-align: right; font-size: var(--fs-xs); color: var(--text-2); }
.vbars { width: 100%; height: auto; }
.vbar { fill: var(--accent); }
.vbar-value { fill: var(--text); font: 600 13px var(--font); }
.vbar-label { fill: var(--text-2); font: 12px var(--font); }
.vbar-axis { stroke: var(--border-strong); }
.donut-wrap { display: flex; align-items: center; gap: var(--sp-6); }
.donut { width: 160px; flex: none; transform: rotate(-90deg); }
.donut text { transform: rotate(90deg); transform-origin: 80px 80px; }
.donut-track { fill: none; stroke: var(--surface-3); stroke-width: 18; }
.donut-seg { fill: none; stroke-width: 18; }
.donut-num { fill: var(--text); font: 650 26px var(--font); }
.donut-cap { fill: var(--text-3); font: 11px var(--font); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-sm); }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend strong { margin-left: auto; padding-left: 16px; }

@media (max-width: 860px) {
    .view-page { padding: var(--sp-4); }
    .search-field { width: 100%; }
    .hbar { grid-template-columns: 110px 1fr 50px; }
}

/* Палитра визуальной концепции */
.swatches { display: flex; height: 140px; border-radius: var(--r-md); overflow: hidden; width: 100%; }
.swatches span { flex: 1; display: flex; align-items: flex-end; padding: 8px; }
.swatches em { font: 500 11px var(--font-mono); font-style: normal; padding: 2px 6px; border-radius: 4px; background: rgba(0, 0, 0, .45); color: #fff; }
.artifact-thumb .swatches { position: absolute; inset: 0; height: auto; border-radius: 0; }
.artifact-thumb .swatches em { display: none; }
.artifact-thumb .swatches + .icon { display: none; }

/* U-08: карточка задачи из API — расход на карточке канбана, задание, шаги. */
.task-card-cost { font-size: var(--fs-xs); font-variant-numeric: tabular-nums; margin-left: auto; }
.td-live { margin-bottom: 12px; }
.td-brief { white-space: pre-wrap; font-family: var(--font); font-size: var(--fs-sm); background: var(--surface-2); border-radius: var(--r-md); padding: 10px 12px; margin: 0 0 12px; max-height: 200px; overflow: auto; }
.td-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.td-steps li { display: flex; gap: 8px; align-items: baseline; font-size: var(--fs-sm); flex-wrap: wrap; }
.td-steps .td-step-cost { margin-left: auto; font-variant-numeric: tabular-nums; }

/* U-09: просмотр файлов — markdown, код с подсветкой, картинки. */
.file-view { margin: 0; max-height: 70vh; overflow: auto; }
.code-view { background: var(--surface-2); border-radius: var(--r-md); padding: 12px 14px; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.55; white-space: pre; tab-size: 4; }
.code-view code { font: inherit; }
.tok-comment { color: var(--text-3); font-style: italic; }
.tok-string { color: #16a34a; }
.tok-number { color: #d97706; }
.tok-keyword { color: var(--accent); font-weight: 600; }
.tok-var { color: #0891b2; }
.md-view { line-height: 1.6; font-size: var(--fs-md); }
.md-view h1, .md-view h2, .md-view h3 { margin: 16px 0 8px; line-height: 1.25; }
.md-view p, .md-view ul, .md-view ol, .md-view blockquote { margin: 0 0 10px; }
.md-view blockquote { border-left: 3px solid var(--border-strong); padding-left: 12px; color: var(--text-2); }
.md-view code { background: var(--surface-2); border-radius: var(--r-sm); padding: 1px 5px; font-family: var(--font-mono); font-size: .92em; }
.md-view pre code { background: none; padding: 0; }
.md-view a { color: var(--accent); }
.file-view-image { display: grid; place-items: center; background: var(--surface-2); border-radius: var(--r-md); padding: 12px; }
.file-view-image img { max-width: 100%; max-height: 64vh; object-fit: contain; }
.project-card { cursor: pointer; }
.project-card-right { display: inline-flex; align-items: center; gap: 6px; }
.project-card-tools { display: inline-flex; gap: 2px; }
.project-card-tools .icon-btn { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: var(--r-sm, 6px); color: var(--text-2); }
.project-card-tools .icon-btn:hover { background: var(--surface-2, rgba(255,255,255,.06)); color: var(--text); }
.project-card-tools [data-delete]:hover { color: var(--danger, #f87171); }

/* K13: вкладки сотрудника — 4 + «…», всегда помещаются, при узком окне прокручиваются */
.emp-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.emp-tabs .tab { flex: 0 0 auto; white-space: nowrap; }
.emp-tabs .tab-more { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
/* K22: шаги задачи простыми словами */
.td-steps li.td-step { flex-wrap: nowrap; align-items: flex-start; padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); }
.td-step-icon { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.td-step[data-kind="wait"] .td-step-icon { background: color-mix(in srgb, var(--st-waiting) 14%, transparent); color: var(--st-waiting); }
.td-step-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.td-step-lines { display: flex; flex-direction: column; gap: 2px; color: var(--text); line-height: 1.4; }
.td-step-meta { font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.td-plan-btn { margin: 0 0 12px; }
.td-plan-btn .icon { color: var(--accent); }
