/**
 * SHOPAGG Admin Panel Styles
 * 统一后台样式管理
 */

/* ==================== CSS 变量 ==================== */
:root {
    --primary-solid: #4f46e5;
    --info-solid: #0891b2;
    --success-solid: #059669;
    --warning-solid: #d97706;
    --danger-solid: #dc2626;
    --dark-solid: #334155;
    --link-solid: #2563eb;
    --card-shadow: 0 4px 20px rgba(0,0,0,0.08);
    --card-hover-shadow: 0 12px 40px rgba(0,0,0,0.12);
    --border-radius: 16px;
    --border-radius-sm: 12px;
    --border-radius-xs: 10px;
    --border-radius-pill: 50px;
}

/* ==================== 全局基础样式 ==================== */
body { 
    background: #f5f7fb;
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif; 
}

.admin-main { flex: 1; }
.relative { position: relative; }

/* ==================== Tailwind 过渡兼容层 ==================== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

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

img,
video {
    max-width: 100%;
}

.container {
    width: min(1200px, calc(100% - 2rem));
    margin-inline: auto;
}

.label {
    display: block;
    margin-bottom: 0.5rem;
    color: #334155;
    font-size: 0.875rem;
    font-weight: 600;
}

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

.table th,
.table td {
    text-align: left;
}

.image.is-3by2 {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
}

.image.is-3by2 img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.is-hidden { display: none !important; }
.is-expanded { width: 100%; }
.is-left { left: 0; }

/* ==================== 页面头部样式 ==================== */
.page-header {
    background: var(--primary-solid);
    border-radius: var(--border-radius);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    color: white;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

.page-header h1 {
    color: white !important;
    margin-bottom: 0.5rem !important;
    font-weight: 700;
    line-height: 1.3;
}

/* ==================== 统一表格样式 ==================== */
.card {
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.admin-table {
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
    overflow: hidden;
}
.admin-table table { width: 100%; border-collapse: collapse; }
.admin-table thead th {
    position: sticky; top: 0;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1.25rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}
.admin-table tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: #f8fafc; }

/* ==================== 统一Tabs样式 ==================== */
.modern-tabs {
    background: white;
    border-radius: var(--border-radius-sm);
    padding: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 1.5rem;
    display: inline-flex;
    gap: 0.25rem;
}

.modern-tabs a {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    color: #64748b;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
    text-decoration: none;
}

.modern-tabs a:hover {
    background: #f1f5f9;
    color: #334155;
}

.modern-tabs a.is-active {
    background: var(--primary-solid);
    color: white;
}

/* ==================== 分区标题 ==================== */
.section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title .icon-box {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.section-title .icon-box.primary { background: rgba(102, 126, 234, 0.15); color: #667eea; }
.section-title .icon-box.info { background: rgba(23, 162, 184, 0.15); color: #17a2b8; }
.section-title .icon-box.success { background: rgba(40, 167, 69, 0.15); color: #28a745; }
.section-title .icon-box.warning { background: rgba(255, 193, 7, 0.15); color: #d39e00; }
.section-title .icon-box.danger { background: rgba(220, 53, 69, 0.15); color: #dc3545; }

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #94a3b8;
}

.empty-state > :first-child {
    height: 5rem;
    width: 5rem;
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state > button > :first-child {
    font-size: 1.6rem;
    margin-bottom: 0rem;
    opacity: 0.5;
}
.empty-state p {
    font-size: 1rem;
}

/* ==================== 导航样式 ==================== */
.admin-navbar { 
    background: white;
    border-bottom: 1px solid #edf2f7; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.04); 
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 二级导航 */
.admin-subnav { 
    background: #fff; 
    border-bottom: 1px solid #edf2f7; 
    padding: 0; 
    margin-bottom: 1.5rem; 
}

.admin-subnav .container { 
    display: flex; 
    align-items: stretch; 
    overflow-x: auto; 
    white-space: nowrap; 
    -webkit-overflow-scrolling: touch; 
}

/* 隐藏滚动条但保持功能 */
.admin-subnav .container::-webkit-scrollbar { display: none; }
.admin-subnav .container { -ms-overflow-style: none; scrollbar-width: none; }

/* ==================== 媒体库相关样式 ==================== */
.media-library-modal-card {
    width: min(1180px, 94vw);
    max-width: none;
}

.media-library-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 1rem;
}

.media-library-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
}

.media-library-toolbar-main {
    min-width: 240px;
}

.media-library-toolbar-buttons {
    justify-content: flex-end;
}

.media-library-status {
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.media-library-status.is-success {
    background: #ecfdf5;
    color: #166534;
}

.media-library-status.is-danger {
    background: #fef2f2;
    color: #991b1b;
}

.media-library-status.is-info {
    background: #eff6ff;
    color: #1d4ed8;
}

.media-library-empty {
    min-height: 320px;
    border: 1px dashed #d1d5db;
    border-radius: 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #64748b;
    padding: 2rem;
    grid-column: 1 / -1;
}

.media-library-folder-tile,
.media-library-tile {
    position: relative;
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #fff;
    padding: 0;
    overflow: hidden;
    text-align: left;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.04);
}

.media-library-folder-tile:hover,
.media-library-tile:hover,
.media-library-tile.is-active,
.media-library-tile.is-selected {
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 16px 36px rgba(102, 126, 234, 0.14);
}

.media-library-folder-tile {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    min-height: 170px;
    padding: 1rem;
}

.media-library-folder-tile-icon > span {
    color: #f59e0b;
}

.media-library-folder-tile small {
    color: #64748b;
}

.media-library-thumb {
    position: relative;
    aspect-ratio: 1;
    background: #f8fafc;
}

.media-library-select-toggle {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 999px;
    font-size: 0.72rem;
    color: #334155;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.media-library-select-toggle input {
    margin: 0;
}

.media-library-thumb img,
.media-library-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-library-video-badge {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.media-library-tile-body {
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.media-library-tile-body strong,
.media-library-tile-body span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-library-tile-body span {
    color: #64748b;
    font-size: 0.75rem;
}

.media-library-details {
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #fff;
    padding: 1rem;
    min-height: 100%;
}

.media-library-details-placeholder {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #94a3b8;
}

.media-library-details-preview {
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 1rem;
}

.media-library-details-preview img,
.media-library-details-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-library-detail-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.9rem;
}

.media-library-detail-row span {
    font-size: 0.75rem;
    color: #64748b;
}

.media-library-detail-row strong {
    font-size: 0.92rem;
    color: #111827;
    word-break: break-word;
}

.media-library-footer {
    justify-content: flex-end;
}

.media-library-window {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 0.9rem;
}

.media-library-window-nav,
.media-library-window-statusbar {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #f8fafc;
    padding: 0.4rem 1rem;
}

.media-library-window-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.media-library-filter-bar {
    min-width: 360px;
    flex: 1;
}

.media-library-window-main {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 290px;
    flex: 1;
    min-height: 0;
    max-height: calc(100vh - 18rem);
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
}

.media-library-tree-panel,
.media-library-preview-panel {
    background: #f8fafc;
    padding: 1rem;
}

.media-library-tree-panel {
    border-right: 1px solid #e5e7eb;
}

.media-library-preview-panel {
    border-left: 1px solid #e5e7eb;
}

.media-library-tree-panel,
.media-library-preview-panel,
.media-library-files-panel {
    min-height: 0;
}

.media-library-tree-panel #media-library-tree,
.media-library-preview-panel .media-library-details,
.media-library-file-list {
    overflow: auto;
}

.media-library-pane-title {
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.9rem;
}

.media-library-tree-root,
.media-library-tree-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 10px;
    padding: 0.42rem 0.6rem;
    color: #1e293b;
}

.media-library-tree-root:hover,
.media-library-tree-link:hover {
    background: #e8eefc;
}

.media-library-tree-root.is-current,
.media-library-tree-node.is-current > .media-library-tree-row .media-library-tree-link {
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 600;
}

.media-library-tree-list {
    margin: 0;
    padding-left: 0.85rem;
}

.media-library-tree-row {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.media-library-tree-toggle {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.media-library-tree-toggle:hover {
    background: #e2e8f0;
    color: #334155;
}

.media-library-tree-toggle > span {
    transition: transform 0.15s ease;
}

.media-library-tree-toggle.is-expanded > span {
    transform: rotate(90deg);
}

.media-library-tree-toggle.is-empty {
    visibility: hidden;
}

.media-library-tree-children.is-collapsed {
    display: none;
}

.media-library-tree-node {
    list-style: none;
}

.media-library-tree-node.is-ancestor > .media-library-tree-row .media-library-tree-link {
    background: rgba(219, 234, 254, 0.55);
}

.media-library-files-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    background: #fff;
}

.media-library-file-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.media-library-file-header,
.media-library-file-row,
.media-library-folder-row {
    display: grid;
    grid-template-columns: 46px minmax(220px, 2fr) 90px minmax(130px, 1.1fr) 120px;
    gap: 0.75rem;
    align-items: center;
}

.media-library-file-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.media-library-file-list {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.media-library-file-list.is-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.9rem;
    padding: 1rem;
    align-content: start;
    background: #f8fafc;
}

.media-library-file-row,
.media-library-folder-row {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
    transition: background 0.18s ease;
    cursor: pointer;
    text-align: left;
}

.media-library-file-row:hover,
.media-library-folder-row:hover,
.media-library-file-row.is-selected,
.media-library-file-row.is-active {
    background: #eef5ff;
}

.media-library-folder-row {
    color: #0f172a;
}

.media-library-file-col {
    min-width: 0;
}

.media-library-file-col.check {
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-library-file-col.check .media-library-select-toggle {
    position: static;
    top: auto;
    left: auto;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.media-library-file-col.name {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.media-library-row-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    overflow: hidden;
    flex-shrink: 0;
}

.media-library-row-icon.folder {
    color: #f59e0b;
}

.media-library-row-icon.video {
    color: #0f766e;
}

.media-library-row-icon.image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-library-row-name {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.media-library-row-name strong,
.media-library-row-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-library-row-name span {
    font-size: 0.75rem;
    color: #64748b;
}

.media-library-folder-tile-explorer,
.media-library-file-tile {
    box-shadow: none;
    border-radius: 14px;
}

.media-library-folder-tile-explorer {
    min-height: 0;
    align-items: flex-start;
    padding: 1rem;
}

.media-library-folder-tile-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: #fef3c7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #b45309;
}

.media-library-file-tile .media-library-thumb {
    aspect-ratio: 4 / 3;
}

.media-library-file-tile.is-selected,
.media-library-file-tile.is-active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.media-library-file-tile .media-library-select-toggle {
    position: absolute;
}

.media-library-window-statusbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    color: #475569;
    font-size: 0.84rem;
}

/* ==================== 移动端管理体验优化 ==================== */
.admin-nav-toggle {
    flex-direction: column;
    gap: 4px;
}

.admin-nav-toggle > span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.admin-nav-toggle.is-active > span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.admin-nav-toggle.is-active > span:nth-child(2) {
    opacity: 0;
}

.admin-nav-toggle.is-active > span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.admin-nav-mobile-header {
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.35rem 0.35rem 0.9rem;
    border-bottom: 1px solid #e2e8f0;
}

.admin-nav-mobile-header strong,
.admin-nav-mobile-header span {
    display: block;
}

.admin-nav-mobile-header strong {
    color: #0f172a;
    font-size: 1rem;
}

.admin-nav-mobile-header span {
    margin-top: 0.15rem;
    color: #94a3b8;
    font-size: 0.75rem;
}

.admin-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1001;
    width: 100%;
    border: 0;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(2px);
}

[data-profile-menu].is-open .admin-profile-dropdown {
    visibility: visible;
    opacity: 1;
}

.admin-main :where(button, a, input, select, textarea):focus-visible,
.admin-navbar :where(button, a):focus-visible,
.admin-subnav a:focus-visible {
    outline: 3px solid rgba(99, 102, 241, 0.28);
    outline-offset: 2px;
}

.admin-table > .overflow-x-auto,
.admin-table .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

@media screen and (max-width: 1023px) {
    body.admin-nav-open {
        overflow: hidden;
        touch-action: none;
    }

    .admin-navbar {
        position: sticky;
        top: 0;
        z-index: 1000;
        height: 68px;
    }

    .admin-navbar-inner {
        width: calc(100% - 1rem);
        padding-block: 0.55rem;
    }

    .admin-navbar-brand {
        min-width: 0;
    }

    .admin-navbar .logo-link {
        padding: 0.35rem;
    }

    .admin-navbar .logo-link img {
        width: auto;
        max-width: min(48vw, 190px);
        height: 32px;
        object-fit: contain;
    }

    .admin-nav-menu {
        position: fixed;
        inset: 0 0 0 auto;
        z-index: 1002;
        width: min(88vw, 360px) !important;
        height: 100dvh;
        max-height: 100dvh;
        overflow-y: auto;
        overscroll-behavior: contain;
        border: 0 !important;
        border-radius: 24px 0 0 24px !important;
        padding: max(0.9rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom)) !important;
        box-shadow: -24px 0 60px rgba(15, 23, 42, 0.22) !important;
        animation: admin-drawer-in 0.2s ease-out;
    }

    .admin-nav-mobile-header {
        display: flex;
    }

    .admin-nav-menu > div:nth-child(2) > a {
        min-height: 48px;
        padding-inline: 1rem;
    }

    .admin-profile-area {
        margin-top: auto;
        padding-top: 0.75rem;
        border-top: 1px solid #e2e8f0;
    }

    .admin-profile-dropdown {
        position: static !important;
        width: 100%;
        min-width: 0 !important;
        max-height: 0;
        overflow: hidden;
        padding-top: 0 !important;
        pointer-events: none;
        transform: translateY(-4px);
    }

    [data-profile-menu].is-open .admin-profile-dropdown {
        max-height: 240px;
        padding-top: 0.5rem !important;
        pointer-events: auto;
        transform: translateY(0);
    }

    .admin-profile-dropdown > div {
        box-shadow: none;
    }

    .admin-subnav {
        position: sticky;
        top: 68px;
        z-index: 40;
        margin-bottom: 0;
        box-shadow: 0 5px 16px rgba(15, 23, 42, 0.04);
    }

    .admin-subnav .container {
        width: 100%;
        padding-inline: 0.5rem;
        scroll-snap-type: x proximity;
    }

    .admin-subnav a {
        min-height: 46px;
        scroll-snap-align: start;
    }

    .media-library-window-main {
        grid-template-columns: minmax(0, 1fr);
    }

    .media-library-tree-panel,
    .media-library-preview-panel {
        display: none;
    }

    .explorer-main {
        grid-template-columns: minmax(0, 1fr);
        min-height: 0;
    }

    .explorer-sidebar,
    .explorer-preview-pane {
        display: none;
    }

    .explorer-filter-bar {
        width: 100%;
        min-width: 0;
    }
}

@keyframes admin-drawer-in {
    from { transform: translateX(24px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media screen and (max-width: 768px) {
    :root {
        --border-radius: 14px;
        --border-radius-sm: 12px;
    }

    .container {
        width: calc(100% - 1rem);
    }

    .admin-content-section {
        padding: 1rem 0.25rem 1.5rem !important;
    }

    .page-header,
    .dashboard-header {
        margin-bottom: 1rem;
        padding: 1.1rem !important;
        border-radius: 14px;
        box-shadow: 0 8px 24px rgba(76, 81, 191, 0.2);
    }

    .page-header h1,
    .dashboard-header h1 {
        font-size: 1.35rem !important;
        line-height: 1.35;
    }

    .page-header p,
    .dashboard-header p {
        line-height: 1.55;
    }

    .header-actions {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 0.6rem !important;
    }

    .header-actions > * {
        min-width: 0;
        justify-content: center;
        text-align: center;
    }

    .admin-main .card.p-8,
    .admin-main .card.p-6,
    .admin-main .rounded-2xl.p-8,
    .admin-main .rounded-2xl.p-6 {
        padding: 1rem !important;
    }

    .admin-main :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
        max-width: 100%;
        font-size: 16px !important;
    }

    .admin-main :where(button, input, select, textarea),
    .admin-navbar button {
        touch-action: manipulation;
    }

    .section-title {
        margin-bottom: 1rem;
        font-size: 1rem;
        gap: 0.6rem;
    }

    .section-title .icon-box {
        width: 34px;
        height: 34px;
    }

    .admin-main .grid.grid-cols-2 {
        grid-template-columns: minmax(0, 1fr);
    }

    .admin-table {
        border-radius: 12px;
    }

    .admin-table table {
        min-width: 680px;
    }

    .admin-table thead th {
        padding: 0.7rem 0.85rem;
    }

    .admin-table tbody td {
        padding: 0.85rem;
    }

    .admin-table > .flex,
    .admin-table > .flex > .flex {
        align-items: stretch;
    }

    .admin-table > .flex button {
        min-height: 42px;
        flex: 1 1 auto;
        justify-content: center;
    }

    .modern-tabs {
        margin-bottom: 1rem;
        padding: 0.35rem;
        scroll-snap-type: x proximity;
    }

    .modern-tabs a {
        flex: 0 0 auto;
        min-height: 42px;
        padding: 0.65rem 1rem;
        scroll-snap-align: start;
    }

    .stat-card {
        display: grid;
        grid-template-columns: 46px minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.15rem 0.9rem;
        min-height: 104px;
        padding: 1rem;
    }

    .stat-card:hover,
    .quick-action:hover {
        transform: none;
    }

    .stat-icon {
        grid-row: 1 / span 3;
        width: 46px;
        height: 46px;
        margin: 0;
        font-size: 1.1rem;
    }

    .stat-value {
        grid-column: 2;
        font-size: 1.8rem;
    }

    .stat-label {
        grid-column: 2;
    }

    .stat-badge,
    .stat-card > a {
        grid-column: 3;
        align-self: center;
        margin-top: 0 !important;
        white-space: nowrap;
    }

    .stat-badge {
        grid-row: 1;
    }

    .stat-card > a {
        grid-row: 2;
    }

    .quick-action {
        min-height: 70px;
        padding: 0.85rem 1rem;
    }

    .activity-card {
        padding: 1rem;
    }

    .footer {
        padding-block: 1rem !important;
    }

    .footer p {
        font-size: 0.8rem;
    }

    #editor-wrapper .jodit-toolbar__box {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #editor-wrapper .jodit-toolbar-editor-collection {
        min-width: max-content;
    }

    #media-library-modal,
    #product-selector-modal {
        padding: 0 !important;
    }

    .media-library-modal-card,
    #product-selector-modal > .relative.z-10 {
        width: 100vw !important;
        height: 100dvh;
        max-height: 100dvh !important;
        border-radius: 0 !important;
    }

    .media-library-modal-card > header,
    #product-selector-modal header {
        padding: max(0.75rem, env(safe-area-inset-top)) 1rem 0.75rem !important;
    }

    .media-library-modal-card > header button,
    #product-selector-modal header button {
        width: 40px !important;
        height: 40px !important;
        flex-shrink: 0;
    }

    .media-library-body {
        padding: 0.6rem;
    }

    .media-library-window {
        gap: 0.6rem;
    }

    .media-library-window-nav,
    .media-library-window-statusbar {
        padding: 0.55rem;
        border-radius: 10px;
    }

    .media-library-window-nav > div:first-child button {
        width: 40px !important;
        height: 40px !important;
    }

    .media-library-toolbar {
        gap: 0.6rem;
    }

    .media-library-toolbar-buttons {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 0.5rem !important;
    }

    .media-library-toolbar-buttons > * {
        width: auto;
        min-height: 42px;
        justify-content: center;
        padding-inline: 0.65rem;
    }

    .media-library-filter-bar {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        width: 100%;
        min-width: 0;
        gap: 0.5rem !important;
    }

    .media-library-filter-bar > input {
        grid-column: 1 / -1;
        min-width: 0 !important;
    }

    .media-library-filter-bar > select {
        min-width: 0 !important;
    }

    .media-library-window-main {
        max-height: none;
        border-radius: 12px;
    }

    .media-library-file-list.is-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
        padding: 0.6rem;
    }

    .media-library-footer,
    #product-selector-modal footer {
        padding: 0.75rem 1rem max(0.75rem, env(safe-area-inset-bottom)) !important;
    }

    .media-library-footer > *,
    #product-selector-modal footer > * {
        min-height: 44px;
        flex: 1;
    }

    #product-selector-modal > .relative.z-10 > section {
        gap: 0.65rem;
        padding: 0.75rem !important;
        overflow-y: auto;
    }

    #product-selector-modal > .relative.z-10 > section > .grid:last-child {
        display: flex;
        min-height: 520px;
        flex-direction: column;
    }

    #product-selector-modal > .relative.z-10 > section > .grid:last-child > div {
        min-height: 330px;
    }

    #product-selector-modal > .relative.z-10 > section > .grid:last-child > aside {
        min-height: 170px;
        max-height: 220px;
    }

    .explorer-topbar,
    .explorer-toolbar {
        align-items: stretch;
        padding: 0.75rem;
    }

    .explorer-topbar-left,
    .explorer-breadcrumbs,
    .explorer-toolbar > div:first-child {
        width: 100%;
        min-width: 0;
    }

    .explorer-toolbar > div:first-child {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem !important;
    }

    .explorer-toolbar > div:first-child > * {
        justify-content: center;
        min-width: 0;
        padding-inline: 0.65rem;
    }

    .explorer-folder-strip {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        padding: 0.75rem 0.75rem 0;
    }

    .explorer-folder-chip-wrap,
    .explorer-folder-chip {
        width: 100%;
        min-width: 0;
    }

    .explorer-file-header {
        display: none;
    }

    .explorer-file-row {
        grid-template-columns: 34px minmax(0, 1fr) auto;
        gap: 0.55rem;
        padding: 0.75rem;
    }

    .explorer-file-row > :nth-child(3),
    .explorer-file-row > :nth-child(4),
    .explorer-file-row > :nth-child(5) {
        display: none;
    }

    .explorer-thumb {
        width: 42px;
        height: 42px;
    }

    .explorer-actions {
        gap: 0.25rem;
    }

    .explorer-actions button {
        width: 40px !important;
        height: 40px !important;
    }

    .login-container {
        padding: max(1rem, env(safe-area-inset-top)) 0.75rem max(1rem, env(safe-area-inset-bottom));
    }

    .login-card {
        padding: 1.5rem 1.1rem;
    }
}

@media screen and (max-width: 480px) {
    .header-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .stat-card {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .stat-icon {
        width: 44px;
        height: 44px;
    }

    .stat-badge,
    .stat-card > a {
        grid-column: 2;
        grid-row: auto;
        justify-self: start;
        margin-top: 0.35rem !important;
    }

    .media-library-toolbar-buttons {
        grid-template-columns: minmax(0, 1fr);
    }

    .explorer-actions button:nth-child(2) {
        display: none;
    }
}

@media screen and (max-width: 640px) {
    .admin-table > .overflow-x-auto,
    .admin-table .overflow-x-auto {
        overflow: visible;
    }

    .responsive-admin-table {
        display: block;
        min-width: 0 !important;
        background: #f1f5f9;
    }

    .responsive-admin-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .responsive-admin-table tbody {
        display: grid;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .responsive-admin-table tbody tr {
        position: relative;
        display: block;
        overflow: hidden;
        border: 1px solid #e2e8f0;
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    }

    .responsive-admin-table tbody tr:hover {
        background: #fff;
    }

    .responsive-admin-table tbody td {
        display: grid;
        grid-template-columns: minmax(76px, 0.32fr) minmax(0, 1fr);
        align-items: start;
        gap: 0.75rem;
        width: 100%;
        min-width: 0;
        padding: 0.7rem 0.85rem;
        border-bottom: 1px solid #f1f5f9;
        white-space: normal;
    }

    .responsive-admin-table tbody td::before {
        content: attr(data-mobile-label);
        color: #94a3b8;
        font-size: 0.72rem;
        font-weight: 700;
        line-height: 1.5;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .responsive-admin-table tbody td:last-child {
        border-bottom: 0;
    }

    .responsive-admin-table .mobile-selection-cell {
        position: absolute;
        top: 0.75rem;
        right: 0.75rem;
        z-index: 2;
        display: block;
        width: auto;
        padding: 0;
        border: 0;
    }

    .responsive-admin-table .mobile-selection-cell::before,
    .responsive-admin-table .mobile-action-cell::before,
    .responsive-admin-table .mobile-full-cell::before {
        display: none;
    }

    .responsive-admin-table .mobile-action-cell {
        display: block;
        padding-top: 0.8rem;
        background: #f8fafc;
    }

    .responsive-admin-table .mobile-action-cell > :where(div, form) {
        justify-content: flex-start;
    }

    .responsive-admin-table .mobile-action-cell :where(a, button) {
        min-width: 40px;
        min-height: 40px;
        justify-content: center;
    }

    .responsive-admin-table .mobile-full-cell {
        display: block;
        padding: 1.25rem;
        text-align: center;
    }
}

@media screen and (max-width: 374px) {
    .admin-nav-menu {
        width: 100vw !important;
        border-radius: 0 !important;
    }

    .admin-subnav a {
        padding-inline: 0.75rem;
    }

    .media-library-file-list.is-tiles {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* 媒体网格样式 */
#media-container { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); 
    gap: 10px; 
}

.media-item { 
    aspect-ratio: 1/1; 
    border: 2px solid #e5e7eb; 
    border-radius: var(--border-radius-sm); 
    overflow: hidden; 
    background: #fff; 
    cursor: grab; 
    position: relative; 
    transition: all 0.2s; 
}

.media-item:hover { border-color: #667eea; }
.media-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-remove-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 10;
    width: 1.9rem;
    height: 1.9rem;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.96);
    color: #fff;
    box-shadow: 0 8px 18px rgba(239, 68, 68, 0.3);
    transition: transform 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.media-remove-btn:hover {
    background: #dc2626;
    box-shadow: 0 10px 20px rgba(220, 38, 38, 0.34);
    transform: scale(1.06);
}

.media-remove-btn:focus-visible {
    outline: 2px solid rgba(248, 113, 113, 0.45);
    outline-offset: 2px;
}

.media-remove-btn i {
    pointer-events: none;
}

.media-add-btn { 
    aspect-ratio: 1/1; 
    border: 2px dashed #d1d5db; 
    border-radius: var(--border-radius-sm); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    cursor: pointer; 
    background: #fafafa; 
    transition: all .2s; 
}

.media-add-btn:hover { 
    border-color: #667eea; 
    background: rgba(102, 126, 234, 0.05); 
}

.media-placeholder { 
    border: 2px dashed #d1d5db; 
    border-radius: var(--border-radius-sm); 
    padding: 40px; 
    text-align: center; 
    background: #fafafa; 
}



/* ==================== 统计卡片 ==================== */
.stat-mini {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--border-radius-sm);
}

.stat-mini .icon-box {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.stat-mini .stat-info .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.stat-mini .stat-info .label {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
}

/* ==================== 动画 ==================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 登录页样式 ==================== */
body.login-page {
    background: #eef2ff !important;
    min-height: 100vh;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 24px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.3);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.5s ease;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo .icon-wrap {
    width: 80px;
    height: 80px;
    background: #4f46e5;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin-bottom: 1rem;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.login-logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.login-logo p {
    color: #94a3b8;
    font-size: 0.875rem;
}

.login-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    background: #4f46e5;
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 0.5rem;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f1f5f9;
}

.login-footer a {
    color: #667eea;
    font-size: 0.875rem;
}

/* ==================== 仪表盘样式 ==================== */
.dashboard-header {
    background: #4f46e5;
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    color: white;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

.dashboard-header h1 {
    color: white !important;
    margin-bottom: 0.5rem;
}

.dashboard-header .subtitle {
    color: rgba(255,255,255,0.85);
}

/* 统计卡片 */
.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0,0,0,0.04);
    transition: all 0.3s ease;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.stat-card.primary::before { background: #4f46e5; }
.stat-card.info::before { background: #0891b2; }
.stat-card.success::before { background: #059669; }
.stat-card.warning::before { background: #d97706; }
.stat-card.danger::before { background: #dc2626; }
.stat-card.link::before { background: #2563eb; }
.stat-card.dark::before { background: #334155; }

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stat-icon.primary { background: #4f46e5; color: white; }
.stat-icon.info { background: #0891b2; color: white; }
.stat-icon.success { background: #059669; color: white; }
.stat-icon.warning { background: #d97706; color: white; }
.stat-icon.danger { background: #dc2626; color: white; }
.stat-icon.link { background: #2563eb; color: white; }
.stat-icon.dark { background: #334155; color: white; }

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
    color: #1e293b;
}

.stat-label {
    font-size: 0.875rem;
    color: #718096;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--border-radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.75rem;
}

.stat-badge.up {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.stat-badge.down {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.stat-badge.neutral {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

/* 活动卡片 */
.activity-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0,0,0,0.04);
}

.activity-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.activity-stat {
    text-align: center;
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    background: #f7fafc;
    transition: all 0.2s;
}

.activity-stat:hover {
    background: #edf2f7;
}

.activity-stat .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d3748;
}

.activity-stat .label {
    font-size: 0.75rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

.activity-stat.highlight .value {
    color: #667eea;
}

/* 快捷操作 */
.quick-action {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    background: white;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.04);
    transition: all 0.3s ease;
    text-decoration: none;
    color: #4a5568;
    gap: 1rem;
}

.quick-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    color: #667eea;
}

.quick-action .action-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.quick-action .action-text {
    font-weight: 600;
    font-size: 0.9375rem;
}

.quick-action .action-desc {
    font-size: 0.75rem;
    color: #a0aec0;
    margin-top: 0.125rem;
}

/* 迷你图表 */
.mini-chart {
    height: 60px;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    margin-top: 1rem;
}

.mini-chart .bar {
    flex: 1;
    background: #4f46e5;
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.3s ease;
    opacity: 0.7;
}

.mini-chart .bar:hover {
    opacity: 1;
}

/* ==================== 头像样式 ==================== */
.avatar-circle {
    width: 40px;
    height: 40px;
    background: #4f46e5;
    border-radius: var(--border-radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.avatar-circle.info {
    background: #0891b2;
}

.avatar-circle.lg {
    width: 100px;
    height: 100px;
    font-size: 2.5rem;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

/* ==================== 图片选择预览框 ==================== */
.logo-preview-box:hover,
.favicon-preview-box:hover,
.og-image-preview-box:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.logo-preview-box img,
.favicon-preview-box img,
.og-image-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ==================== 辅助工具类 ==================== */
.rounded-lg { border-radius: var(--border-radius); }

/* ==================== 移动端响应式 ==================== */
@media screen and (max-width: 1023px) {
    .admin-subnav .container {
        padding: 0 0.5rem;
    }

    .page-header {
        padding: 1.25rem 1.5rem;
        margin-bottom: 1.5rem;
    }
}

@media screen and (max-width: 768px) {
    .page-header {
        border-radius: var(--border-radius-sm);
        padding: 1rem 1.25rem;
    }
    
    .modern-tabs {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .modern-tabs::-webkit-scrollbar { display: none; }
    
    .stat-value {
        font-size: 2rem;
    }

    .media-library-modal-card {
        width: calc(100vw - 1rem);
    }

    .media-library-window-main {
        grid-template-columns: 1fr;
    }

    .media-library-tree-panel,
    .media-library-preview-panel {
        border: none;
        border-top: 1px solid #e5e7eb;
    }

    .media-library-file-header {
        display: none;
    }

    .media-library-file-toolbar {
        flex-wrap: wrap;
    }

    .media-library-file-row,
    .media-library-folder-row {
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .media-library-toolbar-buttons {
        justify-content: stretch;
    }

    .media-library-toolbar-buttons > * {
        width: 100%;
    }

    .media-library-file-col.type,
    .media-library-file-col.folder,
    .media-library-file-col.size,
    .media-library-file-col.date {
        display: none;
    }
}


#editor-wrapper {
    border: 1px solid #e5e7eb;
    border-radius: var(--border-radius-xs);
    background: #fff;
    overflow: hidden;
}

#editor-wrapper .jodit-container:not(.jodit_inline) {
    border: none;
    border-radius: inherit;
}

#editor-wrapper .jodit-toolbar__box:not(:empty) {
    border-bottom: 1px solid #e5e7eb;
    background: #fafaf9;
}

#editor-wrapper .jodit-workplace {
    min-height: 600px;
}

#editor-wrapper .jodit-wysiwyg,
#editor-wrapper .jodit-source__mirror {
    font-size: 16px;
    line-height: 1.8;
    padding: 2rem;
}

#editor-wrapper .jodit-status-bar {
    border-top: 1px solid #e5e7eb;
}

.jodit_fullsize,
.jodit-container.jodit_fullsize {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    z-index: 100000 !important;
    border-radius: 0 !important;
    background: #fff !important;
}

.jodit_fullsize {
    display: flex !important;
    flex-direction: column !important;
}

.jodit_fullsize .jodit-workplace {
    flex: 1 1 auto;
    min-height: 0;
}

.jodit_fullsize .jodit-wysiwyg,
.jodit_fullsize .jodit-source__mirror {
    min-height: 100% !important;
}

.editor-fullscreen-active {
    overflow: hidden !important;
}

html.media-library-modal-open,
body.media-library-modal-open {
    overflow: hidden !important;
}

.editor-fullscreen-host {
    transform: none !important;
    animation: none !important;
    overflow: visible !important;
    opacity: 1 !important;
}

html.jodit_fullsize-box_true,
body.jodit_fullsize-box_true {
    overflow: hidden;
}

.category-tree-table .tree-line {
    opacity: 0.5;
}

.category-tree-table tr.level-1 {
    background: rgba(0, 0, 0, 0.01);
}

.category-tree-table tr.level-2 {
    background: rgba(0, 0, 0, 0.02);
}

.category-tree-table tr.level-3 {
    background: rgba(0, 0, 0, 0.03);
}

.media-preview-wrap {
    position: relative;
}

.media-preview {
    width: 100%;
    aspect-ratio: 1/1;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    transition: all 0.2s;
}

.media-preview:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.media-preview:not(.is-empty) {
    border-style: solid;
    border-color: #e5e7eb;
}

.media-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.explorer-shell {
    padding: 0;
    overflow: hidden;
}

.explorer-topbar,
.explorer-toolbar,
.explorer-statusbar {
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.explorer-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.explorer-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.explorer-app-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #dbeafe;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.explorer-app-title {
    font-size: 1rem;
    color: #0f172a;
}

.explorer-breadcrumbs {
    flex: 1;
    min-width: 280px;
}

.explorer-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
}

.explorer-filter-bar {
    min-width: 380px;
    flex: 1;
}

.explorer-main {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr) 310px;
    min-height: 720px;
}

.explorer-sidebar,
.explorer-content,
.explorer-preview-pane {
    min-width: 0;
}

.explorer-sidebar,
.explorer-preview-pane {
    background: #f8fafc;
}

.explorer-sidebar {
    border-right: 1px solid #e5e7eb;
}

.explorer-preview-pane {
    border-left: 1px solid #e5e7eb;
    padding: 1rem;
}

.explorer-pane-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 0.9rem;
}

.explorer-tree {
    padding: 1rem;
}

.explorer-tree-root,
.explorer-tree-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    border-radius: 10px;
    color: #1e293b;
    padding: 0.45rem 0.65rem;
    margin-bottom: 0.2rem;
}

.explorer-tree-root:hover,
.explorer-tree-link:hover {
    background: #e8eefc;
}

.explorer-tree-root.is-current,
.explorer-tree-node.is-current > .explorer-tree-link {
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 600;
}

.explorer-tree-list {
    margin: 0;
    padding-left: 0.85rem;
}

.explorer-tree-node {
    list-style: none;
}

.explorer-tree-node.is-ancestor > .explorer-tree-link {
    background: rgba(219, 234, 254, 0.55);
}

.explorer-content {
    background: #fff;
    display: flex;
    flex-direction: column;
}

.explorer-location-bar {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid #e5e7eb;
    color: #475569;
    font-size: 0.92rem;
}

.explorer-folder-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.1rem 0;
}

.explorer-folder-chip {
    min-width: 150px;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #1e293b;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 0.85rem;
}

.explorer-folder-chip > span:first-child {
    color: #f59e0b;
}

.explorer-folder-chip small {
    margin-left: auto;
    color: #64748b;
}

.explorer-file-header,
.explorer-file-row {
    display: grid;
    grid-template-columns: 54px minmax(260px, 2fr) 110px 110px 140px 110px;
    align-items: center;
    gap: 0.75rem;
}

.explorer-file-header {
    padding: 0.75rem 1.1rem;
    margin-top: 1rem;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.explorer-file-list {
    display: flex;
    flex-direction: column;
}

.explorer-file-row {
    padding: 0.8rem 1.1rem;
    border-bottom: 1px solid #eef2f7;
    transition: background 0.18s ease;
    cursor: pointer;
}

.explorer-file-row:hover,
.explorer-file-row.is-active {
    background: #eef5ff;
}

.explorer-check-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

.explorer-name-cell {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
}

.explorer-thumb {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    flex-shrink: 0;
}

.explorer-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.explorer-name-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.explorer-name-meta strong,
.explorer-name-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.explorer-name-meta span {
    color: #64748b;
    font-size: 0.75rem;
}

.explorer-actions {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
}

.explorer-preview-empty,
.explorer-preview-panel {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #fff;
}

.explorer-preview-empty {
    min-height: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    text-align: center;
    padding: 1.5rem;
}

.explorer-preview-panel {
    padding: 1rem;
}

.explorer-preview-box {
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    background: #f8fafc;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.explorer-preview-box img,
.explorer-preview-box video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.explorer-preview-meta {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.explorer-meta-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.explorer-meta-row span {
    font-size: 0.74rem;
    color: #64748b;
}

.explorer-meta-row strong {
    color: #0f172a;
    word-break: break-word;
}

.explorer-statusbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.1rem;
    padding: 0.75rem 1.1rem;
    border-top: 1px solid #e5e7eb;
    border-bottom: none;
    color: #475569;
    font-size: 0.84rem;
}

.explorer-empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: #94a3b8;
}

/* 置于文件末尾，确保移动端规则在各模块样式之后生效 */
@media screen and (max-width: 1023px) {
    .explorer-main {
        grid-template-columns: minmax(0, 1fr);
        min-height: 0;
    }

    .explorer-sidebar,
    .explorer-preview-pane {
        display: none;
    }

    .explorer-filter-bar {
        width: 100%;
        min-width: 0;
    }
}

@media screen and (max-width: 768px) {
    .dashboard-header {
        margin-bottom: 1rem;
        padding: 1.1rem;
        border-radius: 14px;
        box-shadow: 0 8px 24px rgba(76, 81, 191, 0.2);
    }

    .dashboard-header h1 {
        font-size: 1.35rem !important;
        line-height: 1.35;
    }

    .stat-card {
        display: grid;
        grid-template-columns: 46px minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.15rem 0.9rem;
        min-height: 104px;
        padding: 1rem;
    }

    .stat-card:hover,
    .quick-action:hover {
        transform: none;
    }

    .stat-icon {
        grid-row: 1 / span 3;
        width: 46px;
        height: 46px;
        margin: 0;
        font-size: 1.1rem;
    }

    .stat-value {
        grid-column: 2;
        font-size: 1.8rem;
    }

    .stat-label {
        grid-column: 2;
    }

    .stat-badge,
    .stat-card > a {
        grid-column: 3;
        align-self: center;
        margin-top: 0 !important;
        white-space: nowrap;
    }

    .stat-badge {
        grid-row: 1;
    }

    .stat-card > a {
        grid-row: 2;
    }

    .quick-action {
        min-height: 70px;
        padding: 0.85rem 1rem;
    }

    .media-library-modal-card,
    #product-selector-modal > .relative.z-10 {
        width: 100vw !important;
        height: 100dvh;
        max-height: 100dvh !important;
        border-radius: 0 !important;
    }

    .media-library-toolbar-buttons > * {
        width: auto;
    }

    .media-library-window-main {
        max-height: none;
    }

    .explorer-topbar,
    .explorer-toolbar {
        align-items: stretch;
        padding: 0.75rem;
    }

    .explorer-topbar-left,
    .explorer-breadcrumbs,
    .explorer-toolbar > div:first-child {
        width: 100%;
        min-width: 0;
    }

    .explorer-toolbar > div:first-child {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem !important;
    }

    .explorer-toolbar > div:first-child > * {
        justify-content: center;
        min-width: 0;
        padding-inline: 0.65rem;
    }

    .explorer-folder-strip {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        padding: 0.75rem 0.75rem 0;
    }

    .explorer-folder-chip-wrap,
    .explorer-folder-chip {
        width: 100%;
        min-width: 0;
    }

    .explorer-file-header {
        display: none;
    }

    .explorer-file-row {
        grid-template-columns: 34px minmax(0, 1fr) auto;
        gap: 0.55rem;
        padding: 0.75rem;
    }

    .explorer-file-row > :nth-child(3),
    .explorer-file-row > :nth-child(4),
    .explorer-file-row > :nth-child(5) {
        display: none;
    }

    .explorer-thumb {
        width: 42px;
        height: 42px;
    }

    .explorer-actions {
        gap: 0.25rem;
    }

    .explorer-actions button {
        width: 40px !important;
        height: 40px !important;
    }

    .login-card {
        padding: 1.5rem 1.1rem;
    }

    .login-container {
        padding: max(1rem, env(safe-area-inset-top)) 0.75rem max(1rem, env(safe-area-inset-bottom));
    }
}

@media screen and (max-width: 480px) {
    .stat-card {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .stat-icon {
        width: 44px;
        height: 44px;
    }

    .stat-badge,
    .stat-card > a {
        grid-column: 2;
        grid-row: auto;
        justify-self: start;
        margin-top: 0.35rem !important;
    }

    .explorer-actions button:nth-child(2) {
        display: none;
    }
}

/* 产品发布页：防止富文本工具栏撑开移动端视口 */
@media screen and (max-width: 768px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    .admin-main,
    .admin-content-section,
    .admin-content-section > .container,
    #product-form,
    #product-form > .grid,
    #product-form > .grid > div,
    #product-form .card,
    #editor-wrapper {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    #editor-wrapper .jodit-container:not(.jodit_inline),
    #editor-wrapper .jodit-toolbar__box,
    #editor-wrapper .jodit-workplace,
    #editor-wrapper .jodit-wysiwyg,
    #editor-wrapper .jodit-source__mirror {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    #editor-wrapper .jodit-toolbar__box {
        overflow-x: auto !important;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-inline: contain;
    }

    #editor-wrapper .jodit-toolbar-editor-collection {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    #editor-wrapper .jodit-workplace {
        min-height: 320px;
    }

    #editor-wrapper .jodit-wysiwyg,
    #editor-wrapper .jodit-source__mirror {
        padding: 1rem;
        overflow-wrap: anywhere;
    }
}


/* 2026-09-27: 视频封面（选择封面控件）缩略图——尺寸写死在本表，不依赖 Tailwind CDN 按时生成 */
.media-poster-preview {
  width: 5rem;
  height: 3rem;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  background: #fff;
}
.media-poster-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
