/* ============================================================
   Task modal — layout skeleton
   The modal is a fixed-height flex column:
     .task-modal-content (flex column, fixed height)
       .modal-header
       .modal-body          ← must flex to fill, scroll internally
         .task-body         ← flex column filling the body
           .task-form       ← the top field row (fixed height)
           .task-content-wrapper  ← editor | tabs, fills remaining space
       .modal-footer
   Every link in that chain needs `flex:1; min-height:0` so the content
   area fills the modal exactly instead of spilling past it.
   ============================================================ */
.task-modal-content > .modal-body {
    padding: 0;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.task-content-wrapper {
    display: grid;
    grid-template-columns: 60% 40%;
    gap: 1rem;
    padding: 1rem;
    flex: 1;
    min-height: 0;
    /* Visual separator between the form row above and the work area below. */
    border-top: 1px solid var(--border-docs);

    @media (max-width: 1300px) {
        grid-template-columns: 1fr;
        padding: 1rem 0 0;
    }
}

/* The two columns each own their own scroll so the modal height stays put. */
.task-content-wrapper > * {
    min-height: 0;
    min-width: 0;
}

/* Right column (tabs + comments/audit/deps) gets a divider from the editor. */
.task-modal-tabs-col {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-left: 1rem;
    border-left: 1px solid var(--border-docs);
}

@media (max-width: 1300px) {
    .task-modal-tabs-col {
        padding-left: 0;
        border-left: none;
    }
}

/* The tab strip stays fixed; the active panel fills the rest and scrolls. */
.task-modal-tabs-col > .modal-tabs {
    flex: none;
}

.task-modal-tabs-col > .task-modal-comments,
.task-modal-tabs-col > .task-modal-deps-tab {
    flex: 1;
    min-height: 0;
}

/* In-modal the comment list flexes to the column height instead of the
   standalone 400px cap used elsewhere. */
.task-modal-tabs-col .comment-modal-list {
    max-height: none;
}

/* ── Editor pane ─────────────────────────────────────────────────────────── */
.task-modal-editor {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    overflow: auto;
    border: 1px dashed var(--border-docs);
    border-radius: 8px;
}

.task-modal-editor > .editor-kyst {
    width: 100%;
    height: 100%;
    max-height: none;
    align-self: stretch;
}

.task-modal-editor.hidden {
    display: none;
}

/* ── Top field row ───────────────────────────────────────────────────────── */
.task-form {
    padding: 18px 22px 16px;
    flex: none;
}

/* Align all field cells to the top so labels/inputs line up across the row
   regardless of each control's intrinsic height (multiselect vs date vs
   native select). */
.task-modal-content .task-modal-grid-4 {
    align-items: end;
}

.task-modal-content .task-modal-grid-4 > .form-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* Give every control in the row the same height so the row reads as one
   clean band. The multiselect trigger reuses .user-dash-filter-select, which
   is shorter than .form-input — normalise it here. */
.task-modal-content .form-input,
.task-modal-content .status-picker-trigger,
.task-modal-content .tags .user-dash-filter-select {
    min-height: 38px;
    box-sizing: border-box;
}

.task-modal-content .tags .user-dash-filter-select {
    padding: 9px 12px;
}

/* ── Title / header bits ─────────────────────────────────────────────────── */
.modal-create-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* Header title row: takes all the width left of the close/meatball actions
   so the editable title input can stretch to fill it (an <input> with
   width:100% only grows as far as its flex parent allows). */
.task-modal-title-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex: 1;
    min-width: 0;
}

/* The slot that swaps between the <h2> (view) and the <input> (edit). It must
   grow inside the row and clip, otherwise a long title pushes the layout. */
.task-title-wrapper {
    flex: 1;
    min-width: 0;
}

.name-form {
    width: 100%;
}

/* Edit mode: the input fills the wrapper instead of collapsing to content. */
.task-title-wrapper .scope-view-title-input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font-size: 1.1rem;
    font-weight: 600;
}

.task-title {
    transition: padding 0.1s ease-in;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    cursor: text;
    border-radius: 6px;
    min-width: 0;
}

/* View mode: long titles get an ellipsis instead of pushing the header. The
   h2 takes the available space; the pencil icon stays put beside it. */
.task-title h2 {
    margin: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.task-title svg {
    flex-shrink: 0;
}

.task-title:hover {
    background: var(--bg-tertiary);
    padding: 0 10px;
}

/* ── "Relações" tab: WBS family diagram centered on the task ─────────────── */

.relations-tab {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
    min-height: 0;
    overflow-y: auto;
}

.relations-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.relations-levels-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.relations-levels-select {
    width: auto;
    padding: 4px 8px;
    font-size: 0.85rem;
}

.relations-tree {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.relations-node {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 4px;
    padding-bottom: 4px;
    padding-right: 8px;
    font-size: 0.88rem;
    color: var(--text-primary);
    border-radius: var(--card-radius, 0);
}

.relations-node.current {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border-left: 3px solid var(--accent);
    font-weight: 600;
}

.relations-elbow {
    color: var(--text-secondary);
    opacity: 0.6;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.relations-status {
    width: 5px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}

.relations-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.relations-you {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    padding: 1px 6px;
    border-radius: 999px;
    flex-shrink: 0;
}

.relations-empty {
    color: var(--text-secondary);
    font-size: 0.88rem;
    padding: 24px 8px;
    text-align: center;
}
