/* Стили интерфейса трекера. Вёрстка приблизительно по макетам Яндекс Трекера. */
:root {
    --bg: #f4f5f7;
    --panel: #ffffff;
    --column: #eceef1;
    --border: #dfe2e6;
    --text: #1f2328;
    --muted: #6b7280;
    --primary: #2f6df6;
    --danger: #d33a3a;
    --radius: 8px;
}

body { background: var(--bg); color: var(--text); font-size: 14px; }

/* Верхняя полоса */
.topbar { display: flex; align-items: center; gap: 28px; height: 52px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar .brand { font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; }
.tabs { display: flex; gap: 4px; height: 100%; }
.tab { display: flex; align-items: center; padding: 0 12px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }
.user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user form { margin: 0; }
.user-email { color: var(--muted); }

.page { padding: 16px 20px 40px; }

/* Панель инструментов */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.toolbar .form-control { width: auto; min-width: 150px; height: 34px; padding: 4px 8px; }
.toolbar .spacer { flex: 1; }
.empty { color: var(--muted); padding: 24px; text-align: center; }

/* Метки */
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #e6e8ec; color: #3b4048; white-space: nowrap; }
.chip.status-backlog { background: #e6e8ec; }
.chip.status-queued { background: #dfe7f5; color: #2a4f9a; }
.chip.status-in_progress { background: #d9e8ff; color: #1c53c4; }
.chip.status-blocked { background: #fde0e0; color: #a42525; }
.chip.status-review { background: #ece1fb; color: #6b3fb0; }
.chip.status-testing { background: #fdebd2; color: #9a5b0b; }
.chip.status-grooming { background: #f3e8d4; color: #8a5a12; }
.chip.status-plannable { background: #e4ecf7; color: #345a99; }
.chip.status-waiting { background: #e8e1f5; color: #55398f; }
.chip.status-final_review { background: #f0dff5; color: #7d2f93; }
.chip.status-ready { background: #dcf3dd; color: #247a2e; }
.chip.status-released { background: #c9eccd; color: #1c6b27; }
.chip.status-cancelled { background: #ececec; color: #777; text-decoration: line-through; }
.chip.epic { background: #f1ecdc; color: #7a6320; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.type-badge { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 4px; font-size: 11px; font-weight: 700; color: #fff; }
.type-task { background: #5b8def; }
.type-bug { background: #d95555; }
.type-hotfix { background: #e08a1e; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 700; flex: none; }
.task-key { color: var(--muted); font-size: 12px; }
.overdue { color: var(--danger); font-weight: 600; }

/* Доска: колонки-панели с заголовком, внутри группы карточек (эпики) с серым заголовком группы */
/* Сетка вместо flex: все колонки равной высоты (по самой длинной), поэтому заголовок липнет и у коротких и пустых колонок */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: 229px; gap: 12px; overflow-x: auto; padding-bottom: 14px; align-items: stretch; }
.board-col { flex: 0 0 229px; min-width: 0; background: var(--column); border-radius: 14px; padding: 6px 8px 12px; }
/* Заголовок колонки прилипает к верху доски при вертикальной прокрутке карточек; отрицательные поля закрывают отступы панели, чтобы карточки не выглядывали над ним */
.col-head { position: sticky; top: 0; z-index: 3; background: var(--column); margin: -6px -8px 0; padding: 14px 14px 10px; border-radius: 14px 14px 0 0; display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; }
.col-head .count { color: var(--muted); font-weight: 400; font-size: 14px; }
.col-head .grow { flex: 1; }
.col-dot { width: 10px; height: 10px; border-radius: 50%; background: #b9c0cb; flex: none; }
.board-col.status-queued .col-dot { background: #5b8def; }
.board-col.status-in_progress .col-dot { background: #2f6df6; }
.board-col.status-blocked .col-dot { background: var(--danger); }
.board-col.status-review .col-dot { background: #8a5cd1; }
.board-col.status-testing .col-dot { background: #e08a1e; }
.board-col.status-grooming .col-dot { background: #c98b2b; }
.board-col.status-plannable .col-dot { background: #7b9ad1; }
.board-col.status-waiting .col-dot { background: #7a63b5; }
.board-col.status-final_review .col-dot { background: #a43fc0; }
.board-col.status-ready .col-dot { background: #4caf50; }
.board-col.status-released .col-dot { background: #2e7d32; }
.board-col.status-cancelled .col-dot { background: #9aa0a8; }
.col-add { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 8px 2px; border-radius: 8px; }
.col-add:hover { background: rgba(0, 0, 0, .06); color: var(--text); }
.group-title { margin: 12px 0 6px; padding: 5px 10px; border-radius: 8px; background: #e1e4ea; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-body { min-height: 6px; display: flex; flex-direction: column; gap: 8px; border-radius: 10px; }
.col-body.is-empty { min-height: 0; }
.col-body.col-disabled { opacity: .4; }
.col-body.col-allowed { min-height: 56px; outline: 2px dashed var(--primary); outline-offset: 2px; }

.card { background: var(--panel); border-radius: 14px; padding: 12px 14px; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); cursor: pointer; border: 1px solid transparent; }
.card:hover { border-color: #c5ccd6; }
.card.card-ghost { opacity: .4; }
.card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.card-top .task-key { font-size: 13px; }
.card-top .grow { flex: 1; }
.card-title { line-height: 1.35; font-size: 15px; word-break: break-word; }
.card-epic { margin-top: 8px; }
.card-deadline { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 15px; }
.card-deadline .flame { color: var(--danger); flex: none; }
.card-field { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; color: var(--muted); font-size: 13px; }
.card-field .value { color: var(--text); }

/* Страница доски на белом фоне, как на образце: серые панели колонок лучше читаются */
.page:has([data-page=board]) { background: #fff; height: calc(100vh - 52px); padding-bottom: 8px; display: flex; flex-direction: column; }
/* Доска занимает остаток высоты окна и прокручивается внутри себя: полоса горизонтальной прокрутки всегда внизу окна */
.page:has([data-page=board]) > [data-pjax-container] { flex: 1; min-height: 0; display: flex; flex-direction: column; }
[data-page=board] { flex: 1; min-height: 0; display: flex; flex-direction: column; }
[data-page=board] .board { flex: 1; min-height: 0; overflow: auto; padding-bottom: 8px; }
[data-page=board] .board-head { flex: none; }

/* Шапка доски: хлебные крошки, фильтры-«таблетки», чипы исполнителей */
.board-head { margin-bottom: 14px; }
.board-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.board-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: #e8eaff; color: #5a5fd8; font-size: 15px; }
.crumb-muted { color: var(--muted); }
.crumb-sep { color: var(--muted); }
.crumb-select { border: 0; background: none; font-size: 17px; font-weight: 700; padding: 2px 4px; cursor: pointer; max-width: 260px; }
.chip-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.pill { height: 34px; border: 1px solid var(--border); border-radius: 17px; background: var(--panel); padding: 0 14px; font-size: 14px; color: var(--text); }
.pill:focus { outline: none; border-color: var(--primary); }
.pill-chip { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); text-decoration: none; font-size: 14px; white-space: nowrap; }
.pill-chip:hover { background: #f1f3f6; text-decoration: none; color: var(--text); }
.pill-chip.active { background: #2f6df6; border-color: #2f6df6; color: #fff; }
.chip-reset { color: var(--muted); font-size: 18px; text-decoration: none; padding: 0 6px; }
.chip-reset:hover { color: var(--text); text-decoration: none; }

/* Бэклог: список */
.section-title { font-weight: 600; margin: 16px 0 8px; display: flex; gap: 8px; align-items: baseline; }
.section-title .count { color: var(--muted); font-weight: 400; }
.list { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); min-height: 44px; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; background: var(--panel); }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: #f8f9fb; }
.list-row.card-ghost { opacity: .4; }
.list-row .handle { color: #aab0b9; cursor: grab; user-select: none; }
.list-row .row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list.list-disabled { opacity: .45; }

/* Панель карточки справа */
.drawer-overlay { position: fixed; inset: 0; background: rgba(20, 24, 31, .35); z-index: 50; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 50vw; min-width: min(480px, 100vw); background: var(--panel); z-index: 51; overflow-y: auto; padding: 18px 22px 40px; box-shadow: -8px 0 24px rgba(0, 0, 0, .15); }
.drawer-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.drawer-head .grow { flex: 1; }
.drawer h2 { font-size: 18px; margin: 0; }
.drawer .title-input { font-size: 18px; font-weight: 600; border: 1px solid transparent; padding: 4px 6px; width: 100%; border-radius: 6px; }
.drawer .title-input:hover:not(:disabled), .drawer .title-input:focus { border-color: var(--border); }
.field-row { display: grid; grid-template-columns: 150px 1fr; gap: 8px; align-items: center; padding: 5px 0; }
.field-row .label { color: var(--muted); }
.field-row .form-control { height: 32px; padding: 3px 8px; }
.field-row .form-control.invalid { border-color: var(--danger); }
.drawer textarea.form-control { height: auto; min-height: 110px; }
.drawer .block { margin-top: 18px; }
.drawer .block-title { font-weight: 600; margin-bottom: 6px; }
.drawer .muted { color: var(--muted); }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.link-list li.current { background: #fff6d6; border-radius: 4px; padding: 3px 6px; margin: 0 -6px; }
.link-list a, .link-list button.link { color: var(--primary); cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.sub-tabs { display: flex; gap: 14px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.sub-tab { padding: 6px 0; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; background: none; border-top: 0; border-left: 0; border-right: 0; }
.sub-tab.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }
.comment { padding: 8px 0; border-bottom: 1px solid var(--border); }
.comment .who { font-weight: 600; margin-right: 6px; }
.comment .when { color: var(--muted); font-size: 12px; }
.comment .body { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.log-row { padding: 4px 0; color: #3b4048; font-size: 13px; }
.log-row .when { color: var(--muted); margin-right: 8px; }
.progress-bar { height: 8px; background: #e6e8ec; border-radius: 4px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: #4caf50; }
.actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }


/* Добавки для панели и форм */
.inline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.grow { flex: 1; }
.tab-pane[hidden] { display: none; }
button.link { color: var(--primary); background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }

@media (max-width: 700px) {
    .user-email { display: none; }
    .topbar { gap: 12px; padding: 0 12px; }
}

/* Спринты и календарь */
.page-tabs { margin-bottom: 12px; }
.page-tabs .sub-tab { text-decoration: none; }
.sprint-layout { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; align-items: start; }
.sprint-list { min-height: 0; }
.sprint-row { flex-wrap: wrap; text-decoration: none; color: var(--text); }
.sprint-row:hover { text-decoration: none; }
.sprint-row.selected { background: #eef3ff; box-shadow: inset 3px 0 0 var(--primary); }
.sprint-row .sprint-meta { flex-basis: 100%; font-size: 12px; }
.chip.sprint-planned { background: #dfe7f5; color: #2a4f9a; }
.chip.sprint-active { background: #dcf3dd; color: #247a2e; }
.chip.sprint-closed { background: #ececec; color: #777; }
.sprint-detail { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; min-width: 0; }
.sprint-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sprint-head h2 { font-size: 18px; margin: 0; }
.sprint-detail .block { margin-top: 20px; }
.sprint-detail .block-title, .calendar-col .block-title { font-weight: 600; margin-bottom: 6px; }
.sprint-detail .muted, .calendar-col .muted { color: var(--muted); }
.next-sprint { width: auto; min-width: 180px; }
.table .num { text-align: right; white-space: nowrap; }
.cap-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.cap-actions .form-control { width: 80px; }
.plan-box { margin-top: 12px; padding: 12px; background: #f8f9fb; border-radius: var(--radius); border: 1px solid var(--border); }
.plan-table .form-control { min-width: 150px; }
.plan-box .link-list .avatar { margin-right: 4px; }
.calendar-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 24px; align-items: start; }
.form-row-gap { margin-top: 10px; }
.form-row-gap .form-control { width: auto; }
@media (max-width: 800px) {
    .sprint-layout { grid-template-columns: 1fr; }
}

/* Узкие экраны: таблицы прокручиваются внутри блока, а не расширяют страницу */
.table-wrap { overflow-x: auto; }
.sprint-detail .list-row { flex-wrap: wrap; }
.sprint-detail .row-title { min-width: 140px; white-space: normal; }
@media (max-width: 700px) {
    .topbar .brand { display: none; }
    .tabs { overflow-x: auto; min-width: 0; flex: 1; }
    .user { flex: none; margin-left: 0; }
    .page { padding: 12px 12px 32px; }
    .sprint-detail { padding: 12px; }
}

/* Диаграмма Ганта */
.gantt-note { margin-bottom: 8px; color: var(--muted); }
.gantt-legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.swatch { display: inline-block; width: 16px; height: 10px; border-radius: 3px; background: #dfe7f5; }
.swatch.vacation { background: repeating-linear-gradient(45deg, #f3d9a8, #f3d9a8 4px, #fbeccc 4px, #fbeccc 8px); }
.swatch.manual { background: #fff; border: 2px dashed #2a4f9a; }
.swatch.overflow { background: #dfe7f5; border-right: 4px solid var(--danger); }
.gantt-scroll { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.gantt { min-width: calc(190px + var(--days) * 34px); }
.gantt-row { display: grid; grid-template-columns: 190px 1fr; border-bottom: 1px solid var(--border); }
.gantt-row:last-child { border-bottom: 0; }
.gantt-head { background: #f8f9fb; font-size: 12px; position: sticky; top: 0; }
.gantt-name { position: sticky; left: 0; z-index: 3; background: inherit; display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-right: 1px solid var(--border); background-color: var(--panel); min-width: 0; }
.gantt-head .gantt-name { background-color: #f8f9fb; font-weight: 600; }
.gantt-name .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-name .load { font-size: 12px; white-space: nowrap; }
.gantt-days, .gantt-track { display: grid; grid-template-columns: repeat(var(--days), minmax(0, 1fr)); position: relative; }
.gantt-day { display: flex; flex-direction: column; align-items: center; padding: 4px 0; border-left: 1px solid var(--border); }
.gantt-day .d-name { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.gantt-day.weekend, .gantt-cell.weekend { background: #f1f2f5; }
.gantt-day.holiday, .gantt-cell.holiday { background: #fdebd2; }
.gantt-day.today, .gantt-cell.today { box-shadow: inset 2px 0 0 var(--primary), inset -2px 0 0 var(--primary); }
.gantt-cell { border-left: 1px solid var(--border); }
.gantt-bar { z-index: 1; margin: 3px 1px; padding: 0 6px; border-radius: 4px; font-size: 12px; line-height: 24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; background: #dfe7f5; color: #2a4f9a; border: 1px solid rgba(0, 0, 0, .08); }
.gantt-bar:hover { filter: brightness(.96); }
.gantt-bar.vacation { cursor: default; color: #7a5b13; background: repeating-linear-gradient(45deg, #f3d9a8, #f3d9a8 6px, #fbeccc 6px, #fbeccc 12px); }
.gantt-bar.manual { border: 2px dashed #2a4f9a; line-height: 22px; }
.gantt-bar.overflow { border-right: 4px solid var(--danger); }
.gantt-bar.no-estimate { font-style: italic; }
.gantt-bar.bar-status-backlog { background: #e6e8ec; color: #3b4048; }
.gantt-bar.bar-status-queued { background: #dfe7f5; color: #2a4f9a; }
.gantt-bar.bar-status-in_progress { background: #d9e8ff; color: #1c53c4; }
.gantt-bar.bar-status-blocked { background: #fde0e0; color: #a42525; }
.gantt-bar.bar-status-review { background: #ece1fb; color: #6b3fb0; }
.gantt-bar.bar-status-testing { background: #fdebd2; color: #9a5b0b; }
.gantt-bar.bar-status-grooming { background: #f3e8d4; color: #8a5a12; }
.gantt-bar.bar-status-plannable { background: #e4ecf7; color: #345a99; }
.gantt-bar.bar-status-waiting { background: #e8e1f5; color: #55398f; }
.gantt-bar.bar-status-final_review { background: #f0dff5; color: #7d2f93; }
.gantt-bar.bar-status-ready { background: #dcf3dd; color: #247a2e; }
.gantt-bar.bar-status-released { background: #c9eccd; color: #1c6b27; }
.swatch.bar-status-queued { background: #dfe7f5; }

/* Диаграмма сгорания */
.epic-select { min-width: 320px; max-width: 100%; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.stat-value { font-size: 22px; font-weight: 600; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 2px; }
.chart-box { position: relative; height: 360px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.chart-note { margin: 8px 0 4px; color: var(--muted); font-size: 12px; }
@media (max-width: 700px) {
    .epic-select { min-width: 0; width: 100%; }
    .chart-box { height: 280px; padding: 8px; }
}

/* Сообщения о результате действия: выводятся сервером, скрываются сами */
.flash-box { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 90; pointer-events: none; }
.flash { padding: 10px 14px; border-radius: 8px; max-width: 420px; color: #fff; box-shadow: 0 4px 16px rgba(0, 0, 0, .25); animation: flash-out 7s forwards; }
.flash-ok { background: #2e7d32; }
.flash-error { background: var(--danger); animation-duration: 10s; }
.net-error { position: fixed; right: 18px; bottom: 18px; z-index: 90; animation: none; }
.net-error[hidden] { display: none; }
@keyframes flash-out { 0%, 85% { opacity: 1; visibility: visible; } 100% { opacity: 0; visibility: hidden; } }
.invalid-text { color: var(--danger); font-size: 12px; margin-top: 2px; }

/* Формы, отправляемые через PJAX */
.inline-form { display: inline-flex; margin: 0; align-items: center; }
.form-control.is-invalid, .title-input.is-invalid { border-color: var(--danger); }

/* Полосы предложенного плана на диаграмме Ганта */
.gantt-bar.proposed { box-shadow: inset 0 0 0 2px #2e9d6f; background-image: repeating-linear-gradient(135deg, rgba(46, 157, 111, .22) 0 6px, transparent 6px 12px); }
.swatch.proposed { background: #fff; border: 2px solid #2e9d6f; }
.plan-box .gantt-note { margin-top: 6px; }
.gantt-note .legend-item { margin-left: 12px; }
/* Продолжение полосы после выходных или другой задачи: без подписи, с тем же цветом */
.gantt-bar.continued { text-indent: -999px; }

/* Шапка карточки: хлебные крошки, кнопки ссылки, подпись с датами */
.task-crumbs { flex-wrap: wrap; }
.crumb-link { color: var(--muted); text-decoration: none; }
.crumb-link:hover { color: var(--text); text-decoration: underline; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; position: relative; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; padding: 0; }
.icon-btn:hover { background: #eceef1; color: var(--text); text-decoration: none; }
.icon-btn.copied { color: #2e7d32; }
.icon-btn.copied::after { content: attr(data-copied); position: absolute; top: 100%; left: 0; margin-top: 4px; font-size: 12px; white-space: nowrap; background: #1f2328; color: #fff; padding: 3px 8px; border-radius: 6px; z-index: 5; }
.task-dates { color: var(--muted); font-size: 13px; margin: 2px 6px 0; }
.task-side .side-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }

/* Отдельная страница задачи: основное слева, параметры справа */
.task-page { display: grid; grid-template-columns: minmax(0, 1fr) 340px; column-gap: 40px; align-items: start; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 26px 32px; }
.task-page .task-top { grid-column: 1; grid-row: 1; }
.task-page .task-rest { grid-column: 1; grid-row: 2; }
.task-page .task-side { grid-column: 2; grid-row: 1 / span 2; border-left: 1px solid var(--border); padding-left: 24px; }
.task-page .title-input { font-size: 24px; font-weight: 600; border: 1px solid transparent; padding: 4px 6px; width: 100%; border-radius: 6px; }
.task-page .title-input:hover:not(:disabled), .task-page .title-input:focus { border-color: var(--border); }
.task-page .block { margin-top: 18px; }
.task-page .task-side .block:first-of-type { margin-top: 0; }
.task-page .block-title { font-weight: 600; margin-bottom: 6px; }
.task-page .muted { color: var(--muted); }
.task-page textarea.form-control { height: auto; min-height: 140px; }
.task-page .field-row { grid-template-columns: 130px 1fr; }
@media (max-width: 900px) {
    .task-page { grid-template-columns: minmax(0, 1fr); padding: 14px; }
    .task-page .task-side { grid-column: 1; grid-row: 2; border-left: 0; padding-left: 0; margin-top: 12px; }
    .task-page .task-rest { grid-row: 3; }
}

/* Окно новой задачи и эпика: слева описание, справа чат с Claude */
.draft-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, 1fr); gap: 24px; align-items: start; }
.draft-left, .draft-chat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; }
.draft-left .crumbs { color: var(--muted); margin-bottom: 10px; }
.draft-rule { background: #eef6ff; color: #23498a; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 8px; }
.draft-rule.strict { background: #fff6e0; color: #7a5a10; }
.draft-left .block { margin-top: 14px; }
.draft-left .block-title { font-weight: 600; margin-bottom: 6px; }
.title-field { font-size: 18px; font-weight: 600; }
.draft-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.draft-fields label { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 12px; color: var(--muted); }
.draft-fields .form-control { height: 34px; padding: 3px 8px; }
.draft-description { min-height: 260px; }
.draft-status { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }
.draft-status .state { color: var(--muted); }
.draft-status .state.ok { color: #247a2e; font-weight: 600; }
.draft-status .state.warn { color: #9a5b0b; font-weight: 600; }
.draft-actions { margin-top: 12px; }
.draft-plan ol { padding-left: 20px; margin: 0; }
.draft-plan li { margin: 4px 0; }
.draft-chat { position: sticky; top: 64px; display: flex; flex-direction: column; height: calc(100vh - 90px); min-height: 420px; }
.chat-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.chat-messages { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 8px; }
.chat-empty { color: var(--muted); font-size: 14px; padding: 12px 4px; }
.chat-msg { max-width: 94%; }
.chat-msg .chat-body { padding: 9px 12px; border-radius: 12px; line-height: 1.4; word-break: break-word; font-size: 14px; }
.chat-user { align-self: flex-end; }
.chat-user .chat-body { background: #2f6df6; color: #fff; border-bottom-right-radius: 4px; }
.chat-bot { align-self: flex-start; }
.chat-bot .chat-body { background: #f1f3f6; border-bottom-left-radius: 4px; }
.chat-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chat-actions .done { opacity: .5; }
.chat-thinking { display: none; align-self: flex-start; color: var(--muted); font-size: 13px; padding: 6px 4px; }
.draft-page.is-thinking .chat-thinking { display: block; }
.draft-page.is-thinking .draft-actions .btn, .draft-page.is-thinking .chat-actions .btn, .draft-page.is-thinking .chat-input .btn { pointer-events: none; opacity: .55; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--border); padding-top: 10px; }
.chat-input textarea { flex: 1; resize: none; }
@media (max-width: 900px) {
    .draft-grid { grid-template-columns: minmax(0, 1fr); }
    .draft-chat { position: static; height: 70vh; }
}

.plan-list { padding-left: 20px; margin: 0; }
.plan-list li { margin: 4px 0; }

/* Тимлиды доски */
.board-leads { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 20px 8px; font-size: 13px; }
.board-leads .leads-edit { display: inline-block; }
.board-leads .leads-edit summary { cursor: pointer; color: var(--accent, #2f6df6); }
.board-leads .leads-list { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0; max-width: 720px; }
.board-leads .leads-item { display: inline-flex; align-items: center; gap: 4px; }

/* Диаграмма Ганта: стрелки зависимостей и перетаскивание полос */
.gantt { position: relative; }
.gantt-arrows { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 2; overflow: visible; }
.gantt-arrow { fill: none; stroke: #6b7a8f; stroke-width: 1.4; }
.gantt-bar.draggable { cursor: grab; touch-action: none; user-select: none; }
.gantt-bar.dragging { cursor: grabbing; opacity: .8; z-index: 5; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }

/* Вложения: карточки файлов (картинки с миниатюрой, остальные значком), крестик и карточка добавления */
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; white-space: nowrap; }
.att-block .muted { color: var(--muted); font-weight: 400; font-size: 12px; }
.upl { display: flex; flex-wrap: wrap; gap: 12px; }
.upt, .upa { position: relative; width: 120px; }
.upt .upo { display: flex; align-items: center; justify-content: center; width: 120px; height: 120px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #f7f8fa; text-decoration: none; }
.upt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upe { font-weight: 700; font-size: 15px; letter-spacing: .5px; color: var(--muted); border: 2px solid var(--border); border-radius: 6px; padding: 8px 10px; background: #fff; }
.upn { display: block; margin-top: 4px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ups { display: block; font-size: 11px; color: var(--muted); }
.upx { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; background: rgba(31, 35, 40, .72); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.upx:hover, .upx:focus-within { background: var(--danger); }
.upx svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 2.2; fill: none; stroke-linecap: round; }
.upa { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 120px; border: 2px dashed var(--border); border-radius: var(--radius); color: var(--muted); cursor: pointer; text-align: center; }
.upa:hover, .upa:focus-within { border-color: var(--primary); color: var(--primary); }
.upa svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.upa b { font-weight: 600; font-size: 12px; padding: 0 6px; }
.upc { font-size: 11px; }
.upl.busy { opacity: .5; pointer-events: none; }
.uph { margin: 8px 0 0; }

/* Состав доски: крестик на чипе исполнителя и плюс для добавления (видны администратору и тимлиду доски) */
.pill-chip-wrap { position: relative; display: inline-flex; }
.pill-chip-wrap.has-x .pill-chip { padding-right: 24px; }
.chip-x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--panel); color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer; display: none; align-items: center; justify-content: center; }
.pill-chip-wrap:hover .chip-x, .chip-x:focus-visible { display: inline-flex; }
@media (hover: none) { .chip-x { display: inline-flex; } }
.chip-x:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.member-add { position: relative; }
.member-add > summary { list-style: none; cursor: pointer; justify-content: center; width: 34px; padding: 0; font-size: 20px; color: var(--muted); }
.member-add > summary::-webkit-details-marker { display: none; }
.member-add-pop { position: absolute; z-index: 30; top: 40px; left: 0; display: flex; align-items: center; gap: 8px; padding: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); white-space: nowrap; }

