        :root {
            --primary: #4F46E5;
            --primary-hover: #4338CA;
            --primary-light: #6366F1;
            --secondary: #7C3AED;
            --accent: #06B6D4;
            --bg: #0B1120;
            --surface: #1A2332;
            --surface-hover: #243044;
            --border: #2D3A4F;
            --text-primary: #F1F5F9;
            --text-secondary: #94A3B8;
            --success: #10B981;
            --warning: #F59E0B;
            --error: #EF4444;
            --gradient: linear-gradient(135deg, #4F46E5, #7C3AED);
        }

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

        body {
            font-family: 'Inter', system-ui, sans-serif;
            background: var(--bg);
            color: var(--text-primary);
            min-height: 100vh;
            line-height: 1.6;
        }

        /* Header */
        .header {
            border-bottom: 1px solid var(--border);
            padding: 1rem 0;
            position: sticky;
            top: 0;
            z-index: 100;
            backdrop-filter: blur(20px);
            background: rgba(26, 35, 50, 0.85);
        }

        .header-content {
            width: 100%;
            max-width: 1600px;
            margin: 0 auto;
            padding: 0 1.5rem;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
        }

        /* ========== 顶层导航 Tab ========== */
        .nav-tabs {
            display: flex;
            gap: 0;
            background: var(--surface);
            border-radius: 10px;
            border: 1px solid var(--border);
            overflow: hidden;
        }
        .nav-tab {
            padding: 0.5rem 2rem;
            font-size: 0.88rem;
            font-weight: 500;
            border: none;
            background: transparent;
            color: var(--text-secondary);
            cursor: pointer;
            transition: all 0.25s;
            white-space: nowrap;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.35rem;
            border-bottom: 2px solid transparent;
            min-width: 120px;
        }
        .nav-tab:hover {
            color: var(--text-primary);
            background: var(--surface-hover);
        }
        .nav-tab.active {
            color: var(--primary);
            background: rgba(99, 102, 241, 0.08);
            border-bottom-color: var(--primary);
            font-weight: 600;
        }
        .nav-tab .nav-tab-icon {
            font-size: 1rem;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .logo h1 {
            font-size: 1.15rem;
            font-weight: 700;
            color: var(--text-primary);
            letter-spacing: 0.5px;
        }

        .cloud-status {
            font-size: 0.7rem;
            font-weight: 500;
            padding: 0.15rem 0.5rem;
            border-radius: 6px;
            background: var(--surface);
            border: 1px solid var(--border);
            color: var(--text-secondary);
            white-space: nowrap;
            cursor: default;
            transition: all 0.3s ease;
        }
        .cloud-status.online {
            color: var(--success);
            border-color: rgba(16, 185, 129, 0.3);
            background: rgba(16, 185, 129, 0.08);
        }
        .cloud-status.offline {
            color: var(--warning);
            border-color: rgba(245, 158, 11, 0.3);
            background: rgba(245, 158, 11, 0.08);
            cursor: pointer;
            transition: all 0.2s;
        }
        .cloud-status.offline:hover {
            border-color: var(--primary);
            color: var(--primary);
            background: rgba(99, 102, 241, 0.1);
        }

        .header-actions {
            display: flex;
            gap: 0.5rem;
        }

        /* Buttons */
        .btn {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.55rem 1.1rem;
            border-radius: 10px;
            border: none;
            cursor: pointer;
            font-family: inherit;
            font-size: 0.85rem;
            font-weight: 500;
            transition: all 0.2s ease;
            letter-spacing: 0.2px;
            white-space: nowrap;
        }

        .btn:active {
            transform: scale(0.96);
        }

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

        .btn-primary:hover {
            background: var(--primary-hover);
            box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
            transform: translateY(-1px);
        }

        .btn-secondary {
            background: var(--surface-hover);
            color: var(--text-primary);
            border: 1px solid var(--border);
        }

        .btn-secondary:hover {
            background: var(--border);
            border-color: var(--text-secondary);
            transform: translateY(-1px);
        }

        .btn-danger {
            background: var(--error);
            color: white;
        }

        .btn-danger:hover {
            background: #DC2626;
        }

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

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

        .btn-sm {
            padding: 0.35rem 0.75rem;
            font-size: 0.78rem;
            border-radius: 8px;
        }

        .btn-toggle-visibility {
            position: absolute;
            right: 6px;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 2px 4px;
            font-size: 0.72rem;
            line-height: 1;
            white-space: nowrap;
        }

        .btn-toggle-visibility:hover {
            color: var(--text-primary);
        }

        .btn-icon {
            width: 32px;
            height: 32px;
            padding: 0;
            justify-content: center;
            font-size: 1rem;
        }

        /* Main Layout */
        .main {
            max-width: 1600px;
            margin: 0 auto;
            padding: 1.5rem;
        }

        /* 视图容器切换 */
        .view-container {
            display: none;
        }
        .view-container.active {
            display: block;
        }

        /* 两栏布局（词汇组合视图） */
        .layout-columns {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1.5rem;
            align-items: start;
        }

        .layout-left,
        .layout-right {
            display: flex;
            flex-direction: column;
            gap: 1.25rem;
            min-width: 0;
        }

        /* ========== 图片反推独立视图布局 ========== */
        .image-prompt-layout {
            display: grid;
            grid-template-columns: 360px 1fr;
            gap: 1.5rem;
            align-items: start;
            height: calc(100vh - 140px);
            min-height: 600px;
        }
        @media (max-width: 900px) {
            .image-prompt-layout {
                grid-template-columns: 1fr;
                height: auto;
            }
        }

        /* 左侧面板 */
        .image-prompt-layout .left-panel {
            display: flex;
            flex-direction: column;
            gap: 1rem;
            height: 100%;
            overflow-y: auto;
        }
        .image-prompt-layout .left-panel::-webkit-scrollbar { width: 4px; }
        .image-prompt-layout .left-panel::-webkit-scrollbar-track { background: transparent; }
        .image-prompt-layout .left-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

        .image-prompt-layout .left-panel .panel-card {
            background: var(--surface);
            border-radius: 12px;
            border: 1px solid var(--border);
            overflow: hidden;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
        }
        .image-prompt-layout .left-panel .panel-card .card-header {
            padding: 0.75rem 1rem;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: rgba(15, 23, 42, 0.3);
        }
        .image-prompt-layout .left-panel .panel-card .card-header .card-title {
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text-primary);
            display: flex;
            align-items: center;
            gap: 0.4rem;
        }
        .image-prompt-layout .left-panel .panel-card .card-body {
            padding: 0.875rem 1rem;
        }

        /* 上传区域 */
        .image-prompt-layout .upload-zone {
            border: 2px dashed var(--border);
            border-radius: 10px;
            padding: 1.5rem 1rem;
            text-align: center;
            cursor: pointer;
            transition: all 0.25s ease;
            min-height: 120px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            background: rgba(15, 23, 42, 0.3);
        }
        .image-prompt-layout .upload-zone:hover,
        .image-prompt-layout .upload-zone.drag-over {
            border-color: var(--primary);
            background: rgba(99, 102, 241, 0.08);
        }
        .image-prompt-layout .upload-zone.has-image {
            padding: 0.5rem;
            min-height: auto;
            border-style: solid;
            border-color: var(--primary);
            background: rgba(99, 102, 241, 0.05);
        }
        .image-prompt-layout .upload-zone .upload-icon { font-size: 2rem; opacity: 0.6; }
        .image-prompt-layout .upload-zone .upload-text { font-size: 0.8rem; color: var(--text-secondary); }
        .image-prompt-layout .upload-zone .upload-hint { font-size: 0.7rem; color: var(--text-muted); }
        .image-prompt-layout .preview-container {
            position: relative;
            width: 100%;
            border-radius: 8px;
            overflow: hidden;
        }
        .image-prompt-layout .preview-container img {
            width: 100%;
            height: auto;
            max-height: 200px;
            object-fit: contain;
            display: block;
            border-radius: 6px;
        }
        .image-prompt-layout .preview-remove {
            position: absolute;
            top: 4px;
            right: 4px;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            background: rgba(0,0,0,0.6);
            color: #fff;
            border: none;
            cursor: pointer;
            font-size: 0.75rem;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
        }
        .image-prompt-layout .preview-remove:hover { background: #ef4444; }

        /* 模式选择 */
        .image-prompt-layout .mode-selector {
            display: flex;
            gap: 0.4rem;
            margin-bottom: 0.75rem;
        }
        .image-prompt-layout .mode-btn,
        .image-prompt-layout #providerSelector .mini-btn {
            flex: 1;
            padding: 0.4rem 0.3rem;
            border-radius: 8px;
            font-size: 0.75rem;
            border: 1px solid var(--border);
            background: transparent;
            color: var(--text-secondary);
            cursor: pointer;
            transition: all 0.2s;
            text-align: center;
        }
        .image-prompt-layout .mode-btn:hover,
        .image-prompt-layout #providerSelector .mini-btn:hover {
            border-color: var(--primary);
            color: var(--primary);
        }
        .image-prompt-layout .mode-btn.active,
        .image-prompt-layout #providerSelector .mini-btn.active {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff;
        }
        .image-prompt-layout #providerSelector {
            display: flex;
            gap: 0.4rem;
            margin-bottom: 0.75rem;
        }

        /* 智谱模型下拉选择 */
        .image-prompt-layout #zhipuModelSelector select {
            width: 100%;
            padding: 0.5rem 2rem 0.5rem 0.75rem;
            border: 1px solid var(--border);
            border-radius: 8px;
            font-size: 0.82rem;
            background: rgba(15, 23, 42, 0.5);
            color: var(--text-primary);
            cursor: pointer;
            appearance: none;
            -webkit-appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 0.75rem center;
            transition: border-color 0.2s;
        }
        .image-prompt-layout #zhipuModelSelector select:hover {
            border-color: var(--primary);
        }
        .image-prompt-layout #zhipuModelSelector select:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
        }

        /* 反推结果文本框 */
        .image-prompt-layout .result-textarea {
            width: 100%;
            min-height: 120px;
            padding: 0.6rem 0.75rem;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: rgba(15, 23, 42, 0.5);
            color: var(--text-primary);
            font-size: 0.8rem;
            line-height: 1.6;
            resize: vertical;
            font-family: inherit;
        }
        .image-prompt-layout .result-textarea:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
        }
        .image-prompt-layout .result-textarea::placeholder { color: var(--text-muted); }
        .image-prompt-layout .result-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 0.4rem;
            font-size: 0.7rem;
            color: var(--text-muted);
        }

        /* 开始反推按钮 */
        .image-prompt-layout .analyze-btn {
            width: 100%;
            padding: 0.65rem;
            border-radius: 10px;
            font-size: 0.85rem;
            font-weight: 600;
            background: var(--gradient);
            color: #fff;
            border: none;
            cursor: pointer;
            transition: all 0.25s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.4rem;
            margin-top: 0.5rem;
        }
        .image-prompt-layout .analyze-btn:hover:not(:disabled) {
            transform: translateY(-1px);
            box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
        }
        .image-prompt-layout .analyze-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }
        .image-prompt-layout .analyze-btn .spinner {
            width: 14px;
            height: 14px;
            border: 2px solid rgba(255,255,255,0.3);
            border-top-color: #fff;
            border-radius: 50%;
            animation: spin 0.6s linear infinite;
        }

        /* 右侧历史记录 */
        .image-prompt-layout .right-panel {
            background: var(--surface);
            border-radius: 12px;
            border: 1px solid var(--border);
            overflow: hidden;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
            height: 100%;
            display: flex;
            flex-direction: column;
        }
        .image-prompt-layout .right-panel .panel-header {
            padding: 0.85rem 1.25rem;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: rgba(15, 23, 42, 0.3);
            flex-shrink: 0;
        }
        .image-prompt-layout .right-panel .panel-header .panel-title {
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--text-primary);
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        .image-prompt-layout .right-panel .panel-body {
            padding: 0;
            flex: 1;
            overflow-y: auto;
        }

        /* 历史记录项 */
        .image-prompt-layout .history-item {
            display: flex;
            gap: 1rem;
            padding: 1rem 1.25rem;
            border-bottom: 1px solid var(--border);
            transition: background 0.2s;
            cursor: pointer;
        }
        .image-prompt-layout .history-item:hover {
            background: rgba(99, 102, 241, 0.04);
        }
        .image-prompt-layout .history-item:last-child {
            border-bottom: none;
        }
        .image-prompt-layout .history-thumb {
            width: 80px;
            height: 80px;
            border-radius: 8px;
            overflow: hidden;
            flex-shrink: 0;
            background: rgba(15, 23, 42, 0.5);
            border: 1px solid var(--border);
        }
        .image-prompt-layout .history-thumb img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }
        .image-prompt-layout .history-content {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 0.35rem;
        }
        .image-prompt-layout .history-desc {
            font-size: 0.82rem;
            color: var(--text-primary);
            line-height: 1.6;
            display: -webkit-box;
            -webkit-line-clamp: 3;
            -webkit-box-orient: vertical;
            overflow: hidden;
            word-break: break-word;
        }
        .image-prompt-layout .history-meta {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            margin-top: 0.2rem;
        }
        .image-prompt-layout .history-date {
            font-size: 0.72rem;
            color: var(--text-muted);
        }
        .image-prompt-layout .history-model {
            font-size: 0.7rem;
            padding: 0.15rem 0.4rem;
            border-radius: 4px;
            font-weight: 500;
        }
        .image-prompt-layout .history-actions {
            display: flex;
            gap: 0.3rem;
            margin-top: 0.2rem;
        }
        .image-prompt-layout .history-actions .mini-btn {
            padding: 0.2rem 0.5rem;
            border-radius: 5px;
            font-size: 0.7rem;
            border: 1px solid var(--border);
            background: transparent;
            color: var(--text-secondary);
            cursor: pointer;
            transition: all 0.2s;
        }
        .image-prompt-layout .history-actions .mini-btn:hover {
            border-color: var(--primary);
            color: var(--primary);
            background: rgba(99, 102, 241, 0.08);
        }

        /* 反推结果面板操作按钮 */
        .image-prompt-layout .card-header .mini-btn {
            padding: 0.25rem 0.55rem;
            border-radius: 6px;
            font-size: 0.72rem;
            font-weight: 500;
            border: 1px solid var(--border);
            background: var(--surface-hover);
            color: var(--text-secondary);
            cursor: pointer;
            transition: all 0.2s;
            line-height: 1.4;
        }
        .image-prompt-layout .card-header .mini-btn:hover {
            border-color: var(--primary);
            color: var(--primary);
            background: rgba(99, 102, 241, 0.1);
        }
        .image-prompt-layout .card-header .mini-btn.active {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff;
        }
        .image-prompt-layout .card-header .mini-btn.primary {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff;
        }
        .image-prompt-layout .card-header .mini-btn.primary:hover {
            background: var(--primary-hover);
            border-color: var(--primary-hover);
            box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
        }
        .image-prompt-layout .card-header .mini-btn.danger {
            border-color: #ef4444;
            color: #ef4444;
        }
        .image-prompt-layout .card-header .mini-btn.danger:hover {
            background: #ef4444;
            border-color: #ef4444;
            color: #fff;
        }

        .image-prompt-layout .history-empty {
            text-align: center;
            padding: 4rem 2rem;
            color: var(--text-muted);
        }
        .image-prompt-layout .history-empty .empty-icon {
            font-size: 3rem;
            margin-bottom: 1rem;
            opacity: 0.5;
        }

        /* 变体卡片（保留用于可能的扩展） */
        .image-prompt-layout .prompt-variant-item {
            padding: 0.75rem;
            background: rgba(15, 23, 42, 0.3);
            border: 1px solid var(--border);
            border-radius: 8px;
            margin-bottom: 0.5rem;
            transition: border-color 0.2s;
        }
        .image-prompt-layout .prompt-variant-item:hover {
            border-color: var(--primary);
        }
        .image-prompt-layout .prompt-variant-item .variant-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 0.35rem;
        }
        .image-prompt-layout .prompt-variant-item .variant-model-badge {
            font-size: 0.7rem;
            padding: 0.15rem 0.5rem;
            border-radius: 4px;
            font-weight: 600;
        }
        .image-prompt-layout .prompt-variant-item .variant-text-content {
            font-size: 0.83rem;
            color: var(--text-primary);
            line-height: 1.6;
        }
        .image-prompt-layout .prompt-variant-item .variant-actions-row {
            display: flex;
            gap: 0.35rem;
            margin-top: 0.5rem;
        }
        .badge-wanxiang { background: rgba(255,107,53,0.2); color: #FF6B35; }
        .badge-seedream { background: rgba(99,102,241,0.2); color: #6366F1; }
        .badge-qwen { background: rgba(245,158,11,0.2); color: #F59E0B; }
        .badge-lingdong { background: rgba(16,185,129,0.2); color: #10B981; }
        .badge-zimage { background: rgba(236,72,153,0.2); color: #EC4899; }
        .badge-doubao { background: rgba(34,197,94,0.2); color: #22C55E; }
        .badge-generic { background: rgba(148,163,184,0.2); color: #94A3B8; }

        @media (max-width: 1100px) {
            .layout-columns {
                grid-template-columns: 1fr;
            }
        }

        /* 公式管理：可折叠 */
        .panel.formula-panel {
            transition: all 0.3s ease;
        }

        .panel.formula-panel.collapsed .panel-body {
            display: none;
        }

        .panel.formula-panel .panel-header {
            cursor: pointer;
            user-select: none;
        }

        .panel.formula-panel .collapse-indicator {
            font-size: 0.75rem;
            transition: transform 0.25s ease;
            color: var(--text-secondary);
        }

        .panel.formula-panel.collapsed .collapse-indicator {
            transform: rotate(-90deg);
        }

        /* Shared panel scroll fix */
        .panel.thesaurus-panel .panel-body {
            max-height: 450px;
            overflow-y: auto;
        }

        .panel.size-panel .panel-body,
        .panel.title-layout-panel .panel-body {
            max-height: none;
            overflow-y: visible;
        }

        /* Panel Card */
        .panel {
            background: var(--surface);
            border-radius: 14px;
            border: 1px solid var(--border);
            overflow: hidden;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
        }

        .panel-header {
            padding: 1rem 1.25rem;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            background: rgba(15, 23, 42, 0.3);
        }

        .panel-title {
            font-size: 0.95rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            color: var(--text-primary);
        }

        .panel-title::before {
            content: '';
            width: 3px;
            height: 16px;
            background: var(--gradient);
            border-radius: 2px;
        }

        .panel-body {
            padding: 1rem 1.25rem;
            max-height: 400px;
            overflow-y: auto;
        }

        .panel-body::-webkit-scrollbar {
            width: 6px;
        }

        .panel-body::-webkit-scrollbar-track {
            background: var(--bg);
        }

        .panel-body::-webkit-scrollbar-thumb {
            background: var(--border);
            border-radius: 3px;
        }

        /* Form List */
        .form-list {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .form-item {
            background: var(--bg);
            border-radius: 10px;
            padding: 1rem;
            border: 1px solid transparent;
            transition: all 0.2s ease;
        }

        .form-item:hover {
            border-color: var(--primary);
            box-shadow: 0 2px 8px rgba(79, 70, 229, 0.1);
        }

        .form-item-header {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 0.75rem;
            margin-bottom: 0.5rem;
        }

        .form-item-name {
            font-weight: 600;
            color: var(--accent);
        }

        .form-item-desc {
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-bottom: 0.5rem;
        }

        .form-item-template {
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.8rem;
            color: var(--text-secondary);
            background: var(--surface);
            padding: 0.5rem 0.75rem;
            border-radius: 6px;
            word-break: break-all;
        }

        .form-item-template .var {
            color: var(--accent);
            background: rgba(34, 211, 238, 0.1);
            padding: 0 0.25rem;
            border-radius: 3px;
        }

        .form-item-actions {
            display: flex;
            gap: 0.5rem;
            margin-top: 0.75rem;
        }

        /* Category & Words */
        .category-list {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .category-item {
            background: rgba(26, 35, 50, 0.5);
            border: 1px solid rgba(45, 58, 79, 0.25);
            border-radius: 10px;
            padding: 0.85rem 1rem;
            transition: border-color 0.2s;
        }
        .category-item:hover {
            border-color: rgba(45, 58, 79, 0.5);
        }

        .category-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.5rem;
            margin-bottom: 0.6rem;
            flex-wrap: wrap;
        }

        .category-name {
            font-weight: 600;
            font-size: 0.88rem;
            display: flex;
            align-items: center;
            gap: 0.45rem;
            color: #e2e8f0;
        }

        .category-name .badge {
            font-size: 0.62rem;
            padding: 0.12rem 0.4rem;
            background: rgba(99, 102, 241, 0.15);
            color: #a5b4fc;
            border-radius: 3px;
            font-weight: 500;
            border: 1px solid rgba(99, 102, 241, 0.2);
        }

        .category-name .badge.sel-badge {
            background: rgba(34, 197, 94, 0.18);
            border: 1px solid rgba(34, 197, 94, 0.35);
            color: #4ade80;
        }

        .words-grid {
            display: flex;
            flex-wrap: wrap;
            gap: 0.35rem;
            align-items: flex-start;
        }

        .word-tag {
            display: inline-flex;
            align-items: center;
            gap: 0.3rem;
            padding: 0.3rem 0.65rem;
            background: rgba(30, 41, 59, 0.6);
            border-radius: 6px;
            border: 1px solid rgba(51, 65, 85, 0.4);
            font-size: 0.76rem;
            color: rgba(148, 163, 184, 0.8);
            cursor: pointer;
            transition: all 0.18s ease;
            user-select: none;
            letter-spacing: 0.01em;
            line-height: 1.35;
        }

        .word-tag:hover {
            background: rgba(51, 65, 85, 0.7);
            color: #e2e8f0;
            border-color: rgba(71, 85, 105, 0.6);
            transform: translateY(-1px);
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
        }

        .word-tag:active {
            transform: translateY(0);
            background: rgba(79, 70, 229, 0.12);
            border-color: rgba(99, 102, 241, 0.35);
        }

        .word-tag.selected {
            background: rgba(99, 102, 241, 0.18);
            border: 1px solid rgba(129, 140, 248, 0.4);
            color: #e0e7ff;
            font-weight: 500;
            box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.1), 0 1px 4px rgba(0, 0, 0, 0.2);
        }

        .word-tag .remove {
            width: 15px;
            height: 15px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            cursor: pointer;
            opacity: 0;
            font-size: 0.6rem;
            transition: all 0.15s ease;
            flex-shrink: 0;
        }

        .word-tag:hover .remove {
            opacity: 0.45;
        }

        .word-tag .remove:hover {
            opacity: 1;
            background: rgba(239, 68, 68, 0.3);
            color: #fca5a5;
        }

        /* 分层词汇：父词标签 */
        .word-tag.word-parent {
            background: rgba(99, 102, 241, 0.1);
            border-color: rgba(129, 140, 248, 0.25);
            color: #c7d2fe;
            font-weight: 500;
            gap: 0.4rem;
            padding: 0.32rem 0.4rem 0.32rem 0.65rem;
            position: relative;
        }
        .word-tag.word-parent:hover {
            background: rgba(99, 102, 241, 0.18);
            border-color: rgba(129, 140, 248, 0.4);
            color: #e0e7ff;
        }
        .word-tag.word-parent.selected {
            background: rgba(99, 102, 241, 0.25);
            border-color: rgba(129, 140, 248, 0.55);
            color: #eef2ff;
        }

        .word-parent-dot {
            width: 5px;
            height: 5px;
            border-radius: 50%;
            background: #818cf8;
            flex-shrink: 0;
            opacity: 0.7;
        }
        .word-tag.word-parent.selected .word-parent-dot {
            opacity: 1;
            box-shadow: 0 0 4px rgba(129, 140, 248, 0.5);
        }

        .word-parent-count {
            font-size: 0.6rem;
            color: rgba(148, 163, 184, 0.45);
            font-weight: 400;
            white-space: nowrap;
        }

        .word-expand-arrow {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 20px;
            height: 20px;
            font-size: 0.5rem;
            color: rgba(148, 163, 184, 0.45);
            transition: transform 0.22s ease, color 0.15s, background 0.15s;
            cursor: pointer;
            border-radius: 4px;
            flex-shrink: 0;
        }

        .word-expand-arrow:hover {
            color: #a5b4fc;
            background: rgba(99, 102, 241, 0.2);
        }

        .word-expand-arrow.expanded {
            transform: rotate(180deg);
            color: #c4b5fd;
            background: rgba(99, 102, 241, 0.12);
        }

        /* 子词汇面板 */
        .word-children-panel {
            display: none;
            flex-wrap: wrap;
            gap: 0.28rem;
            padding: 0.4rem 0.55rem;
            margin: 0.15rem 0 0.15rem 0.6rem;
            background: rgba(99, 102, 241, 0.03);
            border: 1px solid rgba(99, 102, 241, 0.1);
            border-left: 2px solid rgba(99, 102, 241, 0.2);
            border-radius: 0 6px 6px 0;
            width: calc(100% - 0.6rem);
        }
        .word-children-panel.visible {
            display: inline-flex;
            animation: childPanelIn 0.2s ease;
        }
        @keyframes childPanelIn {
            from { opacity: 0; transform: translateX(-4px); }
            to { opacity: 1; transform: translateX(0); }
        }

        /* 子词汇标签 */
        .word-tag.word-child {
            font-size: 0.7rem;
            padding: 0.2rem 0.5rem;
            background: rgba(30, 41, 59, 0.4);
            border-color: rgba(51, 65, 85, 0.25);
            color: rgba(167, 139, 250, 0.65);
            border-radius: 5px;
        }

        .word-tag.word-child:hover {
            background: rgba(99, 102, 241, 0.12);
            border-color: rgba(129, 140, 248, 0.3);
            color: #c4b5fd;
        }

        .word-tag.word-child.selected {
            background: rgba(99, 102, 241, 0.2);
            border-color: rgba(129, 140, 248, 0.45);
            color: #ddd6fe;
            font-weight: 500;
        }

        /* Size Management */
        .size-tabs {
            display: flex;
            flex-wrap: wrap;
            gap: 0.3rem;
            margin-bottom: 0.6rem;
            align-items: center;
        }

        .size-tab {
            padding: 0.35rem 0.55rem;
            background: transparent;
            border: 1px solid var(--border);
            border-radius: 6px;
            color: var(--text-secondary);
            cursor: pointer;
            font-family: inherit;
            font-size: 0.75rem;
            font-weight: 500;
            transition: all 0.2s ease;
            position: relative;
            display: flex;
            align-items: center;
            gap: 0.3rem;
        }

        .size-tab:hover {
            color: var(--text-primary);
            background: var(--surface-hover);
        }

        .size-tab.active {
            color: var(--primary);
            border-color: var(--primary);
            background: rgba(99, 102, 241, 0.15);
        }

        .size-tab .tab-edit-input {
            background: var(--bg);
            border: 1px solid var(--primary);
            border-radius: 4px;
            color: var(--text-primary);
            font-family: inherit;
            font-size: 0.75rem;
            padding: 0.15rem 0.3rem;
            width: 60px;
            outline: none;
        }

        .size-tab .tab-delete {
            font-size: 0.7rem;
            opacity: 0.5;
            cursor: pointer;
            line-height: 1;
        }

        .size-tab .tab-delete:hover {
            opacity: 1;
            color: var(--error);
        }

        .size-tab-add {
            padding: 0.35rem 0.55rem;
            background: transparent;
            border: 1px dashed var(--border);
            border-radius: 6px;
            color: var(--text-secondary);
            cursor: pointer;
            font-family: inherit;
            font-size: 0.85rem;
            transition: all 0.2s ease;
            line-height: 1;
        }

        .size-tab-add:hover {
            color: var(--primary);
            border-color: var(--primary);
            background: rgba(99, 102, 241, 0.1);
        }

        .size-unit-label {
            margin-left: auto;
            padding: 0.35rem 0.55rem;
            color: var(--text-tertiary);
            font-size: 0.7rem;
            font-weight: 400;
            white-space: nowrap;
            letter-spacing: 0.02em;
        }

        .size-panel {
            grid-column: 1 / -1;
        }

        .size-panel .size-grid {
            display: flex;
            flex-wrap: wrap;
            gap: 0.4rem;
        }

        .size-btn {
            display: flex;
            align-items: center;
            gap: 0.35rem;
            padding: 0.45rem 0.6rem;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 8px;
            color: var(--text-secondary);
            cursor: pointer;
            font-family: inherit;
            font-size: 0.78rem;
            transition: all 0.2s ease;
            text-align: left;
            white-space: nowrap;
            position: relative;
        }

        .size-btn:hover {
            background: var(--surface-hover);
            color: var(--text-primary);
            border-color: var(--text-secondary);
            transform: translateY(-1px);
        }

        .size-btn.selected {
            background: rgba(99, 102, 241, 0.25);
            border-color: var(--primary);
            color: #fff;
            font-weight: 600;
            box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.4);
        }

        .size-btn .size-value {
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.72rem;
            color: var(--accent);
            margin-left: auto;
        }

        .size-btn.selected .size-value {
            color: var(--text-primary);
        }

        .size-btn .size-remove {
            position: absolute;
            top: -4px;
            right: -4px;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: var(--error);
            color: white;
            font-size: 0.6rem;
            display: none;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 1;
        }

        .size-btn:hover .size-remove {
            display: flex;
        }

        .size-add-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0.4rem 0.75rem;
            background: transparent;
            border: 1px dashed var(--border);
            border-radius: 6px;
            color: var(--text-secondary);
            cursor: pointer;
            font-family: inherit;
            font-size: 0.75rem;
            transition: all 0.2s ease;
            flex: 0 0 auto;
        }

        .size-add-btn:hover {
            color: var(--primary);
            border-color: var(--primary);
            background: rgba(99, 102, 241, 0.05);
        }

        .size-custom-wrap {
            margin-top: 0.5rem;
            display: flex;
            gap: 0.4rem;
            align-items: center;
        }

        .size-custom-input {
            flex: 1;
            padding: 0.35rem 0.5rem;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 6px;
            color: var(--text-primary);
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.8rem;
            text-align: center;
        }

        .size-custom-input:focus {
            outline: none;
            border-color: var(--primary);
        }

        .size-custom-input::placeholder {
            color: var(--text-secondary);
            font-size: 0.7rem;
        }

        .size-custom-sep {
            color: var(--text-secondary);
            font-size: 0.9rem;
        }

        .size-custom-btn {
            flex-shrink: 0;
            padding: 0.35rem 0.65rem;
            border-radius: 6px;
            border: 1px solid var(--primary);
            background: var(--primary);
            color: #fff;
            font-size: 0.75rem;
            cursor: pointer;
            font-family: inherit;
            transition: all 0.2s ease;
        }

        .size-custom-btn:hover {
            background: var(--primary-dark, #4f46e5);
            border-color: var(--primary-dark, #4f46e5);
        }

        .size-custom-btn.cancel {
            background: transparent;
            color: var(--error);
            border-color: var(--error);
        }

        .size-custom-btn.cancel:hover {
            background: rgba(239, 68, 68, 0.1);
        }

        /* Workspace */
        .workspace {
            background: var(--surface);
            border-radius: 14px;
            border: 1px solid var(--border);
            overflow: hidden;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
        }

        .workspace-section {
            padding: 1.25rem;
            border-bottom: 1px solid var(--border);
        }

        .workspace-section:last-child {
            border-bottom: none;
        }

        .section-label {
            font-size: 0.75rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-secondary);
            margin-bottom: 0.75rem;
        }

        /* Formula Selector in panel header */
        .panel-header .formula-select {
            width: auto;
            min-width: 160px;
            padding: 0.35rem 2rem 0.35rem 0.65rem;
            font-size: 0.8rem;
            background: var(--surface-hover);
            border-radius: 8px;
        }

        /* Formula Selector */
        .formula-select.compact {
            padding: 0.45rem 0.75rem;
            font-size: 0.85rem;
            background-position: right 0.5rem center;
        }

        .formula-select {
            width: 100%;
            padding: 0.75rem 1rem;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 10px;
            color: var(--text-primary);
            font-family: inherit;
            font-size: 0.9rem;
            cursor: pointer;
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 0.75rem center;
            transition: all 0.2s ease;
        }

        .formula-select:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
        }

        /* Variable Selector */
        .variable-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 1rem;
        }

        .variable-group {
            background: var(--bg);
            border-radius: 8px;
            padding: 1rem;
        }

        .variable-label {
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--accent);
            margin-bottom: 0.75rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .variable-label::before {
            content: '';
            width: 6px;
            height: 6px;
            background: var(--accent);
            border-radius: 50%;
        }

        .variable-options {
            display: flex;
            flex-direction: column;
            gap: 0.4rem;
            max-height: 180px;
            overflow-y: auto;
        }

        .variable-option {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.4rem 0.6rem;
            background: var(--surface);
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s ease;
            font-size: 0.85rem;
        }

        .variable-option:hover {
            background: var(--surface-hover);
        }

        .variable-option.selected {
            background: rgba(79, 70, 229, 0.18);
            border: 1px solid var(--primary);
        }

        .variable-option input {
            accent-color: var(--primary);
            width: 14px;
            height: 14px;
        }

        .no-variables {
            text-align: center;
            padding: 2rem;
            color: var(--text-secondary);
        }

        .result-textarea {
            width: 100%;
            min-height: 120px;
            padding: 1rem;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 8px;
            color: var(--text-primary);
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.9rem;
            line-height: 1.7;
            resize: vertical;
        }

        .result-textarea:focus {
            outline: none;
            border-color: var(--primary);
        }

        .result-actions {
            display: flex;
            gap: 0.5rem;
            margin-top: 0.75rem;
        }

        /* Title Layout Panel */
        .title-layout-section-label {
            font-size: 0.7rem;
            font-weight: 600;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.08em;
            margin-bottom: 0.5rem;
            display: flex;
            align-items: center;
            gap: 0.4rem;
        }

        .title-layout-section-label::after {
            content: '';
            flex: 1;
            height: 1px;
            background: var(--border);
        }

        .title-layout-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 0.4rem;
            margin-bottom: 0.5rem;
        }

        .title-layout-preset {
            background: var(--bg);
            border: 2px solid var(--border);
            border-radius: 10px;
            padding: 0.55rem 0.4rem;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s ease;
            font-size: 0.72rem;
            color: var(--text-secondary);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.2rem;
            position: relative;
        }

        .title-layout-preset:hover {
            border-color: var(--primary);
            color: var(--text-primary);
            background: var(--surface-hover);
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
        }

        .title-layout-preset.active {
            border-color: var(--primary);
            background: rgba(99, 102, 241, 0.25);
            color: #fff;
            font-weight: 600;
            box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5), 0 2px 12px rgba(99, 102, 241, 0.25);
        }

        .title-layout-preset .preset-label {
            font-weight: 600;
            line-height: 1.2;
            font-size: 0.78rem;
        }

        .title-layout-preset .preset-desc {
            font-size: 0.65rem;
            color: var(--text-secondary);
            line-height: 1.3;
            opacity: 0.8;
        }

        .title-layout-preset.active .preset-desc {
            color: rgba(99, 102, 241, 0.7);
        }

        .title-layout-options {
            display: flex;
            flex-wrap: wrap;
            gap: 0.4rem;
            background: rgba(15, 23, 42, 0.4);
            border-radius: 8px;
            padding: 0.5rem 0.6rem;
            margin-bottom: 0.25rem;
        }

        .title-layout-row {
            display: flex;
            align-items: center;
            gap: 0.3rem;
            flex: 1;
            min-width: 120px;
        }

        .title-layout-row .row-label {
            font-size: 0.72rem;
            color: var(--text-secondary);
            flex-shrink: 0;
            white-space: nowrap;
        }

        .title-layout-row select {
            flex: 1;
            padding: 0.35rem 0.45rem;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 6px;
            color: var(--text-primary);
            font-family: inherit;
            font-size: 0.75rem;
            cursor: pointer;
            min-width: 0;
            transition: border-color 0.2s;
        }

        .title-layout-row select:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
        }

        .title-layout-divider {
            height: 1px;
            background: var(--border);
            margin: 0.5rem 0 0.25rem;
            opacity: 0.5;
        }

        .title-layout-toggle {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.35rem 0;
        }

        .title-layout-toggle input[type="checkbox"] {
            accent-color: var(--primary);
            width: 15px;
            height: 15px;
            cursor: pointer;
        }

        .title-layout-toggle label {
            font-size: 0.78rem;
            color: var(--text-secondary);
            cursor: pointer;
            user-select: none;
        }

        .title-layout-preview {
            font-size: 0.75rem;
            color: var(--text-secondary);
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 0.65rem 0.75rem;
            margin-top: 0.5rem;
            line-height: 1.5;
            position: relative;
        }

        .title-layout-preview::before {
            content: '提示词预览';
            display: block;
            font-size: 0.65rem;
            font-weight: 600;
            color: var(--primary);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-bottom: 0.35rem;
            font-style: normal;
        }

        .title-layout-preview:empty::before {
            content: '';
        }

        /* Modal */
        .modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.7);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            opacity: 0;
            visibility: hidden;
            transition: all 0.2s ease;
            padding: 1rem;
        }

        .modal-overlay.active {
            opacity: 1;
            visibility: visible;
        }

        .modal {
            background: var(--surface);
            border-radius: 16px;
            border: 1px solid var(--border);
            width: 100%;
            max-width: 500px;
            max-height: 90vh;
            overflow-y: auto;
            transform: scale(0.9);
            transition: transform 0.2s ease;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
        }

        .modal-overlay.active .modal {
            transform: scale(1);
        }

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

        .modal-title {
            font-size: 1.1rem;
            font-weight: 600;
        }

        .modal-close {
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
            cursor: pointer;
            color: var(--text-secondary);
            transition: all 0.2s ease;
        }

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

        .modal-body {
            padding: 1.25rem;
        }

        .modal-footer {
            padding: 1rem 1.25rem;
            border-top: 1px solid var(--border);
            display: flex;
            justify-content: flex-end;
            gap: 0.75rem;
        }

        /* Form Groups */
        .form-group {
            margin-bottom: 1rem;
        }

        .form-group:last-child {
            margin-bottom: 0;
        }

        .form-label {
            display: block;
            font-size: 0.85rem;
            font-weight: 500;
            margin-bottom: 0.5rem;
            color: var(--text-secondary);
        }

        .form-input,
        .form-textarea {
            width: 100%;
            padding: 0.75rem 1rem;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 8px;
            color: var(--text-primary);
            font-family: inherit;
            font-size: 0.9rem;
        }

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

        .form-textarea {
            min-height: 100px;
            resize: vertical;
            font-family: 'JetBrains Mono', monospace;
        }

        .form-divider {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            margin: 0.5rem 0 0.75rem;
            color: var(--text-secondary);
            font-size: 0.72rem;
        }

        /* ========== 智能推荐弹窗 ========== */
        .smart-search-modal .modal {
            max-width: 640px;
        }

        .smart-search-body {
            display: flex;
            flex-direction: column;
            gap: 0;
        }

        /* 搜索栏 */
        .smart-search-input-row {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 0.75rem;
        }

        .smart-search-input-row .form-input {
            flex: 1;
        }

        /* 信息栏：来源标识 + 快捷操作 */
        .smart-search-info-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 6px 10px;
            margin-bottom: 8px;
            background: rgba(99, 102, 241, 0.06);
            border: 1px solid rgba(99, 102, 241, 0.12);
            border-radius: 8px;
            font-size: 0.75rem;
        }

        .smart-search-source {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .smart-search-source .source-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #6366f1;
            flex-shrink: 0;
        }

        .smart-search-source.ai-source .source-dot {
            background: #10b981;
        }
        .smart-search-source.preset-source .source-dot {
            background: #f59e0b;
        }
        .smart-search-source.fallback-source .source-dot {
            background: #94a3b8;
        }

        .smart-search-source .source-text {
            color: #94a3b8;
            font-weight: 500;
        }

        .smart-search-source.ai-source .source-text { color: #6ee7b7; }
        .smart-search-source.preset-source .source-text { color: #fcd34d; }
        .smart-search-source.fallback-source .source-text { color: #cbd5e1; }

        .smart-search-quick-actions {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .smart-search-quick-actions .btn-link {
            background: none;
            border: none;
            color: #94a3b8;
            cursor: pointer;
            font-size: 0.72rem;
            padding: 2px 8px;
            border-radius: 4px;
            transition: all 0.15s;
        }

        .smart-search-quick-actions .btn-link:hover {
            color: #e2e8f0;
            background: rgba(99, 102, 241, 0.15);
        }

        .ai-settings-link {
            text-decoration: none;
            color: #94a3b8;
            font-size: 0.85rem;
            transition: color 0.2s;
            padding: 2px 4px;
        }

        .ai-settings-link:hover {
            color: #6366f1;
        }

        /* AI 配置面板 */
        .smart-search-ai-config {
            background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(139, 92, 246, 0.04));
            border: 1px solid rgba(99, 102, 241, 0.15);
            border-radius: 10px;
            padding: 12px 14px;
            margin-bottom: 8px;
        }

        .ai-config-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 8px;
        }

        .ai-config-title {
            font-size: 0.8rem;
            color: #a5b4fc;
            font-weight: 600;
        }

        .ai-config-header select {
            font-size: 0.72rem;
            padding: 3px 8px;
            border: 1px solid rgba(99, 102, 241, 0.2);
            border-radius: 6px;
            background: rgba(15, 23, 42, 0.6);
            color: #cbd5e1;
            cursor: pointer;
        }

        .ai-config-key-row {
            display: flex;
            gap: 6px;
        }

        .ai-config-key-row .form-input {
            flex: 1;
            font-size: 0.75rem;
            padding: 6px 10px;
        }

        .ai-config-key-row .btn-sm {
            white-space: nowrap;
            font-size: 0.72rem;
            padding: 6px 12px;
        }

        .ai-status-hint {
            font-size: 0.68rem;
            color: #64748b;
            margin-top: 6px;
        }

        .ai-status-hint a {
            color: #6366f1;
            text-decoration: none;
        }

        .ai-status-hint a:hover {
            text-decoration: underline;
        }

        /* 占位引导 */
        .smart-search-placeholder {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 2.5rem 1.5rem;
            text-align: center;
            min-height: 160px;
        }

        .smart-search-placeholder .placeholder-icon {
            font-size: 2.5rem;
            margin-bottom: 0.75rem;
            opacity: 0.5;
        }

        .smart-search-placeholder .placeholder-title {
            font-size: 0.95rem;
            font-weight: 600;
            color: #94a3b8;
            margin-bottom: 0.5rem;
        }

        .smart-search-placeholder .placeholder-desc {
            font-size: 0.78rem;
            color: #64748b;
            line-height: 1.5;
            max-width: 340px;
        }

        /* 结果展示区 */
        .smart-search-results {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            max-height: 320px;
            overflow-y: auto;
            padding: 4px 2px;
            min-height: 60px;
            align-items: flex-start;
            align-content: flex-start;
        }

        .smart-search-results .loading {
            width: 100%;
            text-align: center;
            color: #94a3b8;
            padding: 2rem 0;
            font-size: 0.82rem;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }

        .smart-search-results .loading::before {
            content: '';
            width: 14px;
            height: 14px;
            border: 2px solid rgba(99, 102, 241, 0.2);
            border-top-color: #6366f1;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

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

        /* 来源分组标签 */
        .smart-source-group-label {
            width: 100%;
            font-size: 0.68rem;
            color: #64748b;
            padding: 4px 2px 2px;
            margin-top: 4px;
            margin-bottom: 2px;
            font-weight: 600;
            letter-spacing: 0.5px;
            text-transform: uppercase;
        }

        .smart-source-group-label:first-child {
            margin-top: 0;
        }

        /* 词汇卡片 */
        .smart-word-chip {
            display: inline-flex;
            align-items: center;
            gap: 0.3rem;
            padding: 0.4rem 0.9rem;
            background: rgba(30, 41, 59, 0.5);
            border-radius: 20px;
            border: 1px solid rgba(71, 85, 105, 0.3);
            font-size: 0.78rem;
            color: #cbd5e1;
            cursor: pointer;
            transition: all 0.18s ease;
            user-select: none;
            position: relative;
        }

        .smart-word-chip:hover {
            background: rgba(51, 65, 85, 0.65);
            color: #e2e8f0;
            border-color: rgba(99, 102, 241, 0.4);
            transform: translateY(-1px);
        }

        .smart-word-chip:active {
            transform: scale(0.96);
        }

        .smart-word-chip.checked {
            background: rgba(99, 102, 241, 0.2);
            border-color: rgba(129, 140, 248, 0.55);
            color: #c7d2fe;
            font-weight: 500;
            box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
        }

        .smart-word-chip.checked::after {
            content: '✓';
            font-size: 0.6rem;
            margin-left: 0.1rem;
            opacity: 0.9;
            color: #a5b4fc;
        }

        /* AI 来源词特殊标记 */
        .smart-word-chip.ai-source {
            border-left: 2px solid rgba(16, 185, 129, 0.4);
        }

        .smart-word-chip.preset-source {
            border-left: 2px solid rgba(245, 158, 11, 0.4);
        }

        .smart-word-chip.ai-source.checked {
            border-left-color: rgba(16, 185, 129, 0.7);
        }
        .smart-word-chip.preset-source.checked {
            border-left-color: rgba(245, 158, 11, 0.7);
        }

        /* 底部操作栏 */
        .smart-search-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 0.75rem;
            padding-top: 0.75rem;
            border-top: 1px solid rgba(71, 85, 105, 0.25);
        }

        .smart-search-count {
            display: flex;
            align-items: baseline;
            gap: 4px;
        }

        .smart-search-count .count-number {
            font-size: 1.1rem;
            font-weight: 700;
            color: #a5b4fc;
            min-width: 1.5em;
            text-align: center;
            transition: color 0.2s;
        }

        .smart-search-count .count-number.has-selection {
            color: #818cf8;
        }

        .smart-search-count .count-label {
            font-size: 0.72rem;
            color: #64748b;
        }

        .smart-search-actions {
            display: flex;
            gap: 0.5rem;
            align-items: center;
        }

        .category-header .btn-smart-search {
            padding: 0.18rem 0.55rem;
            font-size: 0.7rem;
            border-radius: 5px;
            background: rgba(99, 102, 241, 0.1);
            border: 1px solid rgba(99, 102, 241, 0.18);
            color: rgba(167, 139, 250, 0.8);
            cursor: pointer;
            transition: all 0.18s;
            white-space: nowrap;
            font-weight: 500;
        }

        .category-header .btn-smart-search:hover {
            background: rgba(99, 102, 241, 0.2);
            border-color: rgba(99, 102, 241, 0.35);
            color: #c4b5fd;
        }

        /* category header 中的小按钮统一样式 */
        .category-header .btn-ghost.btn-sm {
            padding: 0.18rem 0.5rem;
            font-size: 0.7rem;
            border-radius: 5px;
            color: rgba(148, 163, 184, 0.6);
            border: 1px solid transparent;
            background: transparent;
            cursor: pointer;
            transition: all 0.15s;
            white-space: nowrap;
        }
        .category-header .btn-ghost.btn-sm:hover {
            color: #e2e8f0;
            background: rgba(51, 65, 85, 0.5);
            border-color: rgba(71, 85, 105, 0.4);
        }
        }

        .form-divider::before,
        .form-divider::after {
            content: '';
            flex: 1;
            height: 1px;
            background: var(--border);
        }

        .form-hint {
            font-size: 0.75rem;
            color: var(--text-secondary);
            margin-top: 0.4rem;
        }

        .form-hint code {
            background: var(--bg);
            padding: 0.1rem 0.3rem;
            border-radius: 3px;
            color: var(--accent);
        }

        /* History detail modal */
        .detail-badge {
            font-size: 0.7rem;
            padding: 0.15rem 0.45rem;
            border-radius: 4px;
            vertical-align: middle;
        }
        .detail-text {
            background: var(--bg);
            border-radius: 8px;
            padding: 1rem;
            border: 1px solid var(--border);
        }

        /* Toast */
        .toast-container {
            position: fixed;
            top: 1rem;
            right: 1rem;
            z-index: 2000;
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }

        .toast {
            padding: 0.75rem 1rem;
            border-radius: 10px;
            background: var(--surface);
            border: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 0.75rem;
            min-width: 280px;
            max-width: 400px;
            animation: slideIn 0.3s ease;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
        }

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

        .toast.success {
            border-color: var(--success);
        }

        .toast.error {
            border-color: var(--error);
        }

        .toast.warning {
            border-color: var(--warning);
        }

        .toast-icon {
            font-size: 1.25rem;
        }

        .toast.success .toast-icon { color: var(--success); }
        .toast.error .toast-icon { color: var(--error); }
        .toast.warning .toast-icon { color: var(--warning); }

        .toast-message {
            flex: 1;
            font-size: 0.9rem;
        }

        /* Empty State */
        .empty-state {
            text-align: center;
            padding: 2rem 1rem;
            color: var(--text-secondary);
        }

        .empty-state-text {
            margin-bottom: 1rem;
        }

        /* Import Section */
        .import-section {
            padding: 0.5rem 0;
        }

        .import-tabs {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 1rem;
        }

        .import-tab {
            flex: 1;
            padding: 0.75rem;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 8px;
            color: var(--text-secondary);
            cursor: pointer;
            font-family: inherit;
            font-size: 0.9rem;
            transition: all 0.2s ease;
        }

        .import-tab:hover {
            background: var(--surface-hover);
            color: var(--text-primary);
        }

        .import-tab.active {
            background: rgba(99, 102, 241, 0.15);
            border-color: var(--primary);
            color: var(--text-primary);
        }

        .file-upload-zone {
            border: 2px dashed var(--border);
            border-radius: 12px;
            padding: 2rem;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s ease;
            background: var(--bg);
        }

        .file-upload-zone:hover {
            border-color: var(--primary);
            background: rgba(99, 102, 241, 0.05);
        }

        .file-upload-text {
            font-weight: 600;
            margin-bottom: 0.5rem;
        }

        .file-upload-hint {
            font-size: 0.8rem;
            color: var(--text-secondary);
        }

        .import-format-hint {
            margin-top: 1rem;
            padding: 1rem;
            background: var(--bg);
            border-radius: 8px;
            font-size: 0.85rem;
        }

        .format-title {
            font-weight: 600;
            margin-bottom: 0.5rem;
            color: var(--accent);
        }

        .format-example {
            color: var(--text-secondary);
            line-height: 1.8;
        }

        .import-section .form-hint {
            margin-top: 0.75rem;
        }

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

        .radio-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px 14px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.9rem;
            color: var(--text-secondary);
            transition: all 0.2s;
        }

        .radio-item:hover {
            border-color: var(--primary);
            color: var(--text-primary);
        }

        .radio-item input[type="radio"] {
            accent-color: var(--primary);
            width: 16px;
            height: 16px;
            cursor: pointer;
        }

        .radio-item:has(input:checked) {
            border-color: var(--primary);
            background: rgba(99, 102, 241, 0.1);
            color: var(--text-primary);
        }

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

        .preview-title {
            font-weight: 600;
            margin-bottom: 0.75rem;
            color: var(--accent);
        }

        .preview-category {
            margin-bottom: 0.75rem;
        }

        .preview-category-name {
            font-weight: 600;
            font-size: 0.9rem;
            margin-bottom: 0.4rem;
            color: var(--text-primary);
        }

        .preview-words {
            display: flex;
            flex-wrap: wrap;
            gap: 0.3rem;
        }

        .preview-word {
            background: var(--surface);
            padding: 0.2rem 0.5rem;
            border-radius: 4px;
            font-size: 0.8rem;
            color: var(--text-secondary);
        }

        .preview-actions {
            display: flex;
            gap: 0.5rem;
            margin-top: 1rem;
            justify-content: flex-end;
        }

        .preview-category-header {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin-bottom: 0.5rem;
        }

        .preview-category-input {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 0.4rem 0.6rem;
            color: var(--text-primary);
            font-weight: 600;
            font-size: 0.9rem;
            flex: 1;
        }

        .preview-category-input:focus {
            outline: none;
            border-color: var(--primary);
        }

        .preview-word.editable {
            cursor: pointer;
        }

        .preview-word.editable:hover {
            background: var(--surface-hover);
            color: var(--text-primary);
        }

        .preview-edit-input {
            background: var(--surface);
            border: 1px solid var(--primary);
            border-radius: 4px;
            padding: 0.2rem 0.4rem;
            color: var(--text-primary);
            font-size: 0.8rem;
            width: 80px;
        }

        .preview-edit-input:focus {
            outline: none;
        }

        .preview-add-word {
            display: flex;
            gap: 0.25rem;
            margin-top: 0.5rem;
        }

        .preview-add-input {
            background: var(--surface);
            border: 1px dashed var(--border);
            border-radius: 4px;
            padding: 0.3rem 0.5rem;
            color: var(--text-primary);
            font-size: 0.8rem;
            flex: 1;
        }

        .preview-add-input:focus {
            outline: none;
            border-color: var(--primary);
            border-style: solid;
        }

        .preview-add-input::placeholder {
            color: var(--text-secondary);
        }

        /* Model Optimization */
        .model-section {
            margin-top: 0;
        }

        .model-tabs {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
            margin-bottom: 1rem;
        }

        .model-tab {
            padding: 0.5rem 1rem;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 10px;
            color: var(--text-secondary);
            cursor: pointer;
            font-family: inherit;
            font-size: 0.85rem;
            font-weight: 500;
            transition: all 0.2s ease;
            white-space: nowrap;
        }

        .model-tab:hover {
            background: var(--surface-hover);
            color: var(--text-primary);
            border-color: var(--text-secondary);
            transform: translateY(-1px);
        }

        .model-tab.active {
            background: rgba(79, 70, 229, 0.15);
            border-color: var(--primary);
            color: var(--text-primary);
            box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
        }

        .model-tab .model-badge {
            display: inline-block;
            font-size: 0.65rem;
            padding: 0.1rem 0.4rem;
            border-radius: 4px;
            margin-left: 0.35rem;
            font-weight: 500;
        }

        .model-tab.active .model-badge {
            background: var(--primary);
        }

        .model-result-card {
            background: var(--bg);
            border-radius: 10px;
            border: 1px solid var(--border);
            overflow: hidden;
        }

        .model-result-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.75rem 1rem;
            border-bottom: 1px solid var(--border);
            background: rgba(99, 102, 241, 0.05);
        }

        .model-result-info {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .model-result-name {
            font-weight: 600;
            font-size: 0.9rem;
        }

        .model-result-strategy {
            font-size: 0.75rem;
            color: var(--text-secondary);
            background: var(--surface);
            padding: 0.2rem 0.5rem;
            border-radius: 4px;
        }

        .model-result-body {
            position: relative;
        }

        .model-result-textarea {
            width: 100%;
            min-height: 100px;
            padding: 1rem;
            background: var(--bg);
            border: none;
            color: var(--success);
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.9rem;
            line-height: 1.7;
            resize: vertical;
        }

        .model-result-textarea:focus {
            outline: none;
            color: var(--text-primary);
        }

        .model-result-actions {
            display: flex;
            gap: 0.5rem;
            padding: 0.75rem 1rem;
            border-top: 1px solid var(--border);
            background: rgba(99, 102, 241, 0.03);
        }

        .model-empty {
            text-align: center;
            padding: 2rem;
            color: var(--text-secondary);
        }

        .model-type-hint {
            font-size: 0.75rem;
            color: var(--text-secondary);
            margin-top: 0.5rem;
            padding: 0.6rem 0.8rem;
            background: rgba(245, 158, 11, 0.08);
            border-radius: 6px;
            border: 1px dashed var(--border);
        }

        /* Feed to Optimization */
        .btn-optimize-feed {
            background: linear-gradient(135deg, #F59E0B, #EF4444);
            color: white;
            border: none;
            transition: all 0.3s ease;
            font-weight: 600;
        }

        .btn-optimize-feed:hover {
            background: linear-gradient(135deg, #D97706, #DC2626);
            box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
            transform: translateY(-1px);
        }

        .btn-optimize-feed:active {
            transform: scale(0.96);
        }

        .opt-status-bar {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.75rem 1rem;
            border-radius: 8px;
            margin-bottom: 1rem;
            font-size: 0.85rem;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .opt-status-bar.fed {
            background: rgba(16, 185, 129, 0.1);
            border: 1px solid var(--success);
            color: var(--success);
        }

        .opt-status-bar.stale {
            background: rgba(245, 158, 11, 0.1);
            border: 1px solid var(--warning);
            color: var(--warning);
        }

        .opt-status-bar .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            animation: pulse 1.5s infinite;
        }

        .opt-status-bar.fed .status-dot {
            background: var(--success);
        }

        .opt-status-bar.stale .status-dot {
            background: var(--warning);
        }

        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.4; }
        }

        .opt-status-bar .status-actions {
            margin-left: auto;
            display: flex;
            gap: 0.5rem;
        }

        .model-tab.has-result {
            border-color: var(--success);
            position: relative;
        }

        .model-tab.has-result::after {
            content: '✓';
            position: absolute;
            top: -4px;
            right: -4px;
            width: 18px;
            height: 18px;
            background: var(--success);
            color: #000;
            font-size: 0.6rem;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
        }

        .model-tab.has-result.active::after {
            background: #FFF;
            color: var(--success);
        }

        /* Model Official Links */
        .model-links {
            padding: 1rem 1.25rem;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 14px;
        }

        .model-links-title {
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 0.75rem;
            display: flex;
            align-items: center;
            gap: 0.4rem;
        }

        .model-links-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 0.5rem;
        }

        .model-link-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0.55rem 0.75rem;
            font-size: 0.82rem;
            font-weight: 600;
            text-decoration: none;
            border: 1px solid var(--border);
            border-radius: 10px;
            background: var(--bg);
            color: var(--text-primary);
            transition: all 0.2s ease;
            white-space: nowrap;
            cursor: pointer;
            letter-spacing: 0.3px;
        }

        .model-link-btn:hover {
            background: var(--surface-hover);
            border-color: var(--primary);
            color: var(--primary);
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        }

        .model-link-btn.wanxiang { border-left: 3px solid #FF6B35; }
        .model-link-btn.seedream { border-left: 3px solid #6366F1; }
        .model-link-btn.lingdong { border-left: 3px solid #10B981; }
        .model-link-btn.qwen { border-left: 3px solid #F59E0B; }
        .model-link-btn.zimage { border-left: 3px solid #EC4899; }
        .model-link-btn.gaoding { border-left: 3px solid #8B5CF6; }
        .model-link-btn.doubao { border-left: 3px solid #22C55E; }
        .model-link-btn.dola { border-left: 3px solid #06B6D4; }

        .model-link-btn.wanxiang:hover { border-color: #FF6B35; background: rgba(255,107,53,0.1); }
        .model-link-btn.seedream:hover { border-color: #6366F1; background: rgba(99,102,241,0.1); }
        .model-link-btn.lingdong:hover { border-color: #10B981; background: rgba(16,185,129,0.1); }
        .model-link-btn.qwen:hover { border-color: #F59E0B; background: rgba(245,158,11,0.1); }
        .model-link-btn.zimage:hover { border-color: #EC4899; background: rgba(236,72,153,0.1); }
        .model-link-btn.gaoding:hover { border-color: #8B5CF6; background: rgba(139,92,246,0.1); }
        .model-link-btn.doubao:hover { border-color: #22C55E; background: rgba(34,197,94,0.1); }
        .model-link-btn.dola:hover { border-color: #06B6D4; background: rgba(6,182,212,0.1); }

        @media (max-width: 600px) {
            .model-links-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        /* History Panel */
        .history-toggle {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 1rem 1.25rem;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 14px;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .history-toggle:hover {
            background: var(--surface-hover);
        }

        .history-toggle.open {
            border-radius: 14px 14px 0 0;
        }

        .history-toggle-content {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-weight: 500;
        }

        .history-toggle-icon {
            transition: transform 0.2s ease;
        }

        .history-toggle.open .history-toggle-icon {
            transform: rotate(180deg);
        }

        .history-content {
            display: none;
            padding: 1rem 1.25rem;
            background: var(--surface);
            border: 1px solid var(--border);
            border-top: none;
            border-radius: 0 0 14px 14px;
        }

        .history-content.open {
            display: block;
        }

        .history-list {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            max-height: 200px;
            overflow-y: auto;
        }

        .history-item {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.75rem;
            background: var(--bg);
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .history-item:hover {
            background: var(--surface-hover);
        }

        .history-item-text {
            flex: 1;
            font-size: 0.85rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            color: var(--text-secondary);
        }

        .history-item-time {
            font-size: 0.75rem;
            color: var(--text-secondary);
        }

        /* Animations */
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        .fade-in {
            animation: fadeIn 0.3s ease;
        }

        /* Responsive */
        @media (max-width: 600px) {
            .header {
                padding: 0.75rem 1rem;
            }

            .logo h1 {
                font-size: 1rem;
            }

            .header-actions .btn span {
                display: none;
            }

            .main {
                padding: 1rem;
            }

            .variable-grid {
                grid-template-columns: 1fr;
            }
        }

        /* ========== 认证弹窗样式 ========== */
        .auth-overlay {
            position: fixed; inset: 0; background: rgba(0,0,0,0.7);
            display: flex; align-items: center; justify-content: center;
            z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s;
        }
        .auth-overlay.active { opacity: 1; pointer-events: auto; }

        .auth-card {
            background: var(--surface); border: 1px solid var(--border);
            border-radius: 16px; padding: 2rem; width: 400px; max-width: 90vw;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
        }
        .auth-card h2 { font-size: 1.4rem; margin-bottom: 0.25rem; }
        .auth-card .auth-sub { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 1.5rem; }

        .auth-tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
        .auth-tab { flex: 1; padding: 0.6rem; text-align: center; cursor: pointer; background: var(--bg); color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; transition: all 0.2s; border: none; }
        .auth-tab.active { background: var(--primary); color: #fff; }

        .auth-field { margin-bottom: 1rem; }
        .auth-field label { display: block; font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 0.35rem; }
        .auth-field input {
            width: 100%; padding: 0.7rem 0.9rem; border-radius: 8px;
            border: 1px solid var(--border); background: var(--bg); color: var(--text-primary);
            font-size: 0.9rem; transition: border-color 0.2s;
        }
        .auth-field input:focus { outline: none; border-color: var(--primary); }

        .auth-btn { width: 100%; padding: 0.75rem; border-radius: 8px; border: none; cursor: pointer;
            font-size: 0.95rem; font-weight: 600; transition: all 0.2s; margin-top: 0.5rem; }
        .auth-btn-primary { background: var(--gradient); color: #fff; }
        .auth-btn-primary:hover { opacity: 0.9; }
        .auth-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
        .auth-error { color: var(--error); font-size: 0.82rem; margin-top: 0.5rem; text-align: center; }
        .auth-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; color: var(--text-secondary); font-size: 1.4rem; cursor: pointer; }

        /* ========== 用户徽章（Header） ========== */
        .user-badge { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; padding: 0.4rem 0.75rem;
            border-radius: 8px; background: var(--surface); border: 1px solid var(--border); transition: all 0.2s; }
        .user-badge:hover { background: var(--surface-hover); }
        .user-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--gradient);
            display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: #fff; flex-shrink: 0; }
        .user-name { font-size: 0.85rem; color: var(--text-primary); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .user-badge .admin-tag { font-size: 0.65rem; padding: 0.1rem 0.35rem; border-radius: 4px;
            background: var(--warning); color: #000; font-weight: 700; }
        .viewing-badge { font-size: 0.72rem; color: var(--accent); background: rgba(6,182,212,0.1);
            padding: 0.1rem 0.5rem; border-radius: 4px; white-space: nowrap; display: inline-flex; align-items: center; gap: 0.2rem; }
        .user-menu { position: absolute; top: calc(100% + 4px); right: 0; background: var(--surface);
            border: 1px solid var(--border); border-radius: 8px; min-width: 160px; z-index: 200;
            box-shadow: 0 8px 24px rgba(0,0,0,0.4); display: none; overflow: hidden; }
        .user-menu.active { display: block; }
        .user-menu-item { padding: 0.6rem 1rem; cursor: pointer; font-size: 0.85rem; color: var(--text-primary);
            transition: background 0.15s; border: none; background: none; width: 100%; text-align: left; }
        .user-menu-item:hover { background: var(--surface-hover); }
        .user-menu-item.logout { color: var(--error); border-top: 1px solid var(--border); }

        /* ========== 管理员面板 ========== */
        .admin-panel-overlay {
            position: fixed; inset: 0; background: rgba(0,0,0,0.7);
            display: flex; align-items: center; justify-content: center;
            z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s;
        }
        .admin-panel-overlay.active { opacity: 1; pointer-events: auto; }

        .admin-panel {
            background: var(--surface); border: 1px solid var(--border);
            border-radius: 16px; padding: 1.5rem; width: 560px; max-width: 92vw;
            max-height: 85vh; overflow-y: auto;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
        }
        .admin-panel-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
        .admin-panel h3 { font-size: 1.15rem; margin-bottom: 0.15rem; }
        .admin-panel .admin-sub { color: var(--text-secondary); font-size: 0.78rem; margin-bottom: 0; }
        .admin-panel-tabs { display: flex; gap: 0.3rem; }
        .admin-tab {
            padding: 0.35rem 0.75rem; border: 1px solid var(--border); border-radius: 6px;
            background: transparent; color: var(--text-secondary); font-size: 0.78rem;
            cursor: pointer; transition: all 0.15s; white-space: nowrap;
        }
        .admin-tab:hover { background: var(--surface-hover); }
        .admin-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
        .admin-tab-content { display: none; margin-top: 0.75rem; }
        .admin-tab-content.active { display: block; }

        .admin-filter-row {
            display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem;
        }
        .admin-filter-count { font-size: 0.72rem; color: var(--text-secondary); white-space: nowrap; }
        .admin-user-list { max-height: 45vh; overflow-y: auto; }
        .admin-user-item {
            display: flex; align-items: center; justify-content: space-between;
            padding: 0.7rem 0.85rem; border-radius: 8px;
            border: 1px solid transparent; transition: all 0.15s; margin-bottom: 0.35rem;
            background: rgba(15,23,42,0.3);
        }
        .admin-user-left { cursor: pointer; flex: 1; display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
        .admin-user-left:hover ~ .admin-user-actions,
        .admin-user-item:hover { background: var(--surface-hover); border-color: var(--border); }
        .admin-user-item.selected { border-color: var(--primary); background: rgba(79,70,229,0.08); }
        .admin-user-item.blocked { opacity: 0.5; }
        .admin-user-info { min-width: 0; }
        .admin-user-name { font-size: 0.85rem; color: var(--text-primary); display: flex; align-items: center; gap: 0.35rem; }
        .admin-user-email { font-size: 0.72rem; color: var(--text-secondary); margin-top: 0.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .admin-user-status { font-size: 0.62rem; padding: 0.1rem 0.4rem; border-radius: 4px; font-weight: 700; text-transform: uppercase; }
        .status-active { background: rgba(52,211,153,0.15); color: #34d399; }
        .status-blocked { background: rgba(239,68,68,0.15); color: #ef4444; }
        .status-whitelist { background: rgba(96,165,250,0.15); color: #60a5fa; }
        .admin-user-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
        .admin-btn-action {
            padding: 0.25rem 0.5rem; border: 1px solid var(--border); border-radius: 5px;
            background: transparent; color: var(--text-secondary); font-size: 0.68rem;
            cursor: pointer; transition: all 0.15s; white-space: nowrap;
        }
        .admin-btn-action:hover { background: var(--surface-hover); color: var(--text-primary); }
        .admin-btn-action.danger:hover { background: rgba(239,68,68,0.1); color: #ef4444; border-color: rgba(239,68,68,0.3); }
        .admin-btn-action.warn:hover { background: rgba(251,191,36,0.1); color: #fbbf24; border-color: rgba(251,191,36,0.3); }

        .admin-badge { font-size: 0.65rem; padding: 0.1rem 0.4rem; border-radius: 4px;
            background: var(--warning); color: #000; font-weight: 700; }
        .admin-current { font-size: 0.72rem; color: var(--success); }
        .admin-close-btn { position: absolute; top: 0.75rem; right: 0.75rem; background: none; border: none;
            color: var(--text-secondary); font-size: 1.4rem; cursor: pointer; z-index: 1; }

        /* 白名单表单 */
        .whitelist-form {
            background: rgba(79,70,229,0.05); border: 1px solid rgba(79,70,229,0.15);
            border-radius: 10px; padding: 1rem;
        }
        .whitelist-field { margin-bottom: 0.6rem; }
        .whitelist-field label { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 0.25rem; display: block; }
        .whitelist-list { max-height: 30vh; overflow-y: auto; }

        /* API Keys 管理表单 */
        .api-keys-admin-form { max-height: 35vh; overflow-y: auto; }

        /* 确认弹窗 */
        .btn-danger {
            background: var(--error); color: #fff; border: none;
            padding: 0.5rem 1.25rem; border-radius: 8px; font-size: 0.9rem;
            cursor: pointer; transition: all 0.15s; font-weight: 600;
        }
        .btn-danger:hover { background: #dc2626; }

        .btn-success {
            background: var(--success); color: #fff; border: none;
            padding: 0.5rem 1.25rem; border-radius: 8px; font-size: 0.9rem;
            cursor: pointer; transition: all 0.15s; font-weight: 600;
        }
        .btn-success:hover { opacity: 0.9; }

        /* ================================================================
           响应式适配 - 平板端 (768px - 1100px)
           ================================================================ */
        @media (max-width: 1100px) and (min-width: 769px) {
            .layout-columns {
                grid-template-columns: 5fr 7fr;
                gap: 1rem;
            }
            .header-content {
                padding: 0 1rem;
                gap: 0.75rem;
            }
            .logo h1 {
                font-size: 1rem;
            }
            .nav-tab {
                padding: 0.5rem 1.2rem;
                font-size: 0.8rem;
                min-width: auto;
            }
            .header-actions {
                gap: 0.35rem;
            }
            .header-actions .btn {
                padding: 0.45rem 0.7rem;
                font-size: 0.75rem;
            }
            .model-links-grid {
                grid-template-columns: repeat(4, 1fr);
            }
            .model-link-btn {
                font-size: 0.72rem;
                padding: 0.45rem 0.5rem;
            }
            .panel-body {
                max-height: 350px;
            }
            .image-prompt-layout {
                grid-template-columns: 320px 1fr;
            }
        }

        /* ================================================================
           响应式适配 - 移动端 (≤768px)
           ================================================================ */
        @media (max-width: 768px) {
            /* --- Header 重构 --- */
            .header {
                padding: 0.5rem 0;
                position: sticky;
                top: 0;
                z-index: 100;
            }
            .header-content {
                flex-wrap: wrap;
                padding: 0 0.75rem;
                gap: 0.5rem;
                justify-content: space-between;
            }
            .logo {
                flex: 1 1 auto;
                min-width: 0;
            }
            .logo h1 {
                font-size: 0.88rem;
                letter-spacing: 0;
            }
            .cloud-status {
                font-size: 0.62rem;
                padding: 0.1rem 0.35rem;
            }

            /* 导航 Tab 移到第二行，占满宽 */
            .nav-tabs {
                order: 10;
                width: 100%;
                flex: 1 1 100%;
                justify-content: stretch;
            }
            .nav-tab {
                flex: 1;
                padding: 0.45rem 0.5rem;
                font-size: 0.75rem;
                min-width: auto;
                text-align: center;
            }
            .nav-tab .nav-tab-icon {
                display: none;
            }

            /* 操作按钮区 */
            .header-actions {
                flex-wrap: wrap;
                gap: 0.3rem;
                align-items: center;
            }
            .header-actions .btn {
                padding: 0.35rem 0.55rem;
                font-size: 0.7rem;
                border-radius: 7px;
                gap: 0.25rem;
            }
            .header-actions .btn span,
            .header-actions .btn .btn-text {
                display: none;
            }
            .user-badge {
                padding: 0.25rem 0.45rem;
                gap: 0.3rem;
            }
            .user-avatar {
                width: 24px;
                height: 24px;
                font-size: 0.65rem;
            }
            .user-name {
                font-size: 0.75rem;
                max-width: 80px;
            }
            .admin-tag {
                font-size: 0.6rem;
                padding: 0.08rem 0.25rem;
            }
            .viewing-badge {
                font-size: 0.65rem;
            }

            /* --- 主布局：两栏变单栏 --- */
            .main {
                padding: 0.75rem;
            }
            .layout-columns {
                grid-template-columns: 1fr;
                gap: 0.75rem;
            }
            .layout-left,
            .layout-right {
                gap: 0.75rem;
            }

            /* --- Panel 通用 --- */
            .panel {
                border-radius: 10px;
            }
            .panel-header {
                padding: 0.75rem 0.85rem;
                flex-wrap: wrap;
                gap: 0.5rem;
            }
            .panel-title {
                font-size: 0.85rem;
            }
            .panel-body {
                padding: 0.75rem 0.85rem;
                max-height: 300px;
            }

            /* --- 词库 --- */
            .category-item {
                padding: 0.6rem 0.75rem;
            }
            .category-name {
                font-size: 0.78rem;
            }
            .word-tag {
                font-size: 0.7rem;
                padding: 0.25rem 0.5rem;
            }
            .word-tag.word-parent {
                font-size: 0.7rem;
                padding: 0.25rem 0.35rem 0.25rem 0.5rem;
            }
            .word-tag.word-child {
                font-size: 0.65rem;
                padding: 0.18rem 0.4rem;
            }
            .word-children-panel {
                margin: 0.1rem 0 0.1rem 0.3rem;
                padding: 0.3rem 0.4rem;
                width: calc(100% - 0.3rem);
            }

            /* --- 尺寸管理 --- */
            .size-tabs {
                gap: 0.25rem;
            }
            .size-tab {
                padding: 0.3rem 0.45rem;
                font-size: 0.7rem;
            }
            .size-btn {
                padding: 0.35rem 0.5rem;
                font-size: 0.7rem;
            }
            .size-custom-wrap {
                flex-wrap: wrap;
                gap: 0.3rem;
            }
            .size-custom-input {
                font-size: 0.72rem;
                padding: 0.3rem 0.4rem;
            }
            .size-custom-btn {
                font-size: 0.7rem;
                padding: 0.3rem 0.5rem;
            }

            /* --- 标题排版 --- */
            .title-layout-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 0.35rem;
            }
            .title-layout-preset {
                padding: 0.45rem 0.3rem;
                font-size: 0.68rem;
            }
            .title-layout-preset .preset-label {
                font-size: 0.7rem;
            }
            .title-layout-options {
                flex-direction: column;
                gap: 0.35rem;
            }
            .title-layout-row {
                min-width: auto;
            }

            /* --- 公式管理 --- */
            .form-item {
                padding: 0.75rem;
            }
            .form-item-name {
                font-size: 0.85rem;
            }
            .form-item-template {
                font-size: 0.72rem;
            }

            /* --- 结果输出 --- */
            .result-textarea {
                min-height: 100px;
                font-size: 0.78rem;
                padding: 0.75rem;
            }
            .result-actions {
                flex-wrap: wrap;
                gap: 0.35rem;
            }
            .result-actions .btn {
                flex: 1 1 auto;
                font-size: 0.72rem;
                padding: 0.4rem 0.6rem;
                justify-content: center;
            }
            .formula-select.compact {
                font-size: 0.75rem;
                padding: 0.35rem 0.55rem;
                min-width: 120px;
            }

            /* --- 模型优化 --- */
            .model-tabs {
                gap: 0.3rem;
            }
            .model-tab {
                padding: 0.4rem 0.6rem;
                font-size: 0.72rem;
            }
            .model-result-textarea {
                min-height: 80px;
                font-size: 0.78rem;
            }

            /* --- 模型链接 --- */
            .model-links {
                padding: 0.75rem 0.85rem;
            }
            .model-links-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 0.35rem;
            }
            .model-link-btn {
                font-size: 0.7rem;
                padding: 0.45rem 0.5rem;
                border-radius: 8px;
            }

            /* --- 历史记录 --- */
            .history-toggle {
                padding: 0.75rem 0.85rem;
            }
            .history-content {
                padding: 0.75rem 0.85rem;
            }
            .history-list {
                max-height: 160px;
            }
            .history-item {
                padding: 0.6rem;
            }
            .history-item-text {
                font-size: 0.75rem;
            }

            /* --- 图片反推视图 --- */
            .image-prompt-layout {
                grid-template-columns: 1fr;
                height: auto;
                gap: 0.75rem;
            }
            .image-prompt-layout .right-panel {
                height: auto;
                max-height: 400px;
            }
            .image-prompt-layout .left-panel {
                height: auto;
            }
            .image-prompt-layout .upload-zone {
                min-height: 100px;
                padding: 1rem 0.75rem;
            }
            .image-prompt-layout .preview-container img {
                max-height: 150px;
            }
            .image-prompt-layout .history-thumb {
                width: 60px;
                height: 60px;
            }
            .image-prompt-layout .history-desc {
                font-size: 0.72rem;
                -webkit-line-clamp: 2;
            }
            .image-prompt-layout .history-meta {
                gap: 0.4rem;
            }
            .image-prompt-layout .history-date {
                font-size: 0.65rem;
            }

            /* --- 弹窗 --- */
            .modal {
                border-radius: 12px;
                max-width: 95vw;
                max-height: 85vh;
            }
            .modal-header {
                padding: 0.85rem 1rem;
            }
            .modal-title {
                font-size: 0.95rem;
            }
            .modal-body {
                padding: 0.85rem 1rem;
            }
            .modal-footer {
                padding: 0.75rem 1rem;
                flex-wrap: wrap;
                gap: 0.5rem;
            }
            .modal-footer .btn {
                flex: 1 1 auto;
                font-size: 0.8rem;
            }

            /* 认证弹窗 */
            .auth-card {
                padding: 1.25rem;
                width: 95vw;
            }
            .auth-card h2 {
                font-size: 1.15rem;
            }
            .auth-field input {
                padding: 0.6rem 0.75rem;
                font-size: 0.85rem;
            }

            /* 管理员面板 */
            .admin-panel {
                padding: 1rem;
                max-height: 85vh;
            }
            .admin-user-item {
                padding: 0.55rem 0.65rem;
            }
            .admin-user-email {
                font-size: 0.78rem;
            }

            /* 智能推荐弹窗 */
            .smart-search-modal .modal {
                max-width: 95vw;
            }
            .smart-search-input-row {
                flex-direction: column;
                gap: 0.35rem;
            }
            .smart-search-input-row .btn {
                width: 100%;
            }
            .smart-search-results {
                max-height: 220px;
            }
            .smart-word-chip {
                font-size: 0.7rem;
                padding: 0.3rem 0.65rem;
            }
            .smart-search-footer {
                flex-wrap: wrap;
                gap: 0.5rem;
            }
            .smart-search-actions {
                flex-wrap: wrap;
                gap: 0.35rem;
            }
            .smart-search-actions .btn {
                flex: 1 1 auto;
                font-size: 0.72rem;
            }

            /* 版本记录弹窗 */
            #versionHistoryModal .modal {
                max-width: 95vw;
            }

            /* Toast */
            .toast {
                min-width: auto;
                max-width: 85vw;
                padding: 0.6rem 0.85rem;
                font-size: 0.82rem;
            }

            /* --- 公式管理面板头部按钮 --- */
            .panel.formula-panel .panel-header {
                flex-wrap: wrap;
            }
            .panel.formula-panel .panel-header > div:last-child {
                flex-wrap: wrap;
                gap: 0.3rem;
            }

            /* --- 隐藏非核心元素 --- */
            .btn-optimize-feed {
                font-size: 0.72rem;
            }
            .cloud-status {
                display: none;
            }
        }

        /* ================================================================
           响应式适配 - 小屏手机 (≤480px)
           ================================================================ */
        @media (max-width: 480px) {
            .header-content {
                padding: 0 0.5rem;
                gap: 0.35rem;
            }
            .logo h1 {
                font-size: 0.78rem;
            }
            .nav-tab {
                padding: 0.4rem 0.35rem;
                font-size: 0.68rem;
                border-bottom-width: 2px;
            }
            .header-actions .btn {
                padding: 0.3rem 0.45rem;
                font-size: 0.65rem;
                border-radius: 6px;
            }
            .user-name {
                max-width: 50px;
            }
            .main {
                padding: 0.5rem;
            }
            .layout-columns {
                gap: 0.5rem;
            }
            .layout-left,
            .layout-right {
                gap: 0.5rem;
            }
            .panel-header {
                padding: 0.6rem 0.7rem;
            }
            .panel-title {
                font-size: 0.78rem;
            }
            .panel-body {
                padding: 0.6rem 0.7rem;
                max-height: 250px;
            }
            .word-tag {
                font-size: 0.66rem;
                padding: 0.2rem 0.4rem;
                border-radius: 5px;
            }
            .size-tabs {
                flex-wrap: wrap;
                gap: 0.2rem;
            }
            .size-tab {
                padding: 0.25rem 0.35rem;
                font-size: 0.65rem;
                border-radius: 5px;
            }
            .size-btn {
                padding: 0.3rem 0.4rem;
                font-size: 0.65rem;
                border-radius: 6px;
            }
            .title-layout-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            .title-layout-preset {
                padding: 0.35rem 0.25rem;
            }
            .title-layout-preset .preset-label {
                font-size: 0.65rem;
            }
            .model-links-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 0.3rem;
            }
            .model-link-btn {
                font-size: 0.65rem;
                padding: 0.35rem 0.4rem;
                border-radius: 7px;
            }
            .result-textarea {
                min-height: 80px;
                font-size: 0.72rem;
            }
            .result-actions .btn {
                font-size: 0.68rem;
                padding: 0.35rem 0.5rem;
            }
            .form-item {
                padding: 0.6rem;
            }
            .form-item-template {
                font-size: 0.68rem;
                padding: 0.4rem 0.55rem;
            }
            .image-prompt-layout .history-thumb {
                width: 48px;
                height: 48px;
            }
            .image-prompt-layout .history-desc {
                font-size: 0.68rem;
                -webkit-line-clamp: 2;
            }
            .image-prompt-layout .history-item {
                padding: 0.6rem 0.85rem;
                gap: 0.6rem;
            }
            .modal {
                max-width: 98vw;
                border-radius: 10px;
            }
            .modal-title {
                font-size: 0.88rem;
            }
            .auth-card {
                padding: 1rem;
            }
            .auth-card h2 {
                font-size: 1.05rem;
            }
            .auth-field input {
                padding: 0.5rem 0.65rem;
                font-size: 0.8rem;
            }
        }

        /* ================================================================
           响应式适配 - 大屏 (>1600px)
           ================================================================ */
        @media (min-width: 1601px) {
            .main {
                max-width: 1800px;
                padding: 2rem;
            }
            .layout-columns {
                gap: 2rem;
            }
            .model-links-grid {
                grid-template-columns: repeat(4, 1fr);
            }
        }
