/* ==========================================================
   RESET & BASE
========================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: #1e293b;
    background: #f1f5f9;
    height: 100vh;
    overflow: hidden;
    transition: background 0.3s ease;
}

.app-container {
    display: flex;
    height: 100vh;
    background: #f8fafc;
    transition: background 0.3s ease;
}

/* ==========================================================
   CSS 变量 ———— 4 套主题系统
========================================================== */
:root {
    /* 默认：极简灰白 (Neutral) */
    --sidebar-bg: #ffffff;
    --sidebar-border: #e9edf4;
    --sidebar-shadow: 2px 0 16px rgba(0, 0, 0, 0.04);
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #94a3b8;
    --accent: #4f46e5;
    --accent-soft: #eef2ff;
    --accent-glow: rgba(79, 70, 229, 0.15);
    --accent-gradient: linear-gradient(135deg, #4f46e5, #6366f1);
    --hover-bg: #f1f5f9;
    --card-bg: #ffffff;
    --card-border: #e9edf4;
    --main-bg: #f8fafc;
    --topbar-bg: #ffffff;
    --topbar-border: #e9edf4;
    --scrollbar-thumb: #d1d5db;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* 主题 2：奶茶暖阳 (Warm) */
.theme-warm {
    --sidebar-bg: #fefaf5;
    --sidebar-border: #f0e6db;
    --sidebar-shadow: 2px 0 16px rgba(0, 0, 0, 0.03);
    --text-primary: #3d2c1e;
    --text-secondary: #5a4a38;
    --text-muted: #b0957a;
    --accent: #d97747;
    --accent-soft: #fdf0e6;
    --accent-glow: rgba(217, 119, 71, 0.15);
    --accent-gradient: linear-gradient(135deg, #d97747, #e5986b);
    --hover-bg: #f8ede4;
    --card-bg: #ffffff;
    --card-border: #f0e6db;
    --main-bg: #fdf8f3;
    --topbar-bg: #ffffff;
    --topbar-border: #f0e6db;
    --scrollbar-thumb: #dccfc2;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.03);
}

/* 主题 3：薄荷清雾 (Mint) */
.theme-mint {
    --sidebar-bg: #f6fbf9;
    --sidebar-border: #d6ebe5;
    --sidebar-shadow: 2px 0 16px rgba(0, 0, 0, 0.03);
    --text-primary: #134e4a;
    --text-secondary: #2d6a64;
    --text-muted: #7fa9a2;
    --accent: #14b8a6;
    --accent-soft: #e6f6f3;
    --accent-glow: rgba(20, 184, 166, 0.15);
    --accent-gradient: linear-gradient(135deg, #14b8a6, #2dd4bf);
    --hover-bg: #ecf9f5;
    --card-bg: #ffffff;
    --card-border: #d6ebe5;
    --main-bg: #f4fbf9;
    --topbar-bg: #ffffff;
    --topbar-border: #d6ebe5;
    --scrollbar-thumb: #b8d5ce;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.03);
}

/* 主题 4：淡雅粉紫 (Rose) */
.theme-rose {
    --sidebar-bg: #fdf8fc;
    --sidebar-border: #f0e2ed;
    --sidebar-shadow: 2px 0 16px rgba(0, 0, 0, 0.03);
    --text-primary: #4a2d44;
    --text-secondary: #6b4a62;
    --text-muted: #b694ac;
    --accent: #d9468b;
    --accent-soft: #fde8f2;
    --accent-glow: rgba(217, 70, 139, 0.12);
    --accent-gradient: linear-gradient(135deg, #d9468b, #ec6aa3);
    --hover-bg: #f9ecf3;
    --card-bg: #ffffff;
    --card-border: #f0e2ed;
    --main-bg: #fdf8fc;
    --topbar-bg: #ffffff;
    --topbar-border: #f0e2ed;
    --scrollbar-thumb: #dcc4d6;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.03);
}

/* ==========================================================
   应用主题变量（全局）
========================================================== */
.app-container {
    background: var(--main-bg);
}

.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    box-shadow: var(--sidebar-shadow);
    transition: background 0.3s ease, border-color 0.3s ease, width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    border-bottom: 1px solid var(--sidebar-border);
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(4px);
}

.sidebar-header h3 {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-menu li a {
    color: var(--text-secondary);
}

.sidebar-menu li a:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.sidebar-menu li.active a {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 500;
}

.sidebar-menu li.active a::before {
    background: var(--accent-gradient);
    box-shadow: 0 0 16px var(--accent-glow);
}

.sidebar-menu i {
    color: var(--text-muted);
}

.sidebar-menu li.active a i {
    color: var(--accent);
    text-shadow: 0 0 16px var(--accent-glow);
}

.sidebar-menu .menu-divider {
    background: linear-gradient(90deg, transparent, var(--sidebar-border), transparent);
}

.sidebar-footer {
    border-top: 1px solid var(--sidebar-border);
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-footer .brand-tag {
    color: var(--text-muted);
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
}

.main-content::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
}

#top-user-bar {
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    box-shadow: var(--shadow-sm);
}

.home-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm);
}

.home-card:hover {
    background: var(--hover-bg);
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.home-card::after {
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.home-card-title {
    color: var(--text-primary);
}

.home-card-desc {
    color: var(--text-muted);
}

.home-logo h1 {
    color: var(--text-primary);
}

.home-logo h1 .ai-quick-btn {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--sidebar-border);
}

.home-logo h1 .ai-quick-btn:hover {
    background: var(--hover-bg);
    border-color: var(--accent);
}

.home-logo h1 .trade-quick-btn {
    background: rgba(5, 247, 235, 0.719);
    color: var(--text-secondary);
    border: 1px solid var(--sidebar-border);
}

.home-logo h1 .trade-quick-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.home-subtitle {
    color: var(--text-muted);
}

.home-footer {
    border-top: 1px solid var(--sidebar-border);
}

.footer-inner {
    color: var(--text-muted);
}

.footer-legal a {
    color: var(--text-muted);
}

.footer-legal a:hover {
    color: var(--text-secondary);
}

#top-avatar {
    background: var(--accent-gradient);
    box-shadow: 0 0 20px var(--accent-glow);
    color: #fff;
}

.toggle-sidebar {
    border: 1px solid var(--sidebar-border);
    color: var(--text-muted);
    background: transparent;
}

.toggle-sidebar:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--accent);
}

.theme-switcher {
    border-top: 1px solid var(--sidebar-border);
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================
   侧边栏核心样式
========================================================== */
.sidebar {
    width: 260px;
    min-width: 260px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 100;
}

.sidebar.collapsed {
    width: 68px;
    min-width: 68px;
}

.sidebar-header {
    padding: 18px 20px 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    min-height: 68px;
}

.sidebar.collapsed .sidebar-header {
    padding: 18px 14px 14px 14px;
    justify-content: center;
}

.sidebar-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-header h3 {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    width: 0;
    overflow: hidden;
}

.toggle-sidebar {
    cursor: pointer;
    font-size: 16px;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.sidebar.collapsed .toggle-sidebar {
    transform: rotate(180deg);
}

.toggle-sidebar:not(.collapsed)::before {
    content: "\f053";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.toggle-sidebar.collapsed::before {
    content: "\f054";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.sidebar-menu {
    list-style: none;
    padding: 12px 10px 8px 10px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 180px);
}

.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    border-radius: 4px;
    transition: background 0.2s;
}

.sidebar-menu li {
    margin: 2px 0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    white-space: nowrap;
    position: relative;
}

.sidebar-menu li a {
    text-decoration: none;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    width: 100%;
    transition: all 0.2s ease;
    font-weight: 450;
    font-size: 0.9rem;
    border-radius: 10px;
    position: relative;
}

.sidebar-menu li.active a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    border-radius: 0 4px 4px 0;
    background: var(--accent-gradient);
    box-shadow: 0 0 16px var(--accent-glow);
}

.sidebar-menu i {
    margin-right: 14px;
    width: 22px;
    text-align: center;
    font-size: 1.05rem;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.sidebar-menu .menu-text {
    transition: opacity 0.3s ease, width 0.3s ease;
    opacity: 1;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-menu {
    padding: 12px 6px 8px 6px;
}

.sidebar.collapsed .sidebar-menu li {
    justify-content: center;
}

.sidebar.collapsed .sidebar-menu li a {
    justify-content: center;
    padding: 12px 0;
    border-radius: 10px;
}

.sidebar.collapsed .sidebar-menu .menu-text {
    opacity: 0;
    width: 0;
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.sidebar.collapsed .sidebar-menu i {
    margin-right: 0;
    font-size: 1.2rem;
}

.sidebar.collapsed .sidebar-menu li.active a::before {
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    border-radius: 0 0 4px 4px;
}

.sidebar-menu .menu-divider {
    height: 1px;
    margin: 8px 14px;
    border: none;
}

.sidebar-footer {
    flex-shrink: 0;
    padding: 14px 18px;
    text-align: center;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.sidebar-footer p {
    margin: 0;
    font-weight: 400;
}

.sidebar.collapsed .sidebar-footer {
    padding: 12px 6px;
}

.sidebar.collapsed .sidebar-footer .brand-tag {
    font-size: 0.6rem;
    opacity: 0.6;
}

/* ==========================================================
   主题切换器（侧边栏底部）
========================================================== */
.theme-switcher {
    padding: 12px 18px 10px 18px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    flex-wrap: wrap;
}

.theme-switcher .switcher-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-right: 6px;
    font-weight: 500;
    transition: opacity 0.3s;
}

.theme-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.theme-dot:hover {
    transform: scale(1.15);
    border-color: var(--text-muted);
}

.theme-dot.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
    transform: scale(1.1);
}

.dot-neutral {
    background: #e9edf4;
    border-color: #cbd5e1;
}

.dot-warm {
    background: #f0e0d0;
    border-color: #dccfc2;
}

.dot-mint {
    background: #b8d9d0;
    border-color: #a1c7bc;
}

.dot-rose {
    background: #f0d6e0;
    border-color: #e2c4d2;
}

.sidebar.collapsed .theme-switcher {
    justify-content: center;
    padding: 12px 6px;
}

.sidebar.collapsed .theme-switcher .switcher-label {
    display: none;
}

.sidebar.collapsed .theme-switcher .theme-dot {
    width: 22px;
    height: 22px;
    margin: 0 2px;
}

/* ==========================================================
   主内容区域
========================================================== */
.main-content {
    flex: 1;
    background: var(--main-bg);
    overflow-y: auto;
    padding: 0;
    position: relative;
    transition: background 0.3s ease;
}

.main-content::-webkit-scrollbar {
    width: 6px;
}

.main-content::-webkit-scrollbar-track {
    background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
    border-radius: 4px;
}

#top-user-bar {
    display: none;
    /* 默认隐藏，由 JS 控制显示 */
    padding: 6px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    min-height: 52px;
    gap: 12px;
    backdrop-filter: blur(8px);
}

#top-user-bar span,
#top-user-bar div {
    color: var(--text-secondary);
}

#top-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

#top-vip-tag {
    font-size: 10px;
    font-weight: 600;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff;
    padding: 1px 12px;
    border-radius: 12px;
    display: none;
    letter-spacing: 0.3px;
}

#top-user-bar button {
    background: transparent;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
    transition: all 0.2s;
}

#top-user-bar button:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

#top-user-bar .logout-btn {
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

#top-user-bar .logout-btn:hover {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ==========================================================
   首页卡片网格
========================================================== */
#home-container {
    padding: 24px 32px 32px 32px;
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.home-content {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.home-logo h1 {
    font-size: 2.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    letter-spacing: -0.5px;
}

.home-logo h1 .ai-quick-btn,
.home-logo h1 .trade-quick-btn {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 4px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.3px;
    -webkit-text-fill-color: currentColor;
    background-clip: unset;
}

.home-logo h1 .ai-quick-btn {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--sidebar-border);
}

.home-logo h1 .ai-quick-btn:hover {
    background: var(--hover-bg);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

.home-logo h1 .trade-quick-btn {
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-secondary);
    border: 1px solid var(--sidebar-border);
}

.home-logo h1 .trade-quick-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.home-subtitle {
    font-size: 0.95rem;
    letter-spacing: 1px;
    margin-top: 4px;
    font-weight: 400;
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
    margin-top: 8px;
}

.home-card {
    border-radius: 16px;
    padding: 24px 18px 20px 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    position: relative;
    overflow: hidden;
}

.home-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.home-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    opacity: 0;
    transition: opacity 0.3s;
}

.home-card:hover::after {
    opacity: 1;
}

.home-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px auto;
    font-size: 1.5rem;
    transition: transform 0.3s;
}

.home-card:hover .home-card-icon {
    transform: scale(1.05);
}

.home-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.home-card-desc {
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.home-card-tag {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 14px;
    border-radius: 12px;
    display: inline-block;
    letter-spacing: 0.3px;
}

/* 卡片图标颜色（保持低饱和） */
.icon-blue {
    background: #e0f2fe;
    color: #3b82f6;
}

.icon-purple {
    background: #ede9fe;
    color: #8b5cf6;
}

.icon-green {
    background: #d1fae5;
    color: #10b981;
}

.icon-orange {
    background: #ffedd5;
    color: #f59e0b;
}

.icon-red {
    background: #fce4ec;
    color: #ef4444;
}

.icon-indigo {
    background: #e0e7ff;
    color: #6366f1;
}

.tag-blue {
    background: #e0f2fe;
    color: #3b82f6;
}

.tag-purple {
    background: #ede9fe;
    color: #8b5cf6;
}

.tag-green {
    background: #d1fae5;
    color: #10b981;
}

.tag-orange {
    background: #ffedd5;
    color: #f59e0b;
}

.tag-red {
    background: #fce4ec;
    color: #ef4444;
}

.tag-indigo {
    background: #e0e7ff;
    color: #6366f1;
}

/* 底部 */
.home-footer {
    margin-top: 24px;
    padding-top: 20px;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}

.footer-legal {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 12px;
}

.footer-legal a {
    text-decoration: none;
    transition: color 0.2s;
}

.footer-legal .divider {
    color: var(--sidebar-border);
}

/* ==========================================================
   移动端适配
========================================================== */
.mobile-menu-button {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1001;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 8px 30px var(--accent-glow);
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

.mobile-menu-button:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 40px var(--accent-glow);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(2px);
    z-index: 999;
}

@media (min-width: 769px) {

    .mobile-menu-button,
    .sidebar-overlay {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    .home-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 14px;
    }

    .home-card {
        padding: 20px 10px 16px;
    }

    .home-card-icon {
        width: 46px;
        height: 46px;
        font-size: 1.3rem;
    }
}

@media (max-width: 900px) {
    .home-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }

    .home-logo h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .mobile-menu-button {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100%;
        z-index: 1000;
        transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 6px 0 30px rgba(0, 0, 0, 0.06);
        border-radius: 0 16px 16px 0;
        width: 280px;
        min-width: 280px;
    }

    .sidebar.mobile-expanded {
        left: 0;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        padding: 0;
        width: 100%;
    }

    #home-container {
        padding: 16px;
    }

    .home-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .home-logo h1 {
        font-size: 1.6rem;
    }
}

@media (max-width: 480px) {
    .home-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .home-card {
        padding: 16px 10px;
    }

    .home-card-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .home-logo h1 {
        font-size: 1.3rem;
    }

    #home-container {
        padding: 12px;
    }
}

/* 隐藏辅助元素 */
#web_id,
#username,
#span_banbenhao,
#span_shengyushijian,
#user_id,
#token_shu,
#aizishu,
#pay_time,
#token_day_no,
#token_day_ys,
#business_no,
#rsu {
    display: none !important;
}

/* ==========================================================
   确保主题变量全局生效（修复 main-content 背景）
   ========================================================== */
.app-container,
.main-content,
#home-container,
.home-content {
    background: var(--main-bg) !important;
    transition: background 0.3s ease;
}

/* 所有卡片和面板也跟随 */
.home-card,
.panel-header,
.setting-section {
    background: var(--card-bg) !important;
    border-color: var(--card-border) !important;
}

/* 顶部用户栏 */
#top-user-bar {
    background: var(--topbar-bg) !important;
    border-bottom-color: var(--topbar-border) !important;
}

/* 文本颜色也跟随 */
body,
.main-content,
#home-container {
    color: var(--text-primary) !important;
}

.home-card-title {
    color: var(--text-primary) !important;
}

.home-card-desc,
.home-subtitle,
.footer-inner,
.footer-legal a {
    color: var(--text-muted) !important;
}

















/* ============================================================
   悬浮客服组件 - 右侧居中
   ============================================================ */
   #floating-widget {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 主按钮 */
.float-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #fff;
    border: none;
    user-select: none;
}

.float-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(79, 70, 229, 0.5);
}

.float-btn:active {
    transform: scale(0.95);
}

.float-btn svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    flex-shrink: 0;
}

.float-btn span {
    font-size: 10px;
    font-weight: 500;
    margin-top: 2px;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* ===== 弹窗（默认隐藏） ===== */
.cs-popover {
    position: absolute;
    right: calc(100% + 16px);
    top: 50%;
    transform: translateY(-50%) scale(0.95);
    width: 340px;
    max-width: 90vw;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.04);
    padding: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* 弹窗展开状态 */
.cs-popover.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
}

/* 小三角箭头（指向按钮） */
.cs-popover::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 0 4px 0 0;
    box-shadow: 2px -2px 8px rgba(0, 0, 0, 0.04);
}

.popover-content {
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 16px;
}

/* 二维码区域 */
.qr-img {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 0;
}

.qr-img img {
    width: 160px;
    height: 160px;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    object-fit: cover;
    background: #f8fafc;
}

/* 文字信息 */
.popover-info {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.popover-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.popover-desc {
    font-size: 14px;
    color: #64748b;
}

/* 营业时间 */
.time-table {
    background: #f8fafc;
    border-radius: 10px;
    padding: 8px 12px;
    margin: 4px 0;
}

.time-row {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.time-row-head {
    font-weight: 600;
    color: #0f172a;
    font-size: 13px;
    margin-bottom: 4px;
}

.time-row-body {
    gap: 20px;
}

.time-col {
    font-size: 13px;
    color: #475569;
    background: #ffffff;
    padding: 2px 12px;
    border-radius: 6px;
    border: 1px solid #e9edf4;
}

/* 底部提示 */
.popover-footer {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 2px;
}

.popover-footer span {
    color: #4f46e5;
    font-weight: 600;
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
    #floating-widget {
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
    }

    .float-btn {
        width: 54px;
        height: 54px;
    }

    .float-btn svg {
        width: 22px;
        height: 22px;
    }

    .float-btn span {
        font-size: 9px;
    }

    .cs-popover {
        right: calc(100% + 12px);
        width: 300px;
        max-width: 85vw;
    }

    .cs-popover::after {
        right: -6px;
        width: 12px;
        height: 12px;
    }

    .qr-img img {
        width: 130px;
        height: 130px;
    }

    .popover-title {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    #floating-widget {
        right: 8px;
    }

    .float-btn {
        width: 48px;
        height: 48px;
    }

    .float-btn svg {
        width: 18px;
        height: 18px;
    }

    .float-btn span {
        font-size: 8px;
    }

    .cs-popover {
        right: calc(100% + 8px);
        width: 280px;
        padding: 0;
    }

    .popover-content {
        padding: 14px;
    }

    .qr-img img {
        width: 110px;
        height: 110px;
    }
}






/* ============================================================
   4. 移动端菜单按钮
   ============================================================ */
.mobile-menu-button {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1001;
    background: var(--dark-bg);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    align-items: center;
    justify-content: center;
}

.mobile-menu-button:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.mobile-menu-button:active {
    transform: scale(0.95);
}

/* ============================================================
   5. 面板布局（编辑器/预览）
   ============================================================ */
.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 2px solid var(--primary);
    min-width: 0;
}

.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow-x: auto;
    gap: 6px;
    background: var(--dark-bg);
    color: white;
    padding: 15px 20px;
    font-weight: bold;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.panel-header button,
.panel-header select {
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    padding: 0 8px;
    font-size: 14px;
}

.panel-content {
    flex: 1;
    overflow: auto;
    padding: 0;
    position: relative;
}

.panel-content .panel-contents {
    flex: 1;
    overflow: auto;
    padding: 0;
    position: relative;
}

/* 面板内通用文本域 */
#inputText,
#zhidingzhiling,
#txst-aigai,
#yffx-inputText,
#yffx-reportOutput,
#yffx-statsOutput,
#txst-qingjie,
#txst-sw-hx,
#txst-sw-bj,
#txst-zidong,
#Text-typeList,
#Text-sd-mofang,
#Text-fj-mofang,
#Text-fj-fenxi,
#aixhTest,
#aixhTest_end,
#AI_kuaigao,
#AI_xunhuan,
#aikuais,
#aikuais_fx,
#aikuais_fx2,
#aikuais_fx3,
#aikuais_fx4,
#aikuais_fx5,
#aikuais_fx6,
#aikuais_fx7,
#guanjianci,
#jianjie,
#zddgxs,
#txst-zimufenxi,
#txst-aifengge,
#txst-aifengge-jg,
#tyts_txt,
#txst-sw,
#txst-tl-txt,
#wenbenfx_txt,
#chat-AIkuaixie,
#xuxietis,
#outputzimuText,
#outputText,
#subtitleInput,
#chat-taolu,
#chat-zhangjiegy {
    width: 100%;
    height: 100%;
    padding: 20px;
    border: none;
    resize: none;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 16px;
    line-height: 1.8;
    outline: none;
    box-shadow: none;
}

#output,
#aizdys {
    padding: 20px;
    height: 100%;
    overflow-y: auto;
}

/* ============================================================
   6. 按钮 & 控件
   ============================================================ */
button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-container {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: var(--light-bg);
    border-top: 1px solid var(--border-color);
}

/* 通用白色按钮 */
.btn-bai {
    display: inline-block;
    padding: 4px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    color: #2c3e50;
    text-decoration: none;
    user-select: none;
    line-height: 28px;
    height: 35px;
    box-sizing: border-box;
}

.btn-bai:hover {
    background: #f8f9fa;
    border-color: var(--dark-bg);
}

.btn-bai:active {
    background: #e0e0e0;
}

/* 按钮变体 */
.save-btn {
    background: var(--success);
}

.save-btn:hover {
    background: #219653;
}

.reset-btn {
    background: var(--danger);
}

.reset-btn:hover {
    background: #c0392b;
}

.download-btn {
    background: #9b59b6;
}

.download-btn:hover {
    background: #8e44ad;
}

.btn-dark {
    background-color: #f2f3f5;
    color: var(--dark-bg);
}

.btn-dark:hover {
    background-color: #d1d1d1;
    border-color: #f8f8f8;
}

.btn-responsive i {
    margin-right: 6px;
}

/* 响应式按钮（移动端只显示图标） */
@media (max-width: 768px) {
    .btn-responsive {
        font-size: 0 !important;
        padding: 8px 9px;
        line-height: 1;
        min-width: 36px;
        text-align: center;
    }

    .btn-responsive i {
        margin: 0;
        font-size: 16px;
    }

    .parse-btn,
    .save-btn,
    .reset-btn,
    .download-btn,
    #stopButton_zddag {
        font-size: 0;
        padding: 8px 10px;
        line-height: 1;
    }

    .parse-btn i,
    .save-btn i,
    .reset-btn i,
    .download-btn i,
    #stopButton_zddag i {
        font-size: 16px;
        margin: 0;
    }
}

#stopButton_zddag::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f04d";
    margin-right: 4px;
}

/* ============================================================
   7. 状态栏 & Toast
   ============================================================ */
.status-bar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: opacity var(--transition);
    z-index: 1000;
}

.status-bar.show {
    opacity: 1;
}

/* ============================================================
   8. 表格样式
   ============================================================ */
.table-container {
    overflow-x: auto;
    margin: 30px 0;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

th,
td {
    padding: 12px 15px;
    text-align: left;
    border: 1px solid #ddd;
}

th {
    background-color: var(--primary);
    color: white;
    position: sticky;
    top: 0;
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

tr:hover {
    background-color: #e9f7fe;
}

.table-title {
    background: var(--dark-bg);
    color: white;
    padding: 10px 15px;
    border-radius: 5px 5px 0 0;
    margin-bottom: 0;
    font-size: 18px;
}

/* ============================================================
   9. 聊天/消息样式
   ============================================================ */
.user-message {
    background-color: white;
    color: black;
    padding: 10px;
    border-radius: 5px;
    max-width: 90%;
    text-align: left;
    margin-left: auto;
    float: right;
    clear: both;
    display: flex;
}

.ai-message {
    background-color: white;
    color: black;
    padding: 10px;
    border-radius: 5px;
    max-width: 90%;
    text-align: left;
    clear: both;
    display: flex;
}

.user-message .message-container {
    justify-content: flex-end;
    margin-right: 10px;
}

.ai-message .message-container {
    justify-content: flex-start;
    margin-left: 10px;
}

/* ============================================================
   10. 弹窗/模态框
   ============================================================ */
#ai_zhiling {
    display: none;
    position: fixed;
    width: 750px;
    height: 580px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
    background-color: var(--light-bg);
    z-index: 1000;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
}

/* 通用弹窗（AI快写等） */
#aikuai,
#aizhanggang,
#tisci_pro,
#typeListwd,
#aizjfjfx,
#aichaishu,
#aitanchuang {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 800px;
    background: white;
    padding: 0;
    border-radius: var(--radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1050;
    transition: transform 0.2s ease;
    min-height: auto;
    height: auto;
    max-height: 90vh;
    overflow: visible;
}

#aikuai .popup-content,
#aizhanggang .popup-content,
#tisci_pro .popup-content,
#typeListwd .popup-content,
#aizjfjfx .popup-content,
#aichaishu .popup-content,
#aitanchuang .popup-content {
    padding: 20px;
}

#aikuai textarea,
#aizhanggang textarea,
#tisci_pro textarea,
#typeListwd textarea,
#aizjfjfx textarea,
#aichaishu textarea,
#aitanchuang textarea {
    width: 100%;
    min-height: 100px;
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
    overflow: auto;
}

#aikuai .button-group,
#aizhanggang .button-group,
#tisci_pro .button-group,
#typeListwd .button-group,
#aizjfjfx .button-group,
#aichaishu .button-group,
#aitanchuang .button-group {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

/* 桌面端可拖动 */
@media (min-width: 769px) {

    #aikuai.draggable,
    #aizhanggang.draggable,
    #tisci_pro.draggable,
    #typeListwd.draggable,
    #aizjfjfx.draggable,
    #aichaishu.draggable,
    #aitanchuang.draggable {
        user-select: none;
    }

    #aikuai.dragging,
    #aizhanggang.dragging,
    #tisci_pro.dragging,
    #typeListwd.dragging,
    #aizjfjfx.dragging,
    #aichaishu.dragging,
    #aitanchuang.dragging {
        transition: none;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
        height: auto;
        min-height: auto;
    }
}

/* 移动端弹窗 */
@media (max-width: 768px) {
    #ai_zhiling {
        width: 90%;
        height: 80vh;
        max-height: 80vh;
        padding: 15px;
    }

    #ai_zhiling .window-content {
        padding: 10px;
    }

    #ai_zhiling textarea {
        width: 100%;
        height: 200px;
    }

    #aikuai,
    #aizhanggang,
    #tisci_pro,
    #typeListwd,
    #aizjfjfx,
    #aichaishu,
    #aitanchuang {
        width: 90%;
        max-width: none;
        padding: 0px;
    }

    #aikuai .drag-handle,
    #aizhanggang .drag-handle,
    #tisci_pro .drag-handle,
    #typeListwd .drag-handle,
    #aizjfjfx .drag-handle,
    #aichaishu .drag-handle,
    #aitanchuang .drag-handle {
        display: none;
    }
}

/* 遮罩层 */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

/* ============================================================
   11. 历史记录
   ============================================================ */
.history-container {
    height: 410px;
    overflow-y: auto;
    padding: 10px;
    margin: 10px 0;
    background: white;
    border-radius: var(--radius);
    border: 1px solid #e0e0e0;
}

.history-container::-webkit-scrollbar {
    width: 8px;
}

.history-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.history-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.history-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.session-item {
    padding: 12px 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.session-item:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.session-item .title {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--dark-bg);
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 100px;
}

.session-item .uuid {
    font-size: 11px;
    color: #95a5a6;
    margin-bottom: 8px;
    transition: opacity 0.2s;
}

.session-item .preview {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 10px;
}

.session-item .buttons {
    display: none;
    position: absolute;
    right: 10px;
    top: 10px;
}

.session-item:hover .buttons {
    display: flex;
    gap: 5px;
}

.session-item .buttons button {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 4px;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.session-item .buttons button:hover {
    background: var(--primary-dark);
}

.session-item .buttons button:last-child {
    background: var(--danger);
}

.session-item .buttons button:last-child:hover {
    background: #c0392b;
}

.session-item .time {
    font-size: 11px;
    color: #bdc3c7;
    align-self: flex-end;
}

.search-area {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#searchInput {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

#searchButton {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

#searchButton:hover {
    background: var(--primary-dark);
}

/* 分类标题 */
#todaySessions h2,
#thisMonthSessions h2,
#moreSessions h2 {
    font-size: 16px;
    color: var(--dark-bg);
    margin: 15px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 30px;
    color: #95a5a6;
    font-style: italic;
}

/* ============================================================
   12. 教程页面
   ============================================================ */
#tutorial-container {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    padding: 20px;
}

.tutorial-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
    height: 430px;
}

.tutorial-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.tutorial-card .card-body {
    padding: 15px;
    height: 350px;
    display: flex;
    flex-direction: column;
}

.tutorial-card h5 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: var(--dark-bg);
    line-height: 1.4;
}

.tutorial-card hr {
    margin: 10px 0;
    border: 0;
    border-top: 1px solid #eee;
    width: 100%;
}

.tutorial-card iframe {
    flex: 1;
    border: none;
    border-radius: 4px;
}

.tutorial-controls {
    padding: 15px 20px;
    background: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.tutorial-search {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.tutorial-search input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.tutorial-search i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #95a5a6;
}

.tutorial-filters select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
    font-size: 14px;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
    grid-column: 1 / -1;
}

/* ============================================================
   13. 设置页面
   ============================================================ */
#boogan_shezhi {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    background: var(--light-bg);
}

.setting-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 20px;
    margin-bottom: 25px;
}

.setting-header {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-bg);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
    display: flex;
    align-items: center;
}

.setting-header i {
    margin-right: 10px;
    color: var(--primary);
}

.setting-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.setting-item {
    margin-bottom: 15px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #34495e;
}

.setting-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all var(--transition);
}

.setting-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    outline: none;
}

.btn-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.setting-hint {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 8px;
    font-style: italic;
}

.setting-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #ddd, transparent);
    margin: 25px 0;
}

/* ============================================================
   14. Mermaid 图表
   ============================================================ */
.mermaid-container {
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    margin: 16px 0;
    background: #fff;
    overflow: hidden;
}

.mermaid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid #e1e4e8;
    background: #f6f8fa;
    font-weight: 600;
}

.mermaid-controls {
    display: flex;
    gap: 8px;
}

.mermaid-btn {
    background: none;
    border: 1px solid #d1d5da;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    color: #24292e;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 24px;
}

.mermaid-btn:hover {
    background-color: #f3f4f6;
}

.mermaid-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mermaid-diagram {
    overflow: hidden;
    padding: 16px;
    background: #fff;
    min-height: 200px;
    position: relative;
    cursor: grab;
    height: 480px;
}

.mermaid-diagram.dragging {
    cursor: grabbing;
}

.mermaid-viewport {
    transform-origin: 0 0;
    transition: transform 0.1s ease;
}

.mermaid-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #6a737d;
}

.mermaid-btn.download-btn {
    color: #28a745;
    border-color: #28a745;
}

.mermaid-btn.download-btn:hover {
    background-color: rgba(40, 167, 69, 0.1);
}

.fa-download {
    font-size: 12px;
}

/* ============================================================
   15. 图片/视频结果网格
   ============================================================ */
#image-results,
#video-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    padding: 20px 0;
    margin-bottom: 40px;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    min-height: 0;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    height: auto;
}

.result-card {
    min-height: 360px;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all var(--transition);
}

.result-image,
.result-video {
    height: 200px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--light-bg);
    border-bottom: 1px solid #eee;
}

.result-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 120px;
}

.result-content h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    line-height: 1.4;
    color: #333;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
}

.result-actions {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #666;
    background: var(--light-bg);
    border-radius: 12px;
    margin: 20px 0;
}

.empty-state i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-state h3 {
    margin: 10px 0;
    color: #333;
    font-size: 20px;
}

/* ============================================================
   16. 拖拽 & 窗口控制
   ============================================================ */
.draggable {
    position: absolute;
    left: 0;
    top: 0;
}

.draggable .drag-handle {
    cursor: move;
}

.draggable .window-content {
    padding: 20px;
}

.ai-draggable {
    cursor: move !important;
    user-select: none !important;
}

.ai-draggable:active {
    cursor: grabbing !important;
}

.window-resize-handle {
    position: absolute !important;
    bottom: 0 !important;
    right: 0 !important;
    width: 20px !important;
    height: 20px !important;
    cursor: nwse-resize !important;
    z-index: 100 !important;
    background: linear-gradient(135deg, transparent 50%, #94a3b8 50%) !important;
    border-radius: 0 0 4px 0 !important;
    transition: all 0.25s ease !important;
    pointer-events: auto !important;
    user-select: none !important;
}

.window-resize-handle:hover {
    background: linear-gradient(135deg, transparent 50%, #4f46e5 50%) !important;
    width: 24px !important;
    height: 24px !important;
    box-shadow: 0 0 16px rgba(79, 70, 229, 0.4) !important;
}

.dragging-window {
    cursor: move !important;
    user-select: none !important;
}

/* ============================================================
   17. 试用弹窗
   ============================================================ */
.trial-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.trial-modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.4s ease-out;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.trial-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1;
}

.trial-header h2 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
}

.trial-subtitle {
    margin: 8px 0 0;
    opacity: 0.9;
    font-size: 15px;
}

.trial-body {
    padding: 24px;
}

.trial-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--light-bg);
    border-radius: var(--radius);
    border-left: 4px solid #667eea;
}

.feature-icon {
    font-size: 18px;
}

.feature-text {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.trial-instructions {
    background: #f0f7ff;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 20px;
    border: 1px solid #d1e3ff;
}

.instructions-title {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--dark-bg);
    display: flex;
    align-items: center;
    gap: 8px;
}

.instruction-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.instruction-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.step-number {
    background: #667eea;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
    margin-top: 2px;
}

.step-content {
    flex: 1;
}

.step-content h4 {
    margin: 0 0 6px 0;
    font-size: 14px;
    color: var(--dark-bg);
    font-weight: 600;
}

.step-content p {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #555;
    line-height: 1.4;
}

.bilibili-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f5f7ff;
    color: #667eea;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #d1e3ff;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.bilibili-link:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.bilibili-icon {
    font-size: 14px;
}

.wechat-info {
    background: #f5f7ff;
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid #e0e7ff;
}

.wechat-account {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

.wechat-icon {
    font-size: 14px;
}

.wechat-code {
    background: var(--dark-bg);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

.step-tip {
    background: #fff9e6;
    border-left: 3px solid #ffc107;
    padding: 6px 10px;
    font-size: 12px;
    color: #8a6d3b;
    border-radius: 0 4px 4px 0;
    margin-top: 8px !important;
}

.trial-code-section {
    margin-bottom: 20px;
}

.trial-code-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.trial-code-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    font-family: monospace;
    background: white;
    transition: all var(--transition);
    box-sizing: border-box;
}

.trial-code-input:focus {
    outline: none;
    border-color: #667eea;
    background: #f8f9ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.trial-code-hint {
    margin: 8px 0 0;
    font-size: 13px;
    color: #888;
}

.trial-error-message,
.trial-success-message {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.trial-error-message.show {
    display: block;
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
    animation: fadeIn 0.3s;
}

.trial-success-message.show {
    display: block;
    background: #efffee;
    color: #2a8;
    border: 1px solid #cfc;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.trial-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.btn-activate {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-activate:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.btn-activate:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-skip {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    padding: 14px;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-skip:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.trial-footer {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.trial-note {
    margin: 0;
    font-size: 13px;
    color: #888;
}

/* ============================================================
   18. 地图编辑器
   ============================================================ */
#newditu {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f9fafb;
    overflow: hidden;
}

.dt-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    align-items: center;
    flex-shrink: 0;
}

.dt-toolbar select,
.dt-toolbar button,
.dt-toolbar input {
    height: 32px;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: white;
    padding: 0 8px;
}

.dt-toolbar button {
    background: #f3f4f6;
    cursor: pointer;
    transition: all 0.2s;
}

.dt-toolbar button:hover {
    background: #e5e7eb;
}

.landmark-area {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 8px 12px;
    flex-shrink: 0;
}

.landmark-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.landmark-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
    max-height: 130px;
    overflow-y: auto;
    padding: 4px 2px;
}

.landmark-grid input {
    width: 100%;
    padding: 5px 4px;
    font-size: 12px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
}

.map-area {
    flex: 1;
    overflow: auto;
    padding: 12px;
    background: #fefefe;
}

.map-table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.map-table {
    border-collapse: collapse;
    min-width: 100%;
    font-size: 12px;
}

.map-table th,
.map-table td {
    border: 1px solid #e2e8f0;
    padding: 6px 4px;
    text-align: center;
    background-color: #fff;
}

.map-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #1e293b;
}

.map-table input {
    width: 70px;
    padding: 6px 4px;
    text-align: center;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    font-size: 12px;
    transition: 0.1s;
}

.map-table input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.region-selector {
    background: #f1f5f9;
    border-radius: 20px;
    padding: 2px 10px;
    font-weight: 500;
}

.dt-status {
    font-size: 11px;
    color: #6c757d;
    margin-left: auto;
}

/* ============================================================
   19. 关系图
   ============================================================ */
.panel-main {
    flex: 1;
    display: flex;
    position: relative;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

#main {
    flex: 1;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

/* 关系图容器 */
#newrenwusd {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100000;
    background: #fff;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

#newrenwusd #main {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

#newrenwusd .panel-main {
    flex: 1;
    min-height: 300px;
}

#newrenwusd #guanxitu-container {
    display: flex !important;
    flex: 1;
    min-height: 0;
    height: 100%;
    flex-direction: column;
}

#newrenwusd .writing-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

#newrenwusd .crawler-preset-buttons {
    flex-shrink: 0;
}

#guanxitu-toolbar {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    padding: 6px 12px;
    background: #f0f2f5;
    border-bottom: 2px solid #ddd;
    align-items: center;
}

#guanxitu-close-btn {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 100001;
    padding: 6px 16px;
    background: #ff4444;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    display: none;
}

/* 关系图表格容器 */
#newrenwusd .table-responsive td:first-child,
#newrenwusd .table-responsive th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: #ffffffef;
}

#newrenwusd .table-responsive th:first-child {
    z-index: 2;
}

#newrenwusd .table-responsive {
    flex: 1;
    overflow: auto;
    max-height: 500px;
}

#newrenwusd #novelTable {
    width: 1550px;
}

#newrenwusd .rw-table-responsive {
    height: 580px;
}

#newrenwusd #test,
#newrenwusd #test2 {
    width: 100% !important;
    table-layout: fixed;
}

#newrenwusd #test input,
#newrenwusd #test2 input,
#newrenwusd #test select,
#newrenwusd #test2 select {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 4px 8px;
    background-color: transparent;
}

#newrenwusd #test td,
#newrenwusd #test2 td {
    padding: 0 !important;
    margin: 0 !important;
    border: 1px solid #e0e0e0 !important;
    position: relative;
}

#newrenwusd #test th,
#newrenwusd #test2 th {
    padding: 8px 4px;
    background-color: #202020;
}

#newrenwusd #test input:focus,
#newrenwusd #test2 input:focus {
    background-color: #f0f8ff;
    outline: none;
}

/* 人物设定/关系 */
#new_renwu_sd,
#new_renwu_gx {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: #ffffff;
    overflow: hidden;
    border-radius: 8px;
    box-sizing: border-box;
}

#rwtc1-1,
#rwtc2-1 {
    flex-shrink: 0;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    row-gap: 10px;
}

#rwtc1-1 button,
#rwtc2-1 button {
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
}

#rwtc1-1 select,
#rwtc2-1 select {
    height: 34px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: white;
    font-size: 13px;
}

#rwtc1-2,
#rwtc2-2 {
    flex: 1;
    overflow: auto;
    min-height: 0;
    background: #ffffff;
    padding: 0;
    position: relative;
    max-height: calc(100vh - 280px) !important;
    overflow: auto !important;
    min-height: 200px;
}

#test,
#test2 {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
    min-width: 600px;
    max-width: 100%;
}

#test th,
#test2 th {
    background: #f1f5f9;
    color: #1e293b;
    font-weight: 600;
    padding: 12px 8px;
    border: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(2px);
}

#test td,
#test2 td {
    border: 1px solid #e2e8f0;
    padding: 8px 6px;
    vertical-align: middle;
    background-color: #fff;
    transition: background 0.1s;
}

#test input,
#test2 input,
#test select,
#test2 select {
    width: 100%;
    border: none;
    background: transparent;
    padding: 8px 4px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: background 0.1s;
}

#test input:focus,
#test2 input:focus {
    background: #fef9e3;
    border-radius: 4px;
    outline: 1px solid #facc15;
}

#test td:last-child,
#test2 td:last-child {
    min-width: 180px;
}

#test tr:hover td,
#test2 tr:hover td {
    background: #f8fafc;
}

/* 人物关系图 name-cell */
.name-cell {
    text-align: center;
    vertical-align: middle;
    padding: 8px !important;
}

.name-cell .avatar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.name-cell .char-avatar {
    width: 100px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.name-cell .avatar-pick-btn {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
    width: auto;
    display: inline-block;
}

.name-cell .char-name {
    width: 140px;
    text-align: center;
    padding: 6px;
    margin-top: 4px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

/* 表头行高度 */
#test tr.header {
    height: auto;
}

#test th {
    background: #f1f5f9;
    padding: 10px 8px;
    vertical-align: middle;
    font-weight: 600;
    text-align: center;
}

#test tr:not(.header) {
    height: 210px;
}

#test td {
    vertical-align: top;
}

#test th:nth-child(1),
#test td:nth-child(1) {
    width: 40px;
    text-align: center;
    vertical-align: middle;
}

#test th:nth-child(2),
#test td:nth-child(2) {
    width: 200px;
}

#test th:nth-child(3),
#test td:nth-child(3) {
    width: 80px;
}

#test th:nth-child(4),
#test td:nth-child(4) {
    width: 100px;
}

#test th:nth-child(5),
#test td:nth-child(5) {
    width: auto;
}

.avatar-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #64748b;
}

.name-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    width: 100%;
    flex-wrap: nowrap;
}

.name-row .char-name {
    flex: 2;
    min-width: 0;
    padding: 6px 4px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
    background: white;
}

.name-row .avatar-pick-btn {
    flex: 1;
    white-space: nowrap;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 0;
    cursor: pointer;
    font-size: 12px;
}

#test td input[type="text"] {
    width: 100%;
    padding: 6px 4px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 13px;
}

#test td:last-child {
    padding: 0 !important;
    vertical-align: top;
}

#test td:last-child textarea {
    width: 100%;
    height: 210px;
    border: none;
    padding: 8px;
    resize: vertical;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;
    background: transparent;
    box-sizing: border-box;
    outline: none;
    margin: 0;
}

#test td:last-child textarea:focus {
    box-shadow: inset 0 0 0 1px #3b82f6;
    border-radius: 4px;
}

#test2 tr {
    height: 60px;
}

#test2 td {
    vertical-align: middle;
    padding: 4px 8px;
}

#test2 select,
#test2 input {
    box-sizing: border-box;
    margin: 0;
}

.del-row-btn:hover {
    background: #d9363e !important;
}

.row-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* ============================================================
   20. 爬虫/下载区
   ============================================================ */
.crawler-right,
.panel-content,
.prompt-content {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#pacongye,
#txtwb_xz {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   21. 帮助中心
   ============================================================ */
.help-center {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #ffffff;
    overflow: hidden;
}

.help-header {
    padding: 12px 20px;
    border-bottom: 1px solid #eef2f6;
    flex-shrink: 0;
}

.help-header h2 {
    font-size: 1.25rem;
    margin: 0 0 4px 0;
}

.help-header p {
    font-size: 0.8rem;
    color: #5b6e8c;
    margin: 0;
}

.help-tabs {
    display: flex;
    gap: 8px;
    padding: 8px 20px 0;
    border-bottom: 1px solid #eef2f6;
    flex-shrink: 0;
}

.help-tab {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: 30px;
    background: #000000;
    cursor: pointer;
}

.help-tab.active {
    background: var(--dark-bg);
    color: white;
}

.help-cards-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    background: #fafcff;
}

.help-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.help-card {
    background: white;
    border-radius: 16px;
    border: 1px solid #edf2f7;
    cursor: pointer;
    transition: 0.1s;
}

.help-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -8px rgba(0, 0, 0, 0.1);
}

.card-media {
    height: 120px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.card-content {
    padding: 12px;
}

.card-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 30px;
    display: inline-block;
    margin-bottom: 8px;
}

.card-badge.article {
    background: #e0f2fe;
    color: #0369a1;
}

.card-badge.video {
    background: #fee2e2;
    color: #b91c1c;
}

.help-card h4 {
    font-size: 0.95rem;
    margin: 6px 0;
}

.help-card p {
    font-size: 0.75rem;
    color: #475569;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    padding: 8px 12px;
    border-top: 1px solid #f0f4f9;
    font-size: 0.7rem;
    color: #6c86a3;
    display: flex;
    justify-content: space-between;
}

.detail-preview {
    background: #f8fafd;
    border-radius: 16px;
    border: 1px solid #e9edf2;
    padding: 16px 20px;
    margin: 0 16px 16px 16px;
    max-height: 480px;
    overflow-y: auto;
}

.detail-content img,
.detail-content video {
    max-width: 100%;
    border-radius: 12px;
    margin: 12px 0;
}

.pagination-controls {
    margin-top: 20px;
    text-align: center;
}

.pagination-controls button {
    background: #f1f5f9;
    border: none;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================
   22. 工具类（辅助样式）
   ============================================================ */
.text-center {
    text-align: center !important;
}

/* ============================================================
   23. 移动端响应式
   ============================================================ */
/* 桌面端隐藏移动元素 */
@media (min-width: 769px) {
    .mobile-menu-button {
        display: none;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* 移动端主体适配 */
@media (max-width: 768px) {
    .mobile-menu-button {
        display: flex;
    }

    /* 侧边栏移动端 */
    .sidebar {
        position: fixed;
        left: -250px;
        top: 0;
        height: 100%;
        z-index: 1000;
        transition: left var(--transition);
        box-shadow: 3px 0 15px rgba(0, 0, 0, 0.3);
    }

    .sidebar.mobile-expanded {
        left: 0;
        width: 70%;
    }

    .sidebar.mobile-expanded+.sidebar-overlay {
        display: block;
    }

    .sidebar:not(.mobile-expanded) {
        transform: translateX(-100%);
        width: 0;
        opacity: 0;
        overflow: hidden;
    }

    /* 主内容 */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 0;
        overflow-x: hidden;
        height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .container {
        flex-direction: column;
        height: auto;
        min-height: 180vh;
        padding: 0;
        overflow: visible;
    }

    .editor-panel,
    .preview-panel,
    .writing-panel {
        height: 95vh;
        min-height: 95vh;
        border-right: none;
        border-bottom: 2px solid var(--primary);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        position: relative;
        margin-bottom: 10px;
    }

    .container>div:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }

    .panel-header,
    .writing-header,
    .prompt-header {
        flex-shrink: 0;
        padding: 12px 15px;
        background: var(--dark-bg);
        color: white;
    }

    .panel-content,
    .panel-contents,
    .writing-content {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }

    /* 面板内文本域高度自适应 */
    #txst-aigai,
    #inputText,
    #zhidingzhiling,
    #output,
    #aizdys,
    #yffx-inputText,
    #yffx-reportOutput,
    #yffx-statsOutput,
    #txst-qingjie,
    #txst-sw-hx,
    #txst-sw-bj,
    #txst-zidong,
    #Text-typeList,
    #Text-sd-mofang,
    #Text-fj-mofang,
    #Text-fj-fenxi,
    #aixhTest,
    #aixhTest_end,
    #AI_kuaigao,
    #AI_xunhuan,
    #aikuais,
    #aikuais_fx,
    #aikuais_fx2,
    #aikuais_fx3,
    #aikuais_fx4,
    #aikuais_fx5,
    #aikuais_fx6,
    #aikuais_fx7,
    #guanjianci,
    #jianjie,
    #zddgxs,
    #txst-zimufenxi,
    #txst-aifengge,
    #txst-aifengge-jg,
    #tyts_txt,
    #txst-sw,
    #txst-tl-txt,
    #wenbenfx_txt,
    #chat-AIkuaixie,
    #xuxietis,
    #outputzimuText,
    #outputText,
    #subtitleInput,
    #chat-taolu,
    #chat-zhangjiegy {
        height: 450px;
        box-sizing: border-box;
        resize: none;
        background: white;
    }

    #xuxietis1,
    #xuxietis2 {
        width: 100%;
        height: 400px;
        box-sizing: border-box;
        resize: none;
        background: white;
    }

    .btn-container,
    .writing-controls {
        flex-shrink: 0;
        padding: 12px 15px;
        background: var(--light-bg);
        border-top: 1px solid var(--border-color);
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn-container button,
    .writing-controls button {
        min-height: 36px;
        font-size: 14px;
    }

    /* 结果网格移动端单列 */
    #image-results,
    #video-results {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .result-card {
        min-height: 340px;
    }

    .result-image,
    .result-video {
        height: 180px;
        min-height: 180px;
    }

    .result-content {
        padding: 15px;
    }

    /* 教程卡片 */
    .tutorial-grid {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .tutorial-card {
        height: auto;
        min-height: 400px;
    }

    .tutorial-card .card-body {
        height: auto;
        min-height: 320px;
    }

    /* 弹窗 */
    #aikuai,
    #aizhanggang,
    #tisci_pro,
    #typeListwd,
    #aizjfjfx,
    #aichaishu,
    #aitanchuang {
        width: 90%;
        max-width: none;
        padding: 0px;
    }

    #aikuai .drag-handle,
    #aizhanggang .drag-handle,
    #tisci_pro .drag-handle,
    #typeListwd .drag-handle,
    #aizjfjfx .drag-handle,
    #aichaishu .drag-handle,
    #aitanchuang .drag-handle {
        display: none;
    }

    /* 关系图移动端 */
    #newrenwusd #main {
        width: 100%;
        height: 100%;
    }

    #newrenwusd .rw-table-responsive {
        height: 380px;
    }

    #newrenwusd #test,
    #newrenwusd #test2 {
        height: 380px;
        min-width: 600px;
        width: auto !important;
        table-layout: fixed;
        display: block;
        overflow-y: auto;
        overflow-x: hidden;
    }

    #newrenwusd #test thead,
    #newrenwusd #test2 thead {
        position: sticky;
        top: 0;
        z-index: 10;
        display: table;
        width: 100%;
    }

    #newrenwusd #test tbody,
    #newrenwusd #test2 tbody {
        display: table;
        width: 100%;
    }

    #newrenwusd #test th,
    #newrenwusd #test2 th {
        background-color: #202020;
        position: sticky;
        top: 0;
    }

    #rwtc1-2,
    #rwtc2-2 {
        max-height: calc(100vh - 200px) !important;
    }

    #rwtc1-1,
    #rwtc2-1 {
        padding: 10px 12px;
        gap: 6px;
    }

    #rwtc1-1 button,
    #rwtc2-1 button {
        height: 32px;
        padding: 0 10px;
        font-size: 12px;
    }

    #rwtc1-1 select,
    #rwtc2-1 select {
        height: 32px;
        font-size: 12px;
    }

    #rwtc1-2,
    #rwtc2-2 {
        overflow-x: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #test th,
    #test2 th,
    #test td,
    #test2 td {
        padding: 10px 6px;
    }

    #test,
    #test2 {
        min-width: 520px;
    }

    /* 超小屏 */
    @media (max-width: 480px) {

        .editor-panel,
        .preview-panel,
        .writing-panel {
            height: 75vh;
            min-height: 75vh;
        }

        .editor-container textarea:nth-child(1):nth-last-child(3),
        .editor-container textarea:nth-child(1):nth-last-child(3)~textarea {
            flex: 0 0 42%;
        }

        .editor-container .panel-header {
            flex: 0 0 16%;
        }

        .panel-header,
        .writing-header,
        .prompt-header {
            flex-wrap: wrap;
        }

        .btn-container,
        .writing-controls {
            flex-direction: column;
        }

        .btn-container button,
        .writing-controls button {
            width: 100%;
        }

        #test th,
        #test2 th {
            font-size: 12px;
            padding: 8px 4px;
        }

        #test td,
        #test2 td {
            padding: 6px 4px;
            font-size: 12px;
        }

        #test input,
        #test2 input {
            padding: 6px 2px;
            font-size: 12px;
        }

        #newrenwusd .rw-table-responsive {
            height: 250px;
        }

        #newrenwusd #test,
        #newrenwusd #test2 {
            min-width: 520px;
        }
    }
}