@page {
  size: A4 landscape;
  margin: 11mm 10mm 11mm;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: #132e50;
  font: 9pt/1.2 Arial, Helvetica, sans-serif;
}

.print-actions {
  width: min(297mm, 100%);
  margin: 0 auto;
  padding: 12px 10mm;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.print-actions a { color: #174582; text-decoration: none; }
.print-actions button {
  border: 0;
  border-radius: 4px;
  background: #174582;
  color: #fff;
  padding: 9px 15px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.delegation-document { position: relative; width: 297mm; min-height: 210mm; padding: 11mm 10mm 20mm; }
.delegation-document-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4mm;
  margin-bottom: 5mm;
}
.delegation-document-header img { display: block; width: auto; height: 22mm; }
.delegation-document-header p { margin: 0; }
.delegation-organization { color: #123e70; font-size: 8.5pt; font-weight: 700; letter-spacing: .02em; }
.delegation-document-header h1 { margin: 1.5mm 0 1mm; color: #103865; font-size: 19pt; line-height: 1.05; }
.delegation-document-meta { color: #405a77; font-size: 9.5pt; }
.delegation-document-period { padding-left: 4mm; border-left: 1px solid #aac1db; white-space: nowrap; }
.delegation-document-period span, .delegation-document-period strong { display: block; }
.delegation-document-period span { color: #506985; font-size: 8pt; }
.delegation-document-period strong { margin-top: .7mm; color: #103865; font-size: 10pt; }

.delegation-print-group { margin-bottom: 4mm; }
.delegation-print-group h2 {
  margin: 0 0 1.5mm;
  padding: 1.6mm 2.5mm;
  border-left: 2mm solid #ffc52e;
  background: #123e70;
  color: #fff;
  font-size: 9.5pt;
  line-height: 1.1;
  break-after: avoid;
  page-break-after: avoid;
}
.public-round-bye { margin: 2mm 1.1mm 0; padding-top: 1.5mm; border-top: 1px solid #cbdced; color: #506985; font-size: 9pt; }
.public-round-bye strong { color: #103865; }
.delegation-print-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 8.5pt; line-height: 1.18; }
.delegation-print-table thead { display: table-header-group; break-after: avoid; page-break-after: avoid; }
.delegation-print-table tr { break-inside: avoid; page-break-inside: avoid; }
.delegation-print-table th, .delegation-print-table td {
  padding: 1.35mm 1.1mm;
  border: 1px solid #cbdced;
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}
.delegation-print-table thead th { background: #dcecff; color: #123e70; font-weight: 700; }
.delegation-print-table tbody tr:nth-child(even) { background: #f6faff; }
.delegation-print-table .delegation-club { font-weight: 700; }
.delegation-row-number, .delegation-date, .delegation-time { text-align: center !important; white-space: nowrap; }
.delegation-row-number { font-weight: 700; }
.delegation-note { white-space: pre-line; }
.col-number { width: 3%; }
.col-home { width: 14%; }
.col-away { width: 15%; }
.col-delegate { width: 11.5%; }
.col-referee { width: 10.5%; }
.col-date { width: 7.5%; }
.col-time { width: 5.5%; }
.col-venue { width: 12%; }
.col-note { width: 10.5%; }
.delegation-not-delegated {
  display: inline-block;
  padding: .7mm 1.2mm;
  border-radius: 1mm;
  background: #fce2e7;
  color: #b41735;
  font-size: 7.5pt;
  font-weight: 700;
  white-space: nowrap;
}
.delegation-pending-term-cell { text-align: center !important; }
.delegation-pending-term { color: #245985; font-weight: 700; }
.delegation-known-term { margin-left: 2mm; color: #506985; }

.delegation-signatories {
  display: flex;
  justify-content: space-between;
  gap: 8mm;
  margin-top: 6mm;
  padding: 3mm 3mm 0;
  border-top: 1px solid #7899be;
  break-inside: avoid;
  page-break-inside: avoid;
}
.delegation-signatories p { min-width: 43mm; margin: 0; }
.delegation-signatories span, .delegation-signatories strong { display: block; }
.delegation-signatories span { color: #506985; font-size: 8pt; }
.delegation-signatories strong { margin-top: .7mm; color: #103865; font-size: 9pt; }
.delegation-preview-footer { position: absolute; right: 0; bottom: 5mm; left: 0; margin: 0; color: #6a84a0; font-size: 7.5pt; text-align: center; }

@media screen {
  body { background: #f3f5f8; }
  .delegation-document { display: flex; flex-direction: column; }
  .delegation-signatories { margin-top: auto; }
  .print-sheet {
    margin: 20px auto 40px;
    background: #fff;
    border: 1px solid #e0e4ea;
    box-shadow: 0 10px 28px rgb(27 43 65 / 9%);
  }
}

@media print {
  body { background: none; }
  .print-actions { display: none !important; }
  .delegation-preview-footer { display: none; }
  .delegation-print-group { break-inside: avoid; break-inside: avoid-page; page-break-inside: avoid; }
  .delegation-print-group h2 { break-after: avoid; break-after: avoid-page; }
  .delegation-print-table tbody tr:first-child { break-before: avoid; page-break-before: avoid; }
  .delegation-signatories { break-before: avoid; page-break-before: avoid; }
  .delegation-print-group h2, .delegation-print-table thead th,
  .delegation-print-table tbody tr:nth-child(even), .delegation-not-delegated {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-sheet {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
  }
}
