.tp-results-dashboard {
    --tp-font-size-base: 14px;
    --tp-font-size-title: 1.4em;
    --tp-font-size-heading: 1.1em;
    --tp-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    font-family: var(--tp-font-family);
    font-size: var(--tp-font-size-base);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    background: #ffffff;
    color: #222222;
}

.tp-results-dashboard.tp-results-theme-dark {
    background: #121212;
    color: #f0f0f0;
    border-color: #333;
}

.tp-results-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.tp-results-title {
    font-size: var(--tp-font-size-title);
    margin: 0;
}

.tp-results-dashboard h3 {
    font-size: var(--tp-font-size-heading);
    margin-top: 0;
}

.tp-results-theme-toggle {
    border-radius: 4px;
    border: 1px solid #ccc;
    padding: 4px 10px;
    background: #f5f5f5;
    cursor: pointer;
}

.tp-results-theme-dark .tp-results-theme-toggle {
    background: #333;
    border-color: #555;
    color: #f0f0f0;
}

/* Intro & disclaimer */
.tp-results-intro,
.tp-results-disclaimer {
    margin-bottom: 16px;
}

/* Filters card */
.tp-results-filters-card {
    border-radius: 6px;
    border: 1px solid #ddd;
    margin-bottom: 12px;
    overflow: hidden;
}

.tp-results-theme-dark .tp-results-filters-card {
    border-color: #444;
}

.tp-results-filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f5f5f5;
}

.tp-results-theme-dark .tp-results-filters-header {
    background: #1e1e1e;
}

.tp-results-filters-actions {
    display: flex;
    gap: 8px;
}

.tp-results-filters-body {
    padding: 8px 12px 12px;
}

.tp-results-filters-card.is-collapsed .tp-results-filters-body {
    display: none;
}

.tp-results-filter-table {
    width: 100%;
    border-collapse: collapse;
}

.tp-results-filter-table th,
.tp-results-filter-table td {
    padding: 4px 8px;
    vertical-align: top;
}

.tp-results-filter-table th {
    width: 180px;
    text-align: left;
    font-weight: 600;
}

.tp-results-filter-table select {
    min-width: 200px;
    max-width: 100%;
}

.tp-results-filter-help {
    margin-top: 4px;
}

/* Filter summary bar */
.tp-results-filter-summary {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #f9f9f9;
    border: 1px solid #eee;
    padding: 6px 10px;
    margin-bottom: 12px;
    border-radius: 4px;
    font-size: 0.9em;
}

.tp-results-theme-dark .tp-results-filter-summary {
    background: #1b1b1b;
    border-color: #333;
}

/* Selection table container (layout A) */
.tp-results-selection-table-container {
    border-radius: 6px;
    border: 1px solid #ddd;
    padding: 8px 12px 12px;
    margin-bottom: 16px;
    background: #fafafa;
}

.tp-results-theme-dark .tp-results-selection-table-container {
    border-color: #444;
    background: #181818;
}

.tp-results-selection-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}

/* Stats */
.tp-results-summary p {
    margin: 4px 0;
}

.tp-results-method-table {
    border-collapse: collapse;
    margin-top: 8px;
    width: 100%;
    max-width: 400px;
}

.tp-results-method-table th,
.tp-results-method-table td {
    border: 1px solid #ddd;
    padding: 4px 6px;
    text-align: left;
}

.tp-results-theme-dark .tp-results-method-table th,
.tp-results-theme-dark .tp-results-method-table td {
    border-color: #444;
}

/* Charts */
.tp-results-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.tp-results-chart-container {
    border-radius: 6px;
    border: 1px solid #ddd;
    padding: 8px 12px 12px;
    background: #fafafa;
}

.tp-results-theme-dark .tp-results-chart-container {
    background: #181818;
    border-color: #333;
}

.tp-results-chart-wide {
    grid-column: 1 / -1;
}

.tp-results-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

/* Modal (voor vergroote grafieken) */
.tp-results-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.tp-results-modal.is-open {
    display: flex;
}

.tp-results-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.tp-results-modal-dialog {
    position: relative;
    background: #ffffff;
    border-radius: 6px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.tp-results-theme-dark .tp-results-modal-dialog {
    background: #181818;
    color: #f0f0f0;
}

.tp-results-modal-large {
    max-width: 1100px;
}

.tp-results-modal-header {
    padding: 8px 12px;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tp-results-theme-dark .tp-results-modal-header {
    border-color: #333;
}

.tp-results-modal-body {
    padding: 12px;
    overflow: auto;
}

.tp-results-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

/* Ruling table */
.tp-results-ruling-list {
    overflow: auto;
    max-height: 320px;
}

.tp-results-ruling-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}

.tp-results-ruling-table th,
.tp-results-ruling-table td {
    border: 1px solid #ddd;
    padding: 3px 5px;
    text-align: left;
    vertical-align: top;
}

.tp-results-ruling-table thead {
    background: #f0f0f0;
}

.tp-results-theme-dark .tp-results-ruling-table th,
.tp-results-theme-dark .tp-results-ruling-table td {
    border-color: #444;
}

.tp-results-theme-dark .tp-results-ruling-table thead {
    background: #222;
}

.tp-results-ruling-table tr:nth-child(even) {
    background: #fbfbfb;
}

.tp-results-theme-dark .tp-results-ruling-table tr:nth-child(even) {
    background: #202020;
}

/* Markeer uitschieters */
.tp-results-ruling-table tr.tp-outlier {
    background: #ffecec;
}

.tp-results-theme-dark .tp-results-ruling-table tr.tp-outlier {
    background: #4a1a1a;
}

/* Multiselect */
.tp-multiselect {
    position: relative;
    display: inline-block;
    min-width: 220px;
}

.tp-multiselect-display {
    border: 1px solid #ccc;
    padding: 4px 8px;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.tp-results-theme-dark .tp-multiselect-display {
    background: #222;
    border-color: #555;
}

.tp-multiselect.is-open .tp-multiselect-dropdown {
    display: true;
}

.tp-multiselect-dropdown {
    display: none;
    position: absolute;
    z-index: 20;
    top: calc(100% + 2px);
    left: 0;
    min-width: 240px;
    max-height: 260px;
    overflow: auto;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.tp-results-theme-dark .tp-multiselect-dropdown {
    background: #181818;
    border-color: #555;
}

.tp-multiselect-actions {
    padding: 6px;
    border-bottom: 1px solid #eee;
}

.tp-results-theme-dark .tp-multiselect-actions {
    border-color: #333;
}

.tp-multiselect-search {
    width: 100%;
    margin-bottom: 4px;
}

.tp-multiselect-actions-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
}

.tp-multiselect-option {
    display: flex;
    align-items: center;
    padding: 2px 6px;
    cursor: pointer;
}

.tp-multiselect-option:hover {
    background: #f0f0f0;
}

.tp-results-theme-dark .tp-multiselect-option:hover {
    background: #222;
}

.tp-multiselect-option input[type="checkbox"] {
    margin-right: 6px;
}

.tp-filter-empty {
    font-size: 0.9em;
    color: #666;
}

/* Heatmap table */
.tp-results-heatmap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}

.tp-results-heatmap-table th,
.tp-results-heatmap-table td {
    border: 1px solid #ddd;
    padding: 4px 6px;
    text-align: center;
    min-width: 40px;
}

.tp-results-heatmap-table th:first-child,
.tp-results-heatmap-table td:first-child {
    text-align: left;
    font-weight: 600;
}

.tp-results-theme-dark .tp-results-heatmap-table th,
.tp-results-theme-dark .tp-results-heatmap-table td {
    border-color: #444;
}

/* Heatmap tabs voor Methode × PLI per activiteit */
.tp-heatmap-tabs {
    margin-top: 4px;
}

.tp-heatmap-tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.tp-heatmap-tab-button {
    border: 1px solid #ccc;
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}

.tp-results-theme-dark .tp-heatmap-tab-button {
    background: #222;
    border-color: #555;
    color: #f0f0f0;
}

.tp-heatmap-tab-button.is-active {
    font-weight: 600;
    box-shadow: 0 0 0 1px #999 inset;
}

.tp-heatmap-tab-panels {
    border-top: 1px solid #ddd;
    padding-top: 6px;
}

.tp-results-theme-dark .tp-heatmap-tab-panels {
    border-color: #333;
}

.tp-heatmap-tab-panel {
    display: none;
}

.tp-heatmap-tab-panel.is-active {
    display: block;
}

/* Responsive tweaks */
@media (max-width: 600px) {
    .tp-results-filter-table th {
        width: 120px;
    }
    .tp-results-filter-table select {
        min-width: 160px;
    }
}

.tp-results-modal-xlarge {
    max-width: 1200px;
    width: 95%;
}

.tp-results-selection-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.tp-results-ruling-list-modal {
    max-height: 70vh;
    overflow: auto;
}

.tp-results-ruling-table {
    min-width: 1100px;
}
