/* sghtmltopdf doesn't support @layer; Tailwind v4 wraps all output in @layer,
 * so no Tailwind class reaches a PDF. Utilities under app/views/pdf must be
 * hand-declared below or they silently do nothing. Also unsupported: grid, color-mix(). */

/* Page geometry lives here only: Pdf::Renderer passes no page_size/margin options. */
@page {
  size: A4;
  margin: 20mm 15mm 25mm 15mm;

  @bottom-right {
    content: "Page " counter(page) " of " counter(pages);
    font-size: 9pt;
    color: #64748b;
  }
}

html { font-size: 16px; }

@media print {
  .no-print { display: none !important; }
}

.pdf-body {
  font-size: 11pt;
  line-height: 1.5;
  font-family: sans-serif;
  color: #0f172a;
  margin: 0;
}

.pdf-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  page-break-inside: auto;
}

.pdf-content th,
.pdf-content td {
  border: 1px solid #cbd5e1;
  padding: 0.4rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

.pdf-content th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.85rem;
}

.pdf-content tr {
  page-break-inside: avoid;
}

.pdf-content h1 { font-size: 1.35rem; margin-bottom: 0.75rem; }
.pdf-content h2 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }
.pdf-content h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }

.pdf-signature-block {
  margin-top: 3rem;
  page-break-inside: avoid;
}

.pdf-category-subtotal td {
  font-weight: 600;
  background: #f1f5f9;
}

.pdf-content thead { display: table-header-group; }
.pdf-content tfoot { display: table-footer-group; }

/* layout */
.flex { display: flex; }
.flex-1 { flex: 1 1 0%; }
.shrink-0 { flex-shrink: 0; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-6 { gap: 1.5rem; }
.min-w-0 { min-width: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.max-w-4xl { max-width: 56rem; }
.max-w-none { max-width: none; }
.text-center { text-align: center; }

/* spacing */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-8 { margin-bottom: 2rem; }
.p-3 { padding: 0.75rem; }
.pl-5 { padding-left: 1.25rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }
.pb-6 { padding-bottom: 1.5rem; }
.px-0 { padding-left: 0; padding-right: 0; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

/* type */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.025em; }
.leading-relaxed { line-height: 1.625; }
.list-decimal { list-style-type: decimal; }

/* colour */
.text-slate-500 { color: #64748b; }
.text-slate-600 { color: #475569; }
.text-slate-900 { color: #0f172a; }
.text-amber-900 { color: #78350f; }
.bg-white { background-color: #ffffff; }
.bg-amber-50 { background-color: #fffbeb; }

/* borders */
.border { border: 1px solid #cbd5e1; }
.border-t { border-top: 1px solid #cbd5e1; }
.border-b { border-bottom: 1px solid #cbd5e1; }
.border-slate-200 { border-color: #e2e8f0; }
.border-slate-300 { border-color: #cbd5e1; }
.border-amber-300 { border-color: #fcd34d; }
.rounded { border-radius: 0.25rem; }

.pdf-letterhead img {
  max-height: 4rem;
  max-width: 160px;
  object-fit: contain;
}

.prose > p { margin: 0.75rem 0; }
.prose > h1 { font-size: 1.35rem; margin: 0 0 0.75rem; }
.prose > h2 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }
.prose > h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }
.prose > ul,
.prose > ol { margin: 0.75rem 0; padding-left: 1.25rem; }
.prose li { margin: 0.25rem 0; }
.prose-sm { font-size: 0.925rem; }
