/* MARK AS DONE — Shared Task Details modal */
.task-details-dialog {
    max-width: 1180px;
}

.task-details-modal {
    max-height: calc(100vh - 32px);
    overflow: hidden;
}

.task-details-header,
.task-details-footer {
    flex: 0 0 auto;
    background: var(--surface, #fff);
}

.task-details-heading,
.task-details-header-actions,
.task-footer-navigation,
.task-context-actions,
.workflow-detail-title,
.output-section-head,
.gdrive-file-row {
    display: flex;
    align-items: center;
}

.task-details-heading {
    gap: 12px;
}

.task-details-heading p,
.task-section-heading p,
.workflow-detail-head p,
.output-section-head p {
    margin: 2px 0 0;
    color: var(--muted, #718096);
    font-size: 12px;
}

.task-details-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(126, 242, 23, 0.13);
    color: #55b900;
    font-size: 18px;
}

.task-details-header-actions {
    margin-left: auto;
    gap: 12px;
}

.task-footer-navigation,
.task-context-actions {
    gap: 8px;
}

.task-details-body {
    min-height: 0;
    overflow: auto;
    background: var(--page, #f7f9fc);
}

.task-summary-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.85fr);
    border: 1px solid rgba(126, 242, 23, 0.28);
    border-radius: 12px;
    background: linear-gradient(115deg, rgba(126, 242, 23, 0.08), rgba(126, 242, 23, 0.025));
    overflow: hidden;
}

.task-summary-main {
    padding: 20px;
}

.task-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.task-title-row.compact {
    gap: 8px;
}

.task-title-row h2 {
    margin: 0;
    font-size: 22px;
}

.task-title-row.compact h3 {
    margin: 0;
}

.task-summary-main > p {
    margin: 8px 0 0;
    max-width: 720px;
    color: var(--muted, #667085);
}

.task-summary-meta {
    padding: 16px 20px;
    border-left: 1px solid var(--border, #e2e8f0);
    display: grid;
    gap: 9px;
    align-content: center;
}

.task-summary-meta > div {
    display: grid;
    grid-template-columns: 86px 1fr;
    gap: 8px;
    font-size: 12px;
}

.task-summary-meta span,
.workflow-meta-item span,
.review-summary span {
    color: var(--muted, #718096);
}

.task-inline-icon {
    border: 0;
    padding: 2px 5px;
    background: transparent;
    color: var(--muted, #718096);
    cursor: pointer;
}

.project-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: #2d9cff;
}

.task-details-layout {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 14px;
    margin-top: 14px;
}

.workflow-panel,
.workflow-detail-panel {
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    background: var(--surface, #fff);
}

.workflow-panel {
    padding: 14px 10px;
}

.task-section-heading {
    padding: 0 6px 10px;
}

.task-section-heading h3,
.workflow-detail-head h3 {
    margin: 0;
    font-size: 16px;
}

.workflow-level-list {
    display: grid;
    gap: 6px;
}

.workflow-level-item {
    width: 100%;
    border: 0;
    border-radius: 9px;
    padding: 10px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 9px;
    align-items: center;
    text-align: left;
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}

.workflow-level-item:hover {
    background: rgba(126, 242, 23, 0.08);
    transform: translateX(2px);
}

.workflow-level-item.active {
    background: rgba(126, 242, 23, 0.14);
    box-shadow: inset 3px 0 #7ef217;
}

.workflow-state,
.workflow-detail-check {
    border-radius: 50%;
    display: grid;
    place-items: center;
}

.workflow-state {
    width: 24px;
    height: 24px;
    border: 2px solid #a7b0bf;
    color: #a7b0bf;
    font-size: 10px;
}

.workflow-level-item.done .workflow-state,
.workflow-level-item.active .workflow-state,
.workflow-detail-check {
    border-color: #17b657;
    background: #17b657;
    color: #fff;
}

.workflow-state.progress {
    border-color: #e5a400;
    background: transparent;
    color: #e5a400;
}

.workflow-copy {
    min-width: 0;
    display: grid;
}

.workflow-copy b {
    font-size: 12px;
}

.workflow-copy small {
    color: var(--muted, #718096);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workflow-detail-panel {
    min-width: 0;
    overflow: hidden;
}

.workflow-detail-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.workflow-detail-title {
    gap: 10px;
}

.workflow-detail-check {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
}

.workflow-meta-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.workflow-meta-item {
    padding: 12px 14px;
    border-right: 1px solid var(--border, #e2e8f0);
    display: grid;
    gap: 4px;
    font-size: 11px;
}

.workflow-meta-item:last-child {
    border-right: 0;
}

.task-detail-tabs {
    padding: 0 16px;
    gap: 18px;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.task-detail-tabs .nav-link {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 12px 4px 10px;
    color: var(--muted, #667085);
    background: transparent;
    font-size: 12px;
    cursor: pointer;
}

.task-detail-tabs .nav-link:hover,
.task-detail-tabs .nav-link.active {
    color: #36b900;
    border-bottom-color: #55d900;
}

.task-detail-tab-content {
    padding: 14px 16px 16px;
}

.output-section-head {
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.output-section-head h4 {
    margin: 0;
    font-size: 15px;
}

.gdrive-preview {
    overflow: hidden;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    background: var(--surface, #fff);
}

.gdrive-preview-stage {
    padding: 8px;
    background: var(--soft, #f7f9fc);
}

.gdrive-preview-art {
    position: relative;
    min-height: 265px;
    overflow: hidden;
    border-radius: 8px;
    padding: 24px;
    color: #fff;
    background:
        radial-gradient(circle at 80% 15%, rgba(126, 242, 23, 0.28), transparent 25%),
        linear-gradient(125deg, #07120c 0%, #063719 55%, #0c6b28 100%);
}

.preview-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 800;
}

.preview-brand i,
.preview-brand b {
    color: #57f574;
}

.preview-copy {
    position: absolute;
    left: 28px;
    bottom: 34px;
    z-index: 2;
    display: grid;
    gap: 8px;
}

.preview-copy strong {
    font-size: 34px;
    line-height: 0.95;
}

.preview-copy span {
    font-size: 12px;
    opacity: 0.85;
}

.preview-window {
    position: absolute;
    right: 28px;
    bottom: 26px;
    width: 52%;
    height: 70%;
    padding: 9px;
    border: 5px solid #171b1d;
    border-radius: 10px;
    background: #f6f8fb;
    transform: perspective(700px) rotateY(-8deg) rotateX(2deg);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.38);
}

.preview-window > span {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 3px;
    border-radius: 50%;
    background: #cbd3dc;
}

.preview-window-body {
    height: calc(100% - 14px);
    margin-top: 5px;
    border-radius: 4px;
    background:
        linear-gradient(90deg, #14211b 0 18%, transparent 18%),
        linear-gradient(#eaf0f4 0 0) 24px 12px / 36% 8px no-repeat,
        linear-gradient(#dfe7ec 0 0) 24px 30px / 68% 46px no-repeat,
        linear-gradient(#e8c9ff 0 0) 24px 88px / 20% 34px no-repeat,
        linear-gradient(#d5f2df 0 0) 48% 88px / 20% 34px no-repeat,
        linear-gradient(#ffe0c3 0 0) 75% 88px / 18% 34px no-repeat,
        #fff;
}

.gdrive-file-row {
    gap: 10px;
    padding: 10px 12px;
}

.gdrive-file-row > i {
    font-size: 25px;
    color: #2aa75f;
}

.gdrive-file-row > div {
    min-width: 0;
    flex: 1;
    display: grid;
}

.gdrive-file-row span,
.gdrive-api-note {
    color: var(--muted, #718096);
    font-size: 10px;
}

.gdrive-ready {
    color: #159447 !important;
    white-space: nowrap;
}

.gdrive-api-note {
    margin: 9px 2px 0;
}

.review-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.review-summary > div {
    display: grid;
    gap: 3px;
    padding: 10px;
    border-radius: 8px;
    background: var(--surface2, #f9fafb);
    border: 1px solid var(--border, #e4e9f0);
    color: var(--text, #1d2939);
    font-size: 11px;
}

.history-list {
    display: grid;
    gap: 10px;
}

.history-item {
    display: grid;
    grid-template-columns: 9px 1fr;
    gap: 9px;
    align-items: start;
}

.history-dot {
    width: 8px;
    height: 8px;
    margin-top: 4px;
    border-radius: 50%;
    background: #7ef217;
    box-shadow: 0 0 0 3px rgba(126, 242, 23, 0.14);
}

.history-item div {
    display: grid;
}

.history-item strong {
    font-size: 11px;
}

.history-item small {
    color: var(--muted, #718096);
}

.task-details-footer {
    justify-content: space-between;
}

.danger-soft {
    color: #d92d20;
    border-color: rgba(217, 45, 32, 0.25);
    background: rgba(217, 45, 32, 0.05);
}

[data-theme="dark"] .task-summary-panel {
    background: linear-gradient(115deg, rgba(126, 242, 23, 0.1), rgba(126, 242, 23, 0.025));
}

[data-theme="dark"] .task-details-body {
    background: var(--page, #11171b);
}

[data-theme="dark"] .workflow-level-item:hover {
    background: rgba(126, 242, 23, 0.08);
}

[data-theme="dark"] .workflow-level-item.active {
    background: rgba(126, 242, 23, 0.12);
}

@media (max-width: 991.98px) {
    .task-details-header {
        align-items: flex-start;
    }

    .task-details-header-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .task-summary-panel {
        grid-template-columns: 1fr;
    }

    .task-summary-meta {
        border-left: 0;
        border-top: 1px solid var(--border, #e2e8f0);
        grid-template-columns: 1fr 1fr;
    }

    .task-details-layout {
        grid-template-columns: 1fr;
    }

    .workflow-level-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workflow-meta-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workflow-meta-item {
        border-bottom: 1px solid var(--border, #e2e8f0);
    }
}

@media (max-width: 767.98px) {
    .task-details-dialog {
        margin: 0;
        max-width: none;
        min-height: 100%;
    }

    .task-details-modal {
        min-height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .task-header-nav {
        display: none;
    }

    .task-summary-main {
        padding: 15px;
    }

    .task-summary-meta,
    .workflow-level-list,
    .workflow-meta-grid,
    .review-summary {
        grid-template-columns: 1fr;
    }

    .task-summary-meta {
        padding: 13px 15px;
    }

    .workflow-meta-item {
        border-right: 0;
    }

    .output-section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .gdrive-preview-art {
        min-height: 230px;
    }

    .preview-window {
        width: 58%;
        right: 14px;
    }

    .preview-copy strong {
        font-size: 26px;
    }

    .gdrive-ready {
        display: none;
    }

    .task-details-footer {
        align-items: stretch;
        gap: 8px;
    }

    .task-management-actions {
        display: none;
    }

    .task-context-actions,
    .task-context-actions .btn-mad {
        flex: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .workflow-level-item {
        transition: none;
    }
}

/* Task Details tabs — standardized horizontal navigation */
#taskModal .task-detail-tabs {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 0 16px;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    list-style: none;
    border-bottom: 1px solid var(--border, #e2e8f0);
    scrollbar-width: none;
}

#taskModal .task-detail-tabs::-webkit-scrollbar {
    display: none;
}

#taskModal .task-detail-tabs .nav-item {
    display: flex;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
}

#taskModal .task-detail-tabs .nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 48px;
    margin: 0;
    padding: 0 14px;
    white-space: nowrap;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted, #667085);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: color 160ms ease, background-color 160ms ease;
}

#taskModal .task-detail-tabs .nav-link::after {
    content: "";
    position: absolute;
    right: 10px;
    bottom: 0;
    left: 10px;
    height: 2px;
    border-radius: 999px 999px 0 0;
    background: transparent;
    transform: scaleX(0.55);
    transition: background-color 160ms ease, transform 160ms ease;
}

#taskModal .task-detail-tabs .nav-link:hover {
    color: #36b900;
    background: rgba(125, 255, 30, 0.06);
}

#taskModal .task-detail-tabs .nav-link.active {
    color: #36b900;
    background: transparent;
}

#taskModal .task-detail-tabs .nav-link.active::after {
    background: #55d900;
    transform: scaleX(1);
}

#taskModal .task-detail-tabs .nav-link:focus-visible {
    outline: 2px solid rgba(85, 217, 0, 0.42);
    outline-offset: -3px;
    border-radius: 6px;
}

#taskModal .task-detail-tab-content {
    width: 100%;
    min-width: 0;
    padding: 14px 16px 16px;
}

#taskModal .task-detail-tab-content > .tab-pane {
    width: 100%;
}

#taskModal .output-section-head {
    display: flex;
    align-items: flex-start;
}

[data-theme="dark"] #taskModal .task-detail-tabs .nav-link:hover {
    background: rgba(125, 255, 30, 0.08);
}

@media (max-width: 767.98px) {
    #taskModal .task-detail-tabs {
        padding-inline: 10px;
    }

    #taskModal .task-detail-tabs .nav-link {
        min-height: 44px;
        padding-inline: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #taskModal .task-detail-tabs .nav-link,
    #taskModal .task-detail-tabs .nav-link::after {
        transition: none;
    }
}

/* v69 — large Task Details workspace */
#taskModal .task-details-dialog {
    width: min(94vw, 1440px);
    max-width: min(94vw, 1440px);
    margin-left: auto;
    margin-right: auto;
}

#taskModal .task-details-modal {
    height: min(92vh, 940px);
}

#taskModal .task-details-body {
    padding: 16px;
}

#taskModal .task-details-layout {
    grid-template-columns: 290px minmax(0, 1fr);
}

#taskModal .workflow-level-item {
    width: 100%;
    text-align: left;
}

#taskModal .workflow-level-item:focus-visible {
    outline: 2px solid var(--brand, #7ef217);
    outline-offset: 2px;
}

#taskModal .workflow-level-item.active {
    box-shadow: inset 3px 0 0 var(--brand, #7ef217);
}

#taskModal .workflow-detail-panel.is-switching {
    opacity: 0.58;
    transform: translateY(2px);
}

#taskModal .workflow-detail-panel {
    transition: opacity 140ms ease, transform 140ms ease;
}

@media (max-width: 991.98px) {
    #taskModal .task-details-dialog {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        margin: 10px auto;
    }

    #taskModal .task-details-modal {
        height: calc(100vh - 20px);
        max-height: calc(100vh - 20px);
    }
}


/* v70 — independent output presentation per Workflow Level */
#taskModal .workflow-output-placeholder {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px;
    text-align: center;
    border-radius: 10px;
    background: var(--surface, #ffffff);
}

#taskModal .workflow-output-placeholder > i {
    font-size: 42px;
    color: var(--brand, #7eea16);
}

#taskModal .workflow-output-placeholder strong {
    font-size: 16px;
}

#taskModal .workflow-output-placeholder p,
#taskModal .workflow-output-placeholder span {
    max-width: 620px;
    margin: 0;
    color: var(--muted, #718096);
}

#taskModal .workflow-output-video {
    background: linear-gradient(135deg, rgba(126, 234, 22, 0.08), rgba(16, 185, 129, 0.05));
}

html[data-theme="dark"] #taskModal .workflow-output-placeholder {
    background: rgba(255, 255, 255, 0.035);
}


/* v71 — workflow status icons and non-file output semantics */
#taskModal .workflow-level-item.active .workflow-state {
    /* Selection highlight must not overwrite the level's actual workflow status. */
    border-color: #a7b0bf;
    background: transparent;
    color: #a7b0bf;
}

#taskModal .workflow-level-item .workflow-state.done-state,
#taskModal .workflow-level-item.done .workflow-state {
    border-color: #17b657;
    background: #17b657;
    color: #fff;
}

#taskModal .workflow-level-item .workflow-state.progress {
    border-color: #e5a400;
    background: #fff8df;
    color: #c88c00;
}

#taskModal .workflow-detail-check.is-progress {
    border-color: #e5a400;
    background: #fff8df;
    color: #c88c00;
}

#taskModal .workflow-detail-check.is-pending {
    border-color: #a7b0bf;
    background: transparent;
    color: #a7b0bf;
}

#taskModal .workflow-output-text {
    align-items: flex-start;
    text-align: left;
    padding: 22px 24px;
}

#taskModal .workflow-output-text > i {
    display: none;
}

#taskModal .workflow-output-text strong {
    font-size: 13px;
    color: var(--text-muted, #667085);
}

#taskModal .workflow-output-text p {
    margin: 8px 0 0;
    max-width: none;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text, #172033);
    white-space: pre-wrap;
}

#taskModal .gdrive-file-row[hidden] {
    display: none !important;
}

html[data-theme="dark"] #taskModal .workflow-level-item .workflow-state.progress,
html[data-theme="dark"] #taskModal .workflow-detail-check.is-progress {
    background: rgba(229, 164, 0, 0.12);
}


/* v73 — locked Task Details action placement */
.task-details-header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.task-footer-navigation {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 900px) {
    .task-details-header-actions .btn-mad {
        padding-inline: 9px;
    }
}

@media (max-width: 767.98px) {
    .task-details-header-actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }

    .task-details-header-actions .btn-close {
        margin-left: auto;
    }

    .task-details-footer {
        gap: 10px;
    }
}

/* v74 — Task Details sections always fill their available section width. */
.task-summary-panel,
.task-details-layout,
.workflow-panel,
.workflow-detail-panel,
.workflow-detail-head,
.workflow-meta-grid,
.task-detail-tabs,
.task-detail-tab-content,
.task-detail-tab-content > .tab-pane,
.output-section-head,
.gdrive-preview,
.review-summary,
.history-list {
    width: 100%;
    max-width: none;
}

.task-detail-tab-content > .tab-pane.active {
    display: block;
}

.review-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.review-summary > div,
.history-item {
    width: 100%;
    min-width: 0;
}

/* v75 — stretch the Task Details workspace to the available modal height. */
#taskModal .task-details-modal {
    display: flex;
    flex-direction: column;
}

#taskModal .task-details-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#taskModal .task-summary-panel {
    flex: 0 0 auto;
}

#taskModal .task-details-layout {
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
}

#taskModal .workflow-panel,
#taskModal .workflow-detail-panel {
    height: 100%;
    min-height: 0;
}

#taskModal .workflow-detail-panel {
    display: flex;
    flex-direction: column;
}

#taskModal .workflow-detail-head,
#taskModal .workflow-meta-grid,
#taskModal .task-detail-tabs {
    flex: 0 0 auto;
}

#taskModal .task-detail-tab-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#taskModal .task-detail-tab-content > .tab-pane.active {
    flex: 1 1 auto;
    min-height: 100%;
}

#taskModal #taskOutputPane.active,
#taskModal #taskReviewPane.active,
#taskModal #taskHistoryPane.active {
    width: 100%;
    height: 100%;
}

#taskModal #taskOutputPane.active {
    display: flex;
    flex-direction: column;
}

#taskModal #taskOutputPane.active .gdrive-preview,
#taskModal #taskOutputPane.active .workflow-output-placeholder,
#taskModal #taskOutputPane.active .workflow-output-text {
    flex: 1 1 auto;
}

#taskModal #taskReviewPane.active .review-summary,
#taskModal #taskHistoryPane.active .history-list {
    min-height: 100%;
    align-content: start;
}

@media (max-width: 991.98px) {
    #taskModal .task-details-layout {
        flex: 0 0 auto;
    }

    #taskModal .workflow-panel,
    #taskModal .workflow-detail-panel {
        height: auto;
    }
}

/* v78 — keep the Task Details shell fixed while long workflow content scrolls. */
#taskModal .task-details-body {
    overflow: hidden;
}

#taskModal .workflow-panel {
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

#taskModal .workflow-detail-panel {
    overflow: hidden;
}

#taskModal .task-detail-tab-content {
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

#taskModal .task-detail-tab-content > .tab-pane.active {
    min-height: min-content;
    height: auto;
}

#taskModal #taskOutputPane.active,
#taskModal #taskReviewPane.active,
#taskModal #taskHistoryPane.active {
    height: auto;
    min-height: 100%;
}

#taskModal #taskOutputPane.active .gdrive-preview,
#taskModal #taskOutputPane.active .workflow-output-placeholder,
#taskModal #taskOutputPane.active .workflow-output-text {
    flex: 0 0 auto;
}

@media (max-width: 820px) {
    #taskModal .task-details-body {
        overflow-y: auto;
        overflow-x: hidden;
    }

    #taskModal .workflow-panel,
    #taskModal .workflow-detail-panel,
    #taskModal .task-detail-tab-content {
        overflow: visible;
    }
}

/* v129 — Task Details responsive hardening only. */
@media (max-width: 991.98px) {
    #taskModal .modal-dialog.task-details-dialog {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        margin: 12px auto;
    }

    #taskModal .task-details-modal {
        max-height: calc(100dvh - 24px);
    }

    #taskModal .task-details-body {
        overflow-y: auto;
        overflow-x: hidden;
    }

    #taskModal .task-details-layout {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

    #taskModal .workflow-panel,
    #taskModal .workflow-detail-panel {
        width: 100%;
        min-width: 0;
        height: auto;
        overflow: visible;
    }

    #taskModal .workflow-level-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #taskModal .task-detail-tab-content {
        overflow: visible;
    }
}

@media (max-width: 767.98px) {
    #taskModal {
        padding: 0 !important;
    }

    #taskModal .modal-dialog.task-details-dialog {
        width: 100vw;
        max-width: 100vw;
        min-height: 100dvh;
        margin: 0;
    }

    #taskModal .task-details-modal {
        width: 100%;
        min-height: 100dvh;
        max-height: 100dvh;
        border: 0;
        border-radius: 0;
    }

    #taskModal .task-details-header {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
    }

    #taskModal .task-details-heading {
        min-width: 0;
        padding-right: 42px;
    }

    #taskModal .task-details-heading p {
        white-space: normal;
    }

    #taskModal .task-details-header-actions {
        width: 100%;
        margin: 0;
        padding: 0 0 2px;
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    #taskModal .task-details-header-actions::-webkit-scrollbar {
        display: none;
    }

    #taskModal .task-details-header-actions .btn-mad {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    #taskModal .task-details-header-actions .btn-close {
        position: absolute;
        top: 14px;
        right: 14px;
        margin: 0;
    }

    #taskModal .task-details-body {
        flex: 1 1 auto;
        min-height: 0;
        padding: 12px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    #taskModal .task-summary-panel {
        display: block;
    }

    #taskModal .task-summary-main,
    #taskModal .task-summary-meta {
        padding: 14px;
    }

    #taskModal .task-title-row h2 {
        font-size: 19px;
        line-height: 1.25;
    }

    #taskModal .task-summary-meta {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    #taskModal .task-summary-meta > div {
        grid-template-columns: minmax(72px, 86px) minmax(0, 1fr);
    }

    #taskModal .task-summary-meta strong,
    #taskModal .workflow-meta-item strong {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    #taskModal .task-details-layout {
        gap: 12px;
        margin-top: 12px;
    }

    #taskModal .workflow-panel {
        padding: 12px 10px;
    }

    #taskModal .workflow-level-list {
        display: flex;
        gap: 8px;
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 0 4px;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    #taskModal .workflow-level-item {
        flex: 0 0 min(280px, 82vw);
        min-width: 0;
    }

    #taskModal .workflow-detail-head {
        padding: 14px;
    }

    #taskModal .workflow-detail-title {
        align-items: flex-start;
        min-width: 0;
    }

    #taskModal .workflow-detail-title > div {
        min-width: 0;
    }

    #taskModal .workflow-meta-grid {
        display: grid;
        grid-template-columns: 1fr;
    }

    #taskModal .workflow-meta-item {
        min-width: 0;
        border-right: 0;
    }

    #taskModal .task-detail-tabs {
        padding-inline: 10px;
        overflow-x: auto;
        scroll-snap-type: x proximity;
    }

    #taskModal .task-detail-tabs .nav-item {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    #taskModal .task-detail-tab-content {
        min-width: 0;
        overflow: visible;
    }

    #taskModal .task-detail-tab-content > .tab-pane,
    #taskModal .gdrive-preview,
    #taskModal .gdrive-preview-stage,
    #taskModal .history-list,
    #taskModal .review-summary {
        min-width: 0;
        max-width: 100%;
    }

    #taskModal .gdrive-preview-art {
        min-height: 190px;
        overflow: hidden;
    }

    #taskModal .preview-copy strong {
        font-size: clamp(20px, 7vw, 28px);
    }

    #taskModal .gdrive-file-row {
        align-items: flex-start;
        min-width: 0;
    }

    #taskModal .gdrive-file-row > div {
        min-width: 0;
    }

    #taskModal .gdrive-file-row strong,
    #taskModal .gdrive-file-row span,
    #taskModal .history-item strong,
    #taskModal .history-item small {
        overflow-wrap: anywhere;
    }

    #taskModal .task-details-footer {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 10px 12px;
    }

    #taskModal .task-footer-navigation,
    #taskModal .task-context-actions {
        min-width: 0;
    }

    #taskModal .task-footer-navigation {
        flex: 0 0 auto;
    }

    #taskModal .task-context-actions {
        flex: 1 1 auto;
        display: flex;
        justify-content: flex-end;
    }

    #taskModal .task-context-actions .btn-mad {
        flex: 0 1 auto;
        max-width: 100%;
        white-space: normal;
    }
}

@media (max-width: 420px) {
    #taskModal .task-details-icon {
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
    }

    #taskModal .task-details-heading p {
        display: none;
    }

    #taskModal .task-details-header-actions .btn-mad {
        padding-inline: 9px;
    }

    #taskModal .task-details-footer {
        align-items: stretch;
        flex-direction: column;
    }

    #taskModal .task-footer-navigation,
    #taskModal .task-context-actions {
        width: 100%;
    }

    #taskModal .task-footer-navigation .btn-mad,
    #taskModal .task-context-actions .btn-mad {
        flex: 1 1 0;
    }
}


/* v268 — Output feedback + reviewer-status monitoring. */
#taskModal .task-output-entry,
#taskModal .output-review-notes,
#taskModal .reviewer-status-panel {
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    border-radius: 10px;
}
#taskModal .task-output-entry { padding: 14px; }
#taskModal .task-output-instruction { margin: 0 0 12px; color: var(--muted); }
#taskModal .task-output-field { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
#taskModal .task-output-field > span { font-weight: 700; color: var(--text); }
#taskModal .task-output-field .form-control {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}
#taskModal .task-output-field .form-control::placeholder { color: var(--muted); }
#taskModal .task-output-check { display: flex; align-items: center; gap: 10px; color: var(--text); padding: 10px 0; }
#taskModal .output-review-notes { margin-top: 10px; padding: 10px 12px; }
#taskModal .output-review-notes__head,
#taskModal .reviewer-status-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#taskModal .output-review-notes__head span:first-child,
#taskModal .review-status-summary span,
#taskModal .reviewer-status-head span { display: block; color: var(--muted); font-size: 9px; }
#taskModal .output-review-notes__head strong,
#taskModal .reviewer-status-head strong { display: block; color: var(--text); font-size: 11px; }
#taskModal .output-review-note { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
#taskModal .output-review-note strong { display: block; font-size: 11px; }
#taskModal .output-review-note small { display: block; color: var(--muted); font-size: 9px; margin-top: 1px; }
#taskModal .output-review-note p { margin: 4px 0 0; color: var(--text); font-size: 11px; line-height: 1.45; }
#taskModal .review-status-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-bottom: 10px; }
#taskModal .review-status-summary > div { border: 1px solid var(--border); background: var(--surface2); border-radius: 8px; padding: 9px 10px; min-width: 0; }
#taskModal .review-status-summary strong { display: block; color: var(--text); font-size: 11px; margin-top: 3px; overflow-wrap: anywhere; }
#taskModal .reviewer-status-panel { padding: 10px 12px; }
#taskModal .reviewer-status-list { margin-top: 8px; }
#taskModal .reviewer-status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border); padding: 8px 0; }
#taskModal .reviewer-status-row:first-child { border-top: 0; padding-top: 0; }
#taskModal .reviewer-status-row:last-child { padding-bottom: 0; }
#taskModal .reviewer-status-person { display: flex; align-items: center; gap: 8px; min-width: 0; }
#taskModal .reviewer-status-person strong { display: block; color: var(--text); font-size: 11px; }
#taskModal .reviewer-status-person small { display: block; color: var(--muted); font-size: 9px; margin-top: 1px; }
#taskModal .reviewer-status-order { width: 20px; height: 20px; display: inline-grid; place-items: center; flex: 0 0 20px; border: 1px solid var(--border); border-radius: 50%; color: var(--muted); font-size: 9px; font-weight: 700; }
#taskModal .review-decision { align-self: center; font-size: 9px; font-weight: 700; }
#taskModal .review-waiting { color: var(--muted); }
@media (max-width: 767.98px) {
    #taskModal .review-status-summary { grid-template-columns: 1fr; }
    #taskModal .reviewer-status-row { align-items: flex-start; }
}

}
