/* ==========================================================================
   文件传输系统 v2 - 样式（桌面端 / 移动端自适应）
   ========================================================================== */

:root {
    --bg: #f4f6f9;
    --panel: #ffffff;
    --panel-2: #fafbfc;
    --panel-3: #f0f2f6;
    --text: #1f2937;
    --text-2: #4b5563;
    --muted: #7b8794;
    --border: #e4e8ee;
    --border-2: #d5dbe4;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: rgba(37, 99, 235, .08);
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --ok: #16a34a;
    --warn: #d97706;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
    --shadow-lg: 0 8px 16px rgba(16, 24, 40, .08), 0 24px 60px rgba(16, 24, 40, .14);
    --radius: 10px;
    --radius-lg: 16px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --bottom-bar-h: 58px;
    --dur: .16s;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #16181d;
        --panel: #1e2127;
        --panel-2: #23262d;
        --panel-3: #2a2e36;
        --text: #e6e8eb;
        --text-2: #c7ccd3;
        --muted: #9aa3ae;
        --border: #31353d;
        --border-2: #3d424b;
        --primary: #3b82f6;
        --primary-dark: #2563eb;
        --primary-soft: rgba(59, 130, 246, .14);
        --danger: #f87171;
        --danger-bg: #2a1c1e;
        --ok: #4ade80;
        --warn: #fbbf24;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
        --shadow-lg: 0 8px 16px rgba(0, 0, 0, .35), 0 24px 60px rgba(0, 0, 0, .4);
    }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
}

[hidden] { display: none !important; }
.muted { color: var(--muted); }
.mobile-only { display: none !important; }
.desktop-only { display: inline-flex !important; }

/* --------------------------------------------------------------- 基础控件 */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    line-height: 1.4;
    cursor: pointer;
    white-space: nowrap;
    touch-action: manipulation;
    transition: background var(--dur), border-color var(--dur), color var(--dur), opacity var(--dur);
}
.btn:hover { background: var(--panel-2); border-color: var(--border-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--panel); }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 500; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 12px; font-size: 15px; }
.btn-block { width: 100%; }
.btn.icon-only { padding: 7px 9px; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: none;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    touch-action: manipulation;
    transition: background var(--dur), color var(--dur);
}
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn:active { transform: translateY(1px); }

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex: none;
}

.badge {
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    line-height: 17px;
    text-align: center;
}

/* --------------------------------------------------------------- 登录页 */

.gate {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    padding-bottom: calc(24px + var(--safe-bottom));
}

.gate-card {
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 32px 26px 26px;
    text-align: center;
}

.gate-logo {
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 16px;
}

.gate-card h1 { font-size: 20px; margin: 0 0 6px; }
.gate-card .muted { font-size: 13px; margin: 0 0 20px; }

.field { display: block; text-align: left; margin-bottom: 13px; }
.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--panel);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--dur), box-shadow var(--dur);
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.check-inline {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--muted);
    margin: -4px 0 14px;
    cursor: pointer;
    user-select: none;
}

.hint { font-size: 12.5px; color: var(--warn); margin: 10px 0 0; text-align: left; }
.err { font-size: 13px; color: var(--danger); margin: 10px 0 0; text-align: left; }

/* --------------------------------------------------------------- 主框架 */

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.topbar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    padding-top: var(--safe-top);
    height: calc(56px + var(--safe-top));
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 8px; color: var(--primary); flex: none; }
.brand-text { color: var(--text); font-size: 15px; font-weight: 600; }

.search {
    flex: 1;
    min-width: 0;
    max-width: 460px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 0 12px;
    height: 38px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--muted);
    transition: border-color var(--dur), background var(--dur);
}
.search:focus-within { border-color: var(--primary); background: var(--panel); }
.search-ico { flex: none; }
.search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 16px;   /* ≥16px 可避免 iOS 聚焦时自动放大页面 */
    font-family: inherit;
}
.search input::-webkit-search-cancel-button { display: none; }
.search-clear {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50%;
    background: var(--panel-3);
    color: var(--muted);
    cursor: pointer;
}
.search-clear:hover { color: var(--text); }

.actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }

/* 面包屑栏 */
.pathbar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.crumbs {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 1px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.crumbs::-webkit-scrollbar { display: none; }

.crumbs button {
    flex: none;
    border: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    padding: 5px 7px;
    border-radius: 6px;
    font: inherit;
    font-size: 13.5px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.crumbs button:hover { background: var(--panel-3); }
.crumbs button.current { color: var(--text); font-weight: 600; cursor: default; }
.crumbs button.current:hover { background: transparent; }
.crumbs .sep { color: var(--muted); flex: none; font-size: 12px; }

/* 批量操作栏 */
.selbar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--primary-soft);
    border-bottom: 1px solid var(--border);
}
.sel-count { font-size: 13px; font-weight: 600; color: var(--primary); flex: none; }
.sel-actions { display: flex; align-items: center; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.sel-actions::-webkit-scrollbar { display: none; }
.sel-actions .btn { flex: none; }

/* 内容区 */
.content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.content::-webkit-scrollbar { width: 10px; height: 10px; }
.content::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; border: 2px solid var(--bg); }

.searchbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 9px 12px;
    margin-bottom: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}
.searchbar #searchInfoText { flex: 1; min-width: 140px; }

.mini-select {
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--panel);
    color: var(--text);
    font: inherit;
    font-size: 13px;
}

/* --------------------------------------------------------------- 列表视图 */

.list-view {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.list-head,
.row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 110px 165px 200px;
    grid-template-areas: "check name size time act";
    align-items: center;
}

.list-head {
    background: var(--panel-2);
    border-bottom: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--muted);
}
.list-head > div { padding: 10px 12px; }
.list-head .c-check { grid-area: check; display: flex; align-items: center; }
.list-head .c-name { grid-area: name; }
.list-head .c-size { grid-area: size; }
.list-head .c-time { grid-area: time; }
.list-head .c-act { grid-area: act; }

.list-head [data-sort] { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 4px; }
.list-head [data-sort]:hover { color: var(--text); }
.list-head [data-sort].active { color: var(--primary); font-weight: 600; }
.list-head [data-sort] .arrow { font-size: 9px; opacity: .9; }

.row {
    border-bottom: 1px solid var(--border);
    cursor: default;
    transition: background var(--dur);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--panel-2); }
.row.selected { background: var(--primary-soft); }
.row.active { box-shadow: inset 3px 0 0 var(--primary); }

.row > div { padding: 9px 12px; min-width: 0; }
.row .c-check { grid-area: check; display: flex; align-items: center; }
.row .c-name { grid-area: name; }
.row .c-size { grid-area: size; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.row .c-time { grid-area: time; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.row .c-act { grid-area: act; }

.name-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }

.thumb, .file-ico {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--panel-3);
    color: var(--muted);
    border: 1px solid var(--border);
    object-fit: cover;
}
.file-ico.dir { color: #f0b429; background: rgba(240, 180, 41, .12); border-color: transparent; }
.file-ico.image { color: #0ea5e9; background: rgba(14, 165, 233, .12); border-color: transparent; }
.file-ico.video { color: #8b5cf6; background: rgba(139, 92, 246, .12); border-color: transparent; }
.file-ico.audio { color: #ec4899; background: rgba(236, 72, 153, .12); border-color: transparent; }
.file-ico.archive { color: #f59e0b; background: rgba(245, 158, 11, .12); border-color: transparent; }
.file-ico.doc { color: #ef4444; background: rgba(239, 68, 68, .12); border-color: transparent; }
.file-ico.code { color: #10b981; background: rgba(16, 185, 129, .12); border-color: transparent; }
.file-ico.text { color: #64748b; background: rgba(100, 116, 139, .12); border-color: transparent; }

.name-link {
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 14px;
    padding: 2px 0;
    cursor: pointer;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    min-width: 0;
}
.name-link:hover { color: var(--primary); }

.row-sub { display: none; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.row-actions { display: flex; align-items: center; gap: 1px; justify-content: flex-end; opacity: 0; transition: opacity var(--dur); }
.row:hover .row-actions, .row.selected .row-actions, .row:focus-within .row-actions { opacity: 1; }

/* --------------------------------------------------------------- 网格视图 */

.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 12px;
}

.card {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: border-color var(--dur), box-shadow var(--dur);
}
.card:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
.card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }

.card-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-3);
    overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb .big-ico { transform: scale(1.9); }

.card-info { padding: 8px 9px; border-top: 1px solid var(--border); }
.card-name {
    font-size: 12.5px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
}
.card-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }

.card-check {
    position: absolute;
    top: 7px;
    left: 7px;
    z-index: 2;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
@media (prefers-color-scheme: dark) {
    .card-check { background: rgba(30, 33, 39, .9); }
}

.card-menu {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .45);
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--dur);
}
.card:hover .card-menu { opacity: 1; }

/* --------------------------------------------------------------- 空状态 / 分页 */

.empty { padding: 54px 20px; text-align: center; }
.empty-ico { color: var(--border-2); margin-bottom: 10px; }
.empty-title { font-size: 15px; font-weight: 500; margin: 0 0 6px; }
.empty .muted { font-size: 13px; margin: 0; }

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 16px 0 4px;
    font-size: 13px;
}
.pager .pg {
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.pager .pg:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager .pg.cur { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pager .pg:disabled { opacity: .4; cursor: not-allowed; }
.pager .pg-info { color: var(--muted); padding: 0 6px; }

/* --------------------------------------------------------------- 底栏 */

.statusbar {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 16px;
    font-size: 12.5px;
    color: var(--muted);
    background: var(--panel);
    border-top: 1px solid var(--border);
}
.statusbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------------- 拖拽 */

.dropzone {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, .1);
    backdrop-filter: blur(3px);
    pointer-events: none;
}
.dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 34px 48px;
    background: var(--panel);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-lg);
    color: var(--primary);
    font-size: 16px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
}

/* --------------------------------------------------------------- 上传面板 */

.upload-panel {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 392px;
    max-width: calc(100vw - 32px);
    z-index: 50;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.upload-panel.collapsed .up-list,
.upload-panel.collapsed .up-summary { display: none; }

.up-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
}
.up-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-head-actions { display: flex; align-items: center; gap: 6px; flex: none; }

.up-summary { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.up-bar { height: 5px; background: var(--panel-3); border-radius: 3px; overflow: hidden; }
.up-bar > i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 3px; transition: width .2s; }
.up-summary-text { margin-top: 6px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.up-list { max-height: 300px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.up-item { padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.up-item:last-child { border-bottom: 0; }
.up-row { display: flex; align-items: center; gap: 8px; }
.up-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-thumb {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--panel-3);
    border: 1px solid var(--border);
}
.up-state { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.up-state.ok { color: var(--ok); }
.up-state.err { color: var(--danger); }
.up-sub { font-size: 11px; color: var(--muted); margin-top: 6px; height: 4px; background: var(--panel-3); border-radius: 3px; overflow: hidden; }
.up-sub > i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.up-item.done .up-sub > i { background: var(--ok); }
.up-item.error .up-sub > i { background: var(--danger); }

/* --------------------------------------------------------------- 弹窗 */

.modal-mask {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, .48);
    animation: fadeIn .16s ease;
    overscroll-behavior: contain;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    width: 100%;
    max-width: 460px;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: popIn .16s ease;
}
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

.modal.wide { max-width: 680px; }

.modal-head {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    font-weight: 600;
}
.modal-head .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; -webkit-overflow-scrolling: touch; }
.modal-foot {
    flex: none;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 13px 18px;
    border-top: 1px solid var(--border);
    background: var(--panel-2);
    padding-bottom: calc(13px + var(--safe-bottom));
}

.modal-body .field { margin-bottom: 14px; }
.modal-body .field input,
.modal-body .field textarea,
.modal-body .field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--panel);
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    outline: none;
}
.modal-body .field textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; resize: vertical; }
.modal-body .field input:focus,
.modal-body .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* 预览 */
.preview-body { display: flex; align-items: center; justify-content: center; background: var(--panel-2); min-height: 120px; }
.preview-body img, .preview-body video { max-width: 100%; max-height: 68dvh; border-radius: 8px; display: block; }
.preview-body audio { width: 100%; }
.preview-body iframe { width: 100%; height: 68dvh; border: 0; background: #fff; border-radius: 8px; }
.preview-body pre {
    width: 100%;
    margin: 0;
    padding: 14px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 66dvh;
    overflow: auto;
    font: 12.5px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 列表记录（分享 / 回收站） */
.rec-list { display: flex; flex-direction: column; gap: 8px; }
.rec {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
}
.rec-main { flex: 1; min-width: 0; }
.rec-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.rec-meta { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.rec-acts { display: flex; gap: 6px; flex: none; }

.link-box { display: flex; gap: 8px; margin-top: 10px; }
.link-box input {
    flex: 1;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--text);
    font-size: 16px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
}
.switch-row + .switch-row { border-top: 1px solid var(--border); }
.switch-row .label { font-size: 13.5px; }
.switch-row .desc { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

/* 目录选择器 */
.picker-path {
    font-size: 12.5px;
    color: var(--text-2);
    padding: 8px 10px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 10px;
    word-break: break-all;
    font-family: ui-monospace, Menlo, Consolas, monospace;
}
.picker-list { border: 1px solid var(--border); border-radius: 9px; max-height: 320px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.picker-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    text-align: left;
    padding: 11px 12px;
    font: inherit;
    font-size: 13.5px;
    cursor: pointer;
}
.picker-item:last-child { border-bottom: 0; }
.picker-item:hover:not(:disabled) { background: var(--panel-2); }
.picker-item:disabled { opacity: .45; cursor: not-allowed; }
.picker-empty { padding: 26px; text-align: center; color: var(--muted); font-size: 13px; }

/* --------------------------------------------------------------- 操作菜单 / 底部抽屉 */

.menu-mask {
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(15, 23, 42, .35);
    animation: fadeIn .14s ease;
}

.menu {
    position: fixed;
    z-index: 111;
    min-width: 186px;
    padding: 6px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    animation: popIn .14s ease;
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 11px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
}
.menu-item:hover { background: var(--panel-2); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-bg); }
.menu-item .mi-ico { flex: none; color: var(--muted); line-height: 0; }
.menu-item.danger .mi-ico { color: var(--danger); }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--border); }

/* 底部抽屉（移动端） */
.sheet-mask {
    position: fixed;
    inset: 0;
    z-index: 120;
    background: rgba(15, 23, 42, .45);
    animation: fadeIn .16s ease;
}
.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 121;
    background: var(--panel);
    border-radius: 16px 16px 0 0;
    box-shadow: var(--shadow-lg);
    padding-bottom: var(--safe-bottom);
    animation: sheetUp .2s cubic-bezier(.22, .61, .36, 1);
    max-height: 84dvh;
    display: flex;
    flex-direction: column;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }

.sheet-handle { width: 38px; height: 4px; border-radius: 2px; background: var(--border-2); margin: 9px auto 2px; flex: none; }
.sheet-title { padding: 8px 18px 10px; font-size: 14px; font-weight: 600; text-align: center; border-bottom: 1px solid var(--border); flex: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 0; }
.sheet-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 20px;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
}
.sheet-item:hover { background: var(--panel-2); }
.sheet-item.danger { color: var(--danger); }
.sheet-item .mi-ico { flex: none; color: var(--muted); line-height: 0; }
.sheet-item.danger .mi-ico { color: var(--danger); }
.sheet-cancel { border-top: 1px solid var(--border); color: var(--muted); justify-content: center; font-weight: 500; }

/* 文件选择行：真实 <input type="file"> 透明铺满整行，保证手机直接点到 input */
.pick-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 11px;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}
.pick-row .mi-ico { flex: none; color: var(--muted); line-height: 0; }
.pick-row .pick-text { flex: 1 1 auto; }
.pick-row .pick-hint { flex: none; color: var(--muted); font-size: 12px; }
.pick-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}
.pick-row:hover, .pick-row:focus-within { background: var(--panel-2); }
.sheet-body .pick-row { padding: 14px 20px; font-size: 15px; gap: 14px; }
@media (hover: none) {
    .pick-row:hover { background: transparent; }
    .pick-row:active { background: var(--panel-2); }
}

/* --------------------------------------------------------------- 灯箱 */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 130;
    display: flex;
    flex-direction: column;
    background: rgba(10, 12, 16, .96);
    animation: fadeIn .16s ease;
    touch-action: pan-y;
}
.lb-top {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    padding-top: calc(10px + var(--safe-top));
    color: #fff;
}
.lb-name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-actions { display: flex; gap: 6px; flex: none; }
.lightbox .icon-btn { color: rgba(255, 255, 255, .88); }
.lightbox .icon-btn:hover { background: rgba(255, 255, 255, .14); color: #fff; }

.lb-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    overflow: hidden;
}
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lb-stage video { max-width: 100%; max-height: 100%; }
.lb-stage .lb-text {
    width: 100%;
    height: 100%;
    overflow: auto;
    padding: 16px;
    background: #0f1116;
    color: #d6dae2;
    border-radius: 8px;
    font: 12.5px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
    -webkit-overflow-scrolling: touch;
}

.lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    cursor: pointer;
}
.lb-nav:hover { background: rgba(255, 255, 255, .26); }
.lb-nav:disabled { opacity: .25; cursor: not-allowed; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }

.lb-counter {
    flex: none;
    text-align: center;
    color: rgba(255, 255, 255, .7);
    font-size: 12.5px;
    padding: 8px 0 calc(12px + var(--safe-bottom));
}

/* --------------------------------------------------------------- Toast */

.toast-root {
    position: fixed;
    top: calc(16px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    width: max-content;
    max-width: 92vw;
}
.toast {
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    max-width: 92vw;
    word-break: break-word;
    animation: toastIn .18s ease;
}
.toast.ok { border-color: var(--ok); color: var(--ok); }
.toast.err { border-color: var(--danger); color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   平板 / 移动端适配
   ========================================================================== */

/* --- 中等屏幕：收窄列宽 --- */
@media (max-width: 1024px) {
    .list-head, .row { grid-template-columns: 44px minmax(0, 1fr) 95px 150px 168px; }
}

/* --- 平板及以下：操作区移到底部，表格变卡片 --- */
@media (max-width: 820px) {
    .mobile-only { display: inline-flex !important; }
    .desktop-only { display: none !important; }

    /* 底部固定操作栏 */
    .actions {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 45;
        margin: 0;
        gap: 0;
        justify-content: space-around;
        padding: 4px 2px calc(4px + var(--safe-bottom));
        background: var(--panel);
        border-top: 1px solid var(--border);
        box-shadow: 0 -1px 12px rgba(16, 24, 40, .06);
    }
    .actions .btn {
        flex: 1 1 0;
        flex-direction: column;
        gap: 3px;
        padding: 7px 2px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        font-size: 11px;
        color: var(--text-2);
        min-width: 0;
    }
    .actions .btn:hover { background: var(--panel-2); }
    .actions .btn svg { width: 21px; height: 21px; }
    .actions .btn-text { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
    .actions .badge { position: absolute; top: 4px; margin-left: 26px; }

    /* 顶部栏不再放按钮 */
    .topbar { height: calc(52px + var(--safe-top)); padding: 0 12px; gap: 10px; }
    .brand-text { display: none; }
    .search { height: 36px; max-width: none; }

    /* 给底部栏留出空间 */
    #app { padding-bottom: calc(var(--bottom-bar-h) - 6px); }
    .statusbar { display: none; }

    .pathbar { padding: 8px 12px; }
    .content { padding: 10px 12px 16px; }

    /* 列表 → 卡片式 */
    .list-head { display: none; }
    .list-view { background: transparent; border: 0; border-radius: 0; }
    .list-body { display: flex; flex-direction: column; gap: 8px; }

    .row {
        grid-template-columns: 40px minmax(0, 1fr) 44px;
        grid-template-areas: "check name act";
        background: var(--panel);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 4px 2px;
        align-items: center;
    }
    .row:last-child { border-bottom: 1px solid var(--border); }
    .row.selected { border-color: var(--primary); }
    .row > div { padding: 8px 6px; }
    .row .c-check { padding-left: 10px; }
    .row .c-name { padding: 8px 2px; }
    .row .c-size, .row .c-time { display: none; }
    .row .c-act { padding-right: 6px; }
    .row-actions { opacity: 1; }

    .thumb, .file-ico { width: 40px; height: 40px; }
    .name-link { font-size: 14.5px; }
    .row-sub { display: block; }

    /* 网格视图 */
    .grid-view { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 9px; }
    .card-info { padding: 7px 8px; }
    .card-name { font-size: 12px; }
    .card-menu { opacity: 1; }

    /* 弹窗 → 底部抽屉 */
    .modal-mask { align-items: flex-end; padding: 0; }
    .modal {
        max-width: none;
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 90dvh;
        animation: sheetUp .2s cubic-bezier(.22, .61, .36, 1);
    }
    .modal-foot { padding-bottom: calc(13px + var(--safe-bottom)); }
    .modal-foot .btn { flex: 1; }

    /* 上传面板全宽 */
    .upload-panel {
        left: 10px;
        right: 10px;
        bottom: calc(var(--bottom-bar-h) + 8px);
        width: auto;
        max-width: none;
    }
    .up-list { max-height: 34dvh; }

    .dropzone-inner { padding: 26px 30px; font-size: 15px; }

    .lb-prev { left: 6px; }
    .lb-next { right: 6px; }
    .lb-nav { width: 40px; height: 40px; }

    .selbar { padding: 8px 12px; overflow: hidden; }
    .sel-actions { flex: 1; }
    .sel-count { font-size: 12.5px; }
    .pager { gap: 5px; padding: 12px 0 6px; }
    .pager .pg { min-width: 30px; height: 30px; font-size: 12.5px; }
}

/* --- 小屏手机 --- */
@media (max-width: 480px) {
    .list-head, .row { grid-template-columns: 38px minmax(0, 1fr) 42px; }
    .thumb, .file-ico { width: 38px; height: 38px; }
    .grid-view { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
    .gate-card { padding: 26px 18px 20px; }
    .modal-body { padding: 14px; }
    .rec { flex-wrap: wrap; }
    .rec-acts { width: 100%; justify-content: flex-end; }
}

/* --- 触摸设备：去掉 hover 依赖 --- */
@media (hover: none) {
    .row-actions { opacity: 1; }
    .btn:hover { background: var(--panel); border-color: var(--border); }
    .btn-primary:hover { background: var(--primary); border-color: var(--primary); }
    .icon-btn:hover { background: transparent; color: var(--text-2); }
    .card-menu { opacity: 1; }
    .card:hover { border-color: var(--border); box-shadow: none; }
    .crumbs button:hover { background: transparent; }
    .picker-item:hover:not(:disabled) { background: transparent; }
}

/* --- 横屏手机：压缩高度 --- */
@media (max-height: 480px) and (orientation: landscape) {
    .modal { max-height: 96dvh; }
    .up-list { max-height: 40dvh; }
}

/* --- 打印 --- */
@media print {
    .topbar, .pathbar, .selbar, .actions, .statusbar, .upload-panel, .pager { display: none !important; }
}
