/* ---- Information Delivery Plan ---- */
#panel-idp.tab-panel.active {
    display: flex;
    flex-direction: column;
    /* Fill the viewport under the sticky tabs so the matrix scrolls, not the page. */
    height: calc(100vh - var(--sticky-tabs-offset) - var(--status-bar-height) - 16px);
    min-height: 0;
}
.idp-layout,
.idp-layout-single {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--white);
    overflow: hidden;
}
.idp-matrix {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.idp-matrix[hidden],
.idp-schedule[hidden] {
    display: none !important;
}
.idp-matrix-scroll {
    /* The table scroller is .idp-matrix-scroll-inner. If this box also scrolls,
       the sticky header is pinned to a child that moves with the page. */
    overflow: hidden;
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.idp-matrix-scroll-inner {
    overflow: auto;
    flex: 1;
    width: 100%;
    min-height: 0;
}
.idp-empty {
    padding: 28px 20px;
    color: var(--gray-500);
    font-size: 14px;
}
.idp-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    min-width: 100%;
    table-layout: fixed;
    font-size: 13px;
}
.idp-col-elem { width: 220px; }
.idp-col-time { width: 88px; }
.idp-col-bulk { width: 48px; }
.idp-col-add { width: 52px; }
.idp-table th,
.idp-table td {
    border-bottom: 1px solid var(--gray-200);
    border-right: 1px solid var(--gray-100);
    padding: 0;
    vertical-align: middle;
}
/* Stick the header as one block. Per-row top offsets let the phase row
   stick lower than the domain and model rows and leave a gap. */
.idp-table thead {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--white);
}
.idp-table thead th {
    background: var(--white);
}
.idp-corner {
    position: sticky;
    left: 0;
    z-index: 6;
    width: 220px;
    min-width: 220px;
    background: var(--white);
    padding: 10px 12px !important;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-right: 1px solid var(--gray-200);
    vertical-align: top;
}
/* Upper header rows must paint over the ones below while scrolling. */
.idp-domain-head {
    z-index: 5;
    text-align: center;
    padding: 8px 10px !important;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}
.idp-model-head-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    max-width: 100%;
}
.idp-model-head-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.idp-remove-model-btn {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    padding: 0;
    font-size: 12px;
    line-height: 1;
    color: var(--gray-500);
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 3px;
    cursor: pointer;
}
.idp-remove-model-btn:hover:not(:disabled) {
    color: var(--gray-800);
    border-color: var(--gray-500);
}
.idp-remove-model-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.idp-phase-head {
    z-index: 3;
    text-align: center;
    padding: 8px 6px !important;
    min-width: 72px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--gray-700);
    background: var(--gray-50);
    white-space: normal;
    overflow-wrap: break-word;
}
.idp-milestone-head {
    z-index: 3;
    text-align: center;
    padding: 4px 8px !important;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--gray-600);
    background: var(--white);
    white-space: nowrap;
}
.idp-elem-cell {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--white);
    padding: 8px 12px !important;
    width: 220px;
    min-width: 220px;
    border-right: 1px solid var(--gray-200);
    color: var(--gray-800);
    text-align: left;
}
.idp-elem-domain {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--gray-500);
    background: var(--gray-50);
}
.idp-elem-empty {
    color: var(--gray-500);
    font-style: italic;
    font-size: 12px;
}
.idp-row-domain .idp-elem-domain {
    border-top: 1px solid var(--gray-200);
}
.idp-check-cell {
    text-align: center;
    padding: 6px 8px !important;
    background: var(--white);
}
.idp-check-cell-empty {
    color: var(--gray-400);
    font-size: 12px;
}
.idp-check-cell-add {
    background: var(--gray-50);
    width: 52px;
    min-width: 52px;
}
.idp-check-cell-na {
    background: var(--gray-100);
}
/* The bulk toggles belong to the model on their left, so the group divider
   goes after them, not between them and their own phase columns. */
.idp-bulk-head {
    width: 48px;
    min-width: 48px;
    max-width: 48px;
    border-right: 2px solid var(--gray-400);
}
.idp-bulk-cell {
    width: 48px;
    min-width: 48px;
    max-width: 48px;
    white-space: nowrap;
    padding: 4px 4px !important;
    border-right: 2px solid var(--gray-400);
}
.idp-model-head {
    z-index: 4;
    text-align: center;
    padding: 8px 6px !important;
    min-width: 72px;
    font-weight: 600;
    color: var(--gray-800);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    border-right: 2px solid var(--gray-400);
}
.idp-bulk-btn {
    width: 16px;
    height: 16px;
    padding: 0;
    margin: 0 1px;
    font-size: 10px;
    line-height: 1;
    color: var(--gray-500);
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 3px;
    cursor: pointer;
}
.idp-bulk-btn:hover:not(:disabled) {
    color: var(--primary);
    border-color: var(--primary);
}
.idp-bulk-btn-clear:hover:not(:disabled) {
    color: var(--gray-800);
    border-color: var(--gray-500);
}
.idp-bulk-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.idp-na-box {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    background: var(--gray-300);
    vertical-align: middle;
}
.idp-model-check {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}
.idp-model-check:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.idp-model-head-empty {
    color: var(--gray-400);
    font-weight: 500;
    font-style: italic;
}
.idp-add-model-head {
    min-width: 52px;
    width: 52px;
    max-width: 52px;
    background: var(--gray-50);
}
.idp-add-model-dropdown {
    position: relative;
    display: flex;
    justify-content: center;
}
.idp-add-model-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 6px 8px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    color: var(--primary);
    background: var(--white);
    border: 1px dashed var(--gray-300);
    border-radius: 6px;
    cursor: pointer;
}
.idp-add-model-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--neutral-f3f7fb);
}
.idp-add-model-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.idp-add-model-btn[aria-expanded="true"] {
    border-color: var(--primary);
    background: var(--neutral-f3f7fb);
}
.idp-add-model-panel {
    position: fixed;
    min-width: 12rem;
    max-width: 22rem;
    max-height: min(360px, 60vh);
    overflow: auto;
    padding: 4px 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(var(--black-rgb), 0.1);
    z-index: 200;
}
.idp-add-model-item {
    display: block;
    width: 100%;
    padding: 8px 14px;
    font-size: 13px;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--gray-800);
    cursor: pointer;
}
.idp-add-model-item:hover:not(:disabled) {
    background: var(--gray-100);
}
.idp-add-model-item:disabled {
    color: var(--gray-400);
    cursor: not-allowed;
}
.idp-add-model-sep {
    height: 1px;
    margin: 4px 0;
    background: var(--gray-200);
}
.idp-add-model-empty {
    padding: 6px 14px 2px;
    font-size: 12px;
    color: var(--gray-500);
}
.idp-toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--white);
    flex-shrink: 0;
}
.idp-filter-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}
.idp-filter-label {
    flex: 0 0 64px;
    padding-top: 5px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--gray-500);
}
.idp-filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}
.idp-filter-all,
.idp-filter-tag {
    border: 1px solid var(--gray-300);
    background: var(--white);
    color: var(--gray-700);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    line-height: 1.3;
}
.idp-filter-all:hover,
.idp-filter-tag:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.idp-filter-all.is-active,
.idp-filter-tag.is-selected {
    border-color: var(--primary);
    background: var(--neutral-e8eef5);
    color: var(--primary);
    font-weight: 600;
}
.idp-modal-domain-label {
    padding: 8px 10px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--gray-50);
    color: var(--gray-700);
    font-size: 14px;
}
.idp-subtabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px 0;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
    flex: 0 0 auto;
}
.idp-subtab {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
    color: var(--gray-600);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
}
.idp-experimental-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-500);
    letter-spacing: 0;
}
.idp-subtab:hover {
    color: var(--gray-800);
    background: var(--white);
}
.idp-subtab.is-active {
    color: var(--gray-900);
    background: var(--white);
    border-color: var(--gray-200);
    margin-bottom: -1px;
}
.idp-grain-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    font-size: 13px;
    color: var(--gray-700);
    white-space: nowrap;
}
.idp-schedule {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.idp-schedule-board {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.idp-schedule-board-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.idp-schedule-palette {
    width: 240px;
    flex: 0 0 240px;
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--gray-50);
}
.idp-schedule-search {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--gray-500);
}
.idp-schedule-search input {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
    padding: 6px 8px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
}
.idp-schedule-palette-list {
    overflow: auto;
    padding: 4px 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.idp-schedule-card {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    padding: 8px 10px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--white);
    cursor: grab;
    color: var(--gray-800);
    font-size: 13px;
}
.idp-schedule-card:hover,
.idp-schedule-card.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}
.idp-schedule-card-kind {
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-500);
    border: 1px solid var(--gray-300);
    border-radius: 3px;
    padding: 1px 4px;
}
.idp-schedule-hint,
.idp-schedule-empty {
    padding: 8px 12px 12px;
    font-size: 12px;
    color: var(--gray-500);
}
.idp-schedule-grid-wrap {
    flex: 1;
    min-width: 0;
    overflow: auto;
}
.idp-schedule-table {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    width: max-content;
    max-width: none;
    font-size: 12px;
}
.idp-schedule-table th,
.idp-schedule-table td {
    border-bottom: 1px solid var(--gray-200);
    border-right: 1px solid var(--gray-100);
    vertical-align: top;
}
/* Phase and milestone rows stay put while domain lanes scroll, same as the content matrix. */
.idp-schedule-table thead {
    position: sticky;
    top: 0;
    z-index: 4;
}
.idp-schedule-corner {
    position: sticky;
    left: 0;
    background: var(--white);
    width: 160px;
    min-width: 140px;
    max-width: 200px;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    z-index: 6;
}
.idp-schedule-domain-cell {
    position: sticky;
    left: 0;
    background: var(--white);
    width: 160px;
    min-width: 140px;
    max-width: 200px;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    z-index: 2;
}
.idp-schedule-phase-head {
    text-align: center;
    padding: 6px 8px;
    background: var(--gray-50);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--gray-500);
}
.idp-schedule-phase-head.idp-schedule-phase-start,
.idp-schedule-ms-head.idp-schedule-phase-start {
    border-left: 2px solid var(--gray-300);
}
.idp-schedule-phase-head-inner {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.idp-schedule-ms-head-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
}
.idp-schedule-ms-head-top {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    min-width: 0;
}
.idp-schedule-ms-head {
    text-align: center;
    padding: 6px 8px;
    background: var(--white);
    font-weight: 600;
    position: relative;
    overflow: visible;
    z-index: 1;
}
.idp-schedule-ms-head:has(.idp-schedule-add-ms-between) {
    z-index: 3;
}
.idp-schedule-ms-head:has(.idp-schedule-add-ms-between):hover {
    z-index: 4;
}
.idp-schedule-ms-label {
    line-height: 1.2;
    display: block;
    white-space: nowrap;
}
.idp-schedule-ms-label.editable {
    min-height: 1.2em;
    cursor: text;
    outline: none;
    border-radius: 3px;
}
.idp-schedule-ms-label.editable:hover {
    box-shadow: 0 0 0 1px var(--gray-300);
}
.idp-schedule-ms-label.editable:focus {
    background: var(--white);
    box-shadow: 0 0 0 1px var(--primary);
}
.idp-schedule-ms-date {
    font-weight: 400;
    font-size: 12px;
    color: var(--gray-600);
}
input.idp-schedule-ms-date {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    padding: 2px 4px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: var(--white);
    color: var(--gray-800);
}
.idp-schedule-add-ms,
.idp-schedule-del-ms,
.idp-schedule-chip-x,
.idp-schedule-bar-x {
    width: 16px;
    height: 16px;
    padding: 0;
    line-height: 1;
    font-size: 12px;
    border: 1px solid var(--gray-300);
    border-radius: 3px;
    background: var(--white);
    color: var(--gray-500);
    cursor: pointer;
    flex: 0 0 auto;
}
.idp-schedule-add-ms-between {
    position: absolute;
    top: 6px;
    right: -9px;
    z-index: 4;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--white);
}
.idp-schedule-add-ms-between:hover,
.idp-schedule-add-ms-between:focus {
    border-color: var(--primary);
    color: var(--primary);
}
.idp-schedule-cell {
    min-width: 132px;
    min-height: 64px;
    padding: 6px;
    background: var(--white);
}
.idp-schedule-lane-cell {
    padding: 0;
    background: var(--white);
    min-width: 0;
}
.idp-schedule-track {
    display: grid;
    grid-auto-rows: minmax(28px, auto);
    column-gap: 0;
    row-gap: 4px;
    padding: 6px 0;
    min-height: 56px;
    position: relative;
    align-items: stretch;
    box-sizing: border-box;
}
.idp-schedule-drop {
    z-index: 0;
    min-height: 48px;
    box-shadow: inset -1px 0 0 var(--gray-100);
}
.idp-schedule-drop.idp-schedule-phase-start {
    box-shadow: inset 2px 0 0 var(--gray-300), inset -1px 0 0 var(--gray-100);
}
.idp-schedule-drop.is-drop-target,
.idp-schedule-cell.is-drop-target {
    background: var(--neutral-eef6ff);
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
}
.idp-schedule-board.is-placing .idp-schedule-bar {
    pointer-events: none;
}
.idp-schedule-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    height: 28px;
    margin: 0 4px;
    padding: 0 4px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: var(--neutral-eef6ff);
    font-size: 12px;
    color: var(--gray-800);
    position: relative;
    z-index: 1;
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.idp-schedule-bar.is-readonly {
    cursor: default;
}
.idp-schedule-bar.is-dragging {
    cursor: grabbing;
    box-shadow: 0 1px 4px rgba(var(--black-rgb), 0.12);
}
.idp-schedule-bar-kind,
.idp-schedule-chip-kind {
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-500);
}
.idp-schedule-bar-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.idp-schedule-bar-handle {
    flex: 0 0 8px;
    align-self: stretch;
    margin: -1px 0;
    border-radius: 3px;
    cursor: ew-resize;
    touch-action: none;
    background: transparent;
}
.idp-schedule-bar-handle:hover,
.idp-schedule-bar-handle:focus {
    background: var(--primary);
    opacity: 0.35;
}
.idp-schedule-cell-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 48px;
}
.idp-schedule-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    border: 1px solid var(--gray-300);
    border-radius: 999px;
    background: var(--gray-50);
    font-size: 12px;
}

