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

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --bg: #f0f2f5;
    --card: #fff;
    --text: #2d3748;
    --text-light: #718096;
    --border: #e2e8f0;
    --success: #48bb78;
    --danger: #f56565;
    --sidebar-bg: #fff;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .06);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .15)
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px
}

a {
    color: var(--primary);
    text-decoration: none
}

a:hover {
    color: var(--primary-dark)
}

/* ===== 顶部导航 ===== */
.top-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .1)
}

.header-wrap {
    max-width: 1600px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 20px
}

.logo {
    font-size: 20px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0
}

.search-box {
    flex: 1;
    max-width: 500px;
    display: flex;
    background: rgba(255, 255, 255, .15);
    border-radius: 24px;
    padding: 3px
}

.search-box input {
    flex: 1;
    background: 0 0;
    border: none;
    padding: 8px 16px;
    color: #fff;
    font-size: 14px;
    outline: 0
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, .7)
}

.search-box button {
    background: rgba(255, 255, 255, .25);
    border: none;
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: background .2s
}

.search-box button:hover {
    background: rgba(255, 255, 255, .35)
}

.user-area {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0
}

.btn-login,
.btn-logout {
    border: 1px solid rgba(255, 255, 255, .3);
    color: #fff;
    cursor: pointer;
    border-radius: 20px;
    font-size: 13px;
    transition: all .2s
}

.btn-login {
    background: rgba(255, 255, 255, .2);
    padding: 8px 16px
}

.btn-login:hover {
    background: rgba(255, 255, 255, .3)
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px
}

.user-name {
    font-weight: 500
}

.user-lv,
.user-vip-expire {
    background: rgba(255, 255, 255, .2);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px
}

.user-vip-expire {
    cursor: pointer;
    transition: background .2s;
    white-space: nowrap
}

.user-vip-expire:hover {
    background: rgba(255, 255, 255, .3)
}

.btn-logout {
    background: rgba(255, 255, 255, .15);
    padding: 5px 12px;
    font-size: 12px;
    border-color: rgba(255, 255, 255, .25)
}

.btn-logout:hover {
    background: rgba(255, 255, 255, .25)
}

.user-admin-badge {
    background: #e67e22;
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s
}

.user-admin-badge:hover {
    background: #d35400
}

/* ===== 页面布局 ===== */
.page-layout {
    max-width: 1600px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start
}

.side-nav {
    width: 200px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: sticky;
    top: 72px;
    overflow: hidden
}

.nav-title {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, #667eea15, #764ba215)
}

.cat-list {
    list-style: none;
    max-height: calc(100vh - 200px);
    overflow-y: auto
}

.cat-list li {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid transparent;
    transition: all .2s;
    color: var(--text-light);
    font-size: 14px
}

.cat-list li:hover {
    background: #f7fafc;
    color: var(--text)
}

.cat-list li.active {
    background: linear-gradient(90deg, #667eea15, transparent);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500
}

.cat-list .count {
    background: #edf2f7;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: var(--text-light)
}

.cat-list li.active .count {
    background: var(--primary);
    color: #fff
}

.nav-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-light);
    text-align: center
}

.nav-footer span {
    color: var(--primary);
    font-weight: 600
}

.nav-tool-download {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    text-align: center
}

.tool-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: all .2s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, .3)
}

.tool-download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, .4);
    color: #fff
}

.tool-icon {
    font-size: 14px
}

/* ===== 主内容区 ===== */
.main-area {
    flex: 1;
    min-width: 0
}

.cat-bar {
    position: sticky;
    top: 56px;
    z-index: 50;
    background: var(--card);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow)
}

.cat-bar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px
}

.breadcrumb {
    font-size: 14px;
    color: var(--text-light);
    flex: 1;
    min-width: 0
}

.cat-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0
}

.cat-btn {
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    transition: all .2s;
    cursor: pointer;
    white-space: nowrap;
    border: none;
    font-family: inherit;
    line-height: 1.4
}

.cat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, .4);
    color: #fff
}

.cat-admin-buttons {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 8px;
    padding-left: 12px;
    border-left: 1px solid #e0e0e0
}

.cat-admin-btn {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid transparent;
    font-family: inherit;
    line-height: 1.4;
    transition: all .2s
}

.cat-admin-btn.refresh {
    background: #f0fff4;
    color: #38a169;
    border-color: #c6f6d5
}

.cat-admin-btn.refresh:hover {
    background: #c6f6d5;
    color: #2f855a
}

.cat-admin-btn.scan {
    background: #ebf8ff;
    color: #3182ce;
    border-color: #bee3f8
}

.cat-admin-btn.scan:hover {
    background: #bee3f8;
    color: #2b6cb0
}

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

.crumb-item:hover {
    text-decoration: underline
}

.crumb-sep {
    color: var(--border);
    margin: 0 6px
}

/* 子目录条 */
.sub-cat-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border)
}

.sub-cat {
    padding: 5px 12px;
    background: #f7fafc;
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
    color: var(--text-light)
}

.sub-cat em {
    font-style: normal;
    color: #a0aec0;
    font-size: 12px;
    margin-left: 2px
}

.sub-cat:hover,
.sub-cat:hover em {
    border-color: var(--primary);
    color: var(--primary)
}

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

.sub-cat.active em {
    color: rgba(255, 255, 255, .8)
}

/* ===== 素材网格 ===== */
.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px
}

.asset-card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all .2s
}

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

.asset-thumb {
    width: 100%;
    height: 200px;
    position: relative;
    background: #f0f5f1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-image: linear-gradient(45deg, #e8ebf0 25%, transparent 25%), linear-gradient(-45deg, #e8ebf0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e8ebf0 75%), linear-gradient(-45deg, transparent 75%, #e8ebf0 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0
}

.asset-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain
}

.asset-thumb .no-thumb {
    color: #cbd5e0;
    font-size: 14px
}

.asset-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px
}

.asset-info {
    padding: 10px 12px
}

.asset-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px
}

.asset-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1
}

.asset-tags {
    flex-shrink: 0;
    font-size: 11px;
    color: #4299e1;
    background: #ebf8ff;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default
}

.asset-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-light)
}

.card-download-btn {
    cursor: pointer;
    color: #ed8936;
    font-weight: 500;
    transition: color .2s;
    user-select: none
}

.card-download-btn:hover {
    color: #dd6b20;
    text-decoration: underline
}

.loading,
.empty-state {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light)
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px
}

.empty-state p {
    margin-bottom: 8px
}

.load-more-hint {
    grid-column: 1/-1;
    text-align: center;
    padding: 20px;
    color: #a0aec0;
    font-size: 13px
}

/* ===== 预览弹窗 ===== */
.modal,
.user-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .7);
    display: none;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px)
}

.modal {
    z-index: 1000
}

.modal.active,
.user-modal.active {
    display: flex
}

.user-modal {
    z-index: 2000
}

.modal-dialog,
.user-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, .3)
}

.modal-dialog {
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column
}

.preview-dialog {
    width: 1300px;
    min-width: 1300px;
    max-width: 95vw;
    height: 800px;
    min-height: 800px;
    max-height: 90vh
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 600
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f0f2f5;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-light);
    transition: all .2s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center
}

.close-btn:hover {
    background: #e2e8f0;
    color: var(--text)
}

.modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    min-height: 0
}

.preview-dialog .modal-body {
    flex-direction: row
}

.preview-dialog .preview-left {
    width: 200px;
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    min-height: 0
}

.preview-dialog .preview-left .file-list-block {
    flex: 1;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    max-height: none;
    min-height: 0
}

.preview-dialog .preview-left .file-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0
}

.preview-dialog .preview-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    min-height: 0
}

.preview-dialog .preview-canvas-container {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0
}

.preview-dialog .preview-sidebar {
    width: 240px;
    flex: 0 0 240px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0
}

.preview-dialog .preview-sidebar>div {
    flex-shrink: 0
}

.preview-canvas-container {
    background: #f0f2f5;
    border-radius: 8px;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 20px;
    background-image: linear-gradient(45deg, #e2e8f0 25%, transparent 25%), linear-gradient(-45deg, #e2e8f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e2e8f0 75%), linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0
}

#previewCanvas {
    image-rendering: pixelated;
    max-width: 100%
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px;
    background: #f7fafc;
    border-radius: 8px
}

.preview-controls button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all .2s
}

.preview-controls button:hover {
    border-color: var(--primary);
    color: var(--primary)
}

.frame-info {
    font-size: 13px;
    color: var(--text-light);
    font-family: Consolas, monospace
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-light)
}

.control-group input[type=range] {
    width: 100px;
    cursor: pointer
}

.preview-sidebar,
.preview-image-controls,
.info-block,
.download-block,
.file-list-block {
    background: #f7fafc;
    border-radius: 8px
}

.preview-sidebar {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    min-height: 0
}

.preview-image-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px
}

.file-list-block {
    padding: 12px;
    margin-bottom: 16px;
    max-height: 300px;
    overflow-y: auto
}

.file-list-block h4,
.info-block h4,
.download-block h4 {
    font-size: 14px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border)
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 4px
}

.file-list-item {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;
    cursor: pointer;
    color: var(--text);
    transition: all .15s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: Consolas, 'Courier New', monospace;
    display: flex;
    align-items: center;
    width: 100%;
    height: 32px
}

.file-list-item:hover {
    background: #e2e8f0
}

.file-list-item.active {
    background: var(--primary);
    color: #fff
}

.file-list-dir {
    margin-bottom: 2px
}

.file-list-dir-header {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #475569;
    font-weight: 500;
    transition: background .15s;
    user-select: none
}

.file-list-dir-header:hover {
    background: #e2e8f0
}

.file-list-dir-header .dir-arrow {
    font-size: 10px;
    margin-right: 4px;
    transition: transform .2s;
    color: #64748b
}

.file-list-dir.collapsed .dir-arrow {
    transform: rotate(-90deg)
}

.file-list-dir.collapsed .file-list-dir-content {
    display: none
}

.file-list-dir-content {
    margin-top: 2px;
    border-left: 1px dashed #cbd5e1;
    margin-left: 14px;
    padding-left: 4px
}

.info-block,
.download-block {
    padding: 16px;
    flex-shrink: 0
}

.info-block h4,
.download-block h4 {
    margin-bottom: 12px
}

.info-table {
    width: 100%;
    font-size: 13px
}

.info-table td {
    padding: 6px 0
}

.info-table td:first-child {
    color: var(--text-light);
    width: 60px
}

.dl-btn.full-width {
    width: 100%;
    justify-content: center;
    display: flex;
    padding: 12px 16px;
    font-size: 15px
}

.download-block .download-tip {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-light);
    text-align: center
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border)
}

.download-section {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 12px
}

.dl-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px
}

.dl-btn.png {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff
}

.dl-btn.plist {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: #fff
}

.dl-btn.zip {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: #fff
}

.dl-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15)
}

.dl-btn.locked {
    background: #edf2f7;
    color: var(--text-light);
    cursor: pointer
}

.dl-btn.locked:hover {
    background: #e2e8f0;
    color: var(--text)
}

.download-tip {
    text-align: center;
    font-size: 13px;
    color: var(--text-light)
}

/* ===== 管理操作 ===== */
.admin-block {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    padding: 16px;
    flex-shrink: 0
}

.admin-block h4 {
    font-size: 14px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #fed7d7;
    color: #c53030
}

.admin-btn-group {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.admin-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%
}

.admin-btn:disabled {
    opacity: .5;
    cursor: not-allowed
}

.admin-btn.rename {
    background: #4299e1;
    color: #fff
}

.admin-btn.rename:hover:not(:disabled) {
    background: #3182ce
}

.admin-btn.tags {
    background: #ed8936;
    color: #fff
}

.admin-btn.tags:hover:not(:disabled) {
    background: #dd6b20
}

.admin-btn.thumb {
    background: #3c834b;
    color: #fff
}

.admin-btn.delete {
    background: linear-gradient(135deg, #fc8181, #f56565);
    color: #fff
}

.admin-btn.delete:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 101, 101, .3)
}

/* ===== 用户弹窗 ===== */
.user-box {
    width: 380px;
    padding: 30px;
    position: relative
}

.user-box .close-btn {
    position: absolute;
    top: 15px;
    right: 15px
}

.user-box h2 {
    text-align: center;
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text)
}

.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px
}

.tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .2s
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 500
}

.form-item {
    margin-bottom: 16px
}

.form-item label {
    display: block;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 6px
}

.form-item input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    outline: 0;
    transition: border-color .2s
}

.form-item input:focus {
    border-color: var(--primary)
}

.error-msg {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 12px;
    min-height: 18px
}

.success-msg {
    color: var(--success);
    font-size: 13px;
    margin-bottom: 12px;
    text-align: center;
    padding: 8px;
    background: #f0fff4;
    border-radius: 6px
}

.renew-vip-info {
    background: linear-gradient(135deg, #667eea15, #764ba215);
    border: 1px solid #667eea30;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 20px;
    text-align: center
}

.renew-info-label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 6px
}

.renew-info-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary)
}

.btn-primary-full {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s
}

.btn-primary-full:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, .4)
}

.tip-text {
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    margin-top: 16px
}

/* ===== 管理后台 ===== */
.admin-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    color: #333
}

.admin-login-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center
}

.admin-login-page .login-box {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
    width: 360px
}

.admin-login-page .login-box h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 24px
}

.admin-login-page .login-box h1 span {
    color: #667eea
}

.admin-login-page .form-group {
    margin-bottom: 20px
}

.admin-login-page .form-group label {
    display: block;
    color: #666;
    margin-bottom: 8px;
    font-size: 14px
}

.admin-login-page .form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color .3s
}

.admin-login-page .form-group input:focus {
    outline: 0;
    border-color: #667eea
}

.admin-login-page .btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: transform .2s
}

.admin-login-page .btn:hover {
    transform: translateY(-2px)
}

.admin-login-page .error {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center
}

.admin-login-page .tip {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin-top: 15px
}

.admin-page .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 220px;
    height: 100vh;
    background: #2c3e50;
    color: #fff;
    padding-top: 20px;
    overflow-y: auto
}

.admin-page .sidebar .logo {
    padding: 0 20px 20px;
    font-size: 20px;
    font-weight: 700;
    border-bottom: 1px solid #34495e;
    margin-bottom: 10px
}

.admin-page .sidebar .logo span {
    color: #3498db
}

.admin-page .sidebar nav a {
    display: block;
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all .2s;
    border-left: 3px solid transparent
}

.admin-page .sidebar nav a:hover,
.admin-page .sidebar nav a.active {
    background: #34495e;
    color: #fff;
    border-left-color: #3498db
}

.admin-page .main {
    margin-left: 220px;
    padding: 20px
}

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

.admin-page .header h2 {
    font-size: 22px;
    color: #2c3e50
}

.admin-page .header .user-info {
    color: #7f8c8d;
    font-size: 14px
}

.admin-page .header .user-info a {
    color: #e74c3c;
    text-decoration: none;
    margin-left: 10px
}

.admin-page .card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
    margin-bottom: 20px
}

.admin-page .card h3 {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee
}

.admin-page .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px
}

.admin-page .stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05)
}

.admin-page .stat-card .num {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50
}

.admin-page .stat-card .label {
    font-size: 13px;
    color: #7f8c8d;
    margin-top: 5px
}

.admin-page .stat-card.blue .num {
    color: #3498db
}

.admin-page .stat-card.green .num {
    color: #27ae60
}

.admin-page .stat-card.orange .num {
    color: #e67e22
}

.admin-page .stat-card.purple .num {
    color: #9b59b6
}

.admin-page .stat-card.red .num {
    color: #e74c3c
}

.admin-page .stat-card.teal .num {
    color: #16a085
}

.admin-page .stat-card.pink .num {
    color: #e91e63
}

.admin-page .btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all .2s;
    text-decoration: none
}

.admin-page .btn-primary {
    background: #3498db;
    color: #fff
}

.admin-page .btn-primary:hover {
    background: #2980b9
}

.admin-page .btn-success {
    background: #27ae60;
    color: #fff
}

.admin-page .btn-success:hover {
    background: #219a52
}

.admin-page .btn-warning {
    background: #f39c12;
    color: #fff
}

.admin-page .btn-warning:hover {
    background: #e67e22
}

.admin-page .btn-danger {
    background: #e74c3c;
    color: #fff
}

.admin-page .btn-danger:hover {
    background: #c0392b
}

.admin-page .btn-sm {
    padding: 5px 10px;
    font-size: 12px
}

.admin-page .btn[disabled] {
    opacity: .5;
    cursor: not-allowed
}

.admin-page .alert {
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 15px
}

.admin-page .alert.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb
}

.admin-page .alert.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb
}

.admin-page .alert.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb
}

.admin-page table {
    width: 100%;
    border-collapse: collapse
}

.admin-page table th,
.admin-page table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 13px
}

.admin-page table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555
}

.admin-page table tr:hover {
    background: #f8f9fa
}

.admin-page .tag {
    display: inline-block;
    padding: 2px 8px;
    background: #eef2f7;
    color: #667eea;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 4px
}

.admin-page .progress-bar {
    width: 100%;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px
}

.admin-page .progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #27ae60);
    width: 0;
    transition: width .3s
}

.admin-page .log-area {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: 6px;
    font-family: Consolas, monospace;
    font-size: 13px;
    max-height: 300px;
    overflow-y: auto
}

.admin-page .log-area p {
    margin: 2px 0
}

.admin-page .log-area .success {
    color: #4ec9b0
}

.admin-page .log-area .error {
    color: #f48771
}

.admin-page .log-area .info {
    color: #569cd6
}

.admin-page .form-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px
}

.admin-page .form-row label {
    min-width: 100px;
    color: #555
}

.admin-page .form-row input,
.admin-page .form-row select {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px
}

.admin-page .form-row input:focus,
.admin-page .form-row select:focus {
    outline: 0;
    border-color: #3498db
}

.admin-page .cache-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 15px
}

.admin-page .cache-status .icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px
}

.admin-page .cache-status .icon.ok {
    background: #d4edda;
    color: #27ae60
}

.admin-page .cache-status .icon.no {
    background: #f8d7da;
    color: #e74c3c
}

.admin-page .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700
}

.admin-page .badge-green {
    background: #d4edda;
    color: #155724
}

.admin-page .badge-red {
    background: #f8d7da;
    color: #721c24
}

.admin-page .badge-gray {
    background: #e9ecef;
    color: #6c757d
}

.admin-page .badge-blue {
    background: #cce5ff;
    color: #004085
}

.admin-page .badge-purple {
    background: #e2d9f3;
    color: #5a32a3
}

.admin-page .badge-orange {
    background: #ffe5cc;
    color: #8a4a00
}

.admin-page .code-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between
}

.admin-page .code-toolbar-left,
.admin-page .code-toolbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap
}

.admin-page .code-toolbar-right {
    margin-left: auto
}

.admin-page .code-toolbar input,
.admin-page .code-toolbar select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px
}

.admin-page .code-toolbar input[type=checkbox],
.admin-page table input[type=checkbox] {
    width: 16px;
    height: 16px;
    cursor: pointer
}

.admin-page .user-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap
}

.admin-page .user-toolbar-left {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap
}

.admin-page .user-toolbar input,
.admin-page .user-toolbar select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px
}

.admin-page .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center
}

.admin-page .modal-box {
    background: #fff;
    border-radius: 8px;
    width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .15)
}

.admin-page .modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 16px
}

.admin-page .modal-close {
    cursor: pointer;
    font-size: 24px;
    color: #999;
    line-height: 1
}

.admin-page .modal-close:hover {
    color: #333
}

.admin-page .modal-body {
    padding: 20px;
    flex-direction: column
}

.admin-page .modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    text-align: right
}

.admin-page .modal-footer .btn {
    margin-left: 10px
}

.admin-page .form-item {
    margin-bottom: 16px
}

.admin-page .form-item label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #666
}

.admin-page .form-item input,
.admin-page .form-item select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color .3s
}

.admin-page .form-item input:focus,
.admin-page .form-item select:focus {
    outline: 0;
    border-color: #667eea
}

.admin-page .modal-footer .btn {
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: transform .2s
}

.admin-page .modal-footer .btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff
}

.admin-page .modal-footer .btn-primary:hover {
    transform: translateY(-1px)
}

.admin-page .code-item {
    font-family: Consolas, monospace;
    font-weight: 700;
    color: #2c3e50;
    letter-spacing: 1px
}

.admin-page .code-list {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 15px;
    display: none
}

.admin-page .code-list p {
    font-family: Consolas, monospace;
    padding: 4px 8px;
    margin: 2px 0;
    background: #fff;
    border-radius: 4px;
    font-size: 13px
}

.admin-page .log-type-auth {
    color: #3498db
}

.admin-page .log-type-download {
    color: #27ae60
}

.admin-page .log-type-user {
    color: #e67e22
}

.admin-page .log-type-code {
    color: #9b59b6
}

.admin-page .log-type-asset {
    color: #e91e63
}

.admin-page .log-type-cache {
    color: #16a085
}

.admin-page .log-type-system {
    color: #6c757d
}

.admin-page select.lv-select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px
}

.admin-page .menu-table {
    width: 100%;
    border-collapse: collapse
}

.admin-page .menu-table th,
.admin-page .menu-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    text-align: left
}

.admin-page .menu-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 13px
}

.admin-page .menu-row {
    cursor: pointer
}

.admin-page .menu-row:hover td {
    background: #f0f4ff !important
}

.admin-page .toggle-icon {
    display: inline-block;
    width: 16px;
    cursor: pointer;
    color: #667eea;
    font-size: 12px;
    transition: transform .2s;
    user-select: none
}

.admin-page .toggle-icon.collapsed {
    transform: rotate(-90deg)
}

.admin-page .toggle-placeholder {
    display: inline-block;
    width: 16px
}

.admin-page .menu-row.level-0 td {
    background: #fff;
    font-weight: 500
}

.admin-page .menu-row.level-1 td {
    background: #fafbfc
}

.admin-page .menu-row.level-2 td {
    background: #f5f6f8
}

.admin-page .menu-row.hidden {
    display: none
}

.admin-page .btn-scan {
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer
}

.admin-page .btn-scan:hover {
    background: #5a67d8
}

.admin-page .btn-refresh-dir {
    background: #48bb78;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer
}

.admin-page .btn-refresh-dir:hover {
    background: #38a169
}

.admin-page .toolbar-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

.admin-page .refresh-btn {
    background: #48bb78;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px
}

.admin-page .refresh-btn:hover {
    background: #38a169
}

.admin-page .cleanup-btn {
    background: #ed8936;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px
}

.admin-page .cleanup-btn:hover {
    background: #dd6b20
}

.admin-page .delete-all-btn {
    background: #f56565;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px
}

.admin-page .delete-all-btn:hover {
    background: #e53e3e
}

.admin-page .sync-btn {
    background: #4299e1;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px
}

.admin-page .sync-btn:hover {
    background: #3182ce
}

/* ===== 响应式 ===== */
@media(max-width:1024px) {
    .page-layout {
        flex-direction: column
    }

    .side-nav {
        width: 100%;
        position: static
    }

    .cat-list {
        max-height: none;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        padding: 8px
    }

    .cat-list li {
        border-left: none;
        border-bottom: 2px solid transparent;
        padding: 8px 14px;
        white-space: nowrap
    }

    .cat-list li.active {
        border-left: none;
        border-bottom-color: var(--primary)
    }

    .modal-body {
        flex-direction: column
    }

    .preview-sidebar {
        width: 100%
    }

    .preview-dialog .modal-body {
        flex-direction: row
    }

    .preview-dialog .preview-left {
        width: 200px;
        flex: 0 0 200px
    }

    .preview-dialog .preview-sidebar {
        width: 240px;
        flex: 0 0 240px
    }
}

@media(max-width:640px) {
    .header-wrap {
        flex-wrap: wrap
    }

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

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

    .asset-thumb {
        height: 120px
    }

    .user-box {
        width: 90%;
        padding: 20px
    }

    .preview-controls {
        justify-content: center
    }

    .user-lv {
        display: none
    }
}