/* ---- 文件浏览页局部样式 ---- */

/* 工具行 */
.toolrow {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-5);
    flex-wrap: wrap;
}

/* 标题行改为横排：标题在左、视图切换在右，收紧下方间距消除大空白 */
.content-narrow .page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--sp-4);
    margin-bottom: var(--sp-4);
}

/* 驱动器 pills */
.drivers-row {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex: 0 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    font-size: 13px;
    color: var(--text-muted);
}
.drivers-row::-webkit-scrollbar { display: none; }
.drivers-row > span { flex-shrink: 0; white-space: nowrap; }
.driver-pill {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    white-space: nowrap;
    height: 28px;
    padding: 0 var(--sp-3);
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--brand);
    cursor: pointer;
    transition: all .14s var(--ease);
}
.driver-pill:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
}

/* 路径导航区 */
.path-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: var(--sp-3) var(--sp-4);
    background: var(--bg-sunken);
    border-bottom: 1px solid var(--border);
    flex-wrap: nowrap;
}
.nav-btns {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}
.path-section .btn-icon { display:inline-grid; place-items:center; width:44px; height:44px; min-width:44px; padding:0; gap:0; }
.path-section .btn-icon > span { display:flex; align-items:center; justify-content:center; width:23px; height:23px; line-height:0; }
.path-section .btn-icon svg { display:block; width:23px; height:23px; }
.path-section .btn-icon:focus-visible { outline:2px solid var(--brand); outline-offset:2px; }
.browser-toolbar-actions { display:flex; align-items:center; flex-wrap:nowrap; flex-shrink:0; gap:6px; max-width:100%; }

/* 列表头 */
.file-list-header {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) var(--col-size, 110px) var(--col-date, 160px) var(--col-action, 104px) var(--col-preview, 90px);
    align-items: center;
    gap: var(--sp-3);
    padding: 0 var(--sp-4);
    height: 40px;
    background: var(--bg-sunken);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.file-list-header > div { position: relative; }
.header-col {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
    transition: color .14s;
}
.header-col:hover { color: var(--text); }
.header-col.asc .sort-icon::after  { content: ' ↑'; }
.header-col.desc .sort-icon::after { content: ' ↓'; }
/* 列边界手柄：拖动时在相邻两列间分配宽度。 */
.col-resizer {
    position: absolute; top: 0; right: -6px; width: 12px; height: 100%;
    cursor: col-resize; z-index: 5;
}
.col-resizer::after {
    content: ''; position: absolute; top: 25%; bottom: 25%; left: 5px; width: 2px;
    background: transparent; transition: background .14s;
}
.col-resizer:hover::after, .col-resizer.dragging::after { background: var(--brand); }

/* 文件项 */
.file-list-body { display: flex; flex-direction: column; }
.list-view .file-item {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) var(--col-size, 110px) var(--col-date, 160px) var(--col-action, 104px) var(--col-preview, 90px);
    align-items: center;
    gap: var(--sp-3);
    padding: 0 var(--sp-4);
    height: 56px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    transition: background .12s;
}
.list-view .file-item:last-child { border-bottom: none; }
.list-view .file-item:hover { background: var(--surface-hover); }
.list-view .file-item.is-selected {
    background: color-mix(in srgb, var(--brand) 10%, var(--bg-elevated));
    box-shadow: inset 3px 0 0 var(--brand);
}

/* 文件名列 */
.file-name-col {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-width: 0;
}
.file-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--brand-soft);
    color: var(--brand);
}
.file-icon svg { width: 18px; height: 18px; }
.file-link {
    /* 文件名列设最大宽度；过长时多行展示全名，最多 3 行再省略（B） */
    max-width: 520px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    white-space: normal;
    word-break: break-word;
    overflow: hidden;
    color: var(--text);
    font-weight: 500;
    line-height: 1.4;
}
.file-link:hover { color: var(--brand); }
.file-entry-text { min-width: 0; }
.link-target {
    display: block;
    margin-top: 3px;
    max-width: 520px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.35;
}
.link-target b {
    margin-right: 5px;
    color: var(--brand);
    font-family: var(--font-sans);
    font-weight: 600;
}
.grid-link-target {
    margin: 5px 0 0;
    max-width: none;
}

/* 大小 / 日期列 */
.size-col, .date-col {
    color: var(--text-secondary);
    font-size: 13px;
    font-family: var(--font-mono);
}
.size-col a { color: inherit; text-decoration: none; }
.size-col a:hover { color: var(--brand); }

/* 列表视图：大小列 hover 显示删除按钮（悬停时大小文字淡出让位） */
.size-col { position: relative; display: flex; align-items: center; }
.delete-btn {
    display: none; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    background: color-mix(in srgb, var(--danger) 14%, transparent);
    color: var(--danger); cursor: pointer; border: none;
    transition: all .18s var(--ease); flex-shrink: 0;
}
.delete-btn svg { width: 14px; height: 14px; }
.delete-btn:hover { background: var(--danger); color: #fff; transform: scale(1.1); }
.size-col .delete-btn {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    box-shadow: var(--shadow-sm);
}
.size-col .delete-btn:hover { transform: translateY(-50%) scale(1.1); }
.list-view .file-item:hover .size-col .delete-btn { display: inline-flex; }
.size-col .size-text { transition: opacity .18s; }
.list-view .file-item:hover .size-col .size-text { opacity: .25; }

/* 网格视图：卡片右上角 hover 显示删除按钮 */
.card-cover { position: relative; }
.card-delete-btn {
    position: absolute; top: 8px; right: 8px; z-index: 5;
    box-shadow: var(--shadow-md);
    background: color-mix(in srgb, var(--danger) 88%, transparent);
    color: #fff;
}
.card-item:hover .card-delete-btn { display: inline-flex; }

/* 操作列 */
.file-action-col { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: nowrap; white-space: nowrap; }

/* 更多操作下拉（todo #1：折叠打包下载/重命名/移动，只常驻看本） */
.more-menu { position: relative; }
.more-btn {
    width: 28px; height: 28px; display: inline-grid; place-items: center;
    border-radius: var(--r-md); border: none; cursor: pointer;
    background: var(--bg-sunken); color: var(--text-muted);
    transition: all .14s var(--ease);
}
.more-btn:hover { background: var(--surface-hover); color: var(--text); }
.more-btn svg { width: 16px; height: 16px; }
.more-dropdown {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 120;
    min-width: 120px; padding: var(--sp-2);
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--r-md); box-shadow: var(--shadow-lg);
    display: none; flex-direction: column; gap: 1px;
}
.more-menu.open .more-dropdown { display: flex; }
.more-item {
    display: block; padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-sm); font-size: 13px; color: var(--text);
    white-space: nowrap; cursor: pointer; transition: background .12s;
}
.more-item:hover { background: var(--surface-hover); color: var(--brand); }
.more-item-danger { color: var(--danger); }
.more-item-danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 28px;
    padding: 0 var(--sp-3);
    background: var(--brand-soft);
    color: var(--brand);
    border-radius: var(--r-md);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;   /* 防“看本”被窄列挤成竖排 */
    flex-shrink: 0;
    transition: all .14s var(--ease);
}
.action-btn:hover { background: var(--brand); color: var(--text-on-brand); }
.action-btn svg { width: 14px; height: 14px; }

/* 预览列 */
.preview-col { display: flex; align-items: center; }
.preview-img {
    width: 48px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    cursor: zoom-in;
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.preview-img.is-previewing {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px var(--brand-ring);
    cursor: zoom-out;
}
.preview-pop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1200;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: scale(.94);
    transform-origin: center right;
    transition: opacity .18s var(--ease), transform .18s var(--ease), visibility 0s linear .18s;
    will-change: transform, opacity;
}
.preview-pop.open {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition: opacity .18s var(--ease), transform .18s var(--ease), visibility 0s linear 0s;
}
.preview-pop-img {
    display: block;
    width: 360px;
    height: 480px;
    max-width: min(360px, calc(100vw - 96px));
    max-height: min(480px, calc(100vh - 32px));
    object-fit: contain;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
}

/* 回到顶部 */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 80px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s var(--ease);
    z-index: 100;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top svg { width: 18px; height: 18px; }

/* 书签抽屉 */
.bookmarks-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    backdrop-filter: blur(2px);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s var(--ease);
}
.bookmarks-backdrop.open { opacity: 1; pointer-events: auto; }

.bookmarks-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 340px;
    max-width: 90vw;
    background: var(--bg-elevated);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .3s var(--ease);
}
.bookmarks-drawer.open { transform: translateX(0); }

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--border);
}
.drawer-title {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: 16px;
    font-weight: 600;
}
.drawer-title svg { width: 18px; height: 18px; color: var(--warning); }
.btn-close {
    width: 32px;
    height: 32px;
    border-radius: var(--r-md);
    display: grid;
    place-items: center;
    font-size: 20px;
    color: var(--text-muted);
    transition: background .14s;
}
.btn-close:hover { background: var(--surface-hover); color: var(--text); }

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-4) var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}
.bookmark-add-btn {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    width: 100%;
    height: 38px;
    padding: 0 var(--sp-4);
    background: var(--brand);
    color: var(--text-on-brand);
    border-radius: var(--r-md);
    font-size: 14px;
    font-weight: 500;
    justify-content: center;
    transition: background .14s;
}
.bookmark-add-btn:hover { background: var(--brand-hover); }
.bookmark-add-btn svg { width: 16px; height: 16px; }

.bookmarks-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}
.bookmark-item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-3) var(--sp-4);
    transition: border-color .14s;
}
.bookmark-item:hover { border-color: var(--brand); }
.bookmark-link { flex: 1; min-width: 0; }
.bookmark-path {
    font-size: 13px;
    font-weight: 500;
    word-break: break-all;
    line-height: 1.4;
}
.bookmark-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.bookmark-time svg { width: 11px; height: 11px; }
.bookmark-delete {
    width: 28px;
    height: 28px;
    border-radius: var(--r-sm);
    display: grid;
    place-items: center;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all .14s;
}
.bookmark-delete:hover { background: var(--danger); color: #fff; }
.bookmark-delete svg { width: 14px; height: 14px; }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    padding: var(--sp-6);
}

/* 首页搜索/过滤框 */
.filter-box {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 1 1 200px;
    max-width: 320px;
}
.filter-box .filter-ico {
    position: absolute;
    left: var(--sp-3);
    display: grid;
    place-items: center;
    color: var(--text-muted);
    pointer-events: none;
}
.filter-box .filter-ico svg { width: 15px; height: 15px; }
#fileFilter {
    width: 100%;
    height: 34px;
    padding: 0 var(--sp-3) 0 32px;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text);
    font-size: 13px;
    transition: border-color .14s;
}
#fileFilter:focus { outline: none; border-color: var(--brand); }
/* 无匹配空态（列表/网格通用） */
.filter-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    padding: var(--sp-6);
    display: none;
}

/* 最近浏览下拉面板 */
.recent-wrap { position: relative; }
.recent-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 150;
    width: clamp(360px, 48vw, 680px);
    max-width: 92vw;
    max-height: 380px;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-2);
    display: none;
}
.recent-panel.open { display: block; }
@media(max-width:860px) {
    .path-section { flex-wrap: wrap; }
    .nav-btns { position:relative; }
    .path-section > .spacer { display:none; }
    .browser-toolbar-actions { flex-basis:100%; order:1; flex-wrap:wrap; }
    .path-section > .drivers-row { flex-basis:100%; order:2; flex-wrap:wrap; overflow-x:visible; }
    .recent-wrap { position:static; }
    .recent-panel { left:0; width:calc(100vw - 32px); max-width:calc(100vw - 32px); }
}
a.link-target:hover { color: var(--brand); text-decoration: underline; }
a.link-target:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.recent-panel .recent-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: var(--sp-2) var(--sp-3) var(--sp-1);
}
.recent-entry {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-sm);
    font-size: 13px;
    line-height: 1.45;
    color: var(--text);
    white-space: normal;
    word-break: break-all;
    cursor: pointer;
    transition: background .12s, color .12s;
    text-decoration: none;
}
.recent-entry:hover { background: var(--surface-hover); color: var(--brand); }
.recent-entry-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    margin-top: 2px;
    color: var(--text-muted);
}
.recent-entry:hover .recent-entry-icon { color: var(--brand); }
.recent-entry-text {
    flex: 1 1 auto;
    white-space: normal;
    word-break: break-all;
}
.recent-empty { padding: var(--sp-3); color: var(--text-muted); font-size: 13px; }

/* 移动到其它目录浮层（居中 modal，随主题） */
.move-overlay {
    position: fixed; inset: 0; z-index: 300;
    display: none; align-items: center; justify-content: center;
    background: rgba(0,0,0,.4); backdrop-filter: blur(3px);
}
.move-overlay.open { display: flex; }
.move-card {
    width: 380px; max-width: 90vw; max-height: 80vh;
    display: flex; flex-direction: column;
    background: var(--bg-elevated);
    border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg); overflow: hidden;
}
.move-header {
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--border);
}
.move-header h3 { font-size: 15px; font-weight: 600; margin: 0; }
.move-header .move-sub {
    font-size: 12px; color: var(--text-muted); margin-top: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.move-list {
    flex: 1; overflow-y: auto; padding: var(--sp-3);
    display: flex; flex-direction: column; gap: 2px;
}
.move-target {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-3);
    border-radius: var(--r-md); cursor: pointer;
    font-size: 14px; color: var(--text);
    transition: background .12s;
}
.move-target:hover { background: var(--surface-hover); color: var(--brand); }
.move-target svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--brand); }
.move-target .mt-name {
    min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.move-empty { padding: var(--sp-5); text-align: center; color: var(--text-muted); font-size: 13px; }
.move-footer {
    padding: var(--sp-3) var(--sp-5);
    border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end;
}

/* 删除确认弹窗：替代浏览器原生 confirm，保持全站视觉与主题一致 */
.delete-confirm-overlay {
    position: fixed; inset: 0; z-index: 340;
    display: none; align-items: center; justify-content: center;
    padding: var(--sp-4);
    background: rgba(10, 12, 18, .54);
    backdrop-filter: blur(5px);
}
.delete-confirm-overlay.open { display: flex; }
.delete-confirm-card {
    width: 420px; max-width: 100%;
    max-height: calc(100dvh - 32px); overflow-y: auto;
    padding: var(--sp-6);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    animation: deleteConfirmIn .18s var(--ease) both;
}
.delete-confirm-icon {
    width: 48px; height: 48px;
    display: grid; place-items: center;
    margin-bottom: var(--sp-4);
    border-radius: 16px;
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 14%, transparent);
}
.delete-confirm-icon svg { width: 22px; height: 22px; }
.delete-confirm-card h3 {
    margin: 0 0 var(--sp-2);
    font-size: 18px; font-weight: 650;
}
.delete-confirm-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px; line-height: 1.65;
    overflow-wrap: anywhere;
}
.delete-confirm-warning {
    display: inline-flex; align-items: center;
    margin-top: var(--sp-3);
    color: var(--danger);
    font-size: 12px; font-weight: 600;
}
:root:not([data-theme="dark"]) .delete-confirm-warning {
    color: #a1262a;
}
.delete-confirm-actions {
    display: flex; justify-content: flex-end; gap: var(--sp-3);
    margin-top: var(--sp-6);
}
.delete-confirm-actions [hidden] { display: none; }
.delete-confirm-danger {
    color: #fff;
    background: color-mix(in srgb, var(--danger) 58%, #000);
    border-color: color-mix(in srgb, var(--danger) 58%, #000);
}
.delete-confirm-danger:hover {
    color: #fff;
    background: color-mix(in srgb, var(--danger) 68%, #000);
    border-color: color-mix(in srgb, var(--danger) 68%, #000);
}
.delete-confirm-actions .btn:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--brand) 38%, transparent);
    outline-offset: 2px;
}
.file-item.is-recycling, .column-entry.is-recycling { position: relative; }
.recycle-status {
    position: absolute; inset: 0; z-index: 20;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 8px; border-radius: inherit;
    background: color-mix(in srgb, var(--bg-elevated) 94%, transparent);
    color: var(--text-secondary); font-size: 13px;
}
.recycle-status::before, button.is-recycling::before {
    content: ''; flex: 0 0 auto; width: 14px; height: 14px;
    border: 2px solid currentColor; border-right-color: transparent;
    border-radius: 50%; animation: recycleSpin .8s linear infinite;
}
button.is-recycling { display: inline-flex; align-items: center; gap: 8px; }
.delete-confirm-overlay[aria-busy="true"] .delete-confirm-card { cursor: progress; }
.delete-confirm-card p { max-height: 35dvh; overflow-y: auto; }
@keyframes recycleSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .recycle-status::before, button.is-recycling::before { animation: none; }
}
@keyframes deleteConfirmIn {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 视图切换段控件 */
.segmented {
    display: inline-flex;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 3px;
    gap: 2px;
}
.segmented button {
    width: 34px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    color: var(--text-muted);
    transition: all .14s var(--ease);
}
.segmented button svg { width: 21px; height: 21px; }
.segmented button.on {
    background: var(--bg-elevated);
    color: var(--brand);
    box-shadow: var(--shadow-sm);
}

/* 网格视图 */
.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--sp-4);
}
.card-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: all .18s var(--ease);
    cursor: pointer;
    position: relative;
}
.card-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.card-item.is-selected {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px var(--brand-ring), var(--shadow-md);
}
.card-cover {
    aspect-ratio: 3/4;
    position: relative;
    overflow: hidden;
    background: var(--bg-sunken);
    display: grid;
    place-items: center;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.card-item:hover .card-cover img { transform: scale(1.05); }
.card-cover .card-type-badge {
    position: absolute; bottom: 8px; left: 8px; z-index: 5;
    display: flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: var(--r-sm, 6px);
    background: color-mix(in srgb, var(--bg-elevated) 65%, transparent);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    color: var(--brand); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.card-cover .card-type-badge svg { width: 13px; height: 13px; stroke-width: 2.2; }
.card-cover .folder-ico { color: var(--text-muted); }
.card-cover .folder-ico svg { width: 46px; height: 46px; }
.card-meta { padding: 10px 12px 12px; }
.card-meta .name {
    font-size: 13px;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    line-height: 1.4;
    word-break: break-all;
}
.card-meta .info {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    display: flex;
    gap: 8px;
}
.card-jmview-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 5;
}

/* 列表视图（默认显示，网格视图作为覆盖层） */
.list-view {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    /* 用 visible 让预览图放大时能溢出容器显示（对齐旧版），
       否则首/末行的预览弹窗会被 overflow:hidden 裁掉 */
    overflow: visible;
}
/* 预览列自身也不裁剪，放大图可越界 */
.preview-col { overflow: visible; }
/* app.list-mode: grid 显示，list 隐藏 */
.app.grid-mode .list-view { display: none; }
.app.grid-mode .grid-view { display: grid; }
.app:not(.grid-mode) .grid-view { display: none; }
.app.column-mode .list-view,
.app.column-mode .grid-view { display: none; }

/* 移动端适配 */
@media (max-width: 860px) {
    .file-list-header { display: none; }
    .list-view .file-item {
        grid-template-columns: minmax(0, 1fr) auto;
        height: auto;
        padding: var(--sp-3) var(--sp-4);
        gap: var(--sp-2);
    }
    .list-view .file-item.has-preview {
        grid-template-columns: 56px minmax(0, 1fr) auto;
    }
    .list-view .file-item.has-preview .preview-col {
        display: flex;
        grid-column: 1;
        grid-row: 1;
        justify-content: center;
    }
    .list-view .file-item.has-preview .file-name-col {
        grid-column: 2;
        grid-row: 1;
    }
    .list-view .file-item.has-preview .file-action-col {
        grid-column: 3;
        grid-row: 1;
    }
    .list-view .file-item.has-preview .file-icon { display: none; }
    .list-view .preview-img {
        width: 48px;
        height: 64px;
        cursor: default;
        transform: none;
    }
    .size-col, .date-col { display: none; }
    .preview-col { display: none; }
}

/* 面包屑输入框 */
.crumbs-input {
    height: 32px;
    padding: 0 var(--sp-3);
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    transition: border-color .16s, box-shadow .16s;
    width: 100%;
}
.crumbs-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

/* 批量操作栏 */
.batch-bar {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 150;
    width: max-content;
    max-width: calc(100vw - 24px);
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--sp-3);
    align-items: center;
    padding: var(--sp-3) var(--sp-4);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    box-shadow: var(--shadow-lg);
}
#batchCount {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}
.batch-bar .btn { flex-shrink: 0; }
@media (max-width: 860px) {
    .batch-bar {
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        border-radius: var(--r-lg);
        gap: var(--sp-2);
        padding: var(--sp-2) var(--sp-3);
    }
    .batch-bar .btn { min-height: 44px; }
}

/* 系统未提供视频缩略图时，在原预览位置保留类型图标。 */
.video-thumbnail-fallback { display: none; color: var(--text-muted); }
.thumbnail-failed > img[hidden] { display: none !important; }
.thumbnail-failed > .video-thumbnail-fallback { display: grid; place-items: center; }
.preview-col > .video-thumbnail-fallback { width: 48px; height: 64px; }
.video-thumbnail-fallback svg { width: 24px; height: 24px; }
.card-cover > .video-thumbnail-fallback svg { width: 46px; height: 46px; }
