/* ==========================================================================
   图床 - 基础样式与前台
   ========================================================================== */

:root {
    --bg: #f6f7f9;
    --bg-elev: #ffffff;
    --bg-sub: #f0f2f5;
    --bg-hover: #f3f4f7;
    --text: #16181d;
    --text-2: #59616e;
    --text-3: #8b93a1;
    --border: #e5e8ee;
    --border-strong: #d4d9e2;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eef4ff;
    --danger: #e5484d;
    --danger-soft: #fdecec;
    --success: #12a150;
    --success-soft: #e9f8ef;
    --warning: #d97706;
    --warning-soft: #fff5e6;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-sm: 0 2px 8px rgba(16, 24, 40, .06);
    --shadow-md: 0 8px 24px rgba(16, 24, 40, .09);
    --shadow-lg: 0 24px 64px rgba(16, 24, 40, .18);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e1014;
        --bg-elev: #16191f;
        --bg-sub: #1c2027;
        --bg-hover: #21262e;
        --text: #ecedf0;
        --text-2: #a3acba;
        --text-3: #737d8c;
        --border: #262b34;
        --border-strong: #333a45;
        --primary: #4c8dff;
        --primary-hover: #6ba1ff;
        --primary-soft: #16233c;
        --danger: #ff6166;
        --danger-soft: #2c1618;
        --success: #3ecf8e;
        --success-soft: #12291f;
        --warning: #f0a444;
        --warning-soft: #2b2114;
        --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
        --shadow-sm: 0 2px 8px rgba(0, 0, 0, .35);
        --shadow-md: 0 8px 24px rgba(0, 0, 0, .45);
        --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6);
    }
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
}

::selection {
    background: var(--primary);
    color: #fff;
}

.wrap {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 28px;
}

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elev);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: background .16s, border-color .16s, color .16s, transform .16s, box-shadow .16s;
    box-shadow: var(--shadow-xs);
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(37, 99, 235, .3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}

.btn-danger {
    color: var(--danger);
    border-color: var(--border);
}

.btn-danger:hover {
    background: var(--danger-soft);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--text-2);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    border-color: transparent;
    color: var(--text);
}

.btn-sm {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 7px;
}

.btn-lg {
    height: 44px;
    padding: 0 22px;
    font-size: 14px;
    border-radius: 10px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ---------------- 表单 ---------------- */
.input,
.select,
.textarea {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elev);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color .16s, box-shadow .16s, background .16s;
}

.textarea {
    height: auto;
    min-height: 92px;
    padding: 10px 12px;
    resize: vertical;
    line-height: 1.7;
    font-family: var(--mono);
    font-size: 12px;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-3);
}

.select {
    appearance: none;
    padding-right: 30px;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b93a1' d='M6 8.5L1.5 4h9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

.field {
    margin-bottom: 18px;
}

.field>label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.field .hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-3);
    line-height: 1.6;
}

/* ---------------- 徽标 ---------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 21px;
    padding: 0 7px;
    border-radius: 5px;
    background: var(--bg-sub);
    color: var(--text-2);
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.badge-ali {
    background: #fff3e8;
    color: #c2410c;
}

.badge-360 {
    background: #e9f6ec;
    color: #15803d;
}

.badge-sogou {
    background: #fdeaf0;
    color: #be123c;
}

.badge-local {
    background: var(--bg-sub);
    color: var(--text-2);
}

.badge-fail {
    background: var(--danger-soft);
    color: var(--danger);
}

@media (prefers-color-scheme: dark) {
    .badge-ali {
        background: #3a2517;
        color: #ffab73;
    }

    .badge-360 {
        background: #16301f;
        color: #6ee7a2;
    }

    .badge-sogou {
        background: #3a1622;
        color: #fda4af;
    }
}

/* ---------------- 顶部栏 ---------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    height: 62px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -.01em;
    flex-shrink: 0;
}

.brand-logo {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, #3b82f6, #6366f1 55%, #8b5cf6);
    color: #fff;
    box-shadow: 0 2px 6px rgba(59, 130, 246, .35);
}

.brand-logo svg {
    width: 17px;
    height: 17px;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 420px;
}

.search-box svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--text-3);
    pointer-events: none;
}

.search-box .input {
    padding-left: 34px;
    background: var(--bg-elev);
}

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

.user-chip {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0 10px 0 4px;
    border-radius: 999px;
    background: var(--bg-sub);
    font-size: 12px;
    color: var(--text-2);
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

/* ---------------- 上传区 ---------------- */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 30px 0 18px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -.02em;
}

.page-sub {
    margin: 5px 0 0;
    font-size: 13px;
    color: var(--text-3);
}

.stat-inline {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 12px;
    color: var(--text-3);
}

.stat-inline b {
    color: var(--text);
    font-size: 15px;
    font-weight: 650;
    margin-right: 3px;
    font-variant-numeric: tabular-nums;
}

.dropzone {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--bg-elev);
    transition: border-color .2s, background .2s, transform .2s;
    cursor: pointer;
    overflow: hidden;
}

.dropzone:hover,
.dropzone.is-drag {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.dropzone.is-drag {
    transform: scale(1.005);
}

.dz-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 13px;
    background: var(--primary-soft);
    color: var(--primary);
}

.dz-icon svg {
    width: 22px;
    height: 22px;
}

.dz-text h3 {
    margin: 0 0 3px;
    font-size: 14px;
    font-weight: 600;
}

.dz-text p {
    margin: 0;
    font-size: 12px;
    color: var(--text-3);
}

.dz-text kbd {
    display: inline-block;
    padding: 1px 5px;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--bg-sub);
    font-family: var(--font);
    font-size: 11px;
    color: var(--text-2);
}

.dz-action {
    margin-left: auto;
    flex-shrink: 0;
}

/* ---------------- 工具栏 ---------------- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 22px 0 16px;
    flex-wrap: wrap;
}

.seg {
    display: inline-flex;
    padding: 3px;
    border-radius: 9px;
    background: var(--bg-sub);
    gap: 2px;
}

.seg button {
    height: 28px;
    padding: 0 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 500;
    transition: background .15s, color .15s, box-shadow .15s;
}

.seg button:hover {
    color: var(--text);
}

.seg button.active {
    background: var(--bg-elev);
    color: var(--text);
    box-shadow: var(--shadow-xs);
}

.toolbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-3);
}

/* ---------------- 文件夹 ---------------- */
.folder-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 0;
}

.folder-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    padding: 2px 0;
    scrollbar-width: none;
}

.folder-chips::-webkit-scrollbar {
    display: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-elev);
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .15s, color .15s, border-color .15s;
}

.chip:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.chip svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.chip em {
    font-style: normal;
    font-size: 11px;
    color: var(--text-3);
    margin-left: 1px;
}

.chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.chip.active em {
    color: rgba(255, 255, 255, .72);
}

.folder-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.folder-tools .btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.folder-tools .btn svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.btn-ghost-danger {
    color: var(--danger);
    background: transparent;
}

.btn-ghost-danger:hover {
    background: var(--danger-soft);
}

/* ---------------- 图片网格 ---------------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
    padding-bottom: 12px;
}

.img-card {
    position: relative;
    border-radius: var(--radius);
    background: var(--bg-elev);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform .22s cubic-bezier(.2, .8, .3, 1), box-shadow .22s, border-color .22s;
    cursor: zoom-in;
}

.img-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.img-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--bg-sub);
    overflow: hidden;
}

.img-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s cubic-bezier(.2, .8, .3, 1);
    opacity: 0;
}

.img-thumb img.loaded {
    opacity: 1;
}

.img-card:hover .img-thumb img {
    transform: scale(1.045);
}

.img-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 11px;
    font-size: 11.5px;
    color: var(--text-3);
}

.img-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-2);
}

.img-actions {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 6px;
    padding: 9px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, .38), rgba(0, 0, 0, 0) 42%);
    opacity: 0;
    transition: opacity .2s;
}

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

.act-btn {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
    color: #1b1f24;
    backdrop-filter: blur(6px);
    transition: background .15s, transform .15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.act-btn:hover {
    background: #fff;
    transform: scale(1.06);
}

.act-btn.danger:hover {
    background: var(--danger);
    color: #fff;
}

.act-btn svg {
    width: 15px;
    height: 15px;
}

/* ---------------- 空状态 / 骨架 ---------------- */
.empty {
    padding: 80px 20px;
    text-align: center;
    color: var(--text-3);
}

.empty svg {
    width: 46px;
    height: 46px;
    margin-bottom: 14px;
    opacity: .5;
}

.empty h3 {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-2);
}

.empty p {
    margin: 0;
    font-size: 13px;
}

.skeleton {
    border-radius: var(--radius);
    background: linear-gradient(100deg, var(--bg-sub) 25%, var(--bg-hover) 37%, var(--bg-sub) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
    aspect-ratio: 4 / 3.28;
}

@keyframes shimmer {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0 50%;
    }
}

/* ---------------- 分页 ---------------- */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 26px 0 46px;
    flex-wrap: wrap;
}

.pager button {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-elev);
    color: var(--text-2);
    font-size: 13px;
    transition: all .15s;
}

.pager button:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: var(--bg-hover);
    color: var(--text);
}

.pager button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pager button:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.pager .info {
    margin: 0 8px;
    font-size: 12px;
    color: var(--text-3);
}

/* ---------------- 上传进度面板 ---------------- */
.upload-panel {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 60;
    width: 320px;
    max-height: 380px;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    background: var(--bg-elev);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideUp .24s cubic-bezier(.2, .8, .3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.upload-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
}

.upload-list {
    overflow-y: auto;
    padding: 8px;
}

.upload-item {
    padding: 8px;
    border-radius: 8px;
}

.upload-item+.upload-item {
    margin-top: 2px;
}

.upload-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
}

.upload-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-2);
}

.upload-item-status {
    font-size: 11px;
    color: var(--text-3);
    flex-shrink: 0;
}

.upload-item-status.ok {
    color: var(--success);
}

.upload-item-status.err {
    color: var(--danger);
}

.progress {
    height: 3px;
    border-radius: 2px;
    background: var(--bg-sub);
    overflow: hidden;
}

.progress span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 2px;
    background: var(--primary);
    transition: width .2s;
}

.upload-item.ok .progress span {
    background: var(--success);
}

.upload-item.err .progress span {
    background: var(--danger);
}

/* ---------------- 灯箱 ---------------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    flex-direction: column;
    background: rgba(10, 12, 16, .93);
    backdrop-filter: blur(6px);
}

.lightbox.open {
    display: flex;
    animation: fadeIn .18s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.lb-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 22px;
    color: rgba(255, 255, 255, .9);
    font-size: 13px;
}

.lb-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.lb-top .btn {
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .16);
    color: #fff;
    box-shadow: none;
}

.lb-top .btn:hover {
    background: rgba(255, 255, 255, .2);
}

.lb-stage {
    flex: 1;
    position: relative;
    display: grid;
    place-items: center;
    padding: 0 76px 10px;
    overflow: hidden;
}

.lb-stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    transition: background .16s;
}

.lb-nav:hover {
    background: rgba(255, 255, 255, .22);
}

.lb-nav.prev {
    left: 18px;
}

.lb-nav.next {
    right: 18px;
}

.lb-nav svg {
    width: 20px;
    height: 20px;
}

.lb-bottom {
    padding: 14px 22px 18px;
    background: linear-gradient(to top, rgba(0, 0, 0, .5), transparent);
}

.lb-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.lb-link {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .92);
    font-family: var(--mono);
    font-size: 11.5px;
    max-width: 100%;
    overflow: hidden;
    transition: background .16s;
}

.lb-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-link:hover {
    background: rgba(255, 255, 255, .18);
}

.lb-link svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    opacity: .7;
}

.lb-meta {
    margin-top: 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, .45);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* ---------------- Toast ---------------- */
.toast-wrap {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    color: var(--text);
    animation: toastIn .22s cubic-bezier(.2, .8, .3, 1);
    max-width: 90vw;
}

.toast.out {
    animation: toastOut .18s forwards;
}

.toast-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--success);
}

.toast.err .toast-dot {
    background: var(--danger);
}

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

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(.97);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateY(-8px) scale(.97);
    }
}

/* ---------------- 确认框 ---------------- */
.confirm-mask {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: grid;
    place-items: center;
    background: rgba(12, 14, 18, .42);
    backdrop-filter: blur(3px);
    animation: fadeIn .16s;
    padding: 20px;
}

.confirm-box {
    width: 100%;
    max-width: 380px;
    padding: 22px;
    border-radius: var(--radius-lg);
    background: var(--bg-elev);
    box-shadow: var(--shadow-lg);
    animation: pop .2s cubic-bezier(.2, .8, .3, 1);
}

@keyframes pop {
    from {
        opacity: 0;
        transform: scale(.96);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.confirm-box h3 {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
}

.confirm-box p {
    margin: 0 0 20px;
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.65;
}

.confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ---------------- 输入框 / 文件夹选择 ---------------- */
.confirm-input {
    width: 100%;
    margin-bottom: 18px;
}

.picker-box {
    max-width: 420px;
}

.picker-list {
    max-height: 320px;
    overflow-y: auto;
    margin: 2px -6px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 40px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    text-align: left;
}

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

.picker-item.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.picker-ico {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    color: var(--text-3);
    flex-shrink: 0;
}

.picker-item.active .picker-ico {
    color: var(--primary);
}

.picker-ico svg {
    width: 16px;
    height: 16px;
}

.picker-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.picker-num {
    font-style: normal;
    font-size: 11.5px;
    color: var(--text-3);
}

.picker-empty {
    padding: 18px 10px;
    text-align: center;
    color: var(--text-3);
    font-size: 12.5px;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
    .wrap {
        padding: 0 16px;
    }

    .topbar-inner {
        height: auto;
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .search-box {
        order: 3;
        max-width: none;
        flex-basis: 100%;
    }

    .user-chip {
        display: none;
    }

    .page-head {
        padding-top: 18px;
    }

    .stat-inline {
        gap: 12px;
        font-size: 11px;
    }

    .dropzone {
        padding: 16px;
        flex-wrap: wrap;
    }

    .dz-action {
        margin-left: 0;
        width: 100%;
    }

    .dz-action .btn {
        width: 100%;
    }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .lb-stage {
        padding: 0 12px 10px;
    }

    .lb-nav {
        display: none;
    }

    .upload-panel {
        left: 12px;
        right: 12px;
        width: auto;
        bottom: 12px;
    }
}


/* 超小屏：顶部操作只保留最关键的入口 */
@media (max-width: 560px) {
    .topbar-actions .btn-ghost {
        display: none;
    }

    .topbar-actions .btn {
        height: 32px;
        padding: 0 12px;
        font-size: 12px;
    }

    .brand span:last-child {
        font-size: 14px;
    }
}

/* 窄屏：文件夹按钮收成图标，胶囊独占一行方便横向滑动 */
@media (max-width: 680px) {
    .folder-bar {
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 14px;
    }

    .folder-chips {
        flex: 1 0 100%;
        order: 1;
        gap: 6px;
        padding-right: 2px;
    }

    .folder-tools {
        order: 2;
        margin-left: auto;
    }

    .chip {
        height: 30px;
        padding: 0 11px;
        font-size: 12px;
    }

    .folder-tools .btn {
        width: 32px;
        height: 32px;
        padding: 0;
        justify-content: center;
    }

    .folder-tools .btn-label {
        display: none;
    }
}

/* ==========================================================================
   1.5 批量操作 / 拖拽归档 / 列表视图
   ========================================================================== */

.toolbar-hint {
    font-size: 12px;
    color: var(--text-3);
}

.sort-select {
    height: 30px;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-elev);
    color: var(--text-2);
    font-family: var(--font);
    font-size: 12.5px;
    cursor: pointer;
}

.sort-select:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.seg-view button {
    display: grid;
    place-items: center;
    width: 30px;
    padding: 0;
}

.seg-view svg {
    width: 14px;
    height: 14px;
}

/* ---------------- 选择圈 ---------------- */

.pick-btn {
    position: absolute;
    left: 9px;
    top: 9px;
    z-index: 4;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1.5px solid rgba(255, 255, 255, .92);
    border-radius: 50%;
    background: rgba(0, 0, 0, .3);
    color: #fff;
    opacity: 0;
    backdrop-filter: blur(4px);
    transition: opacity .16s, background .16s, border-color .16s, transform .16s;
}

.pick-btn svg {
    width: 13px;
    height: 13px;
    opacity: 0;
    transition: opacity .12s;
}

.img-card:hover .pick-btn,
.img-card.picked .pick-btn,
body.selecting .pick-btn {
    opacity: 1;
}

.pick-btn:hover {
    transform: scale(1.1);
    background: rgba(0, 0, 0, .5);
}

.img-card.picked .pick-btn {
    background: var(--primary);
    border-color: var(--primary);
}

.img-card.picked .pick-btn svg {
    opacity: 1;
}

.img-card.picked {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-soft), var(--shadow-md);
}

.img-card.picked .img-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(37, 99, 235, .16);
    pointer-events: none;
}

.img-card.dragging {
    opacity: .4;
}

/* 拖动中：文件夹胶囊变成放置区 */
body.dragging-images .chip {
    border-style: dashed;
}

body.dragging-images .chip[data-folder=""] {
    opacity: .4;
}

.chip.drop-hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    border-style: solid;
    color: var(--primary);
    transform: translateY(-1px);
}

.chip.drop-hover em {
    color: var(--primary);
}

.chip.just-dropped {
    animation: chipPop .4s ease;
}

@keyframes chipPop {
    0% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.08);
    }

    100% {
        transform: scale(1);
    }
}

/* ---------------- 批量操作条 ---------------- */

.select-bar {
    position: fixed;
    left: 50%;
    bottom: 20px;
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: calc(100vw - 24px);
    padding: 8px 8px 8px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-elev);
    box-shadow: var(--shadow-lg);
    transform: translate(-50%, 16px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s, transform .18s;
}

.select-bar.show {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}

.sb-info {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 12.5px;
    color: var(--text-2);
    white-space: nowrap;
}

.sb-info b {
    font-size: 16px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.sb-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.sb-actions::-webkit-scrollbar {
    display: none;
}

.sb-actions .btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.sb-divider {
    width: 1px;
    height: 18px;
    background: var(--border);
    flex-shrink: 0;
}

.sb-close {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-3);
}

.sb-close:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.sb-close svg {
    width: 15px;
    height: 15px;
}

#selectBtn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

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

.grid.as-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elev);
    transition: border-color .15s, background .15s, box-shadow .15s;
}

.list-row:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-xs);
}

.list-row.picked {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.list-row.dragging {
    opacity: .4;
}

.list-pick {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    padding: 0;
    border: 1.5px solid var(--border-strong);
    border-radius: 50%;
    background: transparent;
    color: #fff;
    transition: background .15s, border-color .15s;
}

.list-pick svg {
    width: 12px;
    height: 12px;
    opacity: 0;
}

.list-row.picked .list-pick {
    background: var(--primary);
    border-color: var(--primary);
}

.list-row.picked .list-pick svg {
    opacity: 1;
}

.list-thumb {
    width: 64px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-sub);
    cursor: zoom-in;
}

.list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-main {
    flex: 1;
    min-width: 0;
}

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

.list-sub {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 3px;
    font-size: 11.5px;
    color: var(--text-3);
}

.list-sub .dot::before {
    content: '·';
    margin-right: 6px;
    color: var(--text-3);
}

.list-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.list-actions .act-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    color: var(--text-3);
    box-shadow: none;
    backdrop-filter: none;
}

.list-actions .act-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
    transform: none;
}

.list-actions .act-btn.danger:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

/* ---------------- 小屏适配 ---------------- */

@media (max-width: 900px) {
    .toolbar-hint {
        display: none;
    }
}

@media (max-width: 680px) {
    .toolbar-right {
        gap: 6px;
    }

    .sort-select {
        max-width: 96px;
    }

    .select-bar {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
        transform: translateY(16px);
        padding: 8px 8px 8px 12px;
        gap: 8px;
    }

    .select-bar.show {
        transform: translateY(0);
    }

    .sb-info span {
        display: none;
    }

    .img-actions {
        flex-wrap: wrap;
        gap: 5px;
        padding: 8px;
    }

    .act-btn {
        width: 28px;
        height: 28px;
    }

    .act-btn svg {
        width: 14px;
        height: 14px;
    }

    .list-row {
        gap: 9px;
        padding: 7px 9px;
    }

    .list-thumb {
        width: 52px;
        height: 40px;
    }

    .list-sub .hide-sm {
        display: none;
    }
}

/* 触屏设备没有 hover，选择圈常显 */
@media (hover: none) {
    .pick-btn {
        opacity: 1;
    }
}

.lb-title {
    min-width: 0;
}

/* 选择模式下整张卡片都是勾选目标 */
body.selecting .img-card {
    cursor: pointer;
}

.skeleton-row {
    height: 66px;
}

.list-row {
    cursor: default;
}

@media (max-width: 560px) {
    .lb-top {
        gap: 8px;
        padding: 12px 14px;
    }

    .lb-top .btn {
        padding: 0 10px;
    }

    #lbOpen {
        display: none;
    }
}

/* 透明状态的操作层不要挡住整张卡片的点击；触屏则常显 */
.img-actions {
    pointer-events: none;
}

.img-card:hover .img-actions,
.img-card:focus-within .img-actions {
    pointer-events: auto;
}

/* 触屏没有 hover，卡片上的小按钮会挤成一团，统一收进灯箱里操作 */
@media (hover: none) {
    .img-actions {
        opacity: 0;
        pointer-events: none;
    }
}

/* 手机上上传面板占满底部，此时先收起批量条，避免两层浮层叠在一起 */
@media (max-width: 680px) {
    body.uploading .select-bar {
        display: none;
    }
}
