/* A client's weekly report (planning/36_Client_Reports.md): the client copy, set as a document, and beside it on the
   report's page the box of what it leaves out. The copy's own page prints it alone (CR-5), with no browser header or
   footer: the page has no margin for them to go in, so the install's address never reaches the client. The copy keeps
   its own margins on every page instead. */

.client-report { display: grid; grid-template-columns: minmax(0, 760px) 320px; gap: var(--space-6); align-items: start; }

.client-report__box {
  position: sticky; top: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  font-size: var(--text-sm);
}
.client-report__items { display: flex; flex-direction: column; gap: var(--space-2); padding-inline-start: var(--space-4); }

@media (max-width: 1100px) {
  .client-report { grid-template-columns: minmax(0, 1fr); }
  .client-report__box { position: static; }
}

.client-copy {
  display: flex; flex-direction: column; gap: var(--space-5);
  max-width: 760px; padding: var(--space-6);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.client-copy h1 { font-size: var(--text-xl); line-height: var(--leading-xl); }
.client-copy h2 { font-size: var(--text-lg); line-height: var(--leading-lg); }
.client-copy__header { display: flex; flex-direction: column; gap: var(--space-1); }
.client-copy__from { color: var(--text-secondary); font-weight: 600; }
.client-copy__meta, .client-copy__note { color: var(--text-secondary); font-size: var(--text-sm); }
.client-copy__opening { font-size: var(--text-md); line-height: var(--leading-md); }
.client-copy__line, .client-copy__section { display: flex; flex-direction: column; gap: var(--space-3); }
.client-copy__line + .client-copy__line, .client-copy__section { padding-top: var(--space-5); border-top: 1px solid var(--border); }
.client-copy__zone { color: var(--text-secondary); font-size: var(--text-sm); font-weight: 400; }

.client-copy__table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.client-copy__table th, .client-copy__table td { padding: 6px var(--space-2); text-align: left; border-bottom: 1px solid var(--border); }
.client-copy__table thead th { color: var(--text-secondary); font-size: var(--text-xs); font-weight: 500; vertical-align: bottom; }
.client-copy__table tbody th { font-weight: 500; }
.client-copy__table .numeric { text-align: right; white-space: nowrap; }
.client-copy__table .client-copy__group { text-align: center; border-bottom: 0; }

.client-copy__notes, .client-copy__list { display: flex; flex-direction: column; gap: var(--space-1); padding-inline-start: var(--space-4); }
.client-copy__notes { color: var(--text-secondary); font-size: var(--text-sm); }
.client-copy__notes strong { color: var(--text); font-weight: 500; }

.client-copy__footer {
  display: flex; flex-direction: column; gap: var(--space-1);
  padding-top: var(--space-4); border-top: 1px solid var(--border);
  color: var(--text-secondary); font-size: var(--text-xs); line-height: var(--leading-xs);
}

/* The copy's own page: the copy and, on screen only, the way back and the button to print. */
.client-copy-page { min-height: 100vh; padding: 0 var(--space-4); background: var(--surface-page); }
.client-copy-page__bar { display: flex; justify-content: space-between; gap: var(--space-3); max-width: 760px; margin: var(--space-5) auto var(--space-3); }
.client-copy-page .client-copy { margin: 0 auto var(--space-8); }

@media (max-width: 640px) {
  .client-copy { padding: var(--space-4); }
  .client-copy-page { padding: 0 var(--space-2); }
}

@page client-copy { margin: 0; }

/* The report's page prints only where the copy prints from: the copy beside the box mustn't go out together. */
@media print {
  .content:has(> .client-report) > :not(.client-report__print-note) { display: none; }
}

@media print {
  .client-copy-page { page: client-copy; min-height: 0; padding: 0; background: #fff; }
  .client-copy-page__bar { display: none; }
  .client-copy-page .client-copy {
    max-width: none; margin: 0; padding: 16mm 18mm; border: 0; border-radius: 0;
    box-decoration-break: clone; -webkit-box-decoration-break: clone; /* the margins again on every page */
    --surface: #fff; --border: #bbb; --text: #000; --text-secondary: #333;
    color: #000;
  }
  .client-copy__table tr, .client-copy__notes li, .client-copy__list li { break-inside: avoid; }
  .client-copy h2, .client-copy h3 { break-after: avoid; }
}
