/* ── Card & Header ─────────────────────────────────────────────── */
.wf-card { background:#fff; border-radius:.75rem; box-shadow:0 1px 3px rgba(0,0,0,.1); border:1px solid rgba(0,0,0,.05); overflow:hidden; }
.dark .wf-card { background:rgb(17 24 39); border-color:rgba(255,255,255,.1); }
.wf-header { padding:1.25rem; }
.wf-title { font-size:1.05rem; font-weight:600; font-family:ui-monospace,SFMono-Regular,monospace; color:#111827; }
.dark .wf-title { color:#f9fafb; }
.wf-meta { display:flex; align-items:center; gap:8px; margin-top:8px; flex-wrap:wrap; }
.wf-stats { display:flex; align-items:center; gap:12px; margin-top:12px; padding-top:12px; border-top:1px solid rgba(0,0,0,.06); flex-wrap:wrap; }
.dark .wf-stats { border-top-color:rgba(255,255,255,.06); }
.wf-stat { display:inline-flex; align-items:center; gap:4px; font-size:11px; color:#6b7280; }
.wf-stat-dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
.wf-header-row { display:flex; justify-content:space-between; align-items:flex-start; }
.wf-header-left { min-width:0; }
.wf-header-right { font-family:ui-monospace,SFMono-Regular,monospace; font-size:10px; color:#9ca3af; flex-shrink:0; margin-left:16px; }
.wf-time { font-size:12px; color:#6b7280; }
.wf-ip { font-size:11px; font-family:ui-monospace,SFMono-Regular,monospace; color:#9ca3af; }

/* ── Badges ────────────────────────────────────────────────────── */
.wf-badge { display:inline-flex; align-items:center; padding:2px 7px; border-radius:4px; font-size:10px; font-weight:600; line-height:1.5; white-space:nowrap; }
.wf-badge-ok   { background:#dcfce7; color:#166534; }
.wf-badge-err  { background:#fee2e2; color:#991b1b; }
.wf-badge-2xx  { background:#dcfce7; color:#166534; }
.wf-badge-3xx  { background:#fef9c3; color:#854d0e; }
.wf-badge-4xx  { background:#fee2e2; color:#991b1b; }
.wf-badge-5xx  { background:#fee2e2; color:#991b1b; }
.wf-badge-gray { background:#f3f4f6; color:#4b5563; }
.wf-badge-blue { background:#dbeafe; color:#1e40af; }

/* Duration headline */
.wf-dur-fast { font-family:ui-monospace,SFMono-Regular,monospace; font-size:13px; font-weight:600; color:#16a34a; }
.wf-dur-med  { font-family:ui-monospace,SFMono-Regular,monospace; font-size:13px; font-weight:600; color:#d97706; }
.wf-dur-slow { font-family:ui-monospace,SFMono-Regular,monospace; font-size:13px; font-weight:600; color:#dc2626; }

/* ── Column header row ──────────────────────────────────────────── */
.wf-cols {
    display:flex;
    align-items:center;
    padding:6px 12px;
    font-size:9px;
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:.07em;
    color:#9ca3af;
    border-bottom:1px solid rgba(0,0,0,.07);
    background:#f9fafb;
    position:sticky;
    top:0;
    z-index:2;
}
.dark .wf-cols { border-bottom-color:rgba(255,255,255,.07); background:rgba(255,255,255,.02); }

/* ── Column widths ──────────────────────────────────────────────── */
/* # | span name (left) | timing | timeline bar (right) */
.wf-col-seq    { width:30px; flex-shrink:0; text-align:right; padding-right:8px; }
.wf-cols-left  { width:32%; flex-shrink:0; }
.wf-col-timing { width:88px; flex-shrink:0; display:flex; flex-direction:column; align-items:flex-end; padding-right:12px; gap:1px; }
.wf-cols-right { flex:1; display:flex; justify-content:space-between; font-size:9px; }

/* ── Rows ───────────────────────────────────────────────────────── */
.wf-row { border-bottom:1px solid rgba(0,0,0,.04); transition:background .1s; }
.wf-row:last-child { border-bottom:none; }
.wf-row:hover { background:rgba(0,0,0,.015); }
.dark .wf-row { border-bottom-color:rgba(255,255,255,.04); }
.dark .wf-row:hover { background:rgba(255,255,255,.03); }
.wf-row-root { background:rgba(59,130,246,.03); }
.dark .wf-row-root { background:rgba(59,130,246,.05); }

.wf-row-inner { display:flex; align-items:center; padding:5px 12px; min-height:34px; cursor:pointer; }

.wf-row-left {
    width:32%;
    flex-shrink:0;
    display:flex;
    align-items:center;
    gap:5px;
    min-width:0;
    padding-right:8px;
}

/* Sequence number column */
.wf-seq-num {
    width:30px;
    flex-shrink:0;
    font-size:10px;
    font-family:ui-monospace,SFMono-Regular,monospace;
    color:#d1d5db;
    text-align:right;
    padding-right:8px;
    user-select:none;
}
.dark .wf-seq-num { color:#4b5563; }

/* Timing column in rows */
.wf-col-timing {
    width:88px;
    flex-shrink:0;
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    padding-right:12px;
    gap:1px;
}
.wf-dur-val {
    font-size:10px;
    font-family:ui-monospace,SFMono-Regular,monospace;
    color:#374151;
    font-weight:600;
    white-space:nowrap;
}
.dark .wf-dur-val { color:#d1d5db; }
.wf-offset-val {
    font-size:9px;
    font-family:ui-monospace,SFMono-Regular,monospace;
    color:#9ca3af;
    white-space:nowrap;
}
.wf-offset-zero { color:#d1d5db; }
.dark .wf-offset-zero { color:#4b5563; }

/* Expand arrow */
.wf-expand { width:11px; height:11px; flex-shrink:0; color:#d1d5db; transition:transform .15s; margin-right:1px; }
.wf-row:hover .wf-expand { color:#9ca3af; }

/* Type badge */
.wf-type {
    display:inline-flex;
    padding:1px 5px;
    border-radius:3px;
    font-size:8px;
    font-weight:700;
    flex-shrink:0;
    color:#fff;
    line-height:1.6;
    letter-spacing:.02em;
    text-transform:uppercase;
}

/* Span name */
.wf-name {
    font-size:11px;
    font-family:ui-monospace,SFMono-Regular,monospace;
    color:#374151;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
.dark .wf-name { color:#d1d5db; }
.wf-name.error { color:#dc2626; }
.dark .wf-name.error { color:#f87171; }

/* ── Timeline bar area ──────────────────────────────────────────── */
.wf-row-right { flex:1; position:relative; height:20px; }

/* Grid lines */
.wf-grid { position:absolute; inset:0; display:flex; pointer-events:none; }
.wf-grid > div { width:25%; border-right:1px dashed rgba(0,0,0,.06); }
.dark .wf-grid > div { border-right-color:rgba(255,255,255,.06); }
.wf-grid > div:last-child { border-right:none; }

/* Bar */
.wf-bar {
    position:absolute;
    top:4px;
    height:12px;
    border-radius:3px;
    opacity:.85;
    min-width:4px;
    transition:opacity .1s;
    display:flex;
    align-items:center;
    overflow:hidden;
}
.wf-row:hover .wf-bar { opacity:1; }
.wf-bar-root {
    top:3px;
    height:14px;
    border-radius:3px;
    opacity:.55;
}
.wf-row-root:hover .wf-bar-root { opacity:.75; }

/* Inline label inside bar (only when wide enough) */
.wf-bar-label {
    font-size:8px;
    font-weight:600;
    color:rgba(255,255,255,.95);
    padding:0 4px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    line-height:1;
}

/* ── Detail panel ───────────────────────────────────────────────── */
.wf-detail { padding:0 12px 12px; }
.wf-detail-inner {
    border-radius:8px;
    border:1px solid rgba(0,0,0,.08);
    padding:12px 16px;
    font-size:11px;
    background:#fafafa;
}
.dark .wf-detail-inner { border-color:rgba(255,255,255,.08); background:rgba(0,0,0,.2); }
.wf-detail-meta { display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin-bottom:10px; padding-bottom:10px; border-bottom:1px solid rgba(0,0,0,.06); }
.dark .wf-detail-meta { border-bottom-color:rgba(255,255,255,.06); }
.wf-detail-label { font-size:10px; font-weight:600; text-transform:uppercase; color:#9ca3af; margin-bottom:2px; }
.wf-detail-val { font-family:ui-monospace,SFMono-Regular,monospace; font-size:11px; color:#374151; word-break:break-all; }
.dark .wf-detail-val { color:#d1d5db; }
.wf-detail-pre {
    background:rgba(0,0,0,.04);
    border-radius:6px;
    padding:8px 10px;
    font-family:ui-monospace,SFMono-Regular,monospace;
    font-size:10px;
    color:#374151;
    white-space:pre-wrap;
    word-break:break-all;
    max-height:260px;
    overflow-y:auto;
    margin-top:4px;
}
.dark .wf-detail-pre { background:rgba(0,0,0,.3); color:#d1d5db; }
.wf-error-box { margin-top:8px; padding:10px; border-radius:6px; background:#fef2f2; border:1px solid #fecaca; }
.dark .wf-error-box { background:rgba(220,38,38,.1); border-color:rgba(220,38,38,.3); }
.wf-error-box pre { font-family:ui-monospace,SFMono-Regular,monospace; font-size:11px; color:#b91c1c; white-space:pre-wrap; word-break:break-all; margin:0; }
.dark .wf-error-box pre { color:#fca5a5; }
.wf-section { margin-top:8px; }
.wf-section summary { font-size:10px; font-weight:600; text-transform:uppercase; color:#9ca3af; cursor:pointer; user-select:none; outline:none; }
.wf-section summary:hover { color:#6b7280; }
.wf-detail-foot { margin-top:8px; padding-top:8px; border-top:1px solid rgba(0,0,0,.06); display:flex; gap:12px; font-family:ui-monospace,SFMono-Regular,monospace; font-size:10px; color:#9ca3af; }
.wf-detail-foot span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.wf-mb { margin-bottom:6px; }
.wf-label { color:#9ca3af; font-size:11px; }
.wf-dur { font-size:10px; font-family:ui-monospace,SFMono-Regular,monospace; color:#9ca3af; }

.wf-empty { padding:48px 16px; text-align:center; color:#9ca3af; }

/* ── App panel: account chip in sidebar footer ──────────────────── */
.lc-account-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin: 8px 12px 4px;
    border-radius: 8px;
    background: rgba(59,130,246,.07);
    border: 1px solid rgba(59,130,246,.15);
}
.dark .lc-account-chip {
    background: rgba(59,130,246,.1);
    border-color: rgba(59,130,246,.2);
}
.lc-account-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    user-select: none;
}
.lc-account-detail { flex: 1; min-width: 0; }
.lc-account-name {
    font-size: 12px;
    font-weight: 600;
    color: #1d4ed8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.dark .lc-account-name { color: #93c5fd; }
.lc-account-id {
    font-size: 10px;
    color: #9ca3af;
    font-family: ui-monospace, SFMono-Regular, monospace;
    line-height: 1.3;
}

/* Back-to-admin icon button (blue hover, not red) */
.lc-back-btn:hover { background: rgba(59,130,246,.1) !important; color: #2563eb !important; }
.dark .lc-back-btn:hover { background: rgba(59,130,246,.2) !important; color: #60a5fa !important; }

/* ── Admin panel chrome tweaks ──────────────────────────────────── */
/* Hide topbar entirely — profile moved to sidebar footer */
.fi-topbar { display: none !important; }
/* Remove sidebar header (brand name area) */
.fi-sidebar-header { display: none !important; }
/* Reclaim topbar height from main content */
.fi-main-ctn { padding-top: 0 !important; }
.fi-sidebar-nav { padding-top: 8px !important; }

/* ── Sidebar profile footer ─────────────────────────────────────── */
.lc-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 8px 12px 12px;
    border-radius: 10px;
    background: rgba(0,0,0,.04);
    transition: background .15s;
    cursor: default;
}
.dark .lc-profile { background: rgba(255,255,255,.06); }
.lc-profile:hover { background: rgba(0,0,0,.08); }
.dark .lc-profile:hover { background: rgba(255,255,255,.1); }

.lc-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f59e0b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    user-select: none;
}

.lc-profile-info {
    flex: 1;
    min-width: 0;
}
.lc-profile-name {
    font-size: 12px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.dark .lc-profile-name { color: #f9fafb; }

.lc-profile-email {
    font-size: 10px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.dark .lc-profile-email { color: #6b7280; }

.lc-logout {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 5px;
    border-radius: 6px;
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.lc-logout:not(.lc-back-btn):hover { background: rgba(220,38,38,.1); color: #dc2626; }
.dark .lc-logout:not(.lc-back-btn):hover { background: rgba(220,38,38,.2); color: #f87171; }
.lc-logout svg { width: 16px; height: 16px; }

/* ── Account picker (admin dashboard) ──────────────────────────── */
.lc-picker-wrap { padding: 0; }

.lc-picker-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.lc-picker-count {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    white-space: nowrap;
}

.lc-picker-search {
    flex: 1;
    max-width: 340px;
    padding: 9px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    color: #111827;
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.lc-picker-search:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.dark .lc-picker-search {
    background: rgba(255,255,255,.05);
    border-color: rgba(255,255,255,.12);
    color: #f9fafb;
}
.dark .lc-picker-search:focus { border-color: #60a5fa; }

.lc-accounts-list {
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #fff;
}
.dark .lc-accounts-list {
    border-color: rgba(255,255,255,.08);
    background: rgba(255,255,255,.03);
}

.lc-account-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    text-decoration: none;
    border-bottom: 1px solid #f3f4f6;
    transition: background .1s;
}
.dark .lc-account-row { border-bottom-color: rgba(255,255,255,.04); }
.lc-account-row:last-child { border-bottom: none; }
.lc-account-row:hover { background: rgba(59,130,246,.04); }
.dark .lc-account-row:hover { background: rgba(59,130,246,.07); }

.lc-account-row-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    user-select: none;
}

.lc-account-row-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dark .lc-account-row-name { color: #f9fafb; }

.lc-account-row-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.lc-account-row-id {
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, monospace;
    color: #9ca3af;
}

.lc-account-row-tz {
    font-size: 11px;
    color: #9ca3af;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lc-account-row-arrow {
    width: 14px;
    height: 14px;
    color: #d1d5db;
    flex-shrink: 0;
    transition: color .1s;
}
.lc-account-row:hover .lc-account-row-arrow { color: #3b82f6; }

/* ── Hide record-actions column in trace tables ─────────────────── */
.lc-traces-tbl .fi-ta-actions-header-cell { display: none !important; }
.lc-traces-tbl td:has(> div.fi-ta-actions) { display: none !important; }

/* ── Full-page waterfall: reclaim header space ──────────────────── */
.fi-page-header { margin-bottom: 12px !important; }

/* ── Retrieval hits tables (sparse / dense / rrf / rerank) ──────── */
.wf-hits { margin-top: 8px; border:1px solid rgba(0,0,0,.08); border-radius:.5rem; background:rgba(0,0,0,.015); }
.dark .wf-hits { border-color:rgba(255,255,255,.08); background:rgba(255,255,255,.02); }
.wf-hits-summary { padding:6px 10px; font-weight:600; font-size:13px; cursor:pointer; user-select:none; }
.wf-hits-summary:hover { background:rgba(0,0,0,.03); }
.dark .wf-hits-summary:hover { background:rgba(255,255,255,.04); }
.wf-hits-empty { padding:8px 12px; color:#9ca3af; font-size:12px; }
.wf-hits-scroll { overflow-x:auto; padding:4px; }
.wf-hits-table { width:100%; border-collapse:collapse; font-size:12px; }
.wf-hits-table th, .wf-hits-table td { padding:5px 8px; text-align:left; vertical-align:top; border-bottom:1px solid rgba(0,0,0,.04); }
.dark .wf-hits-table th, .dark .wf-hits-table td { border-bottom-color:rgba(255,255,255,.04); }
.wf-hits-table th { font-weight:600; font-size:11px; color:#6b7280; text-transform:uppercase; letter-spacing:.04em; background:rgba(0,0,0,.02); }
.dark .wf-hits-table th { background:rgba(255,255,255,.03); color:#9ca3af; }
.wf-hits-table tr:hover td { background:rgba(0,0,0,.02); }
.dark .wf-hits-table tr:hover td { background:rgba(255,255,255,.03); }
.wf-hits-rank, .wf-hits-chunk { width:42px; text-align:center; font-variant-numeric:tabular-nums; }
.wf-hits-score { width:70px; text-align:right; font-variant-numeric:tabular-nums; font-family:ui-monospace,Menlo,Monaco,monospace; }
.wf-hits-id { width:140px; max-width:140px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.wf-mono { font-family:ui-monospace,Menlo,Monaco,monospace; font-size:11px; color:#6b7280; }
.dark .wf-mono { color:#9ca3af; }
.wf-hits-type { width:60px; }
.wf-hits-title-text { font-weight:500; }
.wf-hits-trail { font-size:11px; color:#6b7280; margin-top:2px; }
.dark .wf-hits-trail { color:#9ca3af; }
.wf-hits-preview-col { max-width:260px; }
.wf-hits-preview { font-size:11px; color:#4b5563; }
.dark .wf-hits-preview { color:#9ca3af; }
.wf-hits-preview summary { cursor:pointer; }
.wf-hits-preview-full { margin-top:4px; padding:6px 8px; background:rgba(0,0,0,.03); border-radius:.25rem; white-space:pre-wrap; font-family:ui-monospace,Menlo,Monaco,monospace; font-size:11px; line-height:1.4; }
.dark .wf-hits-preview-full { background:rgba(255,255,255,.04); }
.wf-hits-delta { width:60px; text-align:center; font-variant-numeric:tabular-nums; font-weight:600; color:#6b7280; }
.wf-hits-delta-up { color:#16a34a; }
.wf-hits-delta-down { color:#dc2626; }

/* Larger, scrollable expanded preview so long chunks stay readable */
.wf-hits-preview-full { max-height: 320px; overflow-y: auto; max-width: 80ch; }

/* ── Chunk preview modal ────────────────────────────────────────── */
.wf-chunk-modal { position:fixed; inset:0; z-index:99999; }
.wf-chunk-modal-backdrop { position:absolute; inset:0; background:rgba(0,0,0,.55); }
.wf-chunk-modal-panel {
    position:absolute; left:50%; top:50%; transform:translate(-50%,-50%);
    width:min(900px, 92vw); max-height:80vh;
    background:#fff; border-radius:.75rem; box-shadow:0 20px 60px rgba(0,0,0,.4);
    display:flex; flex-direction:column; overflow:hidden;
}
.dark .wf-chunk-modal-panel { background:rgb(17 24 39); color:#e5e7eb; }
.wf-chunk-modal-head {
    display:flex; align-items:center; justify-content:space-between;
    padding:10px 16px; border-bottom:1px solid rgba(0,0,0,.08);
}
.dark .wf-chunk-modal-head { border-bottom-color:rgba(255,255,255,.1); }
.wf-chunk-modal-title { font-weight:600; font-family:ui-monospace,Menlo,Monaco,monospace; font-size:13px; }
.wf-chunk-modal-close { font-size:24px; line-height:1; background:none; border:none; cursor:pointer; color:#6b7280; padding:0 4px; }
.wf-chunk-modal-close:hover { color:#111; }
.dark .wf-chunk-modal-close:hover { color:#fff; }
.wf-chunk-modal-body { padding:14px 16px; overflow-y:auto; flex:1; }
.wf-chunk-meta {
    display:flex; flex-wrap:wrap; gap:14px; font-size:12px; color:#4b5563;
    padding-bottom:10px; margin-bottom:10px;
    border-bottom:1px solid rgba(0,0,0,.06);
}
.dark .wf-chunk-meta { color:#9ca3af; border-bottom-color:rgba(255,255,255,.06); }
.wf-chunk-content {
    background:rgba(0,0,0,.03); border-radius:.5rem; padding:12px;
    font-size:12px; line-height:1.55; white-space:pre-wrap;
    font-family:ui-monospace,Menlo,Monaco,monospace; max-height:50vh; overflow-y:auto;
}
.dark .wf-chunk-content { background:rgba(255,255,255,.04); }
.wf-chunk-rawmeta { margin-top:10px; font-size:11px; color:#6b7280; }
.wf-chunk-rawmeta pre { background:rgba(0,0,0,.03); padding:8px; border-radius:.25rem; overflow:auto; }
.dark .wf-chunk-rawmeta pre { background:rgba(255,255,255,.04); }
.wf-chunk-modal-loading { padding:20px; color:#6b7280; text-align:center; }
.wf-chunk-modal-error { padding:14px; color:#dc2626; }

/* Make point-id cell clickable */
.wf-hits-pointlink {
    background:none; border:none; padding:0; cursor:pointer;
    color:#3b82f6; font-family:inherit; font-size:inherit; text-decoration:underline dotted;
}
.wf-hits-pointlink:hover { color:#1d4ed8; }
.dark .wf-hits-pointlink { color:#60a5fa; }
.dark .wf-hits-pointlink:hover { color:#93c5fd; }

/* ── Chat summary panel (shown above waterfall for /chat traces) ── */
.wf-chat-summary { display:flex; flex-direction:column; gap:10px; margin-bottom:14px; }
.wf-chat-card {
    background:#fff; border:1px solid rgba(0,0,0,.08); border-radius:.5rem; padding:10px 14px;
}
.dark .wf-chat-card { background:rgb(17 24 39); border-color:rgba(255,255,255,.08); }
.wf-chat-label {
    font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.04em;
    color:#6b7280; margin-bottom:6px; cursor:default;
}
details.wf-chat-card > summary.wf-chat-label { cursor:pointer; }
details.wf-chat-card > summary.wf-chat-label:hover { color:#3b82f6; }
.wf-chat-msg {
    font-size:13px; line-height:1.5; white-space:pre-wrap; word-break:break-word;
    padding:6px 0;
}
.wf-chat-msg.user { color:#1d4ed8; }
.dark .wf-chat-msg.user { color:#93c5fd; }
.wf-chat-msg.assistant { color:#111; }
.dark .wf-chat-msg.assistant { color:#e5e7eb; }
.wf-chat-meta {
    display:flex; flex-wrap:wrap; gap:14px; font-size:12px; color:#6b7280;
    padding-top:8px; margin-top:6px;
    border-top:1px dashed rgba(0,0,0,.06);
}
.dark .wf-chat-meta { color:#9ca3af; border-top-color:rgba(255,255,255,.06); }
.wf-chat-meta code { background:rgba(0,0,0,.05); padding:1px 5px; border-radius:.25rem; font-size:11px; }
.dark .wf-chat-meta code { background:rgba(255,255,255,.07); }
.wf-chat-warn { color:#b45309; }
.dark .wf-chat-warn { color:#fbbf24; }
.wf-chat-history { display:flex; flex-direction:column; gap:6px; padding-top:6px; }
.wf-chat-history .wf-chat-msg {
    background:rgba(0,0,0,.02); padding:6px 10px; border-radius:.25rem;
    border-left:2px solid rgba(0,0,0,.1);
}
.dark .wf-chat-history .wf-chat-msg {
    background:rgba(255,255,255,.03); border-left-color:rgba(255,255,255,.1);
}
.wf-chat-history .wf-chat-msg.user { border-left-color:#3b82f6; }
.wf-chat-history .wf-chat-msg.assistant { border-left-color:#10b981; }
.wf-chat-role {
    font-size:10px; font-weight:600; text-transform:uppercase; color:#6b7280;
    margin-right:8px;
}
.wf-chat-msg-text { white-space:pre-wrap; }
.wf-chat-context { list-style:none; padding:0; margin:6px 0 0 0; font-size:12px; }
.wf-chat-context li { padding:4px 0; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.wf-chat-idx { color:#6b7280; font-size:11px; font-family:ui-monospace,Menlo,Monaco,monospace; }
.wf-chat-ctx-title { color:#374151; }
.dark .wf-chat-ctx-title { color:#d1d5db; }
.wf-chat-actions {
    background:rgba(0,0,0,.03); padding:8px; border-radius:.25rem; font-size:11px;
    overflow:auto; max-height:300px; margin:6px 0 0 0;
}
.dark .wf-chat-actions { background:rgba(255,255,255,.04); }

/* ── Single Additional Data card (after spans) ──────────────────── */
.wf-additional { margin-top: 14px; }
.wf-additional-header {
    padding: 10px 16px;
    font-weight: 600; font-size: 13px;
    border-bottom: 1px solid rgba(0,0,0,.08);
    background: rgba(0,0,0,.02);
}
.dark .wf-additional-header { border-bottom-color: rgba(255,255,255,.08); background: rgba(255,255,255,.03); }
.wf-additional-body { padding: 0; }
.wf-additional-row {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0,0,0,.04);
}
.wf-additional-row:last-child { border-bottom: none; }
.dark .wf-additional-row { border-bottom-color: rgba(255,255,255,.04); }
.wf-additional-row > details > summary { cursor: pointer; }
.wf-additional-row > details > summary:hover { color: #3b82f6; }

/* Drop the standalone-card chrome since each row is now inside one outer card */
.wf-chat-summary, .wf-chat-card { all: unset; }
.wf-chat-summary { display: block; }

/* ─── RAG diagnostic panel additions ────────────────────────────── */
.wf-additional-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.wf-additional-title { flex-shrink: 0; }

.wf-rag-search {
    display: flex;
    align-items: center;
    gap: 8px;
}
.wf-rag-search-input {
    width: 280px;
    padding: 4px 10px;
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 6px;
    font-size: 12px;
    outline: none;
    background: #fff;
}
.wf-rag-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px rgba(59,130,246,.2);
}
.dark .wf-rag-search-input { background: rgb(39 39 42); border-color: rgba(255,255,255,.1); color: #e5e7eb; }
.wf-rag-match-count {
    font-size: 11px;
    color: #6b7280;
    font-family: ui-monospace, SFMono-Regular, monospace;
    min-width: 70px;
}
.wf-rag-match-none { color: #dc2626 !important; }

mark.wf-rag-hl {
    background: rgb(254 240 138);
    color: rgb(120 53 15);
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}
.dark mark.wf-rag-hl { background: rgba(250,204,21,.4); color: rgb(254 240 138); }

/* Query rewrite diff */
.wf-rewrite-diff {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px;
    background: rgba(59,130,246,.04);
    border-left: 2px solid #3b82f6;
    border-radius: 4px;
    font-size: 12px;
}
.dark .wf-rewrite-diff { background: rgba(59,130,246,.08); }
.wf-rewrite-line { display: flex; gap: 10px; align-items: baseline; }
.wf-rewrite-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #9ca3af;
    width: 60px;
    flex-shrink: 0;
    text-align: right;
}
.wf-rewrite-label-after { color: #3b82f6; }
.wf-rewrite-text { font-family: ui-monospace, SFMono-Regular, monospace; line-height: 1.5; }
.wf-rw-removed {
    background: rgba(239,68,68,.12);
    color: #b91c1c;
    text-decoration: line-through;
    padding: 0 2px;
    border-radius: 2px;
}
.wf-rw-added {
    background: rgba(34,197,94,.15);
    color: #15803d;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}
.dark .wf-rw-removed { background: rgba(239,68,68,.2); color: #fca5a5; }
.dark .wf-rw-added   { background: rgba(34,197,94,.2);  color: #86efac; }

/* System instruction */
.wf-chat-instruction {
    margin-top: 6px;
    padding: 10px 12px;
    background: rgba(0,0,0,.03);
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 11px;
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 280px;
    overflow-y: auto;
}
.dark .wf-chat-instruction { background: rgba(255,255,255,.03); }

/* Per-chunk body when available */
.wf-chunk-item { display: block; padding: 6px 0; border-bottom: 1px dashed rgba(0,0,0,.04); }
.wf-chunk-item:last-child { border-bottom: none; }
.dark .wf-chunk-item { border-bottom-color: rgba(255,255,255,.04); }
.wf-chunk-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wf-chunk-body {
    margin-top: 4px;
    padding: 6px 8px;
    background: rgba(0,0,0,.02);
    border-radius: 3px;
    font-size: 12px;
    line-height: 1.45;
    color: #374151;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}
.dark .wf-chunk-body { background: rgba(255,255,255,.02); color: #d1d5db; }
