/*
 * Stratum Client Report — Backend Styles
 *
 * Summary-level billing report: Client → Project table with subtotals.
 * Uses Contao CSS custom properties for automatic light/dark mode.
 */

/* ── Filter summary bar ─────────────────────────────────────────── */

.stratum-cr-filter-summary {
    padding: 8px 14px;
    margin-bottom: 14px;
    background: var(--panel-bg);
    border: 1px solid var(--content-border);
    border-radius: var(--border-radius);
    font-size: 0.82rem;
    color: var(--text);
    line-height: 1.6;
}

/* ── Report table ───────────────────────────────────────────────── */

.stratum-cr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    color: var(--text);
}

.stratum-cr-table thead th {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--gray, #888);
    white-space: nowrap;
}

.stratum-cr-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

/* Column widths and alignment */

.cr-col-client { min-width: 160px; }
.cr-col-project { min-width: 200px; }
.cr-col-status { width: 80px; }
.cr-col-type { width: 100px; }

.cr-col-rate,
.cr-col-hours,
.cr-col-fees {
    text-align: right;
    white-space: nowrap;
}

th.cr-col-rate,
th.cr-col-hours,
th.cr-col-fees {
    text-align: right;
}

.cr-col-rate { width: 80px; }
.cr-col-hours { width: 70px; }
.cr-col-fees { width: 90px; }

/* ── Project rows ───────────────────────────────────────────────── */

.cr-row-project td {
    color: var(--text);
}

/* ── Subtotal rows (per client) ─────────────────────────────────── */

.cr-row-subtotal td {
    border-bottom: 1px solid var(--border);
    background: var(--table-even, #f8f8f8);
    padding-top: 6px;
    padding-bottom: 6px;
}

.cr-row-subtotal .cr-col-client {
    font-weight: 700;
}

/* Spacing between client groups */
.cr-row-subtotal + .cr-row-project td {
    padding-top: 14px;
}

/* ── Retainer drawdown row (retainer clients only) ──────────────── */
.cr-row-retainer td {
    background: var(--table-even, #f8f8f8);
    border-bottom: 1px solid var(--border);
    color: var(--gray);
    font-size: 0.85em;
    padding-top: 4px;
    padding-bottom: 6px;
}

.cr-retainer-detail {
    margin-left: 6px;
}

/* Over the allowance — red so an overrun is obvious when scanning. */
.cr-row-retainer.is-over td {
    color: var(--red, #c1272d);
    font-weight: 600;
}

/* Keep the group gap correct when a retainer row follows the subtotal */
.cr-row-retainer + .cr-row-project td {
    padding-top: 14px;
}

/* ── Grand total row ────────────────────────────────────────────── */

.cr-row-total td {
    border-top: 2px solid var(--border);
    border-bottom: none;
    font-weight: 700;
    font-size: 0.9rem;
    padding-top: 10px;
}

/* ── Print styles ───────────────────────────────────────────────── */

@media print {
    .content-filter,
    .operations,
    .stratum-cr-filter-summary {
        display: none !important;
    }

    .stratum-client-report > .content-inner {
        padding: 0;
    }

    .stratum-cr-table {
        font-size: 11px;
    }

    .cr-row-subtotal td {
        background: #f5f5f5 !important;
    }

    tr {
        page-break-inside: avoid;
    }
}
