#tasks_spase {
    padding: 16px;
}

.tasks-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.tasks-toolbar-actions,
.tasks-toolbar-date {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.tasks-summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.tasks-summary-card {
    min-height: 72px;
    padding: 12px 14px;
    border: 1px solid #e4e8ee;
    border-radius: 8px;
    background: #fff;
}

.tasks-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.tasks-tabs .btn.active,
.tasks-tabs .btn.tasks-tab-active {
    color: #fff;
    background: #4b72d0;
    border-color: #4b72d0;
}

.tasks-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    background: #edf2f7;
    white-space: nowrap;
}

.tasks-status-overdue {
    color: #a61b1b;
    background: #fde5e5;
}

.tasks-status-paused {
    color: #765600;
    background: #fff2c7;
}

.tasks-progress {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--bs-gray-200);
}

.tasks-progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--bs-primary);
}

.tasks-row-new {
    box-shadow: inset 4px 0 0 #dc3545;
    background: #fff9f9;
}

.tasks-task-window {
    position: fixed;
    z-index: 1060;
    top: 3vh;
    left: 50%;
    display: flex;
    flex-direction: column;
    width: min(1440px, calc(100vw - 24px));
    min-width: min(1000px, calc(100vw - 24px));
    height: 94vh;
    max-height: 94vh;
    overflow: hidden;
    transform: translateX(-50%);
    border: 0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 0 0 100vmax rgba(27, 34, 48, .48), 0 18px 50px rgba(0, 0, 0, .28);
}

body:has(.tasks-task-window) .mfp-bg {
    z-index: 1070 !important;
}

body:has(.tasks-task-window) .mfp-container,
body:has(.tasks-task-window) .mfp-content {
    z-index: 1071 !important;
}

.tasks-task-window .modal-header,
.tasks-task-window .modal-footer {
    flex: 0 0 auto;
}

.tasks-task-header {
    min-height: 52px;
    padding: 8px 14px;
}

.tasks-task-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.tasks-task-heading .modal-title {
    min-width: 0;
    overflow: hidden;
    font-size: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tasks_task_parent_nav:empty {
    display: none;
}

.tasks-parent-task-button {
    display: inline-flex;
    max-width: 240px;
    min-height: 30px;
    align-items: center;
    gap: 3px;
    overflow: hidden;
    padding: 3px 8px 3px 5px;
    border: 1px solid #d8e1ef;
    border-radius: 6px;
    background: #f5f8fd;
    color: #40516b;
}

.tasks-parent-task-button span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tasks-parent-task-button:hover {
    border-color: #aebed6;
    background: #edf3fb;
}

.tasks-task-window .tasks-task-left-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 50px;
    padding: 8px 10px;
    background: #fff;
}

.tasks-task-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding: 8px;
}

.tasks-task-layout {
    display: grid;
    grid-template-columns: minmax(600px, 1.55fr) 8px minmax(360px, 1fr);
    gap: 6px;
}

.tasks-task-pane {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid #dde3eb;
    border-radius: 8px;
    background: #fff;
}

.tasks-task-left-pane,
.tasks-task-right-pane {
    display: flex;
    flex-direction: column;
}

.tasks-task-left-scroll {
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 10px;
}

.tasks-layout-resizer {
    min-width: 8px;
    cursor: ew-resize;
    border-radius: 4px;
    background: transparent;
}

.tasks-layout-resizer:hover,
.tasks-layout-resizer:active {
    background: #e3e9f1;
}

.tasks-window-resize-right {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 4;
    width: 8px;
    height: 100%;
    cursor: ew-resize;
}

.tasks-window-resize-right:hover,
.tasks-window-resize-right:active {
    background: rgba(227, 233, 241, .8);
}

.tasks-resizing .tasks-task-window,
.tasks-resizing .tasks-task-window * {
    cursor: ew-resize !important;
    user-select: none;
}

.tasks-detail-tabs {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 0 10px;
    border-bottom: 1px solid #e2e7ee;
}

.tasks-detail-tab {
    min-width: 0;
    padding: 12px 6px 10px;
    overflow: hidden;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #505a6c;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tasks-detail-tab:hover {
    color: var(--bs-primary);
}

.tasks-detail-tab-active {
    border-bottom-color: var(--bs-primary);
    color: var(--bs-primary);
}

.tasks-detail-panels {
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.tasks-detail-panel {
    display: none;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
}

.tasks-detail-panel-active {
    display: block;
    overflow-y: auto;
    padding: 10px;
}

#tasks_feed_block.tasks-detail-panel-active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

#tasks_feed_block > .tasks-section-title,
#tasks_files_block > .tasks-section-title {
    display: none;
}

#tasks_feed_block > .tasks-feed {
    min-height: 0;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 10px;
}

.tasks-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
    padding: 8px;
    border: 1px solid #e3e8ef;
    border-radius: 7px;
}

.tasks-detail-grid label {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    margin: 0;
    white-space: nowrap;
}

.tasks-detail-grid .form-control,
.tasks-detail-grid .form-select,
.tasks-participant-chip .form-control,
.tasks-participant-chip .form-select,
.tasks-participant-add .form-select,
.tasks-single-role .form-select,
.tasks-executor-row .form-control,
.tasks-executor-row .form-select {
    min-height: 30px;
    padding-top: 3px;
    padding-bottom: 3px;
    font-size: 13px;
}

.tasks-detail-grid textarea.form-control {
    height: 48px;
    min-height: 48px;
    resize: vertical;
    white-space: normal;
}

.tasks-detail-meta {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tasks-detail-wide {
    grid-column: 1 / -1;
}

.tasks-section-title {
    margin: 10px 0 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e7eaf0;
    font-size: 14px;
    font-weight: 600;
}

#tasks_participants_block {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

#tasks_participants_block .tasks-section-title,
#tasks_participants_block .tasks-participant-group {
    grid-column: 1 / -1;
}

.tasks-participant-group,
.tasks-file-list,
.tasks-feed,
.tasks-history,
.tasks-subtask-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tasks-participant-group-title {
    display: flex;
    min-height: 28px;
    align-items: center;
}

.tasks-executor-table {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #e1e6ed;
    border-radius: 6px;
}

.tasks-executor-header,
.tasks-executor-row {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(110px, 1.35fr) minmax(58px, .55fr) minmax(58px, .55fr) minmax(95px, .9fr) minmax(110px, 1.2fr) 70px;
    gap: 6px;
    align-items: center;
}

.tasks-executor-header {
    min-height: 30px;
    padding: 4px 7px;
    background: #f2f5f9;
    color: #657086;
    font-size: 12px;
    font-weight: 600;
}

.tasks-executor-row {
    min-height: 40px;
    padding: 4px 7px;
    border-top: 1px solid #e8ecf1;
    background: #fff;
}

.tasks-executor-cell,
.tasks-executor-name,
.tasks-executor-comment {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tasks-executor-cell .form-control,
.tasks-executor-cell .form-select {
    width: 100%;
    min-width: 0;
}

.tasks-executor-name {
    font-weight: 500;
}

.tasks-executor-actions,
.tasks-subtask-actions {
    display: flex;
    min-width: 0;
    justify-content: flex-end;
    gap: 4px;
}

.tasks-executor-actions .btn,
.tasks-subtask-actions .btn {
    width: 32px;
    height: 30px;
    padding: 3px;
}

.tasks-participant-chip,
.tasks-participant-add,
.tasks-file-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    padding: 5px 7px;
    border: 1px solid #e5e8ed;
    border-radius: 6px;
    background: #fafbfc;
}

.tasks-participant-chip > span {
    min-width: 120px;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tasks-participant-chip label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    margin: 0;
    white-space: nowrap;
}

.tasks-participant-chip input {
    width: 78px;
}

.tasks-participant-add select {
    min-width: 0;
    flex: 1 1 auto;
}

.tasks-single-role {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    margin: 0;
    white-space: nowrap;
}

.tasks-subtask-row {
    display: grid;
    grid-template-columns: minmax(140px, 2fr) minmax(110px, 1fr) minmax(55px, .5fr) 82px 100px 36px;
    gap: 6px;
    align-items: center;
    padding: 6px 8px;
    border: 1px solid #e5e8ed;
    border-radius: 6px;
}

.tasks-subtask-row > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tasks-subtask-row:hover {
    background: #f5f8ff;
}

.tasks-file-row > :first-child {
    flex: 1 1 auto;
    text-align: left;
}

.tasks-file-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 7px;
}

.tasks-file-filters label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    cursor: pointer;
}

.tasks-file-preview {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    gap: 10px;
}

.tasks-file-thumb {
    display: flex;
    width: 60px;
    height: 44px;
    min-width: 60px;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #dce2ea;
    border-radius: 6px;
    background: #eef2f7;
    cursor: pointer;
}

.tasks-file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tasks-file-name {
    min-width: 0;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
}

.tasks-file-pending {
    border-style: dashed;
    color: #596274;
}

.tasks-history-item {
    padding: 7px 9px;
    border-left: 3px solid #dce3ee;
    background: #f8f9fb;
}

.tasks-feed-item {
    width: fit-content;
    max-width: 88%;
    align-self: flex-start;
    padding: 8px 10px;
    border: 1px solid #cfe0f7;
    border-left: 3px solid #5b8fd9;
    border-radius: 4px 10px 10px 10px;
    background: #eef5ff;
    overflow-wrap: anywhere;
}

.tasks-feed-item-own {
    align-self: flex-end;
    border: 1px solid #c9ead6;
    border-right: 3px solid #43a86c;
    border-radius: 10px 4px 10px 10px;
    background: #eaf8ef;
}

.tasks-feed-meta-row,
.tasks-comment-manage,
.tasks-comment-edit,
.tasks-comment-edit .tasks-comment-actions {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 6px;
}

.tasks-feed-meta-row {
    justify-content: space-between;
}

.tasks-feed-meta-row > :first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tasks-comment-manage {
    flex: 0 0 auto;
}

.tasks-comment-manage .btn {
    padding: 0 3px;
    font-size: 12px;
}

.tasks-comment-manage .tasks-comment-icon {
    width: 26px;
    height: 26px;
    padding: 2px;
    font-size: 16px;
    line-height: 20px;
}

.tasks-comment-edit {
    flex-direction: column;
    align-items: stretch;
    margin-top: 5px;
}

.tasks-comment-edit textarea {
    min-height: 56px;
    resize: vertical;
}

.tasks-comment-edit .tasks-comment-actions {
    justify-content: flex-end;
}

.tasks-comment-form {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 8px;
    border-top: 1px solid #e2e7ee;
    background: #fff;
}

.tasks-comment-form textarea {
    width: 100%;
    min-height: 62px;
    max-height: 120px;
    flex: 1 0 100%;
    resize: vertical;
}

.tasks-comment-actions {
    display: flex;
    width: 100%;
    flex-direction: row;
    justify-content: flex-end;
    gap: 6px;
}

.tasks-comment-pending {
    display: flex;
    max-height: 112px;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 6px;
    overflow-y: auto;
    margin: 0;
    padding: 6px 8px;
    border-top: 1px solid #eef1f5;
}

.tasks-comment-pending > span {
    padding: 3px 7px;
    border-radius: 12px;
    background: #eef2f7;
}

.tasks-comment-pending > div {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 8px;
    background: #eef2f7;
}

.tasks-comment-files {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.tasks-participant-comment {
    min-width: 170px;
}

@media (max-width: 1050px) {
    .tasks-summary {
        grid-template-columns: repeat(3, minmax(120px, 1fr));
    }
}

@media (max-width: 1023px) {
    .tasks-task-window {
        top: 1vh;
        left: 6px !important;
        width: calc(100vw - 12px) !important;
        min-width: 0 !important;
        height: 98vh;
        max-height: 98vh;
        transform: none !important;
    }

    .tasks-task-layout {
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: minmax(320px, 1fr) minmax(360px, 1fr);
        overflow-y: auto;
    }

    .tasks-layout-resizer,
    .tasks-window-resize-right {
        display: none;
    }

    .tasks-task-pane {
        min-height: 320px;
    }
}

@media (max-width: 720px) {
    #tasks_spase {
        padding: 10px;
    }

    .tasks-summary {
        grid-template-columns: repeat(2, minmax(110px, 1fr));
    }

    .tasks-detail-grid,
    #tasks_participants_block {
        grid-template-columns: 1fr;
    }

    .tasks-detail-wide,
    #tasks_participants_block .tasks-section-title,
    #tasks_participants_block .tasks-participant-group {
        grid-column: auto;
    }

    .tasks-subtask-row {
        grid-template-columns: 1fr;
    }

    .tasks-parent-task-button {
        max-width: 150px;
    }

    .tasks-executor-table {
        display: flex;
        flex-direction: column;
        gap: 6px;
        overflow: visible;
        border: 0;
    }

    .tasks-executor-header {
        display: none;
    }

    .tasks-executor-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px 10px;
        padding: 8px;
        border: 1px solid #e1e6ed;
        border-radius: 6px;
    }

    .tasks-executor-cell {
        display: flex;
        flex-direction: column;
        gap: 3px;
        overflow: visible;
        white-space: normal;
    }

    .tasks-executor-cell::before {
        content: attr(data-label);
        color: #727d90;
        font-size: 11px;
        font-weight: 600;
    }

    .tasks-executor-name,
    .tasks-executor-comment,
    .tasks-executor-actions {
        grid-column: 1 / -1;
    }

    .tasks-executor-actions {
        flex-direction: row;
    }

    .tasks-feed-item {
        max-width: 96%;
    }

    .tasks-detail-grid label,
    .tasks-single-role {
        grid-template-columns: minmax(105px, max-content) minmax(0, 1fr);
    }

    .tasks-participant-chip,
    .tasks-participant-add {
        flex-wrap: wrap;
    }

    .tasks-participant-chip > span {
        min-width: calc(100% - 42px);
    }
}
