/* 워크시트 폴더 패널(문서 탐색기) 스타일. 템플릿 인라인 <style>에서 분리 (main CSS 번들에 포함). */
    .wsfolder-layout {
        display: flex;
        align-items: flex-start;
    }
    .wsfolder-main {
        flex: 1 1 auto;
        min-width: 0;
    }
    #ws_folder_panel {
        flex: none;
        width: 280px; /* JS가 localStorage 값으로 덮어쓴다 */
        position: sticky;
        top: 12px;
        max-height: calc(100vh - 24px);
        display: flex;
        flex-direction: column;
        background: #fff;
        border: 1px solid #dee2e6;
        border-radius: 10px;
        overflow: hidden;
    }
    /* 접힘: 지문 DB 레일(.pdb-rail)과 동일한 세로 레일 UI (30px, 회색 배경, 책등 라벨).
       sticky 대신 전체 높이로 늘어나고 라벨(.pdb-rail-label)이 sticky로 따라온다 (pdb 레일과 동일 동작) */
    #ws_folder_panel.closed {
        box-sizing: border-box;
        width: var(--gin-rail-width) !important;
        position: static;
        align-self: stretch;
        max-height: none;
        overflow: visible;  /* sticky 라벨이 잘리지 않게 */
        background: var(--gin-rail-bg);
        border-radius: 8px;
        cursor: pointer;
        transition: background 0.12s, border-color 0.12s, color 0.12s;
    }
    #ws_folder_panel.closed:hover {
        background: #e9ecef;
        border-color: var(--gin-dark);
        color: var(--gin-dark);
    }
    #ws_folder_panel.closed .wsfolder-inner { display: none; }
    #ws_folder_open_btn {
        display: none;
        width: 100%;
        border: none;
        background: none;
        color: inherit;
        padding: 10px 0;
        text-align: center;
    }
    /* 접힘 버튼이 레일 전체 높이를 채워 어디를 눌러도 펼쳐지게 (라벨은 .pdb-rail-label sticky로 위에 유지) */
    #ws_folder_panel.closed #ws_folder_open_btn { display: block; flex: 1; cursor: pointer; }
    /* 접힘 레일 라벨의 sticky 오프셋: grid용 --sticky-header-top(폴더 패널 문맥엔 안 맞음)이 아니라
       폴더 패널 자신의 sticky 라인(open 패널 top:12)에 맞춰 명시. 레일 맨 위에서 시작해 스크롤 시 여기에 붙는다 */
    #ws_folder_panel.closed .pdb-rail-label { top: 20px; }
    /* 리사이저: 지문 DB 탐색기(#passagedb_resizer)와 동일한 룩 (회색 전체 바 + 중앙 grip 아이콘). 좌우 여백 대칭 */
    #ws_folder_resizer {
        flex-shrink: 0;
        width: 8px;
        margin: 0 10px;
        align-self: stretch;
        cursor: col-resize;
        background: #f1f3f5;
        user-select: none;
    }
    #ws_folder_resizer:hover,
    #ws_folder_resizer.dragging { background: #cfe2ff; }
    #ws_folder_resizer .wsfolder-resizer-grip {
        position: sticky;
        top: 45vh;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 8px;
        color: #adb5bd;
        font-size: 10px;
        line-height: 1;
        pointer-events: none;
    }
    #ws_folder_resizer:hover .wsfolder-resizer-grip,
    #ws_folder_resizer.dragging .wsfolder-resizer-grip { color: #0d6efd; }
    /* 접힘(레일) 상태: 리사이저 바는 자리만 차지하지 않게 폭 0 + 작은 우측 간격만 남긴다 */
    #ws_folder_resizer.disabled { cursor: default; background: none; width: 0; margin: 0 10px 0 0; }
    #ws_folder_resizer.disabled .wsfolder-resizer-grip { visibility: hidden; }
    body.wsfolder-resizing { cursor: col-resize; user-select: none; }
    .wsfolder-inner {
        display: flex;
        flex-direction: column;
        min-height: 0;
    }
    .wsfolder-head {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 10px 8px 8px 14px;
        border-bottom: 1px solid #e9ecef;
    }
    .wsfolder-head-title { font-weight: 600; font-size: 0.95rem; }
    .wsfolder-head .wsfolder-icon-btn:first-of-type { margin-left: auto; }
    .wsfolder-icon-btn {
        border: none;
        background: none;
        color: #495057;
        border-radius: 6px;
        padding: 2px 6px;
        font-size: 0.95rem;
    }
    .wsfolder-icon-btn:hover { background: #e9ecef; color: #212529; }
    #ws_folder_breadcrumb {
        position: sticky;  /* 스크롤해도 상단에 고정 */
        top: 0;
        z-index: 50;
        display: flex;
        align-items: center;
        flex-wrap: wrap;  /* 모바일: 버튼 수가 많아 오른쪽 버튼/툴바가 아래로 접히게 */
        gap: 12px;
        min-height: 39px;  /* 서버 렌더 시 빈 상태에서도 한 줄 높이를 확보해 JS가 채울 때 점프 없음 */
        font-size: 0.9rem;
        color: #495057;
        margin-bottom: 10px;
        padding: 8px 12px;
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        border-radius: 8px;
    }
    /* 데스크톱: 경로가 길어도 버튼을 다음 줄로 접지 말고, 경로를 줄임표로 더 빡세게 줄이고 버튼은 한 줄 유지 */
    @media (min-width: 768px) {
        #ws_folder_breadcrumb { flex-wrap: nowrap; }
    }
    /* 왼쪽: 경로 줄 + (detail이면) 메타 줄. 오른쪽: 상태 뱃지 (목록 행과 같은 배치) */
    #ws_folder_breadcrumb .wsfolder-breadcrumb-left {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    /* 경로는 한 줄 유지, 넘치면 세그먼트를 말줄임(...)한다 (지문 DB 탐색기 breadcrumb과 동일) */
    #ws_folder_breadcrumb .wsfolder-breadcrumb-path {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-wrap: nowrap;
        overflow: hidden;
        min-width: 0;
    }
    #ws_folder_breadcrumb .wsfolder-breadcrumb-path > .text-muted { flex: none; }
    #ws_folder_breadcrumb .wsfolder-breadcrumb-path > a,
    #ws_folder_breadcrumb .wsfolder-breadcrumb-path > .wsfolder-breadcrumb-current {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    #ws_folder_breadcrumb .wsfolder-breadcrumb-path > a { flex-shrink: 100; min-width: 22px; }
    #ws_folder_breadcrumb .wsfolder-breadcrumb-path > a:first-child { flex-shrink: 0; }  /* '내 자료/공개 자료' 루트는 안 줄임 */
    #ws_folder_breadcrumb .wsfolder-breadcrumb-path > .wsfolder-breadcrumb-current { flex-shrink: 1; min-width: 40px; }
    /* 경로 세그먼트 링크만 (툴바의 .btn 링크는 Bootstrap 색을 유지) */
    #ws_folder_breadcrumb .wsfolder-breadcrumb-path a { text-decoration: none; color: inherit; }
    #ws_folder_breadcrumb .wsfolder-breadcrumb-path a:hover { text-decoration: underline; }
    #ws_folder_breadcrumb a.wsfolder-drop-target {
        outline: 2px solid #0d6efd;
        outline-offset: -2px;
        background: #e7f1ff;
        border-radius: 4px;
    }
    /* 현재 세그먼트는 페이지 제목 역할이라 경로(0.9rem)보다 크게 */
    #ws_folder_breadcrumb .wsfolder-breadcrumb-current { font-weight: 600; color: #212529; font-size: 1.1rem; }
    /* breadcrumb 오른쪽 툴바 (지문 DB 탐색기 툴바와 통일) */
    #ws_folder_breadcrumb .wsfolder-breadcrumb-tools {
        margin-left: auto;
        display: flex;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
        flex: none;
    }
    /* detail/form의 오른쪽 액션 블록: 긴 경로로 다음 줄로 밀려도 오른쪽에 붙게 (왼쪽정렬 방지).
       .wsfolder-breadcrumb-tools(index)는 이미 margin-left:auto가 있음 */
    #ws_folder_breadcrumb .ws-file-right { margin-left: auto; }
    /* 선택 툴바: 카운트 + 버튼들을 flex로 정렬 (간격/세로정렬) */
    #ws_selection_tools { display: inline-flex; align-items: center; gap: 8px; }
    /* 생성 그룹(새 폴더/조합/새로 만들기): 내부는 한 줄 유지(nowrap), 좁으면 그룹 통째로 다음 줄로 */
    .ws-toolbar-group { display: inline-flex; align-items: center; gap: 6px; }
    .wsfolder-tools-divider { width: 1px; height: 20px; background: #dee2e6; margin: 0 2px; }
    /* 모바일: 툴바가 flex:none이라 콘텐츠 한 줄 폭이 돼 오버플로우했음. 자기 줄을 전부 차지하게 만들어
       그룹(선택 그룹 | 생성 그룹) 단위로 줄바꿈되게 한다. 줄바꿈이 그룹을 나누므로 구분선은 숨김. */
    /* 버튼 글자는 줄을 바꾸지 않는다 (2026-10-18 사장님: 리더스북 휴대폰 목록에서 '새 / 폴더' · '한 권으로 / 만들기'처럼 버튼 안에서 끊겼다).
       넘치면 버튼이 통째로 다음 줄로 간다 */
    #ws_folder_breadcrumb .btn { white-space: nowrap; word-break: keep-all; }
    @media (max-width: 767px) {
        #ws_folder_breadcrumb .wsfolder-breadcrumb-tools {
            flex: 0 0 100%;
            margin-left: 0;
            justify-content: flex-start;
        }
        #ws_folder_breadcrumb .wsfolder-tools-divider { display: none; }
        /* 생성 그룹도 좁으면 버튼 단위로 줄바꿈 (한 줄 고정이면 버튼마다 글자가 두 줄로 눌렸다) */
        #ws_folder_breadcrumb .ws-toolbar-group { flex-wrap: wrap; row-gap: 6px; }
    }
    #ws_folder_tree {
        flex: 1;
        min-height: 120px;
        overflow-y: auto;
        padding: 8px 8px 8px 6px;
        font-size: 0.875rem;
        user-select: none;
    }
    .wsfolder-row {
        position: relative;
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 4px 6px;
        border-radius: 6px;
        cursor: pointer;
        white-space: nowrap;
    }
    .wsfolder-row:hover { background: #e9ecef; }
    .wsfolder-row.active { background: #cfe2ff; }
    .wsfolder-row .wsfolder-name {
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .wsfolder-caret {
        display: inline-block;
        width: 14px;
        flex: none;
        text-align: center;
        font-size: 0.6rem;
        color: #868e96;
        transition: transform 0.1s ease;
    }
    .wsfolder-node.collapsed > .wsfolder-row .wsfolder-caret.has-children { transform: rotate(-90deg); }
    .wsfolder-node.collapsed > .wsfolder-children { display: none; }
    /* 트리 가이드선: 부모 caret 아래로 세로선, 각 자식 행에 가로 연결선(ㄴ). 마지막 자식은 └ 모양으로 끝남 */
    .wsfolder-children {
        margin-left: 13px;
        padding-left: 11px;
    }
    .wsfolder-node { position: relative; }
    /* 세로선: 마지막이 아닌 노드는 노드 전체 높이(다음 형제까지 이어짐) */
    .wsfolder-children > .wsfolder-node:not(:last-child)::before {
        content: '';
        position: absolute;
        left: -11px; top: 0; bottom: 0;
        border-left: 1px solid #d6dbe0;
    }
    /* 가로 연결선(ㅏ/ㄴ의 가로획): 모든 자식 행 중앙 */
    .wsfolder-children > .wsfolder-node > .wsfolder-row::before {
        content: '';
        position: absolute;
        left: -11px; top: 50%;
        width: 11px;
        border-top: 1px solid #d6dbe0;
    }
    /* 마지막 자식: 세로선을 자기 행 중앙까지만 그려 └ 로 끝냄 (아래로 늘어지지 않음) */
    .wsfolder-children > .wsfolder-node:last-child > .wsfolder-row::after {
        content: '';
        position: absolute;
        left: -11px; top: 0;
        height: 50%;
        border-left: 1px solid #d6dbe0;
    }
    .wsfolder-count { color: #868e96; font-size: 0.75rem; margin-left: 2px; }
    .wsfolder-actions {
        margin-left: auto;
        display: none;
        gap: 2px;
        flex: none;
    }
    .wsfolder-row:hover .wsfolder-actions { display: inline-flex; }
    .wsfolder-actions .wsfolder-icon-btn { padding: 0 4px; font-size: 0.8rem; }
    .wsfolder-row.wsfolder-drop-target,
    .ws-file-row.wsfolder-drop-target {
        outline: 2px solid #0d6efd;
        outline-offset: -2px;
        background: #e7f1ff;
    }
    .wsfolder-row.dragging { opacity: 0.4; }
    /* 드래그 중 원본 행을 흐리게 (집어 올려진 느낌) */
    .ws-file-row.dragging { opacity: 0.4; }
    /* 드래그 중 놓을 수 있는 폴더/루트/경로에 점선 힌트 (hover 중인 대상은 아래 solid 강조가 우선).
       연한 1px보다 두껍고 진한 2px 점선으로 눈에 띄게 (배경 틴트는 옅게, 펄스 없음) */
    body.wsfolder-dragging .wsfolder-droppable:not(.wsfolder-drop-target) {
        outline: 2px dashed #4dabf7;
        outline-offset: -3px;
        border-radius: 6px;
    }
    /* 집어든 항목 칩 (Gmail의 'Move N conversation'처럼 커서를 따라다니는 파란 박스) */
    .wsfolder-drag-ghost {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 3000;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        max-width: 280px;
        padding: 8px 14px;
        background: #1a73e8;
        color: #fff;
        border-radius: 8px;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
        font-size: 0.85rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        pointer-events: none;
    }
    .wsfolder-drag-ghost .bi { font-size: 1rem; flex: none; }
    .wsfolder-drag-ghost span { overflow: hidden; text-overflow: ellipsis; }
    /* 다중 선택 */
    .ws-file-row.selected {
        background: #e7f1ff;
        border-color: #74a9fc;
        box-shadow: inset 0 0 0 1px #74a9fc;
    }
    .ws-file-row.selected:hover { background: #dbe9fe; }
    body.wsfolder-marquee-active { user-select: none; }
    .wsfolder-marquee {
        position: fixed;
        border: 1px solid #4dabf7;
        background: rgba(77, 171, 247, 0.15);
        z-index: 1500;
        pointer-events: none;
    }
    /* 우클릭 컨텍스트 메뉴 (트리/목록 공용) */
    #ws_context_menu {
        position: fixed;
        z-index: 1080;
        min-width: 168px;
        padding: 4px;
        background: #fff;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
        font-size: 0.85rem;
    }
    #ws_context_menu[hidden] { display: none; }
    #ws_context_menu button {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 20px;
        width: 100%;
        text-align: left;
        border: none;
        background: none;
        padding: 7px 10px;
        border-radius: 5px;
        color: var(--gin-dark);
        cursor: pointer;
    }
    #ws_context_menu button:hover { background: #f1f3f5; }
    #ws_context_menu button.danger { color: #dc3545; }
    #ws_context_menu button.danger:hover { background: #f8d7da; }
    #ws_context_menu .menu-label { display: inline-flex; align-items: center; gap: 8px; }
    #ws_context_menu .menu-label .bi { flex: none; }
    #ws_context_menu .menu-key { color: #adb5bd; font-size: 0.75rem; font-weight: 600; flex: none; }
    #ws_context_menu .ctx-sep { height: 1px; background: #e9ecef; margin: 4px 2px; }
    .wsfolder-hint {
        padding: 8px 14px;
        font-size: 0.75rem;
        color: #adb5bd;
        border-top: 1px solid #e9ecef;
    }
    .worksheet-list .table-row[draggable="true"] { cursor: grab; }
    @media (max-width: 767px) {
        .wsfolder-layout { display: block; }
        #ws_folder_panel {
            position: static;
            width: 100% !important;
            max-height: 45vh;
            margin-bottom: 12px;
        }
        #ws_folder_panel.closed {
            width: 100% !important;
            align-self: auto;
            background: #fff;
        }
        #ws_folder_panel.closed #ws_folder_open_btn { text-align: left; padding: 8px 14px; }
        /* 모바일 전체폭 바에서는 책등 세로 라벨 대신 가로 라벨 */
        #ws_folder_panel.closed .pdb-rail-label { position: static; flex-direction: row; top: auto; }
        #ws_folder_panel.closed .pdb-rail-text { writing-mode: horizontal-tb; letter-spacing: normal; }
        #ws_folder_resizer { display: none; }
    }
