.items-layer-card {
    min-height: 640px;
}

.item-layers {
    position: relative;
    overflow: hidden;
}

.item-row {
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    /* margin-bottom: 10px; */
}
.item-row.no-border {
    padding: 10px 12px;
    background: var(--color-surface);
    border: none !important;
    /* margin-bottom: 10px; */
}

.item-row.row-thin {
    padding: 5px 6px;
}

.item-row-main {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.item-expand-btn {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
}

.item-row-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    width: 100%;
}

/* row 클릭 영역 */

.item-row-line.clickable {
    cursor: pointer;
}

.item-badges {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 0.74rem;
    background: var(--color-surface-muted);
    white-space: nowrap;
}

.item-date {
    font-size: 0.78rem;
    color: var(--color-text-light);
    white-space: nowrap;
}

.item-title-button {
    min-width: 0;
    flex: 1 1 auto;
    border: 0;
    background: transparent;
    text-align: left;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.item-title-button.expanded {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
}

.item-inline-detail {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
}

.todo-detail-body {
    font-size: 0.9rem;
    line-height: 1.55;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    white-space: pre-wrap;
    word-break: break-word;
}

.subtle-box {
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
}

.inline-child-row {
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    margin-bottom: 8px;
}

.comment-item {
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

.comment-author {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.comment-created-at {
    font-size: 0.74rem;
    color: var(--color-text-light);
    margin-bottom: 6px;
}

.comment-body {
    font-size: 0.86rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.tab-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tab-row .button {
    min-width: 96px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 16px 24px;
    z-index: 1000;
}

.modal-panel {
    width: 100%;
    max-width: 640px;
    box-shadow: var(--shadow-md);
    background: var(--color-surface);
}

body.modal-open {
    overflow: hidden;
}

/* 기존 subtree 이동 */

.tree-shift {
    transform: translateX(16px) translateY(8px);
    transition: transform 180ms ease;
}

@media (max-width: 980px) {
    .item-row-line {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .item-date {
        order: 2;
    }

    .item-title-button {
        width: 100%;
    }
}

.item-tree-layout {
    display: flex;
    gap: 16px;
    min-height: 600px;
}

.item-tree-sidebar {
    width: 320px;
    flex-shrink: 0;
    border-right: 1px solid var(--color-border);
    padding-right: 12px;
    overflow-y: auto;
}

.item-tree-workspace {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
}

/* .tree-workspace {
    padding-top: 12px;
} */

.item-tree-latest-row {
    width: 100%;
    text-align: left;
    cursor: pointer;
    /* margin-bottom: 8px; */
}

.item-tree-latest-row.selected {
    /* outline: 2px solid var(--color-primary); */
    border:2px solid var(--color-primary);
    box-sizing: border-box;
}

.tree-selected-card {
    margin-bottom: 16px;
}

.tree-node-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position:relative;
}

.tree-node-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tree-node {
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    box-sizing: border-box;
}

/* .tree-node.focused {
    outline: 2px solid var(--color-primary);
} */

/* .tree-node.expanded {
    background: var(--color-surface-muted);
} */

.tree-node-line {
    display: flex;
    align-items: center ;
    gap: 8px;
}

.tree-node-icon {
    /* width: 18px; */
    /* flex: 0 0 18px; */
    line-height: 1.35;
    color: var(--color-text-light);
    user-select: none;
}

.tree-node-title-button {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    text-align: left;
    font-weight: 700;
    line-height: 1.35;
    cursor: pointer;
    color: var(--color-text);
    padding: 8px 0px;
    width:450px;
    max-width:450px;
}

.tree-node-title-button:hover {
    text-decoration: underline;
}

.tree-node-body {
    margin-top: 4px;
    margin-left: 12px;
    padding-bottom: 24px;
    font-size: 0.86rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--color-text);
}

.tree-children {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-left: 2rem;
}

@media (max-width: 980px) {
    .item-tree-layout {
        flex-direction: column;
    }

    .item-tree-sidebar {
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid var(--color-border);
        padding-right: 0;
        padding-bottom: 12px;
    }

    .tree-children {
        margin-left: 1.25rem;
    }
}

.tree-node-detail {
    margin-top: 8px;
    padding-top: 8px;
    min-height: 150px;
    padding-bottom:5rem;
}

.tree-node-public-id {
    font-size: 0.72rem;
    color: var(--color-text-light);
    margin-bottom: 8px;
    word-break: break-all;
}

.tree-version-nav-compact {
    gap: 3px;
}

.tree-version-nav-btn {
    min-height: 28px;
    min-width: 28px;
    padding: 0 8px;
    font-size: var(--font-size-xs);
    line-height: 1;
}

.tree-version-select {
    width: auto;
    min-height: 28px;
    max-width: 170px;
    padding: 2px 6px;
    font-size: var(--font-size-xs);
    line-height: 1.2;
}

.change-note {
    margin-bottom:1rem;
}

#tree_workspace {
    overflow: auto;
    padding-bottom: 5rem;

}

.tree-node {
    width: 100%;
    /* min-width: 820px; */
}

.tree-children {
    margin-left: 2rem;
    width:100%;
}

.modal-drag-handle {
    cursor:move;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 0.5rem 1rem;
}

.item-state-badge {
    flex: 0 0 auto;
    border: 1px solid transparent;
    font-size: var(--font-size-xs);
    line-height: 1.2;
}

.item-state-pending {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
}

.item-state-started {
    background: #d8ecfd;
    border-color: #b8daf5;
    color: #155b8f;
}

.item-state-completed {
    background: #fff2cc;
    border-color: #ead48a;
    color: #7a5a00;
}

.item-state-confirmed {
    background: #dff3df;
    border-color: #bee4be;
    color: #2c6c2f;
}

.item-state-cancelled {
    background: #f9dddd;
    border-color: #efbcbc;
    color: #8d2b2b;
}

.item-state-unknown {
    background: var(--color-surface-muted);
    border-color: var(--color-border);
    color: var(--color-text-muted);
}

.tree-node-meta {
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.tree-node-meta-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.tree-node-meta-line + .tree-node-meta-line {
    margin-top: 4px;
}

.tree-node-meta-label {
    font-weight: 700;
    color: var(--color-text);
}

.tree-node-meta-value {
    min-width: 0;
}

.tree-node-meta-arrow,
.tree-node-meta-separator {
    color: var(--color-text-light);
}

.file-remove-btn {
    width: 1.25rem;
    height: 1.25rem;
    min-width: 1.25rem;
    padding: 0;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
}

.file-remove-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.tree-node-files {
    border-top: 1px solid var(--color-border);
    padding: 10px 12px;
}
.tree-node-file-list {
    padding: 5px 0px;
    line-height:15px;
    color:var(--color-text-light);
}
.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 160px;
    max-width: 260px;
}

.search-input {
    width: 100%;
    padding-right: 2rem;
}

.search-clear-btn {
    position: absolute;
    top: 50%;
    right: 0.45rem;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: #6b7280;
}

.search-clear-btn:hover {
    color: #111827;
}

.search-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.search-input-wrap .search-input {
    width: 100%;
    height: 40px;
    box-sizing: border-box;
    padding: 0 2rem 0 0.75rem;
    line-height: 40px;
}

.search-clear-btn {
    position: absolute;
    top: 50%;
    right: 0.55rem;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 0;
    width: 1.25rem;
    height: 1.25rem;
    line-height: 1.25rem;
    font-size: 1rem;
    color: #6b7280;
}

.search-clear-btn:hover {
    color: #111827;
}

.search-row #item_search_btn {
    height: 40px;
    padding-top: 0;
    padding-bottom: 0;
}