/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

#app {
    flex: 1 1 0%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* 登录页面 */
#login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: white;
    padding: 27px 36px 36px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 342px;
}

.login-logo-area {
    text-align: center;
    margin-bottom: 22px;
}

.login-page-logo {
    max-width: 216px;
    height: auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 11px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 13px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102,126,234,0.2);
}

.btn-primary {
    padding: 11px 22px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    padding: 8px 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    padding: 8px 16px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.error-message {
    color: #dc3545;
    text-align: center;
    margin-top: 10px;
}

/* 主页面 */
#main-page {
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.container {
    display: flex;
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
}

/* 侧边栏 */
.sidebar {
    width: 250px;
    min-width: 250px;
    background: #2c3e50;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    overflow: hidden;
}
.sidebar-header {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-header h1 {
    font-size: 17px;
    color: #ecf0f1;
    white-space: nowrap;
}
.sidebar nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-item {
    display: block;
    padding: 15px 25px;
    color: #ecf0f1;
    text-decoration: none;
    transition: background 0.3s;
}

.nav-item:hover {
    background: #34495e;
}

.nav-item.active {
    background: #3498db;
}

/* 内容区域 */
.content {
    flex: 1 1 0%;
    min-height: 0;
    padding: 0 30px 20px 30px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.content-page {
    display: none;
}

.content-page.active {
    display: flex;
    flex-direction: column;
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
}

.content-page h2 {
    margin-bottom: 0;
    color: #2c3e50;
}

/* 页面头部 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.page-header h2 {
    margin-bottom: 0;
    margin-top: 0;
}

/* 面包屑导航 */
.breadcrumb {
    padding: 10px 15px;
    background: white;
    border-radius: 5px;
    margin-bottom: 10px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.breadcrumb a {
    color: #3498db;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: #666;
    margin: 0 5px;
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 15px;
    flex-shrink: 0;
}

.search-box {
    display: flex;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px 0 0 5px;
    font-size: 14px;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-search {
    padding: 10px 15px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
}

.btn-search:hover {
    background: #2980b9;
}

.sort-box {
    display: flex;
    gap: 10px;
}

.sort-box select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

/* 批量操作栏 */
.batch-bar {
    padding: 10px 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 5px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.batch-bar label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.batch-bar span {
    color: #666;
}

/* 文件列表 */
.file-list {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow-y: auto;
    overflow-x: auto;
    flex: 1 1 0%;
    min-height: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #2c3e50;
    color: white;
    font-weight: 500;
    position: sticky;
    top: 0;
}

tr:hover {
    background: #f5f5f5;
}

.col-checkbox {
    width: 40px;
    text-align: center;
}

.col-icon {
    width: 40px;
    text-align: center;
}

.col-name {
    min-width: 200px;
}

.col-size {
    width: 100px;
}

.col-creator {
    width: 100px;
}

.col-time {
    width: 150px;
}

.col-actions {
    width: 200px;
}

/* 文件/目录行 */
.file-row {
    cursor: pointer;
}

.file-row.folder {
    font-weight: 500;
}

.file-row .file-icon {
    font-size: 20px;
}

.file-row .file-name {
    color: #333;
}

.file-row .file-name:hover {
    color: #3498db;
}

/* 操作按钮 */
.btn-action {
    padding: 5px 8px;
    margin: 0 2px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: opacity 0.3s;
}

.btn-action:hover {
    opacity: 0.8;
}

.btn-edit {
    background: #3498db;
    color: white;
}

.btn-move {
    background: #9b59b6;
    color: white;
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

/* 文档列表 */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.document-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.document-card:hover {
    transform: translateY(-5px);
}

.document-card h3 {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 10px;
    word-break: break-all;
}

.document-card .meta {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 15px;
}

.document-card .btn-view {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.document-card .btn-view:hover {
    background: #2980b9;
}

/* PDF 查看器 */
.viewer-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
    padding: 14px 0 10px 0;
    flex-shrink: 0;
}

.viewer-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.viewer-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.page-jump-input {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
}
.page-jump-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52,152,219,0.2);
}
.page-info-inline {
    font-size: 13px;
    color: #2c3e50;
    font-weight: 600;
    white-space: nowrap;
    padding: 0 4px;
    user-select: none;
}

.btn-nav {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.btn-nav:hover {
    background: #2980b9;
}

.pdf-viewer-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: auto;
    max-height: 70vh;
}

#pdf-canvas {
    border: 1px solid #ddd;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

#watermark-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

/* 上传区域 */
.upload-target {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-target select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    min-width: 200px;
}

.upload-form {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.upload-area {
    border: 2px dashed #3498db;
    border-radius: 10px;
    padding: 60px;
    text-align: center;
    background: #f8f9fa;
}

.upload-area p {
    margin: 10px 0;
    color: #666;
}

#upload-status {
    margin-top: 20px;
    text-align: center;
}

/* 表格容器 */
.table-container {
    overflow: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex: 1 1 0%;
    min-height: 0;
}

/* 分页 */
.pagination {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.pagination button {
    padding: 8px 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.pagination button:hover {
    background: #2980b9;
}

.pagination button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

/* 用户管理 */
.user-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.user-form h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.form-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.form-row input,
.form-row select {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    min-width: 120px;
}

.form-row button {
    padding: 8px 16px;
    white-space: nowrap;
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    min-width: 400px;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* 移动端菜单按钮（桌面隐藏） */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    color: #333;
}

/* 侧边栏遮罩（桌面隐藏） */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* 响应式 */
@media (max-width: 768px) {
    /* 汉堡菜单 */
    .mobile-menu-btn {
        display: inline-block;
    }

    /* 侧边栏：抽屉式，左侧滑出 */
    .sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        width: 260px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
    }
    .sidebar.mobile-open {
        left: 0;
    }
    .sidebar-resize-handle {
        display: none;
    }

    /* 遮罩 */
    .sidebar-overlay.active {
        display: block;
    }

    /* 容器不再横向排列 */
    .container {
        flex-direction: column;
    }

    /* 内容区域 */
    .content {
        padding: 15px;
    }

    /* Header */
    header {
        padding: 10px 12px;
    }
    .header-left h1 {
        font-size: 15px;
    }
    .header-right {
        gap: 8px;
    }

    /* 登录页 */
    .login-container {
        width: 90%;
        max-width: 342px;
        padding: 20px 20px 28px;
    }

    /* 工具栏 */
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .search-box {
        max-width: 100%;
    }
    .sort-box {
        flex-wrap: wrap;
    }

    /* 弹窗全屏化 */
    .modal-content {
        min-width: 0;
        width: 95%;
        max-width: 95%;
        max-height: 90vh;
        overflow-y: auto;
        padding: 20px;
        margin: 10px;
    }

    /* 表格横向滚动 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .file-table {
        min-width: 600px;
    }

    /* 权限配置页 */
    .permission-toolbar {
        flex-direction: column;
        gap: 8px;
    }
    .permission-selector {
        flex-direction: column;
        gap: 8px;
    }
    .permission-selector select {
        width: 100%;
    }

    /* 表单行 */
    .form-row {
        flex-wrap: wrap;
    }
    .form-row input,
    .form-row select {
        width: 100%;
    }

    /* PDF查看器 */
    .pdf-viewer-wrapper {
        max-height: 60vh;
        padding: 10px;
    }
    .viewer-nav {
        gap: 4px;
        flex-wrap: wrap;
    }
    .btn-nav {
        padding: 6px 10px;
        font-size: 12px;
    }
    .zoom-toolbar {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* 缩略图面板 */
    .thumbnail-panel {
        width: 120px;
        min-width: 120px;
    }

    /* 变更动态 */
    .change-history-filters {
        flex-direction: column;
    }

    /* 目录树 */
    .folder-tree-container.expanded {
        max-height: 50vh;
    }

    /* 按钮组 */
    .batch-actions {
        flex-wrap: wrap;
        gap: 4px;
    }
    .batch-actions button {
        font-size: 11px;
        padding: 6px 10px;
    }

    /* 文件列表列宽调整 */
    .file-table th:nth-child(1),
    .file-table td:nth-child(1) {
        width: 30px;
        min-width: 30px;
    }
    .file-table th:nth-child(3),
    .file-table td:nth-child(3) {
        display: none;
    }
    .file-table th:nth-child(4),
    .file-table td:nth-child(4) {
        width: 80px;
        min-width: 80px;
    }

    /* 文件描述截断 */
    .folder-desc-inline {
        max-width: 200px;
    }
}

/* 小屏手机 (≤480px) */
@media (max-width: 480px) {
    header {
        padding: 8px 10px;
    }
    .header-left h1 {
        font-size: 14px;
    }
    .btn-secondary {
        padding: 6px 10px;
        font-size: 12px;
    }
    .content {
        padding: 10px;
    }
    .modal-content {
        padding: 15px;
    }
    h2 {
        font-size: 16px;
    }
    .permission-item {
        font-size: 12px;
        padding: 6px 8px;
    }
    .nav-item {
        padding: 12px 20px;
        font-size: 13px;
    }
}

/* 超小屏 (≤360px) */
@media (max-width: 360px) {
    .header-left h1 {
        font-size: 13px;
    }
    .login-container {
        padding: 15px 15px 20px;
    }
    .btn-primary {
        padding: 10px 16px;
        font-size: 12px;
    }
}

/* 上传目标信息 */
.upload-target-info {
    padding: 10px;
    background: #e3f2fd;
    border-radius: 5px;
    margin-bottom: 15px;
    color: #1976d2;
    font-weight: 500;
}

/* 弹窗内上传区域 */
.modal .upload-area {
    padding: 40px;
    margin: 15px 0;
}

#modal-upload-status {
    margin-top: 15px;
    text-align: center;
    min-height: 24px;
}

/* 缩放工具栏 */
.zoom-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 0;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
}
.zoom-btn {
    padding: 4px 12px;
    background: #ecf0f1;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #2c3e50;
    transition: background 0.2s;
}
.zoom-btn:hover {
    background: #d5dbdb;
}
#zoom-level {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    min-width: 50px;
    text-align: center;
    user-select: none;
}

/* 查看器主体布局（缩略图 + 文档） */
.viewer-body {
    display: flex;
    gap: 0;
    position: relative;
}

/* 缩略图面板 */
.thumbnail-panel {
    width: 180px;
    min-width: 180px;
    max-height: 75vh;
    overflow-y: auto;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    margin-right: 10px;
    flex-shrink: 0;
}
.thumbnail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 1px solid #e0e0e0;
    background: #f0f0f0;
    position: sticky;
    top: 0;
    z-index: 1;
}
.thumbnail-close-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0 4px;
}
.thumbnail-close-btn:hover {
    color: #e74c3c;
}
.thumbnail-list {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.thumbnail-item {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.2s;
    position: relative;
}
.thumbnail-item:hover {
    border-color: #3498db;
}
.thumbnail-item.active {
    border-color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231,76,60,0.3);
}
.thumbnail-item img {
    width: 100%;
    display: block;
}
.thumbnail-item .thumb-page-num {
    position: absolute;
    bottom: 2px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 11px;
    padding: 1px 5px;
    border-radius: 3px;
}

/* PDF 查看器优化 */
.pdf-viewer-wrapper {
    position: relative;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    overflow: auto;
    max-height: 75vh;
    padding: 20px;
    background: #f0f0f0;
    border-radius: 5px;
    flex: 1;
    min-width: 0;
}
.pdf-viewer-wrapper.zoomed-fit {
    justify-content: center;
}

#pdf-canvas {
    border: 1px solid #ddd;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    max-width: 100%;
    height: auto;
}

#pdf-viewer-img {
    max-width: 100%;
    height: auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    border: 1px solid #ddd;
    transition: transform 0.15s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.viewer-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 15px;
}

/* 目录说明 */
.tree-desc {
    display: block;
    font-size: 11px;
    color: #95a5a6;
    padding: 0 8px 2px 26px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}
.folder-desc-inline {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}
.folder-description-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-left: 3px solid #3498db;
    border-radius: 4px;
    font-size: 13px;
    color: #555;
}
.btn-desc-edit {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 3px;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.btn-desc-edit:hover {
    opacity: 1;
    background: #e8e8e8;
}

/* 变更动态 */
.change-history-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.change-history-filters select,
.change-history-filters input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}
.change-history-filters input {
    flex: 1;
    min-width: 200px;
}
.change-history-list {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}
.change-day-header {
    padding: 10px 16px;
    background: #f8f9fa;
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 1;
}
.change-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    transition: background 0.15s;
}
.change-item:hover {
    background: #fafafa;
}
.change-item:last-child {
    border-bottom: none;
}
.change-icon {
    font-size: 16px;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}
.change-content {
    flex: 1;
    color: #333;
    line-height: 1.5;
}
.change-user {
    font-weight: 600;
    color: #2c3e50;
}
.change-target {
    color: #2980b9;
    word-break: break-all;
}
.change-folder {
    color: #7f8c8d;
    font-size: 12px;
}
.change-time {
    color: #95a5a6;
    font-size: 12px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* 权限配置样式 */
.permission-toolbar {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 20px;
}

.permission-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.permission-selector select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    min-width: 150px;
}

.permission-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.permission-section h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.permission-section .hint {
    color: #666;
    font-size: 12px;
    margin-bottom: 15px;
}

.permission-tree {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 10px;
}

.permission-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.permission-item:last-child {
    border-bottom: none;
}

.permission-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.permission-item .folder-icon {
    font-size: 13px;
}

.permission-item .perm-status {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 3px;
}

.perm-granted {
    background: #d4edda;
    color: #155724;
}

.perm-inherited {
    background: #fff3cd;
    color: #856404;
}

.perm-denied {
    background: #f8d7da;
    color: #721c24;
}

/* 权限配置目录树 */
.perm-tree-node {
    border-bottom: 1px solid #f0f0f0;
}
.perm-tree-node:last-child {
    border-bottom: none;
}
.perm-tree-row {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    gap: 6px;
    transition: background 0.15s;
}
.perm-tree-row:hover {
    background: #f5f7fa;
}
.perm-tree-granted {
    background: #e8f5e9;
}
.perm-tree-granted:hover {
    background: #c8e6c9;
}
.perm-tree-toggle {
    cursor: pointer;
    font-size: 11px;
    color: #666;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    user-select: none;
}
.perm-tree-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
    font-size: 13px;
}
.perm-tree-label input[type="checkbox"] {
    flex-shrink: 0;
}
.perm-tree-children {
    border-left: 2px solid #e0e0e0;
    margin-left: 8px;
}

/* 用户组成员管理 */
.group-members {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

.group-members h4 {
    margin-bottom: 10px;
}

.member-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.member-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: #e3f2fd;
    border-radius: 15px;
    font-size: 14px;
}

.member-tag .remove-member {
    cursor: pointer;
    color: #e74c3c;
    font-weight: bold;
}


/* 审计日志样式 */
.audit-action {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

.audit-action:contains("DELETE") {
    background: #f8d7da;
    color: #721c24;
}

.audit-action:contains("CREATE") {
    background: #d4edda;
    color: #155724;
}

.audit-action:contains("UPDATE") {
    background: #fff3cd;
    color: #856404;
}

.audit-action:contains("LOGIN") {
    background: #cce5ff;
    color: #004085;
}

.audit-action:contains("PERMISSION") {
    background: #e2e3e5;
    color: #383d41;
}

/* 权限搜索结果 */
.search-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-top: 5px;
    background: white;
}

.search-result-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-result-item:hover {
    background: #f5f5f5;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-type {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 3px;
    background: #e3f2fd;
    color: #1976d2;
}

.search-result-type.group {
    background: #f3e5f5;
    color: #7b1fa2;
}

.selected-target {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #e8f5e9;
    border-radius: 5px;
}

.btn-sm {
    padding: 3px 8px;
    font-size: 12px;
}

/* 权限弹窗两列布局 */
.perm-results-columns {
    display: flex;
    gap: 15px;
}

.perm-column {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    max-height: 300px;
    overflow-y: auto;
}

.perm-column-header {
    padding: 10px;
    background: #f5f5f5;
    font-weight: bold;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
}

.perm-column .search-result-item {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.perm-column .search-result-item:hover {
    background: #e3f2fd;
}

.perm-column .search-result-item:last-child {
    border-bottom: none;
}

/* 文件路径角标 */
.path-badge {
    display: inline-block;
    margin-left: 5px;
    padding: 2px 6px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    vertical-align: middle;
}

.path-badge:hover {
    background: #bbdefb;
}

.path-display {
    margin: 15px 0;
}

.path-display input {
    font-size: 14px;
    color: #333;
    background: #f5f5f5;
}

/* 已授权显示 */
.current-permissions {
    margin-bottom: 15px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

.current-permissions label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.perm-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.perm-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 13px;
}

.perm-tag.user-tag {
    background: #e3f2fd;
    color: #1565c0;
}

.perm-tag.group-tag {
    background: #f3e5f5;
    color: #7b1fa2;
}

.perm-remove {
    cursor: pointer;
    font-weight: bold;
    margin-left: 3px;
}

.perm-remove:hover {
    color: #d32f2f;
}

.perm-empty {
    color: #999;
    font-style: italic;
}

/* 成员管理弹窗 */
.members-columns {
    display: flex;
    gap: 20px;
    margin: 15px 0;
}

.members-column {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 10px;
}

.members-header {
    font-weight: bold;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 10px;
}

.members-list {
    max-height: 300px;
    overflow-y: auto;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 5px;
    cursor: pointer;
}

.member-item:hover {
    background: #f5f5f5;
}

.members-cell {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 表头搜索行 */
.search-row td {
    padding: 5px;
    background: #f0f0f0;
}

.col-search {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    box-sizing: border-box;
}

.col-search:focus {
    border-color: #1976d2;
    outline: none;
}



.header-brand {
    display: flex;
    align-items: center;
}

.header-logo-img {
    height: 40px;
    width: auto;
}

/* 侧边栏底部版权 */
.sidebar-copyright {
    padding: 10px 16px;
    font-size: 11px;
    color: #7f8c8d;
    line-height: 1.5;
    text-align: center;
    flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.08);
}


/* ===== 用户协议弹框 ===== */
.agreement-modal-overlay {
    z-index: 10000;
}

.agreement-modal-overlay .agreement-modal-content {
    min-width: 520px;
    max-width: 620px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.agreement-modal-overlay h3 {
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 16px;
    text-align: center;
}

.agreement-summary {
    max-height: 280px;
    overflow-y: auto;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13.5px;
    line-height: 1.8;
    color: #444;
}

.agreement-summary p {
    margin: 8px 0;
}

.agreement-summary ul {
    margin: 8px 0 8px 20px;
    padding: 0;
}

.agreement-summary ul li {
    margin: 4px 0;
    color: #555;
}

.agreement-link-row {
    margin-top: 12px;
    text-align: center;
}

.agreement-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
}

.agreement-link:hover {
    text-decoration: underline;
    color: #2980b9;
}

.agreement-accept-btn {
    min-width: 120px;
}


/* ==================== 侧边栏目录树 ==================== */
.folder-tree-container {
    display: none;
    margin: 0;
    padding: 0;
}
.folder-tree-container.expanded {
    display: block;
    border-top: 1px solid #3d566e;
    margin-top: 4px;
    padding-top: 4px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}
.folder-tree {
    font-size: 12px;
    line-height: 1.6;
}
.tree-node {
    padding: 0;
}
.tree-folder-header {
    display: flex;
    align-items: center;
    padding: 3px 8px 3px 12px;
    cursor: pointer;
    color: #ecf0f1;
    border-radius: 4px;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tree-folder-header:hover {
    background: #34495e;
}
.tree-toggle {
    display: inline-block;
    width: 14px;
    font-size: 10px;
    color: #95a5a6;
    flex-shrink: 0;
    text-align: center;
    transition: transform 0.15s;
}
.tree-toggle.open {
    transform: rotate(90deg);
}
.tree-icon {
    margin-right: 4px;
    flex-shrink: 0;
}
.tree-label {
    overflow: hidden;
    text-overflow: ellipsis;
}
.tree-children {
    display: none;
    padding-left: 14px;
}
.tree-children.open {
    display: block;
}
.tree-doc {
    display: flex;
    align-items: center;
    padding: 2px 8px 2px 12px;
    cursor: pointer;
    color: #bdc3c7;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tree-doc:hover {
    background: #34495e;
}
.tree-doc-icon {
    margin-right: 4px;
    flex-shrink: 0;
    font-size: 11px;
}
.tree-doc-name {
    overflow: hidden;
    text-overflow: ellipsis;
}
.tree-folder-header.active,
.tree-doc.active {
    background: #3498db;
    color: #ffffff;
}
.tree-folder-header.active .tree-toggle,
.tree-folder-header.active .tree-icon,
.tree-doc.active .tree-doc-icon {
    color: #ffffff;
}


/* ==================== 可拖动侧边栏 ==================== */
.sidebar {
    position: relative;
    min-width: 180px;
    max-width: 600px;
    flex-shrink: 0;
    overflow-y: auto;
    height: calc(100vh - 60px);
}
.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
    z-index: 10;
    transition: background 0.2s;
}
.sidebar-resize-handle:hover,
.sidebar-resize-handle.active {
    background: #3498db;
}

/* ==================== admin-only CSS控制 ==================== */
body:not(.is-admin) .admin-only {
    display: none !important;
}

/* ==================== 页面加载动画 ==================== */
.page-loading-spinner {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(255,255,255,0.85);
    z-index: 10;
    border-radius: 5px;
}
.page-loading-spinner.hidden {
    display: none !important;
}
.spinner-ring {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner-text {
    margin-top: 10px;
    font-size: 13px;
    color: #666;
}

/* ==================== v7.19: 布局优化 + 全屏 ==================== */
/* sidebar user info at bottom */
.sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}
.sidebar nav {
    flex: 1;
    overflow-y: auto;
}
.sidebar-user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.sidebar-username {
    color: #bdc3c7;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
}
.btn-logout {
    background: transparent;
    color: #e74c3c;
    border: 1px solid #e74c3c;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
}
.btn-logout:hover {
    background: #e74c3c;
    color: white;
}

/* fullscreen hint */
.fullscreen-hint {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 100;
    pointer-events: none;
    animation: hint-fade 3s ease forwards;
}
@keyframes hint-fade {
    0%,70% { opacity: 1; }
    100% { opacity: 0; }
}
.fullscreen-hint.hidden { display: none !important; }

/* fullscreen mode styles — target viewer-body */
.viewer-body:fullscreen,
.viewer-body:-webkit-full-screen {
    background: #1a1a1a;
    padding: 0;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    height: 100vh;
    overflow: hidden;
}
.viewer-body:fullscreen .pdf-viewer-wrapper,
.viewer-body:-webkit-full-screen .pdf-viewer-wrapper {
    max-height: none;
    height: 100%;
    flex: 1 1 0%;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    padding: 0;
    background: transparent;
    border-radius: 0;
}
.viewer-body:fullscreen .pdf-viewer-wrapper.zoomed-in,
.viewer-body:-webkit-full-screen .pdf-viewer-wrapper.zoomed-in {
    align-items: flex-start;
    justify-content: flex-start;
}
.viewer-body:fullscreen .pdf-viewer-wrapper #pdf-viewer-img,
.viewer-body:-webkit-full-screen .pdf-viewer-wrapper #pdf-viewer-img {
    max-width: none !important;
    max-height: none !important;
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
}
.viewer-body:fullscreen .thumbnail-panel,
.viewer-body:-webkit-full-screen .thumbnail-panel {
    max-height: 100vh;
    border-radius: 0;
}
/* toolbar: auto-hide in fullscreen, hover to show */
.zoom-toolbar.fullscreen-toolbar {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    background: rgba(0,0,0,0.8);
    padding: 10px 20px;
    justify-content: center;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
.zoom-toolbar.fullscreen-toolbar.show {
    opacity: 1;
    pointer-events: auto;
}
.zoom-toolbar.fullscreen-toolbar .zoom-btn,
.zoom-toolbar.fullscreen-toolbar #zoom-level {
    color: #ecf0f1;
}
.zoom-toolbar.fullscreen-toolbar .zoom-btn {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
}
.zoom-toolbar.fullscreen-toolbar .zoom-btn:hover {
    background: rgba(255,255,255,0.3);
}
.zoom-toolbar.fullscreen-toolbar .btn-nav {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
    color: #ecf0f1;
}
.zoom-toolbar.fullscreen-toolbar .page-jump-input {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
    color: #ecf0f1;
}

/* batch-bar and desc-bar: fixed position in flex layout */
.batch-bar { flex-shrink: 0; }
.folder-description-bar { flex-shrink: 0; }

/* non-table blocks in content pages should not be compressed by the scrollable table area */
.user-form,
.permission-toolbar,
.change-history-filters,
.pagination {
    flex-shrink: 0;
}
