/*
 * TEG-VETCLINIC - printable documents: the invoice, the estimate, the record
 * summary, the discharge sheet and the vaccination certificate. One page, one
 * accent colour taken from the settings, and a toolbar that never prints.
 *
 * The staff screens print through TVC_Helpers::print_page_start(), which
 * wraps a plain <table class="widefat"> in the same shell, so that is styled
 * here too - otherwise half the practice's printouts would come out looking
 * like a different practice.
 */

:root { color-scheme: light; }

* { box-sizing: border-box; }

body.tvc-doc {
	--tvc-accent: #14707f;
	--tvc-ink: #2b3440;
	--tvc-muted: #6f7a89;
	--tvc-line: #e3ddd0;
	--tvc-red: #c0392b;
	--tvc-red-soft: #fbeceb;
	--tvc-amber: #b45309;
	margin: 0;
	background: #efeae0;
	color: var(--tvc-ink);
	font: 14px/1.5 -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

body.tvc-doc.tvc-font-serif { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; }

.tvc-page {
	max-width: 820px;
	margin: 24px auto;
	background: #fff;
	padding: 36px 44px;
	border-radius: 8px;
	box-shadow: 0 1px 4px rgba(43, 52, 64, .1);
	position: relative;
}

.tvc-toolbar { margin: -20px 0 16px; text-align: right; }

.tvc-toolbar button {
	font: inherit;
	padding: 6px 16px;
	border-radius: 6px;
	border: 1px solid var(--tvc-accent);
	background: var(--tvc-accent);
	color: #fff;
	cursor: pointer;
}

.tvc-toolbar a { margin-left: 12px; color: var(--tvc-accent); }

/* ── the letterhead ─────────────────────────────────────────────────── */

.tvc-head {
	display: flex;
	justify-content: space-between;
	gap: 24px;
	border-bottom: 3px solid var(--tvc-accent);
	padding-bottom: 14px;
	margin-bottom: 20px;
}

.tvc-head-practice { display: flex; align-items: center; gap: 16px; }
.tvc-logo { max-height: 68px; max-width: 220px; object-fit: contain; }
.tvc-practice-name { font-size: 21px; font-weight: 700; color: var(--tvc-accent); line-height: 1.2; }
.tvc-muted { color: var(--tvc-muted); font-size: 13px; }
.tvc-small { font-size: 12px; }
.tvc-red { color: var(--tvc-red); }

/* The out-of-hours line is the one thing in the letterhead worth a colour. */
.tvc-emerg { color: var(--tvc-red); font-weight: 600; }

.tvc-head-doc { text-align: right; }
.tvc-doctitle { font-size: 24px; font-weight: 800; letter-spacing: .08em; }
.tvc-meta { margin-top: 6px; border-collapse: collapse; font-size: 13px; margin-left: auto; }
.tvc-meta th { text-align: left; color: var(--tvc-muted); padding: 1px 14px 1px 0; font-weight: 600; }
.tvc-meta td { padding: 1px 0; text-align: right; }

/* ── who it is for ──────────────────────────────────────────────────── */

.tvc-parties { display: flex; gap: 32px; margin-bottom: 18px; }
.tvc-parties > div { flex: 1; }

.tvc-label {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .09em;
	text-transform: uppercase;
	color: var(--tvc-muted);
	margin: 10px 0 4px;
}

.tvc-doc-h { font-size: 18px; margin: 18px 0 8px; color: var(--tvc-accent); }
.tvc-sec-h { font-size: 15px; margin: 22px 0 6px; color: var(--tvc-accent); border-bottom: 1px solid var(--tvc-line); padding-bottom: 4px; }

/* ── the lines ──────────────────────────────────────────────────────── */

.tvc-lines,
body.tvc-doc table.widefat { width: 100%; border-collapse: collapse; margin: 18px 0 6px; }

.tvc-lines th,
body.tvc-doc table.widefat th {
	text-align: left;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .05em;
	color: var(--tvc-muted);
	border-bottom: 2px solid var(--tvc-ink);
	padding: 6px 8px;
}

.tvc-lines td,
body.tvc-doc table.widefat td { padding: 7px 8px; border-bottom: 1px solid var(--tvc-line); vertical-align: top; }

.tvc-lines .num,
body.tvc-doc .num { text-align: right; white-space: nowrap; }

.tvc-lines tfoot td,
body.tvc-doc table.widefat tfoot th { border-bottom: none; padding: 4px 8px; }
.tvc-lines tfoot tr.tvc-total td { font-weight: 700; font-size: 16px; border-top: 2px solid var(--tvc-ink); }
.tvc-lines tfoot tr.tvc-balance td { background: #fdf0dd; }
.tvc-lines tr.tvc-optional td { color: var(--tvc-muted); }

.tvc-facts { border-collapse: collapse; margin: 6px 0 14px; }
.tvc-facts th { text-align: left; color: var(--tvc-muted); font-weight: 600; padding: 3px 18px 3px 0; white-space: nowrap; vertical-align: top; }
.tvc-facts td { padding: 3px 0; vertical-align: top; }

.tvc-plain { margin: 6px 0 0 18px; }
.tvc-plain li { margin-bottom: 4px; }

.tvc-notes { background: #f7f4ee; padding: 10px 14px; border-radius: 6px; }
.tvc-sign { margin-top: 26px; }

/* ── the one red thing on a clinical sheet ──────────────────────────── */

.tvc-red-band {
	border: 2px solid var(--tvc-red);
	background: var(--tvc-red-soft);
	color: #8a1f11;
	border-radius: 6px;
	padding: 10px 14px;
	margin: 0 0 16px;
}

.tvc-red-band p { margin: 0 0 4px; }
.tvc-red-band p:last-child { margin-bottom: 0; }

.tvc-due-overdue { color: var(--tvc-red); font-weight: 700; }
.tvc-due-due_soon { color: var(--tvc-amber); font-weight: 600; }

/* ── a consultation on the record sheet ─────────────────────────────── */

.tvc-visit {
	border-left: 3px solid var(--tvc-line);
	padding: 2px 0 2px 14px;
	margin: 0 0 16px;
}

.tvc-visit p { margin: 4px 0; }
.tvc-visit-when { font-weight: 700; color: var(--tvc-accent); }

/* ── the vaccination certificate ────────────────────────────────────── */

.tvc-cert-title {
	font-size: 22px;
	letter-spacing: .04em;
	text-transform: uppercase;
	text-align: center;
	margin: 6px 0 18px;
	color: var(--tvc-accent);
}

.tvc-cert-table td { font-size: 13px; }
.tvc-batch { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }

/* The microchip is what somebody checks the animal against, so it is legible. */
.tvc-chip {
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
	font-size: 13px;
	margin-top: 2px;
}

.tvc-cert-sign { margin-top: 26px; }
.tvc-sign-row { display: flex; gap: 28px; margin-top: 18px; }
.tvc-sign-row > div { flex: 1; }
.tvc-sign-line { border-bottom: 1px solid var(--tvc-ink); padding-bottom: 2px; min-height: 22px; }
.tvc-cert-sign .tvc-label { margin: 4px 0 0; }

/* ── the footer and the stamp ───────────────────────────────────────── */

.tvc-foot {
	margin-top: 28px;
	border-top: 1px solid var(--tvc-line);
	padding-top: 12px;
	color: var(--tvc-muted);
	font-size: 12px;
}

.tvc-stamp {
	position: absolute;
	top: 42px;
	right: 44px;
	transform: rotate(-12deg);
	font-size: 32px;
	font-weight: 900;
	letter-spacing: .1em;
	padding: 6px 18px;
	border: 4px solid;
	border-radius: 8px;
	opacity: .85;
}

.tvc-stamp-ok { color: #1f5745; border-color: #1f5745; }
.tvc-stamp-void { color: var(--tvc-red); border-color: var(--tvc-red); }

body.tvc-doc h1 { font-size: 20px; color: var(--tvc-accent); margin: 0 0 10px; }

@media print {
	body.tvc-doc { background: #fff; }
	.tvc-page { margin: 0; max-width: none; box-shadow: none; border-radius: 0; padding: 12mm 14mm; }
	.tvc-noprint { display: none !important; }
	.tvc-visit { break-inside: avoid; }
	.tvc-cert-sign { break-inside: avoid; }
}

/* Payments received and Ways to pay (payment methods) */
.tvc-payments, .tvc-ways-to-pay { margin: 14px 0; }
.tvc-payments h3, .tvc-ways-to-pay h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 6px; }
.tvc-received { border-collapse: collapse; }
.tvc-received td { padding: 2px 16px 2px 0; }
.tvc-received .num { text-align: right; }
.tvc-ways-to-pay ul { margin: 0; padding-left: 18px; }
