/* ============================================
   Coffee RAG - Technical Showcase
   ============================================ */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #222636;
    --bg-input: #2a2e3f;
    --border: #2e3348;
    --text-primary: #f5f6fa;
    --text-secondary: #cdd1e0;
    --text-muted: #a0a4b8;
    --accent: #6c8cff;
    --green: #4ade80;
    --yellow: #facc15;
    --red: #f87171;
    --purple: #a78bfa;
    --coffee: #c4956a;
    --coffee-light: #d4a574;
    --coffee-bg: rgba(196, 149, 106, 0.08);
    --coffee-border: rgba(196, 149, 106, 0.2);
    --radius: 8px;
    --header-height: 52px;
    --tabs-height: 44px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg-primary); color: var(--text-primary); line-height: 1.6; }

/* ---------- Header ---------- */
.header {
    background: rgba(15, 17, 23, 0.6);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--coffee-border);
    padding: 0 20px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header__back {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 6px;
    color: var(--text-secondary); text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.header__back:hover { background: var(--coffee-bg); color: var(--text-primary); }
.header__back svg { width: 20px; height: 20px; }

.header__brand { display: flex; align-items: center; gap: 8px; }
.header__icon { font-size: 1.2rem; }
.header__title { font-size: 1.1rem; font-weight: 600; color: var(--coffee-light); }

.header__badge {
    margin-left: auto;
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--coffee); background: var(--coffee-bg);
    border: 1px solid var(--coffee-border);
    padding: 3px 10px; border-radius: 4px;
}

/* ---------- Tab Bar ---------- */
.tabs {
    position: sticky;
    top: var(--header-height);
    z-index: 90;
    background: rgba(15, 17, 23, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(46, 51, 72, 0.5);
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 6px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar { display: none; }

.tabs__btn {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 16px; border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit; font-size: 0.78rem; font-weight: 500;
    cursor: pointer; white-space: nowrap;
    transition: all 0.15s;
}

.tabs__btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.tabs__btn:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
}

.tabs__btn--active {
    color: var(--coffee-light);
    background: var(--coffee-bg);
    border-color: var(--coffee-border);
}

/* ---------- Tab Panels ---------- */
.tab-panel {
    display: none;
}

.tab-panel--active {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: tabFade 0.2s ease;
}

@keyframes tabFade {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Main ---------- */
.main {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 20px 64px;
}

/* ---------- Section Titles ---------- */
.arch__title,
.pipeline-detail__title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* ---------- Architecture Diagram ---------- */
.arch {
    background: rgba(26, 29, 39, 0.4);
    border: 1px solid rgba(46, 51, 72, 0.5);
    border-radius: 10px;
    padding: 16px 20px;
}

.arch__diagram {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.arch__node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(15, 17, 23, 0.5);
    min-width: 90px;
}

.arch__node-icon { color: var(--text-muted); }
.arch__node-icon svg { width: 20px; height: 20px; }

.arch__node--client .arch__node-icon { color: var(--text-secondary); }
.arch__node--gateway .arch__node-icon { color: var(--accent); }
.arch__node--gateway { border-color: rgba(108, 140, 255, 0.25); }
.arch__node--rag .arch__node-icon { color: var(--coffee); }
.arch__node--rag { border-color: var(--coffee-border); }

.arch__node-label { font-size: 0.78rem; font-weight: 600; color: var(--text-primary); }
.arch__node-detail { font-size: 0.62rem; color: var(--text-muted); }

.arch__arrow { color: var(--text-muted); padding: 0 4px; flex-shrink: 0; }
.arch__arrow svg { width: 40px; height: 12px; }

.arch__hub {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.arch__connectors {
    color: var(--text-muted);
    width: 100%;
    max-width: 280px;
    height: 28px;
    margin: 4px 0;
}

.arch__connectors svg { width: 100%; height: 100%; }

.arch__backend-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.arch__node--sm {
    padding: 6px 12px;
    min-width: 0;
}

.arch__node--sm .arch__node-label { font-size: 0.72rem; }
.arch__node--sm .arch__node-detail { font-size: 0.58rem; }

.arch__node--mongo { border-color: rgba(74, 222, 128, 0.25); }
.arch__node--mongo .arch__node-label { color: var(--green); }
.arch__node--llm { border-color: rgba(108, 140, 255, 0.25); }
.arch__node--llm .arch__node-label { color: var(--accent); }
.arch__node--reranker { border-color: rgba(167, 139, 250, 0.25); }
.arch__node--reranker .arch__node-label { color: var(--purple); }

/* ---------- Pipeline Detail ---------- */
.pipeline-detail {
    background: rgba(26, 29, 39, 0.4);
    border: 1px solid rgba(46, 51, 72, 0.5);
    border-radius: 10px;
    padding: 16px 20px;
}

.pipeline-detail__steps {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pstep {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(46, 51, 72, 0.3);
}

.pstep:last-child { border-bottom: none; }

.pstep__num {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--coffee-bg);
    border: 1px solid var(--coffee-border);
    color: var(--coffee);
    font-size: 0.72rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.pstep__body { flex: 1; min-width: 0; }

.pstep__name {
    font-size: 0.85rem; font-weight: 600;
    color: var(--text-primary);
}

.pstep__model {
    font-size: 0.7rem; font-weight: 500;
    color: var(--coffee);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    margin-top: 1px;
}

.pstep__desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.pstep__time {
    font-size: 0.7rem; font-weight: 600;
    color: var(--text-muted);
    background: rgba(46, 51, 72, 0.4);
    padding: 2px 8px; border-radius: 4px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ---------- Pipeline Visualizer ---------- */
.pipeline-viz {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 8px 0 16px;
}

.pipeline-viz__step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
}

.pipeline-viz__step span {
    font-size: 0.68rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.3px;
    color: var(--text-muted);
    transition: color 0.3s;
}

.pipeline-viz__dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.3s;
}

.pipeline-viz__step--active .pipeline-viz__dot {
    background: var(--coffee);
    box-shadow: 0 0 8px rgba(196, 149, 106, 0.5);
    animation: pulsePipe 1s ease-in-out infinite;
}
.pipeline-viz__step--active span { color: var(--coffee-light); }

.pipeline-viz__step--done .pipeline-viz__dot {
    background: var(--green);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.3);
}
.pipeline-viz__step--done span { color: var(--green); }

@keyframes pulsePipe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.pipeline-viz__arrow {
    width: 28px; height: 2px;
    background: var(--border);
    position: relative;
    flex-shrink: 0;
}
.pipeline-viz__arrow::after {
    content: ''; position: absolute;
    right: 0; top: -3px;
    border: 4px solid transparent;
    border-left: 5px solid var(--border);
}

/* ---------- Search ---------- */
.search__form { display: flex; gap: 8px; }

.search__input {
    flex: 1; padding: 12px 16px;
    border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg-input); color: var(--text-primary);
    font-family: inherit; font-size: 0.92rem;
    outline: none; transition: border-color 0.2s;
}
.search__input:focus { border-color: var(--coffee); }
.search__input::placeholder { color: var(--text-muted); }

.search__btn {
    width: 44px; height: 44px;
    border-radius: 8px; border: 1px solid var(--coffee-border);
    background: var(--coffee-bg); color: var(--coffee);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s; flex-shrink: 0;
}
.search__btn:hover { background: rgba(196, 149, 106, 0.15); border-color: var(--coffee); }
.search__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.search__btn svg { width: 18px; height: 18px; }

.search__examples {
    display: flex; align-items: center; gap: 6px;
    flex-wrap: wrap; margin-top: 10px;
}
.search__examples-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }

.search__example {
    padding: 4px 10px; border-radius: 14px;
    border: 1px solid var(--border); background: transparent;
    color: var(--text-muted); font-family: inherit;
    font-size: 0.72rem; cursor: pointer;
    transition: all 0.15s; white-space: nowrap;
}
.search__example:hover {
    border-color: var(--coffee-border); color: var(--coffee-light);
    background: var(--coffee-bg);
}

/* ---------- Loading ---------- */
.loading {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; padding: 40px 0;
}
.loading__spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border); border-top-color: var(--coffee);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading__text { font-size: 0.82rem; color: var(--text-muted); }

/* ---------- Timing Bar ---------- */
.timing {
    display: flex; gap: 2px; height: 28px;
    border-radius: 6px; overflow: hidden; margin-bottom: 10px;
}
.timing__segment {
    display: flex; align-items: center; justify-content: center;
    gap: 4px; padding: 0 6px; min-width: 0; overflow: hidden;
    transition: flex 0.4s ease;
}
.timing__segment--embed { background: rgba(108, 140, 255, 0.15); }
.timing__segment--retrieve { background: rgba(74, 222, 128, 0.15); }
.timing__segment--rerank { background: rgba(167, 139, 250, 0.15); }
.timing__segment--generate { background: rgba(196, 149, 106, 0.15); }

.timing__label {
    font-size: 0.58rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.3px;
    white-space: nowrap; overflow: hidden;
}
.timing__segment--embed .timing__label { color: var(--accent); }
.timing__segment--retrieve .timing__label { color: var(--green); }
.timing__segment--rerank .timing__label { color: var(--purple); }
.timing__segment--generate .timing__label { color: var(--coffee); }

.timing__value {
    font-size: 0.58rem; font-weight: 500;
    color: var(--text-muted); white-space: nowrap;
}

/* ---------- Retrieval Info ---------- */
.retrieval-info {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; padding: 8px 0;
    font-size: 0.75rem; color: var(--text-muted);
}

.retrieval-info__stage {
    display: inline-flex; align-items: center; gap: 6px;
}

.retrieval-info__label {
    font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.3px;
    color: var(--coffee); background: var(--coffee-bg);
    border: 1px solid var(--coffee-border);
    padding: 1px 6px; border-radius: 3px;
}

.retrieval-info__arrow { color: var(--text-muted); font-size: 0.85rem; }

.retrieval-info strong { color: var(--text-primary); font-weight: 600; }

/* ---------- Results ---------- */
.results { display: flex; flex-direction: column; gap: 12px; }

.answer {
    background: rgba(26, 29, 39, 0.6);
    border: 1px solid var(--coffee-border);
    border-radius: 10px; overflow: hidden;
}
.answer__header {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; background: var(--coffee-bg);
    border-bottom: 1px solid var(--coffee-border);
    font-size: 0.78rem; font-weight: 600; color: var(--coffee-light);
}
.answer__header svg { width: 16px; height: 16px; }
.answer__meta {
    margin-left: auto; font-size: 0.65rem;
    font-weight: 400; color: var(--text-muted);
}
.answer__body {
    padding: 14px 16px; font-size: 0.88rem;
    color: var(--text-secondary); line-height: 1.7; white-space: pre-wrap;
}
.answer__error { color: var(--red); }

.sources {
    background: rgba(26, 29, 39, 0.4);
    border: 1px solid rgba(46, 51, 72, 0.5);
    border-radius: 10px; overflow: hidden;
}
.sources__header {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; border-bottom: 1px solid rgba(46, 51, 72, 0.5);
    font-size: 0.78rem; font-weight: 600; color: var(--text-muted);
}
.sources__header svg { width: 16px; height: 16px; }
.sources__count {
    margin-left: auto; font-size: 0.65rem;
    font-weight: 400; color: var(--text-muted);
}
.sources__list { display: flex; flex-direction: column; }

.source {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(46, 51, 72, 0.3);
}
.source:last-child { border-bottom: none; }

.source__head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.source__rank {
    font-size: 0.65rem; font-weight: 700;
    color: var(--text-muted); background: rgba(46, 51, 72, 0.5);
    padding: 1px 6px; border-radius: 4px;
}
.source__title { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }
.source__score {
    margin-left: auto; font-size: 0.65rem; font-weight: 700;
    padding: 2px 8px; border-radius: 4px;
}
.source__score--high { color: var(--green); background: rgba(74, 222, 128, 0.1); }
.source__score--mid { color: var(--yellow); background: rgba(250, 204, 21, 0.1); }
.source__score--low { color: var(--text-muted); background: rgba(46, 51, 72, 0.5); }

.source__text {
    font-size: 0.75rem; color: var(--text-muted); line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 3;
    -webkit-box-orient: vertical; overflow: hidden;
}
.source__url {
    display: inline-block; margin-top: 3px;
    font-size: 0.65rem; color: var(--accent);
    text-decoration: none; opacity: 0.7;
}
.source__url:hover { opacity: 1; }
.source-empty { padding: 16px; font-size: 0.82rem; color: var(--text-muted); text-align: center; }

/* ---------- Evaluation & Monitoring ---------- */

/* Aggregate scores bar */
.eval__scores {
    display: flex;
    gap: 8px;
}

.eval__score {
    flex: 1;
    background: rgba(26, 29, 39, 0.4);
    border: 1px solid rgba(46, 51, 72, 0.5);
    border-radius: 8px;
    padding: 12px 10px;
    text-align: center;
}

.eval__score-val {
    font-size: 1.2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.eval__score-val--green { color: var(--green); }
.eval__score-val--yellow { color: var(--yellow); }

.eval__score-name {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Section containers */
.eval__section {
    background: rgba(26, 29, 39, 0.4);
    border: 1px solid rgba(46, 51, 72, 0.5);
    border-radius: 10px;
    padding: 16px;
}

.eval__section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.eval__section-note {
    font-weight: 400;
    font-size: 0.65rem;
    text-transform: none;
    letter-spacing: 0;
}

/* Methodology cards */
.eval__method {
    padding: 12px 0;
    border-bottom: 1px solid rgba(46, 51, 72, 0.3);
}

.eval__method:last-child { border-bottom: none; }

.eval__method-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.eval__method-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.eval__method-result {
    font-size: 0.82rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    padding: 2px 10px;
    border-radius: 4px;
}

.eval__method-result--green {
    color: var(--green);
    background: rgba(74, 222, 128, 0.1);
}

.eval__method-result--yellow {
    color: var(--yellow);
    background: rgba(250, 204, 21, 0.1);
}

.eval__method-formula {
    font-size: 0.72rem;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: var(--coffee);
    background: rgba(15, 17, 23, 0.4);
    padding: 5px 10px;
    border-radius: 4px;
    margin-bottom: 6px;
    overflow-x: auto;
}

.eval__method-explain {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 4px;
}

.eval__method-why {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
    padding-left: 10px;
    border-left: 2px solid var(--coffee-border);
}

.eval__method-why strong {
    color: var(--text-primary);
}

/* Test suite table */
.eval__table-wrap {
    overflow-x: auto;
    margin-bottom: 8px;
}

.eval__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    min-width: 680px;
}

.eval__table th {
    padding: 8px 10px;
    text-align: left;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    background: rgba(15, 17, 23, 0.3);
    border-bottom: 1px solid rgba(46, 51, 72, 0.4);
    white-space: nowrap;
}

.eval__table td {
    padding: 7px 10px;
    border-bottom: 1px solid rgba(46, 51, 72, 0.2);
    color: var(--text-secondary);
    vertical-align: middle;
}

.eval__table tbody tr:hover td {
    background: rgba(108, 140, 255, 0.03);
}

.eval__table td:first-child {
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    font-size: 0.68rem;
    width: 30px;
}

.eval__table code {
    font-size: 0.65rem;
    background: rgba(46, 51, 72, 0.4);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--coffee-light);
    white-space: nowrap;
}

.eval__hit {
    color: var(--green);
    font-weight: 700;
    text-align: center;
    font-size: 0.85rem;
}

/* Category badges */
.eval__cat {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 3px;
    font-size: 0.62rem;
    font-weight: 600;
    white-space: nowrap;
}

.eval__cat--origins {
    color: var(--accent);
    background: rgba(108, 140, 255, 0.1);
}

.eval__cat--prep {
    color: var(--green);
    background: rgba(74, 222, 128, 0.1);
}

.eval__cat--comp {
    color: var(--purple);
    background: rgba(167, 139, 250, 0.1);
}

.eval__cat--var {
    color: var(--coffee);
    background: var(--coffee-bg);
}

.eval__table-note {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.eval__table-note code {
    font-size: 0.65rem;
    background: rgba(46, 51, 72, 0.4);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--coffee-light);
}

/* Prometheus */
.eval__card-note--live {
    color: var(--green);
}
.eval__card-note--live::before {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--green);
    margin-right: 4px;
    animation: pulseLive 2s ease-in-out infinite;
}
@keyframes pulseLive {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.eval__prom-card {
    background: rgba(15, 17, 23, 0.3);
    border: 1px solid rgba(46, 51, 72, 0.3);
    border-radius: 8px;
    padding: 6px 0;
}

.prom-row {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 5px 14px;
}
.prom-row--divider {
    height: 1px; background: rgba(46, 51, 72, 0.3);
    margin: 3px 14px; padding: 0;
}
.prom-row__name { font-size: 0.72rem; color: var(--text-muted); }
.prom-row__val {
    font-size: 0.75rem; font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ---------- Knowledge Base ---------- */
.kb {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kb__summary {
    background: rgba(26, 29, 39, 0.4);
    border: 1px solid rgba(46, 51, 72, 0.5);
    border-radius: 10px;
    overflow: hidden;
}

.kb__summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(46, 51, 72, 0.2);
}

.kb__summary-row:last-child { border-bottom: none; }

.kb__summary-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.kb__summary-val {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Chunk strategy detail */
.kb__chunk-strategy {
    background: rgba(26, 29, 39, 0.4);
    border: 1px solid rgba(46, 51, 72, 0.5);
    border-radius: 10px;
    padding: 16px 18px;
}

.kb__chunk-strategy-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--coffee);
    margin-bottom: 8px;
}

.kb__chunk-strategy-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 14px;
}

.kb__chunk-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.kb__chunk-step {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.kb__chunk-step-num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--coffee-bg);
    border: 1px solid var(--coffee-border);
    color: var(--coffee);
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.kb__chunk-step-body {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.kb__chunk-step-body strong {
    color: var(--text-primary);
}

.kb__chunk-step-body code {
    background: rgba(196, 149, 106, 0.1);
    border: 1px solid rgba(196, 149, 106, 0.15);
    color: var(--coffee-light);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.75rem;
}

.kb__chunk-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
    border-top: 1px solid rgba(46, 51, 72, 0.3);
    padding-top: 10px;
}

.kb__docs-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}

.kb__docs-count {
    font-weight: 400;
    font-size: 0.65rem;
    text-transform: none;
    letter-spacing: 0;
}

.kb__docs {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Document cards */
.kb-doc {
    background: rgba(26, 29, 39, 0.4);
    border: 1px solid rgba(46, 51, 72, 0.5);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.15s;
}

.kb-doc:hover {
    border-color: rgba(46, 51, 72, 0.8);
}

.kb-doc--open {
    border-color: var(--coffee-border);
}

.kb-doc__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.kb-doc__head:hover {
    background: rgba(255, 255, 255, 0.02);
}

.kb-doc__title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.kb-doc__chunks {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
    background: rgba(46, 51, 72, 0.4);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.kb-doc__toggle {
    color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
    display: flex;
}

.kb-doc__toggle svg {
    width: 16px;
    height: 16px;
}

.kb-doc--open .kb-doc__toggle {
    transform: rotate(180deg);
}

.kb-doc__body {
    display: none;
    border-top: 1px solid rgba(46, 51, 72, 0.3);
    padding: 12px 14px;
}

.kb-doc--open .kb-doc__body {
    display: block;
    animation: tabFade 0.2s ease;
}

.kb-doc__loading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 8px 0;
}

.kb-doc__unavailable {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 4px 0;
}

.kb-doc__unavailable code {
    font-size: 0.7rem;
    background: rgba(46, 51, 72, 0.5);
    padding: 1px 6px;
    border-radius: 3px;
    color: var(--coffee);
}

.kb-doc__url {
    display: inline-block;
    font-size: 0.68rem;
    color: var(--accent);
    text-decoration: none;
    opacity: 0.7;
    margin-bottom: 10px;
}
.kb-doc__url:hover { opacity: 1; }

.kb-doc__chunks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Individual chunks */
.kb-chunk {
    background: rgba(15, 17, 23, 0.4);
    border: 1px solid rgba(46, 51, 72, 0.3);
    border-radius: 6px;
    overflow: hidden;
}

.kb-chunk__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
    background: rgba(46, 51, 72, 0.2);
    border-bottom: 1px solid rgba(46, 51, 72, 0.2);
}

.kb-chunk__idx {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--coffee);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.kb-chunk__dim {
    font-size: 0.6rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.kb-chunk__text {
    padding: 8px 10px;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.6;
    max-height: 120px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
    .main { padding: 12px 12px 48px; }

    .tabs { justify-content: flex-start; padding: 6px 12px; }
    .tabs__btn { padding: 6px 12px; font-size: 0.72rem; }
    .tabs__btn span { display: none; }
    .tabs__btn svg { width: 16px; height: 16px; }

    .arch__diagram { flex-direction: column; }
    .arch__arrow svg { transform: rotate(90deg); }
    .arch__backend-row { flex-direction: column; align-items: center; }

    .pipeline-viz__step { padding: 0 6px; }
    .pipeline-viz__step span { font-size: 0.6rem; }
    .pipeline-viz__arrow { width: 16px; }

    .eval__scores { flex-wrap: wrap; }
    .eval__score { min-width: calc(50% - 4px); }

    .timing__label { display: none; }
    .retrieval-info { flex-direction: column; gap: 4px; }

    .search__examples { gap: 4px; }
    .search__example { font-size: 0.68rem; padding: 3px 8px; }
}
