/* ============================================
   WPFX.LINK - 全新设计样式 (Stripe + Apple 融合)
   基于 Stripe 渐变网格 + Apple 极致简洁 + Cursor 温暖编辑质感
   ============================================ */

:root {
    /* ===== 主色系统 ===== */
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-light: #EEF2FF;
    --primary-soft: #E0E7FF;

    /* ===== 背景色 ===== */
    --bg-main: #FAFBFC;
    --bg-card: #FFFFFF;
    --bg-hover: #F4F6F8;
    --bg-page: #F1F5F9;

    /* ===== 文字色 ===== */
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;

    /* ===== 边框 ===== */
    --border: #E8ECF0;
    --border-hover: #CBD5E1;
    --border-strong: #B0BEC5;

    /* ===== 功能色 ===== */
    --danger: #EF4444;
    --danger-hover: #DC2626;
    --success: #22C55E;
    --warning: #F59E0B;

    /* ===== 圆角 ===== */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 999px;

    /* ===== 阴影 ===== */
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.06);
    --shadow-xl: 0 20px 40px -10px rgba(0,0,0,.12);
    --shadow-glow: 0 0 0 4px rgba(79,70,229,.12);

    /* ===== 过渡 ===== */
    --transition: .2s cubic-bezier(.4,0,.2,1);
    --transition-slow: .35s cubic-bezier(.4,0,.2,1);

    /* ===== 渐变 (Stripe 风格) ===== */
    --gradient-hero: linear-gradient(135deg, #4F46E5 0%, #7C3AED 40%, #A855F7 100%);
    --gradient-card: linear-gradient(135deg, #F8FAFC 0%, #EEF2FF 100%);
}

/* ============================================
   暗黑模式
   ============================================ */

[data-theme="dark"] {
    --primary: #818CF8;
    --primary-hover: #6366F1;
    --primary-light: #1E1B4B;
    --primary-soft: #312E81;

    --bg-main: #0F172A;
    --bg-card: #1E293B;
    --bg-hover: #334155;
    --bg-page: #1E293B;

    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;

    --border: #334155;
    --border-hover: #475569;
    --border-strong: #64748B;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,.5);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,.6), 0 8px 10px -6px rgba(0,0,0,.5);
    --shadow-xl: 0 20px 40px -10px rgba(0,0,0,.7);
    --shadow-glow: 0 0 0 4px rgba(129,140,248,.25);

    --gradient-hero: linear-gradient(135deg, #4338CA 0%, #6D28D9 40%, #7C3AED 100%);
    --gradient-card: linear-gradient(135deg, #1E293B 0%, #1E1B4B 100%);
}

/* 暗黑模式下 Hero 区域渐变背景 */
[data-theme="dark"] .public-hero {
    background: linear-gradient(180deg, #1E1B4B 0%, transparent 60%);
}

/* 暗黑模式下毛玻璃导航 */
[data-theme="dark"] .public-header {
    background: rgba(15,23,42,.88);
    border-bottom-color: var(--border);
}

/* 暗黑模式下分类区块标题区渐变 */
[data-theme="dark"] .category-header {
    background: linear-gradient(to bottom, var(--bg-card), #1a2332);
}

/* 暗黑模式下模态框遮罩 */
[data-theme="dark"] .modal-overlay {
    background: rgba(0,0,0,.7);
}

/* 暗黑模式下表单元素 */
[data-theme="dark"] .form-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* 暗黑模式下 select 下拉箭头颜色 */
[data-theme="dark"] .form-select {
    color-scheme: dark;
}

/* 暗黑模式下自定义滚动条 */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--bg-main);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ============================================
   主题切换按钮
   ============================================ */

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all var(--transition);
    flex-shrink: 0;
    line-height: 1;
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.theme-toggle:active {
    transform: scale(.92);
}

/* ============================================
   基础重置
   ============================================ */

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

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.011em;
}

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

img { max-width: 100%; height: auto; }

/* ============================================
   公共布局
   ============================================ */

.public-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.public-header {
    background: rgba(255,255,255,.85);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
}

.public-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
}

.public-main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.public-footer {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: .8125rem;
    color: var(--text-muted);
    background: var(--bg-card);
}

.footer-links { margin-bottom: .5rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; transition: color var(--transition); }
.footer-links a:hover { color: var(--primary); }
.footer-divider { margin: 0 .5rem; color: var(--border); color: var(--border); }

/* ============================================
   Hero 区域 (Stripe 渐变网格风格)
   ============================================ */

.public-hero {
    text-align: center;
    padding: 3rem 0 2rem;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #EEF2FF 0%, transparent 60%);
}

.public-hero::before {
    content: '';
    position: absolute;
    top: -60%;
    left: -30%;
    right: -30%;
    bottom: 20%;
    background: var(--gradient-hero);
    opacity: .06;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
}

.home-slogan {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.home-slogan p {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.6;
    letter-spacing: -0.01em;
    margin: 0;
}

/* ============================================
   搜索框 (Apple 风格大圆角)
   ============================================ */

.home-search-bar {
    margin-bottom: 1rem;
    position: relative;
}

.home-search-inner {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .875rem 1.5rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xl);
    transition: all var(--transition);
    max-width: 640px;
    margin: 0 auto;
    box-shadow: var(--shadow-sm);
}

.home-search-inner:focus-within {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.home-search-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color var(--transition);
}

.home-search-inner:focus-within .home-search-icon {
    color: var(--primary);
}

.home-search-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 1rem;
    outline: none;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.home-search-input::placeholder {
    color: var(--text-muted);
}

.home-search-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: .25rem;
    flex-shrink: 0;
    border-radius: 50%;
    transition: all var(--transition);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-search-clear:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* 搜索引擎切换 */
.home-search-engines {
    display: flex;
    gap: .5rem;
    justify-content: center;
    margin-top: .75rem;
    flex-wrap: wrap;
}

.search-engine-btn {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .35rem .75rem;
    font-size: .8125rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: -0.01em;
}

.search-engine-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.search-engine-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79,70,229,.3);
}

/* 搜索结果下拉 */
.search-results-dropdown {
    max-width: 640px;
    margin: 0 auto 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.search-results-status {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: .875rem;
}

.search-results-list {
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .75rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-hover); }

.search-result-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 2px;
}

.search-result-info { flex: 1; min-width: 0; }

.search-result-title {
    font-weight: 600;
    font-size: .875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-desc {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-badge {
    flex-shrink: 0;
    font-size: .6875rem;
    background: var(--primary);
    color: #fff;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

/* ============================================
   顶部导航
   ============================================ */

.public-nav {
    display: flex;
    align-items: center;
    gap: .25rem;
    flex-wrap: wrap;
}

.public-menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .35rem .6rem;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-primary);
    line-height: 1;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

/* ============================================
   用户下拉菜单
   ============================================ */

.user-dropdown {
    position: relative;
    display: inline-flex;
}

.user-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .6rem .3rem .3rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    border: 1px solid transparent;
}

.user-dropdown-trigger:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}

.user-avatar-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8125rem;
    flex-shrink: 0;
}

.user-name-small {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-arrow {
    font-size: .625rem;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.user-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: .375rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--transition);
    z-index: 200;
}

.user-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .75rem;
    border-radius: var(--radius-sm);
    font-size: .8125rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item-danger { color: var(--danger); }
.dropdown-item-danger:hover { background: #FEF2F2; }

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: .25rem 0;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .875rem;
    cursor: pointer;
    transition: all var(--transition);
}

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

/* ============================================
   精选推荐 (Top Sites)
   ============================================ */

.explore-page { padding-bottom: 2rem; }

.top-sites-section { margin-bottom: 2.5rem; }

.section-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    letter-spacing: -0.015em;
}

.section-title-icon { font-size: 1.25rem; }

.top-sites-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: .75rem;
}

.top-site-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 1.25rem .5rem;
    background: var(--bg-card);
    border: 1px solid transparent;
    border-radius: var(--radius);
    text-decoration: none;
    transition: all var(--transition);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.top-site-item:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.top-site-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: contain;
}

.top-site-name {
    font-size: .75rem;
    color: var(--text-primary);
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    letter-spacing: -0.01em;
}

/* ============================================
   分类区块
   ============================================ */

.categories-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.category-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.category-header {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    padding: 1.125rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(to bottom, var(--bg-card), var(--bg-hover));
}

.category-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.015em;
}

.category-title:hover { color: var(--primary); }

.category-desc {
    font-size: .8125rem;
    color: var(--text-muted);
    flex: 1;
}

.category-more {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    transition: opacity var(--transition);
}

.category-more:hover { opacity: .8; }

/* 二级分类标签 */
.subcategory-tabs {
    display: flex;
    gap: .375rem;
    padding: .75rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-main);
    overflow-x: auto;
    flex-wrap: wrap;
}

.subcategory-tab {
    padding: .4rem .875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: .8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.subcategory-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.subcategory-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(79,70,229,.25);
}

/* 链接网格 */
.sub-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .375rem;
    padding: 1rem 1.5rem;
}

.link-item {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .625rem .875rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.link-item:hover {
    background: var(--primary-light);
    border-color: var(--primary-soft);
}

.link-item-wrap {
    position: relative;
}

.link-item-wrap:hover .btn-add-bookmark {
    opacity: 1;
}

.btn-add-bookmark {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: 0;
    box-shadow: var(--shadow-sm);
}

.btn-add-bookmark:hover {
    transform: scale(1.15);
    box-shadow: var(--shadow-md);
}

.link-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
    object-fit: contain;
}

.link-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.link-title {
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.link-desc {
    font-size: .75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empty-links {
    grid-column: 1 / -1;
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: .875rem;
}

/* ============================================
   空间模式
   ============================================ */

.mode-switch-bar {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.mode-switch {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .375rem;
    box-shadow: var(--shadow);
}

.mode-btn {
    padding: .5rem 1.25rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.mode-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79,70,229,.3);
}

.mode-btn:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-main);
}

.space-grid-new {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.space-card-new {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: .75rem;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.space-card-new:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.space-card-icon { font-size: 2rem; line-height: 1; }
.space-card-body { flex: 1; min-width: 0; }

.space-card-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: .25rem;
    letter-spacing: -0.01em;
}

.space-card-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: .75rem;
    opacity: 0;
    transition: opacity var(--transition);
    padding: 0;
    color: var(--text-muted);
}

.space-card-new:hover .space-card-edit-btn { opacity: .5; }
.space-card-edit-btn:hover { opacity: 1 !important; }

.space-card-rename {
    display: flex;
    align-items: center;
    gap: .25rem;
    margin-bottom: .25rem;
}

.space-card-meta {
    display: flex;
    gap: .75rem;
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .25rem;
}

.space-card-slug {
    font-size: .75rem;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    margin-top: .25rem;
}

.space-card-badge {
    position: absolute;
    top: .75rem;
    right: .75rem;
    background: var(--primary);
    color: #fff;
    font-size: .6875rem;
    padding: .15rem .5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
}

/* 空间文件夹分类 */
.space-folders .category-section .category-title {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .375rem;
}

.space-folders .category-title.active-folder {
    color: var(--primary);
}

.space-folders .category-title.active-folder::after {
    content: '✓';
    font-size: .75rem;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   空间详情
   ============================================ */

.space-detail-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.folder-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    position: sticky;
    top: 72px;
    box-shadow: var(--shadow-sm);
}

.folder-sidebar-header {
    font-weight: 600;
    font-size: .875rem;
    margin-bottom: .5rem;
    padding: 0 .25rem;
    letter-spacing: -0.01em;
}

.folder-sidebar-empty {
    font-size: .8125rem;
    color: var(--text-muted);
    padding: .5rem .75rem;
}

.bookmark-content { flex: 1; min-width: 0; }

.bm-batch-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem .75rem;
    background: var(--bg-page);
    border-radius: var(--radius-sm);
    margin-bottom: .5rem;
    font-size: .8125rem;
}

/* 文件夹树 */
.folder-list { list-style: none; }

.folder-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: .875rem;
    color: var(--text-secondary);
    transition: all var(--transition);
    min-width: 0;
}

.folder-count {
    flex-shrink: 0;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: .8125rem;
}

.folder-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

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

.folder-item .folder-icon { font-size: 1rem; }
.folder-children { padding-left: 1.25rem; }

.folder-item-row {
    display: flex;
    align-items: center;
    gap: 2px;
}

.folder-item-row .folder-item { flex: 0 0 auto; min-width: 0; white-space: nowrap; }

.folder-item-row .folder-item-actions {
    display: flex;
    gap: 1px;
    opacity: 0;
    transition: opacity var(--transition);
    flex-shrink: 0;
}

.folder-item-row:hover .folder-item-actions { opacity: 1; }

/* ============================================
   书签列表
   ============================================ */

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

.bookmark-list-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .625rem .875rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.bookmark-list-item:last-child { border-bottom: none; }
.bookmark-list-item:hover { background: var(--bg-hover); }

.bookmark-list-item .favicon {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    flex-shrink: 0;
}

.bookmark-list-item .bm-list-info { flex: 1; min-width: 0; cursor: pointer; }

.bookmark-list-item .bm-title {
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark-list-item .bm-url {
    font-size: .75rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark-list-item .bm-list-actions {
    display: flex;
    gap: .125rem;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--transition);
}

.bookmark-list-item:hover .bm-list-actions { opacity: 1; }

/* 书签表格 */
.bm-table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}

.bm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8125rem;
}

.bm-table thead { background: var(--bg-hover); }

.bm-table th {
    text-align: left;
    padding: .625rem .75rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.bm-table td {
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.bm-table tbody tr:last-child td { border-bottom: none; }
.bm-table tbody tr:hover { background: var(--bg-hover); }

.bm-table .th-icon, .bm-table .td-icon { width: 48px; text-align: center; }
.bm-table .th-check, .bm-table .td-check { width: 36px; text-align: center; }

.bm-table .th-check input, .bm-table .td-check input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.bm-table .td-icon .favicon {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    display: block;
    margin: 0 auto;
}

.bm-table .th-title { min-width: 120px; }

.bm-table .td-title .bm-title {
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    max-width: 200px;
}

.bm-table .th-url { min-width: 160px; }

.bm-table .td-url .bm-url {
    color: var(--text-muted);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    max-width: 280px;
}

.bm-table .td-url .bm-url:hover {
    color: var(--primary);
    text-decoration: underline;
}

.bm-table .th-public, .bm-table .td-public { width: 64px; text-align: center; }
.bm-table .th-actions, .bm-table .td-actions { width: 90px; text-align: center; }

.bm-table .td-actions .btn {
    padding: .25rem .375rem;
    font-size: .875rem;
    line-height: 1;
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    cursor: pointer;
}

.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 20px;
    transition: background var(--transition);
}

.switch-slider::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition);
}

.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(16px); }

.switch-disabled { opacity: .55; cursor: not-allowed !important; }
.switch-disabled .switch-slider { background: var(--primary) !important; }
.switch-disabled .switch-slider::before { transform: translateX(16px) !important; }

/* ============================================
   卡片
   ============================================ */

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ============================================
   表单
   ============================================ */

.form-group { margin-bottom: 1rem; }

.form-label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: .375rem;
    letter-spacing: -0.01em;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: .625rem .875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .9375rem;
    transition: all var(--transition);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    letter-spacing: -0.01em;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.form-textarea { resize: vertical; min-height: 80px; }

/* ============================================
   通用搜索框（空间管理页面等处使用）
   ============================================ */

.search-bar {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .625rem 1rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    transition: all var(--transition);
    max-width: 100%;
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.search-bar input {
    flex: 1;
    border: none;
    background: none;
    font-size: .9375rem;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.field-error {
    display: block;
    color: var(--danger);
    font-size: .75rem;
    margin-top: .25rem;
}

.input-error { border-color: var(--danger) !important; }
.input-ok { border-color: var(--success) !important; }
.input-readonly { background: var(--bg-hover) !important; cursor: not-allowed !important; opacity: .7; }

/* ============================================
   按钮
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: .9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border: 1.5px solid transparent;
    line-height: 1.4;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

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

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 3px rgba(79,70,229,.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79,70,229,.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-main);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

/* 详情页 QR 按钮 */
.btn-detail-qr {
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    background: var(--bg-page);
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}

.btn-detail-qr:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.btn-danger:hover:not(:disabled) {
    background: var(--danger-hover);
}

.btn-sm { padding: .375rem .75rem; font-size: .8125rem; }

.btn-xs {
    padding: 0 .25rem;
    font-size: .75rem;
    line-height: 1.6;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
}

.btn-xs:hover { background: var(--bg-hover); color: var(--text-primary); }

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

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ============================================
   标签
   ============================================ */

.tag {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .125rem .5rem;
    border-radius: var(--radius-full);
    font-size: .75rem;
    font-weight: 500;
    background: var(--primary-light);
    color: var(--primary);
}

.tag-sm { font-size: .6875rem; padding: .0625rem .375rem; }

/* ============================================
   模态框
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: .25rem;
    line-height: 1;
    border-radius: var(--radius-xs);
    transition: all var(--transition);
}

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

/* Admin 弹窗兼容 */
.modal {
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.text-danger { color: var(--danger); }

/* ============================================
   分类管理 (Admin)
   ============================================ */

.category-tree-item {
    border-bottom: 1px solid var(--border);
}

.category-tree-item:last-child {
    border-bottom: none;
}

.category-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .625rem 1rem;
    gap: .5rem;
}

.category-row.main-category {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.category-row.sub-category {
    padding-left: 2.5rem;
    background: var(--bg-main);
}

.category-row-left {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex: 1;
    min-width: 0;
}

.category-name {
    font-weight: 600;
    font-size: .875rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.category-slug {
    font-size: .75rem;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.category-desc-text {
    font-size: .75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-indent {
    color: var(--text-muted);
    font-size: .8125rem;
    flex-shrink: 0;
    width: 1.5rem;
}

.category-row-actions {
    display: flex;
    gap: .375rem;
    flex-shrink: 0;
}

.badge-cat {
    font-size: .6875rem;
    color: var(--text-muted);
    background: var(--bg-main);
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

/* ============================================
   加载 & 空状态
   ============================================ */

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
    gap: .5rem;
}

.loading-spinner::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    margin-left: .5rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state .empty-text { font-size: 1rem; margin-bottom: .5rem; }
.empty-state .empty-sub { font-size: .875rem; }

/* ============================================
   登录/注册页面
   ============================================ */

.auth-page {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
}

.auth-card .auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-card .auth-logo h1 { font-size: 1.75rem; color: var(--primary); letter-spacing: -0.02em; }
.auth-card .auth-logo p { font-size: .875rem; color: var(--text-muted); margin-top: .25rem; }

@media (max-width: 480px) {
    .auth-page {
        padding: .5rem;
        min-height: 50vh;
    }
    .auth-card {
        padding: 1.5rem;
        max-width: 100%;
    }
    .auth-card .auth-logo h1 { font-size: 1.375rem; }
}

.activate-success { text-align: center; padding: 1rem 0; }
.activate-success h3 { font-size: 1.125rem; color: var(--text-primary); }

.auth-tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: .75rem;
}

.auth-tab {
    flex: 1;
    text-align: center;
    padding: .5rem;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 500;
    border: none;
    background: none;
    font-size: .9375rem;
    transition: color var(--transition);
}

.auth-tab.active {
    color: var(--primary);
    position: relative;
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

.email-checking {
    position: absolute;
    right: .625rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .75rem;
    color: var(--text-muted);
}

.email-ok {
    position: absolute;
    right: .625rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .75rem;
    color: var(--success);
    font-weight: 600;
}

.password-checklist {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .25rem .5rem;
    margin-top: .375rem;
    font-size: .75rem;
}

.password-checklist .check-pass { color: var(--success); }
.password-checklist .check-fail { color: var(--text-muted); }

/* ============================================
   面包屑
   ============================================ */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: .375rem;
    font-size: .8125rem;
    color: var(--text-muted);
    margin-bottom: .75rem;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }

/* ============================================
   通知提示
   ============================================ */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.toast {
    padding: .75rem 1.25rem;
    border-radius: var(--radius-sm);
    color: #fff;
    font-weight: 500;
    font-size: .875rem;
    box-shadow: var(--shadow-lg);
    animation: slideIn .3s ease;
    max-width: 360px;
    letter-spacing: -0.01em;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   页面通用样式
   ============================================ */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.page-header-left {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    flex-wrap: wrap;
}

.page-header-right {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

.page-subtitle {
    font-size: .8125rem;
    color: var(--text-muted);
}

.name-limited {
    max-width: 7em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

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

/* ============================================
   关于本站页面
   ============================================ */

.page-about {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0;
}

.about-container h1 {
    font-size: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary);
    letter-spacing: -0.02em;
}

.about-section { margin-bottom: 2rem; }

.about-section h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: .75rem;
    letter-spacing: -0.015em;
}

.about-section p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: .75rem;
}

.about-section ul {
    padding-left: 1.25rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.about-section li { margin-bottom: .5rem; }

/* ============================================
   用户指南页面
   ============================================ */

.page-guide { max-width: 1100px; margin: 0 auto; }

.guide-layout {
    display: flex;
    gap: 2rem;
    padding: 1.5rem 0;
    align-items: flex-start;
}

.guide-sidebar {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding: 1.25rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.guide-sidebar-title {
    font-size: .9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.01em;
}

.guide-nav { display: flex; flex-direction: column; gap: .125rem; }

.guide-nav-item {
    display: block;
    padding: .375rem .5rem;
    font-size: .8125rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    border-left: 2px solid transparent;
    line-height: 1.4;
}

.guide-nav-item:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.guide-nav-item.active {
    color: var(--primary);
    background: var(--primary-light);
    border-left-color: var(--primary);
    font-weight: 500;
}

.guide-nav-level-1 { font-weight: 600; font-size: .875rem; padding-left: .5rem; }
.guide-nav-level-2 { padding-left: .75rem; }
.guide-nav-level-3 { padding-left: 1rem; font-size: .75rem; }

.guide-main {
    flex: 1;
    min-width: 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.guide-content { line-height: 1.8; color: var(--text-primary); }

.guide-content h1 {
    font-size: 1.75rem;
    margin: 1.5rem 0 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
    scroll-margin-top: 70px;
    letter-spacing: -0.02em;
}

.guide-content h2 {
    font-size: 1.35rem;
    margin: 1.5rem 0 .75rem;
    scroll-margin-top: 70px;
    letter-spacing: -0.015em;
}

.guide-content h3 {
    font-size: 1.15rem;
    margin: 1.25rem 0 .5rem;
    scroll-margin-top: 70px;
}

.guide-content h4, .guide-content h5, .guide-content h6 {
    font-size: 1rem;
    margin: 1rem 0 .5rem;
    scroll-margin-top: 70px;
}

.guide-content p { margin-bottom: .75rem; color: var(--text-secondary); }
.guide-content ul, .guide-content ol { padding-left: 1.5rem; margin-bottom: .75rem; color: var(--text-secondary); }
.guide-content li { margin-bottom: .375rem; }
.guide-content strong { color: var(--text-primary); }
.guide-content a { color: var(--primary); text-decoration: none; }
.guide-content a:hover { text-decoration: underline; }

.guide-content code {
    background: var(--bg-hover);
    padding: .125rem .375rem;
    border-radius: var(--radius-xs);
    font-size: .875em;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
}

.guide-content pre {
    background: var(--bg-hover);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: .75rem;
    border: 1px solid var(--border);
}

.guide-content pre code { background: none; padding: 0; }

.guide-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: .875rem;
}

.guide-content th, .guide-content td {
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    text-align: left;
}

.guide-content th { background: var(--bg-hover); font-weight: 600; }

.guide-content hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

.guide-error {
    text-align: center;
    padding: 3rem;
    color: var(--danger);
    font-size: 1rem;
}

/* ============================================
   个人信息页面
   ============================================ */

.page-profile { max-width: 640px; margin: 0 auto; }

.profile-card {
    max-width: 560px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.profile-avatar-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--gradient-hero);
    color: #fff;
}

.profile-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
}

.profile-avatar-name { font-size: 1.1rem; font-weight: 600; }
.profile-avatar-role { font-size: .8125rem; opacity: .8; margin-top: .125rem; }
.profile-form { padding: 1.5rem; }

.form-section { margin-bottom: 1.5rem; }
.form-section:last-child { margin-bottom: 0; }

.form-section-title {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .025em;
    margin-bottom: .75rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
}

.form-actions {
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    margin-top: .5rem;
}

/* ============================================
   导入书签
   ============================================ */

.import-file-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.import-file-zone:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.import-file-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.import-file-hint { color: var(--text-muted); font-size: .875rem; }
.import-file-selected { font-size: .875rem; }
.import-file-size { color: var(--text-muted); margin-left: .5rem; }

.import-preview {
    margin-top: 1rem;
    padding: .75rem 1rem;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
}

.import-preview-title {
    font-size: .8125rem;
    color: var(--text-muted);
    margin-bottom: .5rem;
}

.import-preview-stats { display: flex; gap: 1.5rem; }

.import-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.import-stat-num { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.import-stat-label { font-size: .75rem; color: var(--text-muted); }

.import-result { text-align: center; padding: 1rem 0; }
.import-result-icon { font-size: 3rem; margin-bottom: .5rem; }
.import-result-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 1rem; }

.import-result-stats { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; }

.import-result-stat {
    padding: .5rem 1rem;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    font-size: .875rem;
}

.import-result-num { font-weight: 700; color: var(--primary); }

/* ============================================
   拖拽排序
   ============================================ */

.dragging { opacity: .5; }
.drag-over { border-color: var(--primary) !important; background: var(--primary-light); }

/* ============================================
   桌面端/移动端显隐
   ============================================ */

.nav-desktop-only { display: inline-flex; }
.nav-mobile-only { display: none; }

/* ============================================
   响应式
   ============================================ */

@media (max-width: 1024px) {
    .top-sites-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
    .nav-desktop-only { display: none !important; }
    .nav-mobile-only { display: flex !important; }

    .public-header-inner { padding: .75rem 1rem; }
    .public-main { padding: 1.25rem 1rem; }

    .public-menu-toggle { display: block; position: relative; z-index: 100; }

    .public-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        max-height: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        padding: 0 1.25rem;
        gap: 0;
        overflow: hidden;
        transition: max-height .3s ease, padding .3s ease;
        z-index: 99;
    }

    .public-nav.open {
        max-height: 100vh;
        padding: .75rem 1.25rem 1.25rem;
    }

    .public-nav .btn {
        display: flex;
        width: 100%;
        padding: .75rem 1rem;
        font-size: 1rem;
        font-weight: 500;
        justify-content: flex-start;
        border-radius: var(--radius);
        color: var(--text-primary);
        transition: background var(--transition);
        border: none;
        background: none;
    }

    .public-nav .btn:hover { background: var(--bg-hover); }

    .public-nav .btn.btn-primary {
        justify-content: center;
        background: var(--primary);
        color: #fff;
        margin-top: .5rem;
    }

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

    .nav-mobile-user {
        display: flex !important;
        align-items: center;
        gap: .75rem;
        padding: .75rem 1rem;
        margin-top: .5rem;
        border-top: 1px solid var(--border);
        font-size: .875rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .nav-mobile-user .user-avatar-small {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        flex-shrink: 0;
    }

    .top-sites-grid { grid-template-columns: repeat(4, 1fr); }
    .space-grid-new { grid-template-columns: 1fr; }

    .page-header { flex-direction: column; align-items: flex-start; }

    .space-detail-layout { flex-direction: column; }

    .folder-sidebar { width: 100%; position: static; margin-bottom: 1rem; }

    .bm-table .th-url, .bm-table .td-url { display: none; }

    .guide-layout { flex-direction: column; }

    .guide-sidebar {
        width: 100%;
        position: static;
        max-height: none;
        padding: 1rem;
    }

    .guide-main { padding: 1.25rem; }

    .guide-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: .25rem;
    }

    .guide-nav-item {
        border-left: none;
        border-bottom: 2px solid transparent;
        padding: .25rem .5rem;
    }

    .guide-nav-item.active {
        border-left-color: transparent;
        border-bottom-color: var(--primary);
    }

    .page-profile { padding: 0 .75rem; }
    .profile-card { max-width: 100%; }
}

@media (max-width: 640px) {
    .mode-switch-bar {
        margin-bottom: 1rem;
    }
    .mode-btn {
        padding: .375rem .875rem;
        font-size: .8125rem;
    }
    .top-sites-grid { grid-template-columns: repeat(4, 1fr); gap: .5rem; }
    .top-site-item { padding: .875rem .375rem; }
    .sub-links-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .bm-table .th-title, .bm-table .td-title .bm-title { max-width: 120px; }
    .public-hero { padding: 2rem 0 1.5rem; }
}

@media (max-width: 480px) {
    .top-sites-grid { grid-template-columns: repeat(4, 1fr); gap: .375rem; }
    .top-site-item { padding: .75rem .25rem; }
    .top-site-icon { width: 24px; height: 24px; }
    .top-site-name { font-size: .6875rem; }
}