/* ============================================================
   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-body.notask{
    justify-content: center;
}

.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;
    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;
    position: relative;
}

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

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

.editor-expand{
    position: absolute;
    top: 0;
    right: 0;
    padding: 6px;
    color: var(--border);
    transition: color 0.3s;
    cursor: pointer;
}

.editor-expand:hover{
    color: var(--text-primary);
}

.task-modal-editor.expanded{
    position: fixed;
    inset: 3vh 3vw;
    width: auto;
    height: auto;
    z-index: 11000;
    background: var(--bg-primary);
    border: 1px solid var(--border-docs);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
    padding: 1.5rem;
}

.task-modal-editor.expanded > .editor-expand{
    padding: 12px;
}

.editor-expand-backdrop{
    position: fixed;
    inset: 0;
    z-index: 10999;
    background: rgba(0, 0, 0, 0.4);
}

/* ── Top field row ───────────────────────────────────────────────────────── */
.task-form {
    padding: 0px 22px 16px;
    flex: none;
    overflow: auto;
    width: 15rem;
}

/* Under 700px the field row moves into the tabs column as a "Detalhes" panel,
   so it scrolls within that column instead of sitting fixed at the top. */
.task-form.task-form-tab-panel {
    flex: 1;
    min-height: 0;
    padding: 1rem 1rem;
    width: 100%;
}

.modal-tabs::-webkit-scrollbar{
    width: 2px !important;
    height: 2px !important;
}


/* 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;
}

.locked {
    opacity: 0.55;
    pointer-events: none;
    filter: grayscale(0.3);
}

.task-form-locked-note {
    margin-top: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--bg-secondary, #f3f3f5);
    color: var(--text-secondary, #6b7280);
    font-size: 12px;
    line-height: 1.4;
}

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

.manter-badge {
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-secondary, #6b7280);
    background: var(--bg-secondary, rgba(0, 0, 0, 0.06));
    border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
    vertical-align: middle;
    cursor: help;
}

.form-group label .tooltip-trigger {
    display: inline-flex;
    vertical-align: middle;
}

.form-group.status-select{
    margin-top: 1rem;
}

/* 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;
}

.task-title.unsaved h2 {
    color: var(--danger, #ef4444);
}

.task-title-wrapper .scope-view-title-input.unsaved {
    border-color: var(--danger, #ef4444);
    color: var(--danger, #ef4444);
}

/* ── "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;
}

.notask > .task-form{
    width: 100%;
}
