/* ==========================================================================
   TSG Trip CRM - shared table-export (Print PDF) template
   One layout for every table export: Header band -> Title block -> Table ->
   Footer. Built by renderTsgPrintDocument() in app.js; presentation only.
   Display font: "Archivo Black" (Google Fonts link in index.html) with the
   self-hosted RBNo3.1 Black as an offline fallback. Body: Montserrat.
   ========================================================================== */
@font-face {
  font-family: "TSG Display Fallback";
  src: url("fonts/RBNo3.1-Black.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}

@page {
  size: A4 landscape;
  margin: 0.45in;
}

.tsgp {
  --tsgp-teal: #0b3545;
  --tsgp-ink: #0b2f3c;
  --tsgp-lime: #c8f31d;
  --tsgp-cyan: #12dfe6;
  --tsgp-magenta: #ef3fc8;
  --tsgp-orange: #e8692a;
  --tsgp-border: #d9d4cc;
  --tsgp-divider: #e6e1d9;
  --tsgp-zebra: #f7f5f1;
  --tsgp-muted: #5b6f77;
  --tsgp-empty: #a9b3b6;
  --tsgp-display: "Archivo Black", "TSG Display Fallback", "Montserrat", Arial, sans-serif;
  background: #fff;
  box-sizing: border-box;
  color: var(--tsgp-ink);
  display: flex;
  flex-direction: column;
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
  gap: 22px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  width: 100%;
}
.tsgp *, .tsgp *::before, .tsgp *::after { box-sizing: border-box; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* ---- 1) Header band ---- */
.tsgp-header {
  align-items: center;
  background: var(--tsgp-teal);
  border-bottom: 4px solid var(--tsgp-lime);
  display: flex;
  justify-content: space-between;
  padding: 18px 24px;
}
.tsgp-brand { align-items: center; display: flex; gap: 16px; }
.tsgp-brand img { display: block; height: 40px; width: auto; }
.tsgp-brand-divider { background: rgba(255, 255, 255, .25); flex: 0 0 1px; height: 34px; width: 1px; }
.tsgp-brand-text { display: flex; flex-direction: column; gap: 5px; }
.tsgp-brand-kicker { color: var(--tsgp-lime); font-size: 9px; font-weight: 700; letter-spacing: .22em; line-height: 1; text-transform: uppercase; }
.tsgp-brand-name { color: #fff; font-family: var(--tsgp-display); font-size: 20px; font-weight: 400; line-height: 1; text-transform: uppercase; }
.tsgp-generated { display: flex; flex-direction: column; gap: 5px; text-align: right; }
.tsgp-generated span { color: #9fb6bf; font-size: 8.5px; font-weight: 700; letter-spacing: .22em; line-height: 1; text-transform: uppercase; }
.tsgp-generated strong { color: #fff; font-size: 11px; font-weight: 600; line-height: 1; }

/* ---- 2) Title block ---- */
.tsgp-title { align-items: flex-end; display: flex; gap: 24px; justify-content: space-between; }
.tsgp-title-left { align-items: flex-start; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tsgp-report-label {
  align-items: center;
  border: 1.5px solid var(--tsgp-teal);
  color: var(--tsgp-teal);
  display: inline-flex;
  font-size: 9px;
  font-weight: 700;
  gap: 8px;
  letter-spacing: .24em;
  line-height: 1;
  padding: 5px 10px;
  text-transform: uppercase;
}
.tsgp-report-label::before { background: var(--tsgp-orange); content: ""; display: block; flex: 0 0 7px; height: 7px; width: 7px; }
.tsgp-trip { color: var(--tsgp-teal); font-family: var(--tsgp-display); font-size: 30px; font-weight: 400; line-height: 1; margin: 0; text-transform: uppercase; }
.tsgp-meta { background: #fff; border: 1px solid var(--tsgp-border); display: flex; flex: 0 0 auto; }
.tsgp-meta-cell { border-top: 3px solid var(--tsgp-lime); padding: 9px 18px; }
.tsgp-meta-cell + .tsgp-meta-cell { border-left: 1px solid var(--tsgp-border); border-top-color: var(--tsgp-cyan); }
.tsgp-meta-cell span { color: var(--tsgp-muted); display: block; font-size: 8px; font-weight: 700; letter-spacing: .22em; line-height: 1; margin-bottom: 6px; text-transform: uppercase; }
.tsgp-meta-cell strong { color: var(--tsgp-teal); display: block; font-family: var(--tsgp-display); font-size: 15px; font-weight: 400; line-height: 1; white-space: nowrap; }

/* ---- 3) Table ---- */
.tsgp-table {
  background: #fff;
  border: 1px solid var(--tsgp-border);
  border-collapse: collapse;
  color: var(--tsgp-ink);
  font-size: var(--tsgp-font, 10px);
  line-height: 1.35;
  table-layout: fixed;
  width: 100%;
}
.tsgp-table thead { display: table-header-group; }
.tsgp-table tr { break-inside: avoid; page-break-inside: avoid; }
.tsgp-table th {
  background: var(--tsgp-teal);
  border-bottom: 3px solid var(--tsgp-lime);
  color: #fff;
  font-size: var(--tsgp-th-font, 8.5px);
  font-weight: 700;
  letter-spacing: var(--tsgp-th-spacing, .16em);
  line-height: 1.3;
  overflow-wrap: normal;
  padding: 10px var(--tsgp-th-pad, 12px);
  text-align: left;
  text-transform: uppercase;
  vertical-align: bottom;
}
.tsgp-table .tsgp-group-row th {
  border-bottom: 0;
  color: #c9d6db;
  font-size: 8px;
  letter-spacing: .22em;
  padding: 9px 12px 4px;
  vertical-align: middle;
}
.tsgp-group-row th .tsgp-swatch { display: inline-block; height: 6px; margin-right: 7px; vertical-align: 1px; width: 6px; }
.tsgp-table .tsgp-group-start { border-left: 1px solid rgba(255, 255, 255, .18); }
.tsgp-table td.tsgp-group-start { border-left: 1px solid var(--tsgp-border); }
.tsgp-table td {
  border-bottom: 1px solid var(--tsgp-divider);
  overflow-wrap: anywhere;
  padding: var(--tsgp-cell-pad, 9px 12px);
  text-align: left;
  vertical-align: var(--tsgp-valign, top);
}
.tsgp-table tbody tr:nth-child(odd) td { background: #fff; }
.tsgp-table tbody tr:nth-child(even) td { background: var(--tsgp-zebra); }
.tsgp-table td.is-first { font-weight: 700; }
.tsgp-table td.is-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tsgp-table td.is-empty { color: var(--tsgp-empty); }
.tsgp-table .tsgp-highlight td { color: #b3261e; font-weight: 700; }
.tsgp-table td.tsgp-none { color: var(--tsgp-muted); font-style: italic; padding: 18px 12px; text-align: center; }

/* names + role tags (shared by every table) */
.tsgp-people { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.tsgp-person { align-items: center; display: inline-flex; flex-wrap: wrap; gap: 6px; }
.tsgp-tag {
  background: var(--tsgp-lime);
  color: var(--tsgp-teal);
  display: inline-block;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: .14em;
  line-height: 1.2;
  padding: 2px 5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.tsgp-tag.is-guide { background: var(--tsgp-cyan); }

/* ---- per-report extras (Rooming Details) ---- */
.tsgp-table td.tsgp-c-strong { font-weight: 600; }
.tsgp-table td.tsgp-c-nowrap { white-space: nowrap; }
.tsgp-table td.tsgp-c-notes:not(.is-empty) { color: #8a989d; }
.tsgp-outline-tag {
  border: 1px solid var(--tsgp-border);
  color: inherit;
  display: inline-block;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .12em;
  line-height: 1.3;
  padding: 2px 7px;
  text-transform: uppercase;
  white-space: nowrap;
}
/* a room with no travellers recedes: the whole row's text turns grey */
.tsgp-table tr.tsgp-row-empty td,
.tsgp-table tr.tsgp-row-empty td.tsgp-c-notes { color: var(--tsgp-empty); }

/* ---- per-report extras (Travelers) ---- */
.tsgp-person.is-stacked { align-items: flex-start; display: flex; flex-direction: column; flex-wrap: nowrap; gap: 3px; }
.tsgp-missing-tag {
  border: 1px solid var(--tsgp-orange);
  color: #b8481a;
  display: inline-block;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .12em;
  line-height: 1.3;
  padding: 2px 5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.tsgp-table td.tsgp-c-email { min-width: 150px; overflow-wrap: anywhere; }
.tsgp-med-flag {
  background: #fde6f6;
  color: #8a1f6c;
  display: inline-block;
  font-weight: 600;
  line-height: 1.4;
  padding: 4px 7px;
}
.tsgp-med-none { color: #3d6b2a; font-weight: 600; }

/* ---- per-report extras (Flight Details) ---- */
.tsgp-table.is-tabular td { font-variant-numeric: tabular-nums; }
.tsgp-table td.tsgp-c-nowrap .tsgp-person { flex-wrap: nowrap; }
.tsgp-time { color: #0b3545; font-family: var(--tsgp-display); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.tsgp-flight-tag {
  border: 1px solid var(--tsgp-cyan);
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.3;
  padding: 2px 7px;
  white-space: nowrap;
}

/* ---- 4) Footer ---- */
.tsgp-footer {
  align-items: center;
  border-top: 1px solid var(--tsgp-border);
  color: var(--tsgp-muted);
  display: flex;
  font-size: 8.5px;
  font-weight: 600;
  justify-content: space-between;
  letter-spacing: .18em;
  padding-top: 10px;
  text-transform: uppercase;
}
.tsgp-footer-bars { align-items: center; display: flex; gap: 6px; }
.tsgp-footer-bars i { display: block; height: 3px; width: 18px; }
.tsgp-footer-bars i:nth-child(1) { background: var(--tsgp-lime); }
.tsgp-footer-bars i:nth-child(2) { background: var(--tsgp-cyan); }
.tsgp-footer-bars i:nth-child(3) { background: var(--tsgp-magenta); }
.tsgp-footer-bars i:nth-child(4) { background: var(--tsgp-orange); }
.tsgp-footer > span { flex: 1 1 0; }
.tsgp-footer > span:last-child { text-align: right; }
.tsgp-footer > .tsgp-footer-bars { flex: 0 0 auto; }

/* offscreen copy used only to estimate the page count */
.tsgp-measure { left: -10000px; position: absolute; top: 0; visibility: hidden; width: 1036px; }

@media print {
  html, body, body.is-printing { background: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.is-printing #print-root { padding: 0 !important; }
}

/* ---- per-report extras (remaining table exports) ---- */
.tsgp-owed { color: #b8481a; font-weight: 700; }
