* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; color: #1f2937; background: #f5f7fa; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* ================ 登录/注册页 ================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
.auth-box {
    width: 100%;
    max-width: 400px;
    background: #fff;
    padding: 40px 32px;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.auth-logo { font-size: 22px; font-weight: 600; color: #4f46e5; text-align: center; margin-bottom: 8px; }
.auth-box h2 { text-align: center; margin: 0 0 24px; font-weight: 500; color: #334155; }
.auth-foot { margin-top: 18px; text-align: center; color: #64748b; font-size: 14px; }

.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13px; color: #334155; margin-bottom: 6px; }
.form-row input[type=text], .form-row input[type=password], .form-row input[type=email], .form-row input[type=number], .form-row select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}
.form-row input:focus, .form-row select:focus { border-color: #2563eb; }

.btn { display: inline-block; padding: 8px 16px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-size: 14px; text-decoration: none; line-height: 1.4; background: #fff; color: #334155; border-color: #cbd5e1; }
.btn:hover { background: #f1f5f9; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #ef4444; color: #fff; border-color: #ef4444; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { display: block; width: 100%; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #991b1b; border-left: 3px solid #ef4444; }
.alert-ok { background: #ecfdf5; color: #065f46; border-left: 3px solid #10b981; }
.alert-info { background: #eff6ff; color: #1e40af; border-left: 3px solid #3b82f6; }

/* ================ 主布局 ================ */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px;
    background: #1e293b;
    color: #cbd5e1;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.sidebar-logo { padding: 20px; font-size: 18px; font-weight: 600; color: #fff; border-bottom: 1px solid #334155; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #cbd5e1;
    font-size: 14px;
}
.sidebar-nav a:hover { background: #334155; color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: #2563eb; color: #fff; }
.sidebar-nav .icon { width: 18px; display: inline-block; text-align: center; }
.sidebar-foot { padding: 16px 20px; border-top: 1px solid #334155; font-size: 12px; color: #94a3b8; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
}
.topbar .search { flex: 1; max-width: 400px; position: relative; }
.topbar .search input { width: 100%; padding: 8px 12px 8px 34px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; outline: none; }
.topbar .search::before { content: "🔍"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .6; }
.topbar .spacer { flex: 1; }
.topbar .user-info { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #334155; }
.topbar .user-info .avatar { width: 32px; height: 32px; border-radius: 50%; background: #2563eb; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 500; }

.content { flex: 1; padding: 20px; overflow: auto; }

/* ================ 面包屑 + 操作栏 ================ */
.toolbar {
    background: #fff;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; font-size: 14px; flex: 1; min-width: 200px; }
.breadcrumb a, .breadcrumb span { color: #475569; }
.breadcrumb .sep { margin: 0 6px; color: #cbd5e1; }
.breadcrumb a:hover { color: #2563eb; text-decoration: none; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ================ 文件列表 ================ */
.file-table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    border-collapse: collapse;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.file-table th, .file-table td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; text-align: left; font-size: 14px; }
.file-table th { background: #f8fafc; color: #64748b; font-weight: 500; font-size: 13px; }
.file-table th.sortable { cursor: pointer; user-select: none; }
.file-table th.sortable:hover { color: #2563eb; }
.file-table th.sortable .sort-arrow { display: inline-block; width: 12px; margin-left: 4px; opacity: .6; font-size: 11px; }
.file-table th.sortable.active { color: #2563eb; }
.file-table th.sortable.active .sort-arrow { opacity: 1; }
.file-table tbody tr:hover { background: #f8fafc; }
.file-table .col-chk { width: 36px; }
.file-table .col-size { width: 100px; }
.file-table .col-dl { width: 90px; text-align: center; }
.file-table .col-date { width: 160px; }
.file-table .col-actions { width: 200px; text-align: right; }
.file-table .dl-badge { display: inline-block; min-width: 24px; padding: 2px 8px; border-radius: 10px; background: #eff6ff; color: #1d4ed8; font-size: 12px; font-weight: 500; }
.file-table .dl-badge.zero { background: #f1f5f9; color: #94a3b8; }
.file-table .name-cell { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.file-table .name-cell .icon { font-size: 20px; flex-shrink: 0; width: 28px; text-align: center; }
.file-table .name-cell .thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: #f1f5f9; }
.file-table .name-cell.previewable:hover span:last-child { color: #2563eb; text-decoration: underline; }
.file-table .src-path { display: inline-block; margin-top: 4px; margin-left: 46px; font-size: 12px; color: #64748b; cursor: pointer; padding: 2px 6px; border-radius: 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-table .src-path:hover { background: #eff6ff; color: #2563eb; }
.file-table .folder-row .name-cell { color: #1e40af; font-weight: 500; }
.file-table .actions { text-align: right; white-space: nowrap; }
.file-table .actions .btn { margin-left: 4px; }
.empty-tip { text-align: center; padding: 60px 20px; color: #94a3b8; }

/* ================ 配额进度条 ================ */
.quota-bar { background: #fff; padding: 14px 18px; border-radius: 8px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.quota-text { font-size: 13px; color: #475569; margin-bottom: 8px; display: flex; justify-content: space-between; }
.quota-progress { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.quota-progress > div { height: 100%; background: linear-gradient(90deg, #10b981, #3b82f6); transition: width .3s; }

/* ================ 拖拽遮罩 ================ */
.drop-mask {
    position: fixed;
    inset: 0;
    background: rgba(37, 99, 235, .15);
    border: 3px dashed #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    color: #2563eb;
    font-size: 22px;
    font-weight: 500;
    pointer-events: none;
}

/* ================ 上传进度 ================ */
.upload-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 360px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,.15);
    overflow: hidden;
    z-index: 500;
}
.upload-panel header { padding: 10px 14px; background: #1e293b; color: #fff; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.upload-panel header button { background: transparent; color: #fff; border: 0; cursor: pointer; font-size: 16px; }
.upload-panel .upload-list { max-height: 260px; overflow: auto; }
.upload-item { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.upload-item .upname { display: flex; justify-content: space-between; margin-bottom: 4px; }
.upload-item .upname .status { font-size: 12px; color: #64748b; }
.upload-item .status.ok { color: #059669; }
.upload-item .status.err { color: #dc2626; }
.upload-item .upbar { height: 4px; background: #e2e8f0; border-radius: 2px; overflow: hidden; }
.upload-item .upbar > div { height: 100%; background: #2563eb; transition: width .2s; }

/* ================ 拖拽上传 overlay ================ */
.dropzone-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(37, 99, 235, 0.18);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity .15s ease;
}
.dropzone-overlay.active { opacity: 1; pointer-events: auto; }
.dropzone-card {
    background: #fff; border: 3px dashed #2563eb; border-radius: 16px;
    padding: 50px 60px; text-align: center;
    box-shadow: 0 20px 60px rgba(37, 99, 235, 0.2);
    transform: scale(0.95);
    transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.dropzone-overlay.active .dropzone-card { transform: scale(1); }
.dropzone-icon { font-size: 64px; line-height: 1; margin-bottom: 14px; }
.dropzone-title { font-size: 22px; font-weight: 600; color: #2563eb; margin-bottom: 8px; }
.dropzone-hint { font-size: 14px; color: #64748b; }

/* ================ PWA 安装按钮 ================ */
.pwa-install-btn {
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    color: #fff;
    border: 0;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    margin-right: 10px;
    box-shadow: 0 2px 6px rgba(37, 99, 235, .25);
    transition: transform .15s, box-shadow .15s;
}
.pwa-install-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(37, 99, 235, .35); }
.pwa-install-btn:active { transform: translateY(0); }
.pwa-install-btn:disabled { opacity: .6; cursor: wait; }

/* ================ 弹窗 ================ */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 600; }
.modal { background: #fff; border-radius: 8px; width: 100%; max-width: 440px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal header { padding: 14px 18px; border-bottom: 1px solid #e2e8f0; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.modal header .close { background: transparent; border: 0; font-size: 20px; cursor: pointer; color: #64748b; }
.modal .body { padding: 18px; }
.modal .foot { padding: 12px 18px; background: #f8fafc; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid #e2e8f0; }

/* ================ 后台 ================ */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; padding: 18px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.stat-card .lbl { font-size: 13px; color: #64748b; }
.stat-card .val { font-size: 26px; font-weight: 600; color: #1e293b; margin-top: 4px; }

/* ================ 分享页 ================ */
.share-page { max-width: 900px; margin: 40px auto; background: #fff; border-radius: 12px; padding: 30px; box-shadow: 0 4px 12px rgba(0,0,0,.05); }
.share-header { margin-bottom: 20px; }
.share-header h2 { margin: 0 0 8px; color: #1e293b; }
.share-header .meta { font-size: 13px; color: #64748b; }
.share-table { width: 100%; border-collapse: collapse; }
.share-table th, .share-table td { padding: 10px; border-bottom: 1px solid #f1f5f9; text-align: left; font-size: 14px; vertical-align: middle; }
.share-page { max-width: 1100px; }

/* 分享页工具栏 */
.sh-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 14px 0 16px; padding: 10px 12px; background: #f8fafc; border-radius: 8px; }
.sh-search { flex: 1; min-width: 180px; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 14px; background: #fff; outline: none; }
.sh-search:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(147,197,253,.2); }
.sh-cats { display: flex; gap: 6px; flex-wrap: wrap; }
.sh-chip { padding: 5px 12px; border: 1px solid #e2e8f0; background: #fff; color: #475569; border-radius: 16px; font-size: 13px; cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 6px; }
.sh-chip:hover { border-color: #93c5fd; color: #2563eb; }
.sh-chip.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.sh-chip .ct { font-size: 11px; opacity: .75; padding: 0 5px; background: rgba(0,0,0,.08); border-radius: 8px; min-width: 18px; text-align: center; }
.sh-chip.active .ct { background: rgba(255,255,255,.2); }
.sh-views { display: flex; gap: 0; border: 1px solid #e2e8f0; border-radius: 6px; overflow: hidden; background: #fff; }
.sh-view-btn { width: 36px; height: 32px; background: #fff; border: 0; cursor: pointer; font-size: 16px; color: #64748b; transition: all .15s; }
.sh-view-btn + .sh-view-btn { border-left: 1px solid #e2e8f0; }
.sh-view-btn:hover { background: #f1f5f9; }
.sh-view-btn.active { background: #2563eb; color: #fff; }

/* 列表视图：缩略图与图标 */
.sh-thumb-mini { display: inline-block; width: 40px; height: 40px; border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 10px; background: #f1f5f9; cursor: zoom-in; flex-shrink: 0; }
.sh-thumb-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sh-icon { display: inline-block; width: 40px; text-align: center; font-size: 22px; vertical-align: middle; margin-right: 10px; }
.sh-name { vertical-align: middle; word-break: break-all; }

/* 网格视图 */
.sh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.sh-card { display: flex; flex-direction: column; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); transition: transform .15s, box-shadow .15s; text-decoration: none; color: inherit; }
.sh-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.sh-card-thumb { aspect-ratio: 1; background: #f1f5f9; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.sh-card-thumb.clickable { cursor: zoom-in; }
.sh-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sh-card-icon { font-size: 56px; opacity: .55; }
.sh-card.folder .sh-card-thumb { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.sh-card-name { padding: 8px 10px 2px; font-size: 13px; line-height: 1.4; color: #1e293b; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sh-card-meta { padding: 0 10px; font-size: 11px; color: #94a3b8; }
.sh-card-actions { padding: 8px 10px; display: flex; gap: 6px; }
.sh-card-actions .btn { flex: 1; }

/* 轻量 Lightbox */
.sh-lightbox { position: fixed; inset: 0; background: rgba(15,23,42,.92); z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.sh-lb-stage { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; padding: 60px 70px 50px; min-height: 0; }
.sh-lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 8px 32px rgba(0,0,0,.4); border-radius: 4px; }
.sh-lb-close, .sh-lb-prev, .sh-lb-next { position: absolute; background: rgba(255,255,255,.1); color: #fff; border: 0; cursor: pointer; transition: background .15s; backdrop-filter: blur(8px); }
.sh-lb-close:hover, .sh-lb-prev:hover, .sh-lb-next:hover { background: rgba(255,255,255,.2); }
.sh-lb-close { top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; font-size: 22px; line-height: 1; }
.sh-lb-prev, .sh-lb-next { top: 50%; transform: translateY(-50%); width: 50px; height: 50px; border-radius: 50%; font-size: 28px; line-height: 1; }
.sh-lb-prev { left: 16px; }
.sh-lb-next { right: 16px; }
.sh-lb-bar { position: absolute; bottom: 0; left: 0; right: 0; padding: 14px 20px; background: linear-gradient(to top, rgba(0,0,0,.6), transparent); color: #fff; display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.sh-lb-bar #shLbName { word-break: break-all; padding-right: 16px; }
.sh-lb-count { white-space: nowrap; opacity: .8; }

/* 暗色主题 */
html[data-theme="dark"] .sh-toolbar { background: #0f172a; }
html[data-theme="dark"] .sh-search { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .sh-chip { background: #1e293b; border-color: #334155; color: #cbd5e1; }
html[data-theme="dark"] .sh-views { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .sh-view-btn { background: #1e293b; color: #cbd5e1; }
html[data-theme="dark"] .sh-view-btn:hover { background: #0f172a; }
html[data-theme="dark"] .sh-card { background: #1e293b; }
html[data-theme="dark"] .sh-card-name { color: #e2e8f0; }
html[data-theme="dark"] .sh-card-thumb { background: #0f172a; }
html[data-theme="dark"] .sh-thumb-mini { background: #0f172a; }

/* 移动端适配 */
@media (max-width: 640px) {
    .sh-toolbar { gap: 8px; padding: 8px; }
    .sh-search { width: 100%; flex: none; }
    .sh-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
    .sh-card-icon { font-size: 42px; }
    .sh-lb-stage { padding: 50px 16px 50px; }
    .sh-lb-prev, .sh-lb-next { width: 40px; height: 40px; font-size: 22px; }
}

/* ================ Tabs ================ */
.tabs { display: flex; border-bottom: 2px solid #e2e8f0; margin-bottom: 20px; }
.tabs a { padding: 10px 18px; color: #64748b; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs a:hover { color: #2563eb; text-decoration: none; }
.tabs a.active { color: #2563eb; border-color: #2563eb; font-weight: 500; }

.tag { display: inline-block; padding: 2px 8px; font-size: 12px; border-radius: 10px; background: #e0e7ff; color: #3730a3; }
.tag.admin { background: #fef3c7; color: #92400e; }
.tag.ok { background: #d1fae5; color: #065f46; }
.tag.no { background: #fee2e2; color: #991b1b; }

/* ================ 图片相册：顶部工具栏 ================ */
.photo-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 10px 14px; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.04); margin-bottom: 12px; }
.photo-toolbar .pt-left,
.photo-toolbar .pt-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.photo-toolbar .pt-chip { padding: 4px 12px; border: 1px solid #e2e8f0; background: #fff; border-radius: 16px; font-size: 13px; color: #475569; cursor: pointer; transition: all .15s; }
.photo-toolbar .pt-chip:hover { border-color: #93c5fd; color: #2563eb; }
.photo-toolbar .pt-chip.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.photo-toolbar .pt-info { font-size: 13px; color: #1e40af; padding: 0 6px; }
.photo-toolbar .pt-divider { width: 1px; height: 22px; background: #e2e8f0; margin: 0 4px; }
.photo-toolbar .pt-size-group { display: inline-flex; border: 1px solid #e2e8f0; border-radius: 6px; overflow: hidden; }
.photo-toolbar .pt-size-group button { padding: 4px 10px; background: #fff; border: 0; cursor: pointer; color: #64748b; font-size: 14px; line-height: 1; }
.photo-toolbar .pt-size-group button:hover { background: #f1f5f9; color: #2563eb; }
.photo-toolbar .pt-size-group button.active { background: #2563eb; color: #fff; }
.photo-toolbar .pt-size-group button + button { border-left: 1px solid #e2e8f0; }

/* ================ 图片相册网格 ================ */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding: 4px; }
.photo-grid.size-sm { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photo-grid.size-md { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.photo-grid.size-lg { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.photo-grid.grouped { display: block; }
.photo-grid.grouped .ph-group-title { font-size: 15px; font-weight: 500; color: #1e293b; margin: 18px 4px 12px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.photo-grid.grouped .ph-group-title:first-child { margin-top: 4px; }
.photo-grid.grouped .ph-group-count { font-size: 12px; color: #94a3b8; font-weight: normal; padding: 1px 8px; background: #f1f5f9; border-radius: 10px; margin-left: 6px; }
.photo-grid.grouped .ph-group-select { font-size: 12px; color: #64748b; background: transparent; border: 1px solid #e2e8f0; border-radius: 4px; padding: 2px 10px; cursor: pointer; }
.photo-grid.grouped .ph-group-select:hover { color: #2563eb; border-color: #93c5fd; }
.photo-grid.grouped .ph-group-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.photo-grid.grouped.size-sm .ph-group-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photo-grid.grouped.size-md .ph-group-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.photo-grid.grouped.size-lg .ph-group-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

/* 卡片本体 */
.photo-card { position: relative; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); cursor: pointer; transition: transform .15s, box-shadow .15s, outline-color .15s; display: flex; flex-direction: column; outline: 2px solid transparent; outline-offset: -2px; }
.photo-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.1); }
.photo-card.selected { outline-color: #2563eb; }
.photo-card .ph-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #f1f5f9; }
.photo-card .ph-info { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.photo-card .ph-name { font-size: 13px; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-card .ph-src { font-size: 11px; color: #94a3b8; cursor: pointer; padding: 2px 4px; border-radius: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-card .ph-src:hover { background: #eff6ff; color: #2563eb; }
.photo-card .ph-meta { font-size: 11px; color: #94a3b8; display: flex; justify-content: space-between; }
.photo-card .ph-actions { display: flex; gap: 4px; padding: 0 10px 10px; }
.photo-card .ph-actions .btn { flex: 1; padding: 4px 0; font-size: 11px; }

/* 复选框：默认 hover 显示，select-mode 始终显示 */
.photo-card .ph-check {
    position: absolute; top: 8px; left: 8px; z-index: 2;
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(255,255,255,.85);
    border: 2px solid #cbd5e1;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 14px; font-weight: bold;
    cursor: pointer; transition: all .15s;
    opacity: 0; transform: scale(.8);
}
.photo-card:hover .ph-check,
.photo-grid.select-mode .photo-card .ph-check { opacity: 1; transform: scale(1); }
.photo-card .ph-check:hover { border-color: #2563eb; }
.photo-card.selected .ph-check { background: #2563eb; border-color: #2563eb; opacity: 1; transform: scale(1); }

/* 小尺寸下隐藏次要信息 */
.photo-grid.size-sm .photo-card .ph-info,
.photo-grid.size-sm .photo-card .ph-actions { display: none; }
.photo-grid.size-sm .photo-card .ph-img { aspect-ratio: 1; }

/* ================ 回收站 ================ */
.trash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 14px; }
.trash-stats .stat-card { background: #fff; padding: 16px 20px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.04); display: flex; align-items: center; gap: 14px; }
.trash-stats .sc-icon { width: 44px; height: 44px; border-radius: 10px; background: linear-gradient(135deg, #fef3c7, #fde68a); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.trash-stats .stat-card:nth-child(2) .sc-icon { background: linear-gradient(135deg, #dbeafe, #93c5fd); }
.trash-stats .stat-card:nth-child(3) .sc-icon { background: linear-gradient(135deg, #fee2e2, #fca5a5); }
.trash-stats .sc-num   { font-size: 22px; font-weight: 600; color: #1e293b; }
.trash-stats .sc-label { font-size: 12px; color: #64748b; margin-top: 2px; }

/* 选择栏 */
.trash-selbar { background: #eff6ff; border: 1px solid #bfdbfe; padding: 10px 16px; border-radius: 8px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: 14px; color: #1e40af; }
.trash-selbar .ts-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 表格 */
.trash-table tr.sel { background: #eff6ff !important; }
.trash-table .thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: #f1f5f9; }

/* 剩余天数胶囊 */
.days-pill { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.days-pill.days-ok   { background: #d1fae5; color: #065f46; }
.days-pill.days-soon { background: #fef3c7; color: #92400e; }
.days-pill.days-warn { background: #fee2e2; color: #991b1b; animation: pulseRed 1.6s infinite; }
@keyframes pulseRed { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

/* 通用下拉菜单（用于回收站还原选项） */
.dd { position: relative; display: inline-block; }
.dd .dd-menu {
    position: absolute; right: 0; top: calc(100% + 4px);
    min-width: 200px; background: #fff;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .12);
    border: 1px solid #e2e8f0; border-radius: 6px;
    padding: 4px 0; z-index: 100;
    display: none; text-align: left;
}
.dd.open .dd-menu { display: block; }
.dd .dd-menu a {
    display: block; padding: 8px 14px; font-size: 13px; color: #334155;
    cursor: pointer; user-select: none; text-decoration: none;
}
.dd .dd-menu a:hover { background: #f1f5f9; color: #2563eb; }
.dd .dd-menu a.muted { color: #94a3b8; cursor: not-allowed; }
.dd .dd-menu a.muted:hover { background: transparent; color: #94a3b8; }

/* ================ 侧栏分类子菜单 ================ */
.sidebar-nav .sidebar-sub { padding: 4px 0 6px; background: rgba(0,0,0,.15); }
.sidebar-nav .sidebar-sub a.sub { padding: 7px 20px 7px 40px; font-size: 13px; color: #94a3b8; }
.sidebar-nav .sidebar-sub a.sub:hover { background: #334155; color: #fff; }
.sidebar-nav .sidebar-sub a.sub.active { background: #2563eb; color: #fff; }

/* ================ Lightbox 预览 ================ */
.lightbox { position: fixed; inset: 0; background: rgba(15,23,42,.9); z-index: 1000; display: flex; flex-direction: column; animation: lbIn .2s; }
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox .lb-top { display: flex; align-items: center; padding: 14px 24px; color: #fff; gap: 16px; background: rgba(0,0,0,.4); }
.lightbox .lb-title { flex: 1; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox .lb-meta { color: #cbd5e1; font-size: 13px; }
.lightbox .lb-actions { display: flex; gap: 8px; }
.lightbox .lb-actions .lb-btn { color: #fff; background: rgba(255,255,255,.12); border: 0; padding: 7px 14px; border-radius: 6px; font-size: 14px; cursor: pointer; text-decoration: none; display: inline-block; }
.lightbox .lb-actions .lb-btn:hover { background: rgba(255,255,255,.24); }
.lightbox .lb-actions .lb-close { font-size: 22px; line-height: 1; padding: 4px 12px; }
.lightbox .lb-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px; overflow: auto; position: relative; }
.lightbox .lb-body img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 10px 40px rgba(0,0,0,.5); border-radius: 4px; }
.lightbox .lb-body video, .lightbox .lb-body audio { max-width: 100%; max-height: 100%; outline: none; }
.lightbox .lb-body iframe { width: min(1100px, 95%); height: 100%; border: 0; background: #fff; border-radius: 4px; }
.lightbox .lb-body pre { max-width: 1000px; max-height: 90%; overflow: auto; background: #0f172a; color: #e2e8f0; padding: 20px; border-radius: 6px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.lightbox .lb-body .lb-msg { color: #94a3b8; font-size: 16px; }
.lightbox .lb-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.1); border: 0; color: #fff; font-size: 26px; cursor: pointer; display: flex; align-items: center; justify-content: center; user-select: none; }
.lightbox .lb-arrow:hover { background: rgba(255,255,255,.25); }
.lightbox .lb-arrow.prev { left: 16px; }
.lightbox .lb-arrow.next { right: 16px; }
.lightbox .lb-counter { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); color: #cbd5e1; font-size: 13px; background: rgba(0,0,0,.4); padding: 4px 12px; border-radius: 10px; }

/* Lightbox 工具按钮（缩放/旋转/幻灯片/信息/分享/删除） */
.lightbox .lb-actions .lb-btn { min-width: 36px; text-align: center; padding: 7px 10px; }
.lightbox .lb-actions .lb-btn.btn-danger { background: rgba(220,38,38,.6); }
.lightbox .lb-actions .lb-btn.btn-danger:hover { background: rgba(220,38,38,.9); }

/* 图片模式：图片可缩放 + 拖拽 */
.lightbox.is-image .lb-body { user-select: none; cursor: zoom-in; }
.lightbox.is-image .lb-body.grabbing { cursor: grabbing; }
.lightbox.is-image .lb-body img { transition: transform .15s; max-width: none; max-height: none; user-select: none; -webkit-user-drag: none; }

/* 缩放徽标（右下角） */
.lightbox .lb-zoom-badge { position: absolute; right: 16px; bottom: 16px; background: rgba(0,0,0,.5); color: #fff; padding: 4px 10px; border-radius: 10px; font-size: 12px; font-family: monospace; }

/* 幻灯片模式时高亮播放按钮 */
.lightbox.slideshow-on .lb-actions [data-act="slideshow"] { background: #2563eb !important; color: #fff; }

/* 信息面板（侧边抽屉） */
.lightbox .lb-info {
    position: absolute; top: 0; right: 0; bottom: 0;
    width: 320px; background: #1e293b; color: #e2e8f0;
    transform: translateX(100%); transition: transform .25s ease;
    overflow-y: auto; padding: 60px 20px 20px; box-shadow: -4px 0 20px rgba(0,0,0,.4);
    z-index: 5;
}
.lightbox.info-on .lb-info { transform: translateX(0); }
.lightbox.info-on .lb-actions [data-act="info"] { background: #2563eb !important; color: #fff; }
.lightbox .lb-info h3 { color: #f1f5f9; font-size: 14px; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid #334155; }
.lightbox .lb-info-row { display: flex; padding: 6px 0; font-size: 13px; gap: 10px; align-items: flex-start; }
.lightbox .lb-info-k { color: #94a3b8; flex: 0 0 70px; }
.lightbox .lb-info-v { color: #f1f5f9; flex: 1; word-break: break-word; }

/* ============================================================ */
/* ================ 主题切换按钮 ================ */
/* ============================================================ */
.theme-toggle {
    width: 32px; height: 32px; border-radius: 50%;
    background: transparent; border: 1px solid transparent;
    cursor: pointer; font-size: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all .2s;
}
.theme-toggle:hover { background: rgba(0,0,0,.05); }

/* 移动端汉堡菜单按钮（默认隐藏） */
.menu-toggle { display: none; width: 32px; height: 32px; border: 0; background: transparent; cursor: pointer; padding: 0; align-items: center; justify-content: center; }
.menu-toggle span { display: block; width: 20px; height: 2px; background: #334155; position: relative; }
.menu-toggle span::before, .menu-toggle span::after { content: ""; position: absolute; left: 0; width: 20px; height: 2px; background: #334155; transition: transform .2s; }
.menu-toggle span::before { top: -6px; }
.menu-toggle span::after  { top:  6px; }

/* ============================================================ */
/* ================ 🌙 暗色模式 ================ */
/* ============================================================ */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] body { background: #0f172a; color: #e2e8f0; }
html[data-theme="dark"] a { color: #60a5fa; }

/* 主布局 */
html[data-theme="dark"] .sidebar { background: #020617; border-right: 1px solid #1e293b; }
html[data-theme="dark"] .sidebar-logo { color: #f1f5f9; border-bottom-color: #1e293b; }
html[data-theme="dark"] .sidebar-nav a { color: #94a3b8; }
html[data-theme="dark"] .sidebar-nav a:hover { background: #1e293b; color: #f1f5f9; }
html[data-theme="dark"] .sidebar-nav a.active { background: #2563eb; color: #fff; }
html[data-theme="dark"] .sidebar-foot { color: #64748b; border-top-color: #1e293b; }
html[data-theme="dark"] .topbar { background: #1e293b; border-bottom-color: #334155; }
html[data-theme="dark"] .topbar .user-info { color: #e2e8f0; }
html[data-theme="dark"] .topbar .search input { background: #0f172a; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .menu-toggle span,
html[data-theme="dark"] .menu-toggle span::before,
html[data-theme="dark"] .menu-toggle span::after { background: #cbd5e1; }
html[data-theme="dark"] .theme-toggle:hover { background: rgba(255,255,255,.08); }

/* 通用控件 */
html[data-theme="dark"] .toolbar,
html[data-theme="dark"] .file-table,
html[data-theme="dark"] .quota-bar,
html[data-theme="dark"] .photo-toolbar,
html[data-theme="dark"] .photo-card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .upload-panel { background: #1e293b; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
html[data-theme="dark"] .file-table th { background: #0f172a; color: #94a3b8; }
html[data-theme="dark"] .file-table th, html[data-theme="dark"] .file-table td { border-bottom-color: #334155; }
html[data-theme="dark"] .file-table tbody tr:hover { background: #0f172a; }
html[data-theme="dark"] .breadcrumb a, html[data-theme="dark"] .breadcrumb span { color: #cbd5e1; }
html[data-theme="dark"] .breadcrumb .sep { color: #475569; }
html[data-theme="dark"] .form-row label { color: #cbd5e1; }
html[data-theme="dark"] .form-row input,
html[data-theme="dark"] .form-row select,
html[data-theme="dark"] input[type=text],
html[data-theme="dark"] input[type=password],
html[data-theme="dark"] input[type=email],
html[data-theme="dark"] input[type=number],
html[data-theme="dark"] select { background: #0f172a; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .btn { background: #334155; color: #cbd5e1; border-color: #475569; }
html[data-theme="dark"] .btn:hover { background: #475569; }
html[data-theme="dark"] .btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
html[data-theme="dark"] .btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }

/* 文件列表细节 */
html[data-theme="dark"] .file-table .name-cell .thumb { background: #0f172a; }
html[data-theme="dark"] .file-table .folder-row .name-cell { color: #93c5fd; }
html[data-theme="dark"] .file-table .src-path { color: #94a3b8; }
html[data-theme="dark"] .file-table .src-path:hover { background: #1e293b; color: #93c5fd; }
html[data-theme="dark"] .file-table .dl-badge { background: rgba(59,130,246,.2); color: #93c5fd; }
html[data-theme="dark"] .file-table .dl-badge.zero { background: #334155; color: #64748b; }

/* 文件分类 chips、photo */
html[data-theme="dark"] .photo-toolbar .pt-chip { background: #0f172a; color: #cbd5e1; border-color: #334155; }
html[data-theme="dark"] .photo-toolbar .pt-chip.active { background: #2563eb; border-color: #2563eb; }
html[data-theme="dark"] .photo-toolbar .pt-size-group { border-color: #334155; }
html[data-theme="dark"] .photo-toolbar .pt-size-group button { background: #0f172a; color: #cbd5e1; }
html[data-theme="dark"] .photo-toolbar .pt-size-group button.active { background: #2563eb; color: #fff; }
html[data-theme="dark"] .photo-card { background: #1e293b; }
html[data-theme="dark"] .photo-card .ph-img { background: #0f172a; }
html[data-theme="dark"] .photo-card .ph-name { color: #e2e8f0; }
html[data-theme="dark"] .photo-grid.grouped .ph-group-title { color: #f1f5f9; }
html[data-theme="dark"] .photo-grid.grouped .ph-group-count { background: #334155; color: #cbd5e1; }

/* 标签 */
html[data-theme="dark"] .tag { background: #334155; color: #cbd5e1; }
html[data-theme="dark"] .tag.ok { background: rgba(16,185,129,.2); color: #6ee7b7; }
html[data-theme="dark"] .tag.no { background: rgba(239,68,68,.2); color: #fca5a5; }
html[data-theme="dark"] .tag.admin { background: rgba(245,158,11,.2); color: #fcd34d; }

/* 配额 */
html[data-theme="dark"] .quota-text { color: #cbd5e1; }
html[data-theme="dark"] .quota-progress { background: #334155; }

/* tabs */
html[data-theme="dark"] .tabs { border-bottom-color: #334155; }
html[data-theme="dark"] .tabs a { color: #94a3b8; }
html[data-theme="dark"] .tabs a:hover, html[data-theme="dark"] .tabs a.active { color: #60a5fa; }
html[data-theme="dark"] .tabs a.active { border-color: #2563eb; }

/* 后台 stat-card */
html[data-theme="dark"] .stat-card .lbl { color: #94a3b8; }
html[data-theme="dark"] .stat-card .val { color: #f1f5f9; }
html[data-theme="dark"] .empty-tip { color: #475569; }

/* 模态框/上传面板 */
html[data-theme="dark"] .modal header,
html[data-theme="dark"] .modal .foot,
html[data-theme="dark"] .upload-panel header { background: #0f172a; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .modal .body { color: #e2e8f0; }

/* 回收站 */
html[data-theme="dark"] .trash-stats .stat-card .sc-num { color: #f1f5f9; }
html[data-theme="dark"] .trash-stats .stat-card .sc-label { color: #94a3b8; }
html[data-theme="dark"] .trash-selbar { background: rgba(37,99,235,.15); border-color: rgba(59,130,246,.3); color: #93c5fd; }
html[data-theme="dark"] .trash-table tr.sel { background: rgba(37,99,235,.1) !important; }
html[data-theme="dark"] .dd .dd-menu { background: #0f172a; border-color: #334155; }
html[data-theme="dark"] .dd .dd-menu a { color: #cbd5e1; }
html[data-theme="dark"] .dd .dd-menu a:hover { background: #1e293b; color: #60a5fa; }

/* 分享页 */
html[data-theme="dark"] .share-page { background: #1e293b; color: #e2e8f0; }

/* alert 暗色 */
html[data-theme="dark"] .alert-error { background: rgba(239,68,68,.15); color: #fca5a5; }
html[data-theme="dark"] .alert-ok    { background: rgba(16,185,129,.15); color: #6ee7b7; }
html[data-theme="dark"] .alert-info  { background: rgba(59,130,246,.15); color: #93c5fd; }

/* ============================================================ */
/* ================ 📱 响应式（移动端） ================ */
/* ============================================================ */
@media (max-width: 768px) {
    /* 侧栏抽屉化 */
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; z-index: 200;
        transform: translateX(-100%); transition: transform .25s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,.15);
    }
    .layout.sidebar-open .sidebar { transform: translateX(0); }
    .layout.sidebar-open::after {
        content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 150;
    }
    .menu-toggle { display: inline-flex !important; }

    /* topbar 重排 */
    .topbar { padding: 0 12px; gap: 8px; }
    .topbar .search { max-width: none; flex: 1; }
    .topbar .user-info span:not(.avatar):not(.tag) { display: none; }
    .content { padding: 12px; }

    /* 工具栏堆叠 */
    .toolbar { padding: 10px 12px; gap: 8px; }
    .toolbar-actions { width: 100%; justify-content: flex-start; }
    .toolbar-actions .btn { padding: 6px 10px; font-size: 13px; }

    /* 表格 → 卡片视图 */
    .file-table thead { display: none; }
    .file-table tbody, .file-table tr { display: block; }
    .file-table tr {
        background: #fff; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
        box-shadow: 0 1px 3px rgba(0,0,0,.04); border-bottom: 0;
        display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center;
    }
    html[data-theme="dark"] .file-table tr { background: #1e293b; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
    .file-table td { padding: 4px 0; border: 0; font-size: 13px; }
    .file-table .col-chk { grid-column: 1; grid-row: 1 / span 4; }
    .file-table td:nth-child(2) { grid-column: 2; grid-row: 1; font-weight: 500; font-size: 14px; }
    .file-table .col-size, .file-table .col-dl, .file-table .col-date { grid-column: 2; color: #94a3b8; font-size: 11px; }
    .file-table .col-size { grid-row: 2; }
    .file-table .col-dl   { grid-row: 2; text-align: left; }
    .file-table .col-date { grid-row: 3; }
    .file-table .col-actions { grid-column: 1 / -1; grid-row: 4; text-align: left; padding-top: 6px; border-top: 1px solid #f1f5f9; }
    html[data-theme="dark"] .file-table .col-actions { border-top-color: #334155; }
    .file-table .actions .btn { padding: 4px 8px; font-size: 12px; margin: 2px; }

    /* 回收站表格同样卡片化 */
    .trash-table .name-cell { font-weight: 500; }

    /* 图片网格自适应 */
    .photo-grid.size-md, .photo-grid.size-lg { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
    .photo-grid.size-sm { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; }

    /* Lightbox */
    .lightbox .lb-top { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
    .lightbox .lb-title { font-size: 13px; flex-basis: 100%; order: 1; }
    .lightbox .lb-meta  { font-size: 11px; }
    .lightbox .lb-actions { gap: 4px; }
    .lightbox .lb-actions .lb-btn { padding: 6px 8px; min-width: 32px; }
    .lightbox .lb-info { width: 280px; padding: 50px 16px 16px; }
    .lightbox .lb-arrow { width: 36px; height: 36px; font-size: 22px; }

    /* 后台 tabs 横滚 */
    .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .tabs a { white-space: nowrap; flex-shrink: 0; }

    /* 统计卡纵向堆叠 */
    .trash-stats { grid-template-columns: 1fr 1fr; }
    .stat-cards { grid-template-columns: 1fr 1fr; }

    /* 工具按钮收缩 */
    .toolbar-actions select.btn { flex: 1; min-width: 120px; }

    /* 上传面板 */
    .upload-panel { right: 8px !important; left: 8px; bottom: 8px; width: auto !important; max-width: none; }
}

/* 平板段（768~1024） */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar { width: 180px; }
    .stat-cards { grid-template-columns: repeat(3, 1fr); }
    .file-table .col-actions { width: 160px; }
    .file-table .actions .btn { padding: 3px 6px; font-size: 11px; }
}
