/* ClaimCheck Dashboard Styles */

:root {
    --bg: #f5f6fa;
    --bg-secondary: #e8eaed;
    --surface: #ffffff;
    --text: #2d3436;
    --text-secondary: #636e72;
    --border: #dfe6e9;
    --accent: #0984e3;
    --green: #00b894;
    --red: #d63031;
    --yellow: #fdcb6e;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1a1a2e;
        --bg-secondary: #0f0f1a;
        --surface: #16213e;
        --text: #eaeaea;
        --text-secondary: #a0a0a0;
        --border: #2a2a4a;
        --accent: #4dabf7;
        --green: #51cf66;
        --red: #ff6b6b;
        --yellow: #ffd43b;
        --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding: 0 2rem;
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 2px solid var(--border);
    flex-shrink: 0;
    background: var(--bg);
}

header h1 { font-size: 2.25rem; display: flex; align-items: center; gap: 20px; }
.header-logo { height: 2.7rem; width: auto; }
.header-meta { color: var(--text-secondary); font-size: 0.85rem; }

/* Footer */
footer {
    height: 150px;
    flex-shrink: 0;
    border-top: 2px solid var(--border);
    background: var(--bg);
    margin-top: auto;
}

/* Tabs */
.tabs-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 1rem 0 0 0;
    flex-shrink: 0;
    background: var(--bg);
}

.tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tab {
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.15s;
    min-width: 130px;
    text-align: center;
}

.tab:hover { background: var(--bg); }
.tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.tab-standalone {
    border-radius: var(--radius);
    margin-left: 50px;
}

.tab-standalone.active {
    background: #5F875F;
    border-color: #5F875F;
}

.tab-content { display: none; }
.tab-content.active {
    display: block;
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Sticky tab title header */
.tab-content > .ext-search-header:first-child {
    position: sticky;
    top: 0;
    background: var(--bg);
    padding-top: 1rem;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    z-index: 20;
}

/* Section headings */
h2 {
    font-size: 1.1rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--text);
}

h2:first-child { margin-top: 0; }

/* Health grid */
.health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 150px);
    gap: 0.75rem;
}

.health-card {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--border);
}

.health-card.status-healthy { border-left-color: var(--green); }
.health-card.status-unhealthy { border-left-color: var(--red); }

.health-info { flex: 1; min-width: 0; margin-left: 20px; }
.health-name { font-weight: 600; font-size: 0.9rem; }
.health-status { font-size: 0.8rem; color: var(--text-secondary); }
.health-error { font-size: 0.75rem; color: var(--red); margin-top: 0.25rem; }

/* Stats sections */
.stats-section {
    margin-bottom: 1.5rem;
}

.stats-row-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 150px);
    gap: 0.75rem;
}

.stats-grid.stats-grid-wide {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.75rem 1rem;
    text-align: center;
}

/* Match stat cards height to health/cb cards */
.stats-section .stat-card {
    height: 113.61px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card.warning {
    border-left: 4px solid var(--yellow);
}

.stat-card.danger {
    border-left: 4px solid var(--red);
}

.stat-card.success {
    border-left: 4px solid var(--green);
}

.stat-card-warning {
    border-left: 4px solid var(--red);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.8rem;
    color: white;
    font-weight: normal;
    margin-top: 0.25rem;
}

.stat-sub {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

/* Circuit breaker grid */
.cb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 150px);
    gap: 0.75rem;
}

.cb-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--border);
}

.cb-card.cb-closed { border-left-color: var(--green); }
.cb-card.cb-open { border-left-color: var(--red); }
.cb-card.cb-half_open { border-left-color: var(--yellow); }

.cb-state-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
}

.cb-closed .cb-state-dot { background: var(--green); }
.cb-open .cb-state-dot { background: var(--red); }
.cb-half_open .cb-state-dot { background: var(--yellow); }

.cb-info { flex: 1; min-width: 0; }
.cb-service { font-weight: 600; font-size: 0.9rem; }
.cb-breaker { font-size: 0.75rem; color: var(--text-secondary); }
.cb-state-label { font-size: 0.8rem; color: var(--text-secondary); }

/* Metrics unavailable placeholder */
.metrics-unavailable {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    font-style: italic;
    border-left: 4px solid var(--border);
}

/* Slow query highlight */
.slow-query { background: rgba(214, 48, 49, 0.08); }

@media (prefers-color-scheme: dark) {
    .slow-query { background: rgba(255, 107, 107, 0.1); }
}

/* Charts row */
.charts-row {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
}

.overview-top-row {
    display: flex;
    gap: 1.5rem;
    align-items: stretch;
}

.pipeline-stats-panel {
    flex: 1 1 auto;
    min-width: 0;
}

.overview-side-lists {
    flex: 0 0 620px;
    display: flex;
    flex-direction: row;
    column-gap: 1.5rem;
    row-gap: 0.25rem;
    min-width: 0;
    flex-wrap: wrap;
    align-content: flex-start;
    transform: translateX(-50px);
}

.overview-side-label {
    flex: 0 0 100%;
    margin: 0 0 5px;
}

.chart-container {
    flex: 0 0 calc(100% - 680px);
    max-width: calc(100% - 680px);
    min-width: 0;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.chart-header h2 {
    margin: 0;
}

.chart-header-meta {
    margin-left: auto;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
    color: white;
}

.chart-container-narrow {
    flex: 0 0 auto;
}

.chart-container-narrow .stats-grid {
    grid-template-columns: repeat(2, 1fr);
}

.list-container {
    flex: 0 0 300px;
    min-width: 0;
}

.chart-container, .list-container, .panel-half {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
}

.panel-half {
    flex: 1 1 0;
    min-width: 300px;
}

.panel-half h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.data-table-scroll {
    max-height: 280px;
    overflow-y: scroll;
}

.list-container .data-table {
    table-layout: fixed;
}

.overview-side-lists .list-container {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.overview-side-lists .list-container h2 {
    margin-top: 0;
}

.overview-side-lists .list-container > div[id] {
    flex: 1 1 auto;
}

.overview-side-lists .data-table-scroll {
    max-height: 345px;
}

.chart-container canvas {
    max-height: 300px;
}

.charts-row-compact {
    align-items: flex-start;
}

.charts-row-compact .chart-container canvas {
    max-height: 215px;
}

/* Data tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th, .data-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.data-table th {
    background: var(--bg);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.data-table tr:hover { background: var(--bg); }

.args-cell pre {
    font-size: 0.75rem;
    max-width: 300px;
    overflow-x: auto;
    white-space: pre-wrap;
    margin: 0;
}

/* Confidence bars */
.confidence-bar-container {
    width: 60px;
    height: 12px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.confidence-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.confidence-bar.confidence-low {
    background: var(--red);
}

.confidence-bar.confidence-medium {
    background: var(--yellow);
}

.confidence-bar.confidence-high {
    background: var(--green);
}

/* Veracity bars (SL opinion visualization) */
.veracity-bar-container {
    display: flex;
    width: 80px;
    height: 12px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.veracity-bar {
    height: 100%;
    flex: none;  /* Prevent flex from affecting width */
    transition: width 0.3s ease;
}

.veracity-bar.veracity-belief {
    background: #5F875F;
}

.veracity-bar.veracity-disbelief {
    background: var(--red);
}

.veracity-bar.veracity-uncertainty {
    background: var(--text-secondary);
    opacity: 0.4;
}

/* Assertion type labels */
.assert-type-label {
    display: inline-block;
    font-family: var(--font-mono, monospace);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 4px;
    background: #143057;
    border-radius: 3px;
    width: 75px;
    text-align: center;
    white-space: nowrap;
}

/* Corroboration checkmark */
.corrob-check {
    display: inline-block;
    color: var(--green);
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
}

/* Cell center utility */
.cell-center {
    text-align: center !important;
    vertical-align: middle;
}

/* Ensure buttons and checkmarks are centered in table cells */
td.cell-center {
    text-align: center !important;
    vertical-align: middle;
}

td.cell-center .btn-sm {
    display: inline-block;
}

td.cell-center .corrob-check {
    display: inline-block;
}

/* Explorer panels */
.explorer-panels {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

.panel h2 { margin-top: 0; }

/* Forms */
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

input, textarea {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    background: var(--bg);
    color: var(--text);
}

textarea { resize: vertical; }

.btn {
    padding: 0.5rem 1.25rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: opacity 0.15s;
}

.btn:hover { opacity: 0.9; }

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

/* NL response */
.nl-answer { margin: 1rem 0; line-height: 1.7; }
.nl-results, .nl-reasoning, .nl-citations {
    margin: 0.5rem 0;
    background: var(--bg);
    border-radius: 4px;
    padding: 0.75rem;
}
.nl-results summary, .nl-reasoning summary, .nl-citations summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}

/* Provenance */
.provenance-detail {
    margin-top: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 1rem;
}

.provenance-detail pre {
    font-size: 0.75rem;
    overflow-x: auto;
    white-space: pre-wrap;
}

.provenance-detail h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
}

.provenance-detail h5 {
    margin: 1rem 0 0.5rem 0;
    font-size: 0.9rem;
}

.provenance-summary {
    margin-bottom: 1rem;
}

.provenance-summary p {
    margin: 0.25rem 0;
    font-size: 0.85rem;
}

.provenance-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.provenance-table th,
.provenance-table td {
    padding: 0.4rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.provenance-table th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.provenance-table tr:hover {
    background: var(--bg-secondary);
}

.provenance-detail .note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Provenance Sections */
.provenance-section {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.provenance-section:last-child {
    margin-bottom: 0;
}

.provenance-section-title {
    margin: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.provenance-section-content {
    padding: 0.75rem;
}

.provenance-section-content p {
    margin: 0.3rem 0;
    font-size: 0.85rem;
}

.provenance-section-content p:first-child {
    margin-top: 0;
}

.provenance-section-content p:last-child {
    margin-bottom: 0;
}

/* Reliability badge */
.reliability-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    margin-left: 0.5rem;
}

/* SPO Table */
.spo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.spo-table th,
.spo-table td {
    padding: 0.4rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.spo-table th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.spo-table th:first-child {
    width: 100px;
}

.spo-table td:first-child {
    background: var(--bg-secondary);
}

/* Utilities */
.loading { color: var(--text-secondary); font-style: italic; }
.empty-state { color: var(--text-secondary); font-style: italic; padding: 1rem 0; }
.error { color: var(--red); padding: 0.5rem 0; }
.results-summary { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.text-muted { color: var(--text-secondary); font-size: 0.85rem; }

.htmx-indicator { display: none; color: var(--text-secondary); font-size: 0.85rem; margin-left: 0.5rem; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-request.htmx-indicator { display: inline; }

/* Knowledge Explorer */
.explorer-lists {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.explorer-col {
    flex: 1 1 0;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.explorer-col label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.word-wheel {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8rem;
    background: var(--bg);
    color: var(--text);
}

.explorer-listbox {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.8rem;
    padding: 0.25rem;
}

.explorer-listbox option {
    padding: 0.15rem 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.explorer-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.explorer-results-container {
    resize: vertical;
    overflow: auto;
    max-height: 600px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.explorer-table {
    table-layout: fixed;
}

/* Sticky header for explorer tables */
.explorer-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.explorer-table thead th {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
}

.explorer-table .cell-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.explorer-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.explorer-table th.sortable:hover {
    background: var(--border);
}

.sort-icon {
    font-size: 0.7rem;
    opacity: 0.5;
}

th.sort-asc .sort-icon::after { content: " \2191"; opacity: 1; }
th.sort-desc .sort-icon::after { content: " \2193"; opacity: 1; }

/* Column resize handle */
.col-resizer {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: col-resize;
    background: transparent;
    z-index: 1;
}

.col-resizer:hover,
.col-resizer:active {
    background: var(--accent);
    opacity: 0.4;
}

/* Document modal */
.doc-modal {
    border: none;
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    padding: 0;
    max-width: 800px;
    width: 90vw;
    height: 80vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.doc-modal::backdrop {
    background: rgba(0,0,0,0.5);
}

.doc-modal-inner {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.doc-modal-inner #doc-modal-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.doc-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.doc-content {
    font-size: 0.8rem;
    overflow: auto;
    flex: 1;
    min-height: 0;
    white-space: pre-wrap;
    background: var(--bg);
    padding: 1rem;
    border-radius: 4px;
}

/* Claim highlighting */
.claim-highlight-selected {
    background: #00ffff;
    color: #000;
    border-radius: 2px;
    padding: 1px 2px;
}

.claim-highlight-other {
    background: #4169e1;
    color: #fff;
    border-radius: 2px;
    padding: 1px 2px;
}

@media (prefers-color-scheme: dark) {
    .claim-highlight-selected {
        background: #00cccc;
        color: #000;
    }

    .claim-highlight-other {
        background: #3a5fcd;
        color: #fff;
    }
}

.claim-legend {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-label {
    font-weight: 600;
}

/* Integration Panels (DB8R, External Search, Opinion Engine, Claim Types) */
.integration-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.integration-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
}

.integration-card h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Top queries list */
.top-queries {
    list-style: none;
    margin: 0;
    padding: 0;
}

.top-queries li {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.top-queries li:last-child {
    border-bottom: none;
}

.query-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 0.5rem;
}

.query-count {
    color: var(--accent);
    font-weight: 600;
    flex-shrink: 0;
}

/* Provider chips */
.provider-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.provider-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: var(--bg);
    border-radius: 999px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
}

.provider-chip .count {
    background: var(--accent);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* External search jobs table */
.jobs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.jobs-table th,
.jobs-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.jobs-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.job-status {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.job-status.status-running {
    background: rgba(9, 132, 227, 0.15);
    color: var(--accent);
}

.job-status.status-pending {
    background: rgba(253, 203, 110, 0.2);
    color: var(--yellow);
}

.job-status.status-completed {
    background: rgba(0, 184, 148, 0.15);
    color: var(--green);
}

.job-status.status-failed {
    background: rgba(214, 48, 49, 0.15);
    color: var(--red);
}

/* Opinion engine panels */
.opinion-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.opinion-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    text-align: center;
}

.opinion-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.opinion-value.high-confidence {
    color: var(--green);
}

.opinion-value.low-confidence {
    color: var(--yellow);
}

.opinion-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Claim type breakdown */
.claim-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.claim-type-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    text-align: center;
    border-left: 4px solid var(--border);
}

.claim-type-card.type-evidence {
    border-left-color: var(--green);
}

.claim-type-card.type-normal {
    border-left-color: var(--accent);
}

.claim-type-count {
    font-size: 1.8rem;
    font-weight: 700;
}

.type-evidence .claim-type-count {
    color: var(--green);
}

.type-normal .claim-type-count {
    color: var(--accent);
}

.claim-type-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.claim-type-percent {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Opinion details for Knowledge Explorer */
.claim-opinion-section {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    margin-top: 1rem;
}

.opinion-details {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.opinion-details h4,
.corroboration-details h4 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.opinion-stats,
.corroboration-stats,
.corroboration-scores {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
}

.opinion-projected {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.opinion-base-rate {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.opinion-unavailable,
.corroboration-no {
    color: var(--text-secondary);
    font-style: italic;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
}

.corroboration-yes {
    color: var(--green);
    font-weight: 600;
}

.corroboration-details {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 1rem;
}

.opinion-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.opinion-item {
    text-align: center;
    padding: 0.5rem;
    background: var(--surface);
    border-radius: 4px;
}

.opinion-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}

.opinion-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.corroboration-details {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.corroboration-item {
    flex: 1;
    min-width: 150px;
    padding: 0.75rem;
    background: var(--surface);
    border-radius: 4px;
    text-align: center;
}

.corroboration-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.corroboration-value.has-corroboration {
    color: var(--green);
}

.corroboration-value.no-corroboration {
    color: var(--text-secondary);
}

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

/* Strength bars */
.strength-bar-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.strength-bar {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.strength-bar-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
}

.strength-bar-fill.high {
    background: var(--green);
}

.strength-bar-fill.medium {
    background: var(--yellow);
}

.strength-bar-fill.low {
    background: var(--red);
}

.strength-value {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: right;
}

/* Progress indicator for async jobs */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
}

/* Activity timeline */
.activity-timeline {
    margin-top: 0.5rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-time {
    color: var(--text-secondary);
    font-size: 0.75rem;
    flex-shrink: 0;
    width: 60px;
}

.activity-text {
    flex: 1;
}

/* External Search Tab */

/* External Search header - 50% larger, outside panel */
.ext-search-header {
    font-size: 1.875rem;  /* 1.25rem * 1.5 */
    margin-bottom: 1rem;
}

/* Spacing between panels in External Search tab */
#tab-ext-search .panel + .panel {
    margin-top: 20px;
}

/* Provider checkboxes */
.provider-row {
    display: flex;
    align-items: center;
    margin: 0 0 1rem 0;
}

.provider-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-right: 1rem;
    white-space: nowrap;
}

.provider-checkboxes {
    display: flex;
    justify-content: flex-start;
    gap: 50px;
}

.provider-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.provider-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Search form row layout */
.ext-search-form {
    margin-bottom: 30px;
}

/* Filter toggle row */
.ext-search-filter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text);
    user-select: none;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--accent);
}

.ext-search-row {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
}

.ext-search-row #ext-search-query {
    flex: 1;
    min-width: 200px;
    height: 38px;
    box-sizing: border-box;
    margin-right: 20px;
}

.ext-search-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.ext-search-controls .limit-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-right: 10px;
}

.ext-search-controls .limit-select {
    height: 38px;
    padding: 0 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text);
    margin-right: 30px;
}

.ext-search-controls select {
    height: 38px;
    padding: 0 0.5rem;
}

.ext-search-controls .btn {
    height: 38px;
    width: 70px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ext-search-controls .btn + .btn {
    margin-left: 10px;
}

/* Placeholder styling */
#ext-search-query::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Provider modal */
.provider-modal {
    border: none;
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    padding: 0;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.provider-modal::backdrop {
    background: rgba(0,0,0,0.5);
}

.provider-modal .modal-content {
    padding: 1.5rem;
    text-align: center;
}

.provider-modal .modal-content p {
    margin-bottom: 1rem;
}

.ext-search-options select {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.85rem;
}

.ext-results-container {
    resize: vertical;
    overflow: auto;
    max-height: 600px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.ext-results-table {
    table-layout: fixed;
}

/* Sticky header for external search results */
.ext-results-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.ext-results-table thead th {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
}

.ext-results-table th,
.ext-results-table td {
    vertical-align: middle;
}

.ext-results-table .cell-statement {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Belief bar visualization */
.belief-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.belief-bar-track {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    min-width: 40px;
}

.belief-bar-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
}

.belief-bar-fill.high {
    background: var(--green);
}

.belief-bar-fill.medium {
    background: var(--yellow);
}

.belief-bar-fill.low {
    background: var(--red);
}

.belief-value {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 32px;
    text-align: right;
}

/* Status badges for ingestion pipeline */
.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    min-width: 85px;
    text-align: center;
}

/* Pulse animation for active states */
.status-badge.pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

.status-badge.status-submitted {
    background: rgba(9, 132, 227, 0.15);
    color: var(--accent);
}

.status-badge.status-processing {
    background: rgba(9, 132, 227, 0.15);
    color: var(--accent);
}

.status-badge.status-completed {
    background: rgba(0, 184, 148, 0.15);
    color: var(--green);
}

.status-badge.status-failed {
    background: rgba(214, 48, 49, 0.15);
    color: var(--red);
}

/* Legacy status badges (for backwards compatibility) */
.status-badge.status-fetched {
    background: rgba(9, 132, 227, 0.15);
    color: var(--accent);
}

.status-badge.status-extracting {
    background: rgba(253, 203, 110, 0.2);
    color: #b07d00;
}

.status-badge.status-enriching {
    background: rgba(253, 203, 110, 0.2);
    color: #b07d00;
}

.status-badge.status-indexed {
    background: rgba(0, 184, 148, 0.15);
    color: var(--green);
}

.status-badge.status-pending {
    background: rgba(253, 203, 110, 0.15);
    color: var(--yellow);
}

/* Provider badges */
.provider-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: capitalize;
    min-width: 50px;
    text-align: center;
}

/* Center provider column in ext-results-table */
.ext-results-table td[data-sort-value] .provider-badge {
    display: block;
    margin: 0 auto;
}

.provider-badge.provider-tavily {
    background: rgba(108, 92, 231, 0.15);
    color: #6c5ce7;
}

.provider-badge.provider-serper {
    background: rgba(0, 184, 148, 0.15);
    color: var(--green);
}

.provider-badge.provider-gdelt {
    background: rgba(9, 132, 227, 0.15);
    color: var(--accent);
}

.provider-badge.provider-rss {
    background: rgba(253, 203, 110, 0.15);
    color: #b07d00;
}

/* Relevance score display */
.relevance-score {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 40px;
    text-align: center;
}

.relevance-high {
    background: rgba(0, 184, 148, 0.15);
    color: var(--green);
}

.relevance-medium {
    background: rgba(253, 203, 110, 0.15);
    color: #b07d00;
}

.relevance-low {
    background: rgba(214, 48, 49, 0.15);
    color: var(--red);
}

/* Source name display */
.source-name {
    font-size: 0.85rem;
    color: var(--text);
    cursor: help;
}

/* Document Viewer Window */
.doc-viewer {
    position: fixed;
    width: 800px;
    height: 600px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    resize: both;
    overflow: hidden;
    min-width: 400px;
    min-height: 300px;
}

.doc-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}

.doc-viewer-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.doc-viewer-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    margin-left: 0.5rem;
}

.doc-viewer-close:hover {
    color: var(--red);
}

.doc-viewer-meta {
    padding: 0.5rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.doc-viewer-meta code {
    font-size: 0.7rem;
    background: rgba(0,0,0,0.2);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

.doc-viewer-meta a {
    color: var(--accent);
    text-decoration: none;
}

.doc-viewer-meta a:hover {
    text-decoration: underline;
}

.doc-viewer-content {
    flex: 1;
    overflow: hidden;
}

.doc-viewer-content iframe,
.doc-viewer-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.doc-viewer-iframe {
    display: block;
}

/* Document viewer meta row with button */
.doc-viewer-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.doc-viewer-open-original {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.doc-viewer-open-original:hover {
    background: var(--accent-hover, #2a6bcc);
}

/* Document viewer loading state */
.doc-viewer-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1rem;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Document viewer fallback message */
.doc-viewer-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 0.75rem;
    text-align: center;
    padding: 2rem;
    color: var(--text);
}

.doc-viewer-fallback p {
    margin: 0;
}

.doc-viewer-fallback .btn {
    margin-top: 0.5rem;
}

/* KB Document viewer content */
.kb-doc-content {
    overflow: auto;
    padding: 1rem;
    background: var(--surface);
}

.kb-doc-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Provenance viewer content */
.provenance-viewer .provenance-content {
    overflow: auto;
    padding: 1rem;
    background: var(--surface);
}

.provenance-viewer .provenance-detail {
    background: transparent;
    padding: 0;
}

.provenance-viewer .provenance-section {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
}

.provenance-viewer .provenance-section-title {
    font-size: 0.9rem;
    margin: 0 0 0.5rem 0;
    color: var(--accent);
}

.provenance-viewer .provenance-section-content {
    font-size: 0.85rem;
}

.provenance-viewer .provenance-section-content p {
    margin: 0.25rem 0;
}

.provenance-viewer .spo-table,
.provenance-viewer .provenance-table {
    width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
}

.provenance-viewer .spo-table th,
.provenance-viewer .spo-table td,
.provenance-viewer .provenance-table th,
.provenance-viewer .provenance-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.provenance-viewer .spo-table th,
.provenance-viewer .provenance-table th {
    background: var(--bg-secondary);
    font-weight: 600;
}

/* ClaimSet link styling */
.claimset-link {
    color: var(--accent);
    text-decoration: none;
}

.claimset-link:hover {
    text-decoration: underline;
}

.claimset-link code {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.75rem;
}

/* Text color utilities */
.text-success {
    color: var(--green);
}

.text-danger {
    color: var(--red);
}

/* Stance badges for ClaimSet member claims */
.stance-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.9rem;
    font-weight: bold;
    border-radius: 50%;
}

.stance-corrob {
    background: var(--green);
    color: white;
}

.stance-contra {
    background: var(--red);
    color: white;
}

.stance-uncertain {
    background: var(--yellow);
    color: #333;
}

/* Vertical resize handle visibility */
.doc-viewer,
.provenance-viewer,
.claimset-viewer {
    resize: both;
    overflow: hidden;
}

/* Resize handle styling for better visibility */
.doc-viewer::after,
.provenance-viewer::after,
.claimset-viewer::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 15px;
    height: 15px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, var(--border) 50%);
    border-radius: 0 0 var(--radius) 0;
}

/* ClaimSet viewer specific styles */
.claimset-viewer .claimset-content {
    overflow: auto;
    padding: 1rem;
    background: var(--surface);
}

.claimset-viewer .claimset-detail {
    background: transparent;
    padding: 0;
}

/* Document content display */
.doc-content-wrapper {
    height: 100%;
    overflow: auto;
    background: var(--bg);
}

.doc-content-body {
    padding: 1rem;
}

.doc-content-text {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.doc-content-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
    color: var(--text);
}

.doc-content-error p {
    margin: 0.5rem 0;
}

/* Pipeline status message */
.pipeline-status-message {
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.pipeline-flow {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.pipeline-stage {
    padding: 0.3rem 0.6rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
}

.pipeline-arrow {
    color: var(--text-secondary);
    font-weight: bold;
}

.pipeline-note {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Source link styling */
.source-link {
    color: var(--accent);
    text-decoration: none;
    max-width: 120px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.source-link:hover {
    text-decoration: underline;
}

/* Assertion type badges */
.assertion-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 500;
}

.assertion-badge.type-factual {
    background: rgba(0, 184, 148, 0.15);
    color: var(--green);
}

.assertion-badge.type-opinion {
    background: rgba(9, 132, 227, 0.15);
    color: var(--accent);
}

.assertion-badge.type-prediction {
    background: rgba(155, 89, 182, 0.15);
    color: #9b59b6;
}

/* Evidence detail modal content */
.evidence-detail {
    padding: 0.5rem 0;
}

.evidence-detail-header {
    margin-bottom: 1rem;
}

.evidence-detail-header h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.evidence-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.evidence-meta-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.evidence-meta-item strong {
    color: var(--text);
}

.evidence-statement {
    background: var(--bg);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.evidence-opinion-section {
    background: var(--bg);
    padding: 1rem;
    border-radius: var(--radius);
}

.evidence-opinion-section h4 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.opinion-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

/* ClaimSet Browser */
.panel-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.claimsets-container {
    resize: vertical;
    overflow: auto;
    max-height: 400px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.claimsets-table {
    table-layout: fixed;
}

.claimsets-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.claimsets-table thead th {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
}

/* Pagination controls */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.75rem;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ClaimSet viewer (reuses doc-viewer patterns) */
.claimset-viewer .claimset-content {
    overflow: auto;
    padding: 1rem;
    background: var(--surface);
}

.claimset-viewer .claimset-detail {
    background: transparent;
    padding: 0;
}

.claimset-viewer .provenance-section {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
}

.claimset-viewer .provenance-section-title {
    font-size: 0.9rem;
    margin: 0 0 0.5rem 0;
    color: var(--accent);
}

.claimset-viewer .provenance-section-content {
    font-size: 0.85rem;
}

.claimset-viewer .provenance-section-content p {
    margin: 0.25rem 0;
}

.claimset-viewer .provenance-table {
    width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
}

.claimset-viewer .provenance-table th,
.claimset-viewer .provenance-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.claimset-viewer .provenance-table th {
    background: var(--bg-secondary);
    font-weight: 600;
}

/* ── Data Feeds Tab ───────────────────────────────────────────────── */

/* Harvester control panel */
.harvester-control {
    margin-bottom: 1.5rem;
}

.harvester-control h3 {
    margin: 0 0.75rem 0 0;
    font-size: 1rem;
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.control-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle-label-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Status badges for harvester */
.status-badge.status-running {
    background: rgba(0, 184, 148, 0.15);
    color: var(--green);
}

.status-badge.status-paused {
    background: rgba(253, 203, 110, 0.15);
    color: var(--yellow);
}

.status-badge.status-stopped {
    background: rgba(214, 48, 49, 0.15);
    color: var(--red);
}

.status-badge.status-unavailable {
    background: rgba(99, 110, 114, 0.15);
    color: var(--text-secondary);
}

.error-message {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--red);
}

/* Feeds and Priors sections */
.feeds-section,
.priors-section {
    margin-bottom: 2rem;
}

.feeds-section .view-actions,
.priors-section .view-actions,
.feeds-section .edit-actions,
.priors-section .edit-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.feeds-table-container,
.priors-table-container {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: auto;
    max-height: 400px;
}

.feeds-table,
.priors-table {
    table-layout: fixed;
}

.feeds-table thead,
.priors-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.feeds-table thead th,
.priors-table thead th {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
}

/* Edit-only columns hidden by default */
.edit-only {
    display: none;
}

.edit-mode .edit-only,
table.edit-mode .edit-only {
    display: table-cell;
}

.add-row-action.edit-only {
    display: none;
}

/* Feed enabled/disabled styling */
.feed-disabled {
    opacity: 0.6;
}

.feed-disabled td {
    color: var(--text-secondary);
}

/* Prior value coloring */
.prior-high {
    color: var(--green);
    font-weight: 600;
}

.prior-medium {
    color: var(--yellow);
    font-weight: 500;
}

.prior-low {
    color: var(--red);
    font-weight: 500;
}

/* Edit inputs */
.edit-input {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    background: var(--bg);
    color: var(--text);
    box-sizing: border-box;
}

.edit-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(9, 132, 227, 0.2);
}

.edit-input-short {
    width: 70px;
}

.readonly-value {
    color: var(--text-secondary);
    font-style: italic;
}

/* Delete button danger style */
.btn-danger {
    background: var(--red);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-sm.btn-danger {
    background: var(--red);
}

/* Add row action button */
.add-row-action {
    margin-top: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
    body { padding: 0.5rem; }
    .health-grid { grid-template-columns: 1fr; }
    .cb-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .overview-top-row { flex-direction: column; }
    .overview-side-lists { flex: 1 1 auto; flex-direction: column; }
    .charts-row { flex-direction: column; }
    .list-container { flex-basis: auto; }
    .form-row { flex-direction: column; }
    .tabs { gap: 0.25rem; }
    .tab { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
    .opinion-grid { grid-template-columns: repeat(2, 1fr); }
    .integration-stats { grid-template-columns: 1fr; }
    .claim-type-grid { grid-template-columns: repeat(2, 1fr); }
}
