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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
/* Knowledge sources page — redesign tokens.
 *
 * Single page-scoped stylesheet so we don't have to rebuild Tailwind
 * for layout-only changes. All selectors live under .ks-page or specific
 * dialog ids to avoid bleeding into other pages. */

.ks-page { max-width: 1400px; margin: 0 auto; padding-bottom: 2rem; }

/* ---------------- Header ---------------- */
.ks-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 0 1.25rem;
    border-bottom: 1px solid hsl(var(--border));
    margin-bottom: 1.5rem;
}
.ks-header__title h1 {
    margin: 0 0 0.25rem;
    font-size: 1.625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.ks-header__title p {
    margin: 0;
    color: hsl(var(--muted-foreground));
    font-size: 0.9rem;
    max-width: 60ch;
}
.ks-header__actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.ks-bot-context {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    background: hsl(var(--muted) / 0.4);
}
.ks-bot-context__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: hsl(var(--muted-foreground));
    margin: 0;
    font-weight: 600;
}
.ks-bot-context__select {
    min-width: 200px;
}
.ks-bot-context__select select { background: transparent; border: 0; padding: 0; }

/* ---------------- Active jobs banner ---------------- */
.ks-active-jobs {
    margin-bottom: 1.5rem;
    border: 1px solid hsl(217 91% 60% / 0.3);
    border-radius: 10px;
    background: linear-gradient(180deg, hsl(217 91% 60% / 0.06), hsl(217 91% 60% / 0.02));
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.ks-active-jobs[hidden] { display: none; }
.ks-active-jobs__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: hsl(217 91% 35%);
}
.ks-active-jobs__title::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: hsl(217 91% 50%);
    box-shadow: 0 0 0 0 hsl(217 91% 50% / 0.5);
    animation: ks-pulse 1.6s ease-out infinite;
}
@keyframes ks-pulse {
    0% { box-shadow: 0 0 0 0 hsl(217 91% 50% / 0.5); }
    70% { box-shadow: 0 0 0 8px hsl(217 91% 50% / 0); }
    100% { box-shadow: 0 0 0 0 hsl(217 91% 50% / 0); }
}
.ks-active-jobs__row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem 0;
    border-top: 1px solid hsl(var(--border) / 0.5);
}
.ks-active-jobs__row:first-of-type { border-top: 0; }
.ks-active-jobs__name {
    font-weight: 500;
    font-size: 0.9rem;
}
.ks-active-jobs__meta {
    display: flex;
    gap: 0.6rem;
    font-size: 0.78rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.15rem;
}
.ks-progress {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: hsl(var(--muted));
    overflow: hidden;
    margin-top: 0.4rem;
}
.ks-progress__bar {
    height: 100%;
    background: linear-gradient(90deg, hsl(217 91% 60%), hsl(217 91% 50%));
    transition: width 0.4s ease;
}

/* ---------------- Sources grid ---------------- */
.ks-sources__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.ks-sources__toolbar h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}
.ks-sources__filters {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.ks-sources__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}
.ks-sources__loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem;
    justify-content: center;
    color: hsl(var(--muted-foreground));
}
.ks-sources__empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    border: 1px dashed hsl(var(--border));
    border-radius: 12px;
    background: hsl(var(--muted) / 0.2);
}
.ks-sources__empty h3 { margin: 0.5rem 0 0.25rem; font-size: 1.1rem; }
.ks-sources__empty p { color: hsl(var(--muted-foreground)); margin: 0 auto 1rem; max-width: 40ch; }

/* ---------------- Source card ---------------- */
.ks-source-card {
    display: flex;
    flex-direction: column;
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    background: hsl(var(--background));
    padding: 1rem 1rem 0.75rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ks-source-card:hover { border-color: hsl(var(--border) / 1.5); box-shadow: 0 2px 8px hsl(var(--foreground) / 0.04); }
.ks-source-card.is-inactive { opacity: 0.62; }
.ks-source-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.ks-source-card__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ks-source-card__icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: hsl(var(--muted));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: hsl(var(--muted-foreground));
}
.ks-source-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.6rem;
    font-size: 0.8rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 0.6rem;
}
.ks-source-card__meta strong { color: hsl(var(--foreground)); font-weight: 500; }
.ks-source-card__crawl {
    margin: 0.25rem 0 0.5rem;
    padding: 0.5rem 0.6rem;
    background: hsl(var(--muted) / 0.5);
    border-radius: 6px;
    font-size: 0.78rem;
    color: hsl(var(--muted-foreground));
}
.ks-source-card__crawl.is-active { background: hsl(217 91% 60% / 0.08); color: hsl(217 91% 35%); }
.ks-source-card__crawl.is-failed  { background: hsl(0 84% 60% / 0.08); color: hsl(0 84% 35%); }
.ks-source-card__actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid hsl(var(--border) / 0.6);
}
.ks-source-card__actions .cds--btn--sm { font-size: 0.78rem; }

/* Status pill (used inside card head) */
.ks-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.ks-status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.ks-status-pill--active   { background: hsl(142 76% 36% / 0.12); color: hsl(142 76% 28%); }
.ks-status-pill--active::before   { background: hsl(142 76% 40%); }
.ks-status-pill--inactive { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.ks-status-pill--inactive::before { background: hsl(var(--muted-foreground)); }
.ks-status-pill--running  { background: hsl(217 91% 60% / 0.12); color: hsl(217 91% 35%); }
.ks-status-pill--running::before  { background: hsl(217 91% 50%); animation: ks-pulse 1.6s ease-out infinite; }
.ks-status-pill--failed   { background: hsl(0 84% 60% / 0.1); color: hsl(0 84% 35%); }
.ks-status-pill--failed::before   { background: hsl(0 84% 50%); }
.ks-status-pill--linked   { background: hsl(142 76% 36% / 0.1); color: hsl(142 76% 30%); }

/* ---------------- History (collapsible) ---------------- */
.ks-history {
    margin-top: 1.5rem;
    border-top: 1px solid hsl(var(--border));
}
.ks-history details {
    padding: 0.5rem 0;
}
.ks-history summary {
    cursor: pointer;
    list-style: none;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    user-select: none;
}
.ks-history summary:hover { background: hsl(var(--muted) / 0.4); }
.ks-history summary::-webkit-details-marker { display: none; }
.ks-history summary::before {
    content: '▸';
    font-size: 0.7rem;
    color: hsl(var(--muted-foreground));
    transition: transform 0.18s ease;
    display: inline-block;
}
.ks-history details[open] summary::before { transform: rotate(90deg); }
.ks-history summary h2 { font-size: 1rem; font-weight: 600; }
.ks-history__hint { color: hsl(var(--muted-foreground)); font-size: 0.78rem; margin-left: 0.5rem; }
.ks-history__body { padding: 0.5rem 0 0; }
.ks-history__filters {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

/* ---------------- Modal: import dialog ---------------- */
.ks-import-dialog {
    position: fixed;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: min(720px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    box-shadow: 0 24px 48px -8px rgba(0, 0, 0, 0.25);
    z-index: 60;
    overflow: hidden;
}
.ks-import-dialog__header {
    padding: 1.1rem 1.25rem 0.75rem;
    border-bottom: 1px solid hsl(var(--border));
    position: relative;
}
.ks-import-dialog__header h2 { margin: 0 0 0.25rem; font-size: 1.1rem; font-weight: 600; }
.ks-import-dialog__header p  { margin: 0; font-size: 0.82rem; color: hsl(var(--muted-foreground)); }
.ks-import-dialog__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: transparent;
    border: 0;
    padding: 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    color: hsl(var(--muted-foreground));
}
.ks-import-dialog__close:hover { background: hsl(var(--muted)); color: hsl(var(--foreground)); }
.ks-import-dialog__body {
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.ks-import-dialog__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid hsl(var(--border));
    background: hsl(var(--muted) / 0.25);
}

.ks-stepper {
    display: flex;
    list-style: none;
    padding: 0.6rem 1.25rem;
    margin: 0;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--muted) / 0.15);
}

/* ---------------- Drawer: source detail ---------------- */
.ks-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(840px, 100vw);
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    border-left: 1px solid hsl(var(--border));
    box-shadow: -16px 0 48px -8px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    z-index: 60;
    animation: ks-drawer-slide 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes ks-drawer-slide {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
.ks-drawer__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1.1rem 1.25rem 0.75rem;
    border-bottom: 1px solid hsl(var(--border));
}
.ks-drawer__header h2 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.ks-drawer__subtitle { margin: 0.2rem 0 0; font-size: 0.85rem; color: hsl(var(--muted-foreground)); }
.ks-drawer__close {
    background: transparent; border: 0; padding: 0.4rem; border-radius: 6px; cursor: pointer;
    color: hsl(var(--muted-foreground));
}
.ks-drawer__close:hover { background: hsl(var(--muted)); color: hsl(var(--foreground)); }
.ks-drawer__tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 1.25rem 0;
    border-bottom: 1px solid hsl(var(--border));
}
.ks-drawer__tab {
    background: transparent;
    border: 0;
    padding: 0.6rem 0.9rem;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    font-size: 0.85rem;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
}
.ks-drawer__tab.is-active {
    color: hsl(var(--foreground));
    border-bottom-color: hsl(var(--primary));
    font-weight: 600;
}
.ks-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem 1.5rem;
}
.ks-drawer__panel { animation: ks-fade 0.18s ease-out; }
.ks-drawer__panel[hidden] { display: none; }
@keyframes ks-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- Field error highlight (shared) ---------------- */
.ds-field-error {
    box-shadow: 0 0 0 2px hsl(var(--destructive)) !important;
    transition: box-shadow 0.18s ease;
}