/* ═══════════════════════════════════════════════════
   Портфели документов — основная страница
════════════════════════════════════════════════════ */

/* ─── Страница ─── */
.pf-page {
    background: #fff;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 96px);
    overflow: hidden;
}

/* ─── Заголовок ─── */
.pf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px 12px;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.pf-title {
    font-size: 15px;
    font-weight: 600;
    color: #262626;
}

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

/* ─── Пустые состояния ─── */
.pf-empty-state {
    padding: 60px;
    text-align: center;
    color: #aaa;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

/* ─── Разделение: дерево | контент ─── */
.pf-split-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ─── Панель дерева ─── */
.pf-tree-pane {
    display: flex;
    flex-direction: column;
    width: 280px;
    min-width: 280px;
    border-right: 1px solid #f0f0f0;
    transition: width 0.2s, min-width 0.2s;
}

.pf-tree-pane--collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
}

/* ─── Тулбар разворота дерева ─── */
.pf-tree-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}

.pf-tree-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #8c8c8c;
    border-radius: 4px;
    padding: 0;
    transition: background 0.15s, color 0.15s;
}

.pf-tree-action-btn:hover {
    background: #e6f4ff;
    color: #1890ff;
}

/* ─── Прокручиваемая область дерева ─── */
.pf-tree-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 8px 0;
}

/* ─── Кнопка свернуть/развернуть ─── */
.pf-tree-collapser {
    width: 20px;
    min-width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #bbb;
    border-right: 1px solid #f0f0f0;
    transition: color 0.15s;
}

.pf-tree-collapser:hover {
    color: #1890ff;
    background: #f5f5f5;
}

/* ─── Дерево ─── */
.pf-tree-empty {
    padding: 32px 16px;
    text-align: center;
    color: #bbb;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.pf-tree {
    font-size: 13px;
}

.pf-tree-node {
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    gap: 2px;
    padding: 1px 0;
}

.pf-tree-node--cut {
    opacity: 0.4;
}

.pf-tree-node-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-tree-node-count {
    font-size: 11px;
    background: #f0f0f0;
    color: #888;
    border-radius: 10px;
    padding: 0 6px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* ─── Панель документов ─── */
.pf-docs-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pf-docs-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: #bbb;
    font-size: 13px;
    text-align: center;
    padding: 48px;
}

.pf-docs-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    gap: 8px;
    flex-shrink: 0;
    background: #fafafa;
}

.pf-docs-title {
    font-size: 13px;
    font-weight: 600;
    color: #444;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.pf-docs-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.pf-docs-table .ant-table-row {
    cursor: pointer;
}


.pf-docs-table .ant-table-row:hover td {
    background: #e6f7ff !important;
}

/* ─── Контекстное меню ─── */
.pf-ctx-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
}

.pf-ctx-menu {
    position: fixed;
    z-index: 1000;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    padding: 4px 0;
    min-width: 200px;
}

.pf-ctx-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    color: #333;
    transition: background 0.1s;
}

.pf-ctx-item:hover {
    background: #f5f5f5;
}

.pf-ctx-item--danger {
    color: #ff4d4f;
}

.pf-ctx-item--danger:hover {
    background: #fff2f0;
}

/* ─── Мультивыбор документов ─── */
.pf-doc-selected td {
    background: #e6f4ff !important;
}

/* ─── Контекстное меню документов ─── */
.docs-ctx-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
}

.docs-ctx-menu {
    position: fixed;
    z-index: 1000;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0,0,0,.12);
    padding: 4px 0;
    min-width: 240px;
}

.docs-ctx-header {
    padding: 8px 16px;
    font-size: 12px;
    color: #888;
    border-bottom: 1px solid #f0f0f0;
}

.docs-ctx-item {
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #333;
}

.docs-ctx-item:hover { background: #f5f5f5; }

.docs-ctx-item--danger { color: #ff4d4f; }
.docs-ctx-item--danger:hover { background: #fff2f0; }

/* ─── Модалка номенклатуры ─── */
.docs-nmc-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0,0,0,.45);
}

.docs-nmc-modal-wrap {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: 70vw;
    height: 55vh;
}

/* ─── Выбор папки в модалке ─── */
.pf-pick-row {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    display: flex;
    align-items: center;
}

.pf-pick-row:hover { background: #f5f5f5; }

.pf-pick-row--active {
    background: #e6f4ff;
    color: #1890ff;
}

/* ═══════════════════════════════════════════════════
   Режимы просмотра портфелей
════════════════════════════════════════════════════ */

/* ─── Переключатель режимов ─── */
.pf-view-toggle {
    display: flex;
    gap: 2px;
    align-items: center;
}

/* ─── Тулбар проводника ─── */
.pf-ex-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ─── Хлебные крошки ─── */
.pf-ex-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    flex: 1;
    min-width: 0;
    font-size: 13px;
}

.pf-ex-crumb {
    color: #1890ff;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    transition: background 0.1s;
}

.pf-ex-crumb:hover {
    background: #e6f4ff;
}

.pf-ex-crumb--active {
    color: #333;
    font-weight: 600;
    cursor: default;
    pointer-events: none;
}

.pf-ex-crumb--active:hover {
    background: transparent;
}

/* ─── Сетка папок в проводнике ─── */
.pf-ex-folders-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    flex-shrink: 0;
}

/* ─── Плитка папки ─── */
.pf-ex-folder-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 96px;
    padding: 10px 8px 8px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.pf-ex-folder-tile:hover {
    background: #f0f7ff;
    border-color: #bbd8f5;
}

.pf-ex-folder-tile--selected {
    background: #e6f4ff;
    border-color: #91caff;
}

.pf-ex-folder-tile--selected:hover {
    background: #d6ecff;
    border-color: #69b1ff;
}

.pf-ex-folder-name {
    margin-top: 6px;
    font-size: 12px;
    color: #333;
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    word-break: break-word;
}

.pf-ex-folder-doc-count {
    margin-top: 4px;
    font-size: 11px;
    color: #999;
    background: #f0f0f0;
    border-radius: 8px;
    padding: 0 6px;
    line-height: 18px;
}

/* ─── Единая таблица проводника ─── */
.pf-ex-unified-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.pf-ex-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed;
}

.pf-ex-th {
    position: sticky;
    top: 0;
    background: #fafafa;
    border-bottom: 1px solid #e8e8e8;
    padding: 8px 8px;
    text-align: left;
    font-weight: 500;
    color: #555;
    font-size: 14px;
    white-space: nowrap;
    z-index: 1;
}

.pf-ex-tr {
    cursor: pointer;
    transition: background 0.1s;
}

.pf-ex-tr:hover td {
    background: #f5f5f5;
}

.pf-ex-tr--selected td {
    background: #e6f4ff !important;
}

.pf-ex-tr--folder td {
    font-weight: 500;
}

.pf-ex-tr--cut td {
    opacity: 0.45;
}

.pf-ex-td {
    padding: 0 8px;
    border-bottom: 1px solid #f0f0f0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    box-sizing: border-box;
    font-size: 14px;
}

.pf-ex-td--icon {
    width: 90px;
    text-align: center;
    padding: 0 6px;
}

/* Нивелируем высоту AntDesign Tag внутри ячейки */
.pf-ex-td--icon .ant-tag {
    margin: 0;
    vertical-align: middle;
}

.pf-ex-td--name {
    font-weight: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pf-ex-td--right {
    text-align: right;
    color: #888;
    font-size: 12px;
}

/* ─── Подзаголовок документов ─── */
.pf-ex-docs-subheader {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: #f7f7f7;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
    color: #888;
    flex-shrink: 0;
}
