/* === Reset & Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f0f2f5; color: #212529; line-height: 1.6; }

/* === Navbar === */
.navbar { background: #1a1a2e; color: white; padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 56px; position: sticky; top: 0; z-index: 100; }
.nav-left { display: flex; align-items: center; gap: 0.25rem; }
.nav-brand { color: white; text-decoration: none; font-weight: 800; font-size: 1.1rem; margin-right: 2rem; letter-spacing: 0.02em; }
.nav-link { color: rgba(255,255,255,0.7); text-decoration: none; padding: 0.5rem 1rem; border-radius: 6px; font-weight: 600; font-size: 0.9rem; transition: all 0.15s; }
.nav-link:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-link.active { color: white; background: rgba(255,255,255,0.15); }
.nav-right { display: flex; align-items: center; gap: 0.5rem; }
.tag-filter-label { color: rgba(255,255,255,0.6); font-size: 0.85rem; }
.tag-filter-select { background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; padding: 0.3rem 0.6rem; font-size: 0.85rem; }
.tag-filter-select option { color: #212529; background: white; }

/* === Main Content === */
.main-content { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }

/* === Page Header === */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.8rem; color: #1a1a2e; }
.back-link { color: #0066cc; text-decoration: none; font-size: 0.9rem; display: block; margin-bottom: 0.25rem; }

/* === Buttons === */
.btn { display: inline-block; padding: 0.6rem 1.2rem; border: none; border-radius: 8px; font-weight: 600; font-size: 0.9rem; cursor: pointer; text-decoration: none; transition: all 0.15s; }
.btn-primary { background: #0066cc; color: white; }
.btn-primary:hover { background: #0052a3; }
.btn-secondary { background: #e9ecef; color: #495057; }
.btn-secondary:hover { background: #dee2e6; }
.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #c82333; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.82rem; }

/* === Tables === */
.data-table { width: 100%; border-collapse: collapse; background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
.data-table th, .data-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid #eee; }
.data-table th { background: #f8f9fa; font-weight: 600; color: #495057; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
.data-table tr:hover { background: #f8f9fa; }

/* === Cards === */
.section { background: white; border-radius: 12px; padding: 1.5rem 2rem; margin-bottom: 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
.section h2 { font-size: 1.2rem; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid #dee2e6; color: #1a1a2e; }

.list-card { background: white; border-radius: 12px; padding: 1.25rem 1.5rem; margin-bottom: 0.75rem; box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
.list-card-main { display: flex; justify-content: space-between; align-items: center; }
.list-card-title { font-size: 1.1rem; margin-right: 0.75rem; }
.list-card-actions { display: flex; gap: 0.5rem; }

/* === Forms === */
.form-card { background: white; border-radius: 12px; padding: 2rem; box-shadow: 0 2px 8px rgba(0,0,0,0.07); max-width: 700px; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; color: #495057; }
.form-control { width: 100%; padding: 0.6rem 0.8rem; border: 2px solid #dee2e6; border-radius: 8px; font-size: 0.9rem; font-family: inherit; transition: border-color 0.15s; }
.form-control:focus { outline: none; border-color: #0066cc; }
.form-control.mono { font-family: 'Courier New', monospace; font-size: 0.85rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.5rem; }
.radio-group { display: flex; gap: 1.5rem; margin: 0.5rem 0; }
.radio-group label { font-weight: 400; display: flex; align-items: center; gap: 0.35rem; }
/* === Picker Toolbar === */
.picker-toolbar { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 10px; padding: 0.75rem 1rem; margin-bottom: 0.5rem; }
.picker-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.picker-btn { padding: 0.3rem 0.75rem; border: 1px solid #ced4da; border-radius: 6px; background: white; font-size: 0.82rem; font-weight: 600; color: #495057; cursor: pointer; transition: all 0.15s; }
.picker-btn:hover { background: #e9ecef; border-color: #adb5bd; }
.picker-divider { width: 1px; height: 24px; background: #ced4da; margin: 0 0.25rem; }
.picker-group { display: flex; align-items: center; gap: 0.35rem; }
.picker-label { font-size: 0.82rem; font-weight: 600; color: #495057; white-space: nowrap; }
.picker-input { width: 64px; padding: 0.3rem 0.5rem; border: 1px solid #ced4da; border-radius: 6px; font-size: 0.85rem; text-align: center; transition: border-color 0.15s; }
.picker-input:focus { outline: none; border-color: #0066cc; box-shadow: 0 0 0 2px rgba(0,102,204,0.15); }
.picker-mode-btns { display: inline-flex; border: 1px solid #ced4da; border-radius: 6px; overflow: hidden; }
.picker-mode-btn { padding: 0.3rem 0.7rem; border: none; background: white; font-size: 0.82rem; font-weight: 600; color: #495057; cursor: pointer; transition: all 0.15s; border-right: 1px solid #ced4da; }
.picker-mode-btn:last-child { border-right: none; }
.picker-mode-btn:hover { background: #e9ecef; }
.picker-mode-btn.active { background: #0066cc; color: white; }
.picker-status { margin-top: 0.5rem; font-size: 0.82rem; font-weight: 600; color: #0066cc; }

.query-grid { display: grid; grid-template-columns: 1fr; gap: 0.15rem; margin-top: 0.5rem; max-height: 300px; overflow-y: auto; padding: 0.5rem; border: 1px solid #dee2e6; border-radius: 8px; background: white; }
.query-checkbox { font-size: 0.85rem; display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.5rem; border-radius: 6px; cursor: pointer; transition: background 0.1s; }
.query-checkbox:hover { background: #f0f4ff; }
.query-checkbox input[type="checkbox"] { accent-color: #0066cc; }

/* === Tags & Badges === */
.tag-chip { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 12px; font-size: 0.78rem; font-weight: 600; background: #e7f1ff; color: #004085; margin: 0.1rem; }
.tag-chips { margin-top: 0.35rem; }
.type-badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 12px; font-size: 0.78rem; font-weight: 600; background: #e7f1ff; color: #004085; }

/* === Status === */
.status-completed { color: #28a745; font-weight: 600; }
.status-running { color: #0066cc; font-weight: 600; }
.status-pending { color: #6c757d; font-weight: 600; }
.status-failed { color: #dc3545; font-weight: 600; }
.status-cancelled { color: #f57c00; font-weight: 600; }

/* === Progress === */
.progress-bar { width: 120px; height: 8px; background: #e9ecef; border-radius: 4px; display: inline-block; vertical-align: middle; }
.progress-fill { height: 100%; background: #0066cc; border-radius: 4px; transition: width 0.3s; }
.progress-bar-lg { width: 100%; height: 12px; background: #e9ecef; border-radius: 6px; margin: 0.75rem 0; }
.progress-fill-lg { height: 100%; background: linear-gradient(90deg, #0066cc, #00a3ff); border-radius: 6px; transition: width 0.3s; }
.progress-info { display: flex; justify-content: space-between; font-size: 0.95rem; }

/* === Live Results === */
.live-results { max-height: 400px; overflow-y: auto; }
.live-result-row { padding: 0.5rem 0.75rem; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; font-size: 0.9rem; }
.result-success { color: #28a745; }
.result-error { color: #dc3545; }
.query-preview { color: #6c757d; font-size: 0.85rem; max-width: 60%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }

/* === Mode Switcher === */
.mode-switcher { display: flex; justify-content: center; gap: 0; margin-bottom: 1rem; }
.mode-pill { padding: 0.5rem 1.5rem; border: 2px solid #0066cc; cursor: pointer; font-weight: 600; font-size: 0.9rem; transition: all 0.2s; background: white; color: #0066cc; }
.mode-pill:first-child { border-radius: 8px 0 0 8px; }
.mode-pill:last-child { border-radius: 0 8px 8px 0; }
.mode-pill.active { background: #0066cc; color: white; }
.grading-progress { text-align: center; font-size: 0.85rem; color: #6c757d; margin-bottom: 1rem; }

/* === Grade Summary === */
.grade-summary { background: white; border-radius: 12px; padding: 1rem 2rem; margin-bottom: 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,0.07); display: flex; justify-content: center; gap: 2rem; flex-wrap: wrap; position: sticky; top: 56px; z-index: 50; }
.summary-row { display: flex; justify-content: center; align-items: center; gap: 1rem; flex-wrap: wrap; width: 100%; }
.summary-group { display: flex; gap: 0.75rem; align-items: center; padding: 0.5rem 1rem; border-radius: 8px; }
.summary-group-label { font-weight: 700; font-size: 0.85rem; margin-right: 0.25rem; }
.summary-chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.85rem; font-weight: 600; }
.chip-correct { background: #d4edda; color: #155724; }
.chip-partial { background: #fff3cd; color: #856404; }
.chip-wrong { background: #f8d7da; color: #721c24; }
.chip-pending { background: #e2e3e5; color: #383d41; }
.summary-divider { width: 2px; height: 2rem; background: #dee2e6; }

/* === Query Cards (Grading) === */
.query-card { background: white; border-radius: 12px; padding: 1.5rem 2rem; margin-bottom: 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
.query-card-header { border-bottom: 2px solid #dee2e6; padding-bottom: 0.75rem; margin-bottom: 1rem; display: flex; justify-content: space-between; align-items: center; }
.query-title { font-size: 1.1rem; font-weight: bold; }
.query-text { font-size: 1rem; padding: 0.75rem; background: #f8f9fa; border-radius: 8px; border-left: 4px solid #0066cc; margin-bottom: 1rem; }
.expected-answer { margin-bottom: 1rem; }
.expected-answer h4 { color: #495057; font-size: 0.95rem; margin-bottom: 0.5rem; }
.response-box { background: #f8f9fa; border: 2px solid #dee2e6; border-radius: 8px; padding: 1rem; margin-bottom: 0.75rem; max-height: 400px; overflow-y: auto; white-space: pre-wrap; font-size: 0.93rem; }
.response-box.correct { background: #d4edda; border-color: #28a745; }
.response-box.partial { background: #fff3cd; border-color: #ffc107; }
.response-box.wrong { background: #f8d7da; border-color: #dc3545; }
.grade-buttons { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.grade-btn { padding: 0.45rem 0.9rem; border: 2px solid; border-radius: 6px; cursor: pointer; font-weight: bold; transition: all 0.2s; font-size: 0.88rem; }
.grade-btn-correct { background: #d4edda; border-color: #28a745; color: #155724; }
.grade-btn-correct:hover { background: #c3e6cb; }
.grade-btn-correct.active { font-weight: 900; transform: scale(1.05); box-shadow: 0 2px 8px rgba(40,167,69,0.4); }
.grade-btn-partial { background: #fff3cd; border-color: #ffc107; color: #856404; }
.grade-btn-partial:hover { background: #ffe69c; }
.grade-btn-partial.active { font-weight: 900; transform: scale(1.05); box-shadow: 0 2px 8px rgba(255,193,7,0.4); }
.grade-btn-wrong { background: #f8d7da; border-color: #dc3545; color: #721c24; }
.grade-btn-wrong:hover { background: #f5c6cb; }
.grade-btn-wrong.active { font-weight: 900; transform: scale(1.05); box-shadow: 0 2px 8px rgba(220,53,69,0.4); }
.result-meta { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid #dee2e6; font-size: 0.85rem; color: #6c757d; display: flex; gap: 1.5rem; flex-wrap: wrap; }
.tool-pill { display: inline-block; padding: 0.1rem 0.45rem; background: #e7f1ff; color: #004085; border-radius: 4px; font-size: 0.78rem; font-weight: 600; margin: 0.1rem; }
.answer-comment { margin-top: 0.5rem; padding: 0.4rem 0.75rem; background: #fff8e1; border-left: 3px solid #ffc107; border-radius: 4px; font-size: 0.85rem; color: #6d5a00; }

/* === Tool call clickable pills === */
.dc-tools { font-size: 0.85rem; color: #6c757d; margin-top: 0.5rem; padding: 0.5rem 0.75rem; background: #f1f3f5; border-radius: 6px; word-break: break-word; }
.tool-pill-click { display: inline-block; padding: 0.1rem 0.45rem; margin: 0.1rem; background: #e7f1ff; color: #004085; border-radius: 4px; font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.tool-pill-click:hover { background: #004085; color: white; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.15); }

/* === Tool call modal === */
.tc-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.15s; }
.tc-modal-overlay.visible { opacity: 1; }
.tc-modal { background: white; border-radius: 12px; width: 95%; max-width: 1200px; height: 85vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.tc-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1.5rem; border-bottom: 2px solid #dee2e6; flex-shrink: 0; }
.tc-modal-header h3 { font-size: 1.1rem; color: #1a1a2e; display: flex; align-items: center; gap: 0.5rem; }
.tc-modal-idx { font-size: 0.8rem; color: #6c757d; font-weight: 400; }
.tc-modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #6c757d; padding: 0.2rem 0.5rem; border-radius: 6px; line-height: 1; }
.tc-modal-close:hover { background: #f1f3f5; color: #212529; }

/* Split layout */
.tc-modal-split { display: flex; flex: 1; min-height: 0; }

/* Left sidebar — tool call list */
.tc-modal-sidebar { width: 240px; flex-shrink: 0; border-right: 2px solid #dee2e6; display: flex; flex-direction: column; background: #f8f9fa; }
.tc-search-box { padding: 0.5rem; border-bottom: 1px solid #dee2e6; flex-shrink: 0; }
.tc-search-input { width: 100%; padding: 0.35rem 0.6rem; border: 1px solid #ced4da; border-radius: 6px; font-size: 0.82rem; outline: none; transition: border-color 0.15s; }
.tc-search-input:focus { border-color: #0066cc; box-shadow: 0 0 0 2px rgba(0,102,204,0.15); }
.tc-search-input::placeholder { color: #adb5bd; }
.tc-sidebar-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.tc-sidebar-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.75rem; cursor: pointer; border-bottom: 1px solid #eee; font-size: 0.85rem; transition: background 0.1s; }
.tc-sidebar-item:hover { background: #e9ecef; }
.tc-sidebar-item.active { background: #e7f1ff; border-left: 3px solid #0066cc; font-weight: 600; }
.tc-sidebar-num { width: 22px; height: 22px; border-radius: 50%; background: #dee2e6; color: #495057; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; flex-shrink: 0; }
.tc-sidebar-item.active .tc-sidebar-num { background: #0066cc; color: white; }
.tc-sidebar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-search-snippet { font-size: 0.72rem; color: #6c757d; line-height: 1.3; margin-top: 0.2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tc-search-snippet mark { background: #fff3cd; color: #856404; border-radius: 2px; padding: 0 1px; }

/* Right content */
.tc-modal-content { flex: 1; overflow-y: auto; padding: 1rem 1.5rem; min-width: 0; }
.tc-modal-section { margin-bottom: 1.25rem; }
.tc-modal-section:last-child { margin-bottom: 0; }
.tc-modal-section h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: #6c757d; margin-bottom: 0.5rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.jt-fold-btns { display: inline-flex; gap: 0.15rem; margin-left: auto; }
.jt-fold-btns button { background: none; border: 1px solid #dee2e6; border-radius: 4px; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0.1rem 0.3rem; color: #6c757d; transition: all 0.15s; }
.jt-fold-btns button:hover { background: #e9ecef; color: #212529; border-color: #adb5bd; }
.tc-modal-json { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; padding: 0.75rem; font-family: 'Courier New', monospace; font-size: 0.83rem; line-height: 1.6; max-height: 45vh; overflow-y: auto; overflow-x: auto; }

/* JSON Tree */
.jt-root { }
.jt-line { white-space: pre-wrap; word-break: break-word; }
.jt-key { color: #881391; font-weight: 600; }
.jt-string { color: #1a6b3c; }
.jt-number { color: #1750eb; }
.jt-bool { color: #d63384; font-weight: 600; }
.jt-null { color: #6c757d; font-style: italic; }
.jt-bracket { color: #495057; font-weight: 700; }
.jt-count { font-size: 0.78rem; color: #6c757d; font-style: italic; font-weight: 400; }
.jt-node .jt-children { display: none; }
.jt-node .jt-close { display: none; }
.jt-node.open > .jt-children { display: block; }
.jt-node.open > .jt-close { display: block; }
.jt-node.open > .jt-toggle .jt-count { display: none; }
.jt-toggle { cursor: pointer; user-select: none; display: inline; }
.jt-toggle::before { content: '▸ '; color: #6c757d; font-size: 0.8rem; }
.jt-node.open > .jt-toggle::before { content: '▾ '; }
.jt-toggle:hover { background: #e7f1ff; border-radius: 3px; }
.jt-expand-str { background: none; border: none; color: #0066cc; font-size: 0.78rem; cursor: pointer; padding: 0; font-family: inherit; }
.jt-expand-str:hover { text-decoration: underline; }
.jt-highlight { background: #fff3cd; color: #856404; border-radius: 2px; padding: 0 2px; }
.jt-highlight-active { background: #ffc107; color: #212529; outline: 2px solid #e0a800; box-shadow: 0 0 6px rgba(255,193,7,0.5); }

/* Fullscreen JSON viewer */
.tc-fullscreen { background: white; border-radius: 12px; width: 95%; max-width: 1200px; height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.tc-fs-header { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1.5rem; border-bottom: 2px solid #dee2e6; flex-shrink: 0; }
.tc-fs-back { background: #f1f3f5; border: 1px solid #dee2e6; padding: 0.35rem 0.8rem; border-radius: 6px; cursor: pointer; font-size: 0.88rem; font-weight: 600; color: #495057; transition: all 0.15s; }
.tc-fs-back:hover { background: #e9ecef; color: #212529; }
.tc-fs-title { font-weight: 700; font-size: 0.95rem; color: #1a1a2e; }
.tc-fs-tools { display: flex; align-items: center; gap: 0.4rem; margin-left: auto; }
.tc-fs-search { padding: 0.3rem 0.6rem; border: 1px solid #ced4da; border-radius: 6px; font-size: 0.82rem; width: 180px; outline: none; transition: border-color 0.15s; }
.tc-fs-search:focus { border-color: #0066cc; box-shadow: 0 0 0 2px rgba(0,102,204,0.15); }
.tc-fs-match-count { font-size: 0.78rem; color: #6c757d; font-weight: 600; min-width: 55px; }
.jt-fold-btns-btn { background: none; border: 1px solid #dee2e6; border-radius: 4px; cursor: pointer; font-size: 0.7rem; line-height: 1; padding: 0.2rem 0.35rem; color: #6c757d; transition: all 0.15s; }
.jt-fold-btns-btn:hover { background: #e9ecef; color: #212529; }
.tc-fs-body { flex: 1; overflow: auto; padding: 1rem 1.5rem; background: #f8f9fa; }
.tc-fs-body .tc-modal-json { max-height: none; border: none; background: transparent; padding: 0; }

@media (max-width: 768px) {
    .tc-modal-split { flex-direction: column; }
    .tc-modal-sidebar { width: 100%; max-height: 150px; border-right: none; border-bottom: 2px solid #dee2e6; }
}

/* === Reasoning steps === */
.reasoning-step { border-left: 3px solid #6f42c1; padding: 0.5rem 0.75rem; margin-bottom: 0.5rem; background: #f8f5ff; border-radius: 0 6px 6px 0; }
.reasoning-text { font-size: 0.9rem; color: #333; }
.reasoning-text p { margin: 0.25rem 0; }
.detail-section { margin-top: 0.75rem; border: 1px solid #dee2e6; border-radius: 8px; overflow: hidden; }
.detail-summary { padding: 0.6rem 1rem; background: #f8f9fa; font-weight: 600; font-size: 0.88rem; cursor: pointer; user-select: none; color: #495057; }
.detail-summary:hover { background: #edf0f3; }
.detail-body { padding: 0.5rem; max-height: 500px; overflow-y: auto; }

/* === Tab bar (compare) === */
.tab-bar { display: flex; gap: 0; margin-bottom: 0; background: #f1f3f5; border-bottom: 2px solid #dee2e6; border-radius: 8px 8px 0 0; overflow-x: auto; }
.tab-btn { padding: 0.6rem 1rem; border: none; background: transparent; cursor: pointer; font-weight: 600; font-size: 0.88rem; color: #6c757d; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tab-btn:hover { background: #e9ecef; color: #212529; }
.tab-btn.active { color: #212529; background: white; border-bottom-color: #0066cc; }
.tab-panel { display: none; padding: 1rem; }
.tab-panel.active { display: block; }
.grade-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-left: 0.35rem; }
.grade-dot.correct { background: #28a745; }
.grade-dot.partial { background: #ffc107; }
.grade-dot.wrong { background: #dc3545; }
.grade-dot.not_graded { background: #ced4da; }

/* === Dashboard stats === */
.stats-table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.stats-table th, .stats-table td { padding: 0.6rem 1rem; text-align: left; border-bottom: 1px solid #eee; }
.stats-table th { background: #f8f9fa; font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* === Heatmap === */
.heatmap { display: flex; flex-wrap: wrap; gap: 6px; margin: 0.75rem 0; }
.hm-cell { width: 38px; height: 38px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; cursor: pointer; transition: transform 0.15s; color: white; }
.hm-cell:hover { transform: scale(1.15); }
.hm-correct { background: #28a745; }
.hm-wrong { background: #dc3545; }
.hm-partial { background: #ffc107; color: #333; }
.hm-inconsistent { background: #fd7e14; }
.heatmap-legend { display: flex; gap: 1rem; margin-top: 0.5rem; font-size: 0.85rem; color: #6c757d; }
.legend-item { display: flex; align-items: center; gap: 0.3rem; }
.legend-dot { width: 14px; height: 14px; border-radius: 4px; }

/* === Tool usage bars === */
.tool-bar-row { display: flex; align-items: center; gap: 0.5rem; margin: 0.3rem 0; font-size: 0.88rem; }
.tool-bar-name { width: 180px; text-align: right; font-weight: 600; font-size: 0.82rem; flex-shrink: 0; }
.tool-bar-seg { height: 22px; border-radius: 3px; display: flex; align-items: center; justify-content: center; color: white; font-size: 0.72rem; font-weight: 700; min-width: 20px; }

/* === Run Labels === */
.run-labels { font-size: 1rem; color: #6c757d; }
.run-info { display: flex; gap: 2rem; font-size: 0.95rem; margin-bottom: 1.5rem; color: #495057; }
.group-progress-row { margin-bottom: 1rem; }

/* === Modal === */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal-box { background: white; border-radius: 12px; width: 90%; max-width: 700px; max-height: 85vh; overflow-y: auto; padding: 1.5rem; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-lg { max-width: 900px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-header h3 { font-size: 1.2rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #6c757d; padding: 0.2rem 0.5rem; }

/* === Folder Browser === */
.browse-path-bar { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.browse-path-bar .form-control { font-family: 'Courier New', monospace; }
.browse-list { max-height: 350px; overflow-y: auto; border: 1px solid #dee2e6; border-radius: 8px; background: #fafbfc; }
.browse-item { padding: 0.5rem 0.75rem; display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; border-bottom: 1px solid #f0f0f0; cursor: default; }
.browse-dir { cursor: pointer; font-weight: 500; }
.browse-dir:hover { background: #e7f1ff; }
.browse-file { color: #6c757d; }
.browse-icon { font-size: 1.1rem; flex-shrink: 0; }
.browse-empty { padding: 2rem; text-align: center; color: #adb5bd; font-style: italic; }
.browse-info { margin-top: 0.5rem; }

/* === Export bar === */
.export-bar { display: flex; gap: 0.75rem; margin-top: 1.5rem; justify-content: center; flex-wrap: wrap; }

/* === Actions bar === */
.actions-bar { margin-top: 1rem; }

/* === Utility === */
.text-muted { color: #6c757d; }
.text-sm { font-size: 0.85rem; }

/* === Config Tab === */
.config-section { background: white; border-radius: 10px; padding: 1.25rem 1.5rem; margin-bottom: 1rem; border: 1px solid #e9ecef; }
.config-heading { font-size: 1rem; font-weight: 700; color: #1a1a2e; margin-bottom: 0.75rem; padding-bottom: 0.4rem; border-bottom: 2px solid #e9ecef; }
.config-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.5rem 1.5rem; }
.config-item { display: flex; flex-direction: column; padding: 0.3rem 0; }
.config-item-wide { grid-column: 1 / -1; }
.config-label { font-size: 0.78rem; font-weight: 600; color: #6c757d; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.15rem; }
.config-value { font-size: 0.92rem; color: #212529; word-break: break-word; }
.config-mono { font-family: 'SF Mono', Monaco, Consolas, monospace; font-size: 0.88rem; }
.config-tool-chip { display: inline-block; background: #e8f4fd; color: #0066cc; font-size: 0.8rem; padding: 0.15rem 0.5rem; border-radius: 4px; margin: 0.15rem 0.15rem 0.15rem 0; font-family: 'SF Mono', Monaco, Consolas, monospace; }
.config-sub { margin-top: 0.75rem; }
.config-subheading { font-size: 0.88rem; font-weight: 600; color: #495057; margin-bottom: 0.4rem; }
.config-pre { background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 8px; padding: 1rem; font-size: 0.82rem; font-family: 'SF Mono', Monaco, Consolas, monospace; white-space: pre-wrap; word-break: break-word; max-height: 400px; overflow-y: auto; line-height: 1.5; color: #212529; }

/* === Run Actions Menu === */
.run-actions-wrap { position: relative; }
.run-actions-btn { background: none; border: 1px solid #dee2e6; border-radius: 6px; font-size: 1.3rem; color: #495057; cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; letter-spacing: 2px; line-height: 1; }
.run-actions-btn:hover { background: #f8f9fa; border-color: #adb5bd; color: #212529; }
.run-actions-menu { display: none; position: absolute; right: 0; top: calc(100% + 4px); background: white; border: 1px solid #dee2e6; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); min-width: 150px; z-index: 60; overflow: hidden; }
.run-actions-menu.open { display: block; }
.run-actions-item { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.6rem 1rem; border: none; background: none; font-size: 0.88rem; color: #212529; cursor: pointer; text-align: left; transition: background 0.1s; }
.run-actions-item:hover { background: #f8f9fa; }
.run-actions-danger { color: #dc3545; }
.run-actions-danger:hover { background: #fff5f5; }
.run-actions-icon { font-size: 1rem; width: 1.1rem; text-align: center; }

/* === Rerun Modal === */
.rerun-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 200; display: flex; align-items: center; justify-content: center; }
.rerun-modal { background: white; border-radius: 12px; width: 560px; max-width: 95vw; max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.rerun-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid #e9ecef; }
.rerun-modal-header h3 { font-size: 1.1rem; font-weight: 700; color: #1a1a2e; margin: 0; }
.rerun-modal-close { background: none; border: none; font-size: 1.5rem; color: #6c757d; cursor: pointer; padding: 0; line-height: 1; }
.rerun-modal-close:hover { color: #212529; }
.rerun-modal-body { padding: 1.25rem 1.5rem; overflow-y: auto; flex: 1; }
.rerun-modal-footer { padding: 1rem 1.5rem; border-top: 1px solid #e9ecef; display: flex; justify-content: flex-end; gap: 0.5rem; }
.rerun-query-list { max-height: 280px; overflow-y: auto; border: 1px solid #e9ecef; border-radius: 8px; padding: 0.5rem; }
.rerun-query-item { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.3rem 0.4rem; border-radius: 4px; cursor: pointer; font-size: 0.88rem; }
.rerun-query-item:hover { background: #f8f9fa; }
.rerun-query-item input { margin-top: 0.2rem; flex-shrink: 0; }
.rerun-q-ord { font-weight: 600; color: #6c757d; white-space: nowrap; min-width: 2rem; }
.rerun-q-text { color: #495057; line-height: 1.4; }

/* === Responsive === */
@media (max-width: 768px) {
    .navbar { padding: 0 1rem; }
    .nav-brand { margin-right: 1rem; font-size: 0.95rem; }
    .main-content { padding: 1rem; }
    .form-row { grid-template-columns: 1fr; }
}
