        /* ==================================================================== */
        /* MODULE: KNOWLEDGE BASE & REGULATIONS (SECTION-KB)                    */
        /* ==================================================================== */
        .kb-header-card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 1.25rem 1.5rem;
            margin-bottom: 1.5rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 1.5rem;
            flex-wrap: wrap;
        }
        .kb-header-title {
            display: flex;
            align-items: center;
            gap: 1rem;
        }
        .kb-header-badge {
            width: 46px;
            height: 46px;
            border-radius: 12px;
            background: linear-gradient(135deg, #6366f1, #8b5cf6);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            color: white;
            box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
        }
        .kb-header-title h2 {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--text-main);
            margin: 0 0 4px 0;
        }
        .kb-header-title p {
            font-size: 0.85rem;
            color: var(--text-muted);
            margin: 0;
        }

        /* Filter Chips */
        .kb-reg-controls {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 1rem;
            margin-bottom: 1.25rem;
            flex-wrap: wrap;
        }
        .kb-filter-chips {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
        }
        .kb-chip {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-color);
            border-radius: 20px;
            padding: 6px 14px;
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--text-muted);
            cursor: pointer;
            transition: all 0.2s ease;
        }
        .kb-chip:hover {
            background: rgba(255, 255, 255, 0.1);
            color: white;
        }
        .kb-chip.active {
            background: #6366f1;
            border-color: #6366f1;
            color: white;
            box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
        }

        /* Regulations Grid & Cards */
        .kb-regulations-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr));
            gap: 1.25rem;
        }
        .kb-rule-card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 1.25rem;
            display: flex;
            flex-direction: column;
            gap: 0.9rem;
            transition: all 0.25s ease;
            position: relative;
        }
        .kb-rule-card.active {
            border-left: 4px solid #10b981;
        }
        .kb-rule-card.inactive {
            border-left: 4px solid var(--text-muted);
            opacity: 0.65;
        }
        .kb-rule-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
        }
        .kb-rule-card-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 0.75rem;
        }
        .kb-rule-title-group {
            display: flex;
            align-items: flex-start;
            gap: 0.75rem;
            flex: 1;
        }
        .kb-rule-icon {
            width: 36px;
            height: 36px;
            border-radius: 10px;
            background: rgba(255, 255, 255, 0.06);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 15px;
            color: #818cf8;
            flex-shrink: 0;
        }
        .kb-rule-title {
            font-weight: 600;
            font-size: 0.95rem;
            color: var(--text-main);
            margin-bottom: 4px;
            line-height: 1.3;
        }
        .kb-badge {
            display: inline-block;
            font-size: 0.7rem;
            font-weight: 700;
            padding: 2px 8px;
            border-radius: 12px;
            text-transform: uppercase;
            letter-spacing: 0.3px;
        }
        .badge-critical {
            background: rgba(239, 68, 68, 0.2);
            color: #fca5a5;
            border: 1px solid rgba(239, 68, 68, 0.4);
        }
        .badge-sop {
            background: rgba(168, 85, 247, 0.2);
            color: #d8b4fe;
            border: 1px solid rgba(168, 85, 247, 0.4);
        }
        .badge-warning {
            background: rgba(245, 158, 11, 0.2);
            color: #fcd34d;
            border: 1px solid rgba(245, 158, 11, 0.4);
        }
        .badge-info {
            background: rgba(59, 130, 246, 0.2);
            color: #93c5fd;
            border: 1px solid rgba(59, 130, 246, 0.4);
        }
        .kb-rule-body {
            font-size: 0.85rem;
            line-height: 1.5;
            color: #cbd5e1;
            background: rgba(0, 0, 0, 0.2);
            padding: 0.75rem;
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.04);
            flex-grow: 1;
        }

        /* SOP Step Pills List in Card */
        .kb-sop-steps-card {
            display: flex;
            flex-direction: column;
            gap: 6px;
            width: 100%;
        }
        .kb-sop-step-item {
            display: flex;
            align-items: flex-start;
            gap: 8px;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid rgba(168, 85, 247, 0.15);
            border-radius: 8px;
            padding: 0.45rem 0.65rem;
            font-size: 0.82rem;
            line-height: 1.4;
        }
        .kb-sop-step-badge {
            background: rgba(168, 85, 247, 0.25);
            color: #e9d5ff;
            font-weight: 700;
            font-size: 0.72rem;
            padding: 0.15rem 0.45rem;
            border-radius: 6px;
            white-space: nowrap;
            flex-shrink: 0;
            border: 1px solid rgba(168, 85, 247, 0.35);
        }
        .kb-sop-step-text {
            color: #f1f5f9;
            flex: 1;
        }

        /* SOP Step Pills in Modal Form */
        .sop-step-pill-row {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            background: rgba(15, 23, 42, 0.6);
            border: 1px solid rgba(168, 85, 247, 0.25);
            border-radius: 10px;
            padding: 0.65rem;
            transition: border-color 0.2s;
        }
        .sop-step-pill-row:hover {
            border-color: rgba(168, 85, 247, 0.5);
        }
        .sop-pill-header {
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, rgba(168, 85, 247, 0.35), rgba(99, 102, 241, 0.35));
            border: 1px solid rgba(168, 85, 247, 0.5);
            color: #f5f3ff;
            font-weight: 700;
            font-size: 0.78rem;
            padding: 0.35rem 0.65rem;
            border-radius: 8px;
            white-space: nowrap;
            min-width: 65px;
            text-align: center;
        }
        .sop-pill-textarea {
            flex: 1;
            background: rgba(0, 0, 0, 0.25);
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 8px;
            padding: 0.45rem 0.65rem;
            color: white;
            font-size: 0.82rem;
            line-height: 1.4;
            resize: vertical;
            outline: none;
            min-height: 52px;
        }
        .sop-pill-textarea:focus {
            border-color: #a855f7;
        }
        .btn-remove-step {
            background: rgba(239, 68, 68, 0.15);
            border: 1px solid rgba(239, 68, 68, 0.3);
            color: #fca5a5;
            border-radius: 8px;
            width: 28px;
            height: 28px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.15s;
            flex-shrink: 0;
            margin-top: 4px;
        }
        .btn-remove-step:hover {
            background: rgba(239, 68, 68, 0.35);
            color: white;
        }
        .kb-rule-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding-top: 0.5rem;
            border-top: 1px solid rgba(255, 255, 255, 0.05);
        }
        .kb-rule-status {
            font-size: 0.75rem;
            font-weight: 600;
            color: var(--text-muted);
        }
        .kb-rule-actions {
            display: flex;
            gap: 6px;
        }
        .btn-icon-rule {
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid var(--border-color);
            color: var(--text-muted);
            border-radius: 6px;
            width: 28px;
            height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 12px;
            transition: all 0.2s ease;
        }
        .btn-icon-rule:hover {
            color: white;
            background: rgba(255, 255, 255, 0.15);
        }
        .btn-icon-rule.delete:hover {
            color: #ef4444;
            background: rgba(239, 68, 68, 0.15);
            border-color: rgba(239, 68, 68, 0.3);
        }

        /* Toggle Switch */
        .kb-switch {
            position: relative;
            display: inline-block;
            width: 42px;
            height: 22px;
            flex-shrink: 0;
        }
        .kb-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }
        .kb-slider {
            position: absolute;
            cursor: pointer;
            top: 0; left: 0; right: 0; bottom: 0;
            background-color: rgba(255, 255, 255, 0.15);
            transition: .3s;
            border-radius: 22px;
        }
        .kb-slider:before {
            position: absolute;
            content: "";
            height: 16px;
            width: 16px;
            left: 3px;
            bottom: 3px;
            background-color: white;
            transition: .3s;
            border-radius: 50%;
        }
        .kb-switch input:checked + .kb-slider {
            background-color: #10b981;
        }
        .kb-switch input:checked + .kb-slider:before {
            transform: translateX(20px);
        }

        /* KB Files & Markdown Editor Layout */
        .kb-files-layout {
            display: grid;
            grid-template-columns: 280px 1fr;
            gap: 1.25rem;
            min-height: 600px;
        }
        .kb-files-sidebar {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 1rem;
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }
        .kb-sidebar-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding-bottom: 0.5rem;
            border-bottom: 1px solid var(--border-color);
        }
        .kb-sidebar-header h4 {
            margin: 0;
            font-size: 0.85rem;
            color: var(--text-main);
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .btn-icon-refresh {
            background: transparent;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            font-size: 13px;
        }
        .btn-icon-refresh:hover {
            color: white;
        }
        .kb-files-list {
            display: flex;
            flex-direction: column;
            gap: 6px;
            overflow-y: auto;
            max-height: 520px;
        }
        .kb-file-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 12px;
            border-radius: 10px;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid transparent;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        .kb-file-item:hover {
            background: rgba(255, 255, 255, 0.08);
            border-color: rgba(255, 255, 255, 0.1);
        }
        .kb-file-item.selected {
            background: rgba(99, 102, 241, 0.15);
            border-color: #6366f1;
        }
        .kb-file-item-icon {
            color: #818cf8;
            font-size: 14px;
        }
        .kb-file-item-info {
            overflow: hidden;
            flex: 1;
        }
        .kb-file-item-name {
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--text-main);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .kb-file-item-size {
            font-size: 0.7rem;
            color: var(--text-muted);
        }
        .kb-files-editor-pane {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 1rem;
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }
        .kb-editor-toolbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding-bottom: 0.75rem;
            border-bottom: 1px solid var(--border-color);
            flex-wrap: wrap;
            gap: 0.75rem;
        }
        .kb-filename-badge {
            font-weight: 700;
            font-size: 0.9rem;
            color: var(--text-main);
        }
        .kb-filesize-badge {
            font-size: 0.75rem;
            color: var(--text-muted);
            margin-left: 8px;
        }
        .kb-editor-actions {
            display: flex;
            gap: 8px;
        }
        .kb-code-editor {
            width: 100%;
            flex: 1;
            min-height: 500px;
            background: #0f172a;
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 12px;
            padding: 1rem;
            font-family: 'Fira Code', 'JetBrains Mono', Consolas, monospace;
            font-size: 0.85rem;
            line-height: 1.6;
            color: #f1f5f9;
            resize: vertical;
            outline: none;
            box-sizing: border-box;
        }
        .kb-code-editor:focus {
            border-color: #6366f1;
            box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
        }

        /* RAG Inspector */
        .kb-rag-card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 1.5rem;
        }
        .kb-rag-search-bar {
            display: flex;
            gap: 10px;
            margin-bottom: 0.75rem;
        }
        .kb-rag-search-bar input {
            flex: 1;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-color);
            border-radius: 10px;
            padding: 12px 16px;
            color: white;
            font-size: 0.9rem;
            outline: none;
        }
        .kb-rag-hint {
            font-size: 0.8rem;
            color: var(--text-muted);
            margin-bottom: 1.5rem;
        }
        .kb-rag-results {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }
        .kb-rag-empty {
            text-align: center;
            color: var(--text-muted);
            padding: 3rem;
            font-size: 0.9rem;
            border: 1px dashed var(--border-color);
            border-radius: 12px;
        }
        .kb-rag-chunk-card {
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 1rem;
        }
        .kb-rag-chunk-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.75rem;
            font-size: 0.8rem;
        }
        .kb-rag-rank {
            background: #6366f1;
            color: white;
            padding: 2px 8px;
            border-radius: 6px;
            font-weight: 700;
        }
        .kb-rag-source {
            color: var(--text-muted);
        }
        .kb-rag-score {
            color: #10b981;
        }
        .kb-rag-chunk-text {
            font-size: 0.85rem;
            line-height: 1.5;
            color: #cbd5e1;
            background: #0f172a;
            padding: 0.85rem;
            border-radius: 8px;
            border-left: 3px solid #6366f1;
        }

        /* Playground Layout */
        .kb-playground-layout {
            display: grid;
            grid-template-columns: 1fr 340px;
            gap: 1.25rem;
            min-height: 520px;
        }
        .kb-playground-chat {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .kb-chat-header {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 16px;
            background: rgba(255, 255, 255, 0.04);
            border-bottom: 1px solid var(--border-color);
        }
        .kb-chat-avatar {
            width: 36px;
            height: 36px;
            border-radius: 10px;
            background: linear-gradient(135deg, #ec4899, #8b5cf6);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
        }
        .kb-chat-status {
            font-size: 0.72rem;
            color: var(--text-muted);
            display: flex;
            align-items: center;
            gap: 5px;
        }
        .dot-online {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: #10b981;
            display: inline-block;
        }
        .btn-sm-reset {
            margin-left: auto;
            background: transparent;
            border: 1px solid var(--border-color);
            color: var(--text-muted);
            border-radius: 6px;
            padding: 5px 8px;
            cursor: pointer;
        }
        .btn-sm-reset:hover {
            color: #ef4444;
            border-color: #ef4444;
        }
        .kb-chat-body {
            flex: 1;
            padding: 1rem;
            display: flex;
            flex-direction: column;
            gap: 12px;
            overflow-y: auto;
            max-height: 420px;
        }
        .kb-chat-bubble {
            max-width: 80%;
            padding: 10px 14px;
            border-radius: 12px;
            font-size: 0.85rem;
            line-height: 1.4;
        }
        .kb-chat-bubble.bot {
            align-self: flex-start;
            background: rgba(255, 255, 255, 0.07);
            color: #f1f5f9;
            border-bottom-left-radius: 4px;
        }
        .kb-chat-bubble.user {
            align-self: flex-end;
            background: #6366f1;
            color: white;
            border-bottom-right-radius: 4px;
        }
        .kb-chat-input-area {
            display: flex;
            gap: 8px;
            padding: 12px;
            border-top: 1px solid var(--border-color);
            background: rgba(0, 0, 0, 0.2);
        }
        .kb-chat-input-area input {
            flex: 1;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 10px 14px;
            color: white;
            font-size: 0.85rem;
            outline: none;
        }
        .kb-playground-inspector {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 1rem;
            display: flex;
            flex-direction: column;
        }
        .kb-playground-inspector h4 {
            margin: 0 0 1rem 0;
            font-size: 0.85rem;
            color: var(--text-main);
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .kb-sim-metrics {
            display: grid;
            grid-template-columns: 1fr;
            gap: 8px;
        }
        .sim-metric {
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 8px 12px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .sim-metric .label {
            font-size: 0.75rem;
            color: var(--text-muted);
        }
        .sim-metric .val {
            font-size: 0.85rem;
            font-weight: 700;
            color: #818cf8;
        }
        .kb-sim-chunks {
            flex: 1;
            overflow-y: auto;
            max-height: 250px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .sim-chunk-item {
            font-size: 0.75rem;
            line-height: 1.4;
            color: #cbd5e1;
            background: rgba(0, 0, 0, 0.3);
            padding: 8px;
            border-radius: 6px;
            border-left: 2px solid #818cf8;
        }

