/* ─── Print stylesheet ──────────────────────────────────────
   1) Per-element rules apply to /clients/{id}/print
   2) @media print rules override for actual paper output
   ─────────────────────────────────────────────────────────── */

.print-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: #1a1a1a;
  background: #fff;
  margin: 1.5rem auto;
  max-width: 900px;
  padding: 0 1.5rem;
  line-height: 1.4;
}

.print-toolbar {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding-bottom: 1rem;
  border-bottom: 1px solid #ddd;
  margin-bottom: 1.25rem;
}

.print-header h1 {
  font-size: 1.25rem;
  margin: 0 0 0.25rem;
}
.print-meta {
  margin: 0 0 1.25rem;
  color: #555;
  font-size: 0.875rem;
}

.print-section {
  margin-bottom: 1.5rem;
  page-break-inside: avoid;
}
.print-section h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid #1a1a1a;
}
.print-section h3 {
  font-size: 0.875rem;
  margin: 0.75rem 0 0.25rem;
  color: #555;
}

.print-kv {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.print-kv th, .print-kv td {
  padding: 0.35rem 0.5rem;
  vertical-align: top;
  border: 1px solid #ccc;
}
.print-kv th {
  background: #f4f3ef;
  text-align: left;
  font-weight: 600;
  width: 18%;
}

.print-block {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}
.print-block p {
  margin: 0.25rem 0;
  white-space: pre-wrap;
}

.print-history {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.print-history th, .print-history td {
  padding: 0.35rem 0.5rem;
  border: 1px solid #ccc;
  vertical-align: top;
  text-align: left;
}
.print-history th {
  background: #f4f3ef;
}
.print-history .col-date { width: 110px; white-space: nowrap; }
.print-history .wrap { white-space: pre-wrap; word-break: break-word; }
.print-history tbody tr { page-break-inside: avoid; }

.print-footer {
  margin-top: 2rem;
  padding-top: 0.5rem;
  border-top: 1px solid #ddd;
  text-align: center;
  color: #888;
  font-size: 0.75rem;
}

/* ─── @media print: paper output rules ─── */
@media print {
  @page { margin: 1.5cm; }
  body, .print-body { margin: 0; padding: 0; background: #fff; }
  .no-print, .topnav, .footer, .toolbar, .pager, .actions,
  .form-actions, .filter-bar, button, .btn, .btn-link,
  .logout-form, nav.topnav { display: none !important; }
  a { color: #1a1a1a; text-decoration: none; }
  .print-section { page-break-inside: avoid; }
  .print-history tbody tr { page-break-inside: avoid; }
  table { page-break-inside: auto; }
  thead { display: table-header-group; }
}
