/* auto-generated: node tools/build-knowledge-css.mjs */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            /* Inter：拉丁字母中大写 I 与 l、数字 1 区分更清晰；中文回退到系统黑体 */
            font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
            background: #fafafa;
            min-height: 100vh;
            min-height: 100dvh;
            overflow-x: hidden;
            overflow-y: auto;
        }
        .chat-container {
            --bottom-nav-h: calc(52px + env(safe-area-inset-bottom, 0px));
        }

        .app-bottom-nav {
            flex-shrink: 0;
            display: flex;
            align-items: stretch;
            justify-content: space-around;
            min-height: 52px;
            padding-bottom: env(safe-area-inset-bottom, 0px);
            background: #fff;
            border-top: 1px solid #f0f0f0;
            z-index: 6;
        }

        .bottom-nav-item {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 3px;
            padding: 6px 4px 8px;
            border: none;
            background: transparent;
            cursor: pointer;
            color: #9a9a9a;
            font-family: inherit;
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent;
        }

        .bottom-nav-item.is-active {
            color: #1a1a1a;
        }

        .bottom-nav-icon {
            width: 26px;
            height: 26px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .bottom-nav-icon img {
            width: 24px;
            height: 24px;
            object-fit: contain;
            border-radius: 6px;
            opacity: 0.72;
        }

        .bottom-nav-item.is-active .bottom-nav-icon img {
            opacity: 1;
        }

        .bottom-nav-icon svg {
            display: block;
        }

        .bottom-nav-item.is-active .bottom-nav-icon svg {
            stroke: #ff7f50;
        }

        .bottom-nav-item.is-active .bottom-nav-icon--kb svg {
            fill: rgba(255, 127, 80, 0.15);
            stroke: #ff7f50;
        }

        .bottom-nav-label {
            font-size: 10px;
            line-height: 1.2;
            font-weight: 500;
            letter-spacing: 0.02em;
        }

        .bottom-nav-item.is-active .bottom-nav-label {
            font-weight: 600;
            color: #ff7f50;
        }

        .app-toast {
            position: fixed;
            left: 50%;
            bottom: calc(var(--bottom-nav-h, 52px) + 12px);
            transform: translateX(-50%) translateY(8px);
            max-width: min(320px, calc(100vw - 32px));
            padding: 10px 16px;
            border-radius: 12px;
            background: rgba(26, 26, 26, 0.88);
            color: #fff;
            font-size: 13px;
            line-height: 1.45;
            text-align: center;
            z-index: 50;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s, transform 0.2s;
        }

        .app-toast.is-visible {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }
        /* 知识库侧栏（左侧） */
        .kb-panel {
            position: fixed;
            top: 0;
            left: 0;
            width: min(460px, 100vw);
            max-width: 100%;
            height: 100vh;
            height: 100dvh;
            box-sizing: border-box;
            padding-left: env(safe-area-inset-left, 0px);
            padding-right: env(safe-area-inset-right, 0px);
            padding-bottom: env(safe-area-inset-bottom, 0px);
            background: white;
            box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
            z-index: 1000;
            transform: translateX(-100%);
            transition: transform 0.28s ease;
            display: flex;
            flex-direction: column;
        }

        .kb-panel.open {
            transform: translateX(0);
        }

        /* 知识库：自定义确认（替代系统 confirm，叠在侧栏之上） */
        .kb-dlg-root {
            position: fixed;
            inset: 0;
            z-index: 1100;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            box-sizing: border-box;
            -webkit-backdrop-filter: blur(5px);
            backdrop-filter: blur(5px);
        }
        .kb-dlg-root[hidden] {
            display: none !important;
        }
        .kb-dlg-backdrop {
            position: absolute;
            inset: 0;
            background: rgba(15, 23, 42, 0.48);
        }
        .kb-dlg-card {
            position: relative;
            width: 100%;
            max-width: 400px;
            padding: 26px 24px 22px;
            border-radius: 18px;
            background: linear-gradient(165deg, #fbfcff 0%, #ffffff 42%, #f5f3ff 100%);
            border: 1px solid rgba(99, 102, 241, 0.18);
            box-shadow:
                0 4px 6px -1px rgba(15, 23, 42, 0.06),
                0 22px 48px -12px rgba(15, 23, 42, 0.28),
                inset 0 1px 0 rgba(255, 255, 255, 0.95);
            animation: kb-dlg-pop 0.24s ease;
        }
        @keyframes kb-dlg-pop {
            from {
                opacity: 0;
                transform: scale(0.94) translateY(10px);
            }
            to {
                opacity: 1;
                transform: scale(1) translateY(0);
            }
        }
        .kb-dlg-icon-cap {
            width: 52px;
            height: 52px;
            margin: 0 auto 14px;
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 26px;
            line-height: 1;
            background: linear-gradient(145deg, #fef2f2 0%, #fce7f3 50%, #eef2ff 100%);
            border: 1px solid rgba(244, 114, 182, 0.35);
            box-shadow: 0 4px 14px rgba(99, 102, 241, 0.12);
        }
        .kb-dlg-title {
            margin: 0 0 10px;
            font-size: 17px;
            font-weight: 700;
            color: #0f172a;
            text-align: center;
            letter-spacing: 0.02em;
        }
        .kb-dlg-body {
            margin: 0 0 22px;
            font-size: 14px;
            line-height: 1.55;
            color: #475569;
            text-align: center;
            word-break: break-word;
        }
        .kb-dlg-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            justify-content: center;
        }
        .kb-dlg-btn {
            min-width: 108px;
            padding: 10px 20px;
            border-radius: 11px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            border: none;
            font-family: inherit;
            transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
        }
        .kb-dlg-btn:active {
            transform: scale(0.98);
        }
        .kb-dlg-btn-cancel {
            background: #f1f5f9;
            color: #475569;
            border: 1px solid #e2e8f0;
            box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
        }
        .kb-dlg-btn-cancel:hover {
            background: #e2e8f0;
            border-color: #cbd5e1;
        }
        .kb-dlg-btn-primary {
            color: #fff;
            background: linear-gradient(180deg, #818cf8 0%, #6366f1 100%);
            box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
        }
        .kb-dlg-btn-primary:hover {
            filter: brightness(1.05);
        }
        .kb-dlg-btn-danger {
            color: #fff;
            background: linear-gradient(180deg, #fb7185 0%, #e11d48 100%);
            box-shadow: 0 2px 10px rgba(225, 29, 72, 0.35);
        }
        .kb-dlg-btn-danger:hover {
            filter: brightness(1.06);
        }

        .kb-header {
            padding: 20px 24px;
            border-bottom: 1px solid #e8ecf0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-shrink: 0;
        }

        .kb-header h3 {
            font-size: 18px;
            color: #1a2a3a;
        }

        .close-kb {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #999;
            line-height: 1;
        }

        .kb-toolbar {
            padding: 12px 24px 20px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            flex: 1;
            min-height: 0;
            overflow-y: auto;
        }

        .kb-global-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 14px;
            color: #333;
        }

        .kb-global-row label {
            display: flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            font-weight: 500;
        }

        .kb-add-btn {
            width: 100%;
            padding: 10px;
            background: #f5f7fa;
            border: 1px dashed #c5cdd6;
            border-radius: 12px;
            color: #3a7bd5;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .kb-add-btn:hover {
            background: #eef3f8;
            border-color: #3a7bd5;
        }

        .kb-view {
            display: none;
            flex: 1;
            flex-direction: column;
            min-height: 0;
            overflow: hidden;
        }

        .kb-view.kb-view-active {
            display: flex;
        }

        .kb-add-view-body {
            flex: 1;
            min-height: 0;
            overflow-y: auto;
            padding: 16px 24px 24px;
            display: flex;
            flex-direction: column;
            gap: 14px;
            --kb-inline-row-height: 44px;
        }

        .kb-form-meta-card {
            display: flex;
            flex-direction: column;
            gap: 10px;
            padding: 0;
            border: none;
            border-radius: 0;
            background: transparent;
            box-shadow: none;
        }

        .kb-form-meta-card > .kb-add-form-group {
            gap: 0;
        }

        .kb-form-meta-card .kb-inline-field,
        .kb-form-meta-card .kb-training-stack {
            border-color: #e2e8f0;
            border-radius: 10px;
            box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
        }

        .kb-form-meta-card .kb-inline-field-label {
            background: linear-gradient(180deg, #f1f3f7 0%, #e4e8ef 100%);
            color: #4a5568;
            font-weight: 600;
            letter-spacing: 0.03em;
            border-right-color: #dce0e8;
        }

        .kb-form-meta-card .kb-add-form-group:first-child .kb-inline-field-label {
            border-radius: 10px 0 0 10px;
        }

        .kb-form-meta-card .kb-training-head-inline .kb-inline-field-label {
            border-radius: 10px 0 0 0;
        }

        .kb-form-meta-card .kb-training-head-inline .kb-inline-field-body {
            border-radius: 0 10px 0 0;
        }

        .kb-form-meta-card .kb-training-title-inline .kb-inline-field-label,
        .kb-form-meta-card .kb-training-title-inline .kb-inline-field-body {
            border-radius: 0;
        }

        .kb-form-meta-card .kb-training-title-inline {
            border-top: 1px solid #e8ecf1;
        }

        .kb-form-meta-card .kb-add-form-group:first-child .kb-inline-field-body {
            border-radius: 0 10px 10px 0;
        }

        .kb-form-meta-card .kb-training-stack > .kb-line-editor-wrap {
            border-radius: 0 0 10px 10px;
        }

        .kb-form-meta-card .kb-inline-field:focus-within,
        .kb-form-meta-card .kb-training-stack:focus-within {
            border-color: #a5b4fc;
            box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18), 0 2px 8px rgba(15, 23, 42, 0.06);
        }

        .kb-add-nav {
            flex-shrink: 0;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .kb-add-form-title {
            flex: 1;
            text-align: center;
            font-size: 16px;
            font-weight: 600;
            color: #1e293b;
        }

        .kb-back-btn {
            padding: 8px 14px;
            font-size: 14px;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            background: #fff;
            color: #475569;
            cursor: pointer;
        }

        .kb-back-btn:hover {
            background: #f8fafc;
            border-color: #cbd5e1;
        }

        .kb-add-form-group {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .kb-add-form-group label {
            font-size: 14px;
            font-weight: 600;
            color: #334155;
        }

        /* 图2：左侧灰底标签 + 右侧白底输入，同一行组合框 */
        .kb-inline-field {
            display: flex;
            align-items: stretch;
            width: 100%;
            border: 1px solid #dcdfe6;
            border-radius: 8px;
            overflow: hidden;
            box-sizing: border-box;
            background: #fff;
        }

        .kb-inline-field:focus-within {
            border-color: #3a7bd5;
            box-shadow: 0 0 0 1px rgba(58, 123, 213, 0.25);
        }

        .kb-inline-field-stretch {
            overflow: visible;
        }

        .kb-inline-field-label {
            flex-shrink: 0;
            min-width: 100px;
            width: 100px;
            padding: 0 10px;
            margin: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            font-weight: 500;
            color: #606266;
            background: #f5f7fa;
            border-right: 1px solid #dcdfe6;
            box-sizing: border-box;
            border-radius: 8px 0 0 8px;
        }

        .kb-inline-field-stretch .kb-inline-field-label {
            align-items: flex-start;
            justify-content: center;
            padding-top: 11px;
            padding-bottom: 11px;
            border-radius: 8px 0 0 8px;
        }

        .kb-training-head-inline.kb-inline-field-stretch .kb-inline-field-label {
            align-items: center;
            padding-top: 0;
            padding-bottom: 0;
            border-radius: 8px 0 0 0;
        }

        .kb-inline-field-body {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            align-items: stretch;
            background: #fff;
            border-radius: 0 8px 8px 0;
        }

        .kb-training-head-inline .kb-inline-field-body {
            border-radius: 0 8px 0 0;
        }

        .kb-training-stack {
            display: flex;
            flex-direction: column;
            width: 100%;
            border: 1px solid #dcdfe6;
            border-radius: 8px;
            overflow: visible;
            box-sizing: border-box;
            background: #fff;
        }

        .kb-training-stack:focus-within {
            border-color: #3a7bd5;
            box-shadow: 0 0 0 1px rgba(58, 123, 213, 0.25);
        }

        .kb-training-stack > .kb-inline-field {
            border: none;
            box-shadow: none;
            border-radius: 0;
        }

        .kb-training-stack > .kb-inline-field:focus-within {
            border-color: transparent;
            box-shadow: none;
        }

        .kb-inline-field-stretch .kb-training-toolbar-row {
            border-radius: 0 8px 0 0;
        }

        .kb-inline-field-input {
            width: 100%;
            border: none !important;
            border-radius: 0 !important;
            box-shadow: none !important;
            padding: 10px 12px !important;
            font-size: 14px;
            font-family: inherit;
            box-sizing: border-box;
            min-height: 42px;
            background: #fff;
            color: #334155;
        }

        .kb-inline-field-input:focus {
            outline: none;
            box-shadow: none !important;
        }

        .kb-add-form-group .kb-inline-field-input:focus {
            border-color: transparent;
        }

        /* 知识库名称 / 训练内容首行 统一高度 */
        .kb-add-view-body .kb-inline-field {
            min-height: var(--kb-inline-row-height);
        }

        .kb-add-view-body .kb-inline-field .kb-inline-field-body {
            min-height: var(--kb-inline-row-height);
        }

        /* 知识库表单内联错误：与侧栏紫粉系协调的轻提示条 */
        .kb-field-error--hint {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            box-sizing: border-box;
            margin: 8px 10px 4px;
            padding: 10px 12px 10px 10px;
            border-radius: 10px;
            font-size: 13px;
            line-height: 1.5;
            color: #9f1239;
            background: linear-gradient(135deg, #fff1f2 0%, #faf5ff 42%, #fff7ed 100%);
            border: 1px solid rgba(244, 114, 182, 0.45);
            box-shadow:
                0 1px 2px rgba(15, 23, 42, 0.04),
                0 4px 14px rgba(99, 102, 241, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
        }
        .kb-field-error--hint[hidden] {
            display: none !important;
        }
        .kb-field-error-icon {
            flex-shrink: 0;
            width: 22px;
            height: 22px;
            margin-top: 1px;
            border-radius: 50%;
            text-align: center;
            line-height: 22px;
            font-size: 12px;
            font-weight: 800;
            color: #fff;
            background: linear-gradient(145deg, #818cf8 0%, #6366f1 45%, #db2777 100%);
            box-shadow: 0 2px 6px rgba(99, 102, 241, 0.45);
        }
        .kb-field-error-text {
            flex: 1;
            min-width: 0;
            font-weight: 500;
            letter-spacing: 0.01em;
        }
        .kb-form-meta-card .kb-inline-field.kb-inline-field--has-error {
            border-color: #fda4af !important;
            box-shadow:
                0 0 0 2px rgba(244, 63, 94, 0.12),
                0 2px 10px rgba(15, 23, 42, 0.06) !important;
        }
        .kb-form-meta-card .kb-inline-field.kb-inline-field--has-error:focus-within {
            border-color: #fb7185 !important;
            box-shadow:
                0 0 0 2px rgba(244, 63, 94, 0.18),
                0 2px 12px rgba(99, 102, 241, 0.1) !important;
        }
        .kb-form-save-error.kb-field-error--hint {
            margin: 12px 0 10px;
            width: 100%;
        }
        .kb-inline-field-input[aria-invalid="true"] {
            background: #fffafb !important;
        }
        .kb-add-view-body .kb-inline-field:not(.kb-training-head-inline) .kb-inline-field-input {
            min-height: 0 !important;
            flex: 1;
            align-self: stretch;
        }

        .kb-training-toolbar-row {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 12px;
            flex-shrink: 0;
            border-bottom: 1px solid #ebeef5;
            background: #fff;
            position: relative;
        }

        .kb-training-head-inline .kb-training-toolbar-row {
            flex: 1;
            min-height: var(--kb-inline-row-height);
            padding: 0 12px;
            border-bottom: none;
            align-items: stretch;
            background: linear-gradient(180deg, #fcfcfd 0%, #f1f4f9 100%);
        }

        .kb-add-form-group input,
        .kb-add-form-group textarea,
        .kb-add-form-group select {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            font-size: 14px;
            font-family: inherit;
            box-sizing: border-box;
            background: #fff;
        }

        .kb-add-form-group textarea {
            min-height: 200px;
            resize: vertical;
            line-height: 1.5;
        }

        .kb-line-editor-wrap {
            display: flex;
            width: 100%;
            align-items: stretch;
            min-height: 200px;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            overflow: hidden;
            box-sizing: border-box;
            background: #fff;
        }

        .kb-line-editor-wrap.kb-line-editor-empty .kb-line-gutter {
            display: none;
        }

        .kb-line-gutter {
            flex-shrink: 0;
            min-width: 40px;
            width: 44px;
            background: #e5e7eb;
            color: #64748b;
            text-align: right;
            padding: 10px 6px 10px 4px;
            font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
            font-size: 14px;
            line-height: 1.5;
            overflow-y: auto;
            overflow-x: hidden;
            border-right: 1px solid #cbd5e1;
            box-sizing: border-box;
            user-select: none;
        }

        .kb-line-num {
            min-height: 1.5em;
            line-height: 1.5;
            box-sizing: border-box;
        }

        .kb-line-editor-textarea {
            flex: 1;
            min-width: 0;
            min-height: 200px;
            resize: vertical;
            border: none !important;
            border-radius: 0 !important;
            padding: 10px 12px !important;
            font-size: 14px;
            line-height: 1.5;
            font-family: inherit;
            box-shadow: none !important;
            box-sizing: border-box;
            background: #fffbeb;
        }

        .kb-line-editor-wrap.kb-line-editor-empty .kb-line-editor-textarea {
            background: #fff;
        }

        .kb-line-editor-textarea:focus {
            outline: none;
            box-shadow: inset 0 0 0 2px rgba(58, 123, 213, 0.15) !important;
        }

        .kb-training-wrap {
            gap: 0;
        }

        .kb-training-title-inline {
            border-top: 1px solid #e5e7eb;
        }

        .kb-training-stack > .kb-line-editor-wrap {
            border: none !important;
            border-top: 2px solid #cbd5e1;
            border-radius: 0 0 8px 8px;
            overflow: hidden;
            width: 100%;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
        }

        .kb-training-dropdown {
            flex: 1;
            min-width: 0;
            min-height: 0;
			margin-top:5px;
            max-height: 36px;
            position: relative;
            z-index: 4;
            display: flex;
            flex-direction: column;
            align-self: stretch;
        }

        .kb-training-dropdown-toggle {
            flex: 1;
            min-height: 0;
            width: 100%;
            display: flex;
            align-items: stretch;
            justify-content: flex-start;
            gap: 0;
            min-height: 36px;
            padding: 0;
            border: 1px solid #dcdfe6;
            border-radius: 8px;
            font-size: 13px;
            font-family: inherit;
            color: #1e293b;
            background: #fff;
            cursor: pointer;
            box-sizing: border-box;
            text-align: left;
            box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
            transition: border-color 0.15s ease, box-shadow 0.15s ease;
            overflow: hidden;
        }

        .kb-training-dropdown-toggle:hover:not(:disabled) {
            border-color: #c0c4cc;
            box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
        }

        .kb-training-dropdown-toggle:hover:not(:disabled) .kb-training-dropdown-split {
            background: #f5f7fa;
        }

        .kb-training-dropdown-toggle:disabled {
            opacity: 0.55;
            cursor: not-allowed;
            background: #f5f7fa;
            box-shadow: none;
        }

        .kb-training-dropdown-toggle:focus {
            outline: none;
            border-color: #6366f1;
            box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
        }

        .kb-training-dropdown-label {
            flex: 1;
            min-width: 0;
            display: flex;
            align-items: center;
            padding: 0 12px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
            font-size: 13px;
            font-weight: 600;
            color: #0f172a;
            letter-spacing: 0.01em;
        }

        .kb-training-dropdown-split {
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 36px;
            border-left: 1px solid #dcdfe6;
            background: #fff;
            box-sizing: border-box;
        }

        .kb-training-dropdown-chevron {
            font-size: 11px;
            line-height: 1;
            color: #475569;
        }

        .kb-training-dropdown-panel {
            position: absolute;
            left: 0;
            right: 0;
            top: calc(100% + 4px);
            z-index: 100;
            background: #fff;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
            max-height: min(320px, 52vh);
            overflow-y: auto;
            box-sizing: border-box;
        }

        .kb-training-dropdown-row {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 10px;
            border-bottom: 1px solid #f1f5f9;
        }

        .kb-training-dropdown-row:last-child {
            border-bottom: none;
        }

        .kb-training-dropdown-row-active {
            background: #eff6ff;
        }

        .kb-training-dropdown-row-main {
            flex: 1;
            min-width: 0;
            padding: 4px 6px;
            border: none;
            border-radius: 6px;
            background: transparent;
            font: inherit;
            font-size: 13px;
            color: #334155;
            text-align: left;
            cursor: pointer;
            white-space: normal;
            word-break: break-word;
            line-height: 1.45;
            overflow-wrap: anywhere;
        }

        .kb-training-dropdown-row-main:hover {
            background: #f8fafc;
        }

        .kb-training-dropdown-row-del {
            flex-shrink: 0;
            padding: 3px 8px;
            font-size: 12px;
            font-weight: 500;
            color: #b91c1c;
            background: #fef2f2;
            border: 1px solid #fecaca;
            border-radius: 6px;
            cursor: pointer;
        }

        .kb-training-dropdown-row-del:hover {
            background: #fee2e2;
        }

        .kb-training-dropdown-row-new .kb-training-dropdown-row-main {
            font-family: inherit;
            font-weight: 600;
            color: #1e293b;
        }

        .kb-training-add-btn {
            flex-shrink: 0;
            align-self: stretch;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 0 !important;
			margin-top:5px;
            max-height: 36px !important;
            padding: 0 18px;
            font-size: 13px;
            font-weight: 600;
            letter-spacing: 0.02em;
            color: #334155;
            background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
            border: 1px solid #cbd5e1;
            border-radius: 8px;
            cursor: pointer;
            white-space: nowrap;
            box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
            transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
        }

        .kb-training-add-btn:hover:not(:disabled) {
            background: linear-gradient(180deg, #f1f5f9 0%, #cbd5e1 100%);
            border-color: #94a3b8;
            box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
        }

        .kb-training-add-btn:active:not(:disabled) {
            background: #e2e8f0;
            box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12);
        }

        .kb-training-add-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .kb-add-form-group input:focus,
        .kb-add-form-group textarea:focus,
        .kb-add-form-group select:focus {
            outline: none;
            border-color: #3a7bd5;
            box-shadow: 0 0 0 2px rgba(58, 123, 213, 0.12);
        }

        .kb-add-save-btn {
            margin-top: 8px;
            padding: 12px;
            width: 100%;
            border: none;
            border-radius: 12px;
            font-size: 15px;
            font-weight: 600;
            color: #fff;
            cursor: pointer;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }

        .kb-add-save-btn:hover {
            opacity: 0.95;
        }

        .kb-body {
            flex: 1;
            overflow-y: auto;
            padding: 16px 24px 24px;
        }

        .kb-empty {
            text-align: center;
            color: #999;
            font-size: 14px;
            padding: 32px 16px;
            line-height: 1.6;
        }

        .kb-card {
            border: 1px solid #e8ecf0;
            border-radius: 12px;
            padding: 12px;
            margin-bottom: 12px;
            background: #fafbfc;
        }

        .kb-card-head {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            margin-bottom: 8px;
        }

        .kb-card-head input[type="checkbox"] {
            margin-top: 4px;
            cursor: pointer;
        }

        .kb-title-input {
            flex: 1;
            padding: 8px 10px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 14px;
        }

        .kb-card-actions {
            display: flex;
            gap: 8px;
            flex-shrink: 0;
        }

        .kb-icon-btn {
            background: white;
            border: 1px solid #e0e6ed;
            border-radius: 8px;
            padding: 6px 10px;
            cursor: pointer;
            font-size: 13px;
            color: #555;
        }

        .kb-icon-btn:hover {
            background: #f0f2f5;
        }

        .kb-icon-btn.danger {
            color: #c0392b;
            border-color: #f5c6c0;
        }

        .kb-content-input {
            width: 100%;
            min-height: 100px;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 13px;
            font-family: inherit;
            line-height: 1.5;
            resize: vertical;
        }

        .kb-meta {
            font-size: 12px;
            color: #888;
            margin-top: 6px;
        }

        .kb-panel-note {
            font-size: 12px;
            color: #888;
            line-height: 1.5;
        }

        .kb-panel-note code {
            font-size: 11px;
            background: #f0f2f5;
            padding: 1px 6px;
            border-radius: 4px;
        }

        .kb-new-cat {
            width: 100%;
        }

        .kb-new-cat-below-list {
            padding-top: 12px;
            margin-top: 4px;
            border-top: 1px solid #eef2f7;
        }

        .kb-new-cat-label {
            display: block;
            font-size: 13px;
            font-weight: 600;
            color: #475569;
            margin-bottom: 8px;
        }

        .kb-new-cat-row {
            display: flex;
            gap: 8px;
            width: 100%;
            align-items: center;
        }

        .kb-new-cat-row input {
            flex: 1;
            padding: 8px 10px;
            border-radius: 8px;
            border: 1px solid #ddd;
            font-size: 14px;
        }

        .kb-category-block {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .kb-category-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }

        .kb-category-label {
            font-size: 14px;
            font-weight: 500;
            color: #333;
        }

        .kb-cat-search {
            width: 100%;
            padding: 8px 10px;
            border-radius: 8px;
            border: 1px solid #ddd;
            font-size: 14px;
            box-sizing: border-box;
        }

        .kb-cat-search:focus {
            outline: none;
            border-color: #3a7bd5;
            box-shadow: 0 0 0 2px rgba(58, 123, 213, 0.15);
        }

        .kb-cat-list-scroll {
            max-height: min(480px, calc(100vh - 220px));
            max-height: min(480px, calc(100dvh - 200px));
            overflow: auto;
            -webkit-overflow-scrolling: touch;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            background: #fff;
        }

        .kb-cat-list-inner {
            min-width: 0;
        }

        /* 桌面：四列网格；名称列优先保证至少约 4 个汉字 +「展开」；时间/创建人列收窄并可省略 */
        .kb-cat-thead,
        .kb-cat-row {
            display: grid;
            grid-template-columns: 36px minmax(9.5rem, 1fr) minmax(0, 6.75rem) minmax(82px, max-content);
            align-items: center;
            column-gap: 10px;
            row-gap: 4px;
            padding: 9px 12px;
            font-size: 13px;
        }

        .kb-cat-thead {
            position: sticky;
            top: 0;
            z-index: 1;
            font-size: 12px;
            font-weight: 600;
            color: #475569;
            background: linear-gradient(180deg, #f1f5f9 0%, #e8eef5 100%);
            border-bottom: 1px solid #e2e8f0;
        }

        .kb-cat-thead > div {
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .kb-cat-th-actions {
            text-align: right;
        }

        .kb-cat-thead.kb-cat-thead--readonly,
        .kb-cat-row.kb-cat-row--readonly {
            grid-template-columns: 36px minmax(9.5rem, 1fr) minmax(0, 5.25rem) minmax(0, 6.75rem);
        }

        .kb-cat-creator {
            font-size: 12px;
            color: #475569;
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            min-width: 0;
        }

        .kb-cat-section {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .kb-cat-section-title {
            font-size: 15px;
            font-weight: 700;
            color: #0f172a;
            letter-spacing: -0.02em;
        }

        .kb-cat-section-hint {
            margin: -4px 0 0;
            font-size: 12px;
            color: #64748b;
            line-height: 1.45;
        }

        .kb-cat-section-divider {
            margin: 6px 0 4px;
            border: none;
            border-top: 1px solid #e2e8f0;
        }

        .kb-cat-list-scroll.kb-cat-list-scroll--all {
            max-height: min(280px, calc(100dvh - 380px));
        }

        .kb-all-cats-pager {
            display: flex;
            align-items: center;
            justify-content: center;
            flex-wrap: wrap;
            gap: 10px 16px;
            margin-top: 10px;
            padding: 4px 0;
        }

        .kb-all-cats-pager button {
            padding: 7px 14px;
            font-size: 13px;
            border-radius: 8px;
            border: 1px solid #cbd5e1;
            background: #fff;
            color: #334155;
            cursor: pointer;
        }

        .kb-all-cats-pager button:hover:not(:disabled) {
            border-color: #94a3b8;
            background: #f8fafc;
        }

        .kb-all-cats-pager button:disabled {
            opacity: 0.45;
            cursor: not-allowed;
        }

        .kb-all-cats-page-label {
            font-size: 12px;
            color: #64748b;
            min-width: 0;
            text-align: center;
        }

        .kb-cat-row {
            margin: 0;
            border-bottom: none;
            color: #1e293b;
            transition: background 0.12s;
        }

        .kb-cat-row:hover {
            background: #f8fafc;
        }

        .kb-cat-row.selected {
            background: linear-gradient(90deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.06) 100%);
            box-shadow: inset 3px 0 0 #667eea;
        }

        .kb-cat-row-block {
            border-bottom: 1px solid #f1f5f9;
        }

        .kb-cat-list-inner > .kb-cat-row-block:last-of-type {
            border-bottom: none;
        }

        .kb-cat-idx {
            text-align: center;
            font-variant-numeric: tabular-nums;
            color: #64748b;
            font-size: 12px;
        }

        .kb-cat-main-line {
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 0;
        }

        .kb-cat-main-line .kb-cat-title {
            flex: 1;
            /* 至少约 4 个汉字可见后再省略 */
            min-width: 5em;
        }

        .kb-cat-expand-btn {
            flex-shrink: 0;
            display: inline-flex;
            align-items: center;
            gap: 3px;
            border: none;
            background: transparent;
            padding: 2px 6px;
            cursor: pointer;
            color: #64748b;
            font-size: 12px;
            line-height: 1.25;
            white-space: nowrap;
            border-radius: 6px;
        }

        .kb-cat-expand-btn:hover {
            background: #e2e8f0;
            color: #334155;
        }

        .kb-cat-expand-btn[aria-expanded="true"] {
            color: #4338ca;
        }

        .kb-cat-expand-panel {
            padding: 0 12px 10px 58px;
            background: #f8fafc;
            font-size: 12px;
            color: #475569;
            line-height: 1.45;
        }

        .kb-cat-expand-panel[hidden] {
            display: none !important;
        }

        .kb-cat-expand-title-list {
            margin: 0;
            padding: 0 0 0 1.1em;
            list-style: disc;
        }

        .kb-cat-expand-title-list li {
            margin: 2px 0;
            word-break: break-word;
        }

        .kb-cat-expand-loading,
        .kb-cat-expand-empty {
            padding: 4px 0 2px;
            color: #64748b;
        }

        .kb-cat-main {
            min-width: 0;
            padding: 4px 0;
        }

        .kb-cat-main.kb-cat-main--selectable .kb-cat-title {
            cursor: pointer;
        }

        .kb-cat-title {
            display: block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-weight: 500;
            color: #0f172a;
            line-height: 1.35;
        }

        .kb-cat-row.selected .kb-cat-title {
            color: #4338ca;
        }

        .kb-cat-time {
            font-size: 11px;
            color: #64748b;
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .kb-cat-actions {
            display: flex;
            justify-content: flex-end;
            gap: 6px;
        }

        .kb-cat-btn {
            padding: 4px 8px;
            font-size: 12px;
            border-radius: 6px;
            border: 1px solid #cbd5e1;
            background: #fff;
            color: #475569;
            cursor: pointer;
            transition: all 0.12s;
        }

        .kb-cat-btn:hover {
            background: #f1f5f9;
            border-color: #94a3b8;
        }

        .kb-cat-btn-edit {
            color: #2563eb;
            border-color: #bfdbfe;
            background: #eff6ff;
        }

        .kb-cat-btn-edit:hover {
            background: #dbeafe;
        }

        .kb-cat-btn-del {
            color: #b91c1c;
            border-color: #fecaca;
            background: #fef2f2;
        }

        .kb-cat-btn-del:hover {
            background: #fee2e2;
        }

        .kb-cat-empty {
            padding: 16px;
            text-align: center;
            font-size: 13px;
            color: #999;
        }

        .kb-cat-filter-hint {
            padding: 8px 10px;
            margin: 0 4px 6px;
            font-size: 12px;
            color: #856404;
            background: #fff8e6;
            border-radius: 8px;
            border: 1px solid #ffe69c;
        }

        /* 知识库列表：与输入区一致 ≤640px 用卡片布局，避免四列表格挤爆 */
        @media (max-width: 640px) {
            .kb-header {
                padding: 14px 16px;
            }

            .kb-header h3 {
                font-size: 16px;
            }

            .kb-toolbar {
                padding: 10px 14px 16px;
            }

            .kb-cat-list-scroll {
                max-height: min(56vh, calc(100dvh - 200px));
                border-radius: 12px;
                overflow-x: hidden;
            }

            .kb-cat-thead {
                display: none;
            }

            .kb-cat-row-block {
                margin: 0 0 10px;
            }

            .kb-cat-list-inner > .kb-cat-row-block:last-of-type {
                margin-bottom: 0;
            }

            .kb-cat-row {
                display: grid;
                grid-template-columns: 32px 1fr;
                grid-template-areas:
                    'idx main'
                    'idx time'
                    'act act';
                column-gap: 10px;
                row-gap: 6px;
                padding: 12px 14px;
                margin: 0;
                border: 1px solid #e2e8f0;
                border-bottom: 1px solid #e2e8f0;
                border-radius: 12px;
                background: #fafbfc;
            }

            .kb-cat-expand-panel {
                margin-top: 0;
                padding: 8px 14px 12px 14px;
                border: 1px solid #e2e8f0;
                border-top: none;
                border-radius: 0 0 12px 12px;
                background: #f1f5f9;
            }

            .kb-cat-idx {
                grid-area: idx;
                align-self: start;
                padding-top: 2px;
                font-size: 11px;
                color: #94a3b8;
            }

            .kb-cat-main {
                grid-area: main;
                min-width: 0;
            }

            .kb-cat-title {
                white-space: normal;
                display: -webkit-box;
                -webkit-line-clamp: 2;
                -webkit-box-orient: vertical;
                overflow: hidden;
                word-break: break-word;
            }

            .kb-cat-main-line {
                flex-wrap: wrap;
                align-items: center;
                row-gap: 6px;
                column-gap: 8px;
            }

            .kb-cat-main-line .kb-cat-title {
                flex: 1 1 100%;
                min-width: 0;
                width: 100%;
                order: 1;
            }

            .kb-cat-main-line .kb-cat-expand-btn {
                order: 2;
                flex-shrink: 0;
                align-self: flex-start;
                min-height: 36px;
                padding: 4px 10px;
                font-size: 13px;
                touch-action: manipulation;
            }

            .kb-cat-time {
                grid-area: time;
                white-space: normal;
                font-size: 12px;
                color: #64748b;
                overflow-wrap: anywhere;
                word-break: break-word;
            }

            .kb-cat-time::before {
                content: '创建：';
                color: #94a3b8;
                font-size: 11px;
            }

            .kb-cat-actions {
                grid-area: act;
                justify-content: stretch;
                gap: 10px;
                margin-top: 4px;
            }

            .kb-cat-actions .kb-cat-btn {
                flex: 1;
                padding: 8px 10px;
                font-size: 13px;
                border-radius: 8px;
            }

            .kb-cat-row.kb-cat-row--readonly {
                grid-template-columns: 32px 1fr;
                grid-template-areas:
                    'idx main'
                    'idx creator'
                    'idx time';
            }

            .kb-cat-row.kb-cat-row--readonly .kb-cat-main {
                grid-area: main;
            }

            .kb-cat-row.kb-cat-row--readonly .kb-cat-creator {
                grid-area: creator;
                white-space: normal;
                font-size: 12px;
                overflow-wrap: anywhere;
                word-break: break-word;
            }

            .kb-cat-row.kb-cat-row--readonly .kb-cat-creator::before {
                content: '创建人：';
                color: #94a3b8;
                font-size: 11px;
            }

            .kb-cat-row.kb-cat-row--readonly .kb-cat-time {
                grid-area: time;
            }

            .kb-add-btn {
                padding: 12px;
                font-size: 15px;
                border-radius: 12px;
            }
        }
        .auth-modal-overlay {
            position: fixed;
            inset: 0;
            background: #fff;
            z-index: 1001;
            display: none;
        }

        .auth-modal-overlay.open {
            display: block;
        }

        .auth-modal {
            position: fixed;
            inset: 0;
            width: 100%;
            max-width: 100%;
            height: 100%;
            max-height: 100%;
            transform: none;
            overflow: hidden;
            background: #fff;
            border: none;
            border-radius: 0;
            box-shadow: none;
            z-index: 1002;
            display: none;
            flex-direction: column;
        }

        .auth-modal.open {
            display: flex;
        }

        .auth-modal-inner {
            display: flex;
            flex-direction: column;
            height: 100%;
            max-height: 100dvh;
            overflow: hidden;
        }

        .auth-page-top {
            flex-shrink: 0;
            padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px 16px;
        }

        .auth-back-btn {
            width: 44px;
            height: 44px;
            margin: 0;
            padding: 0;
            border: none;
            background: transparent;
            color: #333;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 10px;
            -webkit-tap-highlight-color: transparent;
        }

        .auth-back-btn:hover {
            background: #f5f5f5;
        }

        .auth-back-btn svg {
            display: block;
        }

        .auth-modal-body {
            flex: 1;
            min-height: 0;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
            padding: 0 28px 28px;
            padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
            -webkit-overflow-scrolling: touch;
        }

        .auth-pane {
            display: flex;
            flex-direction: column;
            flex: 1;
            min-height: 0;
        }

        .auth-page-title {
            margin: 8px 0 0;
            font-size: 26px;
            font-weight: 700;
            letter-spacing: -0.02em;
            color: #1a1a1a;
            line-height: 1.25;
        }

        .auth-page-subtitle {
            margin: 10px 0 36px;
            font-size: 14px;
            color: #999;
            line-height: 1.45;
        }

        .auth-field {
            border-bottom: 1px solid #eee;
            margin-bottom: 0;
        }

        .auth-field input {
            width: 100%;
            padding: 16px 0;
            border: none;
            background: transparent;
            font-size: 16px;
            color: #333;
            outline: none;
            font-family: inherit;
        }

        .auth-field input::placeholder {
            color: #bbb;
        }

        .auth-field--code {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .auth-field--code input {
            flex: 1;
            min-width: 0;
        }

        .auth-sms-send-btn {
            flex-shrink: 0;
            padding: 8px 0 8px 8px;
            border: none;
            background: transparent;
            font-size: 15px;
            font-weight: 500;
            color: #3dccc0;
            cursor: pointer;
            white-space: nowrap;
            font-family: inherit;
            -webkit-tap-highlight-color: transparent;
        }

        .auth-sms-send-btn:hover:not(:disabled) {
            color: #2eb8a6;
        }

        .auth-sms-send-btn:disabled {
            color: #bbb;
            cursor: not-allowed;
        }

        .auth-agree-row {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            margin: 28px 0 24px;
            font-size: 13px;
            line-height: 1.55;
            color: #666;
        }

        .auth-agree-row input[type="checkbox"] {
            flex-shrink: 0;
            width: 18px;
            height: 18px;
            margin-top: 2px;
            border-radius: 50%;
            accent-color: #3dccc0;
            cursor: pointer;
        }

        .auth-agree-text {
            flex: 1;
            min-width: 0;
        }

        .auth-legal-link {
            color: #3dccc0;
            text-decoration: none;
        }

        .auth-legal-link:hover {
            color: #2eb8a6;
            text-decoration: underline;
        }

        .auth-form-error {
            color: #e53935;
            font-size: 13px;
            margin: -12px 0 12px;
            line-height: 1.45;
            display: none;
        }

        .auth-form-error:not(:empty) {
            display: block;
        }

        .auth-login-btn {
            width: 100%;
            padding: 15px 16px;
            border: none;
            border-radius: 999px;
            font-size: 16px;
            font-weight: 600;
            color: #999;
            background: #f0f0f0;
            cursor: not-allowed;
            font-family: inherit;
            transition: background 0.2s, color 0.2s;
            -webkit-tap-highlight-color: transparent;
        }

        .auth-login-btn.is-ready {
            color: #fff;
            background: linear-gradient(135deg, #ff8f6b 0%, #ff7f50 100%);
            cursor: pointer;
            box-shadow: 0 4px 16px rgba(255, 127, 80, 0.35);
        }

        .auth-login-btn.is-ready:active {
            transform: scale(0.99);
        }

        .auth-login-btn:disabled:not(.is-ready) {
            opacity: 1;
        }

        .auth-oauth-wrap {
            margin-top: auto;
            padding-top: 48px;
        }

        .auth-oauth-divider {
            display: flex;
            align-items: center;
            gap: 14px;
            margin-bottom: 28px;
            color: #ccc;
            font-size: 13px;
        }

        .auth-oauth-divider::before,
        .auth-oauth-divider::after {
            content: '';
            flex: 1;
            height: 1px;
            background: #eee;
        }

        .auth-oauth-divider span {
            flex-shrink: 0;
            color: #bbb;
        }

        .auth-oauth-icons {
            display: flex;
            justify-content: center;
            padding-bottom: 12px;
        }

        .auth-wechat-btn {
            width: 48px;
            height: 48px;
            padding: 0;
            border: none;
            border-radius: 50%;
            background: transparent;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            -webkit-tap-highlight-color: transparent;
        }

        .auth-wechat-btn:hover {
            opacity: 0.88;
        }

        .auth-wechat-btn svg {
            display: block;
        }

        @media (min-width: 641px) {
            .auth-modal {
                left: 50%;
                top: 50%;
                right: auto;
                bottom: auto;
                width: min(420px, 100%);
                height: auto;
                max-height: min(720px, 92vh);
                transform: translate(-50%, -50%);
                border-radius: 16px;
                box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
            }

            .auth-modal-inner {
                max-height: min(720px, 92vh);
                border-radius: 16px;
                overflow: hidden;
            }

            .auth-modal-overlay.open {
                background: rgba(0, 0, 0, 0.35);
            }
        }


        /* 知识库全屏页（底部 Tab，仅 index 对话壳内默认隐藏） */
        .chat-container .kb-page {
            display: none;
            flex: 1;
            flex-direction: column;
            min-height: 0;
            background: #fff;
        }

        .chat-container--view-kb .kb-page {
            display: flex;
        }

        .chat-container--view-kb .main-body,
        .chat-container--view-kb .input-area {
            display: none !important;
        }

        .chat-container--view-kb .app-topbar .topbar-disclaimer,
        .chat-container--view-kb .app-topbar .topbar-clear-btn {
            display: none;
        }

        .kb-page-header {
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 12px 20px;
        }

        .kb-page-header h1 {
            margin: 0;
            font-size: 22px;
            font-weight: 700;
            color: #1a1a1a;
            letter-spacing: -0.02em;
        }

        .kb-page-search-btn {
            width: 40px;
            height: 40px;
            border: none;
            background: transparent;
            color: #333;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 10px;
        }

        .kb-page-search-btn:hover {
            background: #f5f5f5;
        }

        .kb-page-search-bar {
            flex-shrink: 0;
            padding: 0 20px 12px;
        }

        .kb-page-search-bar[hidden] {
            display: none !important;
        }

        .kb-page-search-bar input {
            width: 100%;
            padding: 10px 14px;
            border: none;
            border-radius: 10px;
            background: #f5f5f5;
            font-size: 15px;
            outline: none;
            font-family: inherit;
        }

        .kb-page-search-bar input:focus {
            background: #f0f0f0;
            box-shadow: 0 0 0 2px rgba(61, 204, 192, 0.25);
        }

        .kb-page-scroll {
            flex: 1;
            min-height: 0;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }

        .kb-page-section {
            border-top: 8px solid #f5f5f5;
        }

        .kb-page-section:first-child {
            border-top: none;
        }

        .kb-page-section-head {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 14px 16px 14px 20px;
            background: #fff;
        }

        .kb-page-section-toggle {
            flex: 1;
            min-width: 0;
            display: flex;
            align-items: center;
            gap: 6px;
            border: none;
            background: transparent;
            padding: 0;
            font-size: 16px;
            font-weight: 600;
            color: #1a1a1a;
            cursor: pointer;
            text-align: left;
            font-family: inherit;
        }

        .kb-page-section-toggle .kb-page-chevron {
            display: inline-flex;
            transition: transform 0.2s;
            color: #666;
        }

        .kb-page-section.is-collapsed .kb-page-chevron {
            transform: rotate(-90deg);
        }

        .kb-page-section-add {
            flex-shrink: 0;
            width: 36px;
            height: 36px;
            border: none;
            background: transparent;
            color: #333;
            font-size: 22px;
            line-height: 1;
            cursor: pointer;
            border-radius: 8px;
        }

        .kb-page-section-add:hover {
            background: #f5f5f5;
        }

        .kb-page-section-body {
            padding: 0 0 4px;
        }

        .kb-page-section.is-collapsed .kb-page-section-body {
            display: none;
        }

        .kb-page-item {
            display: flex;
            align-items: center;
            gap: 14px;
            width: 100%;
            padding: 14px 20px;
            border: none;
            border-bottom: 1px solid #f0f0f0;
            background: #fff;
            cursor: pointer;
            text-align: left;
            font-family: inherit;
            transition: background 0.12s;
        }

        .kb-page-item:last-child {
            border-bottom: none;
        }

        .kb-page-item:hover {
            background: #fafafa;
        }

        .kb-page-item-icon {
            flex-shrink: 0;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .kb-page-item-name {
            flex: 1;
            min-width: 0;
            font-size: 16px;
            color: #1a1a1a;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .kb-page-empty {
            padding: 16px 20px 20px;
            font-size: 14px;
            color: #999;
            line-height: 1.5;
        }

        .kb-page-discover {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin: 8px 16px 16px;
            padding: 16px 18px;
            border: none;
            border-radius: 12px;
            background: linear-gradient(135deg, #e8f7f5 0%, #dff3f1 55%, #d4eeec 100%);
            cursor: pointer;
            text-align: left;
            font-family: inherit;
            width: calc(100% - 32px);
            box-sizing: border-box;
        }

        .kb-page-discover-text {
            font-size: 15px;
            font-weight: 500;
            color: #2a6f68;
        }

        .kb-page-discover-art {
            flex-shrink: 0;
            opacity: 0.85;
        }

        .chat-container--view-kb-form .main-body,
        .chat-container--view-kb-form .input-area,
        .chat-container--view-kb-form .kb-page {
            display: none !important;
        }

        .kb-panel.kb-panel--fullscreen {
            position: fixed;
            inset: 0;
            left: 0;
            width: 100%;
            max-width: 100%;
            height: 100dvh;
            transform: translateX(0);
            z-index: 1003;
            box-shadow: none;
        }

        .chat-container--view-kb-form .kb-panel.kb-panel--fullscreen {
            display: flex;
        }

        .chat-container--view-kb-form .kb-overlay {
            display: none !important;
        }

        .kb-panel.kb-panel--fullscreen .kb-header {
            padding-top: calc(16px + env(safe-area-inset-top, 0px));
        }

        .kb-panel.kb-panel--fullscreen .close-kb {
            font-size: 28px;
        }


.kb-standalone-app .kb-page,
.kb-standalone-app #kbPage {
    display: flex !important;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    background: #fff;
    width: 100%;
}

.kb-standalone-app .kb-page-scroll {
    flex: 1;
    min-height: 0;
    padding-bottom: calc(8px + var(--bottom-nav-h, 52px));
}

.kb-standalone--form .kb-page {
    display: none !important;
}

.kb-standalone--form .kb-panel.kb-panel--fullscreen {
    display: flex;
    transform: translateX(0);
}

.kb-standalone-app #kbListView {
    display: none !important;
}

.kb-standalone-app #kbAddView.kb-view-active {
    display: flex;
}

.kb-standalone-app:not(.kb-standalone--form) .kb-panel {
    display: none !important;
}

.kb-standalone--form .kb-panel {
    display: flex !important;
}

a.bottom-nav-item,
span.bottom-nav-item {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    padding: 6px 4px 4px;
}

span.bottom-nav-item {
    cursor: default;
}

.bottom-nav-item[data-tab="apikey"] .bottom-nav-label {
    font-size: 9px;
    letter-spacing: -0.02em;
}
