.reports-workspace, .checks-report-page, .report-document {
    --report-chart-ink: color-mix(in srgb, var(--accent-primary) 83%, var(--text-primary));
    --report-chart-fill: color-mix(in srgb, var(--accent-secondary) 24%, transparent);
    --report-panel-radius: .7rem;
    max-width: 90rem;
    margin-inline: auto;
}
.report-panel {
    min-width: 0;
    padding: clamp(.85rem, 1.4vw, 1.1rem);
    border: 1px solid var(--border-color);
    border-radius: var(--report-panel-radius);
    background: var(--bg-surface);
}
.report-panel :is(h2, h3) { margin: 0 0 .5rem; font-size: 1.13rem; }
.report-panel p { margin-block: .35rem .65rem; }
.report-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .75rem; }
.report-kpi {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    padding: .8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--report-panel-radius);
    background: var(--bg-surface);
    color: var(--text-primary);
    text-align: start;
    text-decoration: none;
}
:is(a, button).report-kpi:hover { border-color: var(--accent-primary); background: var(--bg-hover); }
.report-kpi > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.report-kpi strong { display: block; font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.report-kpi small { display: block; margin-top: .15rem; color: var(--text-secondary); }
.report-icon-tile {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 2.65rem;
    height: 2.65rem;
    border-radius: .6rem;
    color: var(--report-chart-ink);
    background: color-mix(in srgb, var(--accent-secondary) 17%, var(--bg-surface));
}
.report-icon-tile .workspace-icon { width: 1.45rem; height: 1.45rem; }
.report-icon-warning { color: var(--warning); background: color-mix(in srgb, var(--warning) 15%, var(--bg-surface)); }
.report-title-icon, .report-icon-button { display: inline-flex; align-items: center; gap: .6rem; }
.report-icon-button .workspace-icon { width: 1.12rem; height: 1.12rem; }
.report-data-scroll { max-width: 100%; min-width: 0; overflow-x: auto; }
.report-compact-table { width: 100%; border-collapse: collapse; text-align: start; }
.report-compact-table :is(th, td) { padding: .55rem .65rem; border-bottom: 1px solid var(--border-color); vertical-align: top; }
.report-compact-table thead { background: var(--bg-hover); }
.report-compact-table tbody tr:last-child > * { border-bottom: 0; }
.report-state { display: inline-block; white-space: nowrap; padding: .15rem .48rem; border-radius: .4rem; font-size: .8rem; font-weight: 650; }
.report-state-danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--bg-surface)); }
.report-state-warning { color: var(--warning); background: color-mix(in srgb, var(--warning) 15%, var(--bg-surface)); }
.report-document .report-sheet {
    background: var(--pm-surface, white);
    border: 1px solid var(--pm-border, #dbe1e8);
    border-radius: .75rem;
    padding: clamp(.85rem, 2vw, 1.5rem);
}
.report-document .report-sheet header p { margin: .25rem 0 .7rem; }
.report-document .report-table-wrap { margin: .75rem 0; overflow-x: auto; }
.report-document .report-table { width: 100%; border-collapse: collapse; text-align: left; }
.report-document .report-table caption { caption-side: top; font-weight: 700; padding-block: .4rem; }
.report-document .report-table :is(th, td) {
    padding: .55rem;
    border-bottom: 1px solid var(--pm-border, #dbe1e8);
    overflow-wrap: anywhere;
    vertical-align: top;
}
.report-document .report-table th span { display: block; font-weight: normal; }
.report-document .report-table thead th { background: var(--pm-surface-alt, #eff3f9); }
.report-metrics { display: flex; flex-wrap: wrap; gap: .65rem; margin-block: .8rem 1.25rem; }
.report-metrics div { flex: 1 1 9.5rem; padding: .7rem; border: 1px solid var(--border-color); border-radius: var(--report-panel-radius); }
.report-metrics dt { display: flex; align-items: center; gap: .45rem; font-size: .85rem; }
.report-metrics .report-icon-tile { width: 1.9rem; height: 1.9rem; }
.report-metrics .workspace-icon { width: 1.15rem; height: 1.15rem; }
.report-metrics dd { margin: .35rem 0 0; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.report-chart { list-style: none; margin: .5rem 0; padding: 0; max-width: 48rem; }
.report-chart li { display: grid; grid-template-columns: 3rem minmax(2rem, 1fr) minmax(10rem, auto); gap: .6rem; align-items: center; }
.report-chart meter { width: 100%; }
.report-document :is(.report-chart, .report-months) meter::-webkit-meter-bar { background: var(--bg-hover); border: 0; }
.report-document :is(.report-chart, .report-months) meter::-webkit-meter-optimum-value { background: var(--report-chart-ink); }
.report-document :is(.report-chart, .report-months) meter::-moz-meter-bar { background: var(--report-chart-ink); }
@media print {
    @page magrathea-report {
        size: A4 portrait;
        margin: 12mm;
        @bottom-right {
            content: "Page " counter(page) " of " counter(pages);
            font: 8pt system-ui;
            color: #354258;
        }
    }
    html:has(.printable-report) { page: magrathea-report; }
    .app-shell:has(.printable-report), .app-main:has(.printable-report), .app-content:has(.printable-report) {
        display: block;
        padding: 0;
        margin: 0;
        min-height: 0;
        background: white !important;
        color: #151515;
    }
    .app-shell:has(.printable-report) > :not(.app-main),
    .app-main:has(.printable-report) > :not(.app-content),
    body:has(.printable-report) .skip-to-content {
        display: none !important;
    }
    .report-document:not(.printable-report), .report-document .report-controls { display: none !important; }
    .report-document .report-sheet { color: #151515; background: white; padding: 0; border: 0; }
    .report-document .report-table-wrap { overflow: visible; }
    .report-document .report-table { font-size: 9pt; }
    .report-document :is(header, .report-metrics, .report-chart li, .report-table tr) { break-inside: avoid; }
    .report-document .report-table thead { display: table-header-group; }
    .report-document .report-table thead th { overflow-wrap: normal; }
    .report-document .report-table :is(th, td) { padding: 2mm; }
    :is(.reports-workspace, .checks-report-page, .report-document) {
        --report-chart-ink: #164780;
        --report-chart-fill: #d9e8f7;
        --bg-surface: #fff;
        --bg-hover: #eef2f7;
        --text-primary: #151515;
        --text-secondary: #404040;
        --border-color: #c8c8c8;
    }
    .report-kpi, .report-panel, .report-compact-table tr { break-inside: avoid; }
    .report-compact-table thead { display: table-header-group; }
    .report-data-scroll { overflow: visible; }
}
