* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 科技风 · 亮色主题 */
    --primary-color: #06b6d4;
    --primary-dark: #0891b2;
    --primary-light: #22d3ee;
    --secondary-color: #6366f1;
    --accent-color: #22d3ee;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --bg-primary: #ffffff;
    --bg-secondary: #eef2f8;
    --bg-tertiary: #e2e8f0;
    --surface: #ffffff;
    --glass: rgba(255, 255, 255, 0.78);
    --border-color: #e2e8f0;
    --glow: 0 0 18px rgba(6, 182, 212, 0.35);
    --glow-strong: 0 0 28px rgba(6, 182, 212, 0.5);
    --bg-gradient: radial-gradient(1200px 600px at 12% -10%, rgba(34, 211, 238, 0.10), transparent 60%),
                   radial-gradient(900px 500px at 100% 0%, rgba(99, 102, 241, 0.10), transparent 55%),
                   linear-gradient(135deg, #eef2f8 0%, #e8edfb 100%);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 6px 16px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.10);
    --shadow-xl: 0 24px 48px rgba(15, 23, 42, 0.12);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏 */
.navbar {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all var(--transition-normal);
}

.navbar:hover {
    box-shadow: var(--shadow-md);
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: transform var(--transition-fast);
}

.navbar-brand:hover {
    transform: scale(1.02);
}

.navbar-brand i {
    font-size: 28px;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(99, 102, 241, 0.1);
}

.nav-link.active {
    color: var(--primary-color);
    background-color: rgba(99, 102, 241, 0.15);
}

.user-menu {
    position: relative;
    cursor: pointer;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    transition: transform var(--transition-fast);
}

.user-avatar:hover {
    transform: scale(1.1);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    z-index: 1200; /* 保证浮层永远盖过 topbar(sticky z-10)/卡片等定位内容 */
}

.user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-item {
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    transition: background-color var(--transition-fast);
}

.user-dropdown-item:hover {
    background-color: var(--bg-secondary);
}

.user-dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    color: white;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--text-primary);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #059669);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-sm {
    padding: 6px 16px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

/* 卡片样式 */
.card {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    transition: all var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    transition: all var(--transition-fast);
    background: var(--surface);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* 登录注册页面 */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    width: 100%;
    max-width: 450px;
    padding: 48px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 40px;
    color: white;
}

.auth-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-links {
    text-align: center;
    margin-top: 24px;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* 文件列表 */
/* 文件网格 / 卡片 / 图标：与 mockup-1 / mockup-3 完全一致 */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 18px;
}

.file-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 18px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.file-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.file-card.selected {
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--secondary-color) 10%, transparent);
    /* 1px 边框 + 1px 外圈 = 2px 视觉选中线，且不改变布局（避免选中时内容跳动） */
    box-shadow: 0 0 0 1px var(--primary-color);
}

/* 暗色主题：主色提亮 + 发光圈，选中态在深底上醒目 */
[data-theme="dark"] .file-card.selected {
    border-color: color-mix(in srgb, var(--primary-color) 55%, #ffffff);
    background: color-mix(in srgb, var(--primary-color) 16%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary-color) 55%, #ffffff),
                0 0 14px color-mix(in srgb, var(--primary-color) 40%, transparent);
}

/* 选中角标：左上角对勾圆点，亮暗主题一眼可辨 */
.file-card.selected::after {
    content: '\f00c';
    font-family: 'FontAwesome';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

[data-theme="dark"] .file-card.selected::after {
    background: color-mix(in srgb, var(--primary-color) 55%, #ffffff);
    color: #0f172a;
}

.file-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #fff;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    transition: all var(--transition-fast);
}

.file-icon i {
    font-size: 26px;
    line-height: 1;
}

.file-card:hover .file-icon {
    transform: scale(1.08);
}

.file-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 4px;
}

.file-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 10;
}

.file-card:hover .file-actions {
    opacity: 1;
}

.file-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.file-action-btn:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

/* 文件列表视图 */
.file-list {
    background: var(--surface);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.file-list-header {
    display: grid;
    /* 操作列 auto 固定不缩；大小/类型/上传时间 minmax 可随窗口自适应压缩；文件名 minmax(0,1fr) 支撑截断 */
    grid-template-columns: 40px minmax(0, 1fr) auto minmax(60px, 100px) minmax(52px, 84px) minmax(96px, 130px);
    padding: 16px 20px;
    /* 底色取 surface 混入 6% 文字色：亮色下是明显浅灰条、暗色下是稍亮深条，两主题都与内容区拉开 */
    background: color-mix(in srgb, var(--text-primary) 6%, var(--surface));
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
}

.file-list-item {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto minmax(60px, 100px) minmax(52px, 84px) minmax(96px, 130px);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.file-list-item:hover {
    /* 主色调淡底：与表头的灰底（bg-secondary）明显区分 */
    background-color: color-mix(in srgb, var(--primary-color) 7%, transparent);
}

.file-list-item.selected {
    background-color: color-mix(in srgb, var(--primary-color) 12%, transparent);
    box-shadow: inset 3px 0 0 var(--primary-color);
}

[data-theme="dark"] .file-list-item.selected {
    background-color: color-mix(in srgb, var(--primary-color) 18%, transparent);
    box-shadow: inset 3px 0 0 color-mix(in srgb, var(--primary-color) 55%, #ffffff);
}

.file-list-icon {
    font-size: 24px;
}

.file-list-name {
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
}

/* 文件名前的类型图标：裸图标无底框；亮色用主题色，暗色自动提亮保持可见 */
.file-list-fileicon {
    flex-shrink: 0;
    width: 20px;
    font-size: 17px;
    line-height: 1;
    text-align: center;
    color: var(--primary-color);
}

[data-theme="dark"] .file-list-fileicon {
    color: color-mix(in srgb, var(--primary-color) 60%, #ffffff);
}

.file-list-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-list-meta {
    font-size: 13px;
    color: var(--text-muted);
}

/* 自定义复选框：替代浏览器原生样式，亮/暗主题自适应 */
.custom-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--text-muted); /* 高对比边框：暗色主题下也清晰可见 */
    border-radius: 4px;
    background: var(--surface);
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    transition: all var(--transition-fast);
}

[data-theme="dark"] .custom-checkbox {
    border-color: rgba(255, 255, 255, 0.45);
}

.custom-checkbox:hover {
    border-color: var(--primary-color);
}

.custom-checkbox:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.custom-checkbox:checked::after {
    content: '\f00c';
    font-family: 'FontAwesome';
    font-size: 10px;
    color: #fff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* 列表操作列：默认隐藏，悬停所在行才显示（成熟网盘交互）；横排紧凑图标按钮 */
.file-list-ops {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    pointer-events: none; /* 隐藏时不可点，防止透明按钮挡住行的其它交互 */
    transition: opacity var(--transition-fast);
}

.file-list-item:hover .file-list-ops {
    opacity: 1;
    pointer-events: auto;
}

.file-op-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.file-op-btn:hover {
    background: color-mix(in srgb, var(--primary-color) 12%, transparent);
    color: var(--primary-color);
}

.file-op-btn.danger:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

/* 触屏设备无 hover：操作按钮常显，保证手机端可用 */
@media (hover: none) {
    .file-list-ops {
        opacity: 1;
        pointer-events: auto;
    }
}

/* 风格1：文件夹在文件区显示 */
.folder-icon-color {
    background: linear-gradient(135deg, #fbbf24, #f59e0b); /* 文件夹经典黄色，区别于文件图标 */
}

.folder-list-item .folder-icon-text {
    color: #f59e0b;
}

[data-theme="dark"] .folder-list-item .folder-icon-text {
    color: #fbbf24;
}

/* 面包屑：我的文件 > 当前文件夹 */
.section-title #breadcrumb-root {
    color: var(--text-primary);
}

.section-title #breadcrumb-root.breadcrumb-link {
    color: var(--primary-color);
    cursor: pointer;
}

.section-title #breadcrumb-root.breadcrumb-link:hover {
    text-decoration: underline;
}

.breadcrumb-sep {
    color: var(--text-muted);
    margin: 0 2px;
}

.breadcrumb-folder {
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 40%;
}

.breadcrumb-crumb-link {
    color: var(--primary-color);
    cursor: pointer;
}

.breadcrumb-crumb-link:hover {
    text-decoration: underline;
}

.breadcrumb-cur {
    color: var(--text-primary);
}

/* 分享页：分享者留言卡（变体 A） */
.share-note {
    text-align: left;
    background: color-mix(in srgb, var(--primary-color) 6%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--primary-color) 18%, var(--border-color));
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 20px;
}

.share-note-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    letter-spacing: .5px;
}

.share-note-content {
    font-size: 14px;
    line-height: 1.75;
    color: var(--text-primary);
    white-space: pre-wrap;      /* 保留换行 */
    word-break: break-word;
}

/* 重命名/说明弹窗：说明输入框（仅可上下拖拽调整高度） */
.note-textarea {
    width: 100%;
    min-height: 110px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.7;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-primary);
    resize: vertical;           /* 只允许上下拖拽 */
    overflow: auto;
    outline: none;
    font-family: inherit;
    transition: border-color var(--transition-fast);
}

.note-textarea:focus {
    border-color: var(--primary-color);
}

.note-tip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.note-tip .drag-hint {
    display: flex;
    align-items: center;
    gap: 5px;
}

.note-tip .drag-hint i {
    font-size: 13px;
}

/* 分享页：文件夹分享的文件列表 */
.share-folder-list {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 8px;
}

.share-folder-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
}

.share-folder-row:last-child {
    border-bottom: none;
}

.share-folder-fileicon {
    flex-shrink: 0;
    width: 18px;
    text-align: center;
    color: var(--primary-color);
    font-size: 15px;
}

.share-folder-fname {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    color: var(--text-primary);
}

.share-folder-fsize {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-muted);
}

.share-folder-row .btn {
    flex-shrink: 0;
}

/* 极窄屏：隐藏"类型"列，其余列继续自适应（操作列保持不缩） */
@media (max-width: 620px) {
    .file-list-header,
    .file-list-item {
        grid-template-columns: 36px minmax(0, 1fr) auto minmax(56px, 90px) minmax(84px, 110px);
    }

    .file-list-header > :nth-child(5),
    .file-list-item > :nth-child(5) {
        display: none;
    }
}

/* 上传区域 */
.upload-area {
    border: 2px dashed var(--primary-color);
    border-radius: 14px;
    padding: 34px;
    line-height: 1.4;
    text-align: center;
    transition: all var(--transition-normal);
    cursor: pointer;
    background: color-mix(in srgb, var(--primary-color) 6%, transparent);
}

.upload-area > i {
    font-size: 34px;
    color: var(--primary-color);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 40px;
    color: var(--primary-color);
    transition: all var(--transition-fast);
}

.upload-area:hover .upload-icon {
    transform: scale(1.1);
}

.upload-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 14px;
    color: var(--text-muted);
}

/* 上传进度条 */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 4px;
    transition: width var(--transition-fast);
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: all var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger-color);
    color: white;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
}

/* 即时反馈：加载中骨架 */
.modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 160px;
    color: #6b7280;
    font-size: 14px;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner.small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 媒体预览：加载完成前隐藏内容并显示转圈 */
.modal-media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.modal-media > .spinner {
    position: absolute;
}

.modal-media > img,
.modal-media > video,
.modal-media > audio {
    opacity: 0;
}

.modal-media.ready > .spinner {
    display: none;
}

.modal-media.ready > img,
.modal-media.ready > video,
.modal-media.ready > audio {
    opacity: 1;
}

.cdn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9ca3af;
    font-size: 12px;
    margin: 4px 0 12px;
}

.btn.is-loading,
.file-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 侧边栏 */
.sidebar {
    width: 248px;
    flex: 0 0 248px;
    background: var(--surface);
    padding: 20px 14px;
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden; /* 滚动交给内部文件夹区，存储空间块固定底部不被挤走 */
    display: flex;
    flex-direction: column;
    gap: 6px;
}


/* 主内容区 */
.main-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.stat-icon.users {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

.stat-icon.files {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: white;
}

.stat-icon.shares {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: white;
}

.stat-icon.space {
    background: linear-gradient(135deg, #22d3ee, #06b6d4);
    color: white;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 空间使用 */
.space-usage {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
}

.space-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.space-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.space-info {
    font-size: 14px;
    color: var(--text-secondary);
}

.space-bar {
    height: 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
}

.space-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 6px;
    transition: width var(--transition-slow);
}

/* 搜索框 */
.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
}

/* 分享页面 */
.share-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.share-card {
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.share-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin: 0 auto 24px;
}

.share-icon i {
    font-size: 44px;
}

.share-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.share-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.share-file-info {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 24px;
    text-align: left;
}

.share-file-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.share-file-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    flex-shrink: 0;
}

.share-file-meta {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.share-file-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    word-break: break-all;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.share-file-size {
    font-size: 13px;
    color: var(--text-muted);
}

/* 分享页移动端适配：长文件名/文件夹名自动折行，左侧图标不被挤压 */
@media (max-width: 480px) {
    .share-container {
        padding: 20px 16px;
        align-items: flex-start;
    }

    .share-card {
        max-width: 100%;
    }

    .share-icon {
        width: 80px;
        height: 80px;
        margin-bottom: 16px;
    }

    .share-icon i {
        font-size: 34px;
    }

    .share-title {
        font-size: 20px;
    }

    .share-subtitle {
        margin-bottom: 24px;
    }

    .share-file-info {
        padding: 16px;
        margin-bottom: 20px;
    }

    .share-file-row {
        gap: 12px;
    }

    .share-file-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .share-file-name {
        font-size: 15px;
    }

    /* 文件夹文件列表：保持单行，文件名过长用省略号，避免大小/按钮被挤到第二行 */
    .share-folder-row {
        gap: 8px;
        padding: 10px 12px;
    }

    .share-folder-fname {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .share-folder-fsize {
        font-size: 11px;
    }

    .share-folder-row .btn {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* 通知提示 */
.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 16px 24px;
    border-radius: var(--border-radius);
    font-weight: 500;
    z-index: 3000;
    transform: translateX(120%);
    transition: transform var(--transition-normal);
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    background: var(--success-color);
    color: white;
}

.toast-error {
    background: var(--danger-color);
    color: white;
}

.toast-warning {
    background: var(--warning-color);
    color: white;
}

.toast-info {
    background: var(--primary-color);
    color: white;
}

/* 复选框 */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.checkbox.checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* 文件区标题工具栏（我的文件 + 新建文件夹 + 排序 + 视图切换：单行布局） */
.section-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.section-title > i {
    color: var(--primary-color);
}

/* 工具栏控件高度统一：新建文件夹按钮 / 排序选择框 / 视图切换按钮 对齐为 32px */
.section-title .btn-sm {
    height: 32px;
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 14px;
    padding-right: 14px;
}

.section-title .sort-select {
    height: 32px;
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 12px;
    padding-right: 12px;
}

/* 筛选排序 */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sort-select {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--surface);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 分页条（变量取色，亮暗/双风格自动适配） */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination .page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination .page-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination .page-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-color: transparent;
    color: #fff;
}

.pagination .page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .page-ellipsis {
    color: var(--text-muted);
    padding: 0 4px;
}

.pagination .page-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 8px;
}

/* 公告区域 */
.announcement {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(148, 163, 184, 0.1));
    border-left: 4px solid var(--primary-color);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.announcement-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.announcement-content {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 响应式 */
@media (max-width: 768px) {
    .navbar-nav {
        gap: 10px;
    }
    
    .nav-link {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .file-card {
        padding: 12px;
    }
    
    .file-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
        margin-bottom: 8px;
    }

    .file-icon i {
        font-size: 22px;
    }
    
    .sidebar {
        width: 200px;
        padding: 12px;
    }
    
    .main-content {
        padding: 12px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .auth-card {
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    .navbar-content {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .navbar-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .file-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        width: 100%;
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .main-content {
        padding: 12px;
    }
}

/* 侧边栏文件夹操作按钮 */
.sidebar-folder-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s;
}

.sidebar-folder-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.sidebar-folder-btn:last-child:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.folder-actions {
    display: flex;
    align-items: center;
}

/* ============ 暗黑主题 ============ */
[data-theme="dark"] {
    --primary-color: #22d3ee;
    --primary-dark: #06b6d4;
    --primary-light: #67e8f9;
    --secondary-color: #818cf8;
    --accent-color: #22d3ee;
    --success-color: #34d399;
    --warning-color: #fbbf24;
    --danger-color: #f87171;
    --text-primary: #e6ebf3;
    --text-secondary: #aab4c5;
    --text-muted: #7e8aa0;
    --bg-primary: #1e2536;
    --bg-secondary: #1a2030;
    --bg-tertiary: #2a3346;
    --surface: #222b3d;
    --glass: rgba(34, 43, 61, 0.72);
    --border-color: #313c52;
    --glow: 0 0 16px rgba(34, 211, 238, 0.38);
    --glow-strong: 0 0 24px rgba(34, 211, 238, 0.5);
    --bg-gradient: radial-gradient(1200px 600px at 12% -10%, rgba(34, 211, 238, 0.12), transparent 60%),
                   radial-gradient(900px 500px at 100% 0%, rgba(129, 140, 248, 0.12), transparent 55%),
                   linear-gradient(135deg, #1a2030 0%, #222b3d 55%, #2a2440 100%);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.45);
}

/* 暗黑下面板玻璃质感 + 霓虹描边 */
[data-theme="dark"] .card,
[data-theme="dark"] .file-card,
[data-theme="dark"] .modal,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .space-usage,
[data-theme="dark"] .upload-area,
[data-theme="dark"] .file-list,
[data-theme="dark"] .sidebar,
[data-theme="dark"] .user-dropdown {
    border: 1px solid rgba(34, 211, 238, 0.12);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.04), 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* 暗黑下输入框 */
[data-theme="dark"] .form-control,
[data-theme="dark"] .sort-select {
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* 暗黑下搜索框：压掉浏览器默认白底（两风格共用暗色变量，一处生效） */
[data-theme="dark"] .search-input {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .search-input::placeholder {
    color: var(--text-muted);
}

[data-theme="dark"] .form-control::placeholder {
    color: var(--text-muted);
}

/* 暗黑下导航品牌发光 */
[data-theme="dark"] .navbar-brand {
    text-shadow: 0 0 16px rgba(34, 211, 238, 0.55);
}

[data-theme="dark"] .auth-logo {
    box-shadow: 0 0 24px rgba(34, 211, 238, 0.4);
}

/* ============ 主题切换按钮 ============ */
.theme-toggle {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 3000;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--primary-color);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast),
                background var(--transition-normal), color var(--transition-normal);
}

.theme-toggle:hover {
    transform: translateY(-3px) scale(1.06);
    box-shadow: var(--glow-strong);
}

.theme-toggle:active {
    transform: translateY(0) scale(0.96);
}

/* 顶栏内的主题切换按钮：右上角内联小方钮，与上传/头像同排 */
.topbar .theme-toggle {
    position: static;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 15px;
    flex: 0 0 auto;
    box-shadow: none;
}

.topbar .theme-toggle:hover {
    transform: none;
    box-shadow: var(--glow);
}

/* ============ 后台管理暗黑主题适配（集中一处，7 个 admin 页面共用同一份 style.css 即全生效） ============ */
/* 说明：admin 各文件的内联 <style> 把 .admin-content/.admin-title/.table/.pagination-link 等
   写死成浅色，在暗色下整片失效。这里用 [data-theme="dark"] 属性选择器提升优先级
   （0,0,2,0 > 内联 <style> 的 0,0,1,0），一处覆盖即对所有 admin 页面生效。 */
[data-theme="dark"] body {
    background: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .admin-content {
    background: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .admin-title {
    color: var(--text-primary);
}

[data-theme="dark"] .admin-sidebar {
    border-right: 1px solid var(--border-color);
}

[data-theme="dark"] .admin-sidebar-logo {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .admin-sidebar-menu-link:hover {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .admin-user span {
    color: var(--text-secondary);
}

/* 配置区块标题分隔线（config.php 写死浅色，暗色下不可见） */
[data-theme="dark"] .config-section-title {
    border-bottom-color: var(--border-color);
}

/* 表格暗色化 */
[data-theme="dark"] .table {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

[data-theme="dark"] .table th,
[data-theme="dark"] .table td {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .table th {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

[data-theme="dark"] .table tr:hover {
    background: var(--bg-tertiary);
}

/* 分页暗色化 */
[data-theme="dark"] .pagination-link {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

[data-theme="dark"] .pagination-link:hover,
[data-theme="dark"] .pagination-link.active {
    background: #6366f1;
    color: #ffffff;
}

/* ===== 公告：topbar 铃铛按钮 + 红点 + 弹窗 ===== */
.notice-btn {
    position: relative;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.notice-btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.notice-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid var(--surface);
}

.notice-overlay {
    position: fixed;
    inset: 0;
    z-index: 2500;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.notice-overlay.active {
    opacity: 1;
}

.notice-card {
    width: 520px;
    max-width: 100%;
    max-height: 80vh;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    transform: scale(0.92) translateY(10px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.notice-overlay.active .notice-card {
    transform: none;
    opacity: 1;
}

.notice-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 800;
    color: var(--text-primary);
    flex: 0 0 auto;
}

.notice-head i {
    color: var(--primary-color);
    margin-right: 6px;
}

.notice-close {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.notice-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.notice-list {
    overflow-y: auto;
    padding: 8px 12px 14px;
}

.notice-item {
    padding: 14px 12px;
    border-radius: 10px;
}

.notice-item + .notice-item {
    margin-top: 4px;
}

.notice-item:hover {
    background: var(--bg-secondary);
}

.notice-item.newest {
    background: color-mix(in srgb, var(--primary-color) 8%, transparent);
}

.notice-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notice-item-title {
    flex: 1;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}

.notice-new-tag {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    padding: 2px 8px;
    border-radius: 999px;
}

.notice-item-time {
    font-size: 11px;
    color: var(--text-muted);
    margin: 4px 0 6px;
}

.notice-item-body {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    white-space: pre-line;
    word-break: break-word;
}

/* =========================================================
   双风格：data-style="1" 科技蓝（默认） / "3" 翡翠绿
   仅覆盖主题色相关变量；布局/表面色由下方规则补充
   ========================================================= */
[data-style="3"] {
    --primary-color: #10b981;
    --primary-dark: #059669;
    --primary-light: #34d399;
    --secondary-color: #6366f1;
    --accent-color: #6366f1;
    --success-color: #10b981;
    --glow: 0 0 18px rgba(16, 185, 129, 0.35);
    --glow-strong: 0 0 28px rgba(16, 185, 129, 0.5);
}

/* 暗黑 + 风格3：翡翠绿在深色下更亮一些，表面色沿用 [data-theme="dark"] */
[data-theme="dark"][data-style="3"] {
    --primary-color: #34d399;
    --primary-dark: #10b981;
    --primary-light: #6ee7b7;
    --secondary-color: #818cf8;
    --glow: 0 0 16px rgba(16, 185, 129, 0.38);
    --glow-strong: 0 0 24px rgba(16, 185, 129, 0.5);
}

/* 登录页：整页居中 + 880px 双栏卡片（对齐 mockup，背景沿用 body 的 --bg-gradient 亮暗自适应） */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px;
}

.login-box {
    display: flex;
    width: 880px;
    max-width: 100%;
    background: var(--surface);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

/* 左侧介绍栏：主色系浅渐变（color-mix 派生，风格1青/风格3绿自动适配） */
.login-intro {
    flex: 0 0 46%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 44px;
    background: linear-gradient(155deg,
        color-mix(in srgb, var(--primary-color) 10%, #ffffff),
        color-mix(in srgb, var(--primary-color) 26%, #ffffff));
    color: color-mix(in srgb, var(--primary-dark) 70%, #334155);
}

.login-intro .b {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 22px;
    color: var(--primary-dark);
}

.login-intro .b i {
    font-size: 26px;
}

.login-intro h1 {
    font-size: 30px;
    font-weight: 900;
    line-height: 1.3;
    margin: 18px 0 12px;
    color: color-mix(in srgb, var(--primary-dark) 80%, #0f172a);
}

.login-intro p {
    color: color-mix(in srgb, var(--primary-dark) 70%, #334155);
    max-width: 300px;
    line-height: 1.8;
    font-size: 14px;
}
.login-intro .feat {
    margin-top: 26px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.login-intro .feat div {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
}
.login-intro .feat i {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--primary-color) 18%, #ffffff);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
}
.login-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 44px;
}
.login-card { width: 100%; max-width: 340px; }
.login-logo {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
    box-shadow: var(--glow);
}
.login-card h2 { font-size: 22px; color: var(--text-primary); }
.login-card p.sub { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }

@media (max-width: 768px) {
    .login-box { flex-direction: column; }
    .login-intro { display: none; }
    .login-side { padding: 32px 24px; }
}
[data-theme="dark"] .login-intro {
    background: linear-gradient(155deg,
        color-mix(in srgb, var(--primary-color) 30%, #0f172a),
        color-mix(in srgb, var(--primary-color) 16%, #0f172a));
    color: #e6f7ef;
}
[data-theme="dark"] .login-intro .b,
[data-theme="dark"] .login-intro p { color: #bfe9d8; }
/* 大标题用更亮一层，保持视觉层级 */
[data-theme="dark"] .login-intro h1 { color: #e6f7ef; }
[data-theme="dark"] .login-intro .feat i {
    background: color-mix(in srgb, var(--primary-color) 22%, #0f172a);
    color: var(--primary-light);
}

/* =========================================================
   主框架与双布局（风格1 侧栏 / 风格3 图标栏）
   与 mockup-1 / mockup-3 完全一致：左导航 + 内部 .topbar + .content
   ========================================================= */
.app {
    display: flex;
    min-height: 100vh;
}

/* 风格1：侧栏导航项（mockup-1） */
.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 20px;
    color: var(--primary-color);
    text-decoration: none;
    margin: 6px 8px 18px;
}
.sidebar .brand i { font-size: 26px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    line-height: 1.2;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
}
.nav-item i { width: 20px; text-align: center; }
.nav-item:hover {
    background: color-mix(in srgb, var(--primary-color) 10%, transparent);
    color: var(--primary-color);
}
.nav-item.active {
    background: color-mix(in srgb, var(--primary-color) 16%, transparent);
    color: var(--primary-color);
}
.side-tag {
    margin-top: auto;
    font-size: 12px;
    color: var(--text-muted);
    padding: 10px 14px;
}
.sidebar .space-usage { margin-bottom: 0; }

/* 风格3：图标栏 rail（mockup-3） */
.rail {
    width: 78px;
    flex: 0 0 78px;
    background: var(--surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    /* sticky 无条件创建 stacking context，会把内部浮层(z-index:1200)封印在本层；
       必须整体抬高 rail 层级，否则下拉菜单被 .main 的定位卡片(file-card 等)盖住 */
    z-index: 50;
}
.rail-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 14px;
    text-decoration: none;
    box-shadow: var(--glow);
}
.ri {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.ri:hover {
    background: color-mix(in srgb, var(--primary-color) 12%, transparent);
    color: var(--primary-color);
}
.ri.on, .ri.active {
    background: color-mix(in srgb, var(--primary-color) 18%, transparent);
    color: var(--primary-color);
}
.sp {
    margin-top: auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    cursor: pointer;
    position: relative;
}
/* 图标栏头像下拉：向右展开、底边对齐头像向上延伸（头像贴近视口底部，
   若垂直居中会让菜单下半部（退出登录等）超出屏幕点不到） */
.sp .user-dropdown {
    left: 100%;
    right: auto;
    top: auto;
    bottom: 0;
    margin: 0 0 0 12px;
    transform: translateY(8px);
}
.sp.user-menu:hover .user-dropdown {
    transform: translateY(0);
}


/* 主区域：topbar + content（两风格共用，与 mockup 一致） */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 28px;
    background: var(--glass);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar .ttl {
    font-weight: 800;
    font-size: 18px;
    color: var(--text-primary);
}
.topbar .search-box {
    flex: 0 0 360px;
    max-width: 40%;
}
.topbar .avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    cursor: pointer;
    position: relative;
}
.content {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    box-sizing: border-box;
}

/* 风格3：内容区限宽居中（风格1 保持铺满不受影响） */
[data-style="3"] .content {
    max-width: 1415px;
    margin-left: auto;
    margin-right: auto;
}

/* 风格3：内容区文件夹面板（复用 sidebar-menu 树，置于卡片上方） */
.folder-panel {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 18px;
}
.folder-panel .sidebar-title { padding-left: 0; margin-bottom: 8px; }

/* 响应式：窄屏下顶栏换行、导航收窄 */
@media (max-width: 768px) {
    .topbar { flex-wrap: wrap; gap: 12px; padding: 14px 16px; }
    .topbar .search-box { flex-basis: 100%; max-width: 100%; order: 3; }
    .content { padding: 16px; }
    .rail { width: 64px; flex-basis: 64px; }
    .sidebar { width: 200px; flex-basis: 200px; }
}
@media (max-width: 480px) {
    .app { flex-direction: column; }
    .sidebar, .rail {
        width: 100%; flex-basis: auto; height: auto;
        position: static; flex-direction: row; flex-wrap: wrap;
        border-right: none; border-bottom: 1px solid var(--border-color);
    }
    .rail { gap: 6px; padding: 10px; justify-content: center; }
    .rail-logo { margin-bottom: 0; }
    .sp { margin-top: 0; margin-left: auto; }
    .sidebar .brand { margin: 6px 8px; }
    .sidebar .space-usage { width: 100%; }
}

/* ============ 后台管理移动端响应式（集中一处，7 个 admin 页面共用同一份 style.css 即全生效） ============ */
/* 思路：手机上把固定 260px 侧栏改为顶部横向滚动导航 + 内容全宽 + 表格横向滚动，纯 CSS 无需 JS */
@media (max-width: 768px) {
    body .admin-layout {
        flex-direction: column;
    }
    body .admin-sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding: 12px 14px;
        border-bottom: 1px solid #374151;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    [data-theme="dark"] body .admin-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    body .admin-sidebar-logo {
        margin-bottom: 4px;
        padding-bottom: 8px;
    }
    body .admin-sidebar-menu {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px;
        -webkit-overflow-scrolling: touch;
    }
    body .admin-sidebar-menu-item {
        margin-bottom: 0;
        flex: 0 0 auto;
    }
    body .admin-sidebar-menu-link {
        padding: 8px 14px;
        white-space: nowrap;
        border-radius: 999px;
    }
    body .admin-content {
        margin-left: 0;
        padding: 16px;
    }
    body .admin-header {
        flex-wrap: wrap;
        gap: 12px;
        margin-bottom: 16px;
    }
    body .table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }
    body .table th,
    body .table td {
        white-space: nowrap;
    }
    body .pagination {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    body .admin-content { padding: 12px; }
    body .admin-title { font-size: 20px; }
    body .admin-sidebar-menu-link { padding: 7px 12px; font-size: 13px; }
}

/* =========================================================
   顶部统计卡片（文件总数 / 已用空间 / 今天上传 / 在线用户）：与 mockup 完全一致
   ========================================================= */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-lg);
}
.stat .ic {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    flex: 0 0 52px;
}
.stat .n {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}
.stat .t {
    font-size: 13px;
    color: var(--text-muted);
}

/* 暗黑上传区依照同样的样式（.upload-area 虚线边框） */
[data-theme="dark"] .upload-area {
    border: 2px dashed var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
/* ===== 全局滚动条美化（前台+后台+弹窗，不改变滚动行为） ===== */
/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

/* Chrome / Edge / 国产浏览器 */
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.45);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.7);
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

/* 暗色主题：thumb 提亮一档，深底上清晰可见 */
[data-theme="dark"] * {
    scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
}

[data-theme="dark"] *::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
}

[data-theme="dark"] *::-webkit-scrollbar-thumb:hover {
    background: rgba(203, 213, 225, 0.6);
}

/* 我的分享列表弹窗 */
.myshares-list {
    max-height: 420px;
    overflow-y: auto;
    text-align: left;
}

.ms-group-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: .5px;
    padding: 10px 4px 6px;
}

.ms-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px;
}

.ms-row:hover {
    background: var(--bg-secondary);
}

.ms-ic {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    color: var(--primary-color);
    font-size: 15px;
}

.ms-info {
    flex: 1;
    min-width: 0;
}

.ms-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ms-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.ms-ops {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

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