/* Copyright (C) 2026 Al Massaeed - GPL v3 or later
 * Screen styling only. The PDF carries its own, much plainer, inline rules
 * because TCPDF reads almost no CSS.
 */

.cr-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	justify-content: space-between;
	margin: 10px 0 18px;
}

.cr-picker {
	display: flex;
	gap: 6px;
	align-items: center;
}

.cr-picker input[type="date"] {
	padding: 6px 8px;
	font-size: 1em;
}

.cr-range {
	font-weight: 600;
	margin-left: 6px;
}

.cr-exports {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
}

.cr-report h2 {
	margin: 26px 0 6px;
	padding-bottom: 4px;
	border-bottom: 2px solid #14315a;
	font-size: 1.15em;
}

.cr-report h3 {
	margin: 18px 0 6px;
	font-size: 1em;
	opacity: 0.85;
}

.cr-lead {
	margin: 4px 0 10px;
}

.cr-absent {
	padding: 10px 12px;
	border: 1px dashed rgba(128, 128, 128, 0.45);
	border-radius: 6px;
	opacity: 0.7;
}

/* The border attribute on the table is there for TCPDF; on screen the theme's
   own table styling looks better, so take it back off. */
.cr-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 6px;
}

.cr-table,
.cr-table td,
.cr-table th {
	border: 0 !important;
	border-bottom: 1px solid rgba(128, 128, 128, 0.22) !important;
}

.cr-table th,
.cr-table td {
	padding: 6px 8px;
	vertical-align: top;
}

.cr-table .cr-head th {
	background: rgba(128, 128, 128, 0.1);
	font-size: 0.85em;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.cr-table .cr-total td {
	background: rgba(20, 49, 90, 0.06);
}

.cr-warn {
	margin-top: 6px;
	padding: 8px 10px;
	background: #fde2c4;
	color: #7a4708;
	border-radius: 6px;
	font-size: 0.9em;
}

@media (max-width: 760px) {
	.cr-bar {
		flex-direction: column;
		align-items: stretch;
	}

	.cr-report {
		overflow-x: auto;
	}
}

/* ----------------------------------------------------- per-person blocks */

.cr-block {
	margin-bottom: 16px;
}

.cr-table .cr-group th {
	background: #14315a;
	color: #fff;
	font-size: 0.9em;
	letter-spacing: 0.03em;
	padding: 6px 8px;
}

.cr-grand .cr-total td {
	font-size: 1.02em;
}

/* A row that gave something away, so the eye finds it without a second table. */
.cr-table .cr-hasfoc td {
	background: rgba(235, 104, 52, 0.07);
}

.cr-table a {
	color: #14315a;
	text-decoration: underline;
}

/* ------------------------------------------------------------- period bar */

.cr-modes {
	display: inline-flex;
	gap: 4px;
	margin-right: 6px;
}

.cr-mode-on {
	background: #14315a !important;
	color: #fff !important;
	border-color: #14315a !important;
}

.cr-custom {
	display: inline-flex;
	gap: 5px;
	align-items: center;
	margin-left: 8px;
}

.cr-custom input[type="date"] {
	padding: 5px 7px;
}

.cr-note {
	margin: 0 0 14px;
	padding: 8px 11px;
	border-left: 3px solid #14315a;
	background: rgba(20, 49, 90, 0.05);
	font-size: 0.88em;
	opacity: 0.85;
}

/* A month of diaries is hundreds of entries; folded away it stays available
   without burying everything under it. */
.cr-collapse > summary {
	cursor: pointer;
	list-style: revert;
}

.cr-collapse > summary > h2 {
	display: inline-block;
	margin-left: 6px;
}

.cr-count {
	font-weight: 400;
	font-size: 0.8em;
	opacity: 0.6;
}

/* ------------------------------------------------------------ receivables
   The bgcolor attribute on each row is what TCPDF reads. These rules win on
   screen, which is where dark mode gets a say. */

.cr-table tr.rc-late td {
	background: rgba(227, 73, 72, 0.08);
}

.cr-table tr.rc-verylate td {
	background: rgba(227, 73, 72, 0.18);
}

.cr-table tr.rc-nodue td {
	background: rgba(237, 161, 0, 0.16);
}

.cr-table tr.rc-credit td {
	background: rgba(42, 120, 214, 0.08);
}

/* A missing due date is the one that hides, so it is stated, not just tinted. */
.cr-table tr.rc-nodue td strong {
	color: #7a4708;
}

.cr-check {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin-left: 8px;
	font-size: 0.9em;
	white-space: nowrap;
}

.cr-picker select {
	padding: 5px 7px;
	font-size: 0.95em;
}

@media (prefers-color-scheme: dark) {
	.cr-table tr.rc-verylate td {
		background: rgba(230, 103, 103, 0.22);
	}

	.cr-table tr.rc-nodue td {
		background: rgba(201, 133, 0, 0.26);
	}

	.cr-table tr.rc-nodue td strong {
		color: #ffd9a8;
	}
}

/* ------------------------------------------------------------- statement
   Payments read as the relief in a column of debts, so they get a tint of
   their own rather than being told apart by the column they land in. */
.cr-table tr.st-payment td {
	background: rgba(23, 138, 70, 0.07);
}

@media (prefers-color-scheme: dark) {
	.cr-table tr.st-payment td {
		background: rgba(25, 158, 112, 0.14);
	}
}

/* A settled invoice, marked on the row rather than needing a column. */
.st-paid {
	display: inline-block;
	margin-left: 5px;
	padding: 0 5px;
	border-radius: 8px;
	background: rgba(23, 138, 70, 0.15);
	color: #0f6334;
	font-size: 0.75em;
	white-space: nowrap;
}

.cr-summary {
	max-width: 760px;
	margin-top: 14px;
}

.cr-summary td {
	font-size: 1.05em;
}

.cr-note-small {
	font-size: 0.85em;
	opacity: 0.7;
}

@media (prefers-color-scheme: dark) {
	.st-paid {
		background: rgba(25, 158, 112, 0.22);
		color: #8fe3b8;
	}
}

/* The salesperson share of a customer's debt, under the customer's own row. */
.cr-table tr.rc-spsplit td {
	font-size: 0.92em;
	opacity: 0.85;
}

/* Age colouring on the receivables list. The theme styles tr.oddeven td, which
   beats a bgcolor attribute, so these have to be classes and they have to win. */
table.liste tr.rc-late > td { background-color: #fdecec !important; }
table.liste tr.rc-verylate > td { background-color: #f9d6d6 !important; }
table.liste tr.rc-nodue > td { background-color: #fdf0d9 !important; }
table.liste tr.rc-credit > td { background-color: #e8eef7 !important; }

